| 1 |
/* Fix for PR119351 alignment peeling with vectors and VLS. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ |
| 4 |
/* { dg-final { check-function-bodies "**" "" ""} } */ |
| 5 |
|
| 6 |
#define N 512 |
| 7 |
#define START 1 |
| 8 |
#define END 505 |
| 9 |
|
| 10 |
int x[N] __attribute__((aligned(32))); |
| 11 |
|
| 12 |
/* |
| 13 |
** foo: |
| 14 |
** ... |
| 15 |
** ld1w z[0-9]+.s, p[0-9]+/z, \[x[0-9], x[0-9], lsl 2\] |
| 16 |
** cmple p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0 |
| 17 |
** ptest p[0-9]+, p[0-9]+.b |
| 18 |
** ... |
| 19 |
*/ |
| 20 |
|
| 21 |
int __attribute__((noipa)) |
| 22 |
foo (void) |
| 23 |
{ |
| 24 |
int z = 0; |
| 25 |
for (unsigned int i = START; i < END; ++i) |
| 26 |
{ |
| 27 |
z++; |
| 28 |
if (x[i] > 0) |
| 29 |
continue; |
| 30 |
|
| 31 |
return z; |
| 32 |
} |
| 33 |
return -1; |
| 34 |
} |
| 35 |
|
| 36 |
/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ |
| 37 |
/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ |
| 38 |
/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ |
| 39 |
|