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