[llvm] 0f5fa35 - [X86] computeKnownBitsForPMADDWD - the final addition of the signextended multiplies is not guaranteed to be NSW

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 05:10:11 PDT 2024


Author: Simon Pilgrim
Date: 2024-06-27T13:09:48+01:00
New Revision: 0f5fa3558eb36823c16ba81a4c6e6e23a5f9df24

URL: https://github.com/llvm/llvm-project/commit/0f5fa3558eb36823c16ba81a4c6e6e23a5f9df24
DIFF: https://github.com/llvm/llvm-project/commit/0f5fa3558eb36823c16ba81a4c6e6e23a5f9df24.diff

LOG: [X86] computeKnownBitsForPMADDWD - the final addition of the signextended multiplies is not guaranteed to be NSW

https://rust.godbolt.org/z/3f1bevnoT
https://alive2.llvm.org/ce/z/cjixBY

Noticed by @alexfh

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index d983c35ca1d13..3bbf009a1defd 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -37158,7 +37158,7 @@ static void computeKnownBitsForPMADDWD(SDValue LHS, SDValue RHS,
   KnownBits RHSHi = DAG.computeKnownBits(RHS, DemandedHiElts, Depth + 1);
   KnownBits Lo = KnownBits::mul(LHSLo.sext(32), RHSLo.sext(32));
   KnownBits Hi = KnownBits::mul(LHSHi.sext(32), RHSHi.sext(32));
-  Known = KnownBits::computeForAddSub(/*Add=*/true, /*NSW=*/true,
+  Known = KnownBits::computeForAddSub(/*Add=*/true, /*NSW=*/false,
                                       /*NUW=*/false, Lo, Hi);
 }
 


        


More information about the llvm-commits mailing list