[llvm] r317005 - [X86][SSE] Add VSRLI/VSRAI/VSLLI demanded elts support to computeKnownBits/ComputeNumSignBits
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 09:06:21 PDT 2017
Author: rksimon
Date: Tue Oct 31 09:06:21 2017
New Revision: 317005
URL: http://llvm.org/viewvc/llvm-project?rev=317005&view=rev
Log:
[X86][SSE] Add VSRLI/VSRAI/VSLLI demanded elts support to computeKnownBits/ComputeNumSignBits
Mainly a perf improvements as most combines will have occurred before we lower to these instructions
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=317005&r1=317004&r2=317005&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 31 09:06:21 2017
@@ -27330,7 +27330,7 @@ void X86TargetLowering::computeKnownBits
break;
}
- DAG.computeKnownBits(Op.getOperand(0), Known, Depth + 1);
+ DAG.computeKnownBits(Op.getOperand(0), Known, DemandedElts, Depth + 1);
unsigned ShAmt = ShiftImm->getZExtValue();
if (Opc == X86ISD::VSHLI) {
Known.Zero <<= ShAmt;
@@ -27347,6 +27347,7 @@ void X86TargetLowering::computeKnownBits
break;
}
case X86ISD::VZEXT: {
+ // TODO: Add DemandedElts support.
SDValue N0 = Op.getOperand(0);
unsigned NumElts = VT.getVectorNumElements();
@@ -27396,6 +27397,7 @@ unsigned X86TargetLowering::ComputeNumSi
return VTBits;
case X86ISD::VSEXT: {
+ // TODO: Add DemandedElts support.
SDValue Src = Op.getOperand(0);
unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
Tmp += VTBits - Src.getScalarValueSizeInBits();
@@ -27403,6 +27405,7 @@ unsigned X86TargetLowering::ComputeNumSi
}
case X86ISD::VTRUNC: {
+ // TODO: Add DemandedElts support.
SDValue Src = Op.getOperand(0);
unsigned NumSrcBits = Src.getScalarValueSizeInBits();
assert(VTBits < NumSrcBits && "Illegal truncation input type");
@@ -27425,24 +27428,22 @@ unsigned X86TargetLowering::ComputeNumSi
}
case X86ISD::VSHLI: {
- // TODO: Add DemandedElts support.
SDValue Src = Op.getOperand(0);
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);
+ unsigned Tmp = DAG.ComputeNumSignBits(Src, DemandedElts, 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);
APInt ShiftVal = cast<ConstantSDNode>(Op.getOperand(1))->getAPIntValue();
if (ShiftVal.uge(VTBits - 1))
return VTBits; // Sign splat.
- unsigned Tmp = DAG.ComputeNumSignBits(Src, Depth + 1);
+ unsigned Tmp = DAG.ComputeNumSignBits(Src, DemandedElts, Depth + 1);
ShiftVal += Tmp;
return ShiftVal.uge(VTBits) ? VTBits : ShiftVal.getZExtValue();
}
More information about the llvm-commits
mailing list