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