@@ -125,27 +125,18 @@ NVPTXTargetLowering::getDivF32Level(const MachineFunction &MF,
125
125
if (UsePrecDivF32.getNumOccurrences () > 0 )
126
126
return UsePrecDivF32;
127
127
128
- // Otherwise, use div.approx if fast math is enabled
129
- if (allowUnsafeFPMath (MF))
130
- return NVPTX::DivPrecisionLevel::Approx;
131
-
132
128
const SDNodeFlags Flags = N.getFlags ();
133
129
if (Flags.hasApproximateFuncs ())
134
130
return NVPTX::DivPrecisionLevel::Approx;
135
131
136
132
return NVPTX::DivPrecisionLevel::IEEE754;
137
133
}
138
134
139
- bool NVPTXTargetLowering::usePrecSqrtF32 (const MachineFunction &MF,
140
- const SDNode *N) const {
135
+ bool NVPTXTargetLowering::usePrecSqrtF32 (const SDNode *N) const {
141
136
// If nvptx-prec-sqrtf32 is used on the command-line, always honor it
142
137
if (UsePrecSqrtF32.getNumOccurrences () > 0 )
143
138
return UsePrecSqrtF32;
144
139
145
- // Otherwise, use sqrt.approx if fast math is enabled
146
- if (allowUnsafeFPMath (MF))
147
- return false ;
148
-
149
140
if (N) {
150
141
const SDNodeFlags Flags = N->getFlags ();
151
142
if (Flags.hasApproximateFuncs ())
@@ -1193,8 +1184,7 @@ SDValue NVPTXTargetLowering::getSqrtEstimate(SDValue Operand, SelectionDAG &DAG,
1193
1184
bool &UseOneConst,
1194
1185
bool Reciprocal) const {
1195
1186
if (!(Enabled == ReciprocalEstimate::Enabled ||
1196
- (Enabled == ReciprocalEstimate::Unspecified &&
1197
- !usePrecSqrtF32 (DAG.getMachineFunction ()))))
1187
+ (Enabled == ReciprocalEstimate::Unspecified && !usePrecSqrtF32 ())))
1198
1188
return SDValue ();
1199
1189
1200
1190
if (ExtraSteps == ReciprocalEstimate::Unspecified)
@@ -2851,8 +2841,7 @@ static SDValue lowerROT(SDValue Op, SelectionDAG &DAG) {
2851
2841
SDLoc (Op), Opcode, DAG);
2852
2842
}
2853
2843
2854
- static SDValue lowerFREM (SDValue Op, SelectionDAG &DAG,
2855
- bool AllowUnsafeFPMath) {
2844
+ static SDValue lowerFREM (SDValue Op, SelectionDAG &DAG) {
2856
2845
// Lower (frem x, y) into (sub x, (mul (ftrunc (div x, y)) y)),
2857
2846
// i.e. "poor man's fmod()". When y is infinite, x is returned. This matches
2858
2847
// the semantics of LLVM's frem.
@@ -2869,7 +2858,7 @@ static SDValue lowerFREM(SDValue Op, SelectionDAG &DAG,
2869
2858
SDValue Sub = DAG.getNode (ISD::FSUB, DL, Ty, X, Mul,
2870
2859
Flags | SDNodeFlags::AllowContract);
2871
2860
2872
- if (AllowUnsafeFPMath || Flags.hasNoInfs ())
2861
+ if (Flags.hasNoInfs ())
2873
2862
return Sub;
2874
2863
2875
2864
// If Y is infinite, return X
@@ -3014,7 +3003,7 @@ NVPTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
3014
3003
case ISD::CTLZ:
3015
3004
return lowerCTLZCTPOP (Op, DAG);
3016
3005
case ISD::FREM:
3017
- return lowerFREM (Op, DAG, allowUnsafeFPMath (DAG. getMachineFunction ()) );
3006
+ return lowerFREM (Op, DAG);
3018
3007
3019
3008
default :
3020
3009
llvm_unreachable (" Custom lowering not defined for operation" );
@@ -4868,17 +4857,7 @@ bool NVPTXTargetLowering::allowFMA(MachineFunction &MF,
4868
4857
if (MF.getTarget ().Options .AllowFPOpFusion == FPOpFusion::Fast)
4869
4858
return true ;
4870
4859
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 ;
4882
4861
}
4883
4862
4884
4863
static bool isConstZero (const SDValue &Operand) {
0 commit comments