Skip to content

Commit dde5546

Browse files
authored
[RISCV] GISel custom lowering for G_ADD/G_SUB (#121587)
Custom lowering for s32 G_ADD/SUB to help match selection dag better. Specifically for RV64 a s32 is produced as a add+sext the output this allows for fewer instructions to sign extend a couple patterns. Allows for the generation of addiw,subw,negw to reduce required instructions to load values quicker Log2_ceil_i32 in rvzbb.ll shows a more obvious improvement case.
1 parent 4583f6d commit dde5546

21 files changed

+236
-156
lines changed

llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/CodeGen/MachineConstantPool.h"
2222
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2323
#include "llvm/CodeGen/MachineMemOperand.h"
24+
#include "llvm/CodeGen/MachineOperand.h"
2425
#include "llvm/CodeGen/MachineRegisterInfo.h"
2526
#include "llvm/CodeGen/TargetOpcodes.h"
2627
#include "llvm/CodeGen/ValueTypes.h"
@@ -132,7 +133,14 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
132133

133134
auto PtrVecTys = {nxv1p0, nxv2p0, nxv4p0, nxv8p0, nxv16p0};
134135

135-
getActionDefinitionsBuilder({G_ADD, G_SUB, G_AND, G_OR, G_XOR})
136+
getActionDefinitionsBuilder({G_ADD, G_SUB})
137+
.legalFor({sXLen})
138+
.legalIf(typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST))
139+
.customFor(ST.is64Bit(), {s32})
140+
.widenScalarToNextPow2(0)
141+
.clampScalar(0, sXLen, sXLen);
142+
143+
getActionDefinitionsBuilder({G_AND, G_OR, G_XOR})
136144
.legalFor({sXLen})
137145
.legalIf(typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST))
138146
.widenScalarToNextPow2(0)
@@ -1330,6 +1338,24 @@ bool RISCVLegalizerInfo::legalizeCustom(
13301338
return true;
13311339
return Helper.lowerConstant(MI);
13321340
}
1341+
case TargetOpcode::G_SUB:
1342+
case TargetOpcode::G_ADD: {
1343+
Helper.Observer.changingInstr(MI);
1344+
Helper.widenScalarSrc(MI, sXLen, 1, TargetOpcode::G_ANYEXT);
1345+
Helper.widenScalarSrc(MI, sXLen, 2, TargetOpcode::G_ANYEXT);
1346+
1347+
Register DstALU = MRI.createGenericVirtualRegister(sXLen);
1348+
1349+
MachineOperand &MO = MI.getOperand(0);
1350+
MIRBuilder.setInsertPt(MIRBuilder.getMBB(), ++MIRBuilder.getInsertPt());
1351+
auto DstSext = MIRBuilder.buildSExtInReg(sXLen, DstALU, 32);
1352+
1353+
MIRBuilder.buildInstr(TargetOpcode::G_TRUNC, {MO}, {DstSext});
1354+
MO.setReg(DstALU);
1355+
1356+
Helper.Observer.changedInstr(MI);
1357+
return true;
1358+
}
13331359
case TargetOpcode::G_SEXT_INREG: {
13341360
LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
13351361
int64_t SizeInBits = MI.getOperand(2).getImm();

llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ define i32 @add_positive_low_bound_reject(i32 %a) nounwind {
1414
;
1515
; RV64I-LABEL: add_positive_low_bound_reject:
1616
; RV64I: # %bb.0:
17-
; RV64I-NEXT: addi a0, a0, 2047
17+
; RV64I-NEXT: addiw a0, a0, 2047
1818
; RV64I-NEXT: ret
1919
%1 = add i32 %a, 2047
2020
ret i32 %1
@@ -30,7 +30,7 @@ define i32 @add_positive_low_bound_accept(i32 %a) nounwind {
3030
; RV64I-LABEL: add_positive_low_bound_accept:
3131
; RV64I: # %bb.0:
3232
; RV64I-NEXT: addi a0, a0, 2047
33-
; RV64I-NEXT: addi a0, a0, 1
33+
; RV64I-NEXT: addiw a0, a0, 1
3434
; RV64I-NEXT: ret
3535
%1 = add i32 %a, 2048
3636
ret i32 %1
@@ -46,7 +46,7 @@ define i32 @add_positive_high_bound_accept(i32 %a) nounwind {
4646
; RV64I-LABEL: add_positive_high_bound_accept:
4747
; RV64I: # %bb.0:
4848
; RV64I-NEXT: addi a0, a0, 2047
49-
; RV64I-NEXT: addi a0, a0, 2047
49+
; RV64I-NEXT: addiw a0, a0, 2047
5050
; RV64I-NEXT: ret
5151
%1 = add i32 %a, 4094
5252
ret i32 %1
@@ -63,8 +63,8 @@ define i32 @add_positive_high_bound_reject(i32 %a) nounwind {
6363
; RV64I-LABEL: add_positive_high_bound_reject:
6464
; RV64I: # %bb.0:
6565
; RV64I-NEXT: lui a1, 1
66-
; RV64I-NEXT: addiw a1, a1, -1
67-
; RV64I-NEXT: add a0, a0, a1
66+
; RV64I-NEXT: addi a1, a1, -1
67+
; RV64I-NEXT: addw a0, a0, a1
6868
; RV64I-NEXT: ret
6969
%1 = add i32 %a, 4095
7070
ret i32 %1
@@ -78,7 +78,7 @@ define i32 @add_negative_high_bound_reject(i32 %a) nounwind {
7878
;
7979
; RV64I-LABEL: add_negative_high_bound_reject:
8080
; RV64I: # %bb.0:
81-
; RV64I-NEXT: addi a0, a0, -2048
81+
; RV64I-NEXT: addiw a0, a0, -2048
8282
; RV64I-NEXT: ret
8383
%1 = add i32 %a, -2048
8484
ret i32 %1
@@ -94,7 +94,7 @@ define i32 @add_negative_high_bound_accept(i32 %a) nounwind {
9494
; RV64I-LABEL: add_negative_high_bound_accept:
9595
; RV64I: # %bb.0:
9696
; RV64I-NEXT: addi a0, a0, -2048
97-
; RV64I-NEXT: addi a0, a0, -1
97+
; RV64I-NEXT: addiw a0, a0, -1
9898
; RV64I-NEXT: ret
9999
%1 = add i32 %a, -2049
100100
ret i32 %1
@@ -110,7 +110,7 @@ define i32 @add_negative_low_bound_accept(i32 %a) nounwind {
110110
; RV64I-LABEL: add_negative_low_bound_accept:
111111
; RV64I: # %bb.0:
112112
; RV64I-NEXT: addi a0, a0, -2048
113-
; RV64I-NEXT: addi a0, a0, -2048
113+
; RV64I-NEXT: addiw a0, a0, -2048
114114
; RV64I-NEXT: ret
115115
%1 = add i32 %a, -4096
116116
ret i32 %1
@@ -127,8 +127,8 @@ define i32 @add_negative_low_bound_reject(i32 %a) nounwind {
127127
; RV64I-LABEL: add_negative_low_bound_reject:
128128
; RV64I: # %bb.0:
129129
; RV64I-NEXT: lui a1, 1048575
130-
; RV64I-NEXT: addiw a1, a1, -1
131-
; RV64I-NEXT: add a0, a0, a1
130+
; RV64I-NEXT: addi a1, a1, -1
131+
; RV64I-NEXT: addw a0, a0, a1
132132
; RV64I-NEXT: ret
133133
%1 = add i32 %a, -4097
134134
ret i32 %1
@@ -144,7 +144,7 @@ define i32 @add32_accept(i32 %a) nounwind {
144144
; RV64I-LABEL: add32_accept:
145145
; RV64I: # %bb.0:
146146
; RV64I-NEXT: addi a0, a0, 2047
147-
; RV64I-NEXT: addi a0, a0, 952
147+
; RV64I-NEXT: addiw a0, a0, 952
148148
; RV64I-NEXT: ret
149149
%1 = add i32 %a, 2999
150150
ret i32 %1

llvm/test/CodeGen/RISCV/GlobalISel/alu-roundtrip.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ define i32 @add_i8_signext_i32(i8 %a, i8 %b) {
3737
; RV64IM-NEXT: slli a1, a1, 56
3838
; RV64IM-NEXT: srai a0, a0, 56
3939
; RV64IM-NEXT: srai a1, a1, 56
40-
; RV64IM-NEXT: add a0, a0, a1
40+
; RV64IM-NEXT: addw a0, a0, a1
4141
; RV64IM-NEXT: ret
4242
entry:
4343
%0 = sext i8 %a to i32
@@ -58,7 +58,7 @@ define i32 @add_i8_zeroext_i32(i8 %a, i8 %b) {
5858
; RV64IM: # %bb.0: # %entry
5959
; RV64IM-NEXT: andi a0, a0, 255
6060
; RV64IM-NEXT: andi a1, a1, 255
61-
; RV64IM-NEXT: add a0, a0, a1
61+
; RV64IM-NEXT: addw a0, a0, a1
6262
; RV64IM-NEXT: ret
6363
entry:
6464
%0 = zext i8 %a to i32
@@ -78,7 +78,7 @@ define i32 @add_i32(i32 %a, i32 %b) {
7878
;
7979
; RV64IM-LABEL: add_i32:
8080
; RV64IM: # %bb.0: # %entry
81-
; RV64IM-NEXT: add a0, a0, a1
81+
; RV64IM-NEXT: addw a0, a0, a1
8282
; RV64IM-NEXT: ret
8383
entry:
8484
%0 = add i32 %a, %b
@@ -93,7 +93,7 @@ define i32 @addi_i32(i32 %a) {
9393
;
9494
; RV64IM-LABEL: addi_i32:
9595
; RV64IM: # %bb.0: # %entry
96-
; RV64IM-NEXT: addi a0, a0, 1234
96+
; RV64IM-NEXT: addiw a0, a0, 1234
9797
; RV64IM-NEXT: ret
9898
entry:
9999
%0 = add i32 %a, 1234
@@ -108,7 +108,7 @@ define i32 @sub_i32(i32 %a, i32 %b) {
108108
;
109109
; RV64IM-LABEL: sub_i32:
110110
; RV64IM: # %bb.0: # %entry
111-
; RV64IM-NEXT: sub a0, a0, a1
111+
; RV64IM-NEXT: subw a0, a0, a1
112112
; RV64IM-NEXT: ret
113113
entry:
114114
%0 = sub i32 %a, %b
@@ -123,7 +123,7 @@ define i32 @subi_i32(i32 %a) {
123123
;
124124
; RV64IM-LABEL: subi_i32:
125125
; RV64IM: # %bb.0: # %entry
126-
; RV64IM-NEXT: addi a0, a0, -1234
126+
; RV64IM-NEXT: addiw a0, a0, -1234
127127
; RV64IM-NEXT: ret
128128
entry:
129129
%0 = sub i32 %a, 1234
@@ -138,7 +138,7 @@ define i32 @neg_i32(i32 %a) {
138138
;
139139
; RV64IM-LABEL: neg_i32:
140140
; RV64IM: # %bb.0: # %entry
141-
; RV64IM-NEXT: neg a0, a0
141+
; RV64IM-NEXT: negw a0, a0
142142
; RV64IM-NEXT: ret
143143
entry:
144144
%0 = sub i32 0, %a

llvm/test/CodeGen/RISCV/GlobalISel/combine.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ define i32 @constant_to_rhs(i32 %x) {
2121
; RV64-O0-NEXT: mv a1, a0
2222
; RV64-O0-NEXT: li a0, 1
2323
; RV64-O0-NEXT: add a0, a0, a1
24+
; RV64-O0-NEXT: sext.w a0, a0
2425
; RV64-O0-NEXT: ret
2526
;
2627
; RV32-OPT-LABEL: constant_to_rhs:
@@ -30,7 +31,7 @@ define i32 @constant_to_rhs(i32 %x) {
3031
;
3132
; RV64-OPT-LABEL: constant_to_rhs:
3233
; RV64-OPT: # %bb.0:
33-
; RV64-OPT-NEXT: addi a0, a0, 1
34+
; RV64-OPT-NEXT: addiw a0, a0, 1
3435
; RV64-OPT-NEXT: ret
3536
%a = add i32 1, %x
3637
ret i32 %a

llvm/test/CodeGen/RISCV/GlobalISel/freeze.ll

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,19 @@ define ptr @freeze_ptr(ptr %x) {
9696
%struct.T = type { i32, i32 }
9797

9898
define i32 @freeze_struct(ptr %p) {
99-
; CHECK-LABEL: freeze_struct:
100-
; CHECK: # %bb.0:
101-
; CHECK-NEXT: lw a1, 0(a0)
102-
; CHECK-NEXT: lw a0, 4(a0)
103-
; CHECK-NEXT: add a0, a1, a0
104-
; CHECK-NEXT: ret
99+
; RV32-LABEL: freeze_struct:
100+
; RV32: # %bb.0:
101+
; RV32-NEXT: lw a1, 0(a0)
102+
; RV32-NEXT: lw a0, 4(a0)
103+
; RV32-NEXT: add a0, a1, a0
104+
; RV32-NEXT: ret
105+
;
106+
; RV64-LABEL: freeze_struct:
107+
; RV64: # %bb.0:
108+
; RV64-NEXT: lw a1, 0(a0)
109+
; RV64-NEXT: lw a0, 4(a0)
110+
; RV64-NEXT: addw a0, a1, a0
111+
; RV64-NEXT: ret
105112
%s = load %struct.T, ptr %p
106113
%y1 = freeze %struct.T %s
107114
%v1 = extractvalue %struct.T %y1, 0
@@ -111,12 +118,19 @@ define i32 @freeze_struct(ptr %p) {
111118
}
112119

113120
define i32 @freeze_anonstruct(ptr %p) {
114-
; CHECK-LABEL: freeze_anonstruct:
115-
; CHECK: # %bb.0:
116-
; CHECK-NEXT: lw a1, 0(a0)
117-
; CHECK-NEXT: lw a0, 4(a0)
118-
; CHECK-NEXT: add a0, a1, a0
119-
; CHECK-NEXT: ret
121+
; RV32-LABEL: freeze_anonstruct:
122+
; RV32: # %bb.0:
123+
; RV32-NEXT: lw a1, 0(a0)
124+
; RV32-NEXT: lw a0, 4(a0)
125+
; RV32-NEXT: add a0, a1, a0
126+
; RV32-NEXT: ret
127+
;
128+
; RV64-LABEL: freeze_anonstruct:
129+
; RV64: # %bb.0:
130+
; RV64-NEXT: lw a1, 0(a0)
131+
; RV64-NEXT: lw a0, 4(a0)
132+
; RV64-NEXT: addw a0, a1, a0
133+
; RV64-NEXT: ret
120134
%s = load {i32, i32}, ptr %p
121135
%y1 = freeze {i32, i32} %s
122136
%v1 = extractvalue {i32, i32} %y1, 0
@@ -141,7 +155,7 @@ define i32 @freeze_anonstruct2(ptr %p) {
141155
; RV64-NEXT: lw a0, 0(a0)
142156
; RV64-NEXT: slli a1, a1, 48
143157
; RV64-NEXT: srli a1, a1, 48
144-
; RV64-NEXT: add a0, a0, a1
158+
; RV64-NEXT: addw a0, a0, a1
145159
; RV64-NEXT: ret
146160
%s = load {i32, i16}, ptr %p
147161
%y1 = freeze {i32, i16} %s
@@ -168,7 +182,7 @@ define i32 @freeze_anonstruct2_sext(ptr %p) {
168182
; RV64-NEXT: lw a0, 0(a0)
169183
; RV64-NEXT: slli a1, a1, 48
170184
; RV64-NEXT: srai a1, a1, 48
171-
; RV64-NEXT: add a0, a0, a1
185+
; RV64-NEXT: addw a0, a0, a1
172186
; RV64-NEXT: ret
173187
%s = load {i32, i16}, ptr %p
174188
%y1 = freeze {i32, i16} %s
@@ -180,12 +194,19 @@ define i32 @freeze_anonstruct2_sext(ptr %p) {
180194
}
181195

182196
define i32 @freeze_array(ptr %p) nounwind {
183-
; CHECK-LABEL: freeze_array:
184-
; CHECK: # %bb.0:
185-
; CHECK-NEXT: lw a1, 0(a0)
186-
; CHECK-NEXT: lw a0, 4(a0)
187-
; CHECK-NEXT: add a0, a1, a0
188-
; CHECK-NEXT: ret
197+
; RV32-LABEL: freeze_array:
198+
; RV32: # %bb.0:
199+
; RV32-NEXT: lw a1, 0(a0)
200+
; RV32-NEXT: lw a0, 4(a0)
201+
; RV32-NEXT: add a0, a1, a0
202+
; RV32-NEXT: ret
203+
;
204+
; RV64-LABEL: freeze_array:
205+
; RV64: # %bb.0:
206+
; RV64-NEXT: lw a1, 0(a0)
207+
; RV64-NEXT: lw a0, 4(a0)
208+
; RV64-NEXT: addw a0, a1, a0
209+
; RV64-NEXT: ret
189210
%s = load [2 x i32], ptr %p
190211
%y1 = freeze [2 x i32] %s
191212
%v1 = extractvalue [2 x i32] %y1, 0

llvm/test/CodeGen/RISCV/GlobalISel/iabs.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ define i32 @abs32(i32 %x) {
9898
; RV64I-LABEL: abs32:
9999
; RV64I: # %bb.0:
100100
; RV64I-NEXT: sraiw a1, a0, 31
101-
; RV64I-NEXT: add a0, a0, a1
101+
; RV64I-NEXT: addw a0, a0, a1
102102
; RV64I-NEXT: xor a0, a0, a1
103103
; RV64I-NEXT: ret
104104
;

llvm/test/CodeGen/RISCV/GlobalISel/legalizer-info-validation.mir

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
2424
#
2525
# DEBUG-NEXT: G_SUB (opcode [[SUB_OPC:[0-9]+]]): 1 type index, 0 imm indices
26-
# DEBUG-NEXT: .. opcode [[SUB_OPC]] is aliased to [[ADD_OPC]]
26+
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
2727
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
2828
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
2929
#
@@ -59,7 +59,6 @@
5959
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
6060
#
6161
# DEBUG-NEXT: G_AND (opcode {{[0-9]+}}): 1 type index, 0 imm indices
62-
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
6362
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
6463
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
6564
#

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-abs-rv64.mir

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ body: |
8686
; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
8787
; RV64I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[ASSERT_SEXT]], [[C]](s64)
8888
; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[ASSERT_SEXT]], [[ASHR]]
89-
; RV64I-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[ADD]], [[ASHR]]
90-
; RV64I-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[XOR]], 32
91-
; RV64I-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
89+
; RV64I-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[ADD]], 32
90+
; RV64I-NEXT: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[SEXT_INREG]], [[ASHR]]
91+
; RV64I-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[XOR]], 32
92+
; RV64I-NEXT: $x10 = COPY [[SEXT_INREG1]](s64)
9293
; RV64I-NEXT: PseudoRET implicit $x10
9394
;
9495
; RV64ZBB-LABEL: name: abs_i32

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-add-rv64.mir

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ body: |
6969
; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
7070
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
7171
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
72-
; CHECK-NEXT: $x10 = COPY [[ADD]](s64)
72+
; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[ADD]], 32
73+
; CHECK-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
7374
; CHECK-NEXT: PseudoRET implicit $x10
7475
%0:_(s64) = COPY $x10
7576
%1:_(s64) = COPY $x11

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-addo-subo-rv64.mir

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ body: |
339339
; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[ADD]], 32
340340
; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
341341
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[SEXT_INREG]](s64), [[SEXT_INREG1]]
342-
; CHECK-NEXT: $x10 = COPY [[ADD]](s64)
342+
; CHECK-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
343343
; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
344344
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
345345
%2:_(s64) = COPY $x10
@@ -454,10 +454,11 @@ body: |
454454
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
455455
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
456456
; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
457-
; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
458-
; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
459-
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[SEXT_INREG]](s64), [[SEXT_INREG1]]
460-
; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
457+
; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[SUB]], 32
458+
; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
459+
; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
460+
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[SEXT_INREG1]](s64), [[SEXT_INREG2]]
461+
; CHECK-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
461462
; CHECK-NEXT: $x11 = COPY [[ICMP]](s64)
462463
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
463464
%2:_(s64) = COPY $x10

0 commit comments

Comments
 (0)