* es.po: Update.
[official-gcc.git] / libgomp / testsuite / libgomp.c / simd-4.c
blob7850cb7f3718854f93b61bbbed997d6cf12802d0
1 /* { dg-do run } */
2 /* { dg-additional-options "-msse2" { target sse2_runtime } } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 extern void abort ();
6 int a[1024] __attribute__((aligned (32))) = { 1 };
7 struct S { int s; };
8 #pragma omp declare reduction (+:struct S:omp_out.s += omp_in.s)
9 #pragma omp declare reduction (foo:struct S:omp_out.s += omp_in.s)
10 #pragma omp declare reduction (foo:int:omp_out += omp_in)
12 __attribute__((noinline, noclone)) int
13 foo (void)
15 int i, u = 0;
16 struct S s, t;
17 s.s = 0; t.s = 0;
18 #pragma omp simd aligned(a : 32) reduction(+:s) reduction(foo:t, u)
19 for (i = 0; i < 1024; i++)
21 int x = a[i];
22 s.s += x;
23 t.s += x;
24 u += x;
26 if (t.s != s.s || u != s.s)
27 abort ();
28 return s.s;
31 int
32 main ()
34 int i;
35 for (i = 0; i < 1024; i++)
36 a[i] = (i & 31) + (i / 128);
37 int s = foo ();
38 if (s != 19456)
39 abort ();
40 return 0;