[llvm] [LegalizeTypes] Create an ISD::ADD instead of an ISD::UADDO with unused overflow result. (PR #100647)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 12:57:38 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-llvm-selectiondag
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
Same for ISD::SUB instead of ISD::USUBO.
---
Full diff: https://github.com/llvm/llvm-project/pull/100647.diff
2 Files Affected:
- (modified) llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (+2-2)
- (modified) llvm/test/CodeGen/X86/known-bits.ll (+1-1)
``````````diff
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index af77b0070df0a..33a53dfc81379 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -3395,13 +3395,13 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
Lo = DAG.getNode(ISD::UADDO, dl, VTList, LoOps);
HiOps[2] = Lo.getValue(1);
Hi = DAG.computeKnownBits(HiOps[2]).isZero()
- ? DAG.getNode(ISD::UADDO, dl, VTList, ArrayRef(HiOps, 2))
+ ? DAG.getNode(ISD::ADD, dl, NVT, ArrayRef(HiOps, 2))
: DAG.getNode(ISD::UADDO_CARRY, dl, VTList, HiOps);
} else {
Lo = DAG.getNode(ISD::USUBO, dl, VTList, LoOps);
HiOps[2] = Lo.getValue(1);
Hi = DAG.computeKnownBits(HiOps[2]).isZero()
- ? DAG.getNode(ISD::USUBO, dl, VTList, ArrayRef(HiOps, 2))
+ ? DAG.getNode(ISD::SUB, dl, NVT, ArrayRef(HiOps, 2))
: DAG.getNode(ISD::USUBO_CARRY, dl, VTList, HiOps);
}
return;
diff --git a/llvm/test/CodeGen/X86/known-bits.ll b/llvm/test/CodeGen/X86/known-bits.ll
index 9741f6f0a5e2d..f7b2538e1de2f 100644
--- a/llvm/test/CodeGen/X86/known-bits.ll
+++ b/llvm/test/CodeGen/X86/known-bits.ll
@@ -115,7 +115,7 @@ define i128 @knownbits_mask_addc_shl(i64 %a0, i64 %a1, i64 %a2) nounwind {
; X64-NEXT: andq $-1024, %rdi # imm = 0xFC00
; X64-NEXT: andq $-1024, %rsi # imm = 0xFC00
; X64-NEXT: addq %rdi, %rsi
-; X64-NEXT: adcq $0, %rdx
+; X64-NEXT: adcl $0, %edx
; X64-NEXT: shldq $54, %rsi, %rdx
; X64-NEXT: xorl %eax, %eax
; X64-NEXT: retq
``````````
</details>
https://github.com/llvm/llvm-project/pull/100647
More information about the llvm-commits
mailing list