| 1 |
/* { dg-additional-options "-fopenmp-simd" } */ |
| 2 |
/* { dg-additional-options "-mavx" { target avx_runtime } } */ |
| 3 |
|
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 1024 |
| 7 |
int a[N]; |
| 8 |
int x; |
| 9 |
|
| 10 |
__attribute__((noipa)) int |
| 11 |
bar (void) |
| 12 |
{ |
| 13 |
return x; |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__((noipa)) void |
| 17 |
foo (void) |
| 18 |
{ |
| 19 |
#pragma omp simd if (bar ()) |
| 20 |
for (int i = 0; i < N; ++i) |
| 21 |
a[i] = a[i] + 1; |
| 22 |
} |
| 23 |
|
| 24 |
__attribute__((noipa)) void |
| 25 |
baz (void) |
| 26 |
{ |
| 27 |
int c = 0; |
| 28 |
#pragma omp simd if (c) |
| 29 |
for (int i = 0; i < N; ++i) |
| 30 |
a[i] = a[i] + 1; |
| 31 |
} |
| 32 |
|
| 33 |
__attribute__((noipa)) void |
| 34 |
qux (void) |
| 35 |
{ |
| 36 |
int c = 1; |
| 37 |
#pragma omp simd if (c) |
| 38 |
for (int i = 0; i < N; ++i) |
| 39 |
a[i] = a[i] + 1; |
| 40 |
} |
| 41 |
|
| 42 |
int |
| 43 |
main () |
| 44 |
{ |
| 45 |
check_vect (); |
| 46 |
foo (); |
| 47 |
#pragma GCC novector |
| 48 |
for (int i = 0; i < N; ++i) |
| 49 |
if (a[i] != 1) |
| 50 |
abort (); |
| 51 |
x = 1; |
| 52 |
foo (); |
| 53 |
#pragma GCC novector |
| 54 |
for (int i = 0; i < N; ++i) |
| 55 |
if (a[i] != 2) |
| 56 |
abort (); |
| 57 |
baz (); |
| 58 |
#pragma GCC novector |
| 59 |
for (int i = 0; i < N; ++i) |
| 60 |
if (a[i] != 3) |
| 61 |
abort (); |
| 62 |
qux (); |
| 63 |
#pragma GCC novector |
| 64 |
for (int i = 0; i < N; ++i) |
| 65 |
if (a[i] != 4) |
| 66 |
abort (); |
| 67 |
return 0; |
| 68 |
} |