Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7830,9 +7830,7 @@ bool CombinerHelper::matchSuboCarryOut(const MachineInstr &MI,
case ConstantRange::OverflowResult::AlwaysOverflowsHigh: {
MatchInfo = [=](MachineIRBuilder &B) {
B.buildSub(Dst, LHS, RHS);
B.buildConstant(Carry, getICmpTrueVal(getTargetLowering(),
/*isVector=*/CarryTy.isVector(),
/*isFP=*/false));
B.buildConstant(Carry, 1);
};
return true;
}
Expand All @@ -7855,9 +7853,7 @@ bool CombinerHelper::matchSuboCarryOut(const MachineInstr &MI,
case ConstantRange::OverflowResult::AlwaysOverflowsHigh: {
MatchInfo = [=](MachineIRBuilder &B) {
B.buildSub(Dst, LHS, RHS);
B.buildConstant(Carry, getICmpTrueVal(getTargetLowering(),
/*isVector=*/CarryTy.isVector(),
/*isFP=*/false));
B.buildConstant(Carry, 1);
};
return true;
}
Expand Down
23 changes: 23 additions & 0 deletions llvm/test/CodeGen/AArch64/GlobalISel/combine-overflow.mir
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,26 @@ body: |
$q1 = COPY %o_wide
RET_ReallyLR implicit $w0
...
---
name: usub_may_carry_non_const
body: |
bb.0:
liveins: $w0, $w1
; CHECK-LABEL: name: usub_may_carry_non_const
; CHECK: liveins: $w0, $w1
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w0
; CHECK-NEXT: %sub:_(s32), %o:_(s1) = G_USUBO [[COPY]], [[COPY1]]
; CHECK-NEXT: %o_wide:_(s32) = G_ZEXT %o(s1)
; CHECK-NEXT: $w0 = COPY %sub(s32)
; CHECK-NEXT: $w1 = COPY %o_wide(s32)
; CHECK-NEXT: RET_ReallyLR implicit $w0
%0:_(s32) = COPY $w0
%1:_(s32) = COPY $w0
%sub:_(s32), %o:_(s1) = G_USUBO %0, %1
%o_wide:_(s32) = G_ZEXT %o(s1)
$w0 = COPY %sub(s32)
$w1 = COPY %o_wide
RET_ReallyLR implicit $w0
...
Loading