@@ -9070,60 +9070,6 @@ SDValue TargetLowering::expandIS_FPCLASS(EVT ResultVT, SDValue Op,
90709070 return Res;
90719071}
90729072
9073- SDValue TargetLowering::expandFADD (SDNode *Node, SelectionDAG &DAG) const {
9074- auto VT = Node->getValueType (0 );
9075- if (!isOperationLegalOrCustom (ISD::FMA, VT)) {
9076- return {};
9077- }
9078-
9079- // FADD(a, b) -> FMA(a, 1.0, b)
9080- SDLoc DL (Node);
9081- auto One = DAG.getConstantFP (1.0 , DL, VT);
9082- SmallVector<SDValue, 3 > Operands{Node->getOperand (0 ), One,
9083- Node->getOperand (1 )};
9084- return DAG.getNode (ISD::FMA, DL, VT, Operands, Node->getFlags ());
9085- }
9086-
9087- SDValue TargetLowering::expandFMUL (SDNode *Node, SelectionDAG &DAG) const {
9088- auto VT = Node->getValueType (0 );
9089- if (!isOperationLegalOrCustom (ISD::FMA, VT)) {
9090- return {};
9091- }
9092-
9093- // FMUL(a, b) -> FMA(a, b, -0.0)
9094- // NOTE: The identity is -0, not 0, because -0 + 0 == 0 for floats
9095- SDLoc DL (Node);
9096- auto NegZero = DAG.getConstantFP (-0.0 , DL, VT);
9097- SmallVector<SDValue, 3 > Operands{Node->getOperand (0 ), Node->getOperand (1 ),
9098- NegZero};
9099- return DAG.getNode (ISD::FMA, DL, VT, Operands, Node->getFlags ());
9100- }
9101-
9102- SDValue TargetLowering::expandFSUB (SDNode *Node, SelectionDAG &DAG) const {
9103- SDLoc DL (Node);
9104- SDNodeFlags SDFlags = Node->getFlags ();
9105- auto VT = Node->getValueType (0 );
9106-
9107- bool CanUseFMA = isOperationLegalOrCustom (ISD::FMA, VT);
9108- bool CanUseAddSub = (isOperationLegalOrCustom (ISD::FADD, VT) &&
9109- isOperationLegalOrCustom (ISD::FNEG, VT));
9110- bool PreferAddSub = CanUseAddSub && isFNegFree (VT);
9111-
9112- // FSUB(a, b) -> FMA(b, -1.0, a)
9113- if (CanUseFMA && !PreferAddSub) {
9114- auto NegOne = DAG.getConstantFP (-1.0 , DL, VT);
9115- SmallVector<SDValue, 3 > Operands{Node->getOperand (1 ), NegOne,
9116- Node->getOperand (0 )};
9117- return DAG.getNode (ISD::FMA, DL, VT, Operands, SDFlags);
9118- }
9119- // FSUB(a, b) -> FADD(a, FNEG(b))
9120- if (CanUseAddSub) {
9121- auto Neg = DAG.getNode (ISD::FNEG, DL, VT, Node->getOperand (1 ));
9122- return DAG.getNode (ISD::FADD, DL, VT, Node->getOperand (0 ), Neg, SDFlags);
9123- }
9124- return {};
9125- }
9126-
91279073// Only expand vector types if we have the appropriate vector bit operations.
91289074static bool canExpandVectorCTPOP (const TargetLowering &TLI, EVT VT) {
91299075 assert (VT.isVector () && " Expected vector type" );
0 commit comments