| 1 |
/* { dg-add-options vect_early_break } */ |
| 2 |
/* { dg-require-effective-target vect_early_break_hw } */ |
| 3 |
/* { dg-require-effective-target vect_long_long } */ |
| 4 |
|
| 5 |
/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ |
| 6 |
|
| 7 |
#include "tree-vect.h" |
| 8 |
|
| 9 |
long x[9]; |
| 10 |
long a[20]; |
| 11 |
struct { long x; long b[40]; } b; |
| 12 |
int __attribute__((noipa)) |
| 13 |
foo (int n) |
| 14 |
{ |
| 15 |
int i = 0; |
| 16 |
int k = 0; |
| 17 |
do |
| 18 |
{ |
| 19 |
if (x[k++]) // early exit, loop upper bound is 8 because of this |
| 20 |
break; |
| 21 |
a[i] = b.b[2*i]; // the misaligned 2*i access causes peeling for gaps |
| 22 |
} |
| 23 |
while (++i < n); |
| 24 |
return i; |
| 25 |
} |
| 26 |
|
| 27 |
int main() |
| 28 |
{ |
| 29 |
check_vect (); |
| 30 |
|
| 31 |
x[8] = 1; |
| 32 |
if (foo (20) != 8) |
| 33 |
__builtin_abort (); |
| 34 |
return 0; |
| 35 |
} |
| 36 |
|