Move scalar immediate shift lowering into a dedicated func

- no functionality change

llvm-svn: 177476
This commit is contained in:
Michael Liao 2013-03-20 02:20:36 +00:00
parent 6f15b290b5
commit 48e8a3727c
1 changed files with 20 additions and 5 deletions

View File

@ -11491,16 +11491,13 @@ SDValue X86TargetLowering::LowerSDIV(SDValue Op, SelectionDAG &DAG) const {
return SDValue();
}
SDValue X86TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) const {
static SDValue LowerScalarImmediateShift(SDValue Op, SelectionDAG &DAG,
const X86Subtarget *Subtarget) {
EVT VT = Op.getValueType();
DebugLoc dl = Op.getDebugLoc();
SDValue R = Op.getOperand(0);
SDValue Amt = Op.getOperand(1);
if (!Subtarget->hasSSE2())
return SDValue();
// Optimize shl/srl/sra with constant shift amount.
if (isSplatVector(Amt.getNode())) {
SDValue SclrAmt = Amt->getOperand(0);
@ -11611,6 +11608,24 @@ SDValue X86TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) const {
}
}
return SDValue();
}
SDValue X86TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) const {
EVT VT = Op.getValueType();
DebugLoc dl = Op.getDebugLoc();
SDValue R = Op.getOperand(0);
SDValue Amt = Op.getOperand(1);
SDValue V;
if (!Subtarget->hasSSE2())
return SDValue();
V = LowerScalarImmediateShift(Op, DAG, Subtarget);
if (V.getNode())
return V;
// Lower SHL with variable shift amount.
if (VT == MVT::v4i32 && Op->getOpcode() == ISD::SHL) {
Op = DAG.getNode(ISD::SHL, dl, VT, Amt, DAG.getConstant(23, VT));