| 1 |
#include "tree-vect.h" |
| 2 |
|
| 3 |
/* This is a load-lane / masked-store-lane test that more reliably |
| 4 |
triggers SLP than SVEs mask_srtuct_store_*.c */ |
| 5 |
|
| 6 |
void __attribute__ ((noipa)) |
| 7 |
test4 (int *__restrict dest, int *__restrict src, |
| 8 |
int *__restrict cond, int bias, int n) |
| 9 |
{ |
| 10 |
for (int i = 0; i < n; ++i) |
| 11 |
{ |
| 12 |
int value0 = src[i * 4] + bias; |
| 13 |
int value1 = src[i * 4 + 1] * bias; |
| 14 |
int value2 = src[i * 4 + 2] + bias; |
| 15 |
int value3 = src[i * 4 + 3] * bias; |
| 16 |
if (cond[i]) |
| 17 |
{ |
| 18 |
dest[i * 4] = value0; |
| 19 |
dest[i * 4 + 1] = value1; |
| 20 |
dest[i * 4 + 2] = value2; |
| 21 |
dest[i * 4 + 3] = value3; |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
int dest[16*4]; |
| 27 |
int src[16*4]; |
| 28 |
int cond[16]; |
| 29 |
const int dest_chk[16*4] = {0, 0, 0, 0, 9, 25, 11, 35, 0, 0, 0, 0, 17, 65, 19, |
| 30 |
75, 0, 0, 0, 0, 25, 105, 27, 115, 0, 0, 0, 0, 33, 145, 35, 155, 0, 0, 0, |
| 31 |
0, 41, 185, 43, 195, 0, 0, 0, 0, 49, 225, 51, 235, 0, 0, 0, 0, 57, 265, 59, |
| 32 |
275, 0, 0, 0, 0, 65, 305, 67, 315}; |
| 33 |
|
| 34 |
int main() |
| 35 |
{ |
| 36 |
check_vect (); |
| 37 |
#pragma GCC novector |
| 38 |
for (int i = 0; i < 16; ++i) |
| 39 |
cond[i] = i & 1; |
| 40 |
#pragma GCC novector |
| 41 |
for (int i = 0; i < 16 * 4; ++i) |
| 42 |
src[i] = i; |
| 43 |
test4 (dest, src, cond, 5, 16); |
| 44 |
#pragma GCC novector |
| 45 |
for (int i = 0; i < 16 * 4; ++i) |
| 46 |
if (dest[i] != dest_chk[i]) |
| 47 |
abort (); |
| 48 |
return 0; |
| 49 |
} |
| 50 |
|
| 51 |
/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target { vect_variable_length && vect_load_lanes } } } } */ |