]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/g++.dg/gomp/openmp-simd-2.C
re PR c++/60228 (ICE using lambda in #pragma omp declare reduction)
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / gomp / openmp-simd-2.C
CommitLineData
6d7f7e0a
TB
1/* { dg-do compile } */
2/* { dg-options "-fopenmp-simd -fdump-tree-original" } */
3
4extern void abort ();
5int a[1024] __attribute__((aligned (32))) = { 1 };
6struct 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)
10
11__attribute__((noinline, noclone)) int
12foo (void)
13{
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++)
19 {
20 int x = a[i];
21 s.s += x;
22 t.s += x;
23 u += x;
24 }
25 if (t.s != s.s || u != s.s)
26 abort ();
27 return s.s;
28}
29
30
31void bar(int n, float *a, float *b)
32{
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];
37}
38
6d7f7e0a
TB
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" } } */