blob: 0de72734b71b985796f1c4b5bcf424fc7534d98c [file] [log] [blame]
Matt Arsenault382d9452016-01-26 04:49:22 +00001//===-- AMDGPU.td - AMDGPU Tablegen files --------*- tablegen -*-===//
Tom Stellard75aadc22012-12-11 21:25:42 +00002//
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//
Matt Arsenault382d9452016-01-26 04:49:22 +00008//===------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +00009
Tom Stellardbc5b5372014-06-13 16:38:59 +000010include "llvm/Target/Target.td"
Tom Stellard75aadc22012-12-11 21:25:42 +000011
Matt Arsenault382d9452016-01-26 04:49:22 +000012//===------------------------------------------------------------===//
13// Subtarget Features (device properties)
14//===------------------------------------------------------------===//
Tom Stellard783893a2013-11-18 19:43:33 +000015
Matt Arsenaultf5e29972014-06-20 06:50:05 +000016def FeatureFP64 : SubtargetFeature<"fp64",
Matt Arsenault382d9452016-01-26 04:49:22 +000017 "FP64",
18 "true",
19 "Enable double precision operations"
20>;
Matt Arsenaultf171cf22014-07-14 23:40:49 +000021
Matt Arsenaultb035a572015-01-29 19:34:25 +000022def FeatureFastFMAF32 : SubtargetFeature<"fast-fmaf",
Matt Arsenault382d9452016-01-26 04:49:22 +000023 "FastFMAF32",
24 "true",
25 "Assuming f32 fma is at least as fast as mul + add"
26>;
Matt Arsenaultb035a572015-01-29 19:34:25 +000027
Matt Arsenaulte83690c2016-01-18 21:13:50 +000028def HalfRate64Ops : SubtargetFeature<"half-rate-64-ops",
Matt Arsenault382d9452016-01-26 04:49:22 +000029 "HalfRate64Ops",
30 "true",
31 "Most fp64 instructions are half rate instead of quarter"
32>;
Matt Arsenaultf171cf22014-07-14 23:40:49 +000033
Tom Stellard99792772013-06-07 20:28:49 +000034def FeatureR600ALUInst : SubtargetFeature<"R600ALUInst",
Matt Arsenault382d9452016-01-26 04:49:22 +000035 "R600ALUInst",
36 "false",
37 "Older version of ALU instructions encoding"
38>;
Tom Stellard99792772013-06-07 20:28:49 +000039
40def FeatureVertexCache : SubtargetFeature<"HasVertexCache",
Matt Arsenault382d9452016-01-26 04:49:22 +000041 "HasVertexCache",
42 "true",
43 "Specify use of dedicated vertex cache"
44>;
Tom Stellard99792772013-06-07 20:28:49 +000045
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000046def FeatureCaymanISA : SubtargetFeature<"caymanISA",
Matt Arsenault382d9452016-01-26 04:49:22 +000047 "CaymanISA",
48 "true",
49 "Use Cayman ISA"
50>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000051
Tom Stellard348273d2014-01-23 16:18:02 +000052def FeatureCFALUBug : SubtargetFeature<"cfalubug",
Matt Arsenault382d9452016-01-26 04:49:22 +000053 "CFALUBug",
54 "true",
55 "GPU has CF_ALU bug"
56>;
Changpeng Fangb41574a2015-12-22 20:55:23 +000057
Matt Arsenault3f981402014-09-15 15:41:53 +000058def FeatureFlatAddressSpace : SubtargetFeature<"flat-address-space",
Matt Arsenault382d9452016-01-26 04:49:22 +000059 "FlatAddressSpace",
60 "true",
61 "Support flat address space"
62>;
Matt Arsenault3f981402014-09-15 15:41:53 +000063
Matt Arsenault7f681ac2016-07-01 23:03:44 +000064def FeatureUnalignedBufferAccess : SubtargetFeature<"unaligned-buffer-access",
65 "UnalignedBufferAccess",
66 "true",
67 "Support unaligned global loads and stores"
68>;
69
Wei Ding205bfdb2017-02-10 02:15:29 +000070def FeatureTrapHandler: SubtargetFeature<"trap-handler",
71 "TrapHandler",
72 "true",
73 "Trap handler support"
74>;
75
Tom Stellard64a9d082016-10-14 18:10:39 +000076def FeatureUnalignedScratchAccess : SubtargetFeature<"unaligned-scratch-access",
77 "UnalignedScratchAccess",
78 "true",
79 "Support unaligned scratch loads and stores"
80>;
81
Matt Arsenaulte823d922017-02-18 18:29:53 +000082def FeatureApertureRegs : SubtargetFeature<"aperture-regs",
83 "HasApertureRegs",
84 "true",
85 "Has Memory Aperture Base and Size Registers"
86>;
87
Marek Olsak0f55fba2016-12-09 19:49:54 +000088// XNACK is disabled if SH_MEM_CONFIG.ADDRESS_MODE = GPUVM on chips that support
89// XNACK. The current default kernel driver setting is:
90// - graphics ring: XNACK disabled
91// - compute ring: XNACK enabled
92//
93// If XNACK is enabled, the VMEM latency can be worse.
94// If XNACK is disabled, the 2 SGPRs can be used for general purposes.
Nicolai Haehnle5b504972016-01-04 23:35:53 +000095def FeatureXNACK : SubtargetFeature<"xnack",
Matt Arsenault382d9452016-01-26 04:49:22 +000096 "EnableXNACK",
97 "true",
98 "Enable XNACK support"
99>;
Tom Stellarde99fb652015-01-20 19:33:04 +0000100
Marek Olsak4d00dd22015-03-09 15:48:09 +0000101def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
Matt Arsenault382d9452016-01-26 04:49:22 +0000102 "SGPRInitBug",
103 "true",
104 "VI SGPR initilization bug requiring a fixed SGPR allocation size"
105>;
Tom Stellardde008d32016-01-21 04:28:34 +0000106
Tom Stellard3498e4f2013-06-07 20:28:55 +0000107class SubtargetFeatureFetchLimit <string Value> :
108 SubtargetFeature <"fetch"#Value,
Matt Arsenault382d9452016-01-26 04:49:22 +0000109 "TexVTXClauseSize",
110 Value,
111 "Limit the maximum number of fetches in a clause to "#Value
112>;
Tom Stellard99792772013-06-07 20:28:49 +0000113
Tom Stellard3498e4f2013-06-07 20:28:55 +0000114def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
115def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
116
Tom Stellard8c347b02014-01-22 21:55:40 +0000117class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +0000118 "wavefrontsize"#Value,
119 "WavefrontSize",
120 !cast<string>(Value),
121 "The number of threads per wavefront"
122>;
Tom Stellard8c347b02014-01-22 21:55:40 +0000123
124def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
125def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
126def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
127
Tom Stellardec87f842015-05-25 16:15:54 +0000128class SubtargetFeatureLDSBankCount <int Value> : SubtargetFeature <
Matt Arsenault382d9452016-01-26 04:49:22 +0000129 "ldsbankcount"#Value,
130 "LDSBankCount",
131 !cast<string>(Value),
132 "The number of LDS banks per compute unit."
133>;
Tom Stellardec87f842015-05-25 16:15:54 +0000134
135def FeatureLDSBankCount16 : SubtargetFeatureLDSBankCount<16>;
136def FeatureLDSBankCount32 : SubtargetFeatureLDSBankCount<32>;
137
Tom Stellard880a80a2014-06-17 16:53:14 +0000138class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +0000139 "localmemorysize"#Value,
140 "LocalMemorySize",
141 !cast<string>(Value),
142 "The size of local memory in bytes"
143>;
Tom Stellard880a80a2014-06-17 16:53:14 +0000144
Tom Stellardd7e6f132015-04-08 01:09:26 +0000145def FeatureGCN : SubtargetFeature<"gcn",
Matt Arsenault382d9452016-01-26 04:49:22 +0000146 "IsGCN",
147 "true",
148 "GCN or newer GPU"
149>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000150
151def FeatureGCN1Encoding : SubtargetFeature<"gcn1-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000152 "GCN1Encoding",
153 "true",
154 "Encoding format for SI and CI"
155>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000156
157def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000158 "GCN3Encoding",
159 "true",
160 "Encoding format for VI"
161>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000162
163def FeatureCIInsts : SubtargetFeature<"ci-insts",
Matt Arsenault382d9452016-01-26 04:49:22 +0000164 "CIInsts",
165 "true",
166 "Additional intstructions for CI+"
167>;
168
Matt Arsenault2021f082017-02-18 19:12:26 +0000169def FeatureGFX9Insts : SubtargetFeature<"gfx9-insts",
170 "GFX9Insts",
171 "true",
172 "Additional intstructions for GFX9+"
173>;
174
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000175def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
176 "HasSMemRealTime",
Matt Arsenault61738cb2016-02-27 08:53:46 +0000177 "true",
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000178 "Has s_memrealtime instruction"
179>;
180
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000181def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
182 "HasInv2PiInlineImm",
183 "true",
184 "Has 1 / (2 * pi) as inline immediate"
185>;
186
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000187def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
188 "Has16BitInsts",
189 "true",
190 "Has i16/f16 instructions"
Matt Arsenault61738cb2016-02-27 08:53:46 +0000191>;
192
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000193def FeatureMovrel : SubtargetFeature<"movrel",
194 "HasMovrel",
195 "true",
196 "Has v_movrel*_b32 instructions"
197>;
198
199def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
200 "HasVGPRIndexMode",
201 "true",
202 "Has VGPR mode register indexing"
203>;
204
Matt Arsenault7b647552016-10-28 21:55:15 +0000205def FeatureScalarStores : SubtargetFeature<"scalar-stores",
206 "HasScalarStores",
207 "true",
208 "Has store scalar memory instructions"
209>;
210
Sam Kolton07dbde22017-01-20 10:01:25 +0000211def FeatureSDWA : SubtargetFeature<"sdwa",
212 "HasSDWA",
213 "true",
214 "Support SDWA (Sub-DWORD Addressing) extension"
215>;
216
217def FeatureDPP : SubtargetFeature<"dpp",
218 "HasDPP",
219 "true",
220 "Support DPP (Data Parallel Primitives) extension"
221>;
222
Matt Arsenault382d9452016-01-26 04:49:22 +0000223//===------------------------------------------------------------===//
224// Subtarget Features (options and debugging)
225//===------------------------------------------------------------===//
226
227// Some instructions do not support denormals despite this flag. Using
228// fp32 denormals also causes instructions to run at the double
229// precision rate for the device.
230def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
231 "FP32Denormals",
232 "true",
233 "Enable single precision denormal handling"
234>;
235
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000236// Denormal handling for fp64 and fp16 is controlled by the same
237// config register when fp16 supported.
238// TODO: Do we need a separate f16 setting when not legal?
239def FeatureFP64FP16Denormals : SubtargetFeature<"fp64-fp16-denormals",
240 "FP64FP16Denormals",
Matt Arsenault382d9452016-01-26 04:49:22 +0000241 "true",
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000242 "Enable double and half precision denormal handling",
Matt Arsenault382d9452016-01-26 04:49:22 +0000243 [FeatureFP64]
244>;
245
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000246def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
247 "FP64FP16Denormals",
248 "true",
249 "Enable double and half precision denormal handling",
250 [FeatureFP64, FeatureFP64FP16Denormals]
251>;
252
253def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
254 "FP64FP16Denormals",
255 "true",
256 "Enable half precision denormal handling",
257 [FeatureFP64FP16Denormals]
258>;
259
Matt Arsenaultf639c322016-01-28 20:53:42 +0000260def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
261 "FPExceptions",
262 "true",
263 "Enable floating point exceptions"
264>;
265
Matt Arsenault24ee0782016-02-12 02:40:47 +0000266class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
267 "max-private-element-size-"#size,
268 "MaxPrivateElementSize",
269 !cast<string>(size),
270 "Maximum private access size may be "#size
271>;
272
273def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
274def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
275def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
276
Matt Arsenault382d9452016-01-26 04:49:22 +0000277def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
278 "EnableVGPRSpilling",
279 "true",
280 "Enable spilling of VGPRs to scratch memory"
281>;
282
283def FeatureDumpCode : SubtargetFeature <"DumpCode",
284 "DumpCode",
285 "true",
286 "Dump MachineInstrs in the CodeEmitter"
287>;
288
289def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
290 "DumpCode",
291 "true",
292 "Dump MachineInstrs in the CodeEmitter"
293>;
294
Matt Arsenault382d9452016-01-26 04:49:22 +0000295def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
296 "EnablePromoteAlloca",
297 "true",
298 "Enable promote alloca pass"
299>;
300
301// XXX - This should probably be removed once enabled by default
302def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
303 "EnableLoadStoreOpt",
304 "true",
305 "Enable SI load/store optimizer pass"
306>;
307
308// Performance debugging feature. Allow using DS instruction immediate
309// offsets even if the base pointer can't be proven to be base. On SI,
310// base pointer values that won't give the same result as a 16-bit add
311// are not safe to fold, but this will override the conservative test
312// for the base pointer.
313def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
314 "unsafe-ds-offset-folding",
315 "EnableUnsafeDSOffsetFolding",
316 "true",
317 "Force using DS instruction immediate offsets on SI"
318>;
319
Matt Arsenault382d9452016-01-26 04:49:22 +0000320def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
321 "EnableSIScheduler",
322 "true",
323 "Enable SI Machine Scheduler"
324>;
325
Matt Arsenault7aad8fd2017-01-24 22:02:15 +0000326// Unless +-flat-for-global is specified, turn on FlatForGlobal for
327// all OS-es on VI and newer hardware to avoid assertion failures due
328// to missing ADDR64 variants of MUBUF instructions.
329// FIXME: moveToVALU should be able to handle converting addr64 MUBUF
330// instructions.
331
Matt Arsenault382d9452016-01-26 04:49:22 +0000332def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
333 "FlatForGlobal",
334 "true",
Matt Arsenaultd8f7ea32017-01-27 17:42:26 +0000335 "Force to generate flat instruction for global"
Matt Arsenault382d9452016-01-26 04:49:22 +0000336>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000337
338// Dummy feature used to disable assembler instructions.
339def FeatureDisable : SubtargetFeature<"",
Matt Arsenault382d9452016-01-26 04:49:22 +0000340 "FeatureDisable","true",
341 "Dummy feature to disable assembler instructions"
342>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000343
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000344class SubtargetFeatureGeneration <string Value,
345 list<SubtargetFeature> Implies> :
346 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
347 Value#" GPU generation", Implies>;
348
Tom Stellard880a80a2014-06-17 16:53:14 +0000349def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
350def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
351def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
352
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000353def FeatureR600 : SubtargetFeatureGeneration<"R600",
Matt Arsenault382d9452016-01-26 04:49:22 +0000354 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]
355>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000356
357def FeatureR700 : SubtargetFeatureGeneration<"R700",
Matt Arsenault382d9452016-01-26 04:49:22 +0000358 [FeatureFetchLimit16, FeatureLocalMemorySize0]
359>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000360
361def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Matt Arsenault382d9452016-01-26 04:49:22 +0000362 [FeatureFetchLimit16, FeatureLocalMemorySize32768]
363>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000364
365def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000366 [FeatureFetchLimit16, FeatureWavefrontSize64,
367 FeatureLocalMemorySize32768]
Tom Stellard880a80a2014-06-17 16:53:14 +0000368>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000369
370def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000371 [FeatureFP64, FeatureLocalMemorySize32768,
372 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000373 FeatureLDSBankCount32, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000374>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000375
Tom Stellard6e1ee472013-10-29 16:37:28 +0000376def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000377 [FeatureFP64, FeatureLocalMemorySize65536,
378 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000379 FeatureGCN1Encoding, FeatureCIInsts, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000380>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000381
382def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000383 [FeatureFP64, FeatureLocalMemorySize65536,
384 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000385 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
Matt Arsenault7b647552016-10-28 21:55:15 +0000386 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
Sam Kolton07dbde22017-01-20 10:01:25 +0000387 FeatureScalarStores, FeatureInv2PiInlineImm, FeatureSDWA,
Matt Arsenaultd8f7ea32017-01-27 17:42:26 +0000388 FeatureDPP
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000389 ]
Matt Arsenault382d9452016-01-26 04:49:22 +0000390>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000391
Matt Arsenaulte823d922017-02-18 18:29:53 +0000392def FeatureGFX9 : SubtargetFeatureGeneration<"GFX9",
393 [FeatureFP64, FeatureLocalMemorySize65536,
394 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
395 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
396 FeatureSMemRealTime, FeatureScalarStores, FeatureInv2PiInlineImm,
Matt Arsenault2021f082017-02-18 19:12:26 +0000397 FeatureApertureRegs, FeatureGFX9Insts
Matt Arsenaulte823d922017-02-18 18:29:53 +0000398 ]
399>;
400
Yaxun Liu94add852016-10-26 16:37:56 +0000401class SubtargetFeatureISAVersion <int Major, int Minor, int Stepping,
402 list<SubtargetFeature> Implies>
403 : SubtargetFeature <
404 "isaver"#Major#"."#Minor#"."#Stepping,
405 "IsaVersion",
406 "ISAVersion"#Major#"_"#Minor#"_"#Stepping,
407 "Instruction set version number",
408 Implies
409>;
410
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000411def FeatureISAVersion7_0_0 : SubtargetFeatureISAVersion <7,0,0,
Yaxun Liu94add852016-10-26 16:37:56 +0000412 [FeatureSeaIslands,
413 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000414
Yaxun Liu94add852016-10-26 16:37:56 +0000415def FeatureISAVersion7_0_1 : SubtargetFeatureISAVersion <7,0,1,
416 [FeatureSeaIslands,
417 HalfRate64Ops,
418 FeatureLDSBankCount32,
419 FeatureFastFMAF32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000420
Yaxun Liu94add852016-10-26 16:37:56 +0000421def FeatureISAVersion7_0_2 : SubtargetFeatureISAVersion <7,0,2,
422 [FeatureSeaIslands,
Marek Olsak23ae31c2016-12-09 19:49:58 +0000423 FeatureLDSBankCount16]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000424
Yaxun Liu94add852016-10-26 16:37:56 +0000425def FeatureISAVersion8_0_0 : SubtargetFeatureISAVersion <8,0,0,
426 [FeatureVolcanicIslands,
427 FeatureLDSBankCount32,
428 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000429
Yaxun Liu94add852016-10-26 16:37:56 +0000430def FeatureISAVersion8_0_1 : SubtargetFeatureISAVersion <8,0,1,
431 [FeatureVolcanicIslands,
432 FeatureLDSBankCount32,
433 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000434
Yaxun Liu94add852016-10-26 16:37:56 +0000435def FeatureISAVersion8_0_2 : SubtargetFeatureISAVersion <8,0,2,
436 [FeatureVolcanicIslands,
437 FeatureLDSBankCount32,
438 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000439
Yaxun Liu94add852016-10-26 16:37:56 +0000440def FeatureISAVersion8_0_3 : SubtargetFeatureISAVersion <8,0,3,
441 [FeatureVolcanicIslands,
442 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000443
Yaxun Liu94add852016-10-26 16:37:56 +0000444def FeatureISAVersion8_0_4 : SubtargetFeatureISAVersion <8,0,4,
445 [FeatureVolcanicIslands,
446 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000447
Yaxun Liu94add852016-10-26 16:37:56 +0000448def FeatureISAVersion8_1_0 : SubtargetFeatureISAVersion <8,1,0,
449 [FeatureVolcanicIslands,
450 FeatureLDSBankCount16,
451 FeatureXNACK]>;
452
Matt Arsenaulte823d922017-02-18 18:29:53 +0000453def FeatureISAVersion9_0_0 : SubtargetFeatureISAVersion <9,0,0,[]>;
454def FeatureISAVersion9_0_1 : SubtargetFeatureISAVersion <9,0,1,[]>;
455
Tom Stellard3498e4f2013-06-07 20:28:55 +0000456//===----------------------------------------------------------------------===//
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000457// Debugger related subtarget features.
458//===----------------------------------------------------------------------===//
459
460def FeatureDebuggerInsertNops : SubtargetFeature<
461 "amdgpu-debugger-insert-nops",
462 "DebuggerInsertNops",
463 "true",
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +0000464 "Insert one nop instruction for each high level source statement"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000465>;
466
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000467def FeatureDebuggerReserveRegs : SubtargetFeature<
468 "amdgpu-debugger-reserve-regs",
469 "DebuggerReserveRegs",
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000470 "true",
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000471 "Reserve registers for debugger usage"
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000472>;
473
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000474def FeatureDebuggerEmitPrologue : SubtargetFeature<
475 "amdgpu-debugger-emit-prologue",
476 "DebuggerEmitPrologue",
477 "true",
478 "Emit debugger prologue"
479>;
480
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000481//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000482
483def AMDGPUInstrInfo : InstrInfo {
484 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000485 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000486}
487
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000488def AMDGPUAsmParser : AsmParser {
489 // Some of the R600 registers have the same name, so this crashes.
490 // For example T0_XYZW and T0_XY both have the asm name T0.
491 let ShouldEmitMatchRegisterName = 0;
492}
493
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000494def AMDGPUAsmWriter : AsmWriter {
495 int PassSubtarget = 1;
496}
497
Sam Koltond63d8a72016-09-09 09:37:51 +0000498def AMDGPUAsmVariants {
499 string Default = "Default";
500 int Default_ID = 0;
501 string VOP3 = "VOP3";
502 int VOP3_ID = 1;
503 string SDWA = "SDWA";
504 int SDWA_ID = 2;
505 string DPP = "DPP";
506 int DPP_ID = 3;
Sam Koltonfb0d9d92016-09-12 14:42:43 +0000507 string Disable = "Disable";
508 int Disable_ID = 4;
Sam Koltond63d8a72016-09-09 09:37:51 +0000509}
510
511def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
512 let Variant = AMDGPUAsmVariants.Default_ID;
513 let Name = AMDGPUAsmVariants.Default;
514}
515
516def VOP3AsmParserVariant : AsmParserVariant {
517 let Variant = AMDGPUAsmVariants.VOP3_ID;
518 let Name = AMDGPUAsmVariants.VOP3;
519}
520
521def SDWAAsmParserVariant : AsmParserVariant {
522 let Variant = AMDGPUAsmVariants.SDWA_ID;
523 let Name = AMDGPUAsmVariants.SDWA;
524}
525
526def DPPAsmParserVariant : AsmParserVariant {
527 let Variant = AMDGPUAsmVariants.DPP_ID;
528 let Name = AMDGPUAsmVariants.DPP;
529}
530
Tom Stellard75aadc22012-12-11 21:25:42 +0000531def AMDGPU : Target {
532 // Pull in Instruction Info:
533 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000534 let AssemblyParsers = [AMDGPUAsmParser];
Sam Koltond63d8a72016-09-09 09:37:51 +0000535 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
536 VOP3AsmParserVariant,
537 SDWAAsmParserVariant,
538 DPPAsmParserVariant];
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000539 let AssemblyWriters = [AMDGPUAsmWriter];
Tom Stellard75aadc22012-12-11 21:25:42 +0000540}
541
Tom Stellardbc5b5372014-06-13 16:38:59 +0000542// Dummy Instruction itineraries for pseudo instructions
543def ALU_NULL : FuncUnit;
544def NullALU : InstrItinClass;
545
Tom Stellard0e70de52014-05-16 20:56:45 +0000546//===----------------------------------------------------------------------===//
547// Predicate helper class
548//===----------------------------------------------------------------------===//
549
Tom Stellardd1f0f022015-04-23 19:33:54 +0000550def TruePredicate : Predicate<"true">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000551
Tom Stellardd1f0f022015-04-23 19:33:54 +0000552def isSICI : Predicate<
553 "Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
554 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS"
555>, AssemblerPredicate<"FeatureGCN1Encoding">;
556
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000557def isVI : Predicate <
558 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
559 AssemblerPredicate<"FeatureGCN3Encoding">;
560
Matt Arsenault2021f082017-02-18 19:12:26 +0000561def isGFX9 : Predicate <
562 "Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
563 AssemblerPredicate<"FeatureGFX9Insts">;
564
Matt Arsenaulte823d922017-02-18 18:29:53 +0000565// TODO: Either the name to be changed or we simply use IsCI!
Matt Arsenault382d9452016-01-26 04:49:22 +0000566def isCIVI : Predicate <
Matt Arsenaulte823d922017-02-18 18:29:53 +0000567 "Subtarget->getGeneration() >= AMDGPUSubtarget::SEA_ISLANDS">,
568 AssemblerPredicate<"FeatureCIInsts">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000569
570def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">;
571
Tom Stellard115a6152016-11-10 16:02:37 +0000572def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">;
573
Sam Kolton07dbde22017-01-20 10:01:25 +0000574def HasSDWA : Predicate<"Subtarget->hasSDWA()">,
575 AssemblerPredicate<"FeatureSDWA">;
576
577def HasDPP : Predicate<"Subtarget->hasDPP()">,
578 AssemblerPredicate<"FeatureDPP">;
579
Tom Stellard0e70de52014-05-16 20:56:45 +0000580class PredicateControl {
581 Predicate SubtargetPredicate;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000582 Predicate SIAssemblerPredicate = isSICI;
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000583 Predicate VIAssemblerPredicate = isVI;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000584 list<Predicate> AssemblerPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000585 Predicate AssemblerPredicate = TruePredicate;
Tom Stellard0e70de52014-05-16 20:56:45 +0000586 list<Predicate> OtherPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000587 list<Predicate> Predicates = !listconcat([SubtargetPredicate, AssemblerPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000588 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000589 OtherPredicates);
590}
591
Tom Stellard75aadc22012-12-11 21:25:42 +0000592// Include AMDGPU TD files
593include "R600Schedule.td"
594include "SISchedule.td"
595include "Processors.td"
596include "AMDGPUInstrInfo.td"
597include "AMDGPUIntrinsics.td"
598include "AMDGPURegisterInfo.td"
Tom Stellardca166212017-01-30 21:56:46 +0000599include "AMDGPURegisterBanks.td"
Tom Stellard75aadc22012-12-11 21:25:42 +0000600include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000601include "AMDGPUCallingConv.td"