blob: 4cf12430d9df2c1c27a16982231b01179621f0d0 [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 Stellard3498e4f2013-06-07 20:28:55 +000095class SubtargetFeatureFetchLimit <string Value> :
96 SubtargetFeature <"fetch"#Value,
97 "TexVTXClauseSize",
98 Value,
99 "Limit the maximum number of fetches in a clause to "#Value>;
Tom Stellard99792772013-06-07 20:28:49 +0000100
Tom Stellard3498e4f2013-06-07 20:28:55 +0000101def FeatureFetchLimit8 : SubtargetFeatureFetchLimit <"8">;
102def FeatureFetchLimit16 : SubtargetFeatureFetchLimit <"16">;
103
Tom Stellard8c347b02014-01-22 21:55:40 +0000104class SubtargetFeatureWavefrontSize <int Value> : SubtargetFeature<
105 "wavefrontsize"#Value,
106 "WavefrontSize",
107 !cast<string>(Value),
108 "The number of threads per wavefront">;
109
110def FeatureWavefrontSize16 : SubtargetFeatureWavefrontSize<16>;
111def FeatureWavefrontSize32 : SubtargetFeatureWavefrontSize<32>;
112def FeatureWavefrontSize64 : SubtargetFeatureWavefrontSize<64>;
113
Tom Stellard880a80a2014-06-17 16:53:14 +0000114class SubtargetFeatureLocalMemorySize <int Value> : SubtargetFeature<
115 "localmemorysize"#Value,
116 "LocalMemorySize",
117 !cast<string>(Value),
118 "The size of local memory in bytes">;
119
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000120class SubtargetFeatureGeneration <string Value,
121 list<SubtargetFeature> Implies> :
122 SubtargetFeature <Value, "Gen", "AMDGPUSubtarget::"#Value,
123 Value#" GPU generation", Implies>;
124
Tom Stellard880a80a2014-06-17 16:53:14 +0000125def FeatureLocalMemorySize0 : SubtargetFeatureLocalMemorySize<0>;
126def FeatureLocalMemorySize32768 : SubtargetFeatureLocalMemorySize<32768>;
127def FeatureLocalMemorySize65536 : SubtargetFeatureLocalMemorySize<65536>;
128
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000129def FeatureR600 : SubtargetFeatureGeneration<"R600",
Tom Stellard880a80a2014-06-17 16:53:14 +0000130 [FeatureR600ALUInst, FeatureFetchLimit8, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000131
132def FeatureR700 : SubtargetFeatureGeneration<"R700",
Tom Stellard880a80a2014-06-17 16:53:14 +0000133 [FeatureFetchLimit16, FeatureLocalMemorySize0]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000134
135def FeatureEvergreen : SubtargetFeatureGeneration<"EVERGREEN",
Tom Stellard880a80a2014-06-17 16:53:14 +0000136 [FeatureFetchLimit16, FeatureLocalMemorySize32768]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000137
138def FeatureNorthernIslands : SubtargetFeatureGeneration<"NORTHERN_ISLANDS",
Tom Stellard880a80a2014-06-17 16:53:14 +0000139 [FeatureFetchLimit16, FeatureWavefrontSize64,
140 FeatureLocalMemorySize32768]
141>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000142
143def FeatureSouthernIslands : SubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000144 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize32768,
145 FeatureWavefrontSize64]>;
Tom Stellarda6c6e1b2013-06-07 20:37:48 +0000146
Tom Stellard6e1ee472013-10-29 16:37:28 +0000147def FeatureSeaIslands : SubtargetFeatureGeneration<"SEA_ISLANDS",
Tom Stellard42639a52014-07-21 15:44:58 +0000148 [Feature64BitPtr, FeatureFP64, FeatureLocalMemorySize65536,
Matt Arsenault3f981402014-09-15 15:41:53 +0000149 FeatureWavefrontSize64, FeatureFlatAddressSpace]>;
Tom Stellard3498e4f2013-06-07 20:28:55 +0000150//===----------------------------------------------------------------------===//
Tom Stellard75aadc22012-12-11 21:25:42 +0000151
152def AMDGPUInstrInfo : InstrInfo {
153 let guessInstructionProperties = 1;
154}
155
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000156def AMDGPUAsmParser : AsmParser {
157 // Some of the R600 registers have the same name, so this crashes.
158 // For example T0_XYZW and T0_XY both have the asm name T0.
159 let ShouldEmitMatchRegisterName = 0;
160}
161
Tom Stellard75aadc22012-12-11 21:25:42 +0000162def AMDGPU : Target {
163 // Pull in Instruction Info:
164 let InstructionSet = AMDGPUInstrInfo;
Tom Stellard9d7ddd52014-11-14 14:08:00 +0000165 let AssemblyParsers = [AMDGPUAsmParser];
Tom Stellard75aadc22012-12-11 21:25:42 +0000166}
167
Tom Stellardbc5b5372014-06-13 16:38:59 +0000168// Dummy Instruction itineraries for pseudo instructions
169def ALU_NULL : FuncUnit;
170def NullALU : InstrItinClass;
171
Tom Stellard0e70de52014-05-16 20:56:45 +0000172//===----------------------------------------------------------------------===//
173// Predicate helper class
174//===----------------------------------------------------------------------===//
175
176class PredicateControl {
177 Predicate SubtargetPredicate;
178 list<Predicate> OtherPredicates = [];
179 list<Predicate> Predicates = !listconcat([SubtargetPredicate],
180 OtherPredicates);
181}
182
Tom Stellard75aadc22012-12-11 21:25:42 +0000183// Include AMDGPU TD files
184include "R600Schedule.td"
185include "SISchedule.td"
186include "Processors.td"
187include "AMDGPUInstrInfo.td"
188include "AMDGPUIntrinsics.td"
189include "AMDGPURegisterInfo.td"
190include "AMDGPUInstructions.td"
Christian Konig2c8f6d52013-03-07 09:03:52 +0000191include "AMDGPUCallingConv.td"