[llvm] r314903 - [X86][SSE] Early out from ComputeNumSignBitsForTargetNode. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 06:41:26 PDT 2017
Author: rksimon
Date: Wed Oct 4 06:41:26 2017
New Revision: 314903
URL: http://llvm.org/viewvc/llvm-project?rev=314903&view=rev
Log:
[X86][SSE] Early out from ComputeNumSignBitsForTargetNode. NFCI.
Early out from vector shift by immediates that will exceed eltsize - don't bother making an unnecessary ComputeNumSignBits recursive call.
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=314903&r1=314902&r2=314903&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 4 06:41:26 2017
@@ -27210,20 +27210,24 @@ unsigned X86TargetLowering::ComputeNumSi
}
case X86ISD::VSHLI: {
+ // TODO: Add DemandedElts support.
SDValue Src = Op.getOperand(0);
- unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
APInt ShiftVal = cast<ConstantSDNode>(Op.getOperand(1))->getAPIntValue();
if (ShiftVal.uge(VTBits))
return VTBits; // Shifted all bits out --> zero.
+ unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
if (ShiftVal.uge(Tmp))
return 1; // Shifted all sign bits out --> unknown.
return Tmp - ShiftVal.getZExtValue();
}
case X86ISD::VSRAI: {
+ // TODO: Add DemandedElts support.
SDValue Src = Op.getOperand(0);
- unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
APInt ShiftVal = cast<ConstantSDNode>(Op.getOperand(1))->getAPIntValue();
+ if (ShiftVal.uge(VTBits - 1))
+ return VTBits; // Sign splat.
+ unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
ShiftVal += Tmp;
return ShiftVal.uge(VTBits) ? VTBits : ShiftVal.getZExtValue();
}
More information about the llvm-commits
mailing list