forked from OSchip/llvm-project
[X86] Add *_EXTEND -> *_EXTEND_VECTOR_INREG opcode conversion helper. NFCI.
Given a *_EXTEND or *_EXTEND_VECTOR_INREG opcode, convert it to *_EXTEND_VECTOR_INREG. llvm-svn: 363812
This commit is contained in:
parent
16ff5fea87
commit
d4754cac89
|
@ -5673,6 +5673,22 @@ static SDValue getOnesVector(EVT VT, SelectionDAG &DAG, const SDLoc &dl) {
|
|||
return DAG.getBitcast(VT, Vec);
|
||||
}
|
||||
|
||||
// Convert *_EXTEND to *_EXTEND_VECTOR_INREG opcode.
|
||||
static unsigned getOpcode_EXTEND_VECTOR_INREG(unsigned Opcode) {
|
||||
switch (Opcode) {
|
||||
case ISD::ANY_EXTEND:
|
||||
case ISD::ANY_EXTEND_VECTOR_INREG:
|
||||
return ISD::ANY_EXTEND_VECTOR_INREG;
|
||||
case ISD::ZERO_EXTEND:
|
||||
case ISD::ZERO_EXTEND_VECTOR_INREG:
|
||||
return ISD::ZERO_EXTEND_VECTOR_INREG;
|
||||
case ISD::SIGN_EXTEND:
|
||||
case ISD::SIGN_EXTEND_VECTOR_INREG:
|
||||
return ISD::SIGN_EXTEND_VECTOR_INREG;
|
||||
}
|
||||
llvm_unreachable("Unknown opcode");
|
||||
}
|
||||
|
||||
static SDValue getExtendInVec(bool Signed, const SDLoc &DL, EVT VT, SDValue In,
|
||||
SelectionDAG &DAG) {
|
||||
EVT InVT = In.getValueType();
|
||||
|
@ -41400,8 +41416,7 @@ static SDValue combineToExtendVectorInReg(SDNode *N, SelectionDAG &DAG,
|
|||
(VT.is256BitVector() && Subtarget.hasAVX()) ||
|
||||
(VT.is512BitVector() && Subtarget.useAVX512Regs())) {
|
||||
SDValue ExOp = ExtendVecSize(DL, N0, VT.getSizeInBits());
|
||||
Opcode = Opcode == ISD::SIGN_EXTEND ? ISD::SIGN_EXTEND_VECTOR_INREG
|
||||
: ISD::ZERO_EXTEND_VECTOR_INREG;
|
||||
Opcode = getOpcode_EXTEND_VECTOR_INREG(Opcode);
|
||||
return DAG.getNode(Opcode, DL, VT, ExOp);
|
||||
}
|
||||
|
||||
|
@ -41411,9 +41426,7 @@ static SDValue combineToExtendVectorInReg(SDNode *N, SelectionDAG &DAG,
|
|||
EVT SubVT = EVT::getVectorVT(*DAG.getContext(), SVT, NumSubElts);
|
||||
EVT InSubVT = EVT::getVectorVT(*DAG.getContext(), InSVT, NumSubElts);
|
||||
|
||||
unsigned IROpc = Opcode == ISD::SIGN_EXTEND ? ISD::SIGN_EXTEND_VECTOR_INREG
|
||||
: ISD::ZERO_EXTEND_VECTOR_INREG;
|
||||
|
||||
unsigned IROpc = getOpcode_EXTEND_VECTOR_INREG(Opcode);
|
||||
SmallVector<SDValue, 8> Opnds;
|
||||
for (unsigned i = 0, Offset = 0; i != NumVecs; ++i, Offset += NumSubElts) {
|
||||
SDValue SrcVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, InSubVT, N0,
|
||||
|
@ -43546,12 +43559,7 @@ static SDValue combineExtractSubvector(SDNode *N, SelectionDAG &DAG,
|
|||
InOpcode == ISD::SIGN_EXTEND_VECTOR_INREG) &&
|
||||
VT.is128BitVector() &&
|
||||
InVec.getOperand(0).getSimpleValueType().is128BitVector()) {
|
||||
unsigned ExtOp = InOpcode;
|
||||
switch (InOpcode) {
|
||||
case ISD::ANY_EXTEND: ExtOp = ISD::ANY_EXTEND_VECTOR_INREG; break;
|
||||
case ISD::SIGN_EXTEND: ExtOp = ISD::SIGN_EXTEND_VECTOR_INREG; break;
|
||||
case ISD::ZERO_EXTEND: ExtOp = ISD::ZERO_EXTEND_VECTOR_INREG; break;
|
||||
}
|
||||
unsigned ExtOp = getOpcode_EXTEND_VECTOR_INREG(InOpcode);
|
||||
return DAG.getNode(ExtOp, SDLoc(N), VT, InVec.getOperand(0));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue