Debian Codegraph @

libgomp/testsuite/libgomp.c++/pr66702-2.C

raw
1 // PR middle-end/66702
2 // { dg-do run { target vect_simd_clones } }
3 // { dg-options "-O2" }
4 // { dg-additional-options "-msse2" { target sse2_runtime } }
5 // { dg-additional-options "-mavx" { target avx_runtime } }
6
7 struct S { int s1, s2; };
8 struct T { T (); ~T (); int t; };
9
10 T::T () : t(0) {}
11 T::~T () {}
12
13 #pragma omp declare simd uniform(b, c) notinbranch
14 __attribute__((noinline)) int
15 foo (int a, S b, T c)
16 {
17 a++;
18 b.s1++;
19 b.s2++;
20 c.t++;
21 return a + b.s1 + b.s2 + c.t;
22 }
23
24 int
25 main ()
26 {
27 int r = 0;
28 S s = { 2, 3 };
29 T t;
30 #pragma omp simd reduction(+:r)
31 for (int i = 0; i < 64; i++)
32 r += foo (i, s, t);
33 if (r != 2592)
34 __builtin_abort ();
35 }