1 # RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s 2 --- | 3 define void @test_sext_s8() { ret void } 4 define void @test_zext_s16() { ret void } 5 6 define void @test_inttoptr_s32() { ret void } 7 define void @test_ptrtoint_s32() { ret void } 8 9 define void @test_add_s8() { ret void } 10 define void @test_add_s16() { ret void } 11 define void @test_add_s32() { ret void } 12 13 define void @test_sub_s8() { ret void } 14 define void @test_sub_s16() { ret void } 15 define void @test_sub_s32() { ret void } 16 17 define void @test_mul_s8() { ret void } 18 define void @test_mul_s16() { ret void } 19 define void @test_mul_s32() { ret void } 20 21 define void @test_and_s8() { ret void } 22 define void @test_and_s16() { ret void } 23 define void @test_and_s32() { ret void } 24 25 define void @test_or_s8() { ret void } 26 define void @test_or_s16() { ret void } 27 define void @test_or_s32() { ret void } 28 29 define void @test_xor_s8() { ret void } 30 define void @test_xor_s16() { ret void } 31 define void @test_xor_s32() { ret void } 32 33 define void @test_lshr_s32() { ret void } 34 define void @test_ashr_s32() { ret void } 35 define void @test_shl_s32() { ret void } 36 37 define void @test_load_from_stack() { ret void } 38 define void @test_legal_loads_stores() #0 { ret void } 39 40 define void @test_gep() { ret void } 41 42 define void @test_constants() { ret void } 43 44 define void @test_icmp_s8() { ret void } 45 define void @test_icmp_s16() { ret void } 46 define void @test_icmp_s32() { ret void } 47 48 define void @test_select_s32() { ret void } 49 define void @test_select_ptr() { ret void } 50 51 define void @test_brcond() { ret void } 52 53 define void @test_phi_s32() { ret void } 54 define void @test_phi_p0() { ret void } 55 define void @test_phi_s64() #0 { ret void } 56 define void @test_phi_s8() { ret void } 57 58 @a_global = global i32 42 59 define void @test_global_variable() { ret void } 60 61 attributes #0 = { "target-features"="+vfp2" } 62 ... 63 --- 64 name: test_sext_s8 65 # CHECK-LABEL: name: test_sext_s8 66 legalized: false 67 # CHECK: legalized: true 68 regBankSelected: false 69 selected: false 70 tracksRegLiveness: true 71 registers: 72 - { id: 0, class: _ } 73 - { id: 1, class: _ } 74 - { id: 2, class: _ } 75 body: | 76 bb.0: 77 liveins: $r0 78 79 %0(p0) = COPY $r0 80 %1(s8) = G_LOAD %0(p0) :: (load 1) 81 %2(s32) = G_SEXT %1 82 ; G_SEXT with s8 is legal, so we should find it unchanged in the output 83 ; CHECK: {{%[0-9]+}}:_(s32) = G_SEXT {{%[0-9]+}} 84 $r0 = COPY %2(s32) 85 BX_RET 14, $noreg, implicit $r0 86 ... 87 --- 88 name: test_zext_s16 89 # CHECK-LABEL: name: test_zext_s16 90 legalized: false 91 # CHECK: legalized: true 92 regBankSelected: false 93 selected: false 94 tracksRegLiveness: true 95 registers: 96 - { id: 0, class: _ } 97 - { id: 1, class: _ } 98 - { id: 2, class: _ } 99 body: | 100 bb.0: 101 liveins: $r0 102 103 %0(p0) = COPY $r0 104 %1(s16) = G_LOAD %0 :: (load 2) 105 %2(s32) = G_ZEXT %1 106 ; G_ZEXT with s16 is legal, so we should find it unchanged in the output 107 ; CHECK: {{%[0-9]+}}:_(s32) = G_ZEXT {{%[0-9]+}} 108 $r0 = COPY %2(s32) 109 BX_RET 14, $noreg, implicit $r0 110 ... 111 --- 112 name: test_inttoptr_s32 113 # CHECK-LABEL: name: test_inttoptr_s32 114 legalized: false 115 # CHECK: legalized: true 116 regBankSelected: false 117 selected: false 118 tracksRegLiveness: true 119 registers: 120 - { id: 0, class: _ } 121 - { id: 1, class: _ } 122 body: | 123 bb.0: 124 liveins: $r0 125 126 %0(s32) = COPY $r0 127 %1(p0) = G_INTTOPTR %0(s32) 128 ; G_INTTOPTR with s32 is legal, so we should find it unchanged in the output 129 ; CHECK: {{%[0-9]+}}:_(p0) = G_INTTOPTR {{%[0-9]+}} 130 $r0 = COPY %1(p0) 131 BX_RET 14, $noreg, implicit $r0 132 ... 133 --- 134 name: test_ptrtoint_s32 135 # CHECK-LABEL: name: test_ptrtoint_s32 136 legalized: false 137 # CHECK: legalized: true 138 regBankSelected: false 139 selected: false 140 tracksRegLiveness: true 141 registers: 142 - { id: 0, class: _ } 143 - { id: 1, class: _ } 144 body: | 145 bb.0: 146 liveins: $r0 147 148 %0(p0) = COPY $r0 149 %1(s32) = G_PTRTOINT %0(p0) 150 ; G_PTRTOINT with s32 is legal, so we should find it unchanged in the output 151 ; CHECK: {{%[0-9]+}}:_(s32) = G_PTRTOINT {{%[0-9]+}} 152 $r0 = COPY %1(s32) 153 BX_RET 14, $noreg, implicit $r0 154 ... 155 --- 156 name: test_add_s8 157 # CHECK-LABEL: name: test_add_s8 158 legalized: false 159 # CHECK: legalized: true 160 regBankSelected: false 161 selected: false 162 tracksRegLiveness: true 163 registers: 164 - { id: 0, class: _ } 165 - { id: 1, class: _ } 166 - { id: 2, class: _ } 167 - { id: 3, class: _ } 168 - { id: 4, class: _ } 169 - { id: 5, class: _ } 170 body: | 171 bb.0: 172 liveins: $r0, $r1 173 174 %0(p0) = COPY $r0 175 %1(s8) = G_LOAD %0 :: (load 1) 176 %2(p0) = COPY $r0 177 %3(s8) = G_LOAD %2 :: (load 1) 178 %4(s8) = G_ADD %1, %3 179 ; G_ADD with s8 should widen 180 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_ADD {{%[0-9]+, %[0-9]+}} 181 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 182 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_ADD {{%[0-9]+, %[0-9]+}} 183 %5(s32) = G_SEXT %4(s8) 184 $r0 = COPY %5(s32) 185 BX_RET 14, $noreg, implicit $r0 186 ... 187 --- 188 name: test_add_s16 189 # CHECK-LABEL: name: test_add_s16 190 legalized: false 191 # CHECK: legalized: true 192 regBankSelected: false 193 selected: false 194 tracksRegLiveness: true 195 registers: 196 - { id: 0, class: _ } 197 - { id: 1, class: _ } 198 - { id: 2, class: _ } 199 - { id: 3, class: _ } 200 - { id: 4, class: _ } 201 - { id: 5, class: _ } 202 body: | 203 bb.0: 204 liveins: $r0, $r1 205 206 %0(p0) = COPY $r0 207 %1(s16) = G_LOAD %0 :: (load 2) 208 %2(p0) = COPY $r0 209 %3(s16) = G_LOAD %2 :: (load 2) 210 %4(s16) = G_ADD %1, %3 211 ; G_ADD with s16 should widen 212 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_ADD {{%[0-9]+, %[0-9]+}} 213 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 214 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_ADD {{%[0-9]+, %[0-9]+}} 215 %5(s32) = G_SEXT %4(s16) 216 $r0 = COPY %5(s32) 217 BX_RET 14, $noreg, implicit $r0 218 ... 219 --- 220 name: test_add_s32 221 # CHECK-LABEL: name: test_add_s32 222 legalized: false 223 # CHECK: legalized: true 224 regBankSelected: false 225 selected: false 226 tracksRegLiveness: true 227 registers: 228 - { id: 0, class: _ } 229 - { id: 1, class: _ } 230 - { id: 2, class: _ } 231 body: | 232 bb.0: 233 liveins: $r0, $r1 234 235 %0(s32) = COPY $r0 236 %1(s32) = COPY $r1 237 %2(s32) = G_ADD %0, %1 238 ; G_ADD with s32 is legal, so we should find it unchanged in the output 239 ; CHECK: {{%[0-9]+}}:_(s32) = G_ADD {{%[0-9]+, %[0-9]+}} 240 $r0 = COPY %2(s32) 241 BX_RET 14, $noreg, implicit $r0 242 243 ... 244 --- 245 name: test_sub_s8 246 # CHECK-LABEL: name: test_sub_s8 247 legalized: false 248 # CHECK: legalized: true 249 regBankSelected: false 250 selected: false 251 tracksRegLiveness: true 252 registers: 253 - { id: 0, class: _ } 254 - { id: 1, class: _ } 255 - { id: 2, class: _ } 256 - { id: 3, class: _ } 257 - { id: 4, class: _ } 258 - { id: 5, class: _ } 259 body: | 260 bb.0: 261 liveins: $r0, $r1 262 263 %0(p0) = COPY $r0 264 %1(s8) = G_LOAD %0 :: (load 1) 265 %2(p0) = COPY $r0 266 %3(s8) = G_LOAD %2 :: (load 1) 267 %4(s8) = G_SUB %1, %3 268 ; G_SUB with s8 should widen 269 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SUB {{%[0-9]+, %[0-9]+}} 270 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 271 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SUB {{%[0-9]+, %[0-9]+}} 272 %5(s32) = G_SEXT %4(s8) 273 $r0 = COPY %5(s32) 274 BX_RET 14, $noreg, implicit $r0 275 ... 276 --- 277 name: test_sub_s16 278 # CHECK-LABEL: name: test_sub_s16 279 legalized: false 280 # CHECK: legalized: true 281 regBankSelected: false 282 selected: false 283 tracksRegLiveness: true 284 registers: 285 - { id: 0, class: _ } 286 - { id: 1, class: _ } 287 - { id: 2, class: _ } 288 - { id: 3, class: _ } 289 - { id: 4, class: _ } 290 - { id: 5, class: _ } 291 body: | 292 bb.0: 293 liveins: $r0, $r1 294 295 %0(p0) = COPY $r0 296 %1(s16) = G_LOAD %0 :: (load 2) 297 %2(p0) = COPY $r0 298 %3(s16) = G_LOAD %2 :: (load 2) 299 %4(s16) = G_SUB %1, %3 300 ; G_SUB with s16 should widen 301 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SUB {{%[0-9]+, %[0-9]+}} 302 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 303 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SUB {{%[0-9]+, %[0-9]+}} 304 %5(s32) = G_SEXT %4(s16) 305 $r0 = COPY %5(s32) 306 BX_RET 14, $noreg, implicit $r0 307 ... 308 --- 309 name: test_sub_s32 310 # CHECK-LABEL: name: test_sub_s32 311 legalized: false 312 # CHECK: legalized: true 313 regBankSelected: false 314 selected: false 315 tracksRegLiveness: true 316 registers: 317 - { id: 0, class: _ } 318 - { id: 1, class: _ } 319 - { id: 2, class: _ } 320 body: | 321 bb.0: 322 liveins: $r0, $r1 323 324 %0(s32) = COPY $r0 325 %1(s32) = COPY $r1 326 %2(s32) = G_SUB %0, %1 327 ; G_SUB with s32 is legal, so we should find it unchanged in the output 328 ; CHECK: {{%[0-9]+}}:_(s32) = G_SUB {{%[0-9]+, %[0-9]+}} 329 $r0 = COPY %2(s32) 330 BX_RET 14, $noreg, implicit $r0 331 332 ... 333 --- 334 name: test_mul_s8 335 # CHECK-LABEL: name: test_mul_s8 336 legalized: false 337 # CHECK: legalized: true 338 regBankSelected: false 339 selected: false 340 tracksRegLiveness: true 341 registers: 342 - { id: 0, class: _ } 343 - { id: 1, class: _ } 344 - { id: 2, class: _ } 345 - { id: 3, class: _ } 346 - { id: 4, class: _ } 347 - { id: 5, class: _ } 348 body: | 349 bb.0: 350 liveins: $r0, $r1 351 352 %0(p0) = COPY $r0 353 %1(s8) = G_LOAD %0 :: (load 1) 354 %2(p0) = COPY $r0 355 %3(s8) = G_LOAD %2 :: (load 1) 356 %4(s8) = G_MUL %1, %3 357 ; G_MUL with s8 should widen 358 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_MUL {{%[0-9]+, %[0-9]+}} 359 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 360 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_MUL {{%[0-9]+, %[0-9]+}} 361 %5(s32) = G_SEXT %4(s8) 362 $r0 = COPY %5(s32) 363 BX_RET 14, $noreg, implicit $r0 364 ... 365 --- 366 name: test_mul_s16 367 # CHECK-LABEL: name: test_mul_s16 368 legalized: false 369 # CHECK: legalized: true 370 regBankSelected: false 371 selected: false 372 tracksRegLiveness: true 373 registers: 374 - { id: 0, class: _ } 375 - { id: 1, class: _ } 376 - { id: 2, class: _ } 377 - { id: 3, class: _ } 378 - { id: 4, class: _ } 379 - { id: 5, class: _ } 380 body: | 381 bb.0: 382 liveins: $r0, $r1 383 384 %0(p0) = COPY $r0 385 %1(s16) = G_LOAD %0 :: (load 2) 386 %2(p0) = COPY $r0 387 %3(s16) = G_LOAD %2 :: (load 2) 388 %4(s16) = G_MUL %1, %3 389 ; G_MUL with s16 should widen 390 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_MUL {{%[0-9]+, %[0-9]+}} 391 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 392 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_MUL {{%[0-9]+, %[0-9]+}} 393 %5(s32) = G_SEXT %4(s16) 394 $r0 = COPY %5(s32) 395 BX_RET 14, $noreg, implicit $r0 396 ... 397 --- 398 name: test_mul_s32 399 # CHECK-LABEL: name: test_mul_s32 400 legalized: false 401 # CHECK: legalized: true 402 regBankSelected: false 403 selected: false 404 tracksRegLiveness: true 405 registers: 406 - { id: 0, class: _ } 407 - { id: 1, class: _ } 408 - { id: 2, class: _ } 409 body: | 410 bb.0: 411 liveins: $r0, $r1 412 413 %0(s32) = COPY $r0 414 %1(s32) = COPY $r1 415 %2(s32) = G_MUL %0, %1 416 ; G_MUL with s32 is legal, so we should find it unchanged in the output 417 ; CHECK: {{%[0-9]+}}:_(s32) = G_MUL {{%[0-9]+, %[0-9]+}} 418 $r0 = COPY %2(s32) 419 BX_RET 14, $noreg, implicit $r0 420 421 ... 422 --- 423 name: test_and_s8 424 # CHECK-LABEL: name: test_and_s8 425 legalized: false 426 # CHECK: legalized: true 427 regBankSelected: false 428 selected: false 429 tracksRegLiveness: true 430 registers: 431 - { id: 0, class: _ } 432 - { id: 1, class: _ } 433 - { id: 2, class: _ } 434 - { id: 3, class: _ } 435 - { id: 4, class: _ } 436 - { id: 5, class: _ } 437 body: | 438 bb.0: 439 liveins: $r0, $r1 440 441 %0(p0) = COPY $r0 442 %1(s8) = G_LOAD %0 :: (load 1) 443 %2(p0) = COPY $r0 444 %3(s8) = G_LOAD %2 :: (load 1) 445 %4(s8) = G_AND %1, %3 446 ; G_AND with s8 should widen 447 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_AND {{%[0-9]+, %[0-9]+}} 448 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 449 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_AND {{%[0-9]+, %[0-9]+}} 450 %5(s32) = G_SEXT %4(s8) 451 $r0 = COPY %5(s32) 452 BX_RET 14, $noreg, implicit $r0 453 ... 454 --- 455 name: test_and_s16 456 # CHECK-LABEL: name: test_and_s16 457 legalized: false 458 # CHECK: legalized: true 459 regBankSelected: false 460 selected: false 461 tracksRegLiveness: true 462 registers: 463 - { id: 0, class: _ } 464 - { id: 1, class: _ } 465 - { id: 2, class: _ } 466 - { id: 3, class: _ } 467 - { id: 4, class: _ } 468 - { id: 5, class: _ } 469 body: | 470 bb.0: 471 liveins: $r0, $r1 472 473 %0(p0) = COPY $r0 474 %1(s16) = G_LOAD %0 :: (load 2) 475 %2(p0) = COPY $r0 476 %3(s16) = G_LOAD %2 :: (load 2) 477 %4(s16) = G_AND %1, %3 478 ; G_AND with s16 should widen 479 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_AND {{%[0-9]+, %[0-9]+}} 480 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 481 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_AND {{%[0-9]+, %[0-9]+}} 482 %5(s32) = G_SEXT %4(s16) 483 $r0 = COPY %5(s32) 484 BX_RET 14, $noreg, implicit $r0 485 ... 486 --- 487 name: test_and_s32 488 # CHECK-LABEL: name: test_and_s32 489 legalized: false 490 # CHECK: legalized: true 491 regBankSelected: false 492 selected: false 493 tracksRegLiveness: true 494 registers: 495 - { id: 0, class: _ } 496 - { id: 1, class: _ } 497 - { id: 2, class: _ } 498 body: | 499 bb.0: 500 liveins: $r0, $r1 501 502 %0(s32) = COPY $r0 503 %1(s32) = COPY $r1 504 %2(s32) = G_AND %0, %1 505 ; G_AND with s32 is legal, so we should find it unchanged in the output 506 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND {{%[0-9]+, %[0-9]+}} 507 $r0 = COPY %2(s32) 508 BX_RET 14, $noreg, implicit $r0 509 510 ... 511 --- 512 name: test_or_s8 513 # CHECK-LABEL: name: test_or_s8 514 legalized: false 515 # CHECK: legalized: true 516 regBankSelected: false 517 selected: false 518 tracksRegLiveness: true 519 registers: 520 - { id: 0, class: _ } 521 - { id: 1, class: _ } 522 - { id: 2, class: _ } 523 - { id: 3, class: _ } 524 - { id: 4, class: _ } 525 - { id: 5, class: _ } 526 body: | 527 bb.0: 528 liveins: $r0, $r1 529 530 %0(p0) = COPY $r0 531 %1(s8) = G_LOAD %0 :: (load 1) 532 %2(p0) = COPY $r0 533 %3(s8) = G_LOAD %2 :: (load 1) 534 %4(s8) = G_OR %1, %3 535 ; G_OR with s8 should widen 536 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_OR {{%[0-9]+, %[0-9]+}} 537 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 538 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_OR {{%[0-9]+, %[0-9]+}} 539 %5(s32) = G_SEXT %4(s8) 540 $r0 = COPY %5(s32) 541 BX_RET 14, $noreg, implicit $r0 542 ... 543 --- 544 name: test_or_s16 545 # CHECK-LABEL: name: test_or_s16 546 legalized: false 547 # CHECK: legalized: true 548 regBankSelected: false 549 selected: false 550 tracksRegLiveness: true 551 registers: 552 - { id: 0, class: _ } 553 - { id: 1, class: _ } 554 - { id: 2, class: _ } 555 - { id: 3, class: _ } 556 - { id: 4, class: _ } 557 - { id: 5, class: _ } 558 body: | 559 bb.0: 560 liveins: $r0, $r1 561 562 %0(p0) = COPY $r0 563 %1(s16) = G_LOAD %0 :: (load 2) 564 %2(p0) = COPY $r0 565 %3(s16) = G_LOAD %2 :: (load 2) 566 %4(s16) = G_OR %1, %3 567 ; G_OR with s16 should widen 568 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_OR {{%[0-9]+, %[0-9]+}} 569 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 570 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_OR {{%[0-9]+, %[0-9]+}} 571 %5(s32) = G_SEXT %4(s16) 572 $r0 = COPY %5(s32) 573 BX_RET 14, $noreg, implicit $r0 574 ... 575 --- 576 name: test_or_s32 577 # CHECK-LABEL: name: test_or_s32 578 legalized: false 579 # CHECK: legalized: true 580 regBankSelected: false 581 selected: false 582 tracksRegLiveness: true 583 registers: 584 - { id: 0, class: _ } 585 - { id: 1, class: _ } 586 - { id: 2, class: _ } 587 body: | 588 bb.0: 589 liveins: $r0, $r1 590 591 %0(s32) = COPY $r0 592 %1(s32) = COPY $r1 593 %2(s32) = G_OR %0, %1 594 ; G_OR with s32 is legal, so we should find it unchanged in the output 595 ; CHECK: {{%[0-9]+}}:_(s32) = G_OR {{%[0-9]+, %[0-9]+}} 596 $r0 = COPY %2(s32) 597 BX_RET 14, $noreg, implicit $r0 598 599 ... 600 --- 601 name: test_xor_s8 602 # CHECK-LABEL: name: test_xor_s8 603 legalized: false 604 # CHECK: legalized: true 605 regBankSelected: false 606 selected: false 607 tracksRegLiveness: true 608 registers: 609 - { id: 0, class: _ } 610 - { id: 1, class: _ } 611 - { id: 2, class: _ } 612 - { id: 3, class: _ } 613 - { id: 4, class: _ } 614 - { id: 5, class: _ } 615 body: | 616 bb.0: 617 liveins: $r0, $r1 618 619 %0(p0) = COPY $r0 620 %1(s8) = G_LOAD %0 :: (load 1) 621 %2(p0) = COPY $r0 622 %3(s8) = G_LOAD %2 :: (load 1) 623 %4(s8) = G_XOR %1, %3 624 ; G_XOR with s8 should widen 625 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_XOR {{%[0-9]+, %[0-9]+}} 626 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 627 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_XOR {{%[0-9]+, %[0-9]+}} 628 %5(s32) = G_SEXT %4(s8) 629 $r0 = COPY %5(s32) 630 BX_RET 14, $noreg, implicit $r0 631 ... 632 --- 633 name: test_xor_s16 634 # CHECK-LABEL: name: test_xor_s16 635 legalized: false 636 # CHECK: legalized: true 637 regBankSelected: false 638 selected: false 639 tracksRegLiveness: true 640 registers: 641 - { id: 0, class: _ } 642 - { id: 1, class: _ } 643 - { id: 2, class: _ } 644 - { id: 3, class: _ } 645 - { id: 4, class: _ } 646 - { id: 5, class: _ } 647 body: | 648 bb.0: 649 liveins: $r0, $r1 650 651 %0(p0) = COPY $r0 652 %1(s16) = G_LOAD %0 :: (load 2) 653 %2(p0) = COPY $r0 654 %3(s16) = G_LOAD %2 :: (load 2) 655 %4(s16) = G_XOR %1, %3 656 ; G_XOR with s16 should widen 657 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_XOR {{%[0-9]+, %[0-9]+}} 658 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 659 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_XOR {{%[0-9]+, %[0-9]+}} 660 %5(s32) = G_SEXT %4(s16) 661 $r0 = COPY %5(s32) 662 BX_RET 14, $noreg, implicit $r0 663 ... 664 --- 665 name: test_xor_s32 666 # CHECK-LABEL: name: test_xor_s32 667 legalized: false 668 # CHECK: legalized: true 669 regBankSelected: false 670 selected: false 671 tracksRegLiveness: true 672 registers: 673 - { id: 0, class: _ } 674 - { id: 1, class: _ } 675 - { id: 2, class: _ } 676 body: | 677 bb.0: 678 liveins: $r0, $r1 679 680 %0(s32) = COPY $r0 681 %1(s32) = COPY $r1 682 %2(s32) = G_XOR %0, %1 683 ; G_XOR with s32 is legal, so we should find it unchanged in the output 684 ; CHECK: {{%[0-9]+}}:_(s32) = G_XOR {{%[0-9]+, %[0-9]+}} 685 $r0 = COPY %2(s32) 686 BX_RET 14, $noreg, implicit $r0 687 688 ... 689 --- 690 name: test_lshr_s32 691 # CHECK-LABEL: name: test_lshr_s32 692 legalized: false 693 # CHECK: legalized: true 694 regBankSelected: false 695 selected: false 696 tracksRegLiveness: true 697 registers: 698 - { id: 0, class: _ } 699 - { id: 1, class: _ } 700 - { id: 2, class: _ } 701 body: | 702 bb.0: 703 liveins: $r0, $r1 704 705 %0(s32) = COPY $r0 706 %1(s32) = COPY $r1 707 %2(s32) = G_LSHR %0, %1 708 ; G_LSHR with s32 is legal, so we should find it unchanged in the output 709 ; CHECK: {{%[0-9]+}}:_(s32) = G_LSHR {{%[0-9]+, %[0-9]+}} 710 $r0 = COPY %2(s32) 711 BX_RET 14, $noreg, implicit $r0 712 713 ... 714 --- 715 name: test_ashr_s32 716 # CHECK-LABEL: name: test_ashr_s32 717 legalized: false 718 # CHECK: legalized: true 719 regBankSelected: false 720 selected: false 721 tracksRegLiveness: true 722 registers: 723 - { id: 0, class: _ } 724 - { id: 1, class: _ } 725 - { id: 2, class: _ } 726 body: | 727 bb.0: 728 liveins: $r0, $r1 729 730 %0(s32) = COPY $r0 731 %1(s32) = COPY $r1 732 %2(s32) = G_ASHR %0, %1 733 ; G_ASHR with s32 is legal, so we should find it unchanged in the output 734 ; CHECK: {{%[0-9]+}}:_(s32) = G_ASHR {{%[0-9]+, %[0-9]+}} 735 $r0 = COPY %2(s32) 736 BX_RET 14, $noreg, implicit $r0 737 738 ... 739 --- 740 name: test_shl_s32 741 # CHECK-LABEL: name: test_shl_s32 742 legalized: false 743 # CHECK: legalized: true 744 regBankSelected: false 745 selected: false 746 tracksRegLiveness: true 747 registers: 748 - { id: 0, class: _ } 749 - { id: 1, class: _ } 750 - { id: 2, class: _ } 751 body: | 752 bb.0: 753 liveins: $r0, $r1 754 755 %0(s32) = COPY $r0 756 %1(s32) = COPY $r1 757 %2(s32) = G_SHL %0, %1 758 ; G_SHL with s32 is legal, so we should find it unchanged in the output 759 ; CHECK: {{%[0-9]+}}:_(s32) = G_SHL {{%[0-9]+, %[0-9]+}} 760 $r0 = COPY %2(s32) 761 BX_RET 14, $noreg, implicit $r0 762 763 ... 764 --- 765 name: test_load_from_stack 766 # CHECK-LABEL: name: test_load_from_stack 767 legalized: false 768 # CHECK: legalized: true 769 regBankSelected: false 770 selected: false 771 tracksRegLiveness: true 772 registers: 773 - { id: 0, class: _ } 774 - { id: 1, class: _ } 775 - { id: 2, class: _ } 776 - { id: 3, class: _ } 777 fixedStack: 778 - { id: 0, offset: 0, size: 4, alignment: 4, isImmutable: true, isAliased: false } 779 - { id: 1, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false } 780 - { id: 2, offset: 8, size: 4, alignment: 4, isImmutable: true, isAliased: false } 781 # CHECK: id: [[FRAME_INDEX:[0-9]+]], type: default, offset: 8 782 body: | 783 bb.0: 784 liveins: $r0, $r1, $r2, $r3 785 786 ; This is legal, so we should find it unchanged in the output 787 ; CHECK: [[FIVREG:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[FRAME_INDEX]] 788 ; CHECK: {{%[0-9]+}}:_(s32) = G_LOAD [[FIVREG]](p0) :: (load 4) 789 %0(p0) = G_FRAME_INDEX %fixed-stack.2 790 %1(s32) = G_LOAD %0(p0) :: (load 4) 791 $r0 = COPY %1(s32) 792 BX_RET 14, $noreg, implicit $r0 793 ... 794 --- 795 name: test_legal_loads_stores 796 # CHECK-LABEL: name: test_legal_loads_stores 797 legalized: false 798 # CHECK: legalized: true 799 regBankSelected: false 800 selected: false 801 tracksRegLiveness: true 802 registers: 803 - { id: 0, class: _ } 804 - { id: 1, class: _ } 805 - { id: 2, class: _ } 806 - { id: 3, class: _ } 807 - { id: 4, class: _ } 808 - { id: 5, class: _ } 809 - { id: 6, class: _ } 810 body: | 811 bb.0: 812 liveins: $r0 813 814 ; These are all legal, so we should find them unchanged in the output 815 ; CHECK-DAG: G_STORE {{%[0-9]+}}(s64), %0(p0) 816 ; CHECK-DAG: G_STORE {{%[0-9]+}}(s32), %0(p0) 817 ; CHECK-DAG: G_STORE {{%[0-9]+}}(s16), %0(p0) 818 ; CHECK-DAG: G_STORE {{%[0-9]+}}(s8), %0(p0) 819 ; CHECK-DAG: G_STORE {{%[0-9]+}}(s1), %0(p0) 820 ; CHECK-DAG: G_STORE {{%[0-9]+}}(p0), %0(p0) 821 ; CHECK-DAG: {{%[0-9]+}}:_(s64) = G_LOAD %0(p0) 822 ; CHECK-DAG: {{%[0-9]+}}:_(s32) = G_LOAD %0(p0) 823 ; CHECK-DAG: {{%[0-9]+}}:_(s16) = G_LOAD %0(p0) 824 ; CHECK-DAG: {{%[0-9]+}}:_(s8) = G_LOAD %0(p0) 825 ; CHECK-DAG: {{%[0-9]+}}:_(s1) = G_LOAD %0(p0) 826 ; CHECK-DAG: {{%[0-9]+}}:_(p0) = G_LOAD %0(p0) 827 %0(p0) = COPY $r0 828 %1(s64) = G_LOAD %0(p0) :: (load 8) 829 G_STORE %1(s64), %0(p0) :: (store 8) 830 %2(s32) = G_LOAD %0(p0) :: (load 4) 831 G_STORE %2(s32), %0(p0) :: (store 4) 832 %3(s16) = G_LOAD %0(p0) :: (load 2) 833 G_STORE %3(s16), %0(p0) :: (store 2) 834 %4(s8) = G_LOAD %0(p0) :: (load 1) 835 G_STORE %4(s8), %0(p0) :: (store 1) 836 %5(s1) = G_LOAD %0(p0) :: (load 1) 837 G_STORE %5(s1), %0(p0) :: (store 1) 838 %6(p0) = G_LOAD %0(p0) :: (load 4) 839 G_STORE %6(p0), %0(p0) :: (store 4) 840 BX_RET 14, $noreg 841 ... 842 --- 843 name: test_gep 844 # CHECK-LABEL: name: test_gep 845 legalized: false 846 # CHECK: legalized: true 847 regBankSelected: false 848 selected: false 849 tracksRegLiveness: true 850 registers: 851 - { id: 0, class: _ } 852 - { id: 1, class: _ } 853 - { id: 2, class: _ } 854 body: | 855 bb.0: 856 liveins: $r0, $r1 857 858 %0(p0) = COPY $r0 859 %1(s32) = COPY $r1 860 861 ; CHECK: {{%[0-9]+}}:_(p0) = G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s32) 862 %2(p0) = G_GEP %0, %1(s32) 863 864 $r0 = COPY %2(p0) 865 BX_RET 14, $noreg, implicit $r0 866 ... 867 --- 868 name: test_constants 869 # CHECK-LABEL: name: test_constants 870 legalized: false 871 # CHECK: legalized: true 872 regBankSelected: false 873 selected: false 874 tracksRegLiveness: true 875 registers: 876 - { id: 0, class: _ } 877 - { id: 1, class: _ } 878 - { id: 2, class: _ } 879 - { id: 3, class: _ } 880 - { id: 4, class: _ } 881 - { id: 5, class: _ } 882 - { id: 6, class: _ } 883 - { id: 7, class: _ } 884 - { id: 8, class: _ } 885 body: | 886 bb.0: 887 liveins: $r0 888 889 %4(p0) = COPY $r0 890 891 %0(s32) = G_CONSTANT 42 892 ; CHECK: {{%[0-9]+}}:_(s32) = G_CONSTANT 42 893 894 %1(s16) = G_CONSTANT i16 21 895 G_STORE %1(s16), %4(p0) :: (store 2) 896 ; CHECK-NOT: G_CONSTANT i16 897 ; CHECK: [[EXT:%[0-9]+]]:_(s32) = G_CONSTANT i32 21 898 ; CHECK: {{%[0-9]+}}:_(s16) = G_TRUNC [[EXT]](s32) 899 ; CHECK-NOT: G_CONSTANT i16 900 901 %2(s8) = G_CONSTANT i8 10 902 G_STORE %2(s8), %4(p0) :: (store 1) 903 ; CHECK-NOT: G_CONSTANT i8 904 ; CHECK: [[EXT:%[0-9]+]]:_(s32) = G_CONSTANT i32 10 905 ; CHECK: {{%[0-9]+}}:_(s8) = G_TRUNC [[EXT]](s32) 906 ; CHECK-NOT: G_CONSTANT i8 907 908 %3(s1) = G_CONSTANT i1 1 909 G_STORE %3(s1), %4(p0) :: (store 1) 910 ; CHECK-NOT: G_CONSTANT i1 911 ; CHECK: [[EXT:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1 912 ; CHECK: {{%[0-9]+}}:_(s1) = G_TRUNC [[EXT]](s32) 913 ; CHECK-NOT: G_CONSTANT i1 914 915 %5(p0) = G_CONSTANT 0 916 G_STORE %5(p0), %4(p0) :: (store 4) 917 ; CHECK: {{%[0-9]+}}:_(p0) = G_CONSTANT 0 918 919 %6(s64) = G_CONSTANT i64 17179869200 ; = 4 * 2 ^ 32 + 16 920 %7(s32), %8(s32) = G_UNMERGE_VALUES %6(s64) 921 G_STORE %7(s32), %4(p0) :: (store 4) 922 G_STORE %8(s32), %4(p0) :: (store 4) 923 ; CHECK-DAG: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 4 924 ; CHECK-DAG: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 16 925 ; CHECK-NOT: G_CONSTANT i64 926 927 $r0 = COPY %0(s32) 928 BX_RET 14, $noreg, implicit $r0 929 ... 930 --- 931 name: test_icmp_s8 932 # CHECK-LABEL: name: test_icmp_s8 933 legalized: false 934 # CHECK: legalized: true 935 regBankSelected: false 936 selected: false 937 tracksRegLiveness: true 938 registers: 939 - { id: 0, class: _ } 940 - { id: 1, class: _ } 941 - { id: 2, class: _ } 942 - { id: 3, class: _ } 943 - { id: 4, class: _ } 944 - { id: 5, class: _ } 945 body: | 946 bb.0: 947 liveins: $r0, $r1 948 949 %0(p0) = COPY $r0 950 %1(s8) = G_LOAD %0 :: (load 1) 951 %2(p0) = COPY $r1 952 %3(s8) = G_LOAD %2 :: (load 1) 953 %4(s1) = G_ICMP intpred(ne), %1(s8), %3 954 ; G_ICMP with s8 should widen 955 ; CHECK: {{%[0-9]+}}:_(s1) = G_ICMP intpred(ne), {{%[0-9]+}}(s32), {{%[0-9]+}} 956 ; CHECK-NOT: {{%[0-9]+}}:_(s1) = G_ICMP intpred(ne), {{%[0-9]+}}(s8), {{%[0-9]+}} 957 %5(s32) = G_ZEXT %4(s1) 958 $r0 = COPY %5(s32) 959 BX_RET 14, $noreg, implicit $r0 960 ... 961 --- 962 name: test_icmp_s16 963 # CHECK-LABEL: name: test_icmp_s16 964 legalized: false 965 # CHECK: legalized: true 966 regBankSelected: false 967 selected: false 968 tracksRegLiveness: true 969 registers: 970 - { id: 0, class: _ } 971 - { id: 1, class: _ } 972 - { id: 2, class: _ } 973 - { id: 3, class: _ } 974 - { id: 4, class: _ } 975 - { id: 5, class: _ } 976 body: | 977 bb.0: 978 liveins: $r0, $r1 979 980 %0(p0) = COPY $r0 981 %1(s16) = G_LOAD %0 :: (load 2) 982 %2(p0) = COPY $r1 983 %3(s16) = G_LOAD %2 :: (load 2) 984 %4(s1) = G_ICMP intpred(slt), %1(s16), %3 985 ; G_ICMP with s16 should widen 986 ; CHECK: {{%[0-9]+}}:_(s1) = G_ICMP intpred(slt), {{%[0-9]+}}(s32), {{%[0-9]+}} 987 ; CHECK-NOT: {{%[0-9]+}}:_(s1) = G_ICMP intpred(slt), {{%[0-9]+}}(s16), {{%[0-9]+}} 988 %5(s32) = G_ZEXT %4(s1) 989 $r0 = COPY %5(s32) 990 BX_RET 14, $noreg, implicit $r0 991 ... 992 --- 993 name: test_icmp_s32 994 # CHECK-LABEL: name: test_icmp_s32 995 legalized: false 996 # CHECK: legalized: true 997 regBankSelected: false 998 selected: false 999 tracksRegLiveness: true 1000 registers: 1001 - { id: 0, class: _ } 1002 - { id: 1, class: _ } 1003 - { id: 2, class: _ } 1004 - { id: 3, class: _ } 1005 body: | 1006 bb.0: 1007 liveins: $r0, $r1 1008 1009 %0(s32) = COPY $r0 1010 %1(s32) = COPY $r1 1011 %2(s1) = G_ICMP intpred(eq), %0(s32), %1 1012 ; G_ICMP with s32 is legal, so we should find it unchanged in the output 1013 ; CHECK: {{%[0-9]+}}:_(s1) = G_ICMP intpred(eq), {{%[0-9]+}}(s32), {{%[0-9]+}} 1014 %3(s32) = G_ZEXT %2(s1) 1015 $r0 = COPY %3(s32) 1016 BX_RET 14, $noreg, implicit $r0 1017 ... 1018 --- 1019 name: test_select_s32 1020 # CHECK-LABEL: name: test_select_s32 1021 legalized: false 1022 # CHECK: legalized: true 1023 regBankSelected: false 1024 selected: false 1025 tracksRegLiveness: true 1026 registers: 1027 - { id: 0, class: _ } 1028 - { id: 1, class: _ } 1029 - { id: 2, class: _ } 1030 - { id: 3, class: _ } 1031 body: | 1032 bb.0: 1033 liveins: $r0, $r1, $r2 1034 1035 %0(s32) = COPY $r0 1036 %1(s32) = COPY $r1 1037 %2(s1) = G_CONSTANT i1 1 1038 %3(s32) = G_SELECT %2(s1), %0, %1 1039 ; G_SELECT with s32 is legal, so we should find it unchanged in the output 1040 ; CHECK: {{%[0-9]+}}:_(s32) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}} 1041 $r0 = COPY %3(s32) 1042 BX_RET 14, $noreg, implicit $r0 1043 ... 1044 --- 1045 name: test_select_ptr 1046 # CHECK-LABEL: name: test_select_ptr 1047 legalized: false 1048 # CHECK: legalized: true 1049 regBankSelected: false 1050 selected: false 1051 tracksRegLiveness: true 1052 registers: 1053 - { id: 0, class: _ } 1054 - { id: 1, class: _ } 1055 - { id: 2, class: _ } 1056 - { id: 3, class: _ } 1057 body: | 1058 bb.0: 1059 liveins: $r0, $r1, $r2 1060 1061 %0(p0) = COPY $r0 1062 %1(p0) = COPY $r1 1063 %2(s1) = G_CONSTANT i1 0 1064 %3(p0) = G_SELECT %2(s1), %0, %1 1065 ; G_SELECT with p0 is legal, so we should find it unchanged in the output 1066 ; CHECK: {{%[0-9]+}}:_(p0) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}} 1067 $r0 = COPY %3(p0) 1068 BX_RET 14, $noreg, implicit $r0 1069 ... 1070 --- 1071 name: test_brcond 1072 # CHECK-LABEL: name: test_brcond 1073 legalized: false 1074 # CHECK: legalized: true 1075 regBankSelected: false 1076 selected: false 1077 tracksRegLiveness: true 1078 registers: 1079 - { id: 0, class: _ } 1080 - { id: 1, class: _ } 1081 - { id: 2, class: _ } 1082 body: | 1083 bb.0: 1084 successors: %bb.1(0x40000000), %bb.2(0x40000000) 1085 liveins: $r0, $r1 1086 1087 %0(s32) = COPY $r0 1088 %1(s32) = COPY $r1 1089 %2(s1) = G_ICMP intpred(sgt), %0(s32), %1 1090 G_BRCOND %2(s1), %bb.1 1091 ; G_BRCOND with s1 is legal, so we should find it unchanged in the output 1092 ; CHECK: G_BRCOND {{%[0-9]+}}(s1), %bb.1 1093 G_BR %bb.2 1094 1095 bb.1: 1096 $r0 = COPY %1(s32) 1097 BX_RET 14, $noreg, implicit $r0 1098 1099 bb.2: 1100 $r0 = COPY %0(s32) 1101 BX_RET 14, $noreg, implicit $r0 1102 1103 ... 1104 --- 1105 name: test_phi_s32 1106 # CHECK-LABEL: name: test_phi_s32 1107 legalized: false 1108 # CHECK: legalized: true 1109 regBankSelected: false 1110 selected: false 1111 tracksRegLiveness: true 1112 registers: 1113 - { id: 0, class: _ } 1114 - { id: 1, class: _ } 1115 - { id: 2, class: _ } 1116 - { id: 3, class: _ } 1117 - { id: 4, class: _ } 1118 body: | 1119 bb.0: 1120 liveins: $r0, $r1, $r2 1121 1122 %0(s32) = COPY $r0 1123 %1(s1) = G_TRUNC %0(s32) 1124 1125 %2(s32) = COPY $r1 1126 %3(s32) = COPY $r2 1127 1128 G_BRCOND %1(s1), %bb.1 1129 G_BR %bb.2 1130 1131 bb.1: 1132 G_BR %bb.2 1133 1134 bb.2: 1135 %4(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.1 1136 ; G_PHI with s32 is legal, so we should find it unchanged in the output 1137 ; CHECK: G_PHI {{%[0-9]+}}(s32), %bb.0, {{%[0-9]+}}(s32), %bb.1 1138 $r0 = COPY %4(s32) 1139 BX_RET 14, $noreg, implicit $r0 1140 ... 1141 --- 1142 name: test_phi_p0 1143 # CHECK-LABEL: name: test_phi_p0 1144 legalized: false 1145 # CHECK: legalized: true 1146 regBankSelected: false 1147 selected: false 1148 tracksRegLiveness: true 1149 registers: 1150 - { id: 0, class: _ } 1151 - { id: 1, class: _ } 1152 - { id: 2, class: _ } 1153 - { id: 3, class: _ } 1154 - { id: 4, class: _ } 1155 body: | 1156 bb.0: 1157 liveins: $r0, $r1, $r2 1158 1159 %0(s32) = COPY $r0 1160 %1(s1) = G_TRUNC %0(s32) 1161 1162 %2(p0) = COPY $r1 1163 %3(p0) = COPY $r2 1164 1165 G_BRCOND %1(s1), %bb.1 1166 G_BR %bb.2 1167 1168 bb.1: 1169 G_BR %bb.2 1170 1171 bb.2: 1172 %4(p0) = G_PHI %2(p0), %bb.0, %3(p0), %bb.1 1173 ; G_PHI with p0 is legal, so we should find it unchanged in the output 1174 ; CHECK: G_PHI {{%[0-9]+}}(p0), %bb.0, {{%[0-9]+}}(p0), %bb.1 1175 $r0 = COPY %4(p0) 1176 BX_RET 14, $noreg, implicit $r0 1177 ... 1178 --- 1179 name: test_phi_s64 1180 # CHECK-LABEL: name: test_phi_s64 1181 legalized: false 1182 # CHECK: legalized: true 1183 regBankSelected: false 1184 selected: false 1185 tracksRegLiveness: true 1186 registers: 1187 - { id: 0, class: _ } 1188 - { id: 1, class: _ } 1189 - { id: 2, class: _ } 1190 - { id: 3, class: _ } 1191 - { id: 4, class: _ } 1192 body: | 1193 bb.0: 1194 liveins: $r0, $d0, $d1 1195 1196 %0(s32) = COPY $r0 1197 %1(s1) = G_TRUNC %0(s32) 1198 1199 %2(s64) = COPY $d0 1200 %3(s64) = COPY $d1 1201 1202 G_BRCOND %1(s1), %bb.1 1203 G_BR %bb.2 1204 1205 bb.1: 1206 G_BR %bb.2 1207 1208 bb.2: 1209 %4(s64) = G_PHI %2(s64), %bb.0, %3(s64), %bb.1 1210 ; G_PHI with s64 is legal when we have floating point support, so we should 1211 ; find it unchanged in the output 1212 ; CHECK: G_PHI {{%[0-9]+}}(s64), %bb.0, {{%[0-9]+}}(s64), %bb.1 1213 $d0 = COPY %4(s64) 1214 BX_RET 14, $noreg, implicit $d0 1215 ... 1216 --- 1217 name: test_phi_s8 1218 # CHECK-LABEL: name: test_phi_s8 1219 legalized: false 1220 # CHECK: legalized: true 1221 regBankSelected: false 1222 selected: false 1223 tracksRegLiveness: true 1224 registers: 1225 - { id: 0, class: _ } 1226 - { id: 1, class: _ } 1227 - { id: 2, class: _ } 1228 - { id: 3, class: _ } 1229 - { id: 4, class: _ } 1230 - { id: 5, class: _ } 1231 - { id: 6, class: _ } 1232 - { id: 7, class: _ } 1233 body: | 1234 bb.0: 1235 liveins: $r0, $r1, $r2 1236 1237 %0(s32) = COPY $r0 1238 %1(s1) = G_TRUNC %0(s32) 1239 1240 %2(s32) = COPY $r1 1241 %3(s8) = G_TRUNC %2(s32) 1242 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1 1243 1244 %4(s32) = COPY $r2 1245 %5(s8) = G_TRUNC %4(s32) 1246 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $r2 1247 1248 ; CHECK: [[V1:%[0-9]+]]:_(s32) = COPY [[R1]] 1249 1250 G_BRCOND %1(s1), %bb.1 1251 G_BR %bb.2 1252 1253 bb.1: 1254 ; CHECK: [[V2:%[0-9]+]]:_(s32) = COPY [[R2]] 1255 G_BR %bb.2 1256 1257 bb.2: 1258 %6(s8) = G_PHI %3(s8), %bb.0, %5(s8), %bb.1 1259 ; G_PHI with s8 should widen, and all the truncs and exts should be combined 1260 ; away into a bunch of redundant copies 1261 ; CHECK: [[V:%[0-9]+]]:_(s32) = G_PHI [[V1]](s32), %bb.0, [[V2]](s32), %bb.1 1262 1263 %7(s32) = G_ANYEXT %6(s8) 1264 $r0 = COPY %7(s32) 1265 ; CHECK: [[R:%[0-9]+]]:_(s32) = COPY [[V]] 1266 ; CHECK: $r0 = COPY [[R]](s32) 1267 BX_RET 14, $noreg, implicit $r0 1268 ... 1269 --- 1270 name: test_global_variable 1271 # CHECK-LABEL: name: test_global_variable 1272 legalized: false 1273 # CHECK: legalized: true 1274 regBankSelected: false 1275 selected: false 1276 tracksRegLiveness: true 1277 registers: 1278 - { id: 0, class: _ } 1279 - { id: 1, class: _ } 1280 body: | 1281 bb.0: 1282 liveins: $r0 1283 1284 %0(s32) = COPY $r0 1285 %1(p0) = G_GLOBAL_VALUE @a_global 1286 ; G_GLOBAL_VALUE is legal, so we should find it unchanged in the output 1287 ; CHECK: {{%[0-9]+}}:_(p0) = G_GLOBAL_VALUE @a_global 1288 $r0 = COPY %1(p0) 1289 BX_RET 14, $noreg, implicit $r0 1290 1291 ... 1292