blob: d97c89df52ff2fa9964a6efacfb4b0e1a63b48ae [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 Arsenault9d82ee72016-02-27 08:53:55 +0000169def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
170 "HasSMemRealTime",
Matt Arsenault61738cb2016-02-27 08:53:46 +0000171 "true",
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000172 "Has s_memrealtime instruction"
173>;
174
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000175def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
176 "HasInv2PiInlineImm",
177 "true",
178 "Has 1 / (2 * pi) as inline immediate"
179>;
180
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000181def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
182 "Has16BitInsts",
183 "true",
184 "Has i16/f16 instructions"
Matt Arsenault61738cb2016-02-27 08:53:46 +0000185>;
186
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000187def FeatureMovrel : SubtargetFeature<"movrel",
188 "HasMovrel",
189 "true",
190 "Has v_movrel*_b32 instructions"
191>;
192
193def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
194 "HasVGPRIndexMode",
195 "true",
196 "Has VGPR mode register indexing"
197>;
198
Matt Arsenault7b647552016-10-28 21:55:15 +0000199def FeatureScalarStores : SubtargetFeature<"scalar-stores",
200 "HasScalarStores",
201 "true",
202 "Has store scalar memory instructions"
203>;
204
Sam Kolton07dbde22017-01-20 10:01:25 +0000205def FeatureSDWA : SubtargetFeature<"sdwa",
206 "HasSDWA",
207 "true",
208 "Support SDWA (Sub-DWORD Addressing) extension"
209>;
210
211def FeatureDPP : SubtargetFeature<"dpp",
212 "HasDPP",
213 "true",
214 "Support DPP (Data Parallel Primitives) extension"
215>;
216
Matt Arsenault382d9452016-01-26 04:49:22 +0000217//===------------------------------------------------------------===//
218// Subtarget Features (options and debugging)
219//===------------------------------------------------------------===//
220
221// Some instructions do not support denormals despite this flag. Using
222// fp32 denormals also causes instructions to run at the double
223// precision rate for the device.
224def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
225 "FP32Denormals",
226 "true",
227 "Enable single precision denormal handling"
228>;
229
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000230// Denormal handling for fp64 and fp16 is controlled by the same
231// config register when fp16 supported.
232// TODO: Do we need a separate f16 setting when not legal?
233def FeatureFP64FP16Denormals : SubtargetFeature<"fp64-fp16-denormals",
234 "FP64FP16Denormals",
Matt Arsenault382d9452016-01-26 04:49:22 +0000235 "true",
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000236 "Enable double and half precision denormal handling",
Matt Arsenault382d9452016-01-26 04:49:22 +0000237 [FeatureFP64]
238>;
239
Matt Arsenaulta6867fd2017-01-23 22:31:03 +0000240def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
241 "FP64FP16Denormals",
242 "true",
243 "Enable double and half precision denormal handling",
244 [FeatureFP64, FeatureFP64FP16Denormals]
245>;
246
247def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
248 "FP64FP16Denormals",
249 "true",
250 "Enable half precision denormal handling",
251 [FeatureFP64FP16Denormals]
252>;
253
Matt Arsenaultf639c322016-01-28 20:53:42 +0000254def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
255 "FPExceptions",
256 "true",
257 "Enable floating point exceptions"
258>;
259
Matt Arsenault24ee0782016-02-12 02:40:47 +0000260class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
261 "max-private-element-size-"#size,
262 "MaxPrivateElementSize",
263 !cast<string>(size),
264 "Maximum private access size may be "#size
265>;
266
267def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
268def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
269def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
270
Matt Arsenault382d9452016-01-26 04:49:22 +0000271def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
272 "EnableVGPRSpilling",
273 "true",
274 "Enable spilling of VGPRs to scratch memory"
275>;
276
277def FeatureDumpCode : SubtargetFeature <"DumpCode",
278 "DumpCode",
279 "true",
280 "Dump MachineInstrs in the CodeEmitter"
281>;
282
283def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
284 "DumpCode",
285 "true",
286 "Dump MachineInstrs in the CodeEmitter"
287>;
288
Matt Arsenault382d9452016-01-26 04:49:22 +0000289def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
290 "EnablePromoteAlloca",
291 "true",
292 "Enable promote alloca pass"
293>;
294
295// XXX - This should probably be removed once enabled by default
296def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
297 "EnableLoadStoreOpt",
298 "true",
299 "Enable SI load/store optimizer pass"
300>;
301
302// Performance debugging feature. Allow using DS instruction immediate
303// offsets even if the base pointer can't be proven to be base. On SI,
304// base pointer values that won't give the same result as a 16-bit add
305// are not safe to fold, but this will override the conservative test
306// for the base pointer.
307def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
308 "unsafe-ds-offset-folding",
309 "EnableUnsafeDSOffsetFolding",
310 "true",
311 "Force using DS instruction immediate offsets on SI"
312>;
313
Matt Arsenault382d9452016-01-26 04:49:22 +0000314def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
315 "EnableSIScheduler",
316 "true",
317 "Enable SI Machine Scheduler"
318>;
319
Matt Arsenault7aad8fd2017-01-24 22:02:15 +0000320// Unless +-flat-for-global is specified, turn on FlatForGlobal for
321// all OS-es on VI and newer hardware to avoid assertion failures due
322// to missing ADDR64 variants of MUBUF instructions.
323// FIXME: moveToVALU should be able to handle converting addr64 MUBUF
324// instructions.
325
Matt Arsenault382d9452016-01-26 04:49:22 +0000326def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
327 "FlatForGlobal",
328 "true",
Matt Arsenaultd8f7ea32017-01-27 17:42:26 +0000329 "Force to generate flat instruction for global"
Matt Arsenault382d9452016-01-26 04:49:22 +0000330>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000331
332// Dummy feature used to disable assembler instructions.
333def FeatureDisable : SubtargetFeature<"",
Matt Arsenault382d9452016-01-26 04:49:22 +0000334 "FeatureDisable","true",
335 "Dummy feature to disable assembler instructions"
336>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000337
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000338class SubtargetFeatureGeneration <string Value,
339 list<SubtargetFeature> Implies> :
340 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
341 Value#" GPU generation", Implies>;
342
Tom Stellard880a80a2014-06-17 16:53:14 +0000343def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
344def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
345def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
346
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000347def FeatureR600 : SubtargetFeatureGeneration<"R600",
Matt Arsenault382d9452016-01-26 04:49:22 +0000348 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]
349>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000350
351def FeatureR700 : SubtargetFeatureGeneration<"R700",
Matt Arsenault382d9452016-01-26 04:49:22 +0000352 [FeatureFetchLimit16, FeatureLocalMemorySize0]
353>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000354
355def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Matt Arsenault382d9452016-01-26 04:49:22 +0000356 [FeatureFetchLimit16, FeatureLocalMemorySize32768]
357>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000358
359def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000360 [FeatureFetchLimit16, FeatureWavefrontSize64,
361 FeatureLocalMemorySize32768]
Tom Stellard880a80a2014-06-17 16:53:14 +0000362>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000363
364def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000365 [FeatureFP64, FeatureLocalMemorySize32768,
366 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000367 FeatureLDSBankCount32, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000368>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000369
Tom Stellard6e1ee472013-10-29 16:37:28 +0000370def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000371 [FeatureFP64, FeatureLocalMemorySize65536,
372 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000373 FeatureGCN1Encoding, FeatureCIInsts, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000374>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000375
376def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000377 [FeatureFP64, FeatureLocalMemorySize65536,
378 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000379 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
Matt Arsenault7b647552016-10-28 21:55:15 +0000380 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
Sam Kolton07dbde22017-01-20 10:01:25 +0000381 FeatureScalarStores, FeatureInv2PiInlineImm, FeatureSDWA,
Matt Arsenaultd8f7ea32017-01-27 17:42:26 +0000382 FeatureDPP
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000383 ]
Matt Arsenault382d9452016-01-26 04:49:22 +0000384>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000385
Matt Arsenaulte823d922017-02-18 18:29:53 +0000386def FeatureGFX9 : SubtargetFeatureGeneration<"GFX9",
387 [FeatureFP64, FeatureLocalMemorySize65536,
388 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
389 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
390 FeatureSMemRealTime, FeatureScalarStores, FeatureInv2PiInlineImm,
391 FeatureApertureRegs
392 ]
393>;
394
Yaxun Liu94add852016-10-26 16:37:56 +0000395class SubtargetFeatureISAVersion <int Major, int Minor, int Stepping,
396 list<SubtargetFeature> Implies>
397 : SubtargetFeature <
398 "isaver"#Major#"."#Minor#"."#Stepping,
399 "IsaVersion",
400 "ISAVersion"#Major#"_"#Minor#"_"#Stepping,
401 "Instruction set version number",
402 Implies
403>;
404
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000405def FeatureISAVersion7_0_0 : SubtargetFeatureISAVersion <7,0,0,
Yaxun Liu94add852016-10-26 16:37:56 +0000406 [FeatureSeaIslands,
407 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000408
Yaxun Liu94add852016-10-26 16:37:56 +0000409def FeatureISAVersion7_0_1 : SubtargetFeatureISAVersion <7,0,1,
410 [FeatureSeaIslands,
411 HalfRate64Ops,
412 FeatureLDSBankCount32,
413 FeatureFastFMAF32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000414
Yaxun Liu94add852016-10-26 16:37:56 +0000415def FeatureISAVersion7_0_2 : SubtargetFeatureISAVersion <7,0,2,
416 [FeatureSeaIslands,
Marek Olsak23ae31c2016-12-09 19:49:58 +0000417 FeatureLDSBankCount16]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000418
Yaxun Liu94add852016-10-26 16:37:56 +0000419def FeatureISAVersion8_0_0 : SubtargetFeatureISAVersion <8,0,0,
420 [FeatureVolcanicIslands,
421 FeatureLDSBankCount32,
422 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000423
Yaxun Liu94add852016-10-26 16:37:56 +0000424def FeatureISAVersion8_0_1 : SubtargetFeatureISAVersion <8,0,1,
425 [FeatureVolcanicIslands,
426 FeatureLDSBankCount32,
427 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000428
Yaxun Liu94add852016-10-26 16:37:56 +0000429def FeatureISAVersion8_0_2 : SubtargetFeatureISAVersion <8,0,2,
430 [FeatureVolcanicIslands,
431 FeatureLDSBankCount32,
432 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000433
Yaxun Liu94add852016-10-26 16:37:56 +0000434def FeatureISAVersion8_0_3 : SubtargetFeatureISAVersion <8,0,3,
435 [FeatureVolcanicIslands,
436 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000437
Yaxun Liu94add852016-10-26 16:37:56 +0000438def FeatureISAVersion8_0_4 : SubtargetFeatureISAVersion <8,0,4,
439 [FeatureVolcanicIslands,
440 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000441
Yaxun Liu94add852016-10-26 16:37:56 +0000442def FeatureISAVersion8_1_0 : SubtargetFeatureISAVersion <8,1,0,
443 [FeatureVolcanicIslands,
444 FeatureLDSBankCount16,
445 FeatureXNACK]>;
446
Matt Arsenaulte823d922017-02-18 18:29:53 +0000447def FeatureISAVersion9_0_0 : SubtargetFeatureISAVersion <9,0,0,[]>;
448def FeatureISAVersion9_0_1 : SubtargetFeatureISAVersion <9,0,1,[]>;
449
Tom Stellard3498e4f2013-06-07 20:28:55 +0000450//===----------------------------------------------------------------------===//
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000451// Debugger related subtarget features.
452//===----------------------------------------------------------------------===//
453
454def FeatureDebuggerInsertNops : SubtargetFeature<
455 "amdgpu-debugger-insert-nops",
456 "DebuggerInsertNops",
457 "true",
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +0000458 "Insert one nop instruction for each high level source statement"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000459>;
460
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000461def FeatureDebuggerReserveRegs : SubtargetFeature<
462 "amdgpu-debugger-reserve-regs",
463 "DebuggerReserveRegs",
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000464 "true",
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000465 "Reserve registers for debugger usage"
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000466>;
467
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000468def FeatureDebuggerEmitPrologue : SubtargetFeature<
469 "amdgpu-debugger-emit-prologue",
470 "DebuggerEmitPrologue",
471 "true",
472 "Emit debugger prologue"
473>;
474
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000475//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000476
477def AMDGPUInstrInfo : InstrInfo {
478 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000479 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000480}
481
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000482def AMDGPUAsmParser : AsmParser {
483 // Some of the R600 registers have the same name, so this crashes.
484 // For example T0_XYZW and T0_XY both have the asm name T0.
485 let ShouldEmitMatchRegisterName = 0;
486}
487
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000488def AMDGPUAsmWriter : AsmWriter {
489 int PassSubtarget = 1;
490}
491
Sam Koltond63d8a72016-09-09 09:37:51 +0000492def AMDGPUAsmVariants {
493 string Default = "Default";
494 int Default_ID = 0;
495 string VOP3 = "VOP3";
496 int VOP3_ID = 1;
497 string SDWA = "SDWA";
498 int SDWA_ID = 2;
499 string DPP = "DPP";
500 int DPP_ID = 3;
Sam Koltonfb0d9d92016-09-12 14:42:43 +0000501 string Disable = "Disable";
502 int Disable_ID = 4;
Sam Koltond63d8a72016-09-09 09:37:51 +0000503}
504
505def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
506 let Variant = AMDGPUAsmVariants.Default_ID;
507 let Name = AMDGPUAsmVariants.Default;
508}
509
510def VOP3AsmParserVariant : AsmParserVariant {
511 let Variant = AMDGPUAsmVariants.VOP3_ID;
512 let Name = AMDGPUAsmVariants.VOP3;
513}
514
515def SDWAAsmParserVariant : AsmParserVariant {
516 let Variant = AMDGPUAsmVariants.SDWA_ID;
517 let Name = AMDGPUAsmVariants.SDWA;
518}
519
520def DPPAsmParserVariant : AsmParserVariant {
521 let Variant = AMDGPUAsmVariants.DPP_ID;
522 let Name = AMDGPUAsmVariants.DPP;
523}
524
Tom Stellard75aadc22012-12-11 21:25:42 +0000525def AMDGPU : Target {
526 // Pull in Instruction Info:
527 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000528 let AssemblyParsers = [AMDGPUAsmParser];
Sam Koltond63d8a72016-09-09 09:37:51 +0000529 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
530 VOP3AsmParserVariant,
531 SDWAAsmParserVariant,
532 DPPAsmParserVariant];
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000533 let AssemblyWriters = [AMDGPUAsmWriter];
Tom Stellard75aadc22012-12-11 21:25:42 +0000534}
535
Tom Stellardbc5b5372014-06-13 16:38:59 +0000536// Dummy Instruction itineraries for pseudo instructions
537def ALU_NULL : FuncUnit;
538def NullALU : InstrItinClass;
539
Tom Stellard0e70de52014-05-16 20:56:45 +0000540//===----------------------------------------------------------------------===//
541// Predicate helper class
542//===----------------------------------------------------------------------===//
543
Tom Stellardd1f0f022015-04-23 19:33:54 +0000544def TruePredicate : Predicate<"true">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000545
Tom Stellardd1f0f022015-04-23 19:33:54 +0000546def isSICI : Predicate<
547 "Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
548 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS"
549>, AssemblerPredicate<"FeatureGCN1Encoding">;
550
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000551def isVI : Predicate <
552 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
553 AssemblerPredicate<"FeatureGCN3Encoding">;
554
Matt Arsenaulte823d922017-02-18 18:29:53 +0000555// TODO: Either the name to be changed or we simply use IsCI!
Matt Arsenault382d9452016-01-26 04:49:22 +0000556def isCIVI : Predicate <
Matt Arsenaulte823d922017-02-18 18:29:53 +0000557 "Subtarget->getGeneration() >= AMDGPUSubtarget::SEA_ISLANDS">,
558 AssemblerPredicate<"FeatureCIInsts">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000559
560def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">;
561
Tom Stellard115a6152016-11-10 16:02:37 +0000562def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">;
563
Sam Kolton07dbde22017-01-20 10:01:25 +0000564def HasSDWA : Predicate<"Subtarget->hasSDWA()">,
565 AssemblerPredicate<"FeatureSDWA">;
566
567def HasDPP : Predicate<"Subtarget->hasDPP()">,
568 AssemblerPredicate<"FeatureDPP">;
569
Tom Stellard0e70de52014-05-16 20:56:45 +0000570class PredicateControl {
571 Predicate SubtargetPredicate;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000572 Predicate SIAssemblerPredicate = isSICI;
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000573 Predicate VIAssemblerPredicate = isVI;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000574 list<Predicate> AssemblerPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000575 Predicate AssemblerPredicate = TruePredicate;
Tom Stellard0e70de52014-05-16 20:56:45 +0000576 list<Predicate> OtherPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000577 list<Predicate> Predicates = !listconcat([SubtargetPredicate, AssemblerPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000578 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000579 OtherPredicates);
580}
581
Tom Stellard75aadc22012-12-11 21:25:42 +0000582// Include AMDGPU TD files
583include "R600Schedule.td"
584include "SISchedule.td"
585include "Processors.td"
586include "AMDGPUInstrInfo.td"
587include "AMDGPUIntrinsics.td"
588include "AMDGPURegisterInfo.td"
Tom Stellardca166212017-01-30 21:56:46 +0000589include "AMDGPURegisterBanks.td"
Tom Stellard75aadc22012-12-11 21:25:42 +0000590include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000591include "AMDGPUCallingConv.td"