diff options
author | Mon P Wang <wangmp@apple.com> | 2009-01-28 08:12:05 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2009-01-28 08:12:05 +0000 |
commit | 3becd093cc308578ca979edbbab0f76d98cef4ec (patch) | |
tree | af75a5a50039295b86144dc2a9d773cb8ec1b91b | |
parent | 57cd67f693d3a0646291692b3e0b9ccd4b40b00e (diff) | |
download | external_llvm-3becd093cc308578ca979edbbab0f76d98cef4ec.zip external_llvm-3becd093cc308578ca979edbbab0f76d98cef4ec.tar.gz external_llvm-3becd093cc308578ca979edbbab0f76d98cef4ec.tar.bz2 |
Add shuffle splat pattern for x86 sse shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63193 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 406b237..f48d752 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -7678,28 +7678,32 @@ static SDValue PerformShiftCombine(SDNode* N, SelectionDAG &DAG, if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16) return SDValue(); - SDValue ShAmtOp = N->getOperand(1); - if (ShAmtOp.getOpcode() != ISD::BUILD_VECTOR) - return SDValue(); - - unsigned NumElts = VT.getVectorNumElements(); - unsigned i = 0; + SDValue ShAmtOp = N->getOperand(1); + MVT EltVT = VT.getVectorElementType(); SDValue BaseShAmt; - for (; i != NumElts; ++i) { - SDValue Arg = ShAmtOp.getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - BaseShAmt = Arg; - break; - } - for (; i != NumElts; ++i) { - SDValue Arg = ShAmtOp.getOperand(i); - if (Arg.getOpcode() == ISD::UNDEF) continue; - if (Arg != BaseShAmt) { - return SDValue(); + if (ShAmtOp.getOpcode() == ISD::BUILD_VECTOR) { + unsigned NumElts = VT.getVectorNumElements(); + unsigned i = 0; + for (; i != NumElts; ++i) { + SDValue Arg = ShAmtOp.getOperand(i); + if (Arg.getOpcode() == ISD::UNDEF) continue; + BaseShAmt = Arg; + break; } - } + for (; i != NumElts; ++i) { + SDValue Arg = ShAmtOp.getOperand(i); + if (Arg.getOpcode() == ISD::UNDEF) continue; + if (Arg != BaseShAmt) { + return SDValue(); + } + } + } else if (ShAmtOp.getOpcode() == ISD::VECTOR_SHUFFLE && + isSplatMask(ShAmtOp.getOperand(2).getNode())) { + BaseShAmt = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EltVT, ShAmtOp, + DAG.getIntPtrConstant(0)); + } else + return SDValue(); - MVT EltVT = VT.getVectorElementType(); if (EltVT.bitsGT(MVT::i32)) BaseShAmt = DAG.getNode(ISD::TRUNCATE, MVT::i32, BaseShAmt); else if (EltVT.bitsLT(MVT::i32)) |