1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

No need to normalize index before calling Extract128BitVector

llvm-svn: 155811
This commit is contained in:
Craig Topper 2012-04-30 05:17:10 +00:00
parent 584ad8ab86
commit 78a563fd27

View File

@ -4330,9 +4330,8 @@ static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG) {
// Extract the 128-bit part containing the splat element and update
// the splat element index when it refers to the higher register.
if (Size == 256) {
unsigned Idx = (EltNo >= NumElems/2) ? NumElems/2 : 0;
V1 = Extract128BitVector(V1, Idx, DAG, dl);
if (Idx > 0)
V1 = Extract128BitVector(V1, EltNo, DAG, dl);
if (EltNo >= NumElems/2)
EltNo -= NumElems/2;
}
@ -6760,11 +6759,12 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
unsigned IdxVal = cast<ConstantSDNode>(Idx)->getZExtValue();
// Get the 128-bit vector.
bool Upper = IdxVal >= NumElems/2;
Vec = Extract128BitVector(Vec, Upper ? NumElems/2 : 0, DAG, dl);
Vec = Extract128BitVector(Vec, IdxVal, DAG, dl);
if (IdxVal >= NumElems/2)
IdxVal -= NumElems/2;
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, Op.getValueType(), Vec,
Upper ? DAG.getConstant(IdxVal-NumElems/2, MVT::i32) : Idx);
DAG.getConstant(IdxVal, MVT::i32));
}
assert(Vec.getValueSizeInBits() <= 128 && "Unexpected vector length");
@ -6906,16 +6906,15 @@ X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const {
// Get the desired 128-bit vector half.
unsigned NumElems = VT.getVectorNumElements();
unsigned IdxVal = cast<ConstantSDNode>(N2)->getZExtValue();
bool Upper = IdxVal >= NumElems/2;
unsigned Ins128Idx = Upper ? NumElems/2 : 0;
SDValue V = Extract128BitVector(N0, Ins128Idx, DAG, dl);
SDValue V = Extract128BitVector(N0, IdxVal, DAG, dl);
// Insert the element into the desired half.
V = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, V.getValueType(), V,
N1, Upper ? DAG.getConstant(IdxVal-NumElems/2, MVT::i32) : N2);
bool Upper = IdxVal >= NumElems/2;
V = DAG.getNode(ISD::INSERT_VECTOR_ELT, dl, V.getValueType(), V, N1,
DAG.getConstant(Upper ? IdxVal-NumElems/2 : IdxVal, MVT::i32));
// Insert the changed part back to the 256-bit vector
return Insert128BitVector(N0, V, Ins128Idx, DAG, dl);
return Insert128BitVector(N0, V, IdxVal, DAG, dl);
}
if (Subtarget->hasSSE41())