PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-34-big-array.c
blob53da79ee77f9a075b0fa015f7d48848a2482abfb
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 unsigned short in[N*8];
9 unsigned short in2[N*8];
10 volatile int y = 0;
12 int
13 main1 ()
15 int i;
16 unsigned short out[N*8];
17 unsigned short out2[N*8];
19 for (i = 0; i < N*8; i++)
21 in[i] = in2[i] = i;
22 if (y) /* Avoid vectorization. */
23 abort ();
26 /* SLP with unrolling by 8. */
27 for (i = 0; i < N; i++)
29 out[i*3] = in[i*3] + 5;
30 out[i*3 + 1] = in[i*3 + 1] + 6;
31 out[i*3 + 2] = in[i*3 + 2] + 16;
33 out2[i*5] = in2[i*5] + 2;
34 out2[i*5 + 1] = in2[i*5 + 1] + 2;
35 out2[i*5 + 2] = in2[i*5 + 2] + 1;
36 out2[i*5 + 3] = in2[i*5 + 3] + 3;
37 out2[i*5 + 4] = in2[i*5 + 4] + 13;
40 /* check results: */
41 for (i = 0; i < N; i++)
43 if (out[i*3] != in[i*3] + 5
44 || out[i*3 + 1] != in[i*3 + 1] + 6
45 || out[i*3 + 2] != in[i*3 + 2] + 16
46 || out2[i*5] != in2[i*5] + 2
47 || out2[i*5 + 1] != in2[i*5 + 1] + 2
48 || out2[i*5 + 2] != in2[i*5 + 2] + 1
49 || out2[i*5 + 3] != in2[i*5 + 3] + 3
50 || out2[i*5 + 4] != in2[i*5 + 4] + 13)
51 abort ();
54 return 0;
57 int main (void)
59 check_vect ();
61 main1 ();
63 return 0;
66 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
67 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
68 /* { dg-final { cleanup-tree-dump "vect" } } */