i386: Support cstorebf4 with native bf16 comi
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-9.c
blob87febca10e7049cb0f4547a13d27f533011d44bc
1 /* { dg-require-effective-target vect_cond_mixed } */
2 /* { dg-require-effective-target vect_float } */
3 /* { dg-additional-options "-fno-ipa-icf" } */
5 #include "tree-vect.h"
7 #define N 1024
8 float a[N], b[N], c[N], d[N];
9 int j[N];
10 unsigned char k[N];
12 __attribute__((noinline, noclone)) void
13 f1 (void)
15 int i;
16 for (i = 0; i < N; ++i)
18 unsigned int x = a[i] < b[i] ? -1 : 0;
19 unsigned int y = c[i] < d[i] ? -1 : 0;
20 j[i] = (x & y) >> 31;
24 __attribute__((noinline, noclone)) void
25 f2 (void)
27 int i;
28 for (i = 0; i < N; ++i)
30 int x = a[i] < b[i];
31 int y = c[i] < d[i];
32 j[i] = x & y;
36 __attribute__((noinline, noclone)) void
37 f3 (void)
39 int i;
40 for (i = 0; i < N; ++i)
41 j[i] = (a[i] < b[i]) & (c[i] < d[i]);
44 __attribute__((noinline, noclone)) void
45 f4 (void)
47 int i;
48 for (i = 0; i < N; ++i)
50 int x = a[i] < b[i];
51 int y = c[i] < d[i];
52 k[i] = x & y;
56 __attribute__((noinline, noclone)) void
57 f5 (void)
59 int i;
60 for (i = 0; i < N; ++i)
61 k[i] = (a[i] < b[i]) & (c[i] < d[i]);
64 __attribute__((noinline, noclone)) void
65 f6 (void)
67 int i;
68 for (i = 0; i < N; ++i)
70 unsigned int x = a[i] < b[i] ? -1 : 0;
71 unsigned int y = c[i] < d[i] ? -1 : 0;
72 j[i] = (x | y) >> 31;
76 __attribute__((noinline, noclone)) void
77 f7 (void)
79 int i;
80 for (i = 0; i < N; ++i)
82 int x = a[i] < b[i];
83 int y = c[i] < d[i];
84 j[i] = x | y;
88 __attribute__((noinline, noclone)) void
89 f8 (void)
91 int i;
92 for (i = 0; i < N; ++i)
93 j[i] = (a[i] < b[i]) | (c[i] < d[i]);
96 __attribute__((noinline, noclone)) void
97 f9 (void)
99 int i;
100 for (i = 0; i < N; ++i)
102 int x = a[i] < b[i];
103 int y = c[i] < d[i];
104 k[i] = x | y;
108 __attribute__((noinline, noclone)) void
109 f10 (void)
111 int i;
112 for (i = 0; i < N; ++i)
113 k[i] = (a[i] < b[i]) | (c[i] < d[i]);
117 main ()
119 int i;
121 check_vect ();
123 for (i = 0; i < N; i++)
125 switch (i % 9)
127 case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
128 case 1: a[i] = 0; b[i] = 0; break;
129 case 2: a[i] = i + 1; b[i] = - i - 1; break;
130 case 3: a[i] = i; b[i] = i + 7; break;
131 case 4: a[i] = i; b[i] = i; break;
132 case 5: a[i] = i + 16; b[i] = i + 3; break;
133 case 6: a[i] = - i - 5; b[i] = - i; break;
134 case 7: a[i] = - i; b[i] = - i; break;
135 case 8: a[i] = - i; b[i] = - i - 7; break;
138 for (i = 0; i < N; i++)
140 switch ((i / 9) % 3)
142 case 0: c[i] = a[i / 9]; d[i] = b[i / 9]; break;
143 case 1: c[i] = a[i / 9 + 3]; d[i] = b[i / 9 + 3]; break;
144 case 2: c[i] = a[i / 9 + 6]; d[i] = b[i / 9 + 6]; break;
147 f1 ();
148 #pragma GCC novector
149 for (i = 0; i < N; i++)
150 if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
151 abort ();
152 __builtin_memset (j, -6, sizeof (j));
153 f2 ();
154 #pragma GCC novector
155 for (i = 0; i < N; i++)
156 if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
157 abort ();
158 __builtin_memset (j, -6, sizeof (j));
159 f3 ();
160 #pragma GCC novector
161 for (i = 0; i < N; i++)
162 if (j[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
163 abort ();
164 __builtin_memset (j, -6, sizeof (j));
165 f4 ();
166 #pragma GCC novector
167 for (i = 0; i < N; i++)
168 if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
169 abort ();
170 __builtin_memset (k, -6, sizeof (k));
171 f5 ();
172 #pragma GCC novector
173 for (i = 0; i < N; i++)
174 if (k[i] != ((i % 3) == 0 && ((i / 9) % 3) == 0))
175 abort ();
176 __builtin_memset (k, -6, sizeof (k));
177 f6 ();
178 #pragma GCC novector
179 for (i = 0; i < N; i++)
180 if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
181 abort ();
182 __builtin_memset (j, -6, sizeof (j));
183 f7 ();
184 #pragma GCC novector
185 for (i = 0; i < N; i++)
186 if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
187 abort ();
188 __builtin_memset (j, -6, sizeof (j));
189 f8 ();
190 #pragma GCC novector
191 for (i = 0; i < N; i++)
192 if (j[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
193 abort ();
194 __builtin_memset (j, -6, sizeof (j));
195 f9 ();
196 #pragma GCC novector
197 for (i = 0; i < N; i++)
198 if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
199 abort ();
200 __builtin_memset (k, -6, sizeof (k));
201 f10 ();
202 #pragma GCC novector
203 for (i = 0; i < N; i++)
204 if (k[i] != ((i % 3) == 0 || ((i / 9) % 3) == 0))
205 abort ();
206 __builtin_memset (k, -6, sizeof (k));
208 return 0;
211 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 10 "vect" } } */