SDValue Bop0 = BinOp.getOperand(0), Bop1 = BinOp.getOperand(1);
SDValue Index = Extract->getOperand(1);
EVT SubVT = Extract->getValueType(0);
+ if (!TLI.isOperationLegalOrCustom(BinOpcode, SubVT))
+ return SDValue();
+
SDValue Sub0 = getSubVectorSrc(Bop0, Index, SubVT);
SDValue Sub1 = getSubVectorSrc(Bop1, Index, SubVT);
// TODO: We could handle the case where only 1 operand is being inserted by
// creating an extract of the other operand, but that requires checking
// number of uses and/or costs.
- if (!Sub0 || !Sub1 || !TLI.isOperationLegalOrCustom(BinOpcode, SubVT))
+ if (!Sub0 || !Sub1)
return SDValue();
// We are inserting both operands of the wide binop only to extract back