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 for (int i = 0; i < 20; i++)
32 {
33 double suma = 0;
34 double sumb = 0;
35 for (int j = 0; j < 40; j++)
36 {
37 suma += j+i;
38 sumb += j+i;
39 asm ("" : "+g" (suma));
40 asm ("" : "+g" (sumb));
41 }
42 if (image[2*i] != suma
43 || image[2*i+1] != sumb)
44 abort ();
45 }
46
47 return 0;
48 }
49
50 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
51 /* We don't yet support SLP inductions for variable length vectors. */
52 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_variable_length } } } */