| 1 |
/* { dg-lto-do link } */ |
| 2 |
/* { dg-require-effective-target vect_simd_clones } */ |
| 3 |
/* { dg-require-effective-target avx2 } */ |
| 4 |
/* { dg-lto-options { { -fopenmp-simd -O3 -ffast-math -mavx2 -flto -flto-partition=max } } } */ |
| 5 |
|
| 6 |
#define SIZE 4096 |
| 7 |
float x[SIZE]; |
| 8 |
|
| 9 |
|
| 10 |
#pragma omp declare simd |
| 11 |
float |
| 12 |
__attribute__ ((noinline)) |
| 13 |
my_mul (float x, float y) { |
| 14 |
return x * y; |
| 15 |
} |
| 16 |
|
| 17 |
__attribute__ ((noinline)) |
| 18 |
int foo () |
| 19 |
{ |
| 20 |
int i = 0; |
| 21 |
#pragma omp simd safelen (16) |
| 22 |
for (i = 0; i < SIZE; i++) |
| 23 |
x[i] = my_mul ((float)i, 9932.3323); |
| 24 |
return (int)x[0]; |
| 25 |
} |
| 26 |
|
| 27 |
int main () |
| 28 |
{ |
| 29 |
int i = 0; |
| 30 |
for (i = 0; i < SIZE; i++) |
| 31 |
x[i] = my_mul ((float) i, 9932.3323); |
| 32 |
foo (); |
| 33 |
return (int)x[0]; |
| 34 |
} |
| 35 |
|