| 1 |
/* { dg-additional-options "-fopenmp-simd" } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
int v; |
| 6 |
|
| 7 |
__attribute__((noipa)) int |
| 8 |
foo (int *a) |
| 9 |
{ |
| 10 |
int x = 5; |
| 11 |
#pragma omp simd lastprivate (conditional: x) safelen (1) |
| 12 |
for (int i = 0; i < 128; i++) |
| 13 |
if (a[i]) |
| 14 |
x = a[i]; |
| 15 |
return x; |
| 16 |
} |
| 17 |
|
| 18 |
__attribute__((noipa)) int |
| 19 |
bar (int *a, int *b) |
| 20 |
{ |
| 21 |
int x = 0; |
| 22 |
#pragma omp simd lastprivate (conditional: x, v) if (0) |
| 23 |
for (int i = 16; i < 128; ++i) |
| 24 |
{ |
| 25 |
if (a[i]) |
| 26 |
x = a[i]; |
| 27 |
if (b[i]) |
| 28 |
v = b[i] + 10; |
| 29 |
} |
| 30 |
return x; |
| 31 |
} |
| 32 |
|
| 33 |
int |
| 34 |
main () |
| 35 |
{ |
| 36 |
int a[128], b[128], i; |
| 37 |
check_vect (); |
| 38 |
for (i = 0; i < 128; i++) |
| 39 |
{ |
| 40 |
a[i] = ((i % 11) == 2) ? i + 10 : 0; |
| 41 |
asm volatile ("" : "+g" (i)); |
| 42 |
b[i] = ((i % 13) == 5) ? i * 2 : 0; |
| 43 |
} |
| 44 |
if (foo (a) != 133) |
| 45 |
abort (); |
| 46 |
if (bar (b, a) != 244) |
| 47 |
abort (); |
| 48 |
if (v != 143) |
| 49 |
abort (); |
| 50 |
return 0; |
| 51 |
} |