[PATCH] D133708: [LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in ExpandIntRes_ADDSUB.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 13 09:08:20 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGefd5acf1201f: [LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in… (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133708/new/
https://reviews.llvm.org/D133708
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
Index: llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
+++ llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
@@ -7,10 +7,9 @@
; COMMON-LABEL: test_add
define i128 @test_add(i128 %a, i128 %b) {
; NOCARRY: add.s64
-; NOCARRY-NEXT: setp.lt.u64
+; NOCARRY-NEXT: add.s64
; NOCARRY-NEXT: setp.lt.u64
; NOCARRY-NEXT: selp.u64
-; NOCARRY-NEXT: selp.b64
; NOCARRY-NEXT: add.s64
; CARRY: add.cc.s64
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -2988,23 +2988,17 @@
if (N->getOpcode() == ISD::ADD) {
Lo = DAG.getNode(ISD::ADD, dl, NVT, LoOps);
Hi = DAG.getNode(ISD::ADD, dl, NVT, makeArrayRef(HiOps, 2));
- SDValue Cmp1 = DAG.getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[0],
- ISD::SETULT);
+ SDValue Cmp = DAG.getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[0],
+ ISD::SETULT);
- if (BoolType == TargetLoweringBase::ZeroOrOneBooleanContent) {
- SDValue Carry = DAG.getZExtOrTrunc(Cmp1, dl, NVT);
- Hi = DAG.getNode(ISD::ADD, dl, NVT, Hi, Carry);
- return;
- }
+ SDValue Carry;
+ if (BoolType == TargetLoweringBase::ZeroOrOneBooleanContent)
+ Carry = DAG.getZExtOrTrunc(Cmp, dl, NVT);
+ else
+ Carry = DAG.getSelect(dl, NVT, Cmp, DAG.getConstant(1, dl, NVT),
+ DAG.getConstant(0, dl, NVT));
- SDValue Carry1 = DAG.getSelect(dl, NVT, Cmp1,
- DAG.getConstant(1, dl, NVT),
- DAG.getConstant(0, dl, NVT));
- SDValue Cmp2 = DAG.getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[1],
- ISD::SETULT);
- SDValue Carry2 = DAG.getSelect(dl, NVT, Cmp2,
- DAG.getConstant(1, dl, NVT), Carry1);
- Hi = DAG.getNode(ISD::ADD, dl, NVT, Hi, Carry2);
+ Hi = DAG.getNode(ISD::ADD, dl, NVT, Hi, Carry);
} else {
Lo = DAG.getNode(ISD::SUB, dl, NVT, LoOps);
Hi = DAG.getNode(ISD::SUB, dl, NVT, makeArrayRef(HiOps, 2));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133708.459775.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220913/4bcefee8/attachment.bin>
More information about the llvm-commits
mailing list