1 /* { dg-require-effective-target vect_int } */ 2 3 #include <stdarg.h> 4 #include "tree-vect.h" 5 6 #define N 40 7 8 int a[N]; 9 10 __attribute__ ((noinline)) int foo()11foo (){ 12 int i; 13 unsigned short j; 14 int sum = 0; 15 unsigned short sum_j; 16 17 for (i = 0; i < N; i++) { 18 sum += i; 19 20 sum_j = 0; 21 for (j = 0; j < N; j++) { 22 sum_j += j; 23 } 24 a[i] = sum_j + 5; 25 } 26 return sum; 27 } 28 main(void)29int main (void) 30 { 31 int i; 32 unsigned short j, sum_j; 33 int sum = 0; 34 int res; 35 36 check_vect (); 37 38 for (i=0; i<N; i++) 39 a[i] = i; 40 41 res = foo (); 42 43 /* check results: */ 44 for (i=0; i<N; i++) 45 { 46 sum += i; 47 48 sum_j = 0; 49 for (j = 0; j < N; j++){ 50 sum_j += j; 51 } 52 if (a[i] != sum_j + 5) 53 abort(); 54 } 55 if (res != sum) 56 abort (); 57 58 return 0; 59 } 60 61 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail { ! {vect_unpack } } } } } */ 62