1 //====-- PTXSubtarget.h - Define Subtarget for the PTX ---------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the PTX specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef PTX_SUBTARGET_H
15 #define PTX_SUBTARGET_H
17 #include "llvm/Target/TargetSubtarget.h"
20 class PTXSubtarget : public TargetSubtarget {
24 * Enumeration of Shader Models supported by the back-end.
27 PTX_COMPUTE_1_0, /*< Compute Compatibility 1.0 */
28 PTX_COMPUTE_1_1, /*< Compute Compatibility 1.1 */
29 PTX_COMPUTE_1_2, /*< Compute Compatibility 1.2 */
30 PTX_COMPUTE_1_3, /*< Compute Compatibility 1.3 */
31 PTX_COMPUTE_2_0, /*< Compute Compatibility 2.0 */
34 PTX_SM_1_0, /*< Shader Model 1.0 */
35 PTX_SM_1_1, /*< Shader Model 1.1 */
36 PTX_SM_1_2, /*< Shader Model 1.2 */
37 PTX_SM_1_3, /*< Shader Model 1.3 */
38 PTX_SM_2_0, /*< Shader Model 2.0 */
39 PTX_SM_2_1, /*< Shader Model 2.1 */
40 PTX_SM_2_2, /*< Shader Model 2.2 */
41 PTX_SM_2_3, /*< Shader Model 2.3 */
46 * Enumeration of PTX versions supported by the back-end.
48 * Currently, PTX 2.0 is the minimum supported version.
51 PTX_VERSION_2_0, /*< PTX Version 2.0 */
52 PTX_VERSION_2_1, /*< PTX Version 2.1 */
53 PTX_VERSION_2_2, /*< PTX Version 2.2 */
54 PTX_VERSION_2_3 /*< PTX Version 2.3 */
59 /// Shader Model supported on the target GPU.
60 PTXTargetEnum PTXTarget;
62 /// PTX Language Version.
63 PTXVersionEnum PTXVersion;
65 // The native .f64 type is supported on the hardware.
68 // Support the fused-multiply add (FMA) and multiply-add (MAD)
72 // Use .u64 instead of .u32 for addresses.
77 PTXSubtarget(const std::string &TT, const std::string &CPU,
78 const std::string &FS, bool is64Bit);
80 // Target architecture accessors
81 std::string getTargetString() const;
83 std::string getPTXVersionString() const;
85 bool supportsDouble() const { return SupportsDouble; }
87 bool is64Bit() const { return Is64Bit; }
89 bool supportsFMA() const { return SupportsFMA; }
91 bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
93 bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
95 bool supportsPTX23() const { return PTXVersion >= PTX_VERSION_2_3; }
97 bool fdivNeedsRoundingMode() const {
98 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
99 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
102 bool fmadNeedsRoundingMode() const {
103 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
104 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
107 bool useParamSpaceForDeviceArgs() const {
108 return (PTXTarget >= PTX_SM_2_0 && PTXTarget < PTX_LAST_SM) ||
109 (PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
112 void ParseSubtargetFeatures(const std::string &FS,
113 const std::string &CPU);
114 }; // class PTXSubtarget
117 #endif // PTX_SUBTARGET_H