Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / signbit-5.c
blob0fad56c0ea85feb5dd59ee5b77f591e8e76934fe
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
4 /* This test does not work when the truth type does not match vector type. */
5 /* { dg-additional-options "-mno-avx512f" { target { i?86-*-* x86_64-*-* } } } */
6 /* { dg-additional-options "-march=armv8-a" { target aarch64_sve } } */
7 /* { dg-xfail-run-if "truth type does not match vector type" { amdgcn-*-* } } */
10 #include <stdint.h>
11 #include <limits.h>
12 #include <stdio.h>
14 #ifndef N
15 #define N 65
16 #endif
18 #ifndef TYPE
19 #define TYPE int32_t
20 #endif
22 #ifndef DEBUG
23 #define DEBUG 1
24 #endif
26 #define BASE ((TYPE) -1 < 0 ? -126 : 4)
28 __attribute__ ((noinline, noipa))
29 void fun1(TYPE *x, int n)
31 for (int i = 0; i < n; i++)
32 x[i] = (-x[i]) >> 31;
35 __attribute__ ((noinline, noipa, optimize("O1")))
36 void fun2(TYPE *x, int n)
38 for (int i = 0; i < n; i++)
39 x[i] = (-x[i]) >> 31;
42 int main ()
44 TYPE a[N];
45 TYPE b[N];
47 a[0] = INT_MIN;
48 b[0] = INT_MIN;
50 for (int i = 1; i < N; ++i)
52 a[i] = BASE + i * 13;
53 b[i] = BASE + i * 13;
54 if (DEBUG)
55 printf ("%d: 0x%x\n", i, a[i]);
58 fun1 (a, N);
59 fun2 (b, N);
61 for (int i = 0; i < N; ++i)
63 if (DEBUG)
64 printf ("%d = 0x%x == 0x%x\n", i, a[i], b[i]);
66 if (a[i] != b[i])
67 __builtin_abort ();
69 return 0;