| 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 |
int k = image[2*i]; |
| 16 |
int l = image[2*i+1]; |
| 17 |
for (int j = 0; j < 40; j++) |
| 18 |
{ |
| 19 |
suma += k+i; |
| 20 |
sumb += l+i; |
| 21 |
k++; |
| 22 |
l++; |
| 23 |
} |
| 24 |
image[2*i] = suma; |
| 25 |
image[2*i+1] = sumb; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
int main () |
| 30 |
{ |
| 31 |
check_vect (); |
| 32 |
|
| 33 |
#pragma GCC novector |
| 34 |
for (int i = 0; i < 40; ++i) |
| 35 |
image[i] = 1.; |
| 36 |
|
| 37 |
foo (); |
| 38 |
|
| 39 |
#pragma GCC novector |
| 40 |
for (int i = 0; i < 20; i++) |
| 41 |
{ |
| 42 |
double suma = 0; |
| 43 |
double sumb = 0; |
| 44 |
int k = 1; |
| 45 |
int l = 1; |
| 46 |
for (int j = 0; j < 40; j++) |
| 47 |
{ |
| 48 |
suma += k+i; |
| 49 |
sumb += l+i; |
| 50 |
asm ("" : "+g" (suma)); |
| 51 |
asm ("" : "+g" (sumb)); |
| 52 |
k++; |
| 53 |
l++; |
| 54 |
} |
| 55 |
if (image[2*i] != suma |
| 56 |
|| image[2*i+1] != sumb) |
| 57 |
abort (); |
| 58 |
} |
| 59 |
|
| 60 |
return 0; |
| 61 |
} |
| 62 |
|
| 63 |
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ |
| 64 |
/* We don't yet support SLP inductions for variable length vectors. */ |
| 65 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_variable_length } } } */ |