| 1 |
/* { dg-require-effective-target vect_double } */ |
| 2 |
/* { dg-require-effective-target vect_intdouble_cvt } */ |
| 3 |
|
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
double image[40]; |
| 7 |
|
| 8 |
void __attribute__((noipa)) |
| 9 |
foo (void) |
| 10 |
{ |
| 11 |
for (int i = 0; i < 20; i++) |
| 12 |
{ |
| 13 |
double suma = 0; |
| 14 |
double sumb = 0; |
| 15 |
for (int j = 0; j < 40; j++) |
| 16 |
{ |
| 17 |
suma += j+i; |
| 18 |
sumb += j+i; |
| 19 |
} |
| 20 |
image[2*i] = suma; |
| 21 |
image[2*i+1] = sumb; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
int main () |
| 26 |
{ |
| 27 |
check_vect (); |
| 28 |
|
| 29 |
foo (); |
| 30 |
|
| 31 |
#pragma GCC novector |
| 32 |
for (int i = 0; i < 20; i++) |
| 33 |
{ |
| 34 |
double suma = 0; |
| 35 |
double sumb = 0; |
| 36 |
for (int j = 0; j < 40; j++) |
| 37 |
{ |
| 38 |
suma += j+i; |
| 39 |
sumb += j+i; |
| 40 |
asm ("" : "+g" (suma)); |
| 41 |
asm ("" : "+g" (sumb)); |
| 42 |
} |
| 43 |
if (image[2*i] != suma |
| 44 |
|| image[2*i+1] != sumb) |
| 45 |
abort (); |
| 46 |
} |
| 47 |
|
| 48 |
return 0; |
| 49 |
} |
| 50 |
|
| 51 |
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ |
| 52 |
/* We don't yet support SLP inductions for variable length vectors. */ |
| 53 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_variable_length } } } */ |