blob: 2eb805e814f6bd3869a8bee8b86d46db3fbbf307 [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- AMDIL.td - AMDIL Tablegen files --*- tablegen -*-------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//==-----------------------------------------------------------------------===//
9
Tom Stellardbc5b5372014-06-13 16:38:59 +000010include "llvm/Target/Target.td"
Tom Stellard75aadc22012-12-11 21:25:42 +000011
Tom Stellard99792772013-06-07 20:28:49 +000012//===----------------------------------------------------------------------===//
13// Subtarget Features
14//===----------------------------------------------------------------------===//
15
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000016// Debugging Features
17
18def FeatureDumpCode : SubtargetFeature <"DumpCode",
19 "DumpCode",
20 "true",
21 "Dump MachineInstrs in the CodeEmitter">;
22
Tom Stellard66df8a22013-11-18 19:43:44 +000023def FeatureIRStructurizer : SubtargetFeature <"disable-irstructurizer",
Tom Stellarded0ceec2013-10-10 17:11:12 +000024 "EnableIRStructurizer",
Tom Stellard66df8a22013-11-18 19:43:44 +000025 "false",
26 "Disable IR Structurizer">;
Tom Stellarded0ceec2013-10-10 17:11:12 +000027
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +000028def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
29 "EnablePromoteAlloca",
30 "true",
31 "Enable promote alloca pass">;
32
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000033// Target features
34
Tom Stellard783893a2013-11-18 19:43:33 +000035def FeatureIfCvt : SubtargetFeature <"disable-ifcvt",
36 "EnableIfCvt",
37 "false",
38 "Disable the if conversion pass">;
39
Matt Arsenaultf5e29972014-06-20 06:50:05 +000040def FeatureFP64 : SubtargetFeature<"fp64",
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000041 "FP64",
Tom Stellard99792772013-06-07 20:28:49 +000042 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000043 "Enable double precision operations">;
Tom Stellard99792772013-06-07 20:28:49 +000044
Matt Arsenaultf171cf22014-07-14 23:40:49 +000045def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
46 "FP64Denormals",
47 "true",
48 "Enable double precision denormal handling",
49 [FeatureFP64]>;
50
Matt Arsenaultb035a572015-01-29 19:34:25 +000051def FeatureFastFMAF32 : SubtargetFeature<"fast-fmaf",
52 "FastFMAF32",
53 "true",
54 "Assuming f32 fma is at least as fast as mul + add",
55 []>;
56
Matt Arsenaultf171cf22014-07-14 23:40:49 +000057// Some instructions do not support denormals despite this flag. Using
58// fp32 denormals also causes instructions to run at the double
59// precision rate for the device.
60def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
61 "FP32Denormals",
62 "true",
63 "Enable single precision denormal handling">;
64
Tom Stellard99792772013-06-07 20:28:49 +000065def Feature64BitPtr : SubtargetFeature<"64BitPtr",
66 "Is64bit",
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000067 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000068 "Specify if 64-bit addressing should be used">;
Tom Stellard99792772013-06-07 20:28:49 +000069
70def FeatureR600ALUInst : SubtargetFeature<"R600ALUInst",
71 "R600ALUInst",
72 "false",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000073 "Older version of ALU instructions encoding">;
Tom Stellard99792772013-06-07 20:28:49 +000074
75def FeatureVertexCache : SubtargetFeature<"HasVertexCache",
76 "HasVertexCache",
77 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000078 "Specify use of dedicated vertex cache">;
Tom Stellard99792772013-06-07 20:28:49 +000079
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000080def FeatureCaymanISA : SubtargetFeature<"caymanISA",
81 "CaymanISA",
82 "true",
83 "Use Cayman ISA">;
84
Tom Stellard348273d2014-01-23 16:18:02 +000085def FeatureCFALUBug : SubtargetFeature<"cfalubug",
86 "CFALUBug",
87 "true",
88 "GPU has CF_ALU bug">;
89
Matt Arsenault41033282014-10-10 22:01:59 +000090// XXX - This should probably be removed once enabled by default
91def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
92 "EnableLoadStoreOpt",
93 "true",
94 "Enable SI load/store optimizer pass">;
95
Matt Arsenault3f981402014-09-15 15:41:53 +000096def FeatureFlatAddressSpace : SubtargetFeature<"flat-address-space",
97 "FlatAddressSpace",
98 "true",
99 "Support flat address space">;
100
Tom Stellarde99fb652015-01-20 19:33:04 +0000101def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
102 "EnableVGPRSpilling",
103 "true",
104 "Enable spilling of VGPRs to scratch memory">;
105
Marek Olsak4d00dd22015-03-09 15:48:09 +0000106def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
107 "SGPRInitBug",
108 "true",
109 "VI SGPR initilization bug requiring a fixed SGPR allocation size">;
110
Tom Stellard3498e4f2013-06-07 20:28:55 +0000111class SubtargetFeatureFetchLimit <string Value> :
112 SubtargetFeature <"fetch"#Value,
113 "TexVTXClauseSize",
114 Value,
115 "Limit the maximum number of fetches in a clause to "#Value>;
Tom Stellard99792772013-06-07 20:28:49 +0000116
Tom Stellard3498e4f2013-06-07 20:28:55 +0000117def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
118def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
119
Tom Stellard8c347b02014-01-22 21:55:40 +0000120class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
121 "wavefrontsize"#Value,
122 "WavefrontSize",
123 !cast<string>(Value),
124 "The number of threads per wavefront">;
125
126def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
127def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
128def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
129
Tom Stellard880a80a2014-06-17 16:53:14 +0000130class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
131 "localmemorysize"#Value,
132 "LocalMemorySize",
133 !cast<string>(Value),
134 "The size of local memory in bytes">;
135
Tom Stellardd7e6f132015-04-08 01:09:26 +0000136def FeatureGCN : SubtargetFeature<"gcn",
137 "IsGCN",
138 "true",
139 "GCN or newer GPU">;
140
141def FeatureGCN1Encoding : SubtargetFeature<"gcn1-encoding",
142 "GCN1Encoding",
143 "true",
144 "Encoding format for SI and CI">;
145
146def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
147 "GCN3Encoding",
148 "true",
149 "Encoding format for VI">;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000150class SubtargetFeatureGeneration <string Value,
151 list<SubtargetFeature> Implies> :
152 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
153 Value#" GPU generation", Implies>;
154
Tom Stellard880a80a2014-06-17 16:53:14 +0000155def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
156def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
157def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
158
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000159def FeatureR600 : SubtargetFeatureGeneration<"R600",
Tom Stellard880a80a2014-06-17 16:53:14 +0000160 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000161
162def FeatureR700 : SubtargetFeatureGeneration<"R700",
Tom Stellard880a80a2014-06-17 16:53:14 +0000163 [FeatureFetchLimit16, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000164
165def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Tom Stellard880a80a2014-06-17 16:53:14 +0000166 [FeatureFetchLimit16, FeatureLocalMemorySize32768]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000167
168def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Tom Stellard880a80a2014-06-17 16:53:14 +0000169 [FeatureFetchLimit16, FeatureWavefrontSize64,
170 FeatureLocalMemorySize32768]
171>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000172
173def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000174 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize32768,
Tom Stellardd7e6f132015-04-08 01:09:26 +0000175 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000176
Tom Stellard6e1ee472013-10-29 16:37:28 +0000177def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000178 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize65536,
Tom Stellardd7e6f132015-04-08 01:09:26 +0000179 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
180 FeatureGCN1Encoding]>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000181
182def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
183 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize65536,
Tom Stellardd7e6f132015-04-08 01:09:26 +0000184 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
185 FeatureGCN3Encoding]>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000186
Tom Stellard3498e4f2013-06-07 20:28:55 +0000187//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000188
189def AMDGPUInstrInfo : InstrInfo {
190 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000191 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000192}
193
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000194def AMDGPUAsmParser : AsmParser {
195 // Some of the R600 registers have the same name, so this crashes.
196 // For example T0_XYZW and T0_XY both have the asm name T0.
197 let ShouldEmitMatchRegisterName = 0;
198}
199
Tom Stellard75aadc22012-12-11 21:25:42 +0000200def AMDGPU : Target {
201 // Pull in Instruction Info:
202 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000203 let AssemblyParsers = [AMDGPUAsmParser];
Tom Stellard75aadc22012-12-11 21:25:42 +0000204}
205
Tom Stellardbc5b5372014-06-13 16:38:59 +0000206// Dummy Instruction itineraries for pseudo instructions
207def ALU_NULL : FuncUnit;
208def NullALU : InstrItinClass;
209
Tom Stellard0e70de52014-05-16 20:56:45 +0000210//===----------------------------------------------------------------------===//
211// Predicate helper class
212//===----------------------------------------------------------------------===//
213
214class PredicateControl {
215 Predicate SubtargetPredicate;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000216 list<Predicate> AssemblerPredicates = [];
Tom Stellard0e70de52014-05-16 20:56:45 +0000217 list<Predicate> OtherPredicates = [];
218 list<Predicate> Predicates = !listconcat([SubtargetPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000219 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000220 OtherPredicates);
221}
222
Tom Stellard75aadc22012-12-11 21:25:42 +0000223// Include AMDGPU TD files
224include "R600Schedule.td"
225include "SISchedule.td"
226include "Processors.td"
227include "AMDGPUInstrInfo.td"
228include "AMDGPUIntrinsics.td"
229include "AMDGPURegisterInfo.td"
230include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000231include "AMDGPUCallingConv.td"