blob: fe67f59feb6edc0f1b610b45ea4fdfead679628f [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
Nicolai Haehnle5b504972016-01-04 23:35:53 +000076def FeatureXNACK : SubtargetFeature<"xnack",
Matt Arsenault382d9452016-01-26 04:49:22 +000077 "EnableXNACK",
78 "true",
79 "Enable XNACK support"
80>;
Tom Stellarde99fb652015-01-20 19:33:04 +000081
Marek Olsak4d00dd22015-03-09 15:48:09 +000082def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
Matt Arsenault382d9452016-01-26 04:49:22 +000083 "SGPRInitBug",
84 "true",
85 "VI SGPR initilization bug requiring a fixed SGPR allocation size"
86>;
Tom Stellardde008d32016-01-21 04:28:34 +000087
Tom Stellard3498e4f2013-06-07 20:28:55 +000088class SubtargetFeatureFetchLimit <string Value> :
89 SubtargetFeature <"fetch"#Value,
Matt Arsenault382d9452016-01-26 04:49:22 +000090 "TexVTXClauseSize",
91 Value,
92 "Limit the maximum number of fetches in a clause to "#Value
93>;
Tom Stellard99792772013-06-07 20:28:49 +000094
Tom Stellard3498e4f2013-06-07 20:28:55 +000095def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
96def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
97
Tom Stellard8c347b02014-01-22 21:55:40 +000098class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +000099 "wavefrontsize"#Value,
100 "WavefrontSize",
101 !cast<string>(Value),
102 "The number of threads per wavefront"
103>;
Tom Stellard8c347b02014-01-22 21:55:40 +0000104
105def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
106def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
107def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
108
Tom Stellardec87f842015-05-25 16:15:54 +0000109class SubtargetFeatureLDSBankCount <int Value> : SubtargetFeature <
Matt Arsenault382d9452016-01-26 04:49:22 +0000110 "ldsbankcount"#Value,
111 "LDSBankCount",
112 !cast<string>(Value),
113 "The number of LDS banks per compute unit."
114>;
Tom Stellardec87f842015-05-25 16:15:54 +0000115
116def FeatureLDSBankCount16 : SubtargetFeatureLDSBankCount<16>;
117def FeatureLDSBankCount32 : SubtargetFeatureLDSBankCount<32>;
118
Tom Stellard880a80a2014-06-17 16:53:14 +0000119class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
Matt Arsenault382d9452016-01-26 04:49:22 +0000120 "localmemorysize"#Value,
121 "LocalMemorySize",
122 !cast<string>(Value),
123 "The size of local memory in bytes"
124>;
Tom Stellard880a80a2014-06-17 16:53:14 +0000125
Tom Stellardd7e6f132015-04-08 01:09:26 +0000126def FeatureGCN : SubtargetFeature<"gcn",
Matt Arsenault382d9452016-01-26 04:49:22 +0000127 "IsGCN",
128 "true",
129 "GCN or newer GPU"
130>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000131
132def FeatureGCN1Encoding : SubtargetFeature<"gcn1-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000133 "GCN1Encoding",
134 "true",
135 "Encoding format for SI and CI"
136>;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000137
138def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
Matt Arsenault382d9452016-01-26 04:49:22 +0000139 "GCN3Encoding",
140 "true",
141 "Encoding format for VI"
142>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000143
144def FeatureCIInsts : SubtargetFeature<"ci-insts",
Matt Arsenault382d9452016-01-26 04:49:22 +0000145 "CIInsts",
146 "true",
147 "Additional intstructions for CI+"
148>;
149
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000150def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
151 "HasSMemRealTime",
Matt Arsenault61738cb2016-02-27 08:53:46 +0000152 "true",
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000153 "Has s_memrealtime instruction"
154>;
155
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000156def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
157 "HasInv2PiInlineImm",
158 "true",
159 "Has 1 / (2 * pi) as inline immediate"
160>;
161
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000162def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
163 "Has16BitInsts",
164 "true",
165 "Has i16/f16 instructions"
Matt Arsenault61738cb2016-02-27 08:53:46 +0000166>;
167
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000168def FeatureMovrel : SubtargetFeature<"movrel",
169 "HasMovrel",
170 "true",
171 "Has v_movrel*_b32 instructions"
172>;
173
174def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
175 "HasVGPRIndexMode",
176 "true",
177 "Has VGPR mode register indexing"
178>;
179
Matt Arsenault7b647552016-10-28 21:55:15 +0000180def FeatureScalarStores : SubtargetFeature<"scalar-stores",
181 "HasScalarStores",
182 "true",
183 "Has store scalar memory instructions"
184>;
185
Matt Arsenault382d9452016-01-26 04:49:22 +0000186//===------------------------------------------------------------===//
187// Subtarget Features (options and debugging)
188//===------------------------------------------------------------===//
189
Konstantin Zhuravlyovf86e4b72016-11-13 07:01:11 +0000190def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
191 "FP16Denormals",
192 "true",
193 "Enable half precision denormal handling"
194>;
195
Matt Arsenault382d9452016-01-26 04:49:22 +0000196// Some instructions do not support denormals despite this flag. Using
197// fp32 denormals also causes instructions to run at the double
198// precision rate for the device.
199def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
200 "FP32Denormals",
201 "true",
202 "Enable single precision denormal handling"
203>;
204
205def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
206 "FP64Denormals",
207 "true",
208 "Enable double precision denormal handling",
209 [FeatureFP64]
210>;
211
Matt Arsenaultf639c322016-01-28 20:53:42 +0000212def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
213 "FPExceptions",
214 "true",
215 "Enable floating point exceptions"
216>;
217
Matt Arsenault24ee0782016-02-12 02:40:47 +0000218class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
219 "max-private-element-size-"#size,
220 "MaxPrivateElementSize",
221 !cast<string>(size),
222 "Maximum private access size may be "#size
223>;
224
225def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
226def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
227def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
228
Matt Arsenault382d9452016-01-26 04:49:22 +0000229def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
230 "EnableVGPRSpilling",
231 "true",
232 "Enable spilling of VGPRs to scratch memory"
233>;
234
235def FeatureDumpCode : SubtargetFeature <"DumpCode",
236 "DumpCode",
237 "true",
238 "Dump MachineInstrs in the CodeEmitter"
239>;
240
241def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
242 "DumpCode",
243 "true",
244 "Dump MachineInstrs in the CodeEmitter"
245>;
246
Matt Arsenault382d9452016-01-26 04:49:22 +0000247def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
248 "EnablePromoteAlloca",
249 "true",
250 "Enable promote alloca pass"
251>;
252
253// XXX - This should probably be removed once enabled by default
254def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
255 "EnableLoadStoreOpt",
256 "true",
257 "Enable SI load/store optimizer pass"
258>;
259
260// Performance debugging feature. Allow using DS instruction immediate
261// offsets even if the base pointer can't be proven to be base. On SI,
262// base pointer values that won't give the same result as a 16-bit add
263// are not safe to fold, but this will override the conservative test
264// for the base pointer.
265def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
266 "unsafe-ds-offset-folding",
267 "EnableUnsafeDSOffsetFolding",
268 "true",
269 "Force using DS instruction immediate offsets on SI"
270>;
271
Matt Arsenault382d9452016-01-26 04:49:22 +0000272def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
273 "EnableSIScheduler",
274 "true",
275 "Enable SI Machine Scheduler"
276>;
277
278def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
279 "FlatForGlobal",
280 "true",
281 "Force to generate flat instruction for global"
282>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000283
284// Dummy feature used to disable assembler instructions.
285def FeatureDisable : SubtargetFeature<"",
Matt Arsenault382d9452016-01-26 04:49:22 +0000286 "FeatureDisable","true",
287 "Dummy feature to disable assembler instructions"
288>;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000289
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000290class SubtargetFeatureGeneration <string Value,
291 list<SubtargetFeature> Implies> :
292 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
293 Value#" GPU generation", Implies>;
294
Tom Stellard880a80a2014-06-17 16:53:14 +0000295def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
296def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
297def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
298
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000299def FeatureR600 : SubtargetFeatureGeneration<"R600",
Matt Arsenault382d9452016-01-26 04:49:22 +0000300 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]
301>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000302
303def FeatureR700 : SubtargetFeatureGeneration<"R700",
Matt Arsenault382d9452016-01-26 04:49:22 +0000304 [FeatureFetchLimit16, FeatureLocalMemorySize0]
305>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000306
307def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Matt Arsenault382d9452016-01-26 04:49:22 +0000308 [FeatureFetchLimit16, FeatureLocalMemorySize32768]
309>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000310
311def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000312 [FeatureFetchLimit16, FeatureWavefrontSize64,
313 FeatureLocalMemorySize32768]
Tom Stellard880a80a2014-06-17 16:53:14 +0000314>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000315
316def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000317 [FeatureFP64, FeatureLocalMemorySize32768,
318 FeatureWavefrontSize64, FeatureGCN, FeatureGCN1Encoding,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000319 FeatureLDSBankCount32, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000320>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000321
Tom Stellard6e1ee472013-10-29 16:37:28 +0000322def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000323 [FeatureFP64, FeatureLocalMemorySize65536,
324 FeatureWavefrontSize64, FeatureGCN, FeatureFlatAddressSpace,
Matt Arsenaultcc88ce32016-10-12 18:00:51 +0000325 FeatureGCN1Encoding, FeatureCIInsts, FeatureMovrel]
Matt Arsenault382d9452016-01-26 04:49:22 +0000326>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000327
328def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
Matt Arsenault382d9452016-01-26 04:49:22 +0000329 [FeatureFP64, FeatureLocalMemorySize65536,
330 FeatureWavefrontSize64, FeatureFlatAddressSpace, FeatureGCN,
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000331 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
Matt Arsenault7b647552016-10-28 21:55:15 +0000332 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
Matt Arsenaultc88ba362016-10-29 04:05:06 +0000333 FeatureScalarStores, FeatureInv2PiInlineImm
Matt Arsenault9d82ee72016-02-27 08:53:55 +0000334 ]
Matt Arsenault382d9452016-01-26 04:49:22 +0000335>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000336
Yaxun Liu94add852016-10-26 16:37:56 +0000337class SubtargetFeatureISAVersion <int Major, int Minor, int Stepping,
338 list<SubtargetFeature> Implies>
339 : SubtargetFeature <
340 "isaver"#Major#"."#Minor#"."#Stepping,
341 "IsaVersion",
342 "ISAVersion"#Major#"_"#Minor#"_"#Stepping,
343 "Instruction set version number",
344 Implies
345>;
346
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000347def FeatureISAVersion7_0_0 : SubtargetFeatureISAVersion <7,0,0,
Yaxun Liu94add852016-10-26 16:37:56 +0000348 [FeatureSeaIslands,
349 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000350
Yaxun Liu94add852016-10-26 16:37:56 +0000351def FeatureISAVersion7_0_1 : SubtargetFeatureISAVersion <7,0,1,
352 [FeatureSeaIslands,
353 HalfRate64Ops,
354 FeatureLDSBankCount32,
355 FeatureFastFMAF32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000356
Yaxun Liu94add852016-10-26 16:37:56 +0000357def FeatureISAVersion7_0_2 : SubtargetFeatureISAVersion <7,0,2,
358 [FeatureSeaIslands,
359 FeatureLDSBankCount16,
360 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000361
Yaxun Liu94add852016-10-26 16:37:56 +0000362def FeatureISAVersion8_0_0 : SubtargetFeatureISAVersion <8,0,0,
363 [FeatureVolcanicIslands,
364 FeatureLDSBankCount32,
365 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000366
Yaxun Liu94add852016-10-26 16:37:56 +0000367def FeatureISAVersion8_0_1 : SubtargetFeatureISAVersion <8,0,1,
368 [FeatureVolcanicIslands,
369 FeatureLDSBankCount32,
370 FeatureXNACK]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000371
Yaxun Liu94add852016-10-26 16:37:56 +0000372def FeatureISAVersion8_0_2 : SubtargetFeatureISAVersion <8,0,2,
373 [FeatureVolcanicIslands,
374 FeatureLDSBankCount32,
375 FeatureSGPRInitBug]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000376
Yaxun Liu94add852016-10-26 16:37:56 +0000377def FeatureISAVersion8_0_3 : SubtargetFeatureISAVersion <8,0,3,
378 [FeatureVolcanicIslands,
379 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000380
Yaxun Liu94add852016-10-26 16:37:56 +0000381def FeatureISAVersion8_0_4 : SubtargetFeatureISAVersion <8,0,4,
382 [FeatureVolcanicIslands,
383 FeatureLDSBankCount32]>;
Matt Arsenaultf3dd8632016-11-01 00:55:14 +0000384
Yaxun Liu94add852016-10-26 16:37:56 +0000385def FeatureISAVersion8_1_0 : SubtargetFeatureISAVersion <8,1,0,
386 [FeatureVolcanicIslands,
387 FeatureLDSBankCount16,
388 FeatureXNACK]>;
389
Tom Stellard3498e4f2013-06-07 20:28:55 +0000390//===----------------------------------------------------------------------===//
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000391// Debugger related subtarget features.
392//===----------------------------------------------------------------------===//
393
394def FeatureDebuggerInsertNops : SubtargetFeature<
395 "amdgpu-debugger-insert-nops",
396 "DebuggerInsertNops",
397 "true",
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +0000398 "Insert one nop instruction for each high level source statement"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000399>;
400
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000401def FeatureDebuggerReserveRegs : SubtargetFeature<
402 "amdgpu-debugger-reserve-regs",
403 "DebuggerReserveRegs",
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000404 "true",
Konstantin Zhuravlyov29ddd2b2016-05-24 18:37:18 +0000405 "Reserve registers for debugger usage"
Konstantin Zhuravlyov1d99c4d2016-04-26 15:43:14 +0000406>;
407
Konstantin Zhuravlyovf2f3d142016-06-25 03:11:28 +0000408def FeatureDebuggerEmitPrologue : SubtargetFeature<
409 "amdgpu-debugger-emit-prologue",
410 "DebuggerEmitPrologue",
411 "true",
412 "Emit debugger prologue"
413>;
414
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +0000415//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000416
417def AMDGPUInstrInfo : InstrInfo {
418 let guessInstructionProperties = 1;
Matt Arsenault1ecac062015-02-18 02:15:32 +0000419 let noNamedPositionallyEncodedOperands = 1;
Tom Stellard75aadc22012-12-11 21:25:42 +0000420}
421
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000422def AMDGPUAsmParser : AsmParser {
423 // Some of the R600 registers have the same name, so this crashes.
424 // For example T0_XYZW and T0_XY both have the asm name T0.
425 let ShouldEmitMatchRegisterName = 0;
426}
427
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000428def AMDGPUAsmWriter : AsmWriter {
429 int PassSubtarget = 1;
430}
431
Sam Koltond63d8a72016-09-09 09:37:51 +0000432def AMDGPUAsmVariants {
433 string Default = "Default";
434 int Default_ID = 0;
435 string VOP3 = "VOP3";
436 int VOP3_ID = 1;
437 string SDWA = "SDWA";
438 int SDWA_ID = 2;
439 string DPP = "DPP";
440 int DPP_ID = 3;
Sam Koltonfb0d9d92016-09-12 14:42:43 +0000441 string Disable = "Disable";
442 int Disable_ID = 4;
Sam Koltond63d8a72016-09-09 09:37:51 +0000443}
444
445def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
446 let Variant = AMDGPUAsmVariants.Default_ID;
447 let Name = AMDGPUAsmVariants.Default;
448}
449
450def VOP3AsmParserVariant : AsmParserVariant {
451 let Variant = AMDGPUAsmVariants.VOP3_ID;
452 let Name = AMDGPUAsmVariants.VOP3;
453}
454
455def SDWAAsmParserVariant : AsmParserVariant {
456 let Variant = AMDGPUAsmVariants.SDWA_ID;
457 let Name = AMDGPUAsmVariants.SDWA;
458}
459
460def DPPAsmParserVariant : AsmParserVariant {
461 let Variant = AMDGPUAsmVariants.DPP_ID;
462 let Name = AMDGPUAsmVariants.DPP;
463}
464
Tom Stellard75aadc22012-12-11 21:25:42 +0000465def AMDGPU : Target {
466 // Pull in Instruction Info:
467 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000468 let AssemblyParsers = [AMDGPUAsmParser];
Sam Koltond63d8a72016-09-09 09:37:51 +0000469 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
470 VOP3AsmParserVariant,
471 SDWAAsmParserVariant,
472 DPPAsmParserVariant];
Konstantin Zhuravlyovda4687c2016-09-27 14:42:48 +0000473 let AssemblyWriters = [AMDGPUAsmWriter];
Tom Stellard75aadc22012-12-11 21:25:42 +0000474}
475
Tom Stellardbc5b5372014-06-13 16:38:59 +0000476// Dummy Instruction itineraries for pseudo instructions
477def ALU_NULL : FuncUnit;
478def NullALU : InstrItinClass;
479
Tom Stellard0e70de52014-05-16 20:56:45 +0000480//===----------------------------------------------------------------------===//
481// Predicate helper class
482//===----------------------------------------------------------------------===//
483
Tom Stellardd1f0f022015-04-23 19:33:54 +0000484def TruePredicate : Predicate<"true">;
Matt Arsenault382d9452016-01-26 04:49:22 +0000485
Tom Stellardd1f0f022015-04-23 19:33:54 +0000486def isSICI : Predicate<
487 "Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
488 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS"
489>, AssemblerPredicate<"FeatureGCN1Encoding">;
490
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000491def isVI : Predicate <
492 "Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
493 AssemblerPredicate<"FeatureGCN3Encoding">;
494
Matt Arsenault382d9452016-01-26 04:49:22 +0000495def isCIVI : Predicate <
496 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS || "
497 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS"
498>, AssemblerPredicate<"FeatureCIInsts">;
499
500def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">;
501
Tom Stellard115a6152016-11-10 16:02:37 +0000502def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">;
503
Tom Stellard0e70de52014-05-16 20:56:45 +0000504class PredicateControl {
505 Predicate SubtargetPredicate;
Tom Stellardd1f0f022015-04-23 19:33:54 +0000506 Predicate SIAssemblerPredicate = isSICI;
Tom Stellard5ebdfbe2015-12-24 03:18:18 +0000507 Predicate VIAssemblerPredicate = isVI;
Tom Stellardd7e6f132015-04-08 01:09:26 +0000508 list<Predicate> AssemblerPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000509 Predicate AssemblerPredicate = TruePredicate;
Tom Stellard0e70de52014-05-16 20:56:45 +0000510 list<Predicate> OtherPredicates = [];
Tom Stellardd1f0f022015-04-23 19:33:54 +0000511 list<Predicate> Predicates = !listconcat([SubtargetPredicate, AssemblerPredicate],
Tom Stellardd7e6f132015-04-08 01:09:26 +0000512 AssemblerPredicates,
Tom Stellard0e70de52014-05-16 20:56:45 +0000513 OtherPredicates);
514}
515
Tom Stellard75aadc22012-12-11 21:25:42 +0000516// Include AMDGPU TD files
517include "R600Schedule.td"
518include "SISchedule.td"
519include "Processors.td"
520include "AMDGPUInstrInfo.td"
521include "AMDGPUIntrinsics.td"
522include "AMDGPURegisterInfo.td"
523include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000524include "AMDGPUCallingConv.td"