Fix xfail for 32-bit hppa*-*-* in gcc.dg/pr84877.c
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / simd-8.C
blobbc13254fdd3dd236037c2f347dc61a828f9cdab4
1 // PR libgomp/58482
2 // { dg-do run }
3 // { dg-additional-options "-msse2" { target sse2_runtime } }
4 // { dg-additional-options "-mavx" { target avx_runtime } }
6 extern "C" void abort ();
7 int a[1024] __attribute__((aligned (32))) = { 1 };
8 struct S
10   int s;
11   S () : s (0) {}
12   ~S () {}
14 #pragma omp declare reduction (+:S:omp_out.s += omp_in.s)
15 #pragma omp declare reduction (foo:S:omp_out.s += omp_in.s)
16 #pragma omp declare reduction (foo:int:omp_out += omp_in)
18 __attribute__((noinline, noclone)) int
19 foo ()
21   int i, u = 0;
22   S s, t;
23   #pragma omp parallel for simd aligned(a : 32) reduction(+:s) \
24                                 reduction(foo:t, u)
25   for (i = 0; i < 1024; i++)
26     {
27       int x = a[i];
28       s.s += x;
29       t.s += x;
30       u += x;
31     }
32   if (t.s != s.s || u != s.s)
33     abort ();
34   return s.s;
37 int
38 main ()
40   int i;
41   for (i = 0; i < 1024; i++)
42     a[i] = (i & 31) + (i / 128);
43   int s = foo ();
44   if (s != 19456)
45     abort ();