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 &FS, bool is64Bit);
79 // Target architecture accessors
80 std::string getTargetString() const;
82 std::string getPTXVersionString() const;
84 bool supportsDouble() const { return SupportsDouble; }
86 bool is64Bit() const { return Is64Bit; }
88 bool supportsFMA() const { return SupportsFMA; }
90 bool supportsPTX21() const { return PTXVersion >= PTX_VERSION_2_1; }
92 bool supportsPTX22() const { return PTXVersion >= PTX_VERSION_2_2; }
94 bool supportsPTX23() const { return PTXVersion >= PTX_VERSION_2_3; }
96 bool fdivNeedsRoundingMode() const {
97 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
98 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
101 bool fmadNeedsRoundingMode() const {
102 return (PTXTarget >= PTX_SM_1_3 && PTXTarget < PTX_LAST_SM) ||
103 (PTXTarget >= PTX_COMPUTE_1_3 && PTXTarget < PTX_LAST_COMPUTE);
106 bool useParamSpaceForDeviceArgs() const {
107 return (PTXTarget >= PTX_SM_2_0 && PTXTarget < PTX_LAST_SM) ||
108 (PTXTarget >= PTX_COMPUTE_2_0 && PTXTarget < PTX_LAST_COMPUTE);
111 std::string ParseSubtargetFeatures(const std::string &FS,
112 const std::string &CPU);
113 }; // class PTXSubtarget
116 #endif // PTX_SUBTARGET_H