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