Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-3-big-array.c
blob615a79f4a30f8002a989047c99eea13dd9f9e1a6
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 96
8 unsigned short in[N*8];
10 int
11 main1 ()
13 int i;
14 unsigned short out[N*8];
16 for (i = 0; i < N*8; i++)
18 in[i] = i&63;
19 asm volatile ("" ::: "memory");
22 for (i = 0; i < N; i++)
24 out[i*8] = in[i*8];
25 out[i*8 + 1] = in[i*8 + 1];
26 out[i*8 + 2] = in[i*8 + 2];
27 out[i*8 + 3] = in[i*8 + 3];
28 out[i*8 + 4] = in[i*8 + 4];
29 out[i*8 + 5] = in[i*8 + 5];
30 out[i*8 + 6] = in[i*8 + 6];
31 out[i*8 + 7] = in[i*8 + 7];
34 /* check results: */
35 #pragma GCC novector
36 for (i = 0; i < N; i++)
38 if (out[i*8] != in[i*8]
39 || out[i*8 + 1] != in[i*8 + 1]
40 || out[i*8 + 2] != in[i*8 + 2]
41 || out[i*8 + 3] != in[i*8 + 3]
42 || out[i*8 + 4] != in[i*8 + 4]
43 || out[i*8 + 5] != in[i*8 + 5]
44 || out[i*8 + 6] != in[i*8 + 6]
45 || out[i*8 + 7] != in[i*8 + 7])
46 abort ();
49 for (i = 0; i < N*2; i++)
51 out[i*4] = in[i*4];
52 out[i*4 + 1] = in[i*4 + 1];
53 out[i*4 + 2] = in[i*4 + 2];
54 out[i*4 + 3] = in[i*4 + 3];
57 /* check results: */
58 #pragma GCC novector
59 for (i = 0; i < N*2; i++)
61 if (out[i*4] != in[i*4]
62 || out[i*4 + 1] != in[i*4 + 1]
63 || out[i*4 + 2] != in[i*4 + 2]
64 || out[i*4 + 3] != in[i*4 + 3])
65 abort ();
68 for (i = 0; i < N/2; i++)
70 out[i*16] = in[i*16];
71 out[i*16 + 1] = in[i*16 + 1];
72 out[i*16 + 2] = in[i*16 + 2];
73 out[i*16 + 3] = in[i*16 + 3];
74 out[i*16 + 4] = in[i*16 + 4];
75 out[i*16 + 5] = in[i*16 + 5];
76 out[i*16 + 6] = in[i*16 + 6];
77 out[i*16 + 7] = in[i*16 + 7];
78 out[i*16 + 8] = in[i*16 + 8];
79 out[i*16 + 9] = in[i*16 + 9];
80 out[i*16 + 10] = in[i*16 + 10];
81 out[i*16 + 11] = in[i*16 + 11];
82 out[i*16 + 12] = in[i*16 + 12];
83 out[i*16 + 13] = in[i*16 + 13];
84 out[i*16 + 14] = in[i*16 + 14];
85 out[i*16 + 15] = in[i*16 + 15];
88 /* check results: */
89 #pragma GCC novector
90 for (i = 0; i < N/2; i++)
92 if (out[i*16] != in[i*16]
93 || out[i*16 + 1] != in[i*16 + 1]
94 || out[i*16 + 2] != in[i*16 + 2]
95 || out[i*16 + 3] != in[i*16 + 3]
96 || out[i*16 + 4] != in[i*16 + 4]
97 || out[i*16 + 5] != in[i*16 + 5]
98 || out[i*16 + 6] != in[i*16 + 6]
99 || out[i*16 + 7] != in[i*16 + 7]
100 || out[i*16 + 8] != in[i*16 + 8]
101 || out[i*16 + 9] != in[i*16 + 9]
102 || out[i*16 + 10] != in[i*16 + 10]
103 || out[i*16 + 11] != in[i*16 + 11]
104 || out[i*16 + 12] != in[i*16 + 12]
105 || out[i*16 + 13] != in[i*16 + 13]
106 || out[i*16 + 14] != in[i*16 + 14]
107 || out[i*16 + 15] != in[i*16 + 15])
108 abort ();
111 /* SLP with unrolling by 8. */
112 for (i = 0; i < N/4; i++)
114 out[i*9] = in[i*9];
115 out[i*9 + 1] = in[i*9 + 1];
116 out[i*9 + 2] = in[i*9 + 2];
117 out[i*9 + 3] = in[i*9 + 3];
118 out[i*9 + 4] = in[i*9 + 4];
119 out[i*9 + 5] = in[i*9 + 5];
120 out[i*9 + 6] = in[i*9 + 6];
121 out[i*9 + 7] = in[i*9 + 7];
122 out[i*9 + 8] = in[i*9 + 8];
125 /* check results: */
126 #pragma GCC novector
127 for (i = 0; i < N/4; i++)
129 if (out[i*9] != in[i*9]
130 || out[i*9 + 1] != in[i*9 + 1]
131 || out[i*9 + 2] != in[i*9 + 2]
132 || out[i*9 + 3] != in[i*9 + 3]
133 || out[i*9 + 4] != in[i*9 + 4]
134 || out[i*9 + 5] != in[i*9 + 5]
135 || out[i*9 + 6] != in[i*9 + 6]
136 || out[i*9 + 7] != in[i*9 + 7]
137 || out[i*9 + 8] != in[i*9 + 8])
138 abort ();
142 return 0;
145 int main (void)
147 check_vect ();
149 main1 ();
151 return 0;
154 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
155 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */