blob: 0b2badff7ccf6c26571350fedc47b80019bb4102 [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
Matt Arsenault382d9452016-01-26 04:49:22 +0000193//===------------------------------------------------------------===//
194// Subtarget Features (options and debugging)
195//===------------------------------------------------------------===//
196
Konstantin Zhuravlyovf86e4b72016-11-13 07:01:11 +0000197def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
198 "FP16Denormals",
199 "true",
200 "Enable half precision denormal handling"
201>;
202
Matt Arsenault382d9452016-01-26 04:49:22 +0000203// Some instructions do not support denormals despite this flag. Using
204// fp32 denormals also causes instructions to run at the double
205// precision rate for the device.
206def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
207 "FP32Denormals",
208 "true",
209 "Enable single precision denormal handling"
210>;
211
212def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
213 "FP64Denormals",
214 "true",
215 "Enable double precision denormal handling",
216 [FeatureFP64]
217>;
218
Matt Arsenaultf639c322016-01-28 20:53:42 +0000219def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
220 "FPExceptions",
221 "true",
222 "Enable floating point exceptions"
223>;
224
Matt Arsenault24ee0782016-02-12 02:40:47 +0000225class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
226 "max-private-element-size-"#size,
227 "MaxPrivateElementSize",
228 !cast<string>(size),
229 "Maximum private access size may be "#size
230>;
231
232def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
233def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
234def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
235
Matt Arsenault382d9452016-01-26 04:49:22 +0000236def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
237 "EnableVGPRSpilling",
238 "true",
239 "Enable spilling of VGPRs to scratch memory"
240>;
241
242def FeatureDumpCode : SubtargetFeature <"DumpCode",
243 "DumpCode",
244 "true",
245 "Dump MachineInstrs in the CodeEmitter"
246>;
247
248def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
249 "DumpCode",
250 "true",
251 "Dump MachineInstrs in the CodeEmitter"
252>;
253
Matt Arsenault382d9452016-01-26 04:49:22 +0000254def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
255 "EnablePromoteAlloca",
256 "true",
257 "Enable promote alloca pass"
258>;
259
260// XXX - This should probably be removed once enabled by default
261def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
262 "EnableLoadStoreOpt",
263 "true",
264 "Enable SI load/store optimizer pass"
265>;
266
267// Performance debugging feature. Allow using DS instruction immediate
268// offsets even if the base pointer can't be proven to be base. On SI,
269// base pointer values that won't give the same result as a 16-bit add
270// are not safe to fold, but this will override the conservative test
271// for the base pointer.
272def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
273 "unsafe-ds-offset-folding",
274 "EnableUnsafeDSOffsetFolding",
275 "true",
276 "Force using DS instruction immediate offsets on SI"
277>;
278
Matt Arsenault382d9452016-01-26 04:49:22 +0000279def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
280 "EnableSIScheduler",
281 "true",
282 "Enable SI Machine Scheduler"
283>;
284
285def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
286 "FlatForGlobal",
287 "true",
288 "Force to generate flat instruction for global"
289>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000290
291// Dummy feature used to disable assembler instructions.
292def FeatureDisable : SubtargetFeature<"",
Matt Arsenault382d9452016-01-26 04:49:22 +0000293 "FeatureDisable","true",
294 "Dummy feature to disable assembler instructions"
295>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000296
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000297class SubtargetFeatureGeneration <string Value,
298 list<SubtargetFeature> Implies> :
299 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
300 Value#" GPU generation", Implies>;
301
Tom Stellard880a80a2014-06-17 16:53:14 +0000302def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
303def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
304def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
305
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000306def FeatureR600 : SubtargetFeatureGeneration<"R600",
Matt Arsenault382d9452016-01-26 04:49:22 +0000307 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]
308>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000309
310def FeatureR700 : SubtargetFeatureGeneration<"R700",
Matt Arsenault382d9452016-01-26 04:49:22 +0000311 [FeatureFetchLimit16, FeatureLocalMemorySize0]
312>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000313
314def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Matt Arsenault382d9452016-01-26 04:49:22 +0000315 [FeatureFetchLimit16, FeatureLocalMemorySize32768]
316>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000317
318def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000319 [FeatureFetchLimit16, FeatureWavefrontSize64,
320 FeatureLocalMemorySize32768]
Tom Stellard880a80a2014-06-17 16:53:14 +0000321>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000322
323def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000324 [FeatureFP64, FeatureLocalMemorySize32768,
325 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000326 FeatureLDSBankCount32, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000327>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000328
Tom Stellard6e1ee472013-10-29 16:37:28 +0000329def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000330 [FeatureFP64, FeatureLocalMemorySize65536,
331 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000332 FeatureGCN1Encoding, FeatureCIInsts, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000333>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000334
335def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000336 [FeatureFP64, FeatureLocalMemorySize65536,
337 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000338 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
Matt Arsenault7b647552016-10-28 21:55:15 +0000339 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000340 FeatureScalarStores, FeatureInv2PiInlineImm
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000341 ]
Matt Arsenault382d9452016-01-26 04:49:22 +0000342>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000343
Yaxun Liu94add852016-10-26 16:37:56 +0000344class SubtargetFeatureISAVersion <int Major, int Minor, int Stepping,
345 list<SubtargetFeature> Implies>
346 : SubtargetFeature <
347 "isaver"#Major#"."#Minor#"."#Stepping,
348 "IsaVersion",
349 "ISAVersion"#Major#"_"#Minor#"_"#Stepping,
350 "Instruction set version number",
351 Implies
352>;
353
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000354def FeatureISAVersion7_0_0 : SubtargetFeatureISAVersion <7,0,0,
Yaxun Liu94add852016-10-26 16:37:56 +0000355 [FeatureSeaIslands,
356 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000357
Yaxun Liu94add852016-10-26 16:37:56 +0000358def FeatureISAVersion7_0_1 : SubtargetFeatureISAVersion <7,0,1,
359 [FeatureSeaIslands,
360 HalfRate64Ops,
361 FeatureLDSBankCount32,
362 FeatureFastFMAF32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000363
Yaxun Liu94add852016-10-26 16:37:56 +0000364def FeatureISAVersion7_0_2 : SubtargetFeatureISAVersion <7,0,2,
365 [FeatureSeaIslands,
Marek Olsak23ae31c2016-12-09 19:49:58 +0000366 FeatureLDSBankCount16]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000367
Yaxun Liu94add852016-10-26 16:37:56 +0000368def FeatureISAVersion8_0_0 : SubtargetFeatureISAVersion <8,0,0,
369 [FeatureVolcanicIslands,
370 FeatureLDSBankCount32,
371 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000372
Yaxun Liu94add852016-10-26 16:37:56 +0000373def FeatureISAVersion8_0_1 : SubtargetFeatureISAVersion <8,0,1,
374 [FeatureVolcanicIslands,
375 FeatureLDSBankCount32,
376 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000377
Yaxun Liu94add852016-10-26 16:37:56 +0000378def FeatureISAVersion8_0_2 : SubtargetFeatureISAVersion <8,0,2,
379 [FeatureVolcanicIslands,
380 FeatureLDSBankCount32,
381 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000382
Yaxun Liu94add852016-10-26 16:37:56 +0000383def FeatureISAVersion8_0_3 : SubtargetFeatureISAVersion <8,0,3,
384 [FeatureVolcanicIslands,
385 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000386
Yaxun Liu94add852016-10-26 16:37:56 +0000387def FeatureISAVersion8_0_4 : SubtargetFeatureISAVersion <8,0,4,
388 [FeatureVolcanicIslands,
389 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000390
Yaxun Liu94add852016-10-26 16:37:56 +0000391def FeatureISAVersion8_1_0 : SubtargetFeatureISAVersion <8,1,0,
392 [FeatureVolcanicIslands,
393 FeatureLDSBankCount16,
394 FeatureXNACK]>;
395
Tom Stellard3498e4f2013-06-07 20:28:55 +0000396//===----------------------------------------------------------------------===//
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000397// Debugger related subtarget features.
398//===----------------------------------------------------------------------===//
399
400def FeatureDebuggerInsertNops : SubtargetFeature<
401 "amdgpu-debugger-insert-nops",
402 "DebuggerInsertNops",
403 "true",
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +0000404 "Insert one nop instruction for each high level source statement"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000405>;
406
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000407def FeatureDebuggerReserveRegs : SubtargetFeature<
408 "amdgpu-debugger-reserve-regs",
409 "DebuggerReserveRegs",
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000410 "true",
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000411 "Reserve registers for debugger usage"
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000412>;
413
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000414def FeatureDebuggerEmitPrologue : SubtargetFeature<
415 "amdgpu-debugger-emit-prologue",
416 "DebuggerEmitPrologue",
417 "true",
418 "Emit debugger prologue"
419>;
420
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000421//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000422
423def AMDGPUInstrInfo : InstrInfo {
424 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000425 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000426}
427
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000428def AMDGPUAsmParser : AsmParser {
429 // Some of the R600 registers have the same name, so this crashes.
430 // For example T0_XYZW and T0_XY both have the asm name T0.
431 let ShouldEmitMatchRegisterName = 0;
432}
433
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000434def AMDGPUAsmWriter : AsmWriter {
435 int PassSubtarget = 1;
436}
437
Sam Koltond63d8a72016-09-09 09:37:51 +0000438def AMDGPUAsmVariants {
439 string Default = "Default";
440 int Default_ID = 0;
441 string VOP3 = "VOP3";
442 int VOP3_ID = 1;
443 string SDWA = "SDWA";
444 int SDWA_ID = 2;
445 string DPP = "DPP";
446 int DPP_ID = 3;
Sam Koltonfb0d9d92016-09-12 14:42:43 +0000447 string Disable = "Disable";
448 int Disable_ID = 4;
Sam Koltond63d8a72016-09-09 09:37:51 +0000449}
450
451def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
452 let Variant = AMDGPUAsmVariants.Default_ID;
453 let Name = AMDGPUAsmVariants.Default;
454}
455
456def VOP3AsmParserVariant : AsmParserVariant {
457 let Variant = AMDGPUAsmVariants.VOP3_ID;
458 let Name = AMDGPUAsmVariants.VOP3;
459}
460
461def SDWAAsmParserVariant : AsmParserVariant {
462 let Variant = AMDGPUAsmVariants.SDWA_ID;
463 let Name = AMDGPUAsmVariants.SDWA;
464}
465
466def DPPAsmParserVariant : AsmParserVariant {
467 let Variant = AMDGPUAsmVariants.DPP_ID;
468 let Name = AMDGPUAsmVariants.DPP;
469}
470
Tom Stellard75aadc22012-12-11 21:25:42 +0000471def AMDGPU : Target {
472 // Pull in Instruction Info:
473 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000474 let AssemblyParsers = [AMDGPUAsmParser];
Sam Koltond63d8a72016-09-09 09:37:51 +0000475 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
476 VOP3AsmParserVariant,
477 SDWAAsmParserVariant,
478 DPPAsmParserVariant];
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000479 let AssemblyWriters = [AMDGPUAsmWriter];
Tom Stellard75aadc22012-12-11 21:25:42 +0000480}
481
Tom Stellardbc5b5372014-06-13 16:38:59 +0000482// Dummy Instruction itineraries for pseudo instructions
483def ALU_NULL : FuncUnit;
484def NullALU : InstrItinClass;
485
Tom Stellard0e70de52014-05-16 20:56:45 +0000486//===----------------------------------------------------------------------===//
487// Predicate helper class
488//===----------------------------------------------------------------------===//
489
Tom Stellardd1f0f022015-04-23 19:33:54 +0000490def TruePredicate : Predicate<"true">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000491
Tom Stellardd1f0f022015-04-23 19:33:54 +0000492def isSICI : Predicate<
493 "Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
494 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS"
495>, AssemblerPredicate<"FeatureGCN1Encoding">;
496
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000497def isVI : Predicate <
498 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
499 AssemblerPredicate<"FeatureGCN3Encoding">;
500
Matt Arsenault382d9452016-01-26 04:49:22 +0000501def isCIVI : Predicate <
502 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS || "
503 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS"
504>, AssemblerPredicate<"FeatureCIInsts">;
505
506def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">;
507
Tom Stellard115a6152016-11-10 16:02:37 +0000508def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">;
509
Tom Stellard0e70de52014-05-16 20:56:45 +0000510class PredicateControl {
511 Predicate SubtargetPredicate;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000512 Predicate SIAssemblerPredicate = isSICI;
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000513 Predicate VIAssemblerPredicate = isVI;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000514 list<Predicate> AssemblerPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000515 Predicate AssemblerPredicate = TruePredicate;
Tom Stellard0e70de52014-05-16 20:56:45 +0000516 list<Predicate> OtherPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000517 list<Predicate> Predicates = !listconcat([SubtargetPredicate, AssemblerPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000518 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000519 OtherPredicates);
520}
521
Tom Stellard75aadc22012-12-11 21:25:42 +0000522// Include AMDGPU TD files
523include "R600Schedule.td"
524include "SISchedule.td"
525include "Processors.td"
526include "AMDGPUInstrInfo.td"
527include "AMDGPUIntrinsics.td"
528include "AMDGPURegisterInfo.td"
529include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000530include "AMDGPUCallingConv.td"