OLD | NEW |
1 //===-- NVPTXISelDAGToDAG.cpp - A dag to dag inst selector for NVPTX ------===// | 1 //===-- NVPTXISelDAGToDAG.cpp - A dag to dag inst selector for NVPTX ------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines an instruction selector for the NVPTX target. | 10 // This file defines an instruction selector for the NVPTX target. |
(...skipping 24 matching lines...) Expand all Loading... |
35 cl::desc("NVPTX Specific: FMA contraction (0: don't do it" | 35 cl::desc("NVPTX Specific: FMA contraction (0: don't do it" |
36 " 1: do it 2: do it aggressively"), | 36 " 1: do it 2: do it aggressively"), |
37 cl::init(2)); | 37 cl::init(2)); |
38 | 38 |
39 static cl::opt<int> UsePrecDivF32( | 39 static cl::opt<int> UsePrecDivF32( |
40 "nvptx-prec-divf32", cl::ZeroOrMore, | 40 "nvptx-prec-divf32", cl::ZeroOrMore, |
41 cl::desc("NVPTX Specifies: 0 use div.approx, 1 use div.full, 2 use" | 41 cl::desc("NVPTX Specifies: 0 use div.approx, 1 use div.full, 2 use" |
42 " IEEE Compliant F32 div.rnd if avaiable."), | 42 " IEEE Compliant F32 div.rnd if avaiable."), |
43 cl::init(2)); | 43 cl::init(2)); |
44 | 44 |
45 static cl::opt<bool> | |
46 UsePrecSqrtF32("nvptx-prec-sqrtf32", | |
47 cl::desc("NVPTX Specific: 0 use sqrt.approx, 1 use sqrt.rn."), | |
48 cl::init(true)); | |
49 | |
50 /// createNVPTXISelDag - This pass converts a legalized DAG into a | 45 /// createNVPTXISelDag - This pass converts a legalized DAG into a |
51 /// NVPTX-specific DAG, ready for instruction scheduling. | 46 /// NVPTX-specific DAG, ready for instruction scheduling. |
52 FunctionPass *llvm::createNVPTXISelDag(NVPTXTargetMachine &TM, | 47 FunctionPass *llvm::createNVPTXISelDag(NVPTXTargetMachine &TM, |
53 llvm::CodeGenOpt::Level OptLevel) { | 48 llvm::CodeGenOpt::Level OptLevel) { |
54 return new NVPTXDAGToDAGISel(TM, OptLevel); | 49 return new NVPTXDAGToDAGISel(TM, OptLevel); |
55 } | 50 } |
56 | 51 |
57 NVPTXDAGToDAGISel::NVPTXDAGToDAGISel(NVPTXTargetMachine &tm, | 52 NVPTXDAGToDAGISel::NVPTXDAGToDAGISel(NVPTXTargetMachine &tm, |
58 CodeGenOpt::Level OptLevel) | 53 CodeGenOpt::Level OptLevel) |
59 : SelectionDAGISel(tm, OptLevel), | 54 : SelectionDAGISel(tm, OptLevel), |
(...skipping 12 matching lines...) Expand all Loading... |
72 (OptLevel > 0) && Subtarget.hasFMAF64() && (FMAContractLevel == 2); | 67 (OptLevel > 0) && Subtarget.hasFMAF64() && (FMAContractLevel == 2); |
73 | 68 |
74 allowFMA = (FMAContractLevel >= 1) || UseFMADInstruction; | 69 allowFMA = (FMAContractLevel >= 1) || UseFMADInstruction; |
75 | 70 |
76 UseF32FTZ = false; | 71 UseF32FTZ = false; |
77 | 72 |
78 doMulWide = (OptLevel > 0); | 73 doMulWide = (OptLevel > 0); |
79 | 74 |
80 // Decide how to translate f32 div | 75 // Decide how to translate f32 div |
81 do_DIVF32_PREC = UsePrecDivF32; | 76 do_DIVF32_PREC = UsePrecDivF32; |
82 // Decide how to translate f32 sqrt | |
83 do_SQRTF32_PREC = UsePrecSqrtF32; | |
84 // sm less than sm_20 does not support div.rnd. Use div.full. | 77 // sm less than sm_20 does not support div.rnd. Use div.full. |
85 if (do_DIVF32_PREC == 2 && !Subtarget.reqPTX20()) | 78 if (do_DIVF32_PREC == 2 && !Subtarget.reqPTX20()) |
86 do_DIVF32_PREC = 1; | 79 do_DIVF32_PREC = 1; |
87 | 80 |
88 } | 81 } |
89 | 82 |
90 /// Select - Select instructions not customized! Used for | 83 /// Select - Select instructions not customized! Used for |
91 /// expanded, promoted and normal instructions. | 84 /// expanded, promoted and normal instructions. |
92 SDNode *NVPTXDAGToDAGISel::Select(SDNode *N) { | 85 SDNode *NVPTXDAGToDAGISel::Select(SDNode *N) { |
93 | 86 |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 | 1724 |
1732 if (N.getOpcode() == ISD::UNDEF) | 1725 if (N.getOpcode() == ISD::UNDEF) |
1733 Retval = CurDAG->getTargetConstant(0, MVT::i8); | 1726 Retval = CurDAG->getTargetConstant(0, MVT::i8); |
1734 else { | 1727 else { |
1735 ConstantSDNode *cn = cast<ConstantSDNode>(N.getNode()); | 1728 ConstantSDNode *cn = cast<ConstantSDNode>(N.getNode()); |
1736 unsigned retval = cn->getZExtValue(); | 1729 unsigned retval = cn->getZExtValue(); |
1737 Retval = CurDAG->getTargetConstant(retval, MVT::i8); | 1730 Retval = CurDAG->getTargetConstant(retval, MVT::i8); |
1738 } | 1731 } |
1739 return true; | 1732 return true; |
1740 } | 1733 } |
OLD | NEW |