|
4 | 4 | # Verify the following:
|
5 | 5 | #
|
6 | 6 | # - We can fold compares into selects.
|
7 |
| -# - This only happens when the result of the compare is only used by the select. |
| 7 | +# - This only happens when the result of the compare is only used by selects. |
8 | 8 | #
|
9 | 9 | # Also verify that, for now:
|
10 | 10 | #
|
@@ -47,6 +47,41 @@ body: |
|
47 | 47 | $s0 = COPY %4(s32)
|
48 | 48 | RET_ReallyLR implicit $s0
|
49 | 49 |
|
| 50 | +... |
| 51 | +--- |
| 52 | +name: fcmp_more_than_one_select |
| 53 | +alignment: 4 |
| 54 | +legalized: true |
| 55 | +regBankSelected: true |
| 56 | +tracksRegLiveness: true |
| 57 | +body: | |
| 58 | + bb.0: |
| 59 | + liveins: $s0, $s1, $w1 |
| 60 | +
|
| 61 | + ; CHECK-LABEL: name: fcmp_more_than_one_select |
| 62 | + ; CHECK: liveins: $s0, $s1, $w1 |
| 63 | + ; CHECK: [[COPY:%[0-9]+]]:fpr32 = COPY $s0 |
| 64 | + ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY $s1 |
| 65 | + ; CHECK: [[FMOVS0_:%[0-9]+]]:fpr32 = FMOVS0 |
| 66 | + ; CHECK: FCMPSri [[COPY]], implicit-def $nzcv |
| 67 | + ; CHECK: [[FCSELSrrr:%[0-9]+]]:fpr32 = FCSELSrrr [[FMOVS0_]], [[COPY1]], 0, implicit $nzcv |
| 68 | + ; CHECK: FCMPSri [[COPY]], implicit-def $nzcv |
| 69 | + ; CHECK: [[FCSELSrrr1:%[0-9]+]]:fpr32 = FCSELSrrr [[COPY1]], [[FMOVS0_]], 0, implicit $nzcv |
| 70 | + ; CHECK: $s0 = COPY [[FCSELSrrr]] |
| 71 | + ; CHECK: $s1 = COPY [[FCSELSrrr1]] |
| 72 | + ; CHECK: RET_ReallyLR implicit $s0 |
| 73 | + %0:fpr(s32) = COPY $s0 |
| 74 | + %1:fpr(s32) = COPY $s1 |
| 75 | + %2:fpr(s32) = G_FCONSTANT float 0.000000e+00 |
| 76 | + %5:gpr(s32) = G_FCMP floatpred(oeq), %0(s32), %2 |
| 77 | + %3:gpr(s1) = G_TRUNC %5(s32) |
| 78 | + %6:fpr(s1) = COPY %3(s1) |
| 79 | + %4:fpr(s32) = G_SELECT %6(s1), %2, %1 |
| 80 | + %7:fpr(s32) = G_SELECT %6(s1), %1, %2 |
| 81 | + $s0 = COPY %4(s32) |
| 82 | + $s1 = COPY %7(s32) |
| 83 | + RET_ReallyLR implicit $s0 |
| 84 | +
|
50 | 85 | ...
|
51 | 86 | ---
|
52 | 87 | name: using_icmp
|
|
0 commit comments