1 //=- AArch64.td - Describe the AArch64 Target Machine --------*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 // Target-independent interfaces which we are implementing.
15 //===----------------------------------------------------------------------===//
17 include "llvm/Target/Target.td"
19 //===----------------------------------------------------------------------===//
20 // AArch64 Subtarget features.
23 def FeatureFPARMv8 : SubtargetFeature<"fp-armv8", "HasFPARMv8", "true",
26 def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
27 "Enable Advanced SIMD instructions", [FeatureFPARMv8]>;
29 def FeatureCrypto : SubtargetFeature<"crypto", "HasCrypto", "true",
30 "Enable cryptographic instructions", [FeatureNEON]>;
32 def FeatureCRC : SubtargetFeature<"crc", "HasCRC", "true",
33 "Enable ARMv8 CRC-32 checksum instructions">;
35 def FeatureRAS : SubtargetFeature<"ras", "HasRAS", "true",
36 "Enable ARMv8 Reliability, Availability and Serviceability Extensions">;
38 def FeatureLSE : SubtargetFeature<"lse", "HasLSE", "true",
39 "Enable ARMv8.1 Large System Extension (LSE) atomic instructions">;
41 def FeatureRDM : SubtargetFeature<"rdm", "HasRDM", "true",
42 "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions">;
44 def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
45 "Enable ARMv8 PMUv3 Performance Monitors extension">;
47 def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
48 "Full FP16", [FeatureFPARMv8]>;
50 def FeatureSPE : SubtargetFeature<"spe", "HasSPE", "true",
51 "Enable Statistical Profiling extension">;
53 def FeatureSVE : SubtargetFeature<"sve", "HasSVE", "true",
54 "Enable Scalable Vector Extension (SVE) instructions">;
56 /// Cyclone has register move instructions which are "free".
57 def FeatureZCRegMove : SubtargetFeature<"zcm", "HasZeroCycleRegMove", "true",
58 "Has zero-cycle register moves">;
60 /// Cyclone has instructions which zero registers for "free".
61 def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
62 "Has zero-cycle zeroing instructions">;
64 /// ... but the floating-point version doesn't quite work in rare cases on older
66 def FeatureZCZeroingFPWorkaround : SubtargetFeature<"zcz-fp-workaround",
67 "HasZeroCycleZeroingFPWorkaround", "true",
68 "The zero-cycle floating-point zeroing instruction has a bug">;
70 def FeatureStrictAlign : SubtargetFeature<"strict-align",
71 "StrictAlign", "true",
72 "Disallow all unaligned memory "
75 def FeatureReserveX18 : SubtargetFeature<"reserve-x18", "ReserveX18", "true",
76 "Reserve X18, making it unavailable "
79 def FeatureUseAA : SubtargetFeature<"use-aa", "UseAA", "true",
80 "Use alias analysis during codegen">;
82 def FeatureBalanceFPOps : SubtargetFeature<"balance-fp-ops", "BalanceFPOps",
84 "balance mix of odd and even D-registers for fp multiply(-accumulate) ops">;
86 def FeaturePredictableSelectIsExpensive : SubtargetFeature<
87 "predictable-select-expensive", "PredictableSelectIsExpensive", "true",
88 "Prefer likely predicted branches over selects">;
90 def FeatureCustomCheapAsMoveHandling : SubtargetFeature<"custom-cheap-as-move",
91 "CustomAsCheapAsMove", "true",
92 "Use custom code for TargetInstrInfo::isAsCheapAsAMove()">;
94 def FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler",
95 "UsePostRAScheduler", "true", "Schedule again after register allocation">;
97 def FeatureSlowMisaligned128Store : SubtargetFeature<"slow-misaligned-128store",
98 "Misaligned128StoreIsSlow", "true", "Misaligned 128 bit stores are slow">;
100 def FeatureSlowPaired128 : SubtargetFeature<"slow-paired-128",
101 "Paired128IsSlow", "true", "Paired 128 bit loads and stores are slow">;
103 def FeatureSlowSTRQro : SubtargetFeature<"slow-strqro-store", "STRQroIsSlow",
104 "true", "STR of Q register with register offset is slow">;
106 def FeatureAlternateSExtLoadCVTF32Pattern : SubtargetFeature<
107 "alternate-sextload-cvt-f32-pattern", "UseAlternateSExtLoadCVTF32Pattern",
108 "true", "Use alternative pattern for sextload convert to f32">;
110 def FeatureArithmeticBccFusion : SubtargetFeature<
111 "arith-bcc-fusion", "HasArithmeticBccFusion", "true",
112 "CPU fuses arithmetic+bcc operations">;
114 def FeatureArithmeticCbzFusion : SubtargetFeature<
115 "arith-cbz-fusion", "HasArithmeticCbzFusion", "true",
116 "CPU fuses arithmetic + cbz/cbnz operations">;
118 def FeatureFuseAES : SubtargetFeature<
119 "fuse-aes", "HasFuseAES", "true",
120 "CPU fuses AES crypto operations">;
122 def FeatureFuseLiterals : SubtargetFeature<
123 "fuse-literals", "HasFuseLiterals", "true",
124 "CPU fuses literal generation operations">;
126 def FeatureDisableLatencySchedHeuristic : SubtargetFeature<
127 "disable-latency-sched-heuristic", "DisableLatencySchedHeuristic", "true",
128 "Disable latency scheduling heuristic">;
130 def FeatureRCPC : SubtargetFeature<"rcpc", "HasRCPC", "true",
131 "Enable support for RCPC extension">;
133 def FeatureUseRSqrt : SubtargetFeature<
134 "use-reciprocal-square-root", "UseRSqrt", "true",
135 "Use the reciprocal square root approximation">;
137 def FeatureDotProd : SubtargetFeature<
138 "dotprod", "HasDotProd", "true",
139 "Enable dot product support">;
141 def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
142 "NegativeImmediates", "false",
143 "Convert immediates and instructions "
144 "to their negated or complemented "
145 "equivalent when the immediate does "
146 "not fit in the encoding.">;
148 def FeatureLSLFast : SubtargetFeature<
149 "lsl-fast", "HasLSLFast", "true",
150 "CPU has a fastpath logical shift of up to 3 places">;
152 //===----------------------------------------------------------------------===//
156 def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
157 "Support ARM v8.1a instructions", [FeatureCRC, FeatureLSE, FeatureRDM]>;
159 def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
160 "Support ARM v8.2a instructions", [HasV8_1aOps, FeatureRAS]>;
162 def HasV8_3aOps : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true",
163 "Support ARM v8.3a instructions", [HasV8_2aOps, FeatureRCPC]>;
165 //===----------------------------------------------------------------------===//
166 // Register File Description
167 //===----------------------------------------------------------------------===//
169 include "AArch64RegisterInfo.td"
170 include "AArch64RegisterBanks.td"
171 include "AArch64CallingConvention.td"
173 //===----------------------------------------------------------------------===//
174 // Instruction Descriptions
175 //===----------------------------------------------------------------------===//
177 include "AArch64Schedule.td"
178 include "AArch64InstrInfo.td"
180 def AArch64InstrInfo : InstrInfo;
182 //===----------------------------------------------------------------------===//
183 // Named operands for MRS/MSR/TLBI/...
184 //===----------------------------------------------------------------------===//
186 include "AArch64SystemOperands.td"
188 //===----------------------------------------------------------------------===//
189 // AArch64 Processors supported.
191 include "AArch64SchedA53.td"
192 include "AArch64SchedA57.td"
193 include "AArch64SchedCyclone.td"
194 include "AArch64SchedFalkor.td"
195 include "AArch64SchedKryo.td"
196 include "AArch64SchedM1.td"
197 include "AArch64SchedThunderX.td"
198 include "AArch64SchedThunderX2T99.td"
200 def ProcA35 : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
201 "Cortex-A35 ARM processors", [
209 def ProcA53 : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
210 "Cortex-A53 ARM processors", [
214 FeatureCustomCheapAsMoveHandling,
219 FeaturePostRAScheduler,
223 def ProcA55 : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55",
224 "Cortex-A55 ARM processors", [
236 def ProcA57 : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
237 "Cortex-A57 ARM processors", [
241 FeatureCustomCheapAsMoveHandling,
247 FeaturePostRAScheduler,
248 FeaturePredictableSelectIsExpensive
251 def ProcA72 : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
252 "Cortex-A72 ARM processors", [
261 def ProcA73 : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
262 "Cortex-A73 ARM processors", [
271 def ProcA75 : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75",
272 "Cortex-A75 ARM processors", [
284 // Note that cyclone does not fuse AES instructions, but newer apple chips do
285 // perform the fusion and cyclone is used by default when targetting apple OSes.
286 def ProcCyclone : SubtargetFeature<"cyclone", "ARMProcFamily", "Cyclone",
288 FeatureAlternateSExtLoadCVTF32Pattern,
289 FeatureArithmeticBccFusion,
290 FeatureArithmeticCbzFusion,
292 FeatureDisableLatencySchedHeuristic,
297 FeatureSlowMisaligned128Store,
300 FeatureZCZeroingFPWorkaround
303 def ProcExynosM1 : SubtargetFeature<"exynosm1", "ARMProcFamily", "ExynosM1",
304 "Samsung Exynos-M1 processors",
305 [FeatureSlowPaired128,
308 FeatureCustomCheapAsMoveHandling,
313 FeaturePostRAScheduler,
314 FeatureSlowMisaligned128Store,
318 def ProcExynosM2 : SubtargetFeature<"exynosm2", "ARMProcFamily", "ExynosM1",
319 "Samsung Exynos-M2/M3 processors",
320 [FeatureSlowPaired128,
323 FeatureCustomCheapAsMoveHandling,
328 FeaturePostRAScheduler,
329 FeatureSlowMisaligned128Store,
332 def ProcKryo : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
333 "Qualcomm Kryo processors", [
336 FeatureCustomCheapAsMoveHandling,
340 FeaturePostRAScheduler,
341 FeaturePredictableSelectIsExpensive,
346 def ProcFalkor : SubtargetFeature<"falkor", "ARMProcFamily", "Falkor",
347 "Qualcomm Falkor processors", [
350 FeatureCustomCheapAsMoveHandling,
354 FeaturePostRAScheduler,
355 FeaturePredictableSelectIsExpensive,
362 def ProcSaphira : SubtargetFeature<"saphira", "ARMProcFamily", "Saphira",
363 "Qualcomm Saphira processors", [
365 FeatureCustomCheapAsMoveHandling,
370 FeaturePostRAScheduler,
371 FeaturePredictableSelectIsExpensive,
376 def ProcThunderX2T99 : SubtargetFeature<"thunderx2t99", "ARMProcFamily",
378 "Cavium ThunderX2 processors", [
382 FeatureArithmeticBccFusion,
384 FeaturePostRAScheduler,
385 FeaturePredictableSelectIsExpensive,
389 def ProcThunderX : SubtargetFeature<"thunderx", "ARMProcFamily", "ThunderX",
390 "Cavium ThunderX processors", [
395 FeaturePostRAScheduler,
396 FeaturePredictableSelectIsExpensive,
399 def ProcThunderXT88 : SubtargetFeature<"thunderxt88", "ARMProcFamily",
401 "Cavium ThunderX processors", [
406 FeaturePostRAScheduler,
407 FeaturePredictableSelectIsExpensive,
410 def ProcThunderXT81 : SubtargetFeature<"thunderxt81", "ARMProcFamily",
412 "Cavium ThunderX processors", [
417 FeaturePostRAScheduler,
418 FeaturePredictableSelectIsExpensive,
421 def ProcThunderXT83 : SubtargetFeature<"thunderxt83", "ARMProcFamily",
423 "Cavium ThunderX processors", [
428 FeaturePostRAScheduler,
429 FeaturePredictableSelectIsExpensive,
432 def : ProcessorModel<"generic", NoSchedModel, [
437 FeaturePostRAScheduler
440 // FIXME: Cortex-A35 and Cortex-A55 are currently modeled as a Cortex-A53.
441 def : ProcessorModel<"cortex-a35", CortexA53Model, [ProcA35]>;
442 def : ProcessorModel<"cortex-a53", CortexA53Model, [ProcA53]>;
443 def : ProcessorModel<"cortex-a55", CortexA53Model, [ProcA55]>;
444 def : ProcessorModel<"cortex-a57", CortexA57Model, [ProcA57]>;
445 // FIXME: Cortex-A72, Cortex-A73 and Cortex-A75 are currently modeled as a Cortex-A57.
446 def : ProcessorModel<"cortex-a72", CortexA57Model, [ProcA72]>;
447 def : ProcessorModel<"cortex-a73", CortexA57Model, [ProcA73]>;
448 def : ProcessorModel<"cortex-a75", CortexA57Model, [ProcA75]>;
449 def : ProcessorModel<"cyclone", CycloneModel, [ProcCyclone]>;
450 def : ProcessorModel<"exynos-m1", ExynosM1Model, [ProcExynosM1]>;
451 def : ProcessorModel<"exynos-m2", ExynosM1Model, [ProcExynosM2]>;
452 def : ProcessorModel<"exynos-m3", ExynosM1Model, [ProcExynosM2]>;
453 def : ProcessorModel<"falkor", FalkorModel, [ProcFalkor]>;
454 def : ProcessorModel<"saphira", FalkorModel, [ProcSaphira]>;
455 def : ProcessorModel<"kryo", KryoModel, [ProcKryo]>;
456 // Cavium ThunderX/ThunderX T8X Processors
457 def : ProcessorModel<"thunderx", ThunderXT8XModel, [ProcThunderX]>;
458 def : ProcessorModel<"thunderxt88", ThunderXT8XModel, [ProcThunderXT88]>;
459 def : ProcessorModel<"thunderxt81", ThunderXT8XModel, [ProcThunderXT81]>;
460 def : ProcessorModel<"thunderxt83", ThunderXT8XModel, [ProcThunderXT83]>;
461 // Cavium ThunderX2T9X Processors. Formerly Broadcom Vulcan.
462 def : ProcessorModel<"thunderx2t99", ThunderX2T99Model, [ProcThunderX2T99]>;
464 //===----------------------------------------------------------------------===//
466 //===----------------------------------------------------------------------===//
468 def GenericAsmParserVariant : AsmParserVariant {
470 string Name = "generic";
471 string BreakCharacters = ".";
474 def AppleAsmParserVariant : AsmParserVariant {
476 string Name = "apple-neon";
477 string BreakCharacters = ".";
480 //===----------------------------------------------------------------------===//
482 //===----------------------------------------------------------------------===//
483 // AArch64 Uses the MC printer for asm output, so make sure the TableGen
484 // AsmWriter bits get associated with the correct class.
485 def GenericAsmWriter : AsmWriter {
486 string AsmWriterClassName = "InstPrinter";
487 int PassSubtarget = 1;
489 bit isMCAsmWriter = 1;
492 def AppleAsmWriter : AsmWriter {
493 let AsmWriterClassName = "AppleInstPrinter";
494 int PassSubtarget = 1;
496 int isMCAsmWriter = 1;
499 //===----------------------------------------------------------------------===//
500 // Target Declaration
501 //===----------------------------------------------------------------------===//
503 def AArch64 : Target {
504 let InstructionSet = AArch64InstrInfo;
505 let AssemblyParserVariants = [GenericAsmParserVariant, AppleAsmParserVariant];
506 let AssemblyWriters = [GenericAsmWriter, AppleAsmWriter];