@@ -20708,42 +20708,31 @@ static SDValue performFMACombine(SDNode *N,
2070820708 // fma(a, b, neg(c)) -> fnmls(a, b, c)
2070920709 // fma(neg(a), b, neg(c)) -> fnmla(a, b, c)
2071020710 // fma(a, neg(b), neg(c)) -> fnmla(a, b, c)
20711- if (!VT.isVector() || !DAG.getTargetLoweringInfo().isTypeLegal(VT) ||
20711+ if (!VT.isFixedLengthVector() ||
20712+ !DAG.getTargetLoweringInfo().isTypeLegal(VT) ||
2071220713 !Subtarget->isSVEorStreamingSVEAvailable() ||
2071320714 OpC.getOpcode() != ISD::FNEG) {
2071420715 return SDValue();
2071520716 }
2071620717
2071720718 SDValue Pg = getPredicateForVector(DAG, DL, VT);
20718- EVT ContainerVT =
20719- VT.isFixedLengthVector() ? getContainerForFixedLengthVector(DAG, VT) : VT;
20720- OpC = VT.isFixedLengthVector()
20721- ? convertToScalableVector(DAG, ContainerVT, OpC.getOperand(0))
20722- : OpC->getOperand(0);
20723- OpC = DAG.getNode(AArch64ISD::FNEG_MERGE_PASSTHRU, DL, ContainerVT, Pg, OpC,
20724- DAG.getUNDEF(ContainerVT));
20725-
20726- if (OpB.getOpcode() == ISD::FNEG) {
20727- std::swap(OpA, OpB);
20728- }
20729-
20730- if (OpA.getOpcode() == ISD::FNEG) {
20731- OpA = VT.isFixedLengthVector()
20732- ? convertToScalableVector(DAG, ContainerVT, OpA.getOperand(0))
20733- : OpA->getOperand(0);
20734- OpA = DAG.getNode(AArch64ISD::FNEG_MERGE_PASSTHRU, DL, ContainerVT, Pg, OpA,
20735- DAG.getUNDEF(ContainerVT));
20736- } else if (VT.isFixedLengthVector()) {
20737- OpA = convertToScalableVector(DAG, ContainerVT, OpA);
20738- }
20739-
20740- if (VT.isFixedLengthVector()) {
20741- OpB = convertToScalableVector(DAG, ContainerVT, OpB);
20742- SDValue ScalableRes =
20743- DAG.getNode(AArch64ISD::FMA_PRED, DL, ContainerVT, Pg, OpA, OpB, OpC);
20744- return convertFromScalableVector(DAG, VT, ScalableRes);
20745- }
20746- return DAG.getNode(AArch64ISD::FMA_PRED, DL, VT, Pg, OpA, OpB, OpC);
20719+ EVT ContainerVT = getContainerForFixedLengthVector(DAG, VT);
20720+ OpC =
20721+ DAG.getNode(AArch64ISD::FNEG_MERGE_PASSTHRU, DL, ContainerVT, Pg,
20722+ convertToScalableVector(DAG, ContainerVT, OpC.getOperand(0)),
20723+ DAG.getUNDEF(ContainerVT));
20724+
20725+ OpA = OpA.getOpcode() == ISD::FNEG
20726+ ? DAG.getNode(
20727+ AArch64ISD::FNEG_MERGE_PASSTHRU, DL, ContainerVT, Pg,
20728+ convertToScalableVector(DAG, ContainerVT, OpA.getOperand(0)),
20729+ DAG.getUNDEF(ContainerVT))
20730+ : convertToScalableVector(DAG, ContainerVT, OpA);
20731+
20732+ OpB = convertToScalableVector(DAG, ContainerVT, OpB);
20733+ SDValue ScalableRes =
20734+ DAG.getNode(AArch64ISD::FMA_PRED, DL, ContainerVT, Pg, OpA, OpB, OpC);
20735+ return convertFromScalableVector(DAG, VT, ScalableRes);
2074720736}
2074820737
2074920738static bool hasPairwiseAdd(unsigned Opcode, EVT VT, bool FullFP16) {
0 commit comments