| 1 |
/* PR tree-optimization/68128 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Ofast -fopenmp -fdump-tree-vect-details" } */ |
| 4 |
/* { dg-additional-options "-mavx" { target i?86-*-* x86_64-*-* } } */ |
| 5 |
|
| 6 |
/* Make sure the following loop is vectorized even when not using |
| 7 |
firstprivate variables for scalar vars that are not modified |
| 8 |
in the parallel region. */ |
| 9 |
|
| 10 |
void |
| 11 |
foo (float *u, float v, float w, float x, float y, float z, float t) |
| 12 |
{ |
| 13 |
int i, j, k, l; |
| 14 |
float a, *b, c, s, e; |
| 15 |
#pragma omp parallel for private (i, j, k, l, a, b, c, s, e) |
| 16 |
for (j = 0; j < 1024; j++) |
| 17 |
{ |
| 18 |
k = j * 64; |
| 19 |
l = j * 64 + 63; |
| 20 |
a = v + j * w; |
| 21 |
b = u + j * 64; |
| 22 |
for (i = k; i <= l; i++, b++, a += w) |
| 23 |
{ |
| 24 |
c = a * a + y; |
| 25 |
s = (1.f - c * x) * (1.f - c * x); |
| 26 |
e = t * (1 / __builtin_sqrtf (c)) * s; |
| 27 |
*b += (c < z ? e : 0); |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { target i?86-*-* x86_64-*-* } } } */ |