1 //===- PTX.td - Describe the PTX Target Machine ---------------*- tblgen -*-==//
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 //===----------------------------------------------------------------------===//
9 // This is the top level entry point for the PTX target.
10 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
13 // Target-independent interfaces
14 //===----------------------------------------------------------------------===//
16 include "llvm/Target/Target.td"
18 //===----------------------------------------------------------------------===//
20 //===----------------------------------------------------------------------===//
22 //===- Architectural Features ---------------------------------------------===//
24 def FeatureDouble : SubtargetFeature<"double", "SupportsDouble", "true",
25 "Do not demote .f64 to .f32">;
27 def FeatureNoFMA : SubtargetFeature<"no-fma","SupportsFMA", "false",
28 "Disable Fused-Multiply Add">;
30 //===- PTX Version --------------------------------------------------------===//
32 def FeaturePTX20 : SubtargetFeature<"ptx20", "PTXVersion", "PTX_VERSION_2_0",
33 "Use PTX Language Version 2.0">;
35 def FeaturePTX21 : SubtargetFeature<"ptx21", "PTXVersion", "PTX_VERSION_2_1",
36 "Use PTX Language Version 2.1">;
38 def FeaturePTX22 : SubtargetFeature<"ptx22", "PTXVersion", "PTX_VERSION_2_2",
39 "Use PTX Language Version 2.2">;
41 def FeaturePTX23 : SubtargetFeature<"ptx23", "PTXVersion", "PTX_VERSION_2_3",
42 "Use PTX Language Version 2.3">;
44 //===- PTX Target ---------------------------------------------------------===//
46 def FeatureSM10 : SubtargetFeature<"sm10", "PTXTarget", "PTX_SM_1_0",
47 "Use Shader Model 1.0">;
48 def FeatureSM11 : SubtargetFeature<"sm11", "PTXTarget", "PTX_SM_1_1",
49 "Use Shader Model 1.1">;
50 def FeatureSM12 : SubtargetFeature<"sm12", "PTXTarget", "PTX_SM_1_2",
51 "Use Shader Model 1.2">;
52 def FeatureSM13 : SubtargetFeature<"sm13", "PTXTarget", "PTX_SM_1_3",
53 "Use Shader Model 1.3">;
54 def FeatureSM20 : SubtargetFeature<"sm20", "PTXTarget", "PTX_SM_2_0",
55 "Use Shader Model 2.0", [FeatureDouble]>;
56 def FeatureSM21 : SubtargetFeature<"sm21", "PTXTarget", "PTX_SM_2_1",
57 "Use Shader Model 2.1", [FeatureDouble]>;
58 def FeatureSM22 : SubtargetFeature<"sm22", "PTXTarget", "PTX_SM_2_2",
59 "Use Shader Model 2.2", [FeatureDouble]>;
60 def FeatureSM23 : SubtargetFeature<"sm23", "PTXTarget", "PTX_SM_2_3",
61 "Use Shader Model 2.3", [FeatureDouble]>;
63 def FeatureCOMPUTE10 : SubtargetFeature<"compute10", "PTXTarget",
65 "Use Compute Compatibility 1.0">;
66 def FeatureCOMPUTE11 : SubtargetFeature<"compute11", "PTXTarget",
68 "Use Compute Compatibility 1.1">;
69 def FeatureCOMPUTE12 : SubtargetFeature<"compute12", "PTXTarget",
71 "Use Compute Compatibility 1.2">;
72 def FeatureCOMPUTE13 : SubtargetFeature<"compute13", "PTXTarget",
74 "Use Compute Compatibility 1.3">;
75 def FeatureCOMPUTE20 : SubtargetFeature<"compute20", "PTXTarget",
77 "Use Compute Compatibility 2.0",
80 //===----------------------------------------------------------------------===//
81 // PTX supported processors
82 //===----------------------------------------------------------------------===//
84 class Proc<string Name, list<SubtargetFeature> Features>
85 : Processor<Name, NoItineraries, Features>;
87 def : Proc<"generic", []>;
89 // Processor definitions for compute/shader models
90 def : Proc<"compute_10", [FeatureCOMPUTE10]>;
91 def : Proc<"compute_11", [FeatureCOMPUTE11]>;
92 def : Proc<"compute_12", [FeatureCOMPUTE12]>;
93 def : Proc<"compute_13", [FeatureCOMPUTE13]>;
94 def : Proc<"compute_20", [FeatureCOMPUTE20]>;
95 def : Proc<"sm_10", [FeatureSM10]>;
96 def : Proc<"sm_11", [FeatureSM11]>;
97 def : Proc<"sm_12", [FeatureSM12]>;
98 def : Proc<"sm_13", [FeatureSM13]>;
99 def : Proc<"sm_20", [FeatureSM20]>;
100 def : Proc<"sm_21", [FeatureSM21]>;
101 def : Proc<"sm_22", [FeatureSM22]>;
102 def : Proc<"sm_23", [FeatureSM23]>;
104 // Processor definitions for common GPU architectures
105 def : Proc<"g80", [FeatureSM10]>;
106 def : Proc<"gt200", [FeatureSM13]>;
107 def : Proc<"gf100", [FeatureSM20, FeatureDouble]>;
108 def : Proc<"fermi", [FeatureSM20, FeatureDouble]>;
110 //===----------------------------------------------------------------------===//
111 // Register File Description
112 //===----------------------------------------------------------------------===//
114 include "PTXRegisterInfo.td"
116 //===----------------------------------------------------------------------===//
117 // Instruction Descriptions
118 //===----------------------------------------------------------------------===//
120 include "PTXInstrInfo.td"
122 def PTXInstrInfo : InstrInfo;
124 //===----------------------------------------------------------------------===//
126 //===----------------------------------------------------------------------===//
127 // PTX uses the MC printer for asm output, so make sure the TableGen
128 // AsmWriter bits get associated with the correct class.
129 def PTXAsmWriter : AsmWriter {
130 string AsmWriterClassName = "InstPrinter";
131 bit isMCAsmWriter = 1;
134 //===----------------------------------------------------------------------===//
135 // Target Declaration
136 //===----------------------------------------------------------------------===//
139 let InstructionSet = PTXInstrInfo;
140 let AssemblyWriters = [PTXAsmWriter];