llvm.org GIT mirror llvm / 3becd09
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 Mon P Wang 10 years ago
1 changed file(s) with 24 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
76777677 if (VT != MVT::v2i64 && VT != MVT::v4i32 && VT != MVT::v8i16)
76787678 return SDValue();
76797679
7680 SDValue ShAmtOp = N->getOperand(1);
7681 if (ShAmtOp.getOpcode() != ISD::BUILD_VECTOR)
7680 SDValue ShAmtOp = N->getOperand(1);
7681 MVT EltVT = VT.getVectorElementType();
7682 SDValue BaseShAmt;
7683 if (ShAmtOp.getOpcode() == ISD::BUILD_VECTOR) {
7684 unsigned NumElts = VT.getVectorNumElements();
7685 unsigned i = 0;
7686 for (; i != NumElts; ++i) {
7687 SDValue Arg = ShAmtOp.getOperand(i);
7688 if (Arg.getOpcode() == ISD::UNDEF) continue;
7689 BaseShAmt = Arg;
7690 break;
7691 }
7692 for (; i != NumElts; ++i) {
7693 SDValue Arg = ShAmtOp.getOperand(i);
7694 if (Arg.getOpcode() == ISD::UNDEF) continue;
7695 if (Arg != BaseShAmt) {
7696 return SDValue();
7697 }
7698 }
7699 } else if (ShAmtOp.getOpcode() == ISD::VECTOR_SHUFFLE &&
7700 isSplatMask(ShAmtOp.getOperand(2).getNode())) {
7701 BaseShAmt = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, EltVT, ShAmtOp,
7702 DAG.getIntPtrConstant(0));
7703 } else
76827704 return SDValue();
76837705
7684 unsigned NumElts = VT.getVectorNumElements();
7685 unsigned i = 0;
7686 SDValue BaseShAmt;
7687 for (; i != NumElts; ++i) {
7688 SDValue Arg = ShAmtOp.getOperand(i);
7689 if (Arg.getOpcode() == ISD::UNDEF) continue;
7690 BaseShAmt = Arg;
7691 break;
7692 }
7693 for (; i != NumElts; ++i) {
7694 SDValue Arg = ShAmtOp.getOperand(i);
7695 if (Arg.getOpcode() == ISD::UNDEF) continue;
7696 if (Arg != BaseShAmt) {
7697 return SDValue();
7698 }
7699 }
7700
7701 MVT EltVT = VT.getVectorElementType();
77027706 if (EltVT.bitsGT(MVT::i32))
77037707 BaseShAmt = DAG.getNode(ISD::TRUNCATE, MVT::i32, BaseShAmt);
77047708 else if (EltVT.bitsLT(MVT::i32))