[llvm] r343096 - [X86][SSE] canReduceVMulWidth - use ComputeNumSignBits/SignBitIsZero directly

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 26 04:48:52 PDT 2018


Author: rksimon
Date: Wed Sep 26 04:48:52 2018
New Revision: 343096

URL: http://llvm.org/viewvc/llvm-project?rev=343096&view=rev
Log:
[X86][SSE] canReduceVMulWidth - use ComputeNumSignBits/SignBitIsZero directly

Don't reinvent the wheel for BUILD_VECTOR/ZERO_EXTEND - its only the ANY_EXTEND special case that needs handling.

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

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=343096&r1=343095&r2=343096&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Sep 26 04:48:52 2018
@@ -33967,25 +33967,9 @@ static bool canReduceVMulWidth(SDNode *N
       else
         return false;
       IsPositive[i] = true;
-    } else if (Opd.getOpcode() == ISD::BUILD_VECTOR) {
-      // All the operands of BUILD_VECTOR need to be int constant.
-      // Find the smallest value range which all the operands belong to.
-      SignBits[i] = 32;
-      IsPositive[i] = true;
-      for (const SDValue &SubOp : Opd.getNode()->op_values()) {
-        if (SubOp.isUndef())
-          continue;
-        auto *CN = dyn_cast<ConstantSDNode>(SubOp);
-        if (!CN)
-          return false;
-        APInt IntVal = CN->getAPIntValue();
-        if (IntVal.isNegative())
-          IsPositive[i] = false;
-        SignBits[i] = std::min(SignBits[i], IntVal.getNumSignBits());
-      }
     } else {
       SignBits[i] = DAG.ComputeNumSignBits(Opd);
-      if (Opd.getOpcode() == ISD::ZERO_EXTEND)
+      if (DAG.SignBitIsZero(Opd))
         IsPositive[i] = true;
     }
   }




More information about the llvm-commits mailing list