blob: 4235e59cdc2e43105402a863944c4b5e4fb54605 [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
Ahmed Bougachab0ff6432015-09-01 16:23:45 +000038def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
39 "Enable ARMv8 PMUv3 Performance Monitors extension">;
40
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +000041def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
42 "Full FP16", [FeatureFPARMv8]>;
43
Oliver Stannarda34e4702015-12-01 10:48:51 +000044def FeatureSPE : SubtargetFeature<"spe", "HasSPE", "true",
45 "Enable Statistical Profiling extension">;
46
Tim Northover3b0846e2014-05-24 12:50:23 +000047/// Cyclone has register move instructions which are "free".
48def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
49 "Has zero-cycle register moves">;
50
51/// Cyclone has instructions which zero registers for "free".
52def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
53 "Has zero-cycle zeroing instructions">;
54
Akira Hatanakaf53b0402015-07-29 14:17:26 +000055def FeatureStrictAlign : SubtargetFeature<"strict-align",
56 "StrictAlign", "true",
57 "Disallow all unaligned memory "
58 "access">;
59
Akira Hatanaka0d4c9ea2015-07-25 00:18:31 +000060def FeatureReserveX18 : SubtargetFeature<"reserve-x18", "ReserveX18", "true",
61 "Reserve X18, making it unavailable "
62 "as a GPR">;
63
Matthias Braun651cff42016-06-02 18:03:53 +000064def FeatureMergeNarrowLd : SubtargetFeature<"merge-narrow-ld",
65 "MergeNarrowLoads", "true",
66 "Merge narrow load instructions">;
67
68def FeatureUseAA : SubtargetFeature<"use-aa", "UseAA", "true",
69 "Use alias analysis during codegen">;
70
71def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
72 "true",
73 "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
74
75def FeaturePredictableSelectIsExpensive : SubtargetFeature<
76 "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
77 "Prefer likely predicted branches over selects">;
78
79def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
80 "CustomAsCheapAsMove", "true",
81 "Use custom code for TargetInstrInfo::isAsCheapAsAMove()">;
82
83def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
84 "UsePostRAScheduler", "true", "Schedule again after register allocation">;
85
86def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
87 "Misaligned128StoreIsSlow", "true", "Misaligned 128 bit stores are slow">;
88
89def FeatureAvoidQuadLdStPairs : SubtargetFeature<"no-quad-ldst-pairs",
90 "AvoidQuadLdStPairs", "true",
91 "Do not form quad load/store pair operations">;
92
93def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
94 "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
95 "true", "Use alternative pattern for sextload convert to f32">;
96
97def FeatureMacroOpFusion : SubtargetFeature<
98 "macroop-fusion", "HasMacroOpFusion", "true",
99 "CPU supports macro op fusion">;
100
101def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
102 "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
103 "Disable latency scheduling heuristic">;
104
105def FeatureUseRSqrt : SubtargetFeature<
106 "use-reverse-square-root", "UseRSqrt", "true", "Use reverse square root">;
107
Tim Northover3b0846e2014-05-24 12:50:23 +0000108//===----------------------------------------------------------------------===//
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000109// Architectures.
110//
111
112def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
113 "Support ARM v8.1a instructions", [FeatureCRC]>;
114
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000115def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
Sjoerd Meijerd906bf12016-06-03 14:03:27 +0000116 "Support ARM v8.2a instructions", [HasV8_1aOps, FeatureRAS]>;
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000117
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000118//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +0000119// Register File Description
120//===----------------------------------------------------------------------===//
121
122include "AArch64RegisterInfo.td"
123include "AArch64CallingConvention.td"
124
125//===----------------------------------------------------------------------===//
126// Instruction Descriptions
127//===----------------------------------------------------------------------===//
128
129include "AArch64Schedule.td"
130include "AArch64InstrInfo.td"
131
132def AArch64InstrInfo : InstrInfo;
133
134//===----------------------------------------------------------------------===//
Tim Northovere6ae6762016-07-05 21:23:04 +0000135// Named operands for MRS/MSR/TLBI/...
136//===----------------------------------------------------------------------===//
137
138include "AArch64SystemOperands.td"
139
140//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +0000141// AArch64 Processors supported.
142//
143include "AArch64SchedA53.td"
Chad Rosier2205d4e2014-06-11 21:06:56 +0000144include "AArch64SchedA57.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000145include "AArch64SchedCyclone.td"
Evandro Menezesd761ca22016-02-06 00:01:41 +0000146include "AArch64SchedM1.td"
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000147include "AArch64SchedKryo.td"
Pankaj Godef4b25542016-06-30 06:42:31 +0000148include "AArch64SchedVulcan.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000149
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000150def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
Matthias Braun651cff42016-06-02 18:03:53 +0000151 "Cortex-A35 ARM processors", [
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000152 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000153 FeatureCrypto,
154 FeatureFPARMv8,
155 FeatureNEON,
156 FeaturePerfMon
157 ]>;
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000158
Tim Northover3b0846e2014-05-24 12:50:23 +0000159def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
Matthias Braun651cff42016-06-02 18:03:53 +0000160 "Cortex-A53 ARM processors", [
161 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000162 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000163 FeatureCrypto,
164 FeatureCustomCheapAsMoveHandling,
165 FeatureFPARMv8,
166 FeatureNEON,
167 FeaturePerfMon,
168 FeaturePostRAScheduler,
169 FeatureUseAA
170 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000171
172def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
Matthias Braun651cff42016-06-02 18:03:53 +0000173 "Cortex-A57 ARM processors", [
174 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000175 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000176 FeatureCrypto,
177 FeatureCustomCheapAsMoveHandling,
178 FeatureFPARMv8,
179 FeatureMergeNarrowLd,
180 FeatureNEON,
181 FeaturePerfMon,
182 FeaturePostRAScheduler,
183 FeaturePredictableSelectIsExpensive
184 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000185
Silviu Barangaaee40fc2016-06-21 15:53:54 +0000186def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
187 "Cortex-A72 ARM processors", [
188 FeatureCRC,
189 FeatureCrypto,
190 FeatureFPARMv8,
191 FeatureNEON,
192 FeaturePerfMon
193 ]>;
194
195def ProcA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
196 "Cortex-A73 ARM processors", [
197 FeatureCRC,
198 FeatureCrypto,
199 FeatureFPARMv8,
200 FeatureNEON,
201 FeaturePerfMon
202 ]>;
203
Tim Northover3b0846e2014-05-24 12:50:23 +0000204def ProcCyclone : SubtargetFeature<"cyclone", "ARMProcFamily", "Cyclone",
Matthias Braun651cff42016-06-02 18:03:53 +0000205 "Cyclone", [
206 FeatureAlternateSExtLoadCVTF32Pattern,
Tim Northover3b0846e2014-05-24 12:50:23 +0000207 FeatureCrypto,
Matthias Braun651cff42016-06-02 18:03:53 +0000208 FeatureDisableLatencySchedHeuristic,
209 FeatureFPARMv8,
210 FeatureMacroOpFusion,
211 FeatureNEON,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000212 FeaturePerfMon,
Matthias Braun651cff42016-06-02 18:03:53 +0000213 FeatureSlowMisaligned128Store,
214 FeatureZCRegMove,
215 FeatureZCZeroing
216 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000217
MinSeong Kima7385eb2016-01-05 12:51:59 +0000218def ProcExynosM1 : SubtargetFeature<"exynosm1", "ARMProcFamily", "ExynosM1",
Matthias Braun651cff42016-06-02 18:03:53 +0000219 "Samsung Exynos-M1 processors", [
220 FeatureAvoidQuadLdStPairs,
MinSeong Kima7385eb2016-01-05 12:51:59 +0000221 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000222 FeatureCrypto,
223 FeatureCustomCheapAsMoveHandling,
224 FeatureFPARMv8,
225 FeatureNEON,
226 FeaturePerfMon,
227 FeatureUseRSqrt
228 ]>;
MinSeong Kima7385eb2016-01-05 12:51:59 +0000229
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000230def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
Matthias Braun651cff42016-06-02 18:03:53 +0000231 "Qualcomm Kryo processors", [
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000232 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000233 FeatureCrypto,
234 FeatureCustomCheapAsMoveHandling,
235 FeatureFPARMv8,
236 FeatureMergeNarrowLd,
237 FeatureNEON,
238 FeaturePerfMon,
239 FeaturePostRAScheduler,
Haicheng Wu1e395742016-07-12 02:04:01 +0000240 FeaturePredictableSelectIsExpensive,
241 FeatureZCZeroing
Matthias Braun651cff42016-06-02 18:03:53 +0000242 ]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000243
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000244def ProcVulcan : SubtargetFeature<"vulcan", "ARMProcFamily", "Vulcan",
245 "Broadcom Vulcan processors", [
Pankaj Godef4b25542016-06-30 06:42:31 +0000246 FeatureCRC,
247 FeatureCrypto,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000248 FeatureFPARMv8,
Pankaj Gode5d118a162016-07-08 11:13:59 +0000249 FeatureMacroOpFusion,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000250 FeatureNEON,
Pankaj Godef4b25542016-06-30 06:42:31 +0000251 FeaturePostRAScheduler,
Pankaj Gode0aab2e32016-06-20 11:13:31 +0000252 HasV8_1aOps]>;
253
Matthias Braun651cff42016-06-02 18:03:53 +0000254def : ProcessorModel<"generic", NoSchedModel, [
255 FeatureCRC,
256 FeatureFPARMv8,
257 FeatureNEON,
258 FeaturePerfMon,
259 FeaturePostRAScheduler
260 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000261
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000262// FIXME: Cortex-A35 is currently modelled as a Cortex-A53
263def : ProcessorModel<"cortex-a35", CortexA53Model, [ProcA35]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000264def : ProcessorModel<"cortex-a53", CortexA53Model, [ProcA53]>;
Chad Rosier2205d4e2014-06-11 21:06:56 +0000265def : ProcessorModel<"cortex-a57", CortexA57Model, [ProcA57]>;
Sjoerd Meijer0b7bb162016-06-02 10:48:52 +0000266// FIXME: Cortex-A72 and Cortex-A73 are currently modelled as an Cortex-A57.
Silviu Barangaaee40fc2016-06-21 15:53:54 +0000267def : ProcessorModel<"cortex-a72", CortexA57Model, [ProcA72]>;
268def : ProcessorModel<"cortex-a73", CortexA57Model, [ProcA73]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000269def : ProcessorModel<"cyclone", CycloneModel, [ProcCyclone]>;
Evandro Menezesd761ca22016-02-06 00:01:41 +0000270def : ProcessorModel<"exynos-m1", ExynosM1Model, [ProcExynosM1]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000271def : ProcessorModel<"kryo", KryoModel, [ProcKryo]>;
Pankaj Godef4b25542016-06-30 06:42:31 +0000272def : ProcessorModel<"vulcan", VulcanModel, [ProcVulcan]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000273
274//===----------------------------------------------------------------------===//
275// Assembly parser
276//===----------------------------------------------------------------------===//
277
278def GenericAsmParserVariant : AsmParserVariant {
279 int Variant = 0;
280 string Name = "generic";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000281 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000282}
283
284def AppleAsmParserVariant : AsmParserVariant {
285 int Variant = 1;
286 string Name = "apple-neon";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000287 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000288}
289
290//===----------------------------------------------------------------------===//
291// Assembly printer
292//===----------------------------------------------------------------------===//
293// AArch64 Uses the MC printer for asm output, so make sure the TableGen
294// AsmWriter bits get associated with the correct class.
295def GenericAsmWriter : AsmWriter {
296 string AsmWriterClassName = "InstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000297 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000298 int Variant = 0;
299 bit isMCAsmWriter = 1;
300}
301
302def AppleAsmWriter : AsmWriter {
303 let AsmWriterClassName = "AppleInstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000304 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000305 int Variant = 1;
306 int isMCAsmWriter = 1;
307}
308
309//===----------------------------------------------------------------------===//
310// Target Declaration
311//===----------------------------------------------------------------------===//
312
313def AArch64 : Target {
314 let InstructionSet = AArch64InstrInfo;
315 let AssemblyParserVariants = [GenericAsmParserVariant, AppleAsmParserVariant];
316 let AssemblyWriters = [GenericAsmWriter, AppleAsmWriter];
317}