Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512vl-vec-set-2.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512bw } */
3 /* { dg-require-effective-target avx512vl } */
4 /* { dg-options "-O2 -mavx512bw -mavx512vl" } */
5
6
7 #ifndef CHECK
8 #define CHECK "avx512f-check.h"
9 #endif
10
11 #define AVX512VL
12 #define AVX512BW
13
14 #include CHECK
15
16 #include "avx512bw-vec-set-1.c"
17
18 #define CALC_TEST(vtype, type, N, idx) \
19 do \
20 { \
21 int i,val = idx * idx - idx * 3 + 16; \
22 type res[N],exp[N]; \
23 vtype resv; \
24 for (i = 0; i < N; i++) \
25 { \
26 res[i] = i * i - i * 3 + 15; \
27 exp[i] = res[i]; \
28 } \
29 exp[idx] = val; \
30 resv = foo_##vtype (*(vtype *)&res[0], val, idx); \
31 for (i = 0; i < N; i++) \
32 { \
33 if (resv[i] != exp[i]) \
34 abort (); \
35 } \
36 } \
37 while (0)
38
39 static void
40 test_256 (void)
41 {
42 CALC_TEST (v32qi, char, 32, 17);
43 CALC_TEST (v16hi, short, 16, 9);
44 CALC_TEST (v8si, int, 8, 3);
45 CALC_TEST (v4di, long long, 4, 1);
46 }
47
48 static void
49 test_128 (void)
50 {
51 CALC_TEST (v16qi, char, 16, 5);
52 CALC_TEST (v8hi, short, 8, 6);
53 CALC_TEST (v4si, int, 4, 2);
54 CALC_TEST (v2di, long long, 2, 0);
55 }