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