blob: 1df4448abf05e6d023a06bbbb62f9edaa2f855c9 [file] [log] [blame]
Tom Stellard75aadc22012-12-11 21:25:42 +00001//===-- AMDIL.td - AMDIL Tablegen files --*- tablegen -*-------------------===//
2//
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//
8//==-----------------------------------------------------------------------===//
9
Tom Stellardbc5b5372014-06-13 16:38:59 +000010include "llvm/Target/Target.td"
Tom Stellard75aadc22012-12-11 21:25:42 +000011
Tom Stellard99792772013-06-07 20:28:49 +000012//===----------------------------------------------------------------------===//
13// Subtarget Features
14//===----------------------------------------------------------------------===//
15
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000016// Debugging Features
17
18def FeatureDumpCode : SubtargetFeature <"DumpCode",
19 "DumpCode",
20 "true",
21 "Dump MachineInstrs in the CodeEmitter">;
22
Tom Stellard66df8a22013-11-18 19:43:44 +000023def FeatureIRStructurizer : SubtargetFeature <"disable-irstructurizer",
Tom Stellarded0ceec2013-10-10 17:11:12 +000024 "EnableIRStructurizer",
Tom Stellard66df8a22013-11-18 19:43:44 +000025 "false",
26 "Disable IR Structurizer">;
Tom Stellarded0ceec2013-10-10 17:11:12 +000027
Matt Arsenaultd9a23ab2014-07-13 02:08:26 +000028def FeaturePromoteAlloca : SubtargetFeature <"promote-alloca",
29 "EnablePromoteAlloca",
30 "true",
31 "Enable promote alloca pass">;
32
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000033// Target features
34
Tom Stellard783893a2013-11-18 19:43:33 +000035def FeatureIfCvt : SubtargetFeature <"disable-ifcvt",
36 "EnableIfCvt",
37 "false",
38 "Disable the if conversion pass">;
39
Matt Arsenaultf5e29972014-06-20 06:50:05 +000040def FeatureFP64 : SubtargetFeature<"fp64",
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000041 "FP64",
Tom Stellard99792772013-06-07 20:28:49 +000042 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000043 "Enable double precision operations">;
Tom Stellard99792772013-06-07 20:28:49 +000044
Matt Arsenaultf171cf22014-07-14 23:40:49 +000045def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
46 "FP64Denormals",
47 "true",
48 "Enable double precision denormal handling",
49 [FeatureFP64]>;
50
51// Some instructions do not support denormals despite this flag. Using
52// fp32 denormals also causes instructions to run at the double
53// precision rate for the device.
54def FeatureFP32Denormals : SubtargetFeature<"fp32-denormals",
55 "FP32Denormals",
56 "true",
57 "Enable single precision denormal handling">;
58
Tom Stellard99792772013-06-07 20:28:49 +000059def Feature64BitPtr : SubtargetFeature<"64BitPtr",
60 "Is64bit",
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000061 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000062 "Specify if 64-bit addressing should be used">;
Tom Stellard99792772013-06-07 20:28:49 +000063
64def FeatureR600ALUInst : SubtargetFeature<"R600ALUInst",
65 "R600ALUInst",
66 "false",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000067 "Older version of ALU instructions encoding">;
Tom Stellard99792772013-06-07 20:28:49 +000068
69def FeatureVertexCache : SubtargetFeature<"HasVertexCache",
70 "HasVertexCache",
71 "true",
Matt Arsenaultf5e29972014-06-20 06:50:05 +000072 "Specify use of dedicated vertex cache">;
Tom Stellard99792772013-06-07 20:28:49 +000073
Tom Stellarda6c6e1b2013-06-07 20:37:48 +000074def FeatureCaymanISA : SubtargetFeature<"caymanISA",
75 "CaymanISA",
76 "true",
77 "Use Cayman ISA">;
78
Tom Stellard348273d2014-01-23 16:18:02 +000079def FeatureCFALUBug : SubtargetFeature<"cfalubug",
80 "CFALUBug",
81 "true",
82 "GPU has CF_ALU bug">;
83
Matt Arsenault41033282014-10-10 22:01:59 +000084// XXX - This should probably be removed once enabled by default
85def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
86 "EnableLoadStoreOpt",
87 "true",
88 "Enable SI load/store optimizer pass">;
89
Matt Arsenault3f981402014-09-15 15:41:53 +000090def FeatureFlatAddressSpace : SubtargetFeature<"flat-address-space",
91 "FlatAddressSpace",
92 "true",
93 "Support flat address space">;
94
Tom Stellarde99fb652015-01-20 19:33:04 +000095def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling",
96 "EnableVGPRSpilling",
97 "true",
98 "Enable spilling of VGPRs to scratch memory">;
99
Tom Stellard3498e4f2013-06-07 20:28:55 +0000100class SubtargetFeatureFetchLimit <string Value> :
101 SubtargetFeature <"fetch"#Value,
102 "TexVTXClauseSize",
103 Value,
104 "Limit the maximum number of fetches in a clause to "#Value>;
Tom Stellard99792772013-06-07 20:28:49 +0000105
Tom Stellard3498e4f2013-06-07 20:28:55 +0000106def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
107def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
108
Tom Stellard8c347b02014-01-22 21:55:40 +0000109class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
110 "wavefrontsize"#Value,
111 "WavefrontSize",
112 !cast<string>(Value),
113 "The number of threads per wavefront">;
114
115def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
116def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
117def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
118
Tom Stellard880a80a2014-06-17 16:53:14 +0000119class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
120 "localmemorysize"#Value,
121 "LocalMemorySize",
122 !cast<string>(Value),
123 "The size of local memory in bytes">;
124
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000125class SubtargetFeatureGeneration <string Value,
126 list<SubtargetFeature> Implies> :
127 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
128 Value#" GPU generation", Implies>;
129
Tom Stellard880a80a2014-06-17 16:53:14 +0000130def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
131def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
132def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
133
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000134def FeatureR600 : SubtargetFeatureGeneration<"R600",
Tom Stellard880a80a2014-06-17 16:53:14 +0000135 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000136
137def FeatureR700 : SubtargetFeatureGeneration<"R700",
Tom Stellard880a80a2014-06-17 16:53:14 +0000138 [FeatureFetchLimit16, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000139
140def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Tom Stellard880a80a2014-06-17 16:53:14 +0000141 [FeatureFetchLimit16, FeatureLocalMemorySize32768]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000142
143def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Tom Stellard880a80a2014-06-17 16:53:14 +0000144 [FeatureFetchLimit16, FeatureWavefrontSize64,
145 FeatureLocalMemorySize32768]
146>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000147
148def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000149 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize32768,
150 FeatureWavefrontSize64]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000151
Tom Stellard6e1ee472013-10-29 16:37:28 +0000152def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000153 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize65536,
Matt Arsenault3f981402014-09-15 15:41:53 +0000154 FeatureWavefrontSize64, FeatureFlatAddressSpace]>;
Marek Olsak5df00d62014-12-07 12:18:57 +0000155
156def FeatureVolcanicIslands : SubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
157 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize65536,
158 FeatureWavefrontSize64, FeatureFlatAddressSpace]>;
159
Tom Stellard3498e4f2013-06-07 20:28:55 +0000160//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000161
162def AMDGPUInstrInfo : InstrInfo {
163 let guessInstructionProperties = 1;
164}
165
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000166def AMDGPUAsmParser : AsmParser {
167 // Some of the R600 registers have the same name, so this crashes.
168 // For example T0_XYZW and T0_XY both have the asm name T0.
169 let ShouldEmitMatchRegisterName = 0;
170}
171
Tom Stellard75aadc22012-12-11 21:25:42 +0000172def AMDGPU : Target {
173 // Pull in Instruction Info:
174 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000175 let AssemblyParsers = [AMDGPUAsmParser];
Tom Stellard75aadc22012-12-11 21:25:42 +0000176}
177
Tom Stellardbc5b5372014-06-13 16:38:59 +0000178// Dummy Instruction itineraries for pseudo instructions
179def ALU_NULL : FuncUnit;
180def NullALU : InstrItinClass;
181
Tom Stellard0e70de52014-05-16 20:56:45 +0000182//===----------------------------------------------------------------------===//
183// Predicate helper class
184//===----------------------------------------------------------------------===//
185
186class PredicateControl {
187 Predicate SubtargetPredicate;
188 list<Predicate> OtherPredicates = [];
189 list<Predicate> Predicates = !listconcat([SubtargetPredicate],
190 OtherPredicates);
191}
192
Tom Stellard75aadc22012-12-11 21:25:42 +0000193// Include AMDGPU TD files
194include "R600Schedule.td"
195include "SISchedule.td"
196include "Processors.td"
197include "AMDGPUInstrInfo.td"
198include "AMDGPUIntrinsics.td"
199include "AMDGPURegisterInfo.td"
200include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000201include "AMDGPUCallingConv.td"