2018-01-22 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / pr66702-1.C
blob4d542599b34abbc0f920f35615df8e1b4e2f0146
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 } }
7 void
8 bar (int &a, int &b, int *&c, int &d)
10   volatile int x;
11   int *volatile y;
12   x = a; a = x;
13   x = b; b = x;
14   y = c; c = y;
15   x = d; d = x;
18 void (*volatile barp) (int &, int &, int *&, int &) = bar;
20 #pragma omp declare simd uniform(b, c) linear(d:2) aligned(c:32) notinbranch
21 int
22 foo (int a, int b, int *c, int d)
24   a++;
25   b++;
26   c += 8;
27   d += 2;
28   barp (a, b, c, d);
29   return a + b + *c + d;
32 volatile int e = 5;
33 int c[64] __attribute__((aligned (32)));
35 int
36 main ()
38   int d = 7, r = 0;
39   int b = e;
40   for (int i = 0; i < 64; i++)
41     c[i] = i;
42   #pragma omp simd reduction(+:r) linear(d:2)
43   for (int i = 0; i < 64; i++)
44     {
45       r += foo (i, b, c, d);
46       d += 2;
47     }
48   if (r != 7584)
49     __builtin_abort ();