blob: 67a0556e4371a93a2f9837aaf38fafed650e3780 [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//===----------------------------------------------------------------------===//
14// Target-independent interfaces which we are implementing
15//===----------------------------------------------------------------------===//
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
Ahmed Bougachab0ff6432015-09-01 16:23:45 +000035def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
36 "Enable ARMv8 PMUv3 Performance Monitors extension">;
37
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +000038def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
39 "Full FP16", [FeatureFPARMv8]>;
40
Oliver Stannarda34e4702015-12-01 10:48:51 +000041def FeatureSPE : SubtargetFeature<"spe", "HasSPE", "true",
42 "Enable Statistical Profiling extension">;
43
Tim Northover3b0846e2014-05-24 12:50:23 +000044/// Cyclone has register move instructions which are "free".
45def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
46 "Has zero-cycle register moves">;
47
48/// Cyclone has instructions which zero registers for "free".
49def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
50 "Has zero-cycle zeroing instructions">;
51
Akira Hatanakaf53b0402015-07-29 14:17:26 +000052def FeatureStrictAlign : SubtargetFeature<"strict-align",
53 "StrictAlign", "true",
54 "Disallow all unaligned memory "
55 "access">;
56
Akira Hatanaka0d4c9ea2015-07-25 00:18:31 +000057def FeatureReserveX18 : SubtargetFeature<"reserve-x18", "ReserveX18", "true",
58 "Reserve X18, making it unavailable "
59 "as a GPR">;
60
Matthias Braun651cff42016-06-02 18:03:53 +000061def FeatureMergeNarrowLd : SubtargetFeature<"merge-narrow-ld",
62 "MergeNarrowLoads", "true",
63 "Merge narrow load instructions">;
64
65def FeatureUseAA : SubtargetFeature<"use-aa", "UseAA", "true",
66 "Use alias analysis during codegen">;
67
68def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
69 "true",
70 "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
71
72def FeaturePredictableSelectIsExpensive : SubtargetFeature<
73 "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
74 "Prefer likely predicted branches over selects">;
75
76def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
77 "CustomAsCheapAsMove", "true",
78 "Use custom code for TargetInstrInfo::isAsCheapAsAMove()">;
79
80def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
81 "UsePostRAScheduler", "true", "Schedule again after register allocation">;
82
83def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
84 "Misaligned128StoreIsSlow", "true", "Misaligned 128 bit stores are slow">;
85
86def FeatureAvoidQuadLdStPairs : SubtargetFeature<"no-quad-ldst-pairs",
87 "AvoidQuadLdStPairs", "true",
88 "Do not form quad load/store pair operations">;
89
90def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
91 "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
92 "true", "Use alternative pattern for sextload convert to f32">;
93
94def FeatureMacroOpFusion : SubtargetFeature<
95 "macroop-fusion", "HasMacroOpFusion", "true",
96 "CPU supports macro op fusion">;
97
98def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
99 "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
100 "Disable latency scheduling heuristic">;
101
102def FeatureUseRSqrt : SubtargetFeature<
103 "use-reverse-square-root", "UseRSqrt", "true", "Use reverse square root">;
104
Tim Northover3b0846e2014-05-24 12:50:23 +0000105//===----------------------------------------------------------------------===//
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000106// Architectures.
107//
108
109def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
110 "Support ARM v8.1a instructions", [FeatureCRC]>;
111
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000112def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
113 "Support ARM v8.2a instructions", [HasV8_1aOps]>;
114
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000115//===----------------------------------------------------------------------===//
Tim Northover3b0846e2014-05-24 12:50:23 +0000116// Register File Description
117//===----------------------------------------------------------------------===//
118
119include "AArch64RegisterInfo.td"
120include "AArch64CallingConvention.td"
121
122//===----------------------------------------------------------------------===//
123// Instruction Descriptions
124//===----------------------------------------------------------------------===//
125
126include "AArch64Schedule.td"
127include "AArch64InstrInfo.td"
128
129def AArch64InstrInfo : InstrInfo;
130
131//===----------------------------------------------------------------------===//
132// AArch64 Processors supported.
133//
134include "AArch64SchedA53.td"
Chad Rosier2205d4e2014-06-11 21:06:56 +0000135include "AArch64SchedA57.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000136include "AArch64SchedCyclone.td"
Evandro Menezesd761ca22016-02-06 00:01:41 +0000137include "AArch64SchedM1.td"
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000138include "AArch64SchedKryo.td"
Tim Northover3b0846e2014-05-24 12:50:23 +0000139
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000140def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
Matthias Braun651cff42016-06-02 18:03:53 +0000141 "Cortex-A35 ARM processors", [
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000142 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000143 FeatureCrypto,
144 FeatureFPARMv8,
145 FeatureNEON,
146 FeaturePerfMon
147 ]>;
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000148
Tim Northover3b0846e2014-05-24 12:50:23 +0000149def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
Matthias Braun651cff42016-06-02 18:03:53 +0000150 "Cortex-A53 ARM processors", [
151 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000152 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000153 FeatureCrypto,
154 FeatureCustomCheapAsMoveHandling,
155 FeatureFPARMv8,
156 FeatureNEON,
157 FeaturePerfMon,
158 FeaturePostRAScheduler,
159 FeatureUseAA
160 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000161
162def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
Matthias Braun651cff42016-06-02 18:03:53 +0000163 "Cortex-A57 ARM processors", [
164 FeatureBalanceFPOps,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000165 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000166 FeatureCrypto,
167 FeatureCustomCheapAsMoveHandling,
168 FeatureFPARMv8,
169 FeatureMergeNarrowLd,
170 FeatureNEON,
171 FeaturePerfMon,
172 FeaturePostRAScheduler,
173 FeaturePredictableSelectIsExpensive
174 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000175
176def ProcCyclone : SubtargetFeature<"cyclone", "ARMProcFamily", "Cyclone",
Matthias Braun651cff42016-06-02 18:03:53 +0000177 "Cyclone", [
178 FeatureAlternateSExtLoadCVTF32Pattern,
Tim Northover3b0846e2014-05-24 12:50:23 +0000179 FeatureCrypto,
Matthias Braun651cff42016-06-02 18:03:53 +0000180 FeatureDisableLatencySchedHeuristic,
181 FeatureFPARMv8,
182 FeatureMacroOpFusion,
183 FeatureNEON,
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000184 FeaturePerfMon,
Matthias Braun651cff42016-06-02 18:03:53 +0000185 FeatureSlowMisaligned128Store,
186 FeatureZCRegMove,
187 FeatureZCZeroing
188 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000189
MinSeong Kima7385eb2016-01-05 12:51:59 +0000190def ProcExynosM1 : SubtargetFeature<"exynosm1", "ARMProcFamily", "ExynosM1",
Matthias Braun651cff42016-06-02 18:03:53 +0000191 "Samsung Exynos-M1 processors", [
192 FeatureAvoidQuadLdStPairs,
MinSeong Kima7385eb2016-01-05 12:51:59 +0000193 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000194 FeatureCrypto,
195 FeatureCustomCheapAsMoveHandling,
196 FeatureFPARMv8,
197 FeatureNEON,
198 FeaturePerfMon,
199 FeatureUseRSqrt
200 ]>;
MinSeong Kima7385eb2016-01-05 12:51:59 +0000201
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000202def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
Matthias Braun651cff42016-06-02 18:03:53 +0000203 "Qualcomm Kryo processors", [
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000204 FeatureCRC,
Matthias Braun651cff42016-06-02 18:03:53 +0000205 FeatureCrypto,
206 FeatureCustomCheapAsMoveHandling,
207 FeatureFPARMv8,
208 FeatureMergeNarrowLd,
209 FeatureNEON,
210 FeaturePerfMon,
211 FeaturePostRAScheduler,
212 FeaturePredictableSelectIsExpensive
213 ]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000214
Matthias Braun651cff42016-06-02 18:03:53 +0000215def : ProcessorModel<"generic", NoSchedModel, [
216 FeatureCRC,
217 FeatureFPARMv8,
218 FeatureNEON,
219 FeaturePerfMon,
220 FeaturePostRAScheduler
221 ]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000222
Christof Douma8b5dc2c2015-12-02 11:53:44 +0000223// FIXME: Cortex-A35 is currently modelled as a Cortex-A53
224def : ProcessorModel<"cortex-a35", CortexA53Model, [ProcA35]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000225def : ProcessorModel<"cortex-a53", CortexA53Model, [ProcA53]>;
Chad Rosier2205d4e2014-06-11 21:06:56 +0000226def : ProcessorModel<"cortex-a57", CortexA57Model, [ProcA57]>;
Sjoerd Meijer0b7bb162016-06-02 10:48:52 +0000227// FIXME: Cortex-A72 and Cortex-A73 are currently modelled as an Cortex-A57.
Renato Golin60885042015-02-04 13:31:29 +0000228def : ProcessorModel<"cortex-a72", CortexA57Model, [ProcA57]>;
Sjoerd Meijer0b7bb162016-06-02 10:48:52 +0000229def : ProcessorModel<"cortex-a73", CortexA57Model, [ProcA57]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000230def : ProcessorModel<"cyclone", CycloneModel, [ProcCyclone]>;
Evandro Menezesd761ca22016-02-06 00:01:41 +0000231def : ProcessorModel<"exynos-m1", ExynosM1Model, [ProcExynosM1]>;
Chad Rosiercd2be7f2016-02-12 15:51:51 +0000232def : ProcessorModel<"kryo", KryoModel, [ProcKryo]>;
Tim Northover3b0846e2014-05-24 12:50:23 +0000233
234//===----------------------------------------------------------------------===//
235// Assembly parser
236//===----------------------------------------------------------------------===//
237
238def GenericAsmParserVariant : AsmParserVariant {
239 int Variant = 0;
240 string Name = "generic";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000241 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000242}
243
244def AppleAsmParserVariant : AsmParserVariant {
245 int Variant = 1;
246 string Name = "apple-neon";
Colin LeMahieu8a0453e2015-11-09 00:31:07 +0000247 string BreakCharacters = ".";
Tim Northover3b0846e2014-05-24 12:50:23 +0000248}
249
250//===----------------------------------------------------------------------===//
251// Assembly printer
252//===----------------------------------------------------------------------===//
253// AArch64 Uses the MC printer for asm output, so make sure the TableGen
254// AsmWriter bits get associated with the correct class.
255def GenericAsmWriter : AsmWriter {
256 string AsmWriterClassName = "InstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000257 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000258 int Variant = 0;
259 bit isMCAsmWriter = 1;
260}
261
262def AppleAsmWriter : AsmWriter {
263 let AsmWriterClassName = "AppleInstPrinter";
Akira Hatanakab46d0232015-03-27 20:36:02 +0000264 int PassSubtarget = 1;
Tim Northover3b0846e2014-05-24 12:50:23 +0000265 int Variant = 1;
266 int isMCAsmWriter = 1;
267}
268
269//===----------------------------------------------------------------------===//
270// Target Declaration
271//===----------------------------------------------------------------------===//
272
273def AArch64 : Target {
274 let InstructionSet = AArch64InstrInfo;
275 let AssemblyParserVariants = [GenericAsmParserVariant, AppleAsmParserVariant];
276 let AssemblyWriters = [GenericAsmWriter, AppleAsmWriter];
277}