1 /* { dg-require-effective-target vect_int } */
2 
3 #include <stdarg.h>
4 #include "tree-vect.h"
5 
6 #define N 64
7 
8 unsigned short in[N*8];
9 unsigned short in2[N*8];
10 
11 int
main1()12 main1 ()
13 {
14   int i;
15   unsigned short out[N*8];
16   unsigned short out2[N*8];
17 
18   for (i = 0; i < N*8; i++)
19     {
20       in[i] = in2[i] = i;
21       asm volatile ("" ::: "memory");
22     }
23 
24   /* SLP with unrolling by 8.  */
25   for (i = 0; i < N; i++)
26     {
27       out[i*3] = in[i*3] + 5;
28       out[i*3 + 1] = in[i*3 + 1] + 6;
29       out[i*3 + 2] = in[i*3 + 2] + 16;
30 
31       out2[i*5] = in2[i*5] + 2;
32       out2[i*5 + 1] = in2[i*5 + 1] + 2;
33       out2[i*5 + 2] = in2[i*5 + 2] + 1;
34       out2[i*5 + 3] = in2[i*5 + 3] + 3;
35       out2[i*5 + 4] = in2[i*5 + 4] + 13;
36     }
37 
38   /* check results:  */
39   for (i = 0; i < N; i++)
40     {
41       if (out[i*3] != in[i*3] + 5
42           || out[i*3 + 1] != in[i*3 + 1] + 6
43           || out[i*3 + 2] != in[i*3 + 2] + 16
44           || out2[i*5] != in2[i*5] + 2
45           || out2[i*5 + 1] != in2[i*5 + 1] + 2
46           || out2[i*5 + 2] != in2[i*5 + 2] + 1
47           || out2[i*5 + 3] != in2[i*5 + 3] + 3
48           || out2[i*5 + 4] != in2[i*5 + 4] + 13)
49         abort ();
50     }
51 
52   return 0;
53 }
54 
main(void)55 int main (void)
56 {
57   check_vect ();
58 
59   main1 ();
60 
61   return 0;
62 }
63 
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
65 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect"  } } */
66 
67