| 1 |
/* { dg-additional-options "-mavx2" { target avx2 } } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
void __attribute__((noipa)) |
| 6 |
foo (unsigned * __restrict x, int * __restrict flag) |
| 7 |
{ |
| 8 |
for (int i = 0; i < 32; ++i) |
| 9 |
{ |
| 10 |
if (flag[2*i+0]) |
| 11 |
x[2*i+0] = x[2*i+0] + 3; |
| 12 |
if (flag[2*i+1]) |
| 13 |
x[2*i+1] = x[2*i+1] + 177; |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
unsigned x[16]; |
| 18 |
int flag[32] = { 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, |
| 19 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 20 |
unsigned res[16] = { 3, 177, 0, 0, 0, 177, 3, 0, 3, 177, 0, 0, 0, 177, 3, 0 }; |
| 21 |
|
| 22 |
int |
| 23 |
main () |
| 24 |
{ |
| 25 |
check_vect (); |
| 26 |
|
| 27 |
foo (x, flag); |
| 28 |
|
| 29 |
if (__builtin_memcmp (x, res, sizeof (x)) != 0) |
| 30 |
abort (); |
| 31 |
|
| 32 |
#pragma GCC novector |
| 33 |
for (int i = 0; i < 32; ++i) |
| 34 |
if (flag[i] != 0 && flag[i] != 1) |
| 35 |
abort (); |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |
| 39 |
|
| 40 |
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" { target { vect_masked_store && vect_masked_load } } } } */ |