1 // { dg-require-effective-target size32plus }
2 // { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" }
3 // { dg-additional-options "-msse2" { target sse2_runtime } }
4 // { dg-additional-options "-mavx" { target avx_runtime } }
5 // { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } }
7 extern "C" void abort ();
13 inline S & operator= (const S &);
31 S::operator= (const S &x)
43 S r, a[1024], b[1024];
45 #pragma omp declare reduction (+: S: omp_out.s += omp_in.s)
46 #pragma omp declare reduction (plus: S: omp_out.s += omp_in.s) initializer (ini (omp_priv))
48 __attribute__((noipa)) void
49 foo (S *a, S *b, S &r)
51 #pragma omp for simd simdlen (1) reduction (inscan, +:r)
52 for (int i = 0; i < 1024; i++)
55 #pragma omp scan exclusive(r)
60 __attribute__((noipa)) S
65 #pragma omp for simd if (0) reduction (inscan, plus:s)
66 for (int i = 0; i < 1024; i++)
69 #pragma omp scan exclusive(s)
75 __attribute__((noipa)) void
76 baz (S *a, S *b, S &r)
78 #pragma omp parallel for simd reduction (inscan, +:r)
79 for (int i = 0; i < 1024; i++)
82 #pragma omp scan exclusive(r)
87 __attribute__((noipa)) S
91 #pragma omp parallel for simd reduction (inscan, plus:s)
92 for (int i = 0; i < 1024; i++)
95 #pragma omp scan exclusive(s)
105 for (int i = 0; i < 1024; ++i)
113 if (r.s != 1024 * 1023 / 2)
115 for (int i = 0; i < 1024; ++i)
123 if (bar ().s != 1024 * 1023)
126 for (int i = 0; i < 1024; ++i)
134 if (r.s != 1024 * 1023 / 2)
137 for (int i = 0; i < 1024; ++i)
145 if (qux ().s != 1024 * 1023)
148 for (int i = 0; i < 1024; ++i)