openmp: Fix signed/unsigned warning
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-4-big-array.c
blobf738a613324b2e40cd75ca43ee92c91ec1c525f2
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int
9 main1 ()
11 int i;
12 unsigned short out[N*8];
13 unsigned short in[N*8];
14 unsigned int ia[N*2];
16 for (i = 0; i < N*8; i++)
18 in[i] = i;
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];
33 ia[i] = 7;
36 /* check results: */
37 #pragma GCC novector
38 for (i = 0; i < N; i++)
40 if (out[i*8] != in[i*8]
41 || out[i*8 + 1] != in[i*8 + 1]
42 || out[i*8 + 2] != in[i*8 + 2]
43 || out[i*8 + 3] != in[i*8 + 3]
44 || out[i*8 + 4] != in[i*8 + 4]
45 || out[i*8 + 5] != in[i*8 + 5]
46 || out[i*8 + 6] != in[i*8 + 6]
47 || out[i*8 + 7] != in[i*8 + 7]
48 || ia[i] != 7)
49 abort ();
52 for (i = 0; i < N*2; i++)
54 out[i*4] = in[i*4];
55 out[i*4 + 1] = in[i*4 + 1];
56 out[i*4 + 2] = in[i*4 + 2];
57 out[i*4 + 3] = in[i*4 + 3];
59 ia[i] = 12;
62 /* check results: */
63 #pragma GCC novector
64 for (i = 0; i < N*2; i++)
66 if (out[i*4] != in[i*4]
67 || out[i*4 + 1] != in[i*4 + 1]
68 || out[i*4 + 2] != in[i*4 + 2]
69 || out[i*4 + 3] != in[i*4 + 3]
70 || ia[i] != 12)
71 abort ();
74 for (i = 0; i < N/2; i++)
76 out[i*16] = in[i*16];
77 out[i*16 + 1] = in[i*16 + 1];
78 out[i*16 + 2] = in[i*16 + 2];
79 out[i*16 + 3] = in[i*16 + 3];
80 out[i*16 + 4] = in[i*16 + 4];
81 out[i*16 + 5] = in[i*16 + 5];
82 out[i*16 + 6] = in[i*16 + 6];
83 out[i*16 + 7] = in[i*16 + 7];
84 out[i*16 + 8] = in[i*16 + 8];
85 out[i*16 + 9] = in[i*16 + 9];
86 out[i*16 + 10] = in[i*16 + 10];
87 out[i*16 + 11] = in[i*16 + 11];
88 out[i*16 + 12] = in[i*16 + 12];
89 out[i*16 + 13] = in[i*16 + 13];
90 out[i*16 + 14] = in[i*16 + 14];
91 out[i*16 + 15] = in[i*16 + 15];
93 ia[i] = 21;
96 /* check results: */
97 #pragma GCC novector
98 for (i = 0; i < N/2; i++)
100 if (out[i*16] != in[i*16]
101 || out[i*16 + 1] != in[i*16 + 1]
102 || out[i*16 + 2] != in[i*16 + 2]
103 || out[i*16 + 3] != in[i*16 + 3]
104 || out[i*16 + 4] != in[i*16 + 4]
105 || out[i*16 + 5] != in[i*16 + 5]
106 || out[i*16 + 6] != in[i*16 + 6]
107 || out[i*16 + 7] != in[i*16 + 7]
108 || out[i*16 + 8] != in[i*16 + 8]
109 || out[i*16 + 9] != in[i*16 + 9]
110 || out[i*16 + 10] != in[i*16 + 10]
111 || out[i*16 + 11] != in[i*16 + 11]
112 || out[i*16 + 12] != in[i*16 + 12]
113 || out[i*16 + 13] != in[i*16 + 13]
114 || out[i*16 + 14] != in[i*16 + 14]
115 || out[i*16 + 15] != in[i*16 + 15]
116 || ia[i] != 21)
117 abort ();
121 return 0;
124 int main (void)
126 check_vect ();
128 main1 ();
130 return 0;
133 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
134 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 6 "vect" } } */