1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/* { dg-do run } */
/* { dg-require-effective-target avx512f } */
/* { dg-options "-O2 -mavx512f" } */
#include "avx512-check.h"
#include "pr88547-1.c"
#define NUM 512
#define TEST_SIGNED(vtype, type, N, fn, op) \
do \
{ \
union { vtype x[NUM / N]; type i[NUM]; } dst, src1, src2; \
int i, sign = 1; \
type res; \
for (i = 0; i < NUM; i++) \
{ \
src1.i[i] = i * i * sign; \
src2.i[i] = (i + 20) * sign; \
sign = -sign; \
} \
for (i = 0; i < NUM; i += N) \
dst.x[i / N] = fn (src1.x[i / N], src2.x[i / N]); \
\
for (i = 0; i < NUM; i++) \
{ \
res = src1.i[i] op src2.i[i] ? -1 : 0; \
if (res != dst.i[i]) \
abort (); \
} \
} \
while (0)
#define TEST_UNSIGNED(vtype, type, N, fn, op) \
do \
{ \
union { vtype x[NUM / N]; type i[NUM]; } dst, src1, src2; \
int i; \
type res; \
\
for (i = 0; i < NUM; i++) \
{ \
src1.i[i] = i * i; \
src2.i[i] = i + 20; \
if ((i % 4)) \
src2.i[i] |= (1ULL << (sizeof (type) \
* __CHAR_BIT__ - 1)); \
} \
\
for (i = 0; i < NUM; i += N) \
dst.x[i / N] = fn (src1.x[i / N], src2.x[i / N]); \
\
for (i = 0; i < NUM; i++) \
{ \
res = src1.i[i] op src2.i[i] ? -1 : 0; \
if (res != dst.i[i]) \
abort (); \
} \
} \
while (0)
static void
test_512 (void)
{
TEST_SIGNED (v64qi, signed char, 64, f1, <=);
TEST_UNSIGNED (v64uqi, unsigned char, 64, f2, <=);
TEST_SIGNED (v64qi, signed char, 64, f3, >=);
TEST_UNSIGNED (v64uqi, unsigned char, 64, f4, >=);
TEST_SIGNED (v32hi, short int, 32, f5, <=);
TEST_UNSIGNED (v32uhi, unsigned short int, 32, f6, <=);
TEST_SIGNED (v32hi, short int, 32, f7, >=);
TEST_UNSIGNED (v32uhi, unsigned short int, 32, f8, >=);
TEST_SIGNED (v16si, int, 16, f9, <=);
TEST_UNSIGNED (v16usi, unsigned int, 16, f10, <=);
TEST_SIGNED (v16si, int, 16, f11, >=);
TEST_UNSIGNED (v16usi, unsigned int, 16, f12, >=);
TEST_SIGNED (v8di, long long int, 8, f13, <=);
TEST_UNSIGNED (v8udi, unsigned long long int, 8, f14, <=);
TEST_SIGNED (v8di, long long int, 8, f15, >=);
TEST_UNSIGNED (v8udi, unsigned long long int, 8, f16, >=);
}
|