openmp: Fix signed/unsigned warning
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-22.c
blob2c083dc4ea3b1d7d3c6b56508cc7465b76060aa1
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int
9 main1 (unsigned short a0, unsigned short a1, unsigned short a2,
10 unsigned short a3, unsigned short a4, unsigned short a5,
11 unsigned short a6, unsigned short a7, unsigned short a8)
13 int i;
14 unsigned short out[N*8], out2[N*8], out3[N*8], b0, b1, b2, b3, b4, b5, b6, b7, b8;
16 for (i = 0; i < N; i++)
18 b0 = a0 + 8;
19 b1 = a1 + 7;
20 b2 = a2 + 6;
21 b3 = a3 + 5;
22 b4 = a4 + 4;
23 b5 = a5 + 3;
25 out[i*4] = b0;
26 out[i*4 + 1] = b1;
27 out[i*4 + 2] = b2;
28 out[i*4 + 3] = b3;
30 out2[i*4] = b0;
31 out2[i*4 + 1] = b1;
32 out2[i*4 + 2] = b4;
33 out2[i*4 + 3] = b5;
35 out3[i*4] = b2;
36 out3[i*4 + 1] = b1;
37 out3[i*4 + 2] = b4;
38 out3[i*4 + 3] = b5;
41 /* check results: */
42 #pragma GCC novector
43 for (i = 0; i < N; i++)
45 if (out[i*4] != b0
46 || out[i*4 + 1] != b1
47 || out[i*4 + 2] != b2
48 || out[i*4 + 3] != b3)
49 abort ();
52 if (out2[i*4] != b0
53 || out2[i*4 + 1] != b1
54 || out2[i*4 + 2] != b4
55 || out2[i*4 + 3] != b5)
56 abort ();
58 if (out3[i*4] != b2
59 || out3[i*4 + 1] != b1
60 || out3[i*4 + 2] != b4
61 || out3[i*4 + 3] != b5)
62 abort ();
65 for (i = 0; i < N; i++)
67 b0 = a0 + 8;
68 b1 = a1 + 7;
69 b2 = a2 + 6;
70 b3 = a3 + 5;
71 b4 = a4 + 4;
72 b5 = a5 + 3;
73 b6 = a6 + 2;
74 b7 = a7 + 1;
75 b8 = a8 + 9;
77 out[i*4] = b0;
78 out[i*4 + 1] = b1;
79 out[i*4 + 2] = b2;
80 out[i*4 + 3] = b3;
82 out2[i*8] = b0;
83 out2[i*8 + 1] = b1;
84 out2[i*8 + 2] = b4;
85 out2[i*8 + 3] = b5;
86 out2[i*8 + 4] = b6;
87 out2[i*8 + 5] = b2;
88 out2[i*8 + 6] = b7;
89 out2[i*8 + 7] = b8;
91 out3[2*i + 1] = a0;
92 out3[2*i] = b8;
95 /* check results: */
96 #pragma GCC novector
97 for (i = 0; i < N; i++)
99 if (out[i*4] != b0
100 || out[i*4 + 1] != b1
101 || out[i*4 + 2] != b2
102 || out[i*4 + 3] != b3)
103 abort ();
105 if (out2[i*8] != b0
106 || out2[i*8 + 1] != b1
107 || out2[i*8 + 2] != b4
108 || out2[i*8 + 3] != b5
109 || out2[i*8 + 4] != b6
110 || out2[i*8 + 5] != b2
111 || out2[i*8 + 6] != b7
112 || out2[i*8 + 7] != b8)
113 abort ();
115 if (out3[2*i] != b8
116 || out3[2*i+1] != a0)
117 abort();
121 return 0;
124 int main (void)
126 check_vect ();
128 main1 (8,7,6,5,4,3,2,1,0);
130 return 0;
133 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
134 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 6 "vect" } } */