blob: 46cd112ad4949b4d1506e373219e681fe787603f [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
Tom Stellard64a9d082016-10-14 18:10:39 +000070def FeatureUnalignedScratchAccess : SubtargetFeature<"unaligned-scratch-access",
71 "UnalignedScratchAccess",
72 "true",
73 "Support unaligned scratch loads and stores"
74>;
75
Marek Olsak0f55fba2016-12-09 19:49:54 +000076// XNACK is disabled if SH_MEM_CONFIG.ADDRESS_MODE = GPUVM on chips that support
77// XNACK. The current default kernel driver setting is:
78// - graphics ring: XNACK disabled
79// - compute ring: XNACK enabled
80//
81// If XNACK is enabled, the VMEM latency can be worse.
82// If XNACK is disabled, the 2 SGPRs can be used for general purposes.
Nicolai Haehnle5b504972016-01-04 23:35:53 +000083def FeatureXNACK : SubtargetFeature<"xnack",
Matt Arsenault382d9452016-01-26 04:49:22 +000084 "EnableXNACK",
85 "true",
86 "Enable XNACK support"
87>;
Tom Stellarde99fb652015-01-20 19:33:04 +000088
Marek Olsak4d00dd22015-03-09 15:48:09 +000089def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
Matt Arsenault382d9452016-01-26 04:49:22 +000090 "SGPRInitBug",
91 "true",
92 "VI SGPR initilization bug requiring a fixed SGPR allocation size"
93>;
Tom Stellardde008d32016-01-21 04:28:34 +000094
Tom Stellard3498e4f2013-06-07 20:28:55 +000095class SubtargetFeatureFetchLimit <string Value> :
96 SubtargetFeature <"fetch"#Value,
Matt Arsenault382d9452016-01-26 04:49:22 +000097 "TexVTXClauseSize",
98 Value,
99 "Limit the maximum number of fetches in a clause to "#Value
100>;
Tom Stellard99792772013-06-07 20:28:49 +0000101
Tom Stellard3498e4f2013-06-07 20:28:55 +0000102def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
103def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
104
Tom Stellard8c347b02014-01-22 21:55:40 +0000105class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +0000106 "wavefrontsize"#Value,
107 "WavefrontSize",
108 !cast<string>(Value),
109 "The number of threads per wavefront"
110>;
Tom Stellard8c347b02014-01-22 21:55:40 +0000111
112def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
113def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
114def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
115
Tom Stellardec87f842015-05-25 16:15:54 +0000116class SubtargetFeatureLDSBankCount <int Value> : SubtargetFeature <
Matt Arsenault382d9452016-01-26 04:49:22 +0000117 "ldsbankcount"#Value,
118 "LDSBankCount",
119 !cast<string>(Value),
120 "The number of LDS banks per compute unit."
121>;
Tom Stellardec87f842015-05-25 16:15:54 +0000122
123def FeatureLDSBankCount16 : SubtargetFeatureLDSBankCount<16>;
124def FeatureLDSBankCount32 : SubtargetFeatureLDSBankCount<32>;
125
Tom Stellard880a80a2014-06-17 16:53:14 +0000126class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +0000127 "localmemorysize"#Value,
128 "LocalMemorySize",
129 !cast<string>(Value),
130 "The size of local memory in bytes"
131>;
Tom Stellard880a80a2014-06-17 16:53:14 +0000132
Tom Stellardd7e6f132015-04-08 01:09:26 +0000133def FeatureGCN : SubtargetFeature<"gcn",
Matt Arsenault382d9452016-01-26 04:49:22 +0000134 "IsGCN",
135 "true",
136 "GCN or newer GPU"
137>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000138
139def FeatureGCN1Encoding : SubtargetFeature<"gcn1-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000140 "GCN1Encoding",
141 "true",
142 "Encoding format for SI and CI"
143>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000144
145def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000146 "GCN3Encoding",
147 "true",
148 "Encoding format for VI"
149>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000150
151def FeatureCIInsts : SubtargetFeature<"ci-insts",
Matt Arsenault382d9452016-01-26 04:49:22 +0000152 "CIInsts",
153 "true",
154 "Additional intstructions for CI+"
155>;
156
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000157def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
158 "HasSMemRealTime",
Matt Arsenault61738cb2016-02-27 08:53:46 +0000159 "true",
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000160 "Has s_memrealtime instruction"
161>;
162
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000163def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
164 "HasInv2PiInlineImm",
165 "true",
166 "Has 1 / (2 * pi) as inline immediate"
167>;
168
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000169def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
170 "Has16BitInsts",
171 "true",
172 "Has i16/f16 instructions"
Matt Arsenault61738cb2016-02-27 08:53:46 +0000173>;
174
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000175def FeatureMovrel : SubtargetFeature<"movrel",
176 "HasMovrel",
177 "true",
178 "Has v_movrel*_b32 instructions"
179>;
180
181def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
182 "HasVGPRIndexMode",
183 "true",
184 "Has VGPR mode register indexing"
185>;
186
Matt Arsenault7b647552016-10-28 21:55:15 +0000187def FeatureScalarStores : SubtargetFeature<"scalar-stores",
188 "HasScalarStores",
189 "true",
190 "Has store scalar memory instructions"
191>;
192
Sam Kolton07dbde22017-01-20 10:01:25 +0000193def FeatureSDWA : SubtargetFeature<"sdwa",
194 "HasSDWA",
195 "true",
196 "Support SDWA (Sub-DWORD Addressing) extension"
197>;
198
199def FeatureDPP : SubtargetFeature<"dpp",
200 "HasDPP",
201 "true",
202 "Support DPP (Data Parallel Primitives) extension"
203>;
204
Matt Arsenault382d9452016-01-26 04:49:22 +0000205//===------------------------------------------------------------===//
206// Subtarget Features (options and debugging)
207//===------------------------------------------------------------===//
208
Konstantin Zhuravlyovf86e4b72016-11-13 07:01:11 +0000209def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
210 "FP16Denormals",
211 "true",
212 "Enable half precision denormal handling"
213>;
214
Matt Arsenault382d9452016-01-26 04:49:22 +0000215// Some instructions do not support denormals despite this flag. Using
216// fp32 denormals also causes instructions to run at the double
217// precision rate for the device.
218def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
219 "FP32Denormals",
220 "true",
221 "Enable single precision denormal handling"
222>;
223
224def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
225 "FP64Denormals",
226 "true",
227 "Enable double precision denormal handling",
228 [FeatureFP64]
229>;
230
Matt Arsenaultf639c322016-01-28 20:53:42 +0000231def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
232 "FPExceptions",
233 "true",
234 "Enable floating point exceptions"
235>;
236
Matt Arsenault24ee0782016-02-12 02:40:47 +0000237class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
238 "max-private-element-size-"#size,
239 "MaxPrivateElementSize",
240 !cast<string>(size),
241 "Maximum private access size may be "#size
242>;
243
244def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
245def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
246def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
247
Matt Arsenault382d9452016-01-26 04:49:22 +0000248def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
249 "EnableVGPRSpilling",
250 "true",
251 "Enable spilling of VGPRs to scratch memory"
252>;
253
254def FeatureDumpCode : SubtargetFeature <"DumpCode",
255 "DumpCode",
256 "true",
257 "Dump MachineInstrs in the CodeEmitter"
258>;
259
260def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
261 "DumpCode",
262 "true",
263 "Dump MachineInstrs in the CodeEmitter"
264>;
265
Matt Arsenault382d9452016-01-26 04:49:22 +0000266def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
267 "EnablePromoteAlloca",
268 "true",
269 "Enable promote alloca pass"
270>;
271
272// XXX - This should probably be removed once enabled by default
273def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
274 "EnableLoadStoreOpt",
275 "true",
276 "Enable SI load/store optimizer pass"
277>;
278
279// Performance debugging feature. Allow using DS instruction immediate
280// offsets even if the base pointer can't be proven to be base. On SI,
281// base pointer values that won't give the same result as a 16-bit add
282// are not safe to fold, but this will override the conservative test
283// for the base pointer.
284def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
285 "unsafe-ds-offset-folding",
286 "EnableUnsafeDSOffsetFolding",
287 "true",
288 "Force using DS instruction immediate offsets on SI"
289>;
290
Matt Arsenault382d9452016-01-26 04:49:22 +0000291def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
292 "EnableSIScheduler",
293 "true",
294 "Enable SI Machine Scheduler"
295>;
296
297def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
298 "FlatForGlobal",
299 "true",
300 "Force to generate flat instruction for global"
301>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000302
303// Dummy feature used to disable assembler instructions.
304def FeatureDisable : SubtargetFeature<"",
Matt Arsenault382d9452016-01-26 04:49:22 +0000305 "FeatureDisable","true",
306 "Dummy feature to disable assembler instructions"
307>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000308
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000309class SubtargetFeatureGeneration <string Value,
310 list<SubtargetFeature> Implies> :
311 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
312 Value#" GPU generation", Implies>;
313
Tom Stellard880a80a2014-06-17 16:53:14 +0000314def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
315def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
316def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
317
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000318def FeatureR600 : SubtargetFeatureGeneration<"R600",
Matt Arsenault382d9452016-01-26 04:49:22 +0000319 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]
320>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000321
322def FeatureR700 : SubtargetFeatureGeneration<"R700",
Matt Arsenault382d9452016-01-26 04:49:22 +0000323 [FeatureFetchLimit16, FeatureLocalMemorySize0]
324>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000325
326def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Matt Arsenault382d9452016-01-26 04:49:22 +0000327 [FeatureFetchLimit16, FeatureLocalMemorySize32768]
328>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000329
330def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000331 [FeatureFetchLimit16, FeatureWavefrontSize64,
332 FeatureLocalMemorySize32768]
Tom Stellard880a80a2014-06-17 16:53:14 +0000333>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000334
335def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000336 [FeatureFP64, FeatureLocalMemorySize32768,
337 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000338 FeatureLDSBankCount32, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000339>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000340
Tom Stellard6e1ee472013-10-29 16:37:28 +0000341def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000342 [FeatureFP64, FeatureLocalMemorySize65536,
343 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000344 FeatureGCN1Encoding, FeatureCIInsts, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000345>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000346
347def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000348 [FeatureFP64, FeatureLocalMemorySize65536,
349 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000350 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
Matt Arsenault7b647552016-10-28 21:55:15 +0000351 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
Sam Kolton07dbde22017-01-20 10:01:25 +0000352 FeatureScalarStores, FeatureInv2PiInlineImm, FeatureSDWA,
353 FeatureDPP
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000354 ]
Matt Arsenault382d9452016-01-26 04:49:22 +0000355>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000356
Yaxun Liu94add852016-10-26 16:37:56 +0000357class SubtargetFeatureISAVersion <int Major, int Minor, int Stepping,
358 list<SubtargetFeature> Implies>
359 : SubtargetFeature <
360 "isaver"#Major#"."#Minor#"."#Stepping,
361 "IsaVersion",
362 "ISAVersion"#Major#"_"#Minor#"_"#Stepping,
363 "Instruction set version number",
364 Implies
365>;
366
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000367def FeatureISAVersion7_0_0 : SubtargetFeatureISAVersion <7,0,0,
Yaxun Liu94add852016-10-26 16:37:56 +0000368 [FeatureSeaIslands,
369 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000370
Yaxun Liu94add852016-10-26 16:37:56 +0000371def FeatureISAVersion7_0_1 : SubtargetFeatureISAVersion <7,0,1,
372 [FeatureSeaIslands,
373 HalfRate64Ops,
374 FeatureLDSBankCount32,
375 FeatureFastFMAF32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000376
Yaxun Liu94add852016-10-26 16:37:56 +0000377def FeatureISAVersion7_0_2 : SubtargetFeatureISAVersion <7,0,2,
378 [FeatureSeaIslands,
Marek Olsak23ae31c2016-12-09 19:49:58 +0000379 FeatureLDSBankCount16]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000380
Yaxun Liu94add852016-10-26 16:37:56 +0000381def FeatureISAVersion8_0_0 : SubtargetFeatureISAVersion <8,0,0,
382 [FeatureVolcanicIslands,
383 FeatureLDSBankCount32,
384 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000385
Yaxun Liu94add852016-10-26 16:37:56 +0000386def FeatureISAVersion8_0_1 : SubtargetFeatureISAVersion <8,0,1,
387 [FeatureVolcanicIslands,
388 FeatureLDSBankCount32,
389 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000390
Yaxun Liu94add852016-10-26 16:37:56 +0000391def FeatureISAVersion8_0_2 : SubtargetFeatureISAVersion <8,0,2,
392 [FeatureVolcanicIslands,
393 FeatureLDSBankCount32,
394 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000395
Yaxun Liu94add852016-10-26 16:37:56 +0000396def FeatureISAVersion8_0_3 : SubtargetFeatureISAVersion <8,0,3,
397 [FeatureVolcanicIslands,
398 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000399
Yaxun Liu94add852016-10-26 16:37:56 +0000400def FeatureISAVersion8_0_4 : SubtargetFeatureISAVersion <8,0,4,
401 [FeatureVolcanicIslands,
402 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000403
Yaxun Liu94add852016-10-26 16:37:56 +0000404def FeatureISAVersion8_1_0 : SubtargetFeatureISAVersion <8,1,0,
405 [FeatureVolcanicIslands,
406 FeatureLDSBankCount16,
407 FeatureXNACK]>;
408
Tom Stellard3498e4f2013-06-07 20:28:55 +0000409//===----------------------------------------------------------------------===//
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000410// Debugger related subtarget features.
411//===----------------------------------------------------------------------===//
412
413def FeatureDebuggerInsertNops : SubtargetFeature<
414 "amdgpu-debugger-insert-nops",
415 "DebuggerInsertNops",
416 "true",
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +0000417 "Insert one nop instruction for each high level source statement"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000418>;
419
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000420def FeatureDebuggerReserveRegs : SubtargetFeature<
421 "amdgpu-debugger-reserve-regs",
422 "DebuggerReserveRegs",
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000423 "true",
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000424 "Reserve registers for debugger usage"
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000425>;
426
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000427def FeatureDebuggerEmitPrologue : SubtargetFeature<
428 "amdgpu-debugger-emit-prologue",
429 "DebuggerEmitPrologue",
430 "true",
431 "Emit debugger prologue"
432>;
433
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000434//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000435
436def AMDGPUInstrInfo : InstrInfo {
437 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000438 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000439}
440
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000441def AMDGPUAsmParser : AsmParser {
442 // Some of the R600 registers have the same name, so this crashes.
443 // For example T0_XYZW and T0_XY both have the asm name T0.
444 let ShouldEmitMatchRegisterName = 0;
445}
446
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000447def AMDGPUAsmWriter : AsmWriter {
448 int PassSubtarget = 1;
449}
450
Sam Koltond63d8a72016-09-09 09:37:51 +0000451def AMDGPUAsmVariants {
452 string Default = "Default";
453 int Default_ID = 0;
454 string VOP3 = "VOP3";
455 int VOP3_ID = 1;
456 string SDWA = "SDWA";
457 int SDWA_ID = 2;
458 string DPP = "DPP";
459 int DPP_ID = 3;
Sam Koltonfb0d9d92016-09-12 14:42:43 +0000460 string Disable = "Disable";
461 int Disable_ID = 4;
Sam Koltond63d8a72016-09-09 09:37:51 +0000462}
463
464def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
465 let Variant = AMDGPUAsmVariants.Default_ID;
466 let Name = AMDGPUAsmVariants.Default;
467}
468
469def VOP3AsmParserVariant : AsmParserVariant {
470 let Variant = AMDGPUAsmVariants.VOP3_ID;
471 let Name = AMDGPUAsmVariants.VOP3;
472}
473
474def SDWAAsmParserVariant : AsmParserVariant {
475 let Variant = AMDGPUAsmVariants.SDWA_ID;
476 let Name = AMDGPUAsmVariants.SDWA;
477}
478
479def DPPAsmParserVariant : AsmParserVariant {
480 let Variant = AMDGPUAsmVariants.DPP_ID;
481 let Name = AMDGPUAsmVariants.DPP;
482}
483
Tom Stellard75aadc22012-12-11 21:25:42 +0000484def AMDGPU : Target {
485 // Pull in Instruction Info:
486 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000487 let AssemblyParsers = [AMDGPUAsmParser];
Sam Koltond63d8a72016-09-09 09:37:51 +0000488 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
489 VOP3AsmParserVariant,
490 SDWAAsmParserVariant,
491 DPPAsmParserVariant];
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000492 let AssemblyWriters = [AMDGPUAsmWriter];
Tom Stellard75aadc22012-12-11 21:25:42 +0000493}
494
Tom Stellardbc5b5372014-06-13 16:38:59 +0000495// Dummy Instruction itineraries for pseudo instructions
496def ALU_NULL : FuncUnit;
497def NullALU : InstrItinClass;
498
Tom Stellard0e70de52014-05-16 20:56:45 +0000499//===----------------------------------------------------------------------===//
500// Predicate helper class
501//===----------------------------------------------------------------------===//
502
Tom Stellardd1f0f022015-04-23 19:33:54 +0000503def TruePredicate : Predicate<"true">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000504
Tom Stellardd1f0f022015-04-23 19:33:54 +0000505def isSICI : Predicate<
506 "Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
507 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS"
508>, AssemblerPredicate<"FeatureGCN1Encoding">;
509
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000510def isVI : Predicate <
511 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
512 AssemblerPredicate<"FeatureGCN3Encoding">;
513
Matt Arsenault382d9452016-01-26 04:49:22 +0000514def isCIVI : Predicate <
515 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS || "
516 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS"
517>, AssemblerPredicate<"FeatureCIInsts">;
518
519def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">;
520
Tom Stellard115a6152016-11-10 16:02:37 +0000521def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">;
522
Sam Kolton07dbde22017-01-20 10:01:25 +0000523def HasSDWA : Predicate<"Subtarget->hasSDWA()">,
524 AssemblerPredicate<"FeatureSDWA">;
525
526def HasDPP : Predicate<"Subtarget->hasDPP()">,
527 AssemblerPredicate<"FeatureDPP">;
528
Tom Stellard0e70de52014-05-16 20:56:45 +0000529class PredicateControl {
530 Predicate SubtargetPredicate;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000531 Predicate SIAssemblerPredicate = isSICI;
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000532 Predicate VIAssemblerPredicate = isVI;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000533 list<Predicate> AssemblerPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000534 Predicate AssemblerPredicate = TruePredicate;
Tom Stellard0e70de52014-05-16 20:56:45 +0000535 list<Predicate> OtherPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000536 list<Predicate> Predicates = !listconcat([SubtargetPredicate, AssemblerPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000537 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000538 OtherPredicates);
539}
540
Tom Stellard75aadc22012-12-11 21:25:42 +0000541// Include AMDGPU TD files
542include "R600Schedule.td"
543include "SISchedule.td"
544include "Processors.td"
545include "AMDGPUInstrInfo.td"
546include "AMDGPUIntrinsics.td"
547include "AMDGPURegisterInfo.td"
548include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000549include "AMDGPUCallingConv.td"