1# RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s 2# RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s 3--- | 4 define void @test_add_s8() { ret void } 5 define void @test_add_s16() { ret void } 6 define void @test_add_s32() { ret void } 7 8 define void @test_sub_s8() { ret void } 9 define void @test_sub_s16() { ret void } 10 define void @test_sub_s32() { ret void } 11 12 define void @test_mul_s8() { ret void } 13 define void @test_mul_s16() { ret void } 14 define void @test_mul_s32() { ret void } 15 16 define void @test_and_s8() { ret void } 17 define void @test_and_s16() { ret void } 18 define void @test_and_s32() { ret void } 19 define void @test_and_s64() { ret void } 20 21 define void @test_or_s8() { ret void } 22 define void @test_or_s16() { ret void } 23 define void @test_or_s32() { ret void } 24 define void @test_or_s64() { ret void } 25 26 define void @test_xor_s8() { ret void } 27 define void @test_xor_s16() { ret void } 28 define void @test_xor_s32() { ret void } 29 define void @test_xor_s64() { ret void } 30 31 define void @test_lshr_s32() { ret void } 32 define void @test_ashr_s32() { ret void } 33 define void @test_shl_s32() { ret void } 34 35 define void @test_shift_s8() { ret void } 36 define void @test_shift_s16() { ret void } 37 define void @test_shift_amount_s8() { ret void } 38 define void @test_shift_amount_s16() { ret void } 39... 40--- 41name: test_add_s8 42# CHECK-LABEL: name: test_add_s8 43legalized: false 44# CHECK: legalized: true 45regBankSelected: false 46selected: false 47tracksRegLiveness: true 48registers: 49 - { id: 0, class: _ } 50 - { id: 1, class: _ } 51 - { id: 2, class: _ } 52 - { id: 3, class: _ } 53 - { id: 4, class: _ } 54 - { id: 5, class: _ } 55body: | 56 bb.0: 57 liveins: $r0, $r1 58 59 %0(p0) = COPY $r0 60 %1(s8) = G_LOAD %0 :: (load (s8)) 61 %2(p0) = COPY $r0 62 %3(s8) = G_LOAD %2 :: (load (s8)) 63 %4(s8) = G_ADD %1, %3 64 ; G_ADD with s8 should widen 65 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_ADD {{%[0-9]+, %[0-9]+}} 66 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 67 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_ADD {{%[0-9]+, %[0-9]+}} 68 %5(s32) = G_SEXT %4(s8) 69 $r0 = COPY %5(s32) 70 BX_RET 14, $noreg, implicit $r0 71... 72--- 73name: test_add_s16 74# CHECK-LABEL: name: test_add_s16 75legalized: false 76# CHECK: legalized: true 77regBankSelected: false 78selected: false 79tracksRegLiveness: true 80registers: 81 - { id: 0, class: _ } 82 - { id: 1, class: _ } 83 - { id: 2, class: _ } 84 - { id: 3, class: _ } 85 - { id: 4, class: _ } 86 - { id: 5, class: _ } 87body: | 88 bb.0: 89 liveins: $r0, $r1 90 91 %0(p0) = COPY $r0 92 %1(s16) = G_LOAD %0 :: (load (s16)) 93 %2(p0) = COPY $r0 94 %3(s16) = G_LOAD %2 :: (load (s16)) 95 %4(s16) = G_ADD %1, %3 96 ; G_ADD with s16 should widen 97 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_ADD {{%[0-9]+, %[0-9]+}} 98 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 99 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_ADD {{%[0-9]+, %[0-9]+}} 100 %5(s32) = G_SEXT %4(s16) 101 $r0 = COPY %5(s32) 102 BX_RET 14, $noreg, implicit $r0 103... 104--- 105name: test_add_s32 106# CHECK-LABEL: name: test_add_s32 107legalized: false 108# CHECK: legalized: true 109regBankSelected: false 110selected: false 111tracksRegLiveness: true 112registers: 113 - { id: 0, class: _ } 114 - { id: 1, class: _ } 115 - { id: 2, class: _ } 116body: | 117 bb.0: 118 liveins: $r0, $r1 119 120 %0(s32) = COPY $r0 121 %1(s32) = COPY $r1 122 %2(s32) = G_ADD %0, %1 123 ; G_ADD with s32 is legal, so we should find it unchanged in the output 124 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 125 $r0 = COPY %2(s32) 126 BX_RET 14, $noreg, implicit $r0 127 128... 129--- 130name: test_sub_s8 131# CHECK-LABEL: name: test_sub_s8 132legalized: false 133# CHECK: legalized: true 134regBankSelected: false 135selected: false 136tracksRegLiveness: true 137registers: 138 - { id: 0, class: _ } 139 - { id: 1, class: _ } 140 - { id: 2, class: _ } 141 - { id: 3, class: _ } 142 - { id: 4, class: _ } 143 - { id: 5, class: _ } 144body: | 145 bb.0: 146 liveins: $r0, $r1 147 148 %0(p0) = COPY $r0 149 %1(s8) = G_LOAD %0 :: (load (s8)) 150 %2(p0) = COPY $r0 151 %3(s8) = G_LOAD %2 :: (load (s8)) 152 %4(s8) = G_SUB %1, %3 153 ; G_SUB with s8 should widen 154 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SUB {{%[0-9]+, %[0-9]+}} 155 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 156 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SUB {{%[0-9]+, %[0-9]+}} 157 %5(s32) = G_SEXT %4(s8) 158 $r0 = COPY %5(s32) 159 BX_RET 14, $noreg, implicit $r0 160... 161--- 162name: test_sub_s16 163# CHECK-LABEL: name: test_sub_s16 164legalized: false 165# CHECK: legalized: true 166regBankSelected: false 167selected: false 168tracksRegLiveness: true 169registers: 170 - { id: 0, class: _ } 171 - { id: 1, class: _ } 172 - { id: 2, class: _ } 173 - { id: 3, class: _ } 174 - { id: 4, class: _ } 175 - { id: 5, class: _ } 176body: | 177 bb.0: 178 liveins: $r0, $r1 179 180 %0(p0) = COPY $r0 181 %1(s16) = G_LOAD %0 :: (load (s16)) 182 %2(p0) = COPY $r0 183 %3(s16) = G_LOAD %2 :: (load (s16)) 184 %4(s16) = G_SUB %1, %3 185 ; G_SUB with s16 should widen 186 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SUB {{%[0-9]+, %[0-9]+}} 187 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 188 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SUB {{%[0-9]+, %[0-9]+}} 189 %5(s32) = G_SEXT %4(s16) 190 $r0 = COPY %5(s32) 191 BX_RET 14, $noreg, implicit $r0 192... 193--- 194name: test_sub_s32 195# CHECK-LABEL: name: test_sub_s32 196legalized: false 197# CHECK: legalized: true 198regBankSelected: false 199selected: false 200tracksRegLiveness: true 201registers: 202 - { id: 0, class: _ } 203 - { id: 1, class: _ } 204 - { id: 2, class: _ } 205body: | 206 bb.0: 207 liveins: $r0, $r1 208 209 %0(s32) = COPY $r0 210 %1(s32) = COPY $r1 211 %2(s32) = G_SUB %0, %1 212 ; G_SUB with s32 is legal, so we should find it unchanged in the output 213 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 214 $r0 = COPY %2(s32) 215 BX_RET 14, $noreg, implicit $r0 216 217... 218--- 219name: test_mul_s8 220# CHECK-LABEL: name: test_mul_s8 221legalized: false 222# CHECK: legalized: true 223regBankSelected: false 224selected: false 225tracksRegLiveness: true 226registers: 227 - { id: 0, class: _ } 228 - { id: 1, class: _ } 229 - { id: 2, class: _ } 230 - { id: 3, class: _ } 231 - { id: 4, class: _ } 232 - { id: 5, class: _ } 233body: | 234 bb.0: 235 liveins: $r0, $r1 236 237 %0(p0) = COPY $r0 238 %1(s8) = G_LOAD %0 :: (load (s8)) 239 %2(p0) = COPY $r0 240 %3(s8) = G_LOAD %2 :: (load (s8)) 241 %4(s8) = G_MUL %1, %3 242 ; G_MUL with s8 should widen 243 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_MUL {{%[0-9]+, %[0-9]+}} 244 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 245 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_MUL {{%[0-9]+, %[0-9]+}} 246 %5(s32) = G_SEXT %4(s8) 247 $r0 = COPY %5(s32) 248 BX_RET 14, $noreg, implicit $r0 249... 250--- 251name: test_mul_s16 252# CHECK-LABEL: name: test_mul_s16 253legalized: false 254# CHECK: legalized: true 255regBankSelected: false 256selected: false 257tracksRegLiveness: true 258registers: 259 - { id: 0, class: _ } 260 - { id: 1, class: _ } 261 - { id: 2, class: _ } 262 - { id: 3, class: _ } 263 - { id: 4, class: _ } 264 - { id: 5, class: _ } 265body: | 266 bb.0: 267 liveins: $r0, $r1 268 269 %0(p0) = COPY $r0 270 %1(s16) = G_LOAD %0 :: (load (s16)) 271 %2(p0) = COPY $r0 272 %3(s16) = G_LOAD %2 :: (load (s16)) 273 %4(s16) = G_MUL %1, %3 274 ; G_MUL with s16 should widen 275 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_MUL {{%[0-9]+, %[0-9]+}} 276 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 277 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_MUL {{%[0-9]+, %[0-9]+}} 278 %5(s32) = G_SEXT %4(s16) 279 $r0 = COPY %5(s32) 280 BX_RET 14, $noreg, implicit $r0 281... 282--- 283name: test_mul_s32 284# CHECK-LABEL: name: test_mul_s32 285legalized: false 286# CHECK: legalized: true 287regBankSelected: false 288selected: false 289tracksRegLiveness: true 290registers: 291 - { id: 0, class: _ } 292 - { id: 1, class: _ } 293 - { id: 2, class: _ } 294body: | 295 bb.0: 296 liveins: $r0, $r1 297 298 %0(s32) = COPY $r0 299 %1(s32) = COPY $r1 300 %2(s32) = G_MUL %0, %1 301 ; G_MUL with s32 is legal, so we should find it unchanged in the output 302 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 303 $r0 = COPY %2(s32) 304 BX_RET 14, $noreg, implicit $r0 305 306... 307--- 308name: test_and_s8 309# CHECK-LABEL: name: test_and_s8 310legalized: false 311# CHECK: legalized: true 312regBankSelected: false 313selected: false 314tracksRegLiveness: true 315registers: 316 - { id: 0, class: _ } 317 - { id: 1, class: _ } 318 - { id: 2, class: _ } 319 - { id: 3, class: _ } 320 - { id: 4, class: _ } 321 - { id: 5, class: _ } 322body: | 323 bb.0: 324 liveins: $r0, $r1 325 326 %0(p0) = COPY $r0 327 %1(s8) = G_LOAD %0 :: (load (s8)) 328 %2(p0) = COPY $r0 329 %3(s8) = G_LOAD %2 :: (load (s8)) 330 %4(s8) = G_AND %1, %3 331 ; G_AND with s8 should widen 332 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_AND {{%[0-9]+, %[0-9]+}} 333 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 334 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_AND {{%[0-9]+, %[0-9]+}} 335 %5(s32) = G_SEXT %4(s8) 336 $r0 = COPY %5(s32) 337 BX_RET 14, $noreg, implicit $r0 338... 339--- 340name: test_and_s16 341# CHECK-LABEL: name: test_and_s16 342legalized: false 343# CHECK: legalized: true 344regBankSelected: false 345selected: false 346tracksRegLiveness: true 347registers: 348 - { id: 0, class: _ } 349 - { id: 1, class: _ } 350 - { id: 2, class: _ } 351 - { id: 3, class: _ } 352 - { id: 4, class: _ } 353 - { id: 5, class: _ } 354body: | 355 bb.0: 356 liveins: $r0, $r1 357 358 %0(p0) = COPY $r0 359 %1(s16) = G_LOAD %0 :: (load (s16)) 360 %2(p0) = COPY $r0 361 %3(s16) = G_LOAD %2 :: (load (s16)) 362 %4(s16) = G_AND %1, %3 363 ; G_AND with s16 should widen 364 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_AND {{%[0-9]+, %[0-9]+}} 365 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 366 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_AND {{%[0-9]+, %[0-9]+}} 367 %5(s32) = G_SEXT %4(s16) 368 $r0 = COPY %5(s32) 369 BX_RET 14, $noreg, implicit $r0 370... 371--- 372name: test_and_s32 373# CHECK-LABEL: name: test_and_s32 374legalized: false 375# CHECK: legalized: true 376regBankSelected: false 377selected: false 378tracksRegLiveness: true 379registers: 380 - { id: 0, class: _ } 381 - { id: 1, class: _ } 382 - { id: 2, class: _ } 383body: | 384 bb.0: 385 liveins: $r0, $r1 386 387 %0(s32) = COPY $r0 388 %1(s32) = COPY $r1 389 %2(s32) = G_AND %0, %1 390 ; G_AND with s32 is legal, so we should find it unchanged in the output 391 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 392 $r0 = COPY %2(s32) 393 BX_RET 14, $noreg, implicit $r0 394 395... 396--- 397name: test_and_s64 398# CHECK-LABEL: name: test_and_s64 399legalized: false 400# CHECK: legalized: true 401regBankSelected: false 402selected: false 403tracksRegLiveness: true 404registers: 405 - { id: 0, class: _ } 406 - { id: 1, class: _ } 407 - { id: 2, class: _ } 408 - { id: 3, class: _ } 409 - { id: 4, class: _ } 410 - { id: 5, class: _ } 411 - { id: 6, class: _ } 412 - { id: 7, class: _ } 413 - { id: 8, class: _ } 414body: | 415 bb.0: 416 liveins: $r0, $r1, $r2, $r3 417 418 %0(s32) = COPY $r0 419 %1(s32) = COPY $r1 420 %2(s32) = COPY $r2 421 %3(s32) = COPY $r3 422 %4(s64) = G_MERGE_VALUES %0(s32), %1(s32) 423 %5(s64) = G_MERGE_VALUES %2(s32), %3(s32) 424 %6(s64) = G_AND %4, %5 425 %7(s32), %8(s32) = G_UNMERGE_VALUES %6(s64) 426 $r0 = COPY %7(s32) 427 $r1 = COPY %8(s32) 428 BX_RET 14, $noreg, implicit $r0, implicit $r1 429 430... 431--- 432name: test_or_s8 433# CHECK-LABEL: name: test_or_s8 434legalized: false 435# CHECK: legalized: true 436regBankSelected: false 437selected: false 438tracksRegLiveness: true 439registers: 440 - { id: 0, class: _ } 441 - { id: 1, class: _ } 442 - { id: 2, class: _ } 443 - { id: 3, class: _ } 444 - { id: 4, class: _ } 445 - { id: 5, class: _ } 446body: | 447 bb.0: 448 liveins: $r0, $r1 449 450 %0(p0) = COPY $r0 451 %1(s8) = G_LOAD %0 :: (load (s8)) 452 %2(p0) = COPY $r0 453 %3(s8) = G_LOAD %2 :: (load (s8)) 454 %4(s8) = G_OR %1, %3 455 ; G_OR with s8 should widen 456 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_OR {{%[0-9]+, %[0-9]+}} 457 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 458 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_OR {{%[0-9]+, %[0-9]+}} 459 %5(s32) = G_SEXT %4(s8) 460 $r0 = COPY %5(s32) 461 BX_RET 14, $noreg, implicit $r0 462... 463--- 464name: test_or_s16 465# CHECK-LABEL: name: test_or_s16 466legalized: false 467# CHECK: legalized: true 468regBankSelected: false 469selected: false 470tracksRegLiveness: true 471registers: 472 - { id: 0, class: _ } 473 - { id: 1, class: _ } 474 - { id: 2, class: _ } 475 - { id: 3, class: _ } 476 - { id: 4, class: _ } 477 - { id: 5, class: _ } 478body: | 479 bb.0: 480 liveins: $r0, $r1 481 482 %0(p0) = COPY $r0 483 %1(s16) = G_LOAD %0 :: (load (s16)) 484 %2(p0) = COPY $r0 485 %3(s16) = G_LOAD %2 :: (load (s16)) 486 %4(s16) = G_OR %1, %3 487 ; G_OR with s16 should widen 488 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_OR {{%[0-9]+, %[0-9]+}} 489 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 490 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_OR {{%[0-9]+, %[0-9]+}} 491 %5(s32) = G_SEXT %4(s16) 492 $r0 = COPY %5(s32) 493 BX_RET 14, $noreg, implicit $r0 494... 495--- 496name: test_or_s32 497# CHECK-LABEL: name: test_or_s32 498legalized: false 499# CHECK: legalized: true 500regBankSelected: false 501selected: false 502tracksRegLiveness: true 503registers: 504 - { id: 0, class: _ } 505 - { id: 1, class: _ } 506 - { id: 2, class: _ } 507body: | 508 bb.0: 509 liveins: $r0, $r1 510 511 %0(s32) = COPY $r0 512 %1(s32) = COPY $r1 513 %2(s32) = G_OR %0, %1 514 ; G_OR with s32 is legal, so we should find it unchanged in the output 515 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 516 $r0 = COPY %2(s32) 517 BX_RET 14, $noreg, implicit $r0 518 519... 520--- 521name: test_or_s64 522# CHECK-LABEL: name: test_or_s64 523legalized: false 524# CHECK: legalized: true 525regBankSelected: false 526selected: false 527tracksRegLiveness: true 528registers: 529 - { id: 0, class: _ } 530 - { id: 1, class: _ } 531 - { id: 2, class: _ } 532 - { id: 3, class: _ } 533 - { id: 4, class: _ } 534 - { id: 5, class: _ } 535 - { id: 6, class: _ } 536 - { id: 7, class: _ } 537 - { id: 8, class: _ } 538body: | 539 bb.0: 540 liveins: $r0, $r1, $r2, $r3 541 542 %0(s32) = COPY $r0 543 %1(s32) = COPY $r1 544 %2(s32) = COPY $r2 545 %3(s32) = COPY $r3 546 %4(s64) = G_MERGE_VALUES %0(s32), %1(s32) 547 %5(s64) = G_MERGE_VALUES %2(s32), %3(s32) 548 %6(s64) = G_OR %4, %5 549 %7(s32), %8(s32) = G_UNMERGE_VALUES %6(s64) 550 $r0 = COPY %7(s32) 551 $r1 = COPY %8(s32) 552 BX_RET 14, $noreg, implicit $r0, implicit $r1 553 554... 555--- 556name: test_xor_s8 557# CHECK-LABEL: name: test_xor_s8 558legalized: false 559# CHECK: legalized: true 560regBankSelected: false 561selected: false 562tracksRegLiveness: true 563registers: 564 - { id: 0, class: _ } 565 - { id: 1, class: _ } 566 - { id: 2, class: _ } 567 - { id: 3, class: _ } 568 - { id: 4, class: _ } 569 - { id: 5, class: _ } 570body: | 571 bb.0: 572 liveins: $r0, $r1 573 574 %0(p0) = COPY $r0 575 %1(s8) = G_LOAD %0 :: (load (s8)) 576 %2(p0) = COPY $r0 577 %3(s8) = G_LOAD %2 :: (load (s8)) 578 %4(s8) = G_XOR %1, %3 579 ; G_XOR with s8 should widen 580 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_XOR {{%[0-9]+, %[0-9]+}} 581 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 582 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_XOR {{%[0-9]+, %[0-9]+}} 583 %5(s32) = G_SEXT %4(s8) 584 $r0 = COPY %5(s32) 585 BX_RET 14, $noreg, implicit $r0 586... 587--- 588name: test_xor_s16 589# CHECK-LABEL: name: test_xor_s16 590legalized: false 591# CHECK: legalized: true 592regBankSelected: false 593selected: false 594tracksRegLiveness: true 595registers: 596 - { id: 0, class: _ } 597 - { id: 1, class: _ } 598 - { id: 2, class: _ } 599 - { id: 3, class: _ } 600 - { id: 4, class: _ } 601 - { id: 5, class: _ } 602body: | 603 bb.0: 604 liveins: $r0, $r1 605 606 %0(p0) = COPY $r0 607 %1(s16) = G_LOAD %0 :: (load (s16)) 608 %2(p0) = COPY $r0 609 %3(s16) = G_LOAD %2 :: (load (s16)) 610 %4(s16) = G_XOR %1, %3 611 ; G_XOR with s16 should widen 612 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_XOR {{%[0-9]+, %[0-9]+}} 613 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 614 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_XOR {{%[0-9]+, %[0-9]+}} 615 %5(s32) = G_SEXT %4(s16) 616 $r0 = COPY %5(s32) 617 BX_RET 14, $noreg, implicit $r0 618... 619--- 620name: test_xor_s32 621# CHECK-LABEL: name: test_xor_s32 622legalized: false 623# CHECK: legalized: true 624regBankSelected: false 625selected: false 626tracksRegLiveness: true 627registers: 628 - { id: 0, class: _ } 629 - { id: 1, class: _ } 630 - { id: 2, class: _ } 631body: | 632 bb.0: 633 liveins: $r0, $r1 634 635 %0(s32) = COPY $r0 636 %1(s32) = COPY $r1 637 %2(s32) = G_XOR %0, %1 638 ; G_XOR with s32 is legal, so we should find it unchanged in the output 639 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 640 $r0 = COPY %2(s32) 641 BX_RET 14, $noreg, implicit $r0 642 643... 644--- 645name: test_xor_s64 646# CHECK-LABEL: name: test_xor_s64 647legalized: false 648# CHECK: legalized: true 649regBankSelected: false 650selected: false 651tracksRegLiveness: true 652registers: 653 - { id: 0, class: _ } 654 - { id: 1, class: _ } 655 - { id: 2, class: _ } 656 - { id: 3, class: _ } 657 - { id: 4, class: _ } 658 - { id: 5, class: _ } 659 - { id: 6, class: _ } 660 - { id: 7, class: _ } 661 - { id: 8, class: _ } 662body: | 663 bb.0: 664 liveins: $r0, $r1, $r2, $r3 665 666 %0(s32) = COPY $r0 667 %1(s32) = COPY $r1 668 %2(s32) = COPY $r2 669 %3(s32) = COPY $r3 670 %4(s64) = G_MERGE_VALUES %0(s32), %1(s32) 671 %5(s64) = G_MERGE_VALUES %2(s32), %3(s32) 672 %6(s64) = G_XOR %4, %5 673 %7(s32), %8(s32) = G_UNMERGE_VALUES %6(s64) 674 $r0 = COPY %7(s32) 675 $r1 = COPY %8(s32) 676 BX_RET 14, $noreg, implicit $r0, implicit $r1 677 678... 679--- 680name: test_lshr_s32 681# CHECK-LABEL: name: test_lshr_s32 682legalized: false 683# CHECK: legalized: true 684regBankSelected: false 685selected: false 686tracksRegLiveness: true 687registers: 688 - { id: 0, class: _ } 689 - { id: 1, class: _ } 690 - { id: 2, class: _ } 691body: | 692 bb.0: 693 liveins: $r0, $r1 694 695 %0(s32) = COPY $r0 696 %1(s32) = COPY $r1 697 %2(s32) = G_LSHR %0, %1 698 ; G_LSHR with s32 is legal, so we should find it unchanged in the output 699 ; CHECK: {{%[0-9]+}}:_(s32) = G_LSHR {{%[0-9]+, %[0-9]+}} 700 $r0 = COPY %2(s32) 701 BX_RET 14, $noreg, implicit $r0 702 703... 704--- 705name: test_ashr_s32 706# CHECK-LABEL: name: test_ashr_s32 707legalized: false 708# CHECK: legalized: true 709regBankSelected: false 710selected: false 711tracksRegLiveness: true 712registers: 713 - { id: 0, class: _ } 714 - { id: 1, class: _ } 715 - { id: 2, class: _ } 716body: | 717 bb.0: 718 liveins: $r0, $r1 719 720 %0(s32) = COPY $r0 721 %1(s32) = COPY $r1 722 %2(s32) = G_ASHR %0, %1 723 ; G_ASHR with s32 is legal, so we should find it unchanged in the output 724 ; CHECK: {{%[0-9]+}}:_(s32) = G_ASHR {{%[0-9]+, %[0-9]+}} 725 $r0 = COPY %2(s32) 726 BX_RET 14, $noreg, implicit $r0 727 728... 729--- 730name: test_shl_s32 731# CHECK-LABEL: name: test_shl_s32 732legalized: false 733# CHECK: legalized: true 734regBankSelected: false 735selected: false 736tracksRegLiveness: true 737registers: 738 - { id: 0, class: _ } 739 - { id: 1, class: _ } 740 - { id: 2, class: _ } 741body: | 742 bb.0: 743 liveins: $r0, $r1 744 745 %0(s32) = COPY $r0 746 %1(s32) = COPY $r1 747 %2(s32) = G_SHL %0, %1 748 ; G_SHL with s32 is legal, so we should find it unchanged in the output 749 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}} 750 $r0 = COPY %2(s32) 751 BX_RET 14, $noreg, implicit $r0 752 753... 754--- 755name: test_shift_s8 756# CHECK-LABEL: name: test_shift_s8 757legalized: false 758# CHECK: legalized: true 759regBankSelected: false 760selected: false 761tracksRegLiveness: true 762registers: 763 - { id: 0, class: _ } 764 - { id: 1, class: _ } 765 - { id: 2, class: _ } 766 - { id: 3, class: _ } 767 - { id: 4, class: _ } 768body: | 769 bb.0: 770 liveins: $r0, $r1 771 772 %0(s32) = COPY $r0 773 %1(s32) = COPY $r1 774 %2(s8) = G_TRUNC %0(s32) 775 %3(s8) = G_SHL %2, %1(s32) 776 ; G_SHL with s8 should widen 777 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SHL {{%[0-9]+, %[0-9]+}} 778 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}} 779 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SHL {{%[0-9]+, %[0-9]+}} 780 %4(s32) = G_SEXT %3(s8) 781 $r0 = COPY %4(s32) 782 BX_RET 14, $noreg, implicit $r0 783... 784--- 785name: test_shift_s16 786# CHECK-LABEL: name: test_shift_s16 787legalized: false 788# CHECK: legalized: true 789regBankSelected: false 790selected: false 791tracksRegLiveness: true 792registers: 793 - { id: 0, class: _ } 794 - { id: 1, class: _ } 795 - { id: 2, class: _ } 796 - { id: 3, class: _ } 797 - { id: 4, class: _ } 798body: | 799 bb.0: 800 liveins: $r0, $r1 801 802 %0(s32) = COPY $r0 803 %1(s32) = COPY $r1 804 %2(s16) = G_TRUNC %0(s32) 805 %3(s16) = G_SHL %2, %1(s32) 806 ; G_SHL with s16 should widen 807 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SHL {{%[0-9]+, %[0-9]+}} 808 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}} 809 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SHL {{%[0-9]+, %[0-9]+}} 810 %4(s32) = G_SEXT %3(s16) 811 $r0 = COPY %4(s32) 812 BX_RET 14, $noreg, implicit $r0 813... 814--- 815name: test_shift_amount_s8 816# CHECK-LABEL: name: test_shift_amount_s8 817legalized: false 818# CHECK: legalized: true 819regBankSelected: false 820selected: false 821tracksRegLiveness: true 822registers: 823 - { id: 0, class: _ } 824 - { id: 1, class: _ } 825 - { id: 2, class: _ } 826 - { id: 3, class: _ } 827body: | 828 bb.0: 829 liveins: $r0, $r1 830 831 %0(s32) = COPY $r0 832 %1(s32) = COPY $r1 833 %2(s8) = G_TRUNC %0(s32) 834 %3(s32) = G_SHL %1, %2(s8) 835 ; G_SHL with s8 amount should widen 836 ; CHECK-NOT: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s8) 837 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s32) 838 ; CHECK-NOT: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s8) 839 $r0 = COPY %3(s32) 840 BX_RET 14, $noreg, implicit $r0 841... 842--- 843name: test_shift_amount_s16 844# CHECK-LABEL: name: test_shift_amount_s16 845legalized: false 846# CHECK: legalized: true 847regBankSelected: false 848selected: false 849tracksRegLiveness: true 850registers: 851 - { id: 0, class: _ } 852 - { id: 1, class: _ } 853 - { id: 2, class: _ } 854 - { id: 3, class: _ } 855body: | 856 bb.0: 857 liveins: $r0, $r1 858 859 %0(s32) = COPY $r0 860 %1(s32) = COPY $r1 861 %2(s16) = G_TRUNC %0(s32) 862 %3(s32) = G_SHL %1, %2(s16) 863 ; G_SHL with s16 amount should widen 864 ; CHECK-NOT: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s16) 865 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s32) 866 ; CHECK-NOT: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}}(s16) 867 $r0 = COPY %3(s32) 868 BX_RET 14, $noreg, implicit $r0 869... 870