@@ -125,27 +125,18 @@ NVPTXTargetLowering::getDivF32Level(const MachineFunction &MF,
125125 if (UsePrecDivF32.getNumOccurrences () > 0 )
126126 return UsePrecDivF32;
127127
128- // Otherwise, use div.approx if fast math is enabled
129- if (allowUnsafeFPMath (MF))
130- return NVPTX::DivPrecisionLevel::Approx;
131-
132128 const SDNodeFlags Flags = N.getFlags ();
133129 if (Flags.hasApproximateFuncs ())
134130 return NVPTX::DivPrecisionLevel::Approx;
135131
136132 return NVPTX::DivPrecisionLevel::IEEE754;
137133}
138134
139- bool NVPTXTargetLowering::usePrecSqrtF32 (const MachineFunction &MF,
140- const SDNode *N) const {
135+ bool NVPTXTargetLowering::usePrecSqrtF32 (const SDNode *N) const {
141136 // If nvptx-prec-sqrtf32 is used on the command-line, always honor it
142137 if (UsePrecSqrtF32.getNumOccurrences () > 0 )
143138 return UsePrecSqrtF32;
144139
145- // Otherwise, use sqrt.approx if fast math is enabled
146- if (allowUnsafeFPMath (MF))
147- return false ;
148-
149140 if (N) {
150141 const SDNodeFlags Flags = N->getFlags ();
151142 if (Flags.hasApproximateFuncs ())
@@ -1193,8 +1184,7 @@ SDValue NVPTXTargetLowering::getSqrtEstimate(SDValue Operand, SelectionDAG &DAG,
11931184 bool &UseOneConst,
11941185 bool Reciprocal) const {
11951186 if (!(Enabled == ReciprocalEstimate::Enabled ||
1196- (Enabled == ReciprocalEstimate::Unspecified &&
1197- !usePrecSqrtF32 (DAG.getMachineFunction ()))))
1187+ (Enabled == ReciprocalEstimate::Unspecified && !usePrecSqrtF32 ())))
11981188 return SDValue ();
11991189
12001190 if (ExtraSteps == ReciprocalEstimate::Unspecified)
@@ -2851,8 +2841,7 @@ static SDValue lowerROT(SDValue Op, SelectionDAG &DAG) {
28512841 SDLoc (Op), Opcode, DAG);
28522842}
28532843
2854- static SDValue lowerFREM (SDValue Op, SelectionDAG &DAG,
2855- bool AllowUnsafeFPMath) {
2844+ static SDValue lowerFREM (SDValue Op, SelectionDAG &DAG) {
28562845 // Lower (frem x, y) into (sub x, (mul (ftrunc (div x, y)) y)),
28572846 // i.e. "poor man's fmod()". When y is infinite, x is returned. This matches
28582847 // the semantics of LLVM's frem.
@@ -2869,7 +2858,7 @@ static SDValue lowerFREM(SDValue Op, SelectionDAG &DAG,
28692858 SDValue Sub = DAG.getNode (ISD::FSUB, DL, Ty, X, Mul,
28702859 Flags | SDNodeFlags::AllowContract);
28712860
2872- if (AllowUnsafeFPMath || Flags.hasNoInfs ())
2861+ if (Flags.hasNoInfs ())
28732862 return Sub;
28742863
28752864 // If Y is infinite, return X
@@ -3014,7 +3003,7 @@ NVPTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
30143003 case ISD::CTLZ:
30153004 return lowerCTLZCTPOP (Op, DAG);
30163005 case ISD::FREM:
3017- return lowerFREM (Op, DAG, allowUnsafeFPMath (DAG. getMachineFunction ()) );
3006+ return lowerFREM (Op, DAG);
30183007
30193008 default :
30203009 llvm_unreachable (" Custom lowering not defined for operation" );
@@ -4868,17 +4857,7 @@ bool NVPTXTargetLowering::allowFMA(MachineFunction &MF,
48684857 if (MF.getTarget ().Options .AllowFPOpFusion == FPOpFusion::Fast)
48694858 return true ;
48704859
4871- return allowUnsafeFPMath (MF);
4872- }
4873-
4874- bool NVPTXTargetLowering::allowUnsafeFPMath (const MachineFunction &MF) const {
4875- // Honor TargetOptions flags that explicitly say unsafe math is okay.
4876- if (MF.getTarget ().Options .UnsafeFPMath )
4877- return true ;
4878-
4879- // Allow unsafe math if unsafe-fp-math attribute explicitly says so.
4880- const Function &F = MF.getFunction ();
4881- return F.getFnAttribute (" unsafe-fp-math" ).getValueAsBool ();
4860+ return false ;
48824861}
48834862
48844863static bool isConstZero (const SDValue &Operand) {
0 commit comments