Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/20.x: [Hexagon] Explicitly truncate constant in UAddSubO (#127360) #127527

Merged
merged 1 commit into from
Feb 18, 2025
Merged
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
2 changes: 1 addition & 1 deletion llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,7 @@ HexagonTargetLowering::LowerUAddSubO(SDValue Op, SelectionDAG &DAG) const {
if (Opc == ISD::USUBO) {
SDValue Op = DAG.getNode(ISD::SUB, dl, VTs.VTs[0], {X, Y});
SDValue Ov = DAG.getSetCC(dl, MVT::i1, Op,
DAG.getConstant(-1, dl, ty(Op)), ISD::SETEQ);
DAG.getAllOnesConstant(dl, ty(Op)), ISD::SETEQ);
return DAG.getMergeValues({Op, Ov}, dl);
}
}
Expand Down
18 changes: 18 additions & 0 deletions llvm/test/CodeGen/Hexagon/iss127296.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; RUN: llc -mtriple=hexagon -O0 < %s | FileCheck %s

; CHECK: r0 = add(r0,#-1)

define fastcc void @os.linux.tls.initStatic(i32 %x) {
%1 = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %x, i32 1)
br label %2

2: ; preds = %0
%3 = extractvalue { i32, i1 } %1, 0
ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i32, i1 } @llvm.usub.with.overflow.i32(i32, i32) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

Loading