Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr112816.c

raw
1 /* PR target/112816 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -mno-avx512f -masm=att" } */
4 /* { dg-final { scan-assembler-times "psrad\t\\\$31," 2 } } */
5 /* { dg-final { scan-assembler-not "pcmpeqd\t" } } */
6
7 #define N 4
8 struct S { float x[N]; };
9 struct T { int x[N]; };
10
11 __attribute__((target ("no-sse3,sse2"))) struct T
12 foo (struct S x)
13 {
14 struct T res;
15 for (int i = 0; i < N; ++i)
16 res.x[i] = __builtin_signbit (x.x[i]) ? -1 : 0;
17 return res;
18 }
19
20 __attribute__((target ("avx2"))) struct T
21 bar (struct S x)
22 {
23 struct T res;
24 for (int i = 0; i < N; ++i)
25 res.x[i] = __builtin_signbit (x.x[i]) ? -1 : 0;
26 return res;
27 }