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