PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-19c.c
blobf0df25f5346b17f71081a51ff905ddbba93e8234
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
8 int
9 main1 ()
11 unsigned int i;
12 unsigned int out[N*8];
13 unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
14 unsigned int ia[N*2], a0, a1, a2, a3;
16 /* The last stmt requires interleaving of not power of 2 size - not
17 vectorizable. */
18 for (i = 0; i < N/2; i++)
20 out[i*12] = in[i*12];
21 out[i*12 + 1] = in[i*12 + 1];
22 out[i*12 + 2] = in[i*12 + 2];
23 out[i*12 + 3] = in[i*12 + 3];
24 out[i*12 + 4] = in[i*12 + 4];
25 out[i*12 + 5] = in[i*12 + 5];
26 out[i*12 + 6] = in[i*12 + 6];
27 out[i*12 + 7] = in[i*12 + 7];
28 out[i*12 + 8] = in[i*12 + 8];
29 out[i*12 + 9] = in[i*12 + 9];
30 out[i*12 + 10] = in[i*12 + 10];
31 out[i*12 + 11] = in[i*12 + 11];
33 ia[i] = in[i*12 + 7];
36 /* check results: */
37 for (i = 0; i < N/2; i++)
39 if (out[i*12] != in[i*12]
40 || out[i*12 + 1] != in[i*12 + 1]
41 || out[i*12 + 2] != in[i*12 + 2]
42 || out[i*12 + 3] != in[i*12 + 3]
43 || out[i*12 + 4] != in[i*12 + 4]
44 || out[i*12 + 5] != in[i*12 + 5]
45 || out[i*12 + 6] != in[i*12 + 6]
46 || out[i*12 + 7] != in[i*12 + 7]
47 || out[i*12 + 8] != in[i*12 + 8]
48 || out[i*12 + 9] != in[i*12 + 9]
49 || out[i*12 + 10] != in[i*12 + 10]
50 || out[i*12 + 11] != in[i*12 + 11]
51 || ia[i] != in[i*12 + 7])
52 abort ();
55 /* Hybrid SLP with unrolling by 2. */
56 for (i = 0; i < N; i++)
58 out[i*6] = in[i*6];
59 out[i*6 + 1] = in[i*6 + 1];
60 out[i*6 + 2] = in[i*6 + 2];
61 out[i*6 + 3] = in[i*6 + 3];
62 out[i*6 + 4] = in[i*6 + 4];
63 out[i*6 + 5] = in[i*6 + 5];
65 ia[i] = i;
68 /* check results: */
69 for (i = 0; i < N/2; i++)
71 if (out[i*6] != in[i*6]
72 || out[i*6 + 1] != in[i*6 + 1]
73 || out[i*6 + 2] != in[i*6 + 2]
74 || out[i*6 + 3] != in[i*6 + 3]
75 || out[i*6 + 4] != in[i*6 + 4]
76 || out[i*6 + 5] != in[i*6 + 5]
77 || ia[i] != i)
78 abort ();
81 return 0;
84 int main (void)
86 check_vect ();
88 main1 ();
90 return 0;
93 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
94 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
95 /* { dg-final { cleanup-tree-dump "vect" } } */