Skip to content

Commit

Permalink
AMDGPU: Propagate fast math flags in fneg combines
Browse files Browse the repository at this point in the history
Can't for fma/mad since it seems they can't have flags currently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292818 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
arsenm committed Jan 23, 2017
1 parent 46a1e8b commit 8611e02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Target/AMDGPU/AMDGPUISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ SDValue AMDGPUTargetLowering::performFNegCombine(SDNode *N,
else
RHS = RHS.getOperand(0);

SDValue Res = DAG.getNode(ISD::FADD, SL, VT, LHS, RHS);
SDValue Res = DAG.getNode(ISD::FADD, SL, VT, LHS, RHS, N0->getFlags());
if (!N0.hasOneUse())
DAG.ReplaceAllUsesWith(N0, DAG.getNode(ISD::FNEG, SL, VT, Res));
return Res;
Expand All @@ -2891,7 +2891,7 @@ SDValue AMDGPUTargetLowering::performFNegCombine(SDNode *N,
else
RHS = DAG.getNode(ISD::FNEG, SL, VT, RHS);

SDValue Res = DAG.getNode(Opc, SL, VT, LHS, RHS);
SDValue Res = DAG.getNode(Opc, SL, VT, LHS, RHS, N0->getFlags());
if (!N0.hasOneUse())
DAG.ReplaceAllUsesWith(N0, DAG.getNode(ISD::FNEG, SL, VT, Res));
return Res;
Expand Down Expand Up @@ -2941,7 +2941,7 @@ SDValue AMDGPUTargetLowering::performFNegCombine(SDNode *N,
// (fneg (fp_extend x)) -> (fp_extend (fneg x))
// (fneg (rcp x)) -> (rcp (fneg x))
SDValue Neg = DAG.getNode(ISD::FNEG, SL, CvtSrc.getValueType(), CvtSrc);
return DAG.getNode(Opc, SL, VT, Neg);
return DAG.getNode(Opc, SL, VT, Neg, N0->getFlags());
}
case ISD::FP_ROUND: {
SDValue CvtSrc = N0.getOperand(0);
Expand Down

0 comments on commit 8611e02

Please sign in to comment.