IVOPT performance tuning patch. The main problem is a variant of maximal weight
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-13.c
blob0041526b9729fc76d14d3dff028a2032200327a6
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
7 #define N 8
9 int
10 main1 ()
12 int i;
13 unsigned short out[N*8];
14 unsigned short 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};
15 unsigned int in2[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};
16 unsigned int out2[N*8];
18 /* Induction is not SLPable yet. */
19 for (i = 0; i < N; i++)
21 out[i*8] = in[i*8] + i;
22 out[i*8 + 1] = in[i*8 + 1] + i;
23 out[i*8 + 2] = in[i*8 + 2] + i;
24 out[i*8 + 3] = in[i*8 + 3] + i;
25 out[i*8 + 4] = in[i*8 + 4] + i;
26 out[i*8 + 5] = in[i*8 + 5] + i;
27 out[i*8 + 6] = in[i*8 + 6] + i;
28 out[i*8 + 7] = in[i*8 + 7] + i;
31 /* check results: */
32 for (i = 0; i < N; i++)
34 if (out[i*8] != in[i*8] + i
35 || out[i*8 + 1] != in[i*8 + 1] + i
36 || out[i*8 + 2] != in[i*8 + 2] + i
37 || out[i*8 + 3] != in[i*8 + 3] + i
38 || out[i*8 + 4] != in[i*8 + 4] + i
39 || out[i*8 + 5] != in[i*8 + 5] + i
40 || out[i*8 + 6] != in[i*8 + 6] + i
41 || out[i*8 + 7] != in[i*8 + 7] + i)
42 abort ();
45 /* Induction is not SLPable yet and strided group size must be a power of 2
46 to get vectorized. */
47 for (i = 0; i < N/2; i++)
49 out2[i*12] = in2[i*12] + i;
50 out2[i*12 + 1] = in2[i*12 + 1] + i;
51 out2[i*12 + 2] = in2[i*12 + 2] + i;
52 out2[i*12 + 3] = in2[i*12 + 3] + i;
53 out2[i*12 + 4] = in2[i*12 + 4] + i;
54 out2[i*12 + 5] = in2[i*12 + 5] + i;
55 out2[i*12 + 6] = in2[i*12 + 6] + i;
56 out2[i*12 + 7] = in2[i*12 + 7] + i;
57 out2[i*12 + 8] = in2[i*12 + 8] + i;
58 out2[i*12 + 9] = in2[i*12 + 9] + i;
59 out2[i*12 + 10] = in2[i*12 + 10] + i;
60 out2[i*12 + 11] = in2[i*12 + 11] + i;
63 /* check results: */
64 for (i = 0; i < N/2; i++)
66 if (out2[i*12] != in2[i*12] + i
67 || out2[i*12 + 1] != in2[i*12 + 1] + i
68 || out2[i*12 + 2] != in2[i*12 + 2] + i
69 || out2[i*12 + 3] != in2[i*12 + 3] + i
70 || out2[i*12 + 4] != in2[i*12 + 4] + i
71 || out2[i*12 + 5] != in2[i*12 + 5] + i
72 || out2[i*12 + 6] != in2[i*12 + 6] + i
73 || out2[i*12 + 7] != in2[i*12 + 7] + i
74 || out2[i*12 + 8] != in2[i*12 + 8] + i
75 || out2[i*12 + 9] != in2[i*12 + 9] + i
76 || out2[i*12 + 10] != in2[i*12 + 10] + i
77 || out2[i*12 + 11] != in2[i*12 + 11] + i)
78 abort ();
81 /* Not power of 2 but SLPable. */
82 for (i = 0; i < N/2; i++)
84 out2[i*12] = in2[i*12] + 1;
85 out2[i*12 + 1] = in2[i*12 + 1] + 2;
86 out2[i*12 + 2] = in2[i*12 + 2] + 3;
87 out2[i*12 + 3] = in2[i*12 + 3] + 4;
88 out2[i*12 + 4] = in2[i*12 + 4] + 5;
89 out2[i*12 + 5] = in2[i*12 + 5] + 6;
90 out2[i*12 + 6] = in2[i*12 + 6] + 7;
91 out2[i*12 + 7] = in2[i*12 + 7] + 8;
92 out2[i*12 + 8] = in2[i*12 + 8] + 9;
93 out2[i*12 + 9] = in2[i*12 + 9] + 10;
94 out2[i*12 + 10] = in2[i*12 + 10] + 11;
95 out2[i*12 + 11] = in2[i*12 + 11] + 12;
98 /* check results: */
99 for (i = 0; i < N/2; i++)
101 if (out2[i*12] != in2[i*12] + 1
102 || out2[i*12 + 1] != in2[i*12 + 1] + 2
103 || out2[i*12 + 2] != in2[i*12 + 2] + 3
104 || out2[i*12 + 3] != in2[i*12 + 3] + 4
105 || out2[i*12 + 4] != in2[i*12 + 4] + 5
106 || out2[i*12 + 5] != in2[i*12 + 5] + 6
107 || out2[i*12 + 6] != in2[i*12 + 6] + 7
108 || out2[i*12 + 7] != in2[i*12 + 7] + 8
109 || out2[i*12 + 8] != in2[i*12 + 8] + 9
110 || out2[i*12 + 9] != in2[i*12 + 9] + 10
111 || out2[i*12 + 10] != in2[i*12 + 10] + 11
112 || out2[i*12 + 11] != in2[i*12 + 11] + 12)
113 abort ();
118 return 0;
121 int main (void)
123 check_vect ();
125 main1 ();
127 return 0;
130 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
131 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { xfail *-*-* } } } */
132 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
133 /* { dg-final { cleanup-tree-dump "vect" } } */