1 | // RUN: %clang_cc1 -triple s390x-linux-gnu -fzvector \ |
2 | // RUN: -fno-lax-vector-conversions -W -Wall -Wconversion \ |
3 | // RUN: -Werror -fsyntax-only -verify %s |
4 | |
5 | vector signed char sc, sc2; |
6 | vector unsigned char uc, uc2; |
7 | vector bool char bc, bc2; |
8 | |
9 | vector signed short ss, ss2; |
10 | vector unsigned short us, us2; |
11 | vector bool short bs, bs2; |
12 | |
13 | vector signed int si, si2; |
14 | vector unsigned int ui, ui2; |
15 | vector bool int bi, bi2; |
16 | |
17 | vector signed long long sl, sl2; |
18 | vector unsigned long long ul, ul2; |
19 | vector bool long long bl, bl2; |
20 | |
21 | vector double fd, fd2; |
22 | |
23 | vector long ll; // expected-error {{cannot use 'long' with '__vector'}} |
24 | vector float ff; // expected-error {{cannot use 'float' with '__vector'}} |
25 | |
26 | signed char sc_scalar; |
27 | unsigned char uc_scalar; |
28 | |
29 | signed short ss_scalar; |
30 | unsigned short us_scalar; |
31 | |
32 | signed int si_scalar; |
33 | unsigned int ui_scalar; |
34 | |
35 | signed long sl_scalar; |
36 | unsigned long ul_scalar; |
37 | |
38 | double fd_scalar; |
39 | |
40 | // Verify that __vector is also recognized |
41 | __vector signed char sc3; |
42 | __vector unsigned char uc3; |
43 | __vector bool char bc3; |
44 | __vector signed short ss3; |
45 | __vector unsigned short us3; |
46 | __vector bool short bs3; |
47 | __vector signed int si3; |
48 | __vector unsigned int ui3; |
49 | __vector bool int bi3; |
50 | __vector signed long long sl3; |
51 | __vector unsigned long long ul3; |
52 | __vector bool long long bl3; |
53 | __vector double fd3; |
54 | __vector long ll3; // expected-error {{cannot use 'long' with '__vector'}} |
55 | __vector float ff3; // expected-error {{cannot use 'float' with '__vector'}} |
56 | |
57 | // Likewise for __bool |
58 | vector __bool char bc4; |
59 | vector __bool short bs4; |
60 | vector __bool int bi4; |
61 | vector __bool long long bl4; |
62 | __vector __bool char bc5; |
63 | __vector __bool short bs5; |
64 | __vector __bool int bi5; |
65 | __vector __bool long long bl5; |
66 | |
67 | // Verify operation of vec_step |
68 | int res_sc[vec_step(sc) == 16 ? 1 : -1]; |
69 | int res_uc[vec_step(uc) == 16 ? 1 : -1]; |
70 | int res_bc[vec_step(bc) == 16 ? 1 : -1]; |
71 | int res_ss[vec_step(ss) == 8 ? 1 : -1]; |
72 | int res_us[vec_step(us) == 8 ? 1 : -1]; |
73 | int res_bs[vec_step(bs) == 8 ? 1 : -1]; |
74 | int res_si[vec_step(si) == 4 ? 1 : -1]; |
75 | int res_ui[vec_step(ui) == 4 ? 1 : -1]; |
76 | int res_bi[vec_step(bi) == 4 ? 1 : -1]; |
77 | int res_sl[vec_step(sl) == 2 ? 1 : -1]; |
78 | int res_ul[vec_step(ul) == 2 ? 1 : -1]; |
79 | int res_bl[vec_step(bl) == 2 ? 1 : -1]; |
80 | int res_fd[vec_step(fd) == 2 ? 1 : -1]; |
81 | |
82 | |
83 | void foo(void) |
84 | { |
85 | // ------------------------------------------------------------------------- |
86 | // Test assignment. |
87 | // ------------------------------------------------------------------------- |
88 | |
89 | sc = sc2; |
90 | uc = uc2; |
91 | bc = bc2; |
92 | |
93 | ss = ss2; |
94 | us = us2; |
95 | bs = bs2; |
96 | |
97 | si = si2; |
98 | ui = ui2; |
99 | bi = bi2; |
100 | |
101 | sl = sl2; |
102 | ul = ul2; |
103 | bl = bl2; |
104 | fd = fd2; |
105 | |
106 | sc = uc2; // expected-error {{incompatible type}} |
107 | sc = bc2; // expected-error {{incompatible type}} |
108 | uc = sc2; // expected-error {{incompatible type}} |
109 | uc = bc2; // expected-error {{incompatible type}} |
110 | bc = sc2; // expected-error {{incompatible type}} |
111 | bc = uc2; // expected-error {{incompatible type}} |
112 | |
113 | sc = sc_scalar; // expected-error {{incompatible type}} |
114 | sc = uc_scalar; // expected-error {{incompatible type}} |
115 | uc = sc_scalar; // expected-error {{incompatible type}} |
116 | uc = uc_scalar; // expected-error {{incompatible type}} |
117 | bc = sc_scalar; // expected-error {{incompatible type}} |
118 | bc = uc_scalar; // expected-error {{incompatible type}} |
119 | |
120 | sc = ss2; // expected-error {{incompatible type}} |
121 | sc = si2; // expected-error {{incompatible type}} |
122 | sc = sl2; // expected-error {{incompatible type}} |
123 | sc = fd2; // expected-error {{incompatible type}} |
124 | |
125 | ss = sc2; // expected-error {{incompatible type}} |
126 | si = sc2; // expected-error {{incompatible type}} |
127 | sl = sc2; // expected-error {{incompatible type}} |
128 | fd = sc2; // expected-error {{incompatible type}} |
129 | |
130 | uc = us2; // expected-error {{incompatible type}} |
131 | uc = ui2; // expected-error {{incompatible type}} |
132 | uc = ul2; // expected-error {{incompatible type}} |
133 | uc = fd2; // expected-error {{incompatible type}} |
134 | |
135 | us = uc2; // expected-error {{incompatible type}} |
136 | ui = uc2; // expected-error {{incompatible type}} |
137 | ul = uc2; // expected-error {{incompatible type}} |
138 | fd = uc2; // expected-error {{incompatible type}} |
139 | |
140 | bc = us2; // expected-error {{incompatible type}} |
141 | bc = ui2; // expected-error {{incompatible type}} |
142 | bc = ul2; // expected-error {{incompatible type}} |
143 | bc = fd2; // expected-error {{incompatible type}} |
144 | |
145 | bs = bc2; // expected-error {{incompatible type}} |
146 | bi = bc2; // expected-error {{incompatible type}} |
147 | bl = bc2; // expected-error {{incompatible type}} |
148 | fd = bc2; // expected-error {{incompatible type}} |
149 | |
150 | // ------------------------------------------------------------------------- |
151 | // Test casts to same element width. |
152 | // ------------------------------------------------------------------------- |
153 | |
154 | sc = (vector signed char)bc2; |
155 | bc = (vector bool char)uc2; |
156 | uc = (vector unsigned char)sc2; |
157 | |
158 | ss = (vector signed short)bs2; |
159 | bs = (vector bool short)us2; |
160 | us = (vector unsigned short)ss2; |
161 | |
162 | si = (vector signed int)bi2; |
163 | bi = (vector bool int)ui2; |
164 | ui = (vector unsigned int)si2; |
165 | |
166 | sl = (vector signed long long)bl2; |
167 | bl = (vector bool long long)ul2; |
168 | ul = (vector unsigned long long)fd2; |
169 | fd = (vector double)sl2; |
170 | |
171 | // ------------------------------------------------------------------------- |
172 | // Test casts to different element width. |
173 | // ------------------------------------------------------------------------- |
174 | |
175 | sc = (vector signed char)bs2; |
176 | bc = (vector bool char)us2; |
177 | uc = (vector unsigned char)fd2; |
178 | |
179 | ss = (vector signed short)bi2; |
180 | bs = (vector bool short)ui2; |
181 | us = (vector unsigned short)fd2; |
182 | |
183 | si = (vector signed int)bl2; |
184 | bi = (vector bool int)ul2; |
185 | ui = (vector unsigned int)fd2; |
186 | |
187 | sl = (vector signed long long)bc2; |
188 | bl = (vector bool long long)uc2; |
189 | ul = (vector unsigned long long)sc2; |
190 | fd = (vector double)sc2; |
191 | |
192 | // ------------------------------------------------------------------------- |
193 | // Test ++. |
194 | // ------------------------------------------------------------------------- |
195 | |
196 | ++sc2; |
197 | ++uc2; |
198 | ++bc2; // expected-error {{cannot increment}} |
199 | |
200 | ++ss2; |
201 | ++us2; |
202 | ++bs2; // expected-error {{cannot increment}} |
203 | |
204 | ++si2; |
205 | ++ui2; |
206 | ++bi2; // expected-error {{cannot increment}} |
207 | |
208 | ++sl2; |
209 | ++ul2; |
210 | ++bl2; // expected-error {{cannot increment}} |
211 | |
212 | ++fd2; |
213 | |
214 | sc++; |
215 | uc++; |
216 | bc++; // expected-error {{cannot increment}} |
217 | |
218 | ss++; |
219 | us++; |
220 | bs++; // expected-error {{cannot increment}} |
221 | |
222 | si++; |
223 | ui++; |
224 | bi++; // expected-error {{cannot increment}} |
225 | |
226 | sl++; |
227 | ul++; |
228 | bl++; // expected-error {{cannot increment}} |
229 | |
230 | fd++; |
231 | |
232 | // ------------------------------------------------------------------------- |
233 | // Test --. |
234 | // ------------------------------------------------------------------------- |
235 | |
236 | --sc2; |
237 | --uc2; |
238 | --bc2; // expected-error {{cannot decrement}} |
239 | |
240 | --ss2; |
241 | --us2; |
242 | --bs2; // expected-error {{cannot decrement}} |
243 | |
244 | --si2; |
245 | --ui2; |
246 | --bi2; // expected-error {{cannot decrement}} |
247 | |
248 | --sl2; |
249 | --ul2; |
250 | --bl2; // expected-error {{cannot decrement}} |
251 | |
252 | --fd2; |
253 | |
254 | sc--; |
255 | uc--; |
256 | bc--; // expected-error {{cannot decrement}} |
257 | |
258 | ss--; |
259 | us--; |
260 | bs--; // expected-error {{cannot decrement}} |
261 | |
262 | si--; |
263 | ui--; |
264 | bi--; // expected-error {{cannot decrement}} |
265 | |
266 | sl--; |
267 | ul--; |
268 | bl--; // expected-error {{cannot decrement}} |
269 | |
270 | fd--; |
271 | |
272 | // ------------------------------------------------------------------------- |
273 | // Test unary +. |
274 | // ------------------------------------------------------------------------- |
275 | |
276 | sc = +sc2; |
277 | uc = +uc2; |
278 | bc = +bc2; // expected-error {{invalid argument type}} |
279 | |
280 | ss = +ss2; |
281 | us = +us2; |
282 | bs = +bs2; // expected-error {{invalid argument type}} |
283 | |
284 | si = +si2; |
285 | ui = +ui2; |
286 | bi = +bi2; // expected-error {{invalid argument type}} |
287 | |
288 | sl = +sl2; |
289 | ul = +ul2; |
290 | bl = +bl2; // expected-error {{invalid argument type}} |
291 | |
292 | fd = +fd2; |
293 | |
294 | sc = +si2; // expected-error {{assigning to}} |
295 | ui = +si2; // expected-error {{assigning to}} |
296 | ui = +bi2; // expected-error {{invalid argument type}} |
297 | |
298 | // ------------------------------------------------------------------------- |
299 | // Test unary -. |
300 | // ------------------------------------------------------------------------- |
301 | |
302 | sc = -sc2; |
303 | uc = -uc2; |
304 | bc = -bc2; // expected-error {{invalid argument type}} |
305 | |
306 | ss = -ss2; |
307 | us = -us2; |
308 | bs = -bs2; // expected-error {{invalid argument type}} |
309 | |
310 | si = -si2; |
311 | ui = -ui2; |
312 | bi = -bi2; // expected-error {{invalid argument type}} |
313 | |
314 | sl = -sl2; |
315 | ul = -ul2; |
316 | bl = -bl2; // expected-error {{invalid argument type}} |
317 | |
318 | fd = -fd2; |
319 | |
320 | sc = -si2; // expected-error {{assigning to}} |
321 | ui = -si2; // expected-error {{assigning to}} |
322 | ui = -bi2; // expected-error {{invalid argument type}} |
323 | |
324 | // ------------------------------------------------------------------------- |
325 | // Test ~. |
326 | // ------------------------------------------------------------------------- |
327 | |
328 | sc = ~sc2; |
329 | uc = ~uc2; |
330 | bc = ~bc2; |
331 | |
332 | ss = ~ss2; |
333 | us = ~us2; |
334 | bs = ~bs2; |
335 | |
336 | si = ~si2; |
337 | ui = ~ui2; |
338 | bi = ~bi2; |
339 | |
340 | sl = ~sl2; |
341 | ul = ~ul2; |
342 | bl = ~bl2; |
343 | |
344 | fd = ~fd2; // expected-error {{invalid argument}} |
345 | |
346 | sc = ~si2; // expected-error {{assigning to}} |
347 | ui = ~si2; // expected-error {{assigning to}} |
348 | ui = ~bi2; // expected-error {{assigning to}} |
349 | |
350 | // ------------------------------------------------------------------------- |
351 | // Test binary +. |
352 | // ------------------------------------------------------------------------- |
353 | |
354 | sc = sc + sc2; |
355 | sc = sc + uc2; // expected-error {{cannot convert}} |
356 | sc = uc + sc2; // expected-error {{cannot convert}} |
357 | sc = sc + bc2; |
358 | sc = bc + sc2; |
359 | |
360 | uc = uc + uc2; |
361 | uc = sc + uc2; // expected-error {{cannot convert}} |
362 | uc = uc + sc2; // expected-error {{cannot convert}} |
363 | uc = bc + uc2; |
364 | uc = uc + bc2; |
365 | |
366 | bc = bc + bc2; // expected-error {{invalid operands}} |
367 | bc = bc + uc2; // expected-error {{incompatible type}} |
368 | bc = uc + bc2; // expected-error {{incompatible type}} |
369 | bc = bc + sc2; // expected-error {{incompatible type}} |
370 | bc = sc + bc2; // expected-error {{incompatible type}} |
371 | |
372 | sc = sc + sc_scalar; |
373 | sc = sc + uc_scalar; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}} |
374 | sc = sc_scalar + sc; |
375 | sc = uc_scalar + sc; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}} |
376 | uc = uc + sc_scalar; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}} |
377 | uc = uc + uc_scalar; |
378 | uc = sc_scalar + uc; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}} |
379 | uc = uc_scalar + uc; |
380 | |
381 | ss = ss + ss2; |
382 | us = us + us2; |
383 | bs = bs + bs2; // expected-error {{invalid operands}} |
384 | |
385 | si = si + si2; |
386 | ui = ui + ui2; |
387 | bi = bi + bi2; // expected-error {{invalid operands}} |
388 | |
389 | sl = sl + sl2; |
390 | ul = ul + ul2; |
391 | bl = bl + bl2; // expected-error {{invalid operands}} |
392 | |
393 | fd = fd + fd2; |
394 | fd = fd + ul2; // expected-error {{cannot convert}} |
395 | fd = sl + fd2; // expected-error {{cannot convert}} |
396 | |
397 | sc += sc2; |
398 | sc += uc2; // expected-error {{cannot convert}} |
399 | sc += bc2; |
400 | |
401 | uc += uc2; |
402 | uc += sc2; // expected-error {{cannot convert}} |
403 | uc += bc2; |
404 | |
405 | bc += bc2; // expected-error {{invalid operands}} |
406 | bc += sc2; // expected-error {{cannot convert}} |
407 | bc += uc2; // expected-error {{cannot convert}} |
408 | |
409 | sc += ss2; // expected-error {{cannot convert}} |
410 | sc += si2; // expected-error {{cannot convert}} |
411 | sc += sl2; // expected-error {{cannot convert}} |
412 | sc += fd2; // expected-error {{cannot convert}} |
413 | |
414 | sc += sc_scalar; |
415 | sc += uc_scalar; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}} |
416 | uc += sc_scalar; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}} |
417 | uc += uc_scalar; |
418 | |
419 | ss += ss2; |
420 | us += us2; |
421 | bs += bs2; // expected-error {{invalid operands}} |
422 | |
423 | si += si2; |
424 | ui += ui2; |
425 | bi += bi2; // expected-error {{invalid operands}} |
426 | |
427 | sl += sl2; |
428 | ul += ul2; |
429 | bl += bl2; // expected-error {{invalid operands}} |
430 | |
431 | fd += fd2; |
432 | |
433 | // ------------------------------------------------------------------------- |
434 | // Test that binary + rules apply to binary - too. |
435 | // ------------------------------------------------------------------------- |
436 | |
437 | sc = sc - sc2; |
438 | uc = uc - uc2; |
439 | bc = bc - bc2; // expected-error {{invalid operands}} |
440 | |
441 | sc = uc - sc2; // expected-error {{cannot convert}} |
442 | sc = sc - bc2; |
443 | uc = bc - uc2; |
444 | |
445 | sc -= sc2; |
446 | uc -= uc2; |
447 | bc -= bc2; // expected-error {{invalid operands}} |
448 | |
449 | sc -= uc2; // expected-error {{cannot convert}} |
450 | uc -= bc2; |
451 | bc -= sc2; // expected-error {{cannot convert}} |
452 | |
453 | ss -= ss2; |
454 | us -= us2; |
455 | bs -= bs2; // expected-error {{invalid operands}} |
456 | |
457 | si -= si2; |
458 | ui -= ui2; |
459 | bi -= bi2; // expected-error {{invalid operands}} |
460 | |
461 | sl -= sl2; |
462 | ul -= ul2; |
463 | bl -= bl2; // expected-error {{invalid operands}} |
464 | |
465 | fd -= fd2; |
466 | |
467 | // ------------------------------------------------------------------------- |
468 | // Test that binary + rules apply to * too. 64-bit integer multiplication |
469 | // is not required by the spec and so isn't tested here. |
470 | // ------------------------------------------------------------------------- |
471 | |
472 | sc = sc * sc2; |
473 | uc = uc * uc2; |
474 | bc = bc * bc2; // expected-error {{invalid operands}} |
475 | |
476 | sc = uc * sc2; // expected-error {{cannot convert}} |
477 | sc = sc * bc2; // expected-error {{cannot convert}} |
478 | uc = bc * uc2; // expected-error {{cannot convert}} |
479 | |
480 | sc *= sc2; |
481 | uc *= uc2; |
482 | bc *= bc2; // expected-error {{invalid operands}} |
483 | |
484 | sc *= uc2; // expected-error {{cannot convert}} |
485 | uc *= bc2; // expected-error {{cannot convert}} |
486 | bc *= sc2; // expected-error {{cannot convert}} |
487 | |
488 | ss *= ss2; |
489 | us *= us2; |
490 | bs *= bs2; // expected-error {{invalid operands}} |
491 | |
492 | si *= si2; |
493 | ui *= ui2; |
494 | bi *= bi2; // expected-error {{invalid operands}} |
495 | |
496 | sl *= sl2; |
497 | ul *= ul2; |
498 | bl *= bl2; // expected-error {{invalid operands}} |
499 | |
500 | fd *= fd2; |
501 | |
502 | // ------------------------------------------------------------------------- |
503 | // Test that * rules apply to / too. |
504 | // ------------------------------------------------------------------------- |
505 | |
506 | sc = sc / sc2; |
507 | uc = uc / uc2; |
508 | bc = bc / bc2; // expected-error {{invalid operands}} |
509 | |
510 | sc = uc / sc2; // expected-error {{cannot convert}} |
511 | sc = sc / bc2; // expected-error {{cannot convert}} |
512 | uc = bc / uc2; // expected-error {{cannot convert}} |
513 | |
514 | sc /= sc2; |
515 | uc /= uc2; |
516 | bc /= bc2; // expected-error {{invalid operands}} |
517 | |
518 | sc /= uc2; // expected-error {{cannot convert}} |
519 | uc /= bc2; // expected-error {{cannot convert}} |
520 | bc /= sc2; // expected-error {{cannot convert}} |
521 | |
522 | ss /= ss2; |
523 | us /= us2; |
524 | bs /= bs2; // expected-error {{invalid operands}} |
525 | |
526 | si /= si2; |
527 | ui /= ui2; |
528 | bi /= bi2; // expected-error {{invalid operands}} |
529 | |
530 | sl /= sl2; |
531 | ul /= ul2; |
532 | bl /= bl2; // expected-error {{invalid operands}} |
533 | |
534 | fd /= fd2; |
535 | |
536 | // ------------------------------------------------------------------------- |
537 | // Test that / rules apply to % too, except that doubles are not allowed. |
538 | // ------------------------------------------------------------------------- |
539 | |
540 | sc = sc % sc2; |
541 | uc = uc % uc2; |
542 | bc = bc % bc2; // expected-error {{invalid operands}} |
543 | |
544 | sc = uc % sc2; // expected-error {{cannot convert}} |
545 | sc = sc % bc2; // expected-error {{cannot convert}} |
546 | uc = bc % uc2; // expected-error {{cannot convert}} |
547 | |
548 | sc %= sc2; |
549 | uc %= uc2; |
550 | bc %= bc2; // expected-error {{invalid operands}} |
551 | |
552 | sc %= uc2; // expected-error {{cannot convert}} |
553 | uc %= bc2; // expected-error {{cannot convert}} |
554 | bc %= sc2; // expected-error {{cannot convert}} |
555 | |
556 | ss %= ss2; |
557 | us %= us2; |
558 | bs %= bs2; // expected-error {{invalid operands}} |
559 | |
560 | si %= si2; |
561 | ui %= ui2; |
562 | bi %= bi2; // expected-error {{invalid operands}} |
563 | |
564 | sl %= sl2; |
565 | ul %= ul2; |
566 | bl %= bl2; // expected-error {{invalid operands}} |
567 | |
568 | fd %= fd2; // expected-error {{invalid operands}} |
569 | |
570 | // ------------------------------------------------------------------------- |
571 | // Test &. |
572 | // ------------------------------------------------------------------------- |
573 | |
574 | sc = sc & sc2; |
575 | sc = sc & uc2; // expected-error {{cannot convert}} |
576 | sc = uc & sc2; // expected-error {{cannot convert}} |
577 | sc = sc & bc2; |
578 | sc = bc & sc2; |
579 | |
580 | uc = uc & uc2; |
581 | uc = sc & uc2; // expected-error {{cannot convert}} |
582 | uc = uc & sc2; // expected-error {{cannot convert}} |
583 | uc = bc & uc2; |
584 | uc = uc & bc2; |
585 | |
586 | bc = bc & bc2; |
587 | bc = bc & uc2; // expected-error {{incompatible type}} |
588 | bc = uc & bc2; // expected-error {{incompatible type}} |
589 | bc = bc & sc2; // expected-error {{incompatible type}} |
590 | bc = sc & bc2; // expected-error {{incompatible type}} |
591 | |
592 | fd = fd & fd2; // expected-error {{invalid operands}} |
593 | fd = bl & fd2; // expected-error {{invalid operands}} |
594 | fd = fd & bl2; // expected-error {{invalid operands}} |
595 | fd = fd & sl2; // expected-error {{invalid operands}} |
596 | fd = fd & ul2; // expected-error {{invalid operands}} |
597 | |
598 | sc &= sc2; |
599 | sc &= uc2; // expected-error {{cannot convert}} |
600 | sc &= bc2; |
601 | |
602 | uc &= uc2; |
603 | uc &= sc2; // expected-error {{cannot convert}} |
604 | uc &= bc2; |
605 | |
606 | bc &= bc2; |
607 | bc &= sc2; // expected-error {{cannot convert}} |
608 | bc &= uc2; // expected-error {{cannot convert}} |
609 | |
610 | sc &= ss2; // expected-error {{cannot convert}} |
611 | sc &= si2; // expected-error {{cannot convert}} |
612 | sc &= sl2; // expected-error {{cannot convert}} |
613 | sc &= fd2; // expected-error {{invalid operands}} |
614 | |
615 | us &= bc2; // expected-error {{cannot convert}} |
616 | ui &= bc2; // expected-error {{cannot convert}} |
617 | ul &= bc2; // expected-error {{cannot convert}} |
618 | fd &= bc2; // expected-error {{invalid operands}} |
619 | |
620 | ss &= ss2; |
621 | us &= us2; |
622 | bs &= bs2; |
623 | |
624 | si &= si2; |
625 | ui &= ui2; |
626 | bi &= bi2; |
627 | |
628 | sl &= sl2; |
629 | ul &= ul2; |
630 | bl &= bl2; |
631 | |
632 | // ------------------------------------------------------------------------- |
633 | // Test that & rules apply to | too. |
634 | // ------------------------------------------------------------------------- |
635 | |
636 | sc = sc | sc2; |
637 | sc = sc | uc2; // expected-error {{cannot convert}} |
638 | sc = sc | bc2; |
639 | |
640 | uc = uc | uc2; |
641 | uc = sc | uc2; // expected-error {{cannot convert}} |
642 | uc = bc | uc2; |
643 | |
644 | bc = bc | bc2; |
645 | bc = uc | bc2; // expected-error {{incompatible type}} |
646 | bc = bc | sc2; // expected-error {{incompatible type}} |
647 | |
648 | fd = fd | fd2; // expected-error {{invalid operands}} |
649 | fd = bl | fd2; // expected-error {{invalid operands}} |
650 | |
651 | ss |= ss2; |
652 | us |= us2; |
653 | bs |= bs2; |
654 | |
655 | si |= si2; |
656 | ui |= ui2; |
657 | bi |= bi2; |
658 | |
659 | sl |= sl2; |
660 | ul |= ul2; |
661 | bl |= bl2; |
662 | |
663 | fd |= bl2; // expected-error {{invalid operands}} |
664 | fd |= fd2; // expected-error {{invalid operands}} |
665 | |
666 | // ------------------------------------------------------------------------- |
667 | // Test that & rules apply to ^ too. |
668 | // ------------------------------------------------------------------------- |
669 | |
670 | sc = sc ^ sc2; |
671 | sc = sc ^ uc2; // expected-error {{cannot convert}} |
672 | sc = sc ^ bc2; |
673 | |
674 | uc = uc ^ uc2; |
675 | uc = sc ^ uc2; // expected-error {{cannot convert}} |
676 | uc = bc ^ uc2; |
677 | |
678 | bc = bc ^ bc2; |
679 | bc = uc ^ bc2; // expected-error {{incompatible type}} |
680 | bc = bc ^ sc2; // expected-error {{incompatible type}} |
681 | |
682 | fd = fd ^ fd2; // expected-error {{invalid operands}} |
683 | fd = bl ^ fd2; // expected-error {{invalid operands}} |
684 | |
685 | ss ^= ss2; |
686 | us ^= us2; |
687 | bs ^= bs2; |
688 | |
689 | si ^= si2; |
690 | ui ^= ui2; |
691 | bi ^= bi2; |
692 | |
693 | sl ^= sl2; |
694 | ul ^= ul2; |
695 | bl ^= bl2; |
696 | |
697 | fd ^= bl2; // expected-error {{invalid operands}} |
698 | fd ^= fd2; // expected-error {{invalid operands}} |
699 | |
700 | // ------------------------------------------------------------------------- |
701 | // Test <<. |
702 | // ------------------------------------------------------------------------- |
703 | |
704 | sc = sc << sc2; |
705 | sc = sc << uc2; |
706 | sc = uc << sc2; // expected-error {{incompatible type}} |
707 | sc = sc << bc2; // expected-error {{invalid operands}} |
708 | sc = bc << sc2; // expected-error {{invalid operands}} |
709 | |
710 | uc = uc << uc2; |
711 | uc = sc << uc2; // expected-error {{assigning to}} |
712 | uc = uc << sc2; |
713 | uc = bc << uc2; // expected-error {{invalid operands}} |
714 | uc = uc << bc2; // expected-error {{invalid operands}} |
715 | |
716 | bc = bc << bc2; // expected-error {{invalid operands}} |
717 | bc = bc << uc2; // expected-error {{invalid operands}} |
718 | bc = uc << bc2; // expected-error {{invalid operands}} |
719 | bc = bc << sc2; // expected-error {{invalid operands}} |
720 | bc = sc << bc2; // expected-error {{invalid operands}} |
721 | |
722 | sc = sc << 1; |
723 | sc = sc << 1.0f; // expected-error {{integer is required}} |
724 | sc = sc << sc_scalar; |
725 | sc = sc << uc_scalar; |
726 | sc = sc << ss_scalar; |
727 | sc = sc << us_scalar; |
728 | sc = sc << si_scalar; |
729 | sc = sc << ui_scalar; |
730 | sc = sc << sl_scalar; |
731 | sc = sc << ul_scalar; |
732 | sc = sc_scalar << sc; // expected-error {{first operand is not a vector}} |
733 | sc = uc_scalar << sc; // expected-error {{first operand is not a vector}} |
734 | uc = uc << sc_scalar; |
735 | uc = uc << uc_scalar; |
736 | uc = sc_scalar << uc; // expected-error {{first operand is not a vector}} |
737 | uc = uc_scalar << uc; // expected-error {{first operand is not a vector}} |
738 | |
739 | ss = ss << ss2; |
740 | ss = ss << ss_scalar; |
741 | us = us << us2; |
742 | us = us << us_scalar; |
743 | bs = bs << bs2; // expected-error {{invalid operands}} |
744 | |
745 | si = si << si2; |
746 | si = si << si_scalar; |
747 | ui = ui << ui2; |
748 | ui = ui << ui_scalar; |
749 | bi = bi << bi2; // expected-error {{invalid operands}} |
750 | |
751 | sl = sl << sl2; |
752 | sl = sl << sl_scalar; |
753 | ul = ul << ul2; |
754 | ul = ul << ul_scalar; |
755 | bl = bl << bl2; // expected-error {{invalid operands}} |
756 | |
757 | fd = fd << fd2; // expected-error {{integer is required}} |
758 | fd = fd << ul2; // expected-error {{integer is required}} |
759 | fd = sl << fd2; // expected-error {{integer is required}} |
760 | |
761 | sc <<= sc2; |
762 | sc <<= uc2; |
763 | sc <<= bc2; // expected-error {{invalid operands}} |
764 | sc <<= sc_scalar; |
765 | |
766 | uc <<= uc2; |
767 | uc <<= sc2; |
768 | uc <<= bc2; // expected-error {{invalid operands}} |
769 | uc <<= uc_scalar; |
770 | |
771 | bc <<= bc2; // expected-error {{invalid operands}} |
772 | bc <<= sc2; // expected-error {{invalid operands}} |
773 | bc <<= uc2; // expected-error {{invalid operands}} |
774 | |
775 | sc <<= ss2; // expected-error {{vector operands do not have the same number of elements}} |
776 | sc <<= si2; // expected-error {{vector operands do not have the same number of elements}} |
777 | sc <<= sl2; // expected-error {{vector operands do not have the same number of elements}} |
778 | sc <<= fd2; // expected-error {{integer is required}} |
779 | |
780 | ss <<= ss2; |
781 | ss <<= ss_scalar; |
782 | us <<= us2; |
783 | us <<= us_scalar; |
784 | bs <<= bs2; // expected-error {{invalid operands}} |
785 | |
786 | si <<= si2; |
787 | si <<= si_scalar; |
788 | ui <<= ui2; |
789 | ui <<= ui_scalar; |
790 | bi <<= bi2; // expected-error {{invalid operands}} |
791 | |
792 | sl <<= sl2; |
793 | sl <<= sl_scalar; |
794 | ul <<= ul2; |
795 | ul <<= ul_scalar; |
796 | bl <<= bl2; // expected-error {{invalid operands}} |
797 | |
798 | fd <<= fd2; // expected-error {{integer is required}} |
799 | |
800 | // ------------------------------------------------------------------------- |
801 | // Test >>. |
802 | // ------------------------------------------------------------------------- |
803 | |
804 | sc = sc >> sc2; |
805 | sc = sc >> uc2; |
806 | sc = uc >> sc2; // expected-error {{incompatible type}} |
807 | sc = sc >> bc2; // expected-error {{invalid operands}} |
808 | sc = bc >> sc2; // expected-error {{invalid operands}} |
809 | |
810 | uc = uc >> uc2; |
811 | uc = sc >> uc2; // expected-error {{assigning to}} |
812 | uc = uc >> sc2; |
813 | uc = bc >> uc2; // expected-error {{invalid operands}} |
814 | uc = uc >> bc2; // expected-error {{invalid operands}} |
815 | |
816 | bc = bc >> bc2; // expected-error {{invalid operands}} |
817 | bc = bc >> uc2; // expected-error {{invalid operands}} |
818 | bc = uc >> bc2; // expected-error {{invalid operands}} |
819 | bc = bc >> sc2; // expected-error {{invalid operands}} |
820 | bc = sc >> bc2; // expected-error {{invalid operands}} |
821 | |
822 | sc = sc >> 1; |
823 | sc = sc >> 1.0f; // expected-error {{integer is required}} |
824 | sc = sc >> sc_scalar; |
825 | sc = sc >> uc_scalar; |
826 | sc = sc >> ss_scalar; |
827 | sc = sc >> us_scalar; |
828 | sc = sc >> si_scalar; |
829 | sc = sc >> ui_scalar; |
830 | sc = sc >> sl_scalar; |
831 | sc = sc >> ul_scalar; |
832 | sc = sc_scalar >> sc; // expected-error {{first operand is not a vector}} |
833 | sc = uc_scalar >> sc; // expected-error {{first operand is not a vector}} |
834 | uc = uc >> sc_scalar; |
835 | uc = uc >> uc_scalar; |
836 | uc = sc_scalar >> uc; // expected-error {{first operand is not a vector}} |
837 | uc = uc_scalar >> uc; // expected-error {{first operand is not a vector}} |
838 | |
839 | ss = ss >> ss2; |
840 | ss = ss >> ss_scalar; |
841 | us = us >> us2; |
842 | us = us >> us_scalar; |
843 | bs = bs >> bs2; // expected-error {{invalid operands}} |
844 | |
845 | si = si >> si2; |
846 | si = si >> si_scalar; |
847 | ui = ui >> ui2; |
848 | ui = ui >> ui_scalar; |
849 | bi = bi >> bi2; // expected-error {{invalid operands}} |
850 | |
851 | sl = sl >> sl2; |
852 | sl = sl >> sl_scalar; |
853 | ul = ul >> ul2; |
854 | ul = ul >> ul_scalar; |
855 | bl = bl >> bl2; // expected-error {{invalid operands}} |
856 | |
857 | fd = fd >> fd2; // expected-error {{integer is required}} |
858 | fd = fd >> ul2; // expected-error {{integer is required}} |
859 | fd = sl >> fd2; // expected-error {{integer is required}} |
860 | |
861 | sc >>= sc2; |
862 | sc >>= uc2; |
863 | sc >>= bc2; // expected-error {{invalid operands}} |
864 | sc >>= sc_scalar; |
865 | |
866 | uc >>= uc2; |
867 | uc >>= sc2; |
868 | uc >>= bc2; // expected-error {{invalid operands}} |
869 | uc >>= uc_scalar; |
870 | |
871 | bc >>= bc2; // expected-error {{invalid operands}} |
872 | bc >>= sc2; // expected-error {{invalid operands}} |
873 | bc >>= uc2; // expected-error {{invalid operands}} |
874 | |
875 | sc >>= ss2; // expected-error {{vector operands do not have the same number of elements}} |
876 | sc >>= si2; // expected-error {{vector operands do not have the same number of elements}} |
877 | sc >>= sl2; // expected-error {{vector operands do not have the same number of elements}} |
878 | sc >>= fd2; // expected-error {{integer is required}} |
879 | |
880 | ss >>= ss2; |
881 | ss >>= ss_scalar; |
882 | us >>= us2; |
883 | us >>= us_scalar; |
884 | bs >>= bs2; // expected-error {{invalid operands}} |
885 | |
886 | si >>= si2; |
887 | si >>= si_scalar; |
888 | ui >>= ui2; |
889 | ui >>= ui_scalar; |
890 | bi >>= bi2; // expected-error {{invalid operands}} |
891 | |
892 | sl >>= sl2; |
893 | sl >>= sl_scalar; |
894 | ul >>= ul2; |
895 | ul >>= ul_scalar; |
896 | bl >>= bl2; // expected-error {{invalid operands}} |
897 | |
898 | fd >>= fd2; // expected-error {{integer is required}} |
899 | |
900 | // ------------------------------------------------------------------------- |
901 | // Test ==. |
902 | // ------------------------------------------------------------------------- |
903 | |
904 | (void)(sc == sc2); |
905 | (void)(uc == uc2); |
906 | (void)(bc == bc2); |
907 | |
908 | (void)(sc == uc); // expected-error {{cannot convert}} |
909 | (void)(sc == bc); |
910 | |
911 | (void)(uc == sc); // expected-error {{cannot convert}} |
912 | (void)(uc == bc); |
913 | |
914 | (void)(bc == sc); |
915 | (void)(bc == uc); |
916 | |
917 | (void)(ss == ss2); |
918 | (void)(us == us2); |
919 | (void)(bs == bs2); |
920 | |
921 | (void)(si == si2); |
922 | (void)(ui == ui2); |
923 | (void)(bi == bi2); |
924 | |
925 | (void)(sl == sl2); |
926 | (void)(ul == ul2); |
927 | (void)(bl == bl2); |
928 | (void)(fd == fd2); |
929 | |
930 | (void)(fd == ul); // expected-error {{cannot convert}} |
931 | (void)(ul == fd); // expected-error {{cannot convert}} |
932 | |
933 | // ------------------------------------------------------------------------- |
934 | // Test that == rules apply to != too. |
935 | // ------------------------------------------------------------------------- |
936 | |
937 | (void)(sc != sc2); |
938 | (void)(uc != uc2); |
939 | (void)(bc != bc2); |
940 | |
941 | (void)(sc != uc); // expected-error {{cannot convert}} |
942 | (void)(sc != bc); |
943 | |
944 | (void)(ss != ss2); |
945 | (void)(us != us2); |
946 | (void)(bs != bs2); |
947 | |
948 | (void)(si != si2); |
949 | (void)(ui != ui2); |
950 | (void)(bi != bi2); |
951 | |
952 | (void)(sl != sl2); |
953 | (void)(ul != ul2); |
954 | (void)(bl != bl2); |
955 | (void)(fd != fd2); |
956 | |
957 | // ------------------------------------------------------------------------- |
958 | // Test that == rules apply to <= too. |
959 | // ------------------------------------------------------------------------- |
960 | |
961 | (void)(sc <= sc2); |
962 | (void)(uc <= uc2); |
963 | (void)(bc <= bc2); |
964 | |
965 | (void)(sc <= uc); // expected-error {{cannot convert}} |
966 | (void)(sc <= bc); |
967 | |
968 | (void)(ss <= ss2); |
969 | (void)(us <= us2); |
970 | (void)(bs <= bs2); |
971 | |
972 | (void)(si <= si2); |
973 | (void)(ui <= ui2); |
974 | (void)(bi <= bi2); |
975 | |
976 | (void)(sl <= sl2); |
977 | (void)(ul <= ul2); |
978 | (void)(bl <= bl2); |
979 | (void)(fd <= fd2); |
980 | |
981 | // ------------------------------------------------------------------------- |
982 | // Test that == rules apply to >= too. |
983 | // ------------------------------------------------------------------------- |
984 | |
985 | (void)(sc >= sc2); |
986 | (void)(uc >= uc2); |
987 | (void)(bc >= bc2); |
988 | |
989 | (void)(sc >= uc); // expected-error {{cannot convert}} |
990 | (void)(sc >= bc); |
991 | |
992 | (void)(ss >= ss2); |
993 | (void)(us >= us2); |
994 | (void)(bs >= bs2); |
995 | |
996 | (void)(si >= si2); |
997 | (void)(ui >= ui2); |
998 | (void)(bi >= bi2); |
999 | |
1000 | (void)(sl >= sl2); |
1001 | (void)(ul >= ul2); |
1002 | (void)(bl >= bl2); |
1003 | (void)(fd >= fd2); |
1004 | |
1005 | // ------------------------------------------------------------------------- |
1006 | // Test that == rules apply to < too. |
1007 | // ------------------------------------------------------------------------- |
1008 | |
1009 | (void)(sc < sc2); |
1010 | (void)(uc < uc2); |
1011 | (void)(bc < bc2); |
1012 | |
1013 | (void)(sc < uc); // expected-error {{cannot convert}} |
1014 | (void)(sc < bc); |
1015 | |
1016 | (void)(ss < ss2); |
1017 | (void)(us < us2); |
1018 | (void)(bs < bs2); |
1019 | |
1020 | (void)(si < si2); |
1021 | (void)(ui < ui2); |
1022 | (void)(bi < bi2); |
1023 | |
1024 | (void)(sl < sl2); |
1025 | (void)(ul < ul2); |
1026 | (void)(bl < bl2); |
1027 | (void)(fd < fd2); |
1028 | |
1029 | // ------------------------------------------------------------------------- |
1030 | // Test that == rules apply to > too. |
1031 | // ------------------------------------------------------------------------- |
1032 | |
1033 | (void)(sc > sc2); |
1034 | (void)(uc > uc2); |
1035 | (void)(bc > bc2); |
1036 | |
1037 | (void)(sc > uc); // expected-error {{cannot convert}} |
1038 | (void)(sc > bc); |
1039 | |
1040 | (void)(ss > ss2); |
1041 | (void)(us > us2); |
1042 | (void)(bs > bs2); |
1043 | |
1044 | (void)(si > si2); |
1045 | (void)(ui > ui2); |
1046 | (void)(bi > bi2); |
1047 | |
1048 | (void)(sl > sl2); |
1049 | (void)(ul > ul2); |
1050 | (void)(bl > bl2); |
1051 | (void)(fd > fd2); |
1052 | } |
1053 | |