[PATCH] D64331: [LegalizeTypes] Fix saturation bug for smul.fix.sat
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 03:25:46 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365455: [LegalizeTypes] Fix saturation bug for smul.fix.sat (authored by bjope, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D64331?vs=208394&id=208627#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64331/new/
https://reviews.llvm.org/D64331
Files:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/trunk/test/CodeGen/X86/smul_fix_sat.ll
Index: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -2902,8 +2902,8 @@
Lo = ResultLH;
Hi = ResultHL;
- // We overflow max if HH > 0 or HH == 0 && HL sign is negative.
- // We overflow min if HH < -1 or HH == -1 && HL sign is 0.
+ // We overflow max if HH > 0 or HH == 0 && HL sign bit is 1.
+ // We overflow min if HH < -1 or HH == -1 && HL sign bit is 0.
if (Saturating) {
SDValue HHPos = DAG.getSetCC(dl, BoolNVT, ResultHH, NVTZero, ISD::SETGT);
SDValue HHZero = DAG.getSetCC(dl, BoolNVT, ResultHH, NVTZero, ISD::SETEQ);
@@ -2913,7 +2913,7 @@
SDValue HHNeg = DAG.getSetCC(dl, BoolNVT, ResultHH, NVTNeg1, ISD::SETLT);
SDValue HHNeg1 = DAG.getSetCC(dl, BoolNVT, ResultHH, NVTNeg1, ISD::SETEQ);
- SDValue HLPos = DAG.getSetCC(dl, BoolNVT, ResultHL, NVTZero, ISD::SETGT);
+ SDValue HLPos = DAG.getSetCC(dl, BoolNVT, ResultHL, NVTZero, ISD::SETGE);
SatMin = DAG.getNode(ISD::OR, dl, BoolNVT, HHNeg,
DAG.getNode(ISD::AND, dl, BoolNVT, HHNeg1, HLPos));
}
Index: llvm/trunk/test/CodeGen/X86/smul_fix_sat.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/smul_fix_sat.ll
+++ llvm/trunk/test/CodeGen/X86/smul_fix_sat.ll
@@ -629,7 +629,7 @@
; X86-NEXT: cmovnsl %esi, %edi
; X86-NEXT: cmovnsl %ecx, %edx
; X86-NEXT: testl %edx, %edx
-; X86-NEXT: setg %cl
+; X86-NEXT: setns %cl
; X86-NEXT: sets %ch
; X86-NEXT: testl %edi, %edi
; X86-NEXT: setg %bl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64331.208627.patch
Type: text/x-patch
Size: 1748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190709/abe41b93/attachment.bin>
More information about the llvm-commits
mailing list