| 1 |
/* { dg-require-effective-target vect_simd_clones } */ |
| 2 |
/* { dg-additional-options "-fopenmp-simd" } */ |
| 3 |
/* { dg-additional-options "-mavx" { target avx_runtime } } */ |
| 4 |
|
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#ifndef N |
| 8 |
#define N 1024 |
| 9 |
#endif |
| 10 |
|
| 11 |
int array[N]; |
| 12 |
|
| 13 |
#pragma omp declare simd linear(val(b):-3), notinbranch |
| 14 |
__attribute__((noinline)) int |
| 15 |
foo (int a, int b) |
| 16 |
{ |
| 17 |
return a + b; |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__((noinline, noclone)) void |
| 21 |
bar () |
| 22 |
{ |
| 23 |
int i; |
| 24 |
#pragma omp simd |
| 25 |
for (i = 0; i < N; ++i) |
| 26 |
array[i] = foo (i >> 1, -i * 3); |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
main () |
| 31 |
{ |
| 32 |
int i; |
| 33 |
check_vect (); |
| 34 |
bar (); |
| 35 |
#pragma GCC novector |
| 36 |
for (i = 0; i < N; i++) |
| 37 |
if (array[i] != ((i >> 1) + (-3 * i))) |
| 38 |
abort (); |
| 39 |
return 0; |
| 40 |
} |