|
| 1 | +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 |
| 2 | +# RUN: llc -mtriple=amdgcn -mcpu=gfx1030 -run-pass=si-fold-operands -o - %s | FileCheck %s |
| 3 | + |
| 4 | +# The same literal may be used multiple times in different operands, |
| 5 | +# as long as it is the same value. |
| 6 | + |
| 7 | +--- |
| 8 | +name: fold_multiple_same_literal_use_0 |
| 9 | +tracksRegLiveness: true |
| 10 | +body: | |
| 11 | + bb.0: |
| 12 | + liveins: $vgpr0 |
| 13 | +
|
| 14 | + ; CHECK-LABEL: name: fold_multiple_same_literal_use_0 |
| 15 | + ; CHECK: liveins: $vgpr0 |
| 16 | + ; CHECK-NEXT: {{ $}} |
| 17 | + ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 |
| 18 | + ; CHECK-NEXT: [[V_DIV_SCALE_F32_e64_:%[0-9]+]]:vgpr_32, [[V_DIV_SCALE_F32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, 1178657792, 0, 1178657792, 0, 1178657792, 0, 0, implicit $mode, implicit $exec |
| 19 | + ; CHECK-NEXT: S_ENDPGM 0, implicit [[V_DIV_SCALE_F32_e64_]] |
| 20 | + %0:vgpr_32 = COPY $vgpr0 |
| 21 | + %1:sreg_32 = S_MOV_B32 1178657792 |
| 22 | + %2:vgpr_32 = COPY %1 |
| 23 | + %3:vgpr_32, %4:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, %2, 0, %2, 0, %2, 0, 0, implicit $mode, implicit $exec |
| 24 | + S_ENDPGM 0, implicit %3 |
| 25 | +... |
| 26 | + |
| 27 | +--- |
| 28 | +name: fold_multiple_same_literal_use_1 |
| 29 | +tracksRegLiveness: true |
| 30 | +body: | |
| 31 | + bb.0: |
| 32 | + liveins: $vgpr0 |
| 33 | +
|
| 34 | + ; CHECK-LABEL: name: fold_multiple_same_literal_use_1 |
| 35 | + ; CHECK: liveins: $vgpr0 |
| 36 | + ; CHECK-NEXT: {{ $}} |
| 37 | + ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 |
| 38 | + ; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 1178657792, implicit $exec |
| 39 | + ; CHECK-NEXT: [[V_DIV_SCALE_F32_e64_:%[0-9]+]]:vgpr_32, [[V_DIV_SCALE_F32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, 1178657792, 0, 1178657792, 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec |
| 40 | + ; CHECK-NEXT: S_ENDPGM 0, implicit [[V_DIV_SCALE_F32_e64_]] |
| 41 | + %0:vgpr_32 = COPY $vgpr0 |
| 42 | + %1:sreg_32 = S_MOV_B32 1178657792 |
| 43 | + %2:vgpr_32 = COPY %1 |
| 44 | + %3:vgpr_32, %4:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, 1178657792, 0, 1178657792, 0, %2, 0, 0, implicit $mode, implicit $exec |
| 45 | + S_ENDPGM 0, implicit %3 |
| 46 | +... |
| 47 | + |
| 48 | +--- |
| 49 | +name: no_fold_multiple_same_literal_different_value |
| 50 | +tracksRegLiveness: true |
| 51 | +body: | |
| 52 | + bb.0: |
| 53 | + liveins: $vgpr0 |
| 54 | +
|
| 55 | + ; CHECK-LABEL: name: no_fold_multiple_same_literal_different_value |
| 56 | + ; CHECK: liveins: $vgpr0 |
| 57 | + ; CHECK-NEXT: {{ $}} |
| 58 | + ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0 |
| 59 | + ; CHECK-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 1178657793, implicit $exec |
| 60 | + ; CHECK-NEXT: [[V_DIV_SCALE_F32_e64_:%[0-9]+]]:vgpr_32, [[V_DIV_SCALE_F32_e64_1:%[0-9]+]]:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, 1178657792, 0, 1178657792, 0, [[V_MOV_B32_e32_]], 0, 0, implicit $mode, implicit $exec |
| 61 | + ; CHECK-NEXT: S_ENDPGM 0, implicit [[V_DIV_SCALE_F32_e64_]] |
| 62 | + %0:vgpr_32 = COPY $vgpr0 |
| 63 | + %1:sreg_32 = S_MOV_B32 1178657793 |
| 64 | + %2:vgpr_32 = COPY %1 |
| 65 | + %3:vgpr_32, %4:sreg_32_xm0_xexec = V_DIV_SCALE_F32_e64 0, 1178657792, 0, 1178657792, 0, %2, 0, 0, implicit $mode, implicit $exec |
| 66 | + S_ENDPGM 0, implicit %3 |
| 67 | +... |
0 commit comments