Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-13-big-array.c
blobe45f8aab1339091f53fd9bdc3e8076d6adf75f84
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 int
9 main1 ()
11 int i;
12 unsigned short out[N*8];
13 unsigned short in[N*8];
14 unsigned int in2[N*8];
15 unsigned int out2[N*8];
17 for (i = 0; i < N*8; i++)
19 in[i] = in2[i] = i;
20 asm volatile ("" ::: "memory");
23 /* Induction is SLPable. */
24 for (i = 0; i < N; i++)
26 out[i*8] = in[i*8] + i;
27 out[i*8 + 1] = in[i*8 + 1] + i;
28 out[i*8 + 2] = in[i*8 + 2] + i;
29 out[i*8 + 3] = in[i*8 + 3] + i;
30 out[i*8 + 4] = in[i*8 + 4] + i;
31 out[i*8 + 5] = in[i*8 + 5] + i;
32 out[i*8 + 6] = in[i*8 + 6] + i;
33 out[i*8 + 7] = in[i*8 + 7] + i;
36 /* check results: */
37 #pragma GCC novector
38 for (i = 0; i < N; i++)
40 if (out[i*8] != in[i*8] + i
41 || out[i*8 + 1] != in[i*8 + 1] + i
42 || out[i*8 + 2] != in[i*8 + 2] + i
43 || out[i*8 + 3] != in[i*8 + 3] + i
44 || out[i*8 + 4] != in[i*8 + 4] + i
45 || out[i*8 + 5] != in[i*8 + 5] + i
46 || out[i*8 + 6] != in[i*8 + 6] + i
47 || out[i*8 + 7] != in[i*8 + 7] + i)
48 abort ();
51 /* Induction is SLPable. */
52 for (i = 0; i < N/2; i++)
54 out2[i*12] = in2[i*12] + i;
55 out2[i*12 + 1] = in2[i*12 + 1] + i;
56 out2[i*12 + 2] = in2[i*12 + 2] + i;
57 out2[i*12 + 3] = in2[i*12 + 3] + i;
58 out2[i*12 + 4] = in2[i*12 + 4] + i;
59 out2[i*12 + 5] = in2[i*12 + 5] + i;
60 out2[i*12 + 6] = in2[i*12 + 6] + i;
61 out2[i*12 + 7] = in2[i*12 + 7] + i;
62 out2[i*12 + 8] = in2[i*12 + 8] + i;
63 out2[i*12 + 9] = in2[i*12 + 9] + i;
64 out2[i*12 + 10] = in2[i*12 + 10] + i;
65 out2[i*12 + 11] = in2[i*12 + 11] + i;
68 /* check results: */
69 #pragma GCC novector
70 for (i = 0; i < N/2; i++)
72 if (out2[i*12] != in2[i*12] + i
73 || out2[i*12 + 1] != in2[i*12 + 1] + i
74 || out2[i*12 + 2] != in2[i*12 + 2] + i
75 || out2[i*12 + 3] != in2[i*12 + 3] + i
76 || out2[i*12 + 4] != in2[i*12 + 4] + i
77 || out2[i*12 + 5] != in2[i*12 + 5] + i
78 || out2[i*12 + 6] != in2[i*12 + 6] + i
79 || out2[i*12 + 7] != in2[i*12 + 7] + i
80 || out2[i*12 + 8] != in2[i*12 + 8] + i
81 || out2[i*12 + 9] != in2[i*12 + 9] + i
82 || out2[i*12 + 10] != in2[i*12 + 10] + i
83 || out2[i*12 + 11] != in2[i*12 + 11] + i)
84 abort ();
87 /* Not power of 2 but SLPable. */
88 for (i = 0; i < N/2; i++)
90 out2[i*12] = in2[i*12] + 1;
91 out2[i*12 + 1] = in2[i*12 + 1] + 2;
92 out2[i*12 + 2] = in2[i*12 + 2] + 3;
93 out2[i*12 + 3] = in2[i*12 + 3] + 4;
94 out2[i*12 + 4] = in2[i*12 + 4] + 5;
95 out2[i*12 + 5] = in2[i*12 + 5] + 6;
96 out2[i*12 + 6] = in2[i*12 + 6] + 7;
97 out2[i*12 + 7] = in2[i*12 + 7] + 8;
98 out2[i*12 + 8] = in2[i*12 + 8] + 9;
99 out2[i*12 + 9] = in2[i*12 + 9] + 10;
100 out2[i*12 + 10] = in2[i*12 + 10] + 11;
101 out2[i*12 + 11] = in2[i*12 + 11] + 12;
104 /* check results: */
105 #pragma GCC novector
106 for (i = 0; i < N/2; i++)
108 if (out2[i*12] != in2[i*12] + 1
109 || out2[i*12 + 1] != in2[i*12 + 1] + 2
110 || out2[i*12 + 2] != in2[i*12 + 2] + 3
111 || out2[i*12 + 3] != in2[i*12 + 3] + 4
112 || out2[i*12 + 4] != in2[i*12 + 4] + 5
113 || out2[i*12 + 5] != in2[i*12 + 5] + 6
114 || out2[i*12 + 6] != in2[i*12 + 6] + 7
115 || out2[i*12 + 7] != in2[i*12 + 7] + 8
116 || out2[i*12 + 8] != in2[i*12 + 8] + 9
117 || out2[i*12 + 9] != in2[i*12 + 9] + 10
118 || out2[i*12 + 10] != in2[i*12 + 10] + 11
119 || out2[i*12 + 11] != in2[i*12 + 11] + 12)
120 abort ();
125 return 0;
128 int main (void)
130 check_vect ();
132 main1 ();
134 return 0;
137 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { { vect_interleave && vect_extract_even_odd } && { ! vect_pack_trunc } } } } } */
138 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { ! vect_pack_trunc } } } } */
139 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { { vect_interleave && vect_extract_even_odd } && vect_pack_trunc } } } } */
140 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { target vect_pack_trunc } } } */