|
4 | 4 | # Check that we correctly assign register banks based off of instructions which
|
5 | 5 | # only use or only define FPRs.
|
6 | 6 | #
|
7 |
| -# For example, G_SITOFP takes in a GPR, but only ever produces values on FPRs. |
| 7 | +# For example, G_SITOFP may take in a GPR, but only ever produces values on FPRs. |
8 | 8 | # Some instructions can have inputs/outputs on either FPRs or GPRs. If one of
|
9 | 9 | # those instructions takes in the result of a G_SITOFP as a source, we should
|
10 | 10 | # put that source on a FPR.
|
@@ -361,3 +361,47 @@ body: |
|
361 | 361 | %phi:_(s32) = G_PHI %gpr_copy(s32), %bb.0, %unmerge_1(s32), %bb.1
|
362 | 362 | $s0 = COPY %phi(s32)
|
363 | 363 | RET_ReallyLR implicit $s0
|
| 364 | +
|
| 365 | +... |
| 366 | +--- |
| 367 | +name: load_used_by_sitofp |
| 368 | +legalized: true |
| 369 | +tracksRegLiveness: true |
| 370 | +body: | |
| 371 | + bb.0: |
| 372 | + liveins: $x0 |
| 373 | + ; The load should be assigned an fpr bank because it's used by the sitofp. |
| 374 | + ; The sitofp should assign both src and dest to FPR, resulting in no copies. |
| 375 | + ; CHECK-LABEL: name: load_used_by_sitofp |
| 376 | + ; CHECK: liveins: $x0 |
| 377 | + ; CHECK: [[COPY:%[0-9]+]]:gpr(p0) = COPY $x0 |
| 378 | + ; CHECK: [[LOAD:%[0-9]+]]:fpr(s32) = G_LOAD [[COPY]](p0) :: (load 4) |
| 379 | + ; CHECK: [[SITOFP:%[0-9]+]]:fpr(s32) = G_SITOFP [[LOAD]](s32) |
| 380 | + ; CHECK: $s0 = COPY [[SITOFP]](s32) |
| 381 | + ; CHECK: RET_ReallyLR implicit $s0 |
| 382 | + %0:_(p0) = COPY $x0 |
| 383 | + %1:_(s32) = G_LOAD %0 :: (load 4) |
| 384 | + %2:_(s32) = G_SITOFP %1:_(s32) |
| 385 | + $s0 = COPY %2(s32) |
| 386 | + RET_ReallyLR implicit $s0 |
| 387 | +... |
| 388 | +--- |
| 389 | +name: load_used_by_uitofp |
| 390 | +legalized: true |
| 391 | +tracksRegLiveness: true |
| 392 | +body: | |
| 393 | + bb.0: |
| 394 | + liveins: $x0 |
| 395 | + ; CHECK-LABEL: name: load_used_by_uitofp |
| 396 | + ; CHECK: liveins: $x0 |
| 397 | + ; CHECK: [[COPY:%[0-9]+]]:gpr(p0) = COPY $x0 |
| 398 | + ; CHECK: [[LOAD:%[0-9]+]]:fpr(s32) = G_LOAD [[COPY]](p0) :: (load 4) |
| 399 | + ; CHECK: [[UITOFP:%[0-9]+]]:fpr(s32) = G_UITOFP [[LOAD]](s32) |
| 400 | + ; CHECK: $s0 = COPY [[UITOFP]](s32) |
| 401 | + ; CHECK: RET_ReallyLR implicit $s0 |
| 402 | + %0:_(p0) = COPY $x0 |
| 403 | + %1:_(s32) = G_LOAD %0 :: (load 4) |
| 404 | + %2:_(s32) = G_UITOFP %1:_(s32) |
| 405 | + $s0 = COPY %2(s32) |
| 406 | + RET_ReallyLR implicit $s0 |
| 407 | +... |
0 commit comments