@@ -26,22 +26,6 @@ using namespace llvm;
26
26
27
27
#define DEBUG_TYPE " nvptx-isel"
28
28
29
- static cl::opt<int > UsePrecDivF32 (
30
- " nvptx-prec-divf32" , cl::ZeroOrMore, cl::Hidden,
31
- cl::desc (" NVPTX Specifies: 0 use div.approx, 1 use div.full, 2 use"
32
- " IEEE Compliant F32 div.rnd if available." ),
33
- cl::init(2 ));
34
-
35
- static cl::opt<bool >
36
- UsePrecSqrtF32 (" nvptx-prec-sqrtf32" , cl::Hidden,
37
- cl::desc (" NVPTX Specific: 0 use sqrt.approx, 1 use sqrt.rn." ),
38
- cl::init(true ));
39
-
40
- static cl::opt<bool >
41
- FtzEnabled (" nvptx-f32ftz" , cl::ZeroOrMore, cl::Hidden,
42
- cl::desc (" NVPTX Specific: Flush f32 subnormals to sign-preserving zero." ),
43
- cl::init(false ));
44
-
45
29
// / createNVPTXISelDag - This pass converts a legalized DAG into a
46
30
// / NVPTX-specific DAG, ready for instruction scheduling.
47
31
FunctionPass *llvm::createNVPTXISelDag (NVPTXTargetMachine &TM,
@@ -56,45 +40,20 @@ NVPTXDAGToDAGISel::NVPTXDAGToDAGISel(NVPTXTargetMachine &tm,
56
40
}
57
41
58
42
bool NVPTXDAGToDAGISel::runOnMachineFunction (MachineFunction &MF) {
59
- Subtarget = &static_cast <const NVPTXSubtarget &>(MF.getSubtarget ());
60
- return SelectionDAGISel::runOnMachineFunction (MF);
43
+ Subtarget = &static_cast <const NVPTXSubtarget &>(MF.getSubtarget ());
44
+ return SelectionDAGISel::runOnMachineFunction (MF);
61
45
}
62
46
63
47
int NVPTXDAGToDAGISel::getDivF32Level () const {
64
- if (UsePrecDivF32.getNumOccurrences () > 0 ) {
65
- // If nvptx-prec-div32=N is used on the command-line, always honor it
66
- return UsePrecDivF32;
67
- } else {
68
- // Otherwise, use div.approx if fast math is enabled
69
- if (TM.Options .UnsafeFPMath )
70
- return 0 ;
71
- else
72
- return 2 ;
73
- }
48
+ return Subtarget->getTargetLowering ()->getDivF32Level ();
74
49
}
75
50
76
51
bool NVPTXDAGToDAGISel::usePrecSqrtF32 () const {
77
- if (UsePrecSqrtF32.getNumOccurrences () > 0 ) {
78
- // If nvptx-prec-sqrtf32 is used on the command-line, always honor it
79
- return UsePrecSqrtF32;
80
- } else {
81
- // Otherwise, use sqrt.approx if fast math is enabled
82
- return !TM.Options .UnsafeFPMath ;
83
- }
52
+ return Subtarget->getTargetLowering ()->usePrecSqrtF32 ();
84
53
}
85
54
86
55
bool NVPTXDAGToDAGISel::useF32FTZ () const {
87
- if (FtzEnabled.getNumOccurrences () > 0 ) {
88
- // If nvptx-f32ftz is used on the command-line, always honor it
89
- return FtzEnabled;
90
- } else {
91
- const Function *F = MF->getFunction ();
92
- // Otherwise, check for an nvptx-f32ftz attribute on the function
93
- if (F->hasFnAttribute (" nvptx-f32ftz" ))
94
- return F->getFnAttribute (" nvptx-f32ftz" ).getValueAsString () == " true" ;
95
- else
96
- return false ;
97
- }
56
+ return Subtarget->getTargetLowering ()->useF32FTZ (*MF);
98
57
}
99
58
100
59
bool NVPTXDAGToDAGISel::allowFMA () const {
0 commit comments