1 /* { dg-require-effective-target vect_int } */
2 #include <stdarg.h>
3 #include "tree-vect.h"
4 
5 #define N 320
6 #define M 1024
7 unsigned short in[N+M];
8 unsigned int out[N];
9 
10 /* Outer-loop vectorization.  */
11 /* Not vectorized due to multiple-types in the inner-loop.  */
12 
13 __attribute__ ((noinline)) unsigned int
foo()14 foo (){
15   int i,j;
16   unsigned int diff;
17   unsigned int s=0;
18 
19   for (i = 0; i < N; i++) {
20     diff = 0;
21     for (j = 0; j < M; j+=8) {
22       diff += in[j+i];
23     }
24     s+=((unsigned short)diff>>3);
25   }
26   return s;
27 }
28 
main(void)29 int main (void)
30 {
31   int i, j;
32   unsigned int diff;
33   unsigned int s=0,sum=0;
34 
35   check_vect ();
36 
37   for (i = 0; i < N+M; i++) {
38     in[i] = i;
39   }
40 
41   sum=foo ();
42 
43   for (i = 0; i < N; i++) {
44     diff = 0;
45     for (j = 0; j < M; j+=8) {
46       diff += in[j+i];
47     }
48     s += ((unsigned short)diff>>3);
49   }
50 
51   if (s != sum)
52     abort ();
53 
54   return 0;
55 }
56 
57 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect"  { xfail *-*-* } } } */
58