[X86][SSE] Simplify zero'th index extract element matching

llvm-svn: 269615
This commit is contained in:
Simon Pilgrim 2016-05-15 20:22:50 +00:00
parent fbe97bc15a
commit 2d4bf1042b
1 changed files with 3 additions and 2 deletions

View File

@ -12235,10 +12235,11 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
MVT VT = Op.getSimpleValueType();
// TODO: handle v16i8.
if (VT.getSizeInBits() == 16) {
if (isNullConstant(Idx))
if (IdxVal == 0)
return DAG.getNode(ISD::TRUNCATE, dl, MVT::i16,
DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i32,
DAG.getBitcast(MVT::v4i32, Vec), Idx));
// Transform it so it match pextrw which produces a 32-bit result.
MVT EltVT = MVT::i32;
SDValue Extract = DAG.getNode(X86ISD::PEXTRW, dl, EltVT, Vec, Idx);
@ -12262,7 +12263,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op,
// FIXME: .td only matches this for <2 x f64>, not <2 x i64> on 32b
// FIXME: seems like this should be unnecessary if mov{h,l}pd were taught
// to match extract_elt for f64.
if (isNullConstant(Idx))
if (IdxVal == 0)
return Op;
// UNPCKHPD the element to the lowest double word, then movsd.