| 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 |
void |
| 8 |
bar (int &a, int &b, int *&c, int &d) |
| 9 |
{ |
| 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; |
| 16 |
} |
| 17 |
|
| 18 |
void (*volatile barp) (int &, int &, int *&, int &) = bar; |
| 19 |
|
| 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) |
| 23 |
{ |
| 24 |
a++; |
| 25 |
b++; |
| 26 |
c += 8; |
| 27 |
d += 2; |
| 28 |
barp (a, b, c, d); |
| 29 |
return a + b + *c + d; |
| 30 |
} |
| 31 |
|
| 32 |
volatile int e = 5; |
| 33 |
int c[64] __attribute__((aligned (32))); |
| 34 |
|
| 35 |
int |
| 36 |
main () |
| 37 |
{ |
| 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 (); |
| 50 |
} |