blob: 740766b151bb61cbfa7d96174e8dce3b624e99a5 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//=- AArch64.td - Describe the AArch64 Target Machine --------*- 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//
10//
11//===----------------------------------------------------------------------===//
12
13//===----------------------------------------------------------------------===//
Pankaj Godea67fea42016-06-15 17:24:52 +000014// Target-independent interfaces which we are implementing.
Tim Northover3b0846e2014-05-24 12:50:23 +000015//===----------------------------------------------------------------------===//
16
17include "llvm/Target/Target.td"
18
19//===----------------------------------------------------------------------===//
20// AArch64 Subtarget features.
21//
22
23def FeatureFPARMv8 : SubtargetFeature<"fp-armv8", "HasFPARMv8", "true",
24 "Enable ARMv8 FP">;
25
26def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
27 "Enable Advanced SIMD instructions", [FeatureFPARMv8]>;
28
29def FeatureCrypto : SubtargetFeature<"crypto", "HasCrypto", "true",
30 "Enable cryptographic instructions">;
31
32def FeatureCRC : SubtargetFeature<"crc", "HasCRC", "true",
33 "Enable ARMv8 CRC-32 checksum instructions">;
34
Sjoerd Meijerd906bf12016-06-03 14:03:27 +000035def FeatureRAS : SubtargetFeature<"ras", "HasRAS", "true",
36 "Enable ARMv8 Reliability, Availability and Serviceability Extensions">;
37
Joel Jones75818bc2016-11-30 22:25:24 +000038def FeatureLSE : SubtargetFeature<"lse", "HasLSE", "true",
39 "Enable ARMv8.1 Large System Extension (LSE) atomic instructions">;
40
Ahmed Bougachab0ff6432015-09-01 16:23:45 +000041def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
42 "Enable ARMv8 PMUv3 Performance Monitors extension">;
43
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +000044def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
45 "Full FP16", [FeatureFPARMv8]>;
46
Oliver Stannarda34e4702015-12-01 10:48:51 +000047def FeatureSPE : SubtargetFeature<"spe", "HasSPE", "true",
48 "Enable Statistical Profiling extension">;
49
Tim Northover3b0846e2014-05-24 12:50:23 +000050/// Cyclone has register move instructions which are "free".
51def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
52 "Has zero-cycle register moves">;
53
54/// Cyclone has instructions which zero registers for "free".
55def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
56 "Has zero-cycle zeroing instructions">;
57
Akira Hatanakaf53b0402015-07-29 14:17:26 +000058def FeatureStrictAlign : SubtargetFeature<"strict-align",
59 "StrictAlign", "true",
60 "Disallow all unaligned memory "
61 "access">;
62
Akira Hatanaka0d4c9ea2015-07-25 00:18:31 +000063def FeatureReserveX18 : SubtargetFeature<"reserve-x18", "ReserveX18", "true",
64 "Reserve X18, making it unavailable "
65 "as a GPR">;
66
Matthias Braun651cff42016-06-02 18:03:53 +000067def FeatureUseAA : SubtargetFeature<"use-aa", "UseAA", "true",
68 "Use alias analysis during codegen">;
69
70def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
71 "true",
72 "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
73
74def FeaturePredictableSelectIsExpensive : SubtargetFeature<
75 "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
76 "Prefer likely predicted branches over selects">;
77
78def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
79 "CustomAsCheapAsMove", "true",
80 "Use custom code for TargetInstrInfo::isAsCheapAsAMove()">;
81
82def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
83 "UsePostRAScheduler", "true", "Schedule again after register allocation">;
84
85def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
86 "Misaligned128StoreIsSlow", "true", "Misaligned 128 bit stores are slow">;
87
88def FeatureAvoidQuadLdStPairs : SubtargetFeature<"no-quad-ldst-pairs",
89 "AvoidQuadLdStPairs", "true",
90 "Do not form quad load/store pair operations">;
91
92def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
93 "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
94 "true", "Use alternative pattern for sextload convert to f32">;
95
Matthias Braun46a52382016-10-04 19:28:21 +000096def FeatureArithmeticBccFusion : SubtargetFeature<
97 "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
98 "CPU fuses arithmetic+bcc operations">;
99
100def FeatureArithmeticCbzFusion : SubtargetFeature<
101 "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
102 "CPU fuses arithmetic + cbz/cbnz operations">;
Matthias Braun651cff42016-06-02 18:03:53 +0000103
104def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
105 "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
106 "Disable latency scheduling heuristic">;
107
Evandro Menezeseff2bd92016-10-24 16:14:58 +0000108def FeatureUseRSqrt : SubtargetFeature<
109 "use-reciprocal-square-root", "UseRSqrt", "true",
110 "Use the reciprocal square root approximation">;
111
Tim Northover3b0846e2014-05-24 12:50:23 +0000112//===----------------------------------------------------------------------===//
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000113// Architectures.
114//
115
116def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
Joel Jones75818bc2016-11-30 22:25:24 +0000117 "Support ARM v8.1a instructions", [FeatureCRC, FeatureLSE]>;
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000118
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000119def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
Sjoerd Meijerd906bf12016-06-03 14:03:27 +0000120 "Support ARM v8.2a instructions", [HasV8_1aOps, FeatureRAS]>;
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000121
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000122//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +0000123// Register File Description
124//===----------------------------------------------------------------------===//
125
126include "AArch64RegisterInfo.td"
127include "AArch64CallingConvention.td"
128
129//===----------------------------------------------------------------------===//
130// Instruction Descriptions
131//===----------------------------------------------------------------------===//
132
133include "AArch64Schedule.td"
134include "AArch64InstrInfo.td"
135
136def AArch64InstrInfo : InstrInfo;
137
138//===----------------------------------------------------------------------===//
Tim Northovere6ae6762016-07-05 21:23:04 +0000139// Named operands for MRS/MSR/TLBI/...
140//===----------------------------------------------------------------------===//
141
142include "AArch64SystemOperands.td"
143
144//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +0000145// AArch64 Processors supported.
146//
147include "AArch64SchedA53.td"
Chad Rosier2205d4e2014-06-11 21:06:56 +0000148include "AArch64SchedA57.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000149include "AArch64SchedCyclone.td"
Chad Rosierd34c26e2016-11-29 20:00:27 +0000150include "AArch64SchedFalkor.td"
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000151include "AArch64SchedKryo.td"
Chad Rosierd34c26e2016-11-29 20:00:27 +0000152include "AArch64SchedM1.td"
Pankaj Godef4b25542016-06-30 06:42:31 +0000153include "AArch64SchedVulcan.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000154
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000155def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
Matthias Braun651cff42016-06-02 18:03:53 +0000156 "Cortex-A35 ARM processors", [
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000157 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000158 FeatureCrypto,
159 FeatureFPARMv8,
160 FeatureNEON,
161 FeaturePerfMon
162 ]>;
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000163
Tim Northover3b0846e2014-05-24 12:50:23 +0000164def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
Matthias Braun651cff42016-06-02 18:03:53 +0000165 "Cortex-A53 ARM processors", [
166 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000167 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000168 FeatureCrypto,
169 FeatureCustomCheapAsMoveHandling,
170 FeatureFPARMv8,
171 FeatureNEON,
172 FeaturePerfMon,
173 FeaturePostRAScheduler,
174 FeatureUseAA
175 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000176
177def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
Matthias Braun651cff42016-06-02 18:03:53 +0000178 "Cortex-A57 ARM processors", [
179 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000180 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000181 FeatureCrypto,
182 FeatureCustomCheapAsMoveHandling,
183 FeatureFPARMv8,
Matthias Braun651cff42016-06-02 18:03:53 +0000184 FeatureNEON,
185 FeaturePerfMon,
186 FeaturePostRAScheduler,
187 FeaturePredictableSelectIsExpensive
188 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000189
Silviu Barangaaee40fc2016-06-21 15:53:54 +0000190def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
191 "Cortex-A72 ARM processors", [
192 FeatureCRC,
193 FeatureCrypto,
194 FeatureFPARMv8,
195 FeatureNEON,
196 FeaturePerfMon
197 ]>;
198
199def ProcA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
200 "Cortex-A73 ARM processors", [
201 FeatureCRC,
202 FeatureCrypto,
203 FeatureFPARMv8,
204 FeatureNEON,
205 FeaturePerfMon
206 ]>;
207
Tim Northover3b0846e2014-05-24 12:50:23 +0000208def ProcCyclone : SubtargetFeature<"cyclone", "ARMProcFamily", "Cyclone",
Matthias Braun651cff42016-06-02 18:03:53 +0000209 "Cyclone", [
210 FeatureAlternateSExtLoadCVTF32Pattern,
Tim Northover3b0846e2014-05-24 12:50:23 +0000211 FeatureCrypto,
Matthias Braun651cff42016-06-02 18:03:53 +0000212 FeatureDisableLatencySchedHeuristic,
213 FeatureFPARMv8,
Matthias Braun46a52382016-10-04 19:28:21 +0000214 FeatureArithmeticBccFusion,
215 FeatureArithmeticCbzFusion,
Matthias Braun651cff42016-06-02 18:03:53 +0000216 FeatureNEON,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000217 FeaturePerfMon,
Matthias Braun651cff42016-06-02 18:03:53 +0000218 FeatureSlowMisaligned128Store,
219 FeatureZCRegMove,
220 FeatureZCZeroing
221 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000222
MinSeong Kima7385eb2016-01-05 12:51:59 +0000223def ProcExynosM1 : SubtargetFeature<"exynosm1", "ARMProcFamily", "ExynosM1",
Evandro Menezesca837032016-10-26 22:06:20 +0000224 "Samsung Exynos-M1 processors",
225 [FeatureAvoidQuadLdStPairs,
226 FeatureCRC,
227 FeatureCrypto,
228 FeatureCustomCheapAsMoveHandling,
229 FeatureFPARMv8,
230 FeatureNEON,
231 FeaturePerfMon,
232 FeaturePostRAScheduler,
Evandro Menezes1b48bac2016-12-16 00:18:00 +0000233 FeatureSlowMisaligned128Store,
Evandro Menezesca837032016-10-26 22:06:20 +0000234 FeatureUseRSqrt,
235 FeatureZCZeroing]>;
236
237def ProcExynosM2 : SubtargetFeature<"exynosm2", "ARMProcFamily", "ExynosM1",
Evandro Menezesaeec7802016-12-13 23:31:41 +0000238 "Samsung Exynos-M2/M3 processors",
Evandro Menezesca837032016-10-26 22:06:20 +0000239 [FeatureAvoidQuadLdStPairs,
240 FeatureCRC,
241 FeatureCrypto,
242 FeatureCustomCheapAsMoveHandling,
243 FeatureFPARMv8,
244 FeatureNEON,
245 FeaturePerfMon,
246 FeaturePostRAScheduler,
Evandro Menezes1b48bac2016-12-16 00:18:00 +0000247 FeatureSlowMisaligned128Store,
Evandro Menezesca837032016-10-26 22:06:20 +0000248 FeatureZCZeroing]>;
MinSeong Kima7385eb2016-01-05 12:51:59 +0000249
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000250def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
Matthias Braun651cff42016-06-02 18:03:53 +0000251 "Qualcomm Kryo processors", [
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000252 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000253 FeatureCrypto,
254 FeatureCustomCheapAsMoveHandling,
255 FeatureFPARMv8,
Matthias Braun651cff42016-06-02 18:03:53 +0000256 FeatureNEON,
257 FeaturePerfMon,
258 FeaturePostRAScheduler,
Haicheng Wu1e395742016-07-12 02:04:01 +0000259 FeaturePredictableSelectIsExpensive,
260 FeatureZCZeroing
Matthias Braun651cff42016-06-02 18:03:53 +0000261 ]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000262
Chad Rosier201fc1e2016-11-15 21:34:12 +0000263def ProcFalkor : SubtargetFeature<"falkor", "ARMProcFamily", "Falkor",
264 "Qualcomm Falkor processors", [
265 FeatureCRC,
266 FeatureCrypto,
Chad Rosier63687e402017-01-04 21:26:23 +0000267 FeatureCustomCheapAsMoveHandling,
Chad Rosier201fc1e2016-11-15 21:34:12 +0000268 FeatureFPARMv8,
269 FeatureNEON,
Chad Rosier63687e402017-01-04 21:26:23 +0000270 FeaturePerfMon,
271 FeaturePostRAScheduler,
272 FeaturePredictableSelectIsExpensive,
273 FeatureZCZeroing
Chad Rosier201fc1e2016-11-15 21:34:12 +0000274 ]>;
275
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000276def ProcVulcan : SubtargetFeature<"vulcan", "ARMProcFamily", "Vulcan",
277 "Broadcom Vulcan processors", [
Pankaj Godef4b25542016-06-30 06:42:31 +0000278 FeatureCRC,
279 FeatureCrypto,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000280 FeatureFPARMv8,
Matthias Braun46a52382016-10-04 19:28:21 +0000281 FeatureArithmeticBccFusion,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000282 FeatureNEON,
Pankaj Godef4b25542016-06-30 06:42:31 +0000283 FeaturePostRAScheduler,
Pankaj Gode1bfca192016-07-19 14:30:21 +0000284 FeaturePredictableSelectIsExpensive,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000285 HasV8_1aOps]>;
286
Matthias Braun651cff42016-06-02 18:03:53 +0000287def : ProcessorModel<"generic", NoSchedModel, [
288 FeatureCRC,
289 FeatureFPARMv8,
290 FeatureNEON,
291 FeaturePerfMon,
292 FeaturePostRAScheduler
293 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000294
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000295// FIXME: Cortex-A35 is currently modelled as a Cortex-A53
296def : ProcessorModel<"cortex-a35", CortexA53Model, [ProcA35]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000297def : ProcessorModel<"cortex-a53", CortexA53Model, [ProcA53]>;
Chad Rosier2205d4e2014-06-11 21:06:56 +0000298def : ProcessorModel<"cortex-a57", CortexA57Model, [ProcA57]>;
Sjoerd Meijer0b7bb162016-06-02 10:48:52 +0000299// FIXME: Cortex-A72 and Cortex-A73 are currently modelled as an Cortex-A57.
Silviu Barangaaee40fc2016-06-21 15:53:54 +0000300def : ProcessorModel<"cortex-a72", CortexA57Model, [ProcA72]>;
301def : ProcessorModel<"cortex-a73", CortexA57Model, [ProcA73]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000302def : ProcessorModel<"cyclone", CycloneModel, [ProcCyclone]>;
Evandro Menezesd761ca22016-02-06 00:01:41 +0000303def : ProcessorModel<"exynos-m1", ExynosM1Model, [ProcExynosM1]>;
Evandro Menezesca837032016-10-26 22:06:20 +0000304def : ProcessorModel<"exynos-m2", ExynosM1Model, [ProcExynosM2]>;
Evandro Menezesaeec7802016-12-13 23:31:41 +0000305def : ProcessorModel<"exynos-m3", ExynosM1Model, [ProcExynosM2]>;
Chad Rosierd34c26e2016-11-29 20:00:27 +0000306def : ProcessorModel<"falkor", FalkorModel, [ProcFalkor]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000307def : ProcessorModel<"kryo", KryoModel, [ProcKryo]>;
Pankaj Godef4b25542016-06-30 06:42:31 +0000308def : ProcessorModel<"vulcan", VulcanModel, [ProcVulcan]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000309
310//===----------------------------------------------------------------------===//
311// Assembly parser
312//===----------------------------------------------------------------------===//
313
314def GenericAsmParserVariant : AsmParserVariant {
315 int Variant = 0;
316 string Name = "generic";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000317 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000318}
319
320def AppleAsmParserVariant : AsmParserVariant {
321 int Variant = 1;
322 string Name = "apple-neon";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000323 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000324}
325
326//===----------------------------------------------------------------------===//
327// Assembly printer
328//===----------------------------------------------------------------------===//
329// AArch64 Uses the MC printer for asm output, so make sure the TableGen
330// AsmWriter bits get associated with the correct class.
331def GenericAsmWriter : AsmWriter {
332 string AsmWriterClassName = "InstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000333 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000334 int Variant = 0;
335 bit isMCAsmWriter = 1;
336}
337
338def AppleAsmWriter : AsmWriter {
339 let AsmWriterClassName = "AppleInstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000340 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000341 int Variant = 1;
342 int isMCAsmWriter = 1;
343}
344
345//===----------------------------------------------------------------------===//
346// Target Declaration
347//===----------------------------------------------------------------------===//
348
349def AArch64 : Target {
350 let InstructionSet = AArch64InstrInfo;
351 let AssemblyParserVariants = [GenericAsmParserVariant, AppleAsmParserVariant];
352 let AssemblyWriters = [GenericAsmWriter, AppleAsmWriter];
353}