| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O3 -mavx2 -mno-avx512f -fdump-tree-vect-details" } */ |
| 3 |
|
| 4 |
void foo (int n, int *off, double *a) |
| 5 |
{ |
| 6 |
const int m = 32; |
| 7 |
|
| 8 |
for (int j = 0; j < n/m; ++j) |
| 9 |
{ |
| 10 |
int const start = j*m; |
| 11 |
int const end = (j+1)*m; |
| 12 |
|
| 13 |
#pragma GCC ivdep |
| 14 |
for (int i = start; i < end; ++i) |
| 15 |
{ |
| 16 |
a[off[i]] = a[i] < 0 ? a[i] : 0; |
| 17 |
} |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
/* Make sure the cost model selects SSE vectors rather than AVX to avoid |
| 22 |
too many scalar ops for the address computes in the loop. */ |
| 23 |
/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" { target { ! ia32 } } } } */ |