c++: adjust some tests for modules
[official-gcc.git] / gcc / testsuite / gcc.dg / gomp / openmp-simd-2.c
blobe66806845b7d245e4fdb995cba355aa5725575fc
1 /* { dg-do compile } */
2 /* { dg-options "-fopenmp-simd -fdump-tree-original" } */
4 extern void abort ();
5 int a[1024] __attribute__((aligned (32))) = { 1 };
6 struct S { int s; };
7 #pragma omp declare reduction (+:struct S:omp_out.s += omp_in.s)
8 #pragma omp declare reduction (foo:struct S:omp_out.s += omp_in.s)
9 #pragma omp declare reduction (foo:int:omp_out += omp_in)
11 __attribute__((noinline, noclone)) int
12 foo (void)
14 int i, u = 0;
15 struct S s, t;
16 s.s = 0; t.s = 0;
17 #pragma omp simd aligned(a : 32) reduction(+:s) reduction(foo:t, u)
18 for (i = 0; i < 1024; i++)
20 int x = a[i];
21 s.s += x;
22 t.s += x;
23 u += x;
25 if (t.s != s.s || u != s.s)
26 abort ();
27 return s.s;
31 void bar(int n, float *a, float *b)
33 int i;
34 #pragma omp parallel for simd num_threads(4) safelen(64)
35 for (i = 0; i < n ; i++)
36 a[i] = b[i];
39 /* { dg-final { scan-tree-dump-times "pragma omp simd reduction\\(u\\) reduction\\(t\\) reduction\\(\\+:s\\) aligned\\(a:32\\)" 1 "original" } } */
40 /* { dg-final { scan-tree-dump-times "pragma omp simd safelen\\(64\\)" 1 "original" } } */
41 /* { dg-final { scan-tree-dump-not "omp parallel" "original" } } */
42 /* { dg-final { scan-tree-dump-not "omp for" "original" } } */