Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr117159.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-Os -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
4
5 typedef __attribute__((__vector_size__ (4))) unsigned char W;
6 typedef __attribute__((__vector_size__ (64))) int V;
7 typedef __attribute__((__vector_size__ (64))) long long Vq;
8
9 W w;
10 V v;
11 Vq vq;
12
13 static inline W
14 foo (short m)
15 {
16 unsigned k = __builtin_ia32_pcmpgtq512_mask ((Vq) { }, vq, m);
17 W r = (W) k + w;
18 return r;
19 }
20
21 static inline W
22 foo1 (short m)
23 {
24 unsigned k = __builtin_ia32_pcmpgtd512_mask ((V) {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, v, m);
25 W r = (W) k + w;
26 return r;
27 }
28
29 int
30 main ()
31 {
32 if (!__builtin_cpu_supports ("avx512bw"))
33 return 0;
34 W y = foo1 (65535);
35 if (!y[0] || !y[1] || y[2] || y[3])
36 __builtin_abort();
37 W x = foo (65535);
38 if (x[0] || x[1] || x[2] || x[3])
39 __builtin_abort();
40
41 return 0;
42 }