xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARM.td (revision 525fe93dc7487a1e63a90f6a2b956abc601963c1)
1//===-- ARM.td - Describe the ARM Target Machine -----------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//
10//===----------------------------------------------------------------------===//
11
12//===----------------------------------------------------------------------===//
13// Target-independent interfaces which we are implementing
14//===----------------------------------------------------------------------===//
15
16include "llvm/Target/Target.td"
17
18//===----------------------------------------------------------------------===//
19// ARM Subtarget state.
20//
21
22// True if compiling for Thumb, false for ARM.
23def ModeThumb             : SubtargetFeature<"thumb-mode", "IsThumb",
24                                             "true", "Thumb mode">;
25
26// True if we're using software floating point features.
27def ModeSoftFloat         : SubtargetFeature<"soft-float","UseSoftFloat",
28                                             "true", "Use software floating "
29                                             "point features.">;
30
31
32//===----------------------------------------------------------------------===//
33// ARM Subtarget features.
34//
35
36// Floating Point, HW Division and Neon Support
37
38// FP loads/stores/moves, shared between VFP and MVE (even in the integer-only
39// version).
40def FeatureFPRegs         : SubtargetFeature<"fpregs", "HasFPRegs", "true",
41                                             "Enable FP registers">;
42
43// 16-bit FP loads/stores/moves, shared between VFP (with the v8.2A FP16
44// extension) and MVE (even in the integer-only version).
45def FeatureFPRegs16       : SubtargetFeature<"fpregs16", "HasFPRegs16", "true",
46                                             "Enable 16-bit FP registers",
47                                             [FeatureFPRegs]>;
48
49def FeatureFPRegs64       : SubtargetFeature<"fpregs64", "HasFPRegs64", "true",
50                                             "Enable 64-bit FP registers",
51                                             [FeatureFPRegs]>;
52
53// True if the floating point unit supports double precision.
54def FeatureFP64           : SubtargetFeature<"fp64", "HasFP64", "true",
55                                             "Floating point unit supports "
56                                             "double precision",
57                                             [FeatureFPRegs64]>;
58
59// True if subtarget has the full 32 double precision FP registers for VFPv3.
60def FeatureD32            : SubtargetFeature<"d32", "HasD32", "true",
61                                             "Extend FP to 32 double registers">;
62
63/// Versions of the VFP flags restricted to single precision, or to
64/// 16 d-registers, or both.
65multiclass VFPver<string name, string query, string description,
66                  list<SubtargetFeature> prev,
67                  list<SubtargetFeature> otherimplies,
68                  list<SubtargetFeature> vfp2prev = []> {
69  def _D16_SP: SubtargetFeature<
70    name#"d16sp", query#"D16SP", "true",
71    description#" with only 16 d-registers and no double precision",
72    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16_SP")) #
73      !foreach(v, vfp2prev, !cast<SubtargetFeature>(v # "_SP")) #
74      otherimplies>;
75  def _SP: SubtargetFeature<
76    name#"sp", query#"SP", "true",
77    description#" with no double precision",
78    !foreach(v, prev, !cast<SubtargetFeature>(v # "_SP")) #
79      otherimplies # [FeatureD32, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
80  def _D16: SubtargetFeature<
81    name#"d16", query#"D16", "true",
82    description#" with only 16 d-registers",
83    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16")) #
84      vfp2prev #
85      otherimplies # [FeatureFP64, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
86  def "": SubtargetFeature<
87    name, query, "true", description,
88    prev # otherimplies # [
89        !cast<SubtargetFeature>(NAME # "_D16"),
90        !cast<SubtargetFeature>(NAME # "_SP")]>;
91}
92
93def FeatureVFP2_SP        : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true",
94                                             "Enable VFP2 instructions with "
95                                             "no double precision",
96                                             [FeatureFPRegs]>;
97
98def FeatureVFP2           : SubtargetFeature<"vfp2", "HasVFPv2", "true",
99                                             "Enable VFP2 instructions",
100                                             [FeatureFP64, FeatureVFP2_SP]>;
101
102defm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions",
103                         [], [], [FeatureVFP2]>;
104
105def FeatureNEON           : SubtargetFeature<"neon", "HasNEON", "true",
106                                             "Enable NEON instructions",
107                                             [FeatureVFP3]>;
108
109// True if subtarget supports half-precision FP conversions.
110def FeatureFP16           : SubtargetFeature<"fp16", "HasFP16", "true",
111                                             "Enable half-precision "
112                                             "floating point">;
113
114defm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable VFP4 instructions",
115                         [FeatureVFP3], [FeatureFP16]>;
116
117defm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP",
118                         [FeatureVFP4], []>;
119
120// True if subtarget supports half-precision FP operations.
121def FeatureFullFP16       : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
122                                             "Enable full half-precision "
123                                             "floating point",
124                                             [FeatureFPARMv8_D16_SP, FeatureFPRegs16]>;
125
126// True if subtarget supports half-precision FP fml operations.
127def FeatureFP16FML        : SubtargetFeature<"fp16fml", "HasFP16FML", "true",
128                                             "Enable full half-precision "
129                                             "floating point fml instructions",
130                                             [FeatureFullFP16]>;
131
132// True if subtarget supports [su]div in Thumb mode.
133def FeatureHWDivThumb     : SubtargetFeature<"hwdiv",
134                                             "HasDivideInThumbMode", "true",
135                                             "Enable divide instructions in Thumb">;
136
137// True if subtarget supports [su]div in ARM mode.
138def FeatureHWDivARM       : SubtargetFeature<"hwdiv-arm",
139                                             "HasDivideInARMMode", "true",
140                                             "Enable divide instructions in ARM mode">;
141
142// Atomic Support
143
144// True if the subtarget supports DMB / DSB data barrier instructions.
145def FeatureDB             : SubtargetFeature<"db", "HasDataBarrier", "true",
146                                             "Has data barrier (dmb/dsb) instructions">;
147
148// True if the subtarget supports CLREX instructions.
149def FeatureV7Clrex        : SubtargetFeature<"v7clrex", "HasV7Clrex", "true",
150                                             "Has v7 clrex instruction">;
151
152// True if the subtarget supports DFB data barrier instruction.
153def FeatureDFB  : SubtargetFeature<"dfb", "HasFullDataBarrier", "true",
154                                   "Has full data barrier (dfb) instruction">;
155
156// True if the subtarget supports v8 atomics (LDA/LDAEX etc) instructions.
157def FeatureAcquireRelease : SubtargetFeature<"acquire-release",
158                                             "HasAcquireRelease", "true",
159                                             "Has v8 acquire/release (lda/ldaex "
160                                             " etc) instructions">;
161
162
163// True if floating point compare + branch is slow.
164def FeatureSlowFPBrcc     : SubtargetFeature<"slow-fp-brcc", "IsFPBrccSlow", "true",
165                                             "FP compare + branch is slow">;
166
167// True if the processor supports the Performance Monitor Extensions. These
168// include a generic cycle-counter as well as more fine-grained (often
169// implementation-specific) events.
170def FeaturePerfMon        : SubtargetFeature<"perfmon", "HasPerfMon", "true",
171                                             "Enable support for Performance "
172                                             "Monitor extensions">;
173
174
175// TrustZone Security Extensions
176
177// True if processor supports TrustZone security extensions.
178def FeatureTrustZone      : SubtargetFeature<"trustzone", "HasTrustZone", "true",
179                                             "Enable support for TrustZone "
180                                             "security extensions">;
181
182// True if processor supports ARMv8-M Security Extensions.
183def Feature8MSecExt       : SubtargetFeature<"8msecext", "Has8MSecExt", "true",
184                                             "Enable support for ARMv8-M "
185                                             "Security Extensions">;
186
187// True if processor supports SHA1 and SHA256.
188def FeatureSHA2           : SubtargetFeature<"sha2", "HasSHA2", "true",
189                                             "Enable SHA1 and SHA256 support", [FeatureNEON]>;
190
191def FeatureAES            : SubtargetFeature<"aes", "HasAES", "true",
192                                             "Enable AES support", [FeatureNEON]>;
193
194// True if processor supports Cryptography extensions.
195def FeatureCrypto         : SubtargetFeature<"crypto", "HasCrypto", "true",
196                                             "Enable support for "
197                                             "Cryptography extensions",
198                                             [FeatureNEON, FeatureSHA2, FeatureAES]>;
199
200// True if processor supports CRC instructions.
201def FeatureCRC            : SubtargetFeature<"crc", "HasCRC", "true",
202                                             "Enable support for CRC instructions">;
203
204// True if the ARMv8.2A dot product instructions are supported.
205def FeatureDotProd        : SubtargetFeature<"dotprod", "HasDotProd", "true",
206                                             "Enable support for dot product instructions",
207                                             [FeatureNEON]>;
208
209// True if the processor supports RAS extensions.
210// Not to be confused with FeatureHasRetAddrStack (return address stack).
211def FeatureRAS            : SubtargetFeature<"ras", "HasRAS", "true",
212                                             "Enable Reliability, Availability "
213                                             "and Serviceability extensions">;
214
215// Fast computation of non-negative address offsets.
216// True if processor does positive address offset computation faster.
217def FeatureFPAO           : SubtargetFeature<"fpao", "HasFPAO", "true",
218                                             "Enable fast computation of "
219                                             "positive address offsets">;
220
221// Fast execution of AES crypto operations.
222// True if processor executes back to back AES instruction pairs faster.
223def FeatureFuseAES        : SubtargetFeature<"fuse-aes", "HasFuseAES", "true",
224                                             "CPU fuses AES crypto operations">;
225
226// Fast execution of bottom and top halves of literal generation.
227// True if processor executes back to back bottom and top halves of literal generation faster.
228def FeatureFuseLiterals   : SubtargetFeature<"fuse-literals", "HasFuseLiterals", "true",
229                                             "CPU fuses literal generation operations">;
230
231// The way of reading thread pointer.
232// True if read thread pointer from coprocessor register.
233def FeatureReadTp :  SubtargetFeature<"read-tp-hard", "IsReadTPHard", "true",
234                                      "Reading thread pointer from register">;
235
236// Cyclone can zero VFP registers in 0 cycles.
237// True if the instructions "vmov.i32 d0, #0" and "vmov.i32 q0, #0" are
238// particularly effective at zeroing a VFP register.
239def FeatureZCZeroing      : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
240                                             "Has zero-cycle zeroing instructions">;
241
242// Whether it is profitable to unpredicate certain instructions during if-conversion.
243// True if if conversion may decide to leave some instructions unpredicated.
244def FeatureProfUnpredicate : SubtargetFeature<"prof-unpr",
245                                              "IsProfitableToUnpredicate", "true",
246                                              "Is profitable to unpredicate">;
247
248// Some targets (e.g. Swift) have microcoded VGETLNi32.
249// True if VMOV will be favored over VGETLNi32.
250def FeatureSlowVGETLNi32  : SubtargetFeature<"slow-vgetlni32",
251                                             "HasSlowVGETLNi32", "true",
252                                             "Has slow VGETLNi32 - prefer VMOV">;
253
254// Some targets (e.g. Swift) have microcoded VDUP32.
255// True if VMOV will be favored over VDUP.
256def FeatureSlowVDUP32     : SubtargetFeature<"slow-vdup32", "HasSlowVDUP32",
257                                             "true",
258                                             "Has slow VDUP32 - prefer VMOV">;
259
260// Some targets (e.g. Cortex-A9) prefer VMOVSR to VMOVDRR even when using NEON
261// for scalar FP, as this allows more effective execution domain optimization.
262// True if VMOVSR will be favored over VMOVDRR.
263def FeaturePreferVMOVSR   : SubtargetFeature<"prefer-vmovsr", "PreferVMOVSR",
264                                             "true", "Prefer VMOVSR">;
265
266// Swift has ISHST barriers compatible with Atomic Release semantics but weaker
267// than ISH.
268// True if ISHST barriers will be used for Release semantics.
269def FeaturePrefISHSTBarrier : SubtargetFeature<"prefer-ishst", "PreferISHSTBarriers",
270                                               "true", "Prefer ISHST barriers">;
271
272// Some targets (e.g. Cortex-A9) have muxed AGU and NEON/FPU.
273// True if the AGU and NEON/FPU units are multiplexed.
274def FeatureMuxedUnits     : SubtargetFeature<"muxed-units", "HasMuxedUnits",
275                                             "true",
276                                             "Has muxed AGU and NEON/FPU">;
277
278// Whether VLDM/VSTM starting with odd register number need more microops
279// than single VLDRS.
280// True if a VLDM/VSTM starting with an odd register number is considered to
281// take more microops than single VLDRS/VSTRS.
282def FeatureSlowOddRegister : SubtargetFeature<"slow-odd-reg", "HasSlowOddRegister",
283                                              "true", "VLDM/VSTM starting "
284                                              "with an odd register is slow">;
285
286// Some targets have a renaming dependency when loading into D subregisters.
287// True if loading into a D subregister will be penalized.
288def FeatureSlowLoadDSubreg : SubtargetFeature<"slow-load-D-subreg",
289                                              "HasSlowLoadDSubregister", "true",
290                                              "Loading into D subregs is slow">;
291
292// True if use a wider stride when allocating VFP registers.
293def FeatureUseWideStrideVFP : SubtargetFeature<"wide-stride-vfp",
294                                               "UseWideStrideVFP", "true",
295                                               "Use a wide stride when allocating VFP registers">;
296
297// Some targets (e.g. Cortex-A15) never want VMOVS to be widened to VMOVD.
298// True if VMOVS will never be widened to VMOVD.
299def FeatureDontWidenVMOVS : SubtargetFeature<"dont-widen-vmovs",
300                                             "DontWidenVMOVS", "true",
301                                             "Don't widen VMOVS to VMOVD">;
302
303// Some targets (e.g. Cortex-A15) prefer to avoid mixing operations on different
304// VFP register widths.
305// True if splat a register between VFP and NEON instructions.
306def FeatureSplatVFPToNeon : SubtargetFeature<"splat-vfp-neon",
307                                             "UseSplatVFPToNeon", "true",
308                                             "Splat register from VFP to NEON",
309                                             [FeatureDontWidenVMOVS]>;
310
311// Whether or not it is profitable to expand VFP/NEON MLA/MLS instructions.
312// True if run the MLx expansion pass.
313def FeatureExpandMLx      : SubtargetFeature<"expand-fp-mlx",
314                                             "ExpandMLx", "true",
315                                             "Expand VFP/NEON MLA/MLS instructions">;
316
317// Some targets have special RAW hazards for VFP/NEON VMLA/VMLS.
318// True if VFP/NEON VMLA/VMLS have special RAW hazards.
319def FeatureHasVMLxHazards : SubtargetFeature<"vmlx-hazards", "HasVMLxHazards",
320                                             "true", "Has VMLx hazards">;
321
322// Some targets (e.g. Cortex-A9) want to convert VMOVRS, VMOVSR and VMOVS from
323// VFP to NEON, as an execution domain optimization.
324// True if VMOVRS, VMOVSR and VMOVS will be converted from VFP to NEON.
325def FeatureNEONForFPMovs  : SubtargetFeature<"neon-fpmovs",
326                                             "UseNEONForFPMovs", "true",
327                                             "Convert VMOVSR, VMOVRS, "
328                                             "VMOVS to NEON">;
329
330// Some processors benefit from using NEON instructions for scalar
331// single-precision FP operations. This affects instruction selection and should
332// only be enabled if the handling of denormals is not important.
333// Use the method useNEONForSinglePrecisionFP() to determine if NEON should actually be used.
334def FeatureNEONForFP      : SubtargetFeature<"neonfp",
335                                             "HasNEONForFP",
336                                             "true",
337                                             "Use NEON for single precision FP">;
338
339// On some processors, VLDn instructions that access unaligned data take one
340// extra cycle. Take that into account when computing operand latencies.
341// True if VLDn instructions take an extra cycle for unaligned accesses.
342def FeatureCheckVLDnAlign : SubtargetFeature<"vldn-align", "CheckVLDnAccessAlignment",
343                                             "true",
344                                             "Check for VLDn unaligned access">;
345
346// Some processors have a nonpipelined VFP coprocessor.
347// True if VFP instructions are not pipelined.
348def FeatureNonpipelinedVFP : SubtargetFeature<"nonpipelined-vfp",
349                                              "NonpipelinedVFP", "true",
350                                              "VFP instructions are not pipelined">;
351
352// Some processors have FP multiply-accumulate instructions that don't
353// play nicely with other VFP / NEON instructions, and it's generally better
354// to just not use them.
355// If the VFP2 / NEON instructions are available, indicates
356// whether the FP VML[AS] instructions are slow (if so, don't use them).
357def FeatureHasSlowFPVMLx  : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
358                                             "Disable VFP / NEON MAC instructions">;
359
360// VFPv4 added VFMA instructions that can similarly be fast or slow.
361// If the VFP4 / NEON instructions are available, indicates
362// whether the FP VFM[AS] instructions are slow (if so, don't use them).
363def FeatureHasSlowFPVFMx  : SubtargetFeature<"slowfpvfmx", "SlowFPVFMx", "true",
364                                             "Disable VFP / NEON FMA instructions">;
365
366// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
367/// True if NEON has special multiplier accumulator
368/// forwarding to allow mul + mla being issued back to back.
369def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
370                                             "HasVMLxForwarding", "true",
371                                             "Has multiplier accumulator forwarding">;
372
373// Disable 32-bit to 16-bit narrowing for experimentation.
374// True if codegen would prefer 32-bit Thumb instructions over 16-bit ones.
375def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Prefers32BitThumb", "true",
376                                             "Prefer 32-bit Thumb instrs">;
377
378def FeaturePrefLoopAlign32 : SubtargetFeature<"loop-align", "PrefLoopLogAlignment","2",
379                                              "Prefer 32-bit alignment for loops">;
380
381def FeatureMVEVectorCostFactor1 : SubtargetFeature<"mve1beat", "MVEVectorCostFactor", "4",
382                        "Model MVE instructions as a 1 beat per tick architecture">;
383
384def FeatureMVEVectorCostFactor2 : SubtargetFeature<"mve2beat", "MVEVectorCostFactor", "2",
385                        "Model MVE instructions as a 2 beats per tick architecture">;
386
387def FeatureMVEVectorCostFactor4 : SubtargetFeature<"mve4beat", "MVEVectorCostFactor", "1",
388                        "Model MVE instructions as a 4 beats per tick architecture">;
389
390/// Some instructions update CPSR partially, which can add false dependency for
391/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
392/// mapped to a separate physical register. Avoid partial CPSR update for these
393/// processors.
394/// True if codegen would avoid using instructions
395/// that partially update CPSR and add false dependency on the previous
396/// CPSR setting instruction.
397def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
398                                               "AvoidCPSRPartialUpdate", "true",
399                                 "Avoid CPSR partial update for OOO execution">;
400
401/// Disable +1 predication cost for instructions updating CPSR.
402/// Enabled for Cortex-A57.
403/// True if disable +1 predication cost for instructions updating CPSR. Enabled for Cortex-A57.
404def FeatureCheapPredicableCPSR : SubtargetFeature<"cheap-predicable-cpsr",
405                                                  "CheapPredicableCPSRDef",
406                                                  "true",
407                  "Disable +1 predication cost for instructions updating CPSR">;
408
409// True if codegen should avoid using flag setting movs with shifter operand (i.e. asr, lsl, lsr).
410def FeatureAvoidMOVsShOp  : SubtargetFeature<"avoid-movs-shop",
411                                             "AvoidMOVsShifterOperand", "true",
412                                             "Avoid movs instructions with "
413                                             "shifter operand">;
414
415// Some processors perform return stack prediction. CodeGen should avoid issue
416// "normal" call instructions to callees which do not return.
417def FeatureHasRetAddrStack : SubtargetFeature<"ret-addr-stack",
418                                              "HasRetAddrStack", "true",
419                                              "Has return address stack">;
420
421// Some processors have no branch predictor, which changes the expected cost of
422// taking a branch which affects the choice of whether to use predicated
423// instructions.
424// True if the subtarget has a branch predictor. Having
425// a branch predictor or not changes the expected cost of taking a branch
426// which affects the choice of whether to use predicated instructions.
427def FeatureHasNoBranchPredictor : SubtargetFeature<"no-branch-predictor",
428                                                   "HasBranchPredictor", "false",
429                                                   "Has no branch predictor">;
430
431/// DSP extension.
432/// True if the subtarget supports the DSP (saturating arith and such) instructions.
433def FeatureDSP            : SubtargetFeature<"dsp", "HasDSP", "true",
434                                             "Supports DSP instructions in "
435                                             "ARM and/or Thumb2">;
436
437// True if the subtarget supports Multiprocessing extension (ARMv7 only).
438def FeatureMP             : SubtargetFeature<"mp", "HasMPExtension", "true",
439                                        "Supports Multiprocessing extension">;
440
441// Virtualization extension - requires HW divide (ARMv7-AR ARMARM - 4.4.8).
442def FeatureVirtualization : SubtargetFeature<"virtualization",
443                                             "HasVirtualization", "true",
444                                             "Supports Virtualization extension",
445                                             [FeatureHWDivThumb, FeatureHWDivARM]>;
446
447// Special TRAP encoding for NaCl, which looks like a TRAP in Thumb too.
448// See ARMInstrInfo.td for details.
449// True if NaCl TRAP instruction is generated instead of the regular TRAP.
450def FeatureNaClTrap       : SubtargetFeature<"nacl-trap", "UseNaClTrap", "true",
451                                             "NaCl trap">;
452
453// True if the subtarget disallows unaligned memory
454// accesses for some types.  For details, see
455// ARMTargetLowering::allowsMisalignedMemoryAccesses().
456def FeatureStrictAlign    : SubtargetFeature<"strict-align",
457                                             "StrictAlign", "true",
458                                             "Disallow all unaligned memory "
459                                             "access">;
460
461// Generate calls via indirect call instructions.
462def FeatureLongCalls      : SubtargetFeature<"long-calls", "GenLongCalls", "true",
463                                             "Generate calls via indirect call "
464                                             "instructions">;
465
466// Generate code that does not contain data access to code sections.
467def FeatureExecuteOnly    : SubtargetFeature<"execute-only",
468                                             "GenExecuteOnly", "true",
469                                             "Enable the generation of "
470                                             "execute only code.">;
471
472// True if R9 is not available as a general purpose register.
473def FeatureReserveR9      : SubtargetFeature<"reserve-r9", "ReserveR9", "true",
474                                             "Reserve R9, making it unavailable"
475                                             " as GPR">;
476
477// True if MOVT / MOVW pairs are not used for materialization of
478// 32-bit imms (including global addresses).
479def FeatureNoMovt         : SubtargetFeature<"no-movt", "NoMovt", "true",
480                                             "Don't use movt/movw pairs for "
481                                             "32-bit imms">;
482
483/// Implicitly convert an instruction to a different one if its immediates
484/// cannot be encoded. For example, ADD r0, r1, #FFFFFFFF -> SUB r0, r1, #1.
485def FeatureNoNegativeImmediates
486                          : SubtargetFeature<"no-neg-immediates",
487                                             "NegativeImmediates", "false",
488                                             "Convert immediates and instructions "
489                                             "to their negated or complemented "
490                                             "equivalent when the immediate does "
491                                             "not fit in the encoding.">;
492
493// Use the MachineScheduler for instruction scheduling for the subtarget.
494def FeatureUseMISched: SubtargetFeature<"use-misched", "UseMISched", "true",
495                                        "Use the MachineScheduler">;
496
497// Use the MachinePipeliner for instruction scheduling for the subtarget.
498def FeatureUseMIPipeliner: SubtargetFeature<"use-mipipeliner", "UseMIPipeliner", "true",
499                                            "Use the MachinePipeliner">;
500
501// False if scheduling should happen again after register allocation.
502def FeatureNoPostRASched : SubtargetFeature<"disable-postra-scheduler",
503    "DisablePostRAScheduler", "true",
504    "Don't schedule again after register allocation">;
505
506// Armv8.5-A extensions
507
508// Has speculation barrier.
509def FeatureSB       : SubtargetFeature<"sb", "HasSB", "true",
510  "Enable v8.5a Speculation Barrier" >;
511
512// Armv8.6-A extensions
513
514// True if subtarget supports BFloat16 floating point operations.
515def FeatureBF16     : SubtargetFeature<"bf16", "HasBF16", "true",
516  "Enable support for BFloat16 instructions",  [FeatureNEON]>;
517
518// True if subtarget supports 8-bit integer matrix multiply.
519def FeatureMatMulInt8 : SubtargetFeature<"i8mm", "HasMatMulInt8",
520    "true", "Enable Matrix Multiply Int8 Extension", [FeatureNEON]>;
521
522// Armv8.1-M extensions
523
524// True if the processor supports the Low Overhead Branch extension.
525def FeatureLOB            : SubtargetFeature<"lob", "HasLOB", "true",
526                                             "Enable Low Overhead Branch "
527                                             "extensions">;
528
529// Mitigate against the cve-2021-35465 security vulnurability.
530def FeatureFixCMSE_CVE_2021_35465 : SubtargetFeature<"fix-cmse-cve-2021-35465",
531                                        "FixCMSE_CVE_2021_35465", "true",
532                                        "Mitigate against the cve-2021-35465 "
533                                        "security vulnurability">;
534
535def FeaturePACBTI         : SubtargetFeature<"pacbti", "HasPACBTI", "true",
536                                             "Enable Pointer Authentication and Branch "
537                                             "Target Identification">;
538
539/// Don't place a BTI instruction after return-twice constructs (setjmp).
540def FeatureNoBTIAtReturnTwice : SubtargetFeature<"no-bti-at-return-twice",
541                                                 "NoBTIAtReturnTwice", "true",
542                                                 "Don't place a BTI instruction "
543                                                 "after a return-twice">;
544
545// Armv8.9-A/Armv9.4-A 2022 Architecture Extensions
546def FeatureCLRBHB : SubtargetFeature<"clrbhb", "HasCLRBHB", "true",
547                                     "Enable Clear BHB instruction">;
548
549
550def FeatureFixCortexA57AES1742098 : SubtargetFeature<"fix-cortex-a57-aes-1742098",
551  "FixCortexA57AES1742098", "true",
552  "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)">;
553
554def FeatureAAPCSFrameChain : SubtargetFeature<"aapcs-frame-chain",
555                                              "CreateAAPCSFrameChain", "true",
556                                              "Create an AAPCS compliant frame chain">;
557
558def FeatureAAPCSFrameChainLeaf : SubtargetFeature<"aapcs-frame-chain-leaf",
559                                                  "CreateAAPCSFrameChainLeaf", "true",
560                                                  "Create an AAPCS compliant frame chain "
561                                                  "for leaf functions",
562                                                  [FeatureAAPCSFrameChain]>;
563
564// Assume that lock-free 32-bit atomics are available, even if the target
565// and operating system combination would not usually provide them. The user
566// is responsible for providing any necessary __sync implementations. Code
567// built with this feature is not ABI-compatible with code built without this
568// feature, if atomic variables are exposed across the ABI boundary.
569def FeatureAtomics32 : SubtargetFeature<
570    "atomics-32", "HasForced32BitAtomics", "true",
571    "Assume that lock-free 32-bit atomics are available">;
572
573//===----------------------------------------------------------------------===//
574// ARM architecture class
575//
576
577// A-series ISA
578def FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass",
579                                     "Is application profile ('A' series)">;
580
581// R-series ISA
582def FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass",
583                                     "Is realtime profile ('R' series)">;
584
585// M-series ISA
586def FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass",
587                                     "Is microcontroller profile ('M' series)">;
588
589// True if Thumb2 instructions are supported.
590def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
591                                     "Enable Thumb2 instructions">;
592
593// True if subtarget does not support ARM mode execution.
594def FeatureNoARM  : SubtargetFeature<"noarm", "NoARM", "true",
595                                     "Does not support ARM mode execution">;
596
597//===----------------------------------------------------------------------===//
598// ARM ISAa.
599//
600// Specify whether target support specific ARM ISA variants.
601
602def HasV4TOps   : SubtargetFeature<"v4t", "HasV4TOps", "true",
603                                   "Support ARM v4T instructions">;
604
605def HasV5TOps   : SubtargetFeature<"v5t", "HasV5TOps", "true",
606                                   "Support ARM v5T instructions",
607                                   [HasV4TOps]>;
608
609def HasV5TEOps  : SubtargetFeature<"v5te", "HasV5TEOps", "true",
610                                   "Support ARM v5TE, v5TEj, and "
611                                   "v5TExp instructions",
612                                   [HasV5TOps]>;
613
614def HasV6Ops    : SubtargetFeature<"v6", "HasV6Ops", "true",
615                                   "Support ARM v6 instructions",
616                                   [HasV5TEOps]>;
617
618def HasV6MOps   : SubtargetFeature<"v6m", "HasV6MOps", "true",
619                                   "Support ARM v6M instructions",
620                                   [HasV6Ops]>;
621
622def HasV8MBaselineOps : SubtargetFeature<"v8m", "HasV8MBaselineOps", "true",
623                                         "Support ARM v8M Baseline instructions",
624                                         [HasV6MOps]>;
625
626def HasV6KOps   : SubtargetFeature<"v6k", "HasV6KOps", "true",
627                                   "Support ARM v6k instructions",
628                                   [HasV6Ops]>;
629
630def HasV6T2Ops  : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
631                                   "Support ARM v6t2 instructions",
632                                   [HasV8MBaselineOps, HasV6KOps, FeatureThumb2]>;
633
634def HasV7Ops    : SubtargetFeature<"v7", "HasV7Ops", "true",
635                                   "Support ARM v7 instructions",
636                                   [HasV6T2Ops, FeatureV7Clrex]>;
637
638def HasV8MMainlineOps :
639                  SubtargetFeature<"v8m.main", "HasV8MMainlineOps", "true",
640                                   "Support ARM v8M Mainline instructions",
641                                   [HasV7Ops]>;
642
643def HasV8Ops    : SubtargetFeature<"v8", "HasV8Ops", "true",
644                                   "Support ARM v8 instructions",
645                                   [HasV7Ops, FeaturePerfMon, FeatureAcquireRelease]>;
646
647def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
648                                   "Support ARM v8.1a instructions",
649                                   [HasV8Ops]>;
650
651def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
652                                   "Support ARM v8.2a instructions",
653                                   [HasV8_1aOps]>;
654
655def HasV8_3aOps   : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true",
656                                   "Support ARM v8.3a instructions",
657                                   [HasV8_2aOps]>;
658
659def HasV8_4aOps   : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
660                                   "Support ARM v8.4a instructions",
661                                   [HasV8_3aOps, FeatureDotProd]>;
662
663def HasV8_5aOps   : SubtargetFeature<"v8.5a", "HasV8_5aOps", "true",
664                                   "Support ARM v8.5a instructions",
665                                   [HasV8_4aOps, FeatureSB]>;
666
667def HasV8_6aOps   : SubtargetFeature<"v8.6a", "HasV8_6aOps", "true",
668                                   "Support ARM v8.6a instructions",
669                                   [HasV8_5aOps, FeatureBF16,
670                                    FeatureMatMulInt8]>;
671
672def HasV8_7aOps   : SubtargetFeature<"v8.7a", "HasV8_7aOps", "true",
673                                   "Support ARM v8.7a instructions",
674                                   [HasV8_6aOps]>;
675
676def HasV8_8aOps   : SubtargetFeature<"v8.8a", "HasV8_8aOps", "true",
677                                   "Support ARM v8.8a instructions",
678                                   [HasV8_7aOps]>;
679
680def HasV8_9aOps   : SubtargetFeature<"v8.9a", "HasV8_9aOps", "true",
681                                   "Support ARM v8.9a instructions",
682                                   [HasV8_8aOps, FeatureCLRBHB]>;
683
684def HasV9_0aOps   : SubtargetFeature<"v9a", "HasV9_0aOps", "true",
685                                   "Support ARM v9a instructions",
686                                   [HasV8_5aOps]>;
687
688def HasV9_1aOps   : SubtargetFeature<"v9.1a", "HasV9_1aOps", "true",
689                                   "Support ARM v9.1a instructions",
690                                   [HasV8_6aOps, HasV9_0aOps]>;
691
692def HasV9_2aOps   : SubtargetFeature<"v9.2a", "HasV9_2aOps", "true",
693                                   "Support ARM v9.2a instructions",
694                                   [HasV8_7aOps, HasV9_1aOps]>;
695
696def HasV9_3aOps   : SubtargetFeature<"v9.3a", "HasV9_3aOps", "true",
697                                   "Support ARM v9.3a instructions",
698                                   [HasV8_8aOps, HasV9_2aOps]>;
699
700def HasV9_4aOps   : SubtargetFeature<"v9.4a", "HasV9_4aOps", "true",
701                                   "Support ARM v9.4a instructions",
702                                   [HasV8_9aOps, HasV9_3aOps]>;
703
704def HasV8_1MMainlineOps : SubtargetFeature<
705               "v8.1m.main", "HasV8_1MMainlineOps", "true",
706               "Support ARM v8-1M Mainline instructions",
707               [HasV8MMainlineOps]>;
708def HasMVEIntegerOps : SubtargetFeature<
709               "mve", "HasMVEIntegerOps", "true",
710               "Support M-Class Vector Extension with integer ops",
711               [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>;
712def HasMVEFloatOps : SubtargetFeature<
713               "mve.fp", "HasMVEFloatOps", "true",
714               "Support M-Class Vector Extension with integer and floating ops",
715               [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>;
716
717def HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true",
718                                 "Support CDE instructions",
719                                 [HasV8MMainlineOps]>;
720
721foreach i = {0-7} in
722    def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i,
723                                              "CoprocCDE["#i#"]", "true",
724                                              "Coprocessor "#i#" ISA is CDEv1",
725                                              [HasCDEOps]>;
726
727//===----------------------------------------------------------------------===//
728// Control codegen mitigation against Straight Line Speculation vulnerability.
729//===----------------------------------------------------------------------===//
730
731/// Harden against Straight Line Speculation for Returns and Indirect Branches.
732def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
733  "HardenSlsRetBr", "true",
734  "Harden against straight line speculation across RETurn and BranchRegister "
735  "instructions">;
736/// Harden against Straight Line Speculation for indirect calls.
737def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
738  "HardenSlsBlr", "true",
739  "Harden against straight line speculation across indirect calls">;
740/// Generate thunk code for SLS mitigation in the normal text section.
741def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
742  "HardenSlsNoComdat", "true",
743  "Generate thunk code for SLS mitigation in the normal text section">;
744
745//===----------------------------------------------------------------------===//
746// Endianness of instruction encodings in memory.
747//
748// In the current Arm architecture, this is usually little-endian regardless of
749// data endianness. But before Armv7 it was typical for instruction endianness
750// to match data endianness, so that a big-endian system was consistently big-
751// endian. And Armv7-R can be configured to use big-endian instructions.
752//
753// Additionally, even when targeting Armv7-A, big-endian instructions can be
754// found in relocatable object files, because the Arm ABI specifies that the
755// linker byte-reverses them depending on the target architecture.
756//
757// So we have a feature here to indicate that instructions are stored big-
758// endian, which you can set when instantiating an MCDisassembler.
759def ModeBigEndianInstructions : SubtargetFeature<"big-endian-instructions",
760    "BigEndianInstructions", "true",
761     "Expect instructions to be stored big-endian.">;
762
763//===----------------------------------------------------------------------===//
764// ARM Processor subtarget features.
765//
766
767def ProcA5      : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5",
768                                   "Cortex-A5 ARM processors", []>;
769def ProcA7      : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7",
770                                   "Cortex-A7 ARM processors", []>;
771def ProcA8      : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
772                                   "Cortex-A8 ARM processors", []>;
773def ProcA9      : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
774                                   "Cortex-A9 ARM processors", []>;
775def ProcA12     : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12",
776                                   "Cortex-A12 ARM processors", []>;
777def ProcA15     : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15",
778                                   "Cortex-A15 ARM processors", []>;
779def ProcA17     : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17",
780                                   "Cortex-A17 ARM processors", []>;
781def ProcA32     : SubtargetFeature<"a32", "ARMProcFamily", "CortexA32",
782                                   "Cortex-A32 ARM processors", []>;
783def ProcA35     : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
784                                   "Cortex-A35 ARM processors", []>;
785def ProcA53     : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
786                                   "Cortex-A53 ARM processors", []>;
787def ProcA55     : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55",
788                                   "Cortex-A55 ARM processors", []>;
789def ProcA57     : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
790                                   "Cortex-A57 ARM processors", []>;
791def ProcA72     : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
792                                   "Cortex-A72 ARM processors", []>;
793def ProcA73     : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
794                                   "Cortex-A73 ARM processors", []>;
795def ProcA75     : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75",
796                                   "Cortex-A75 ARM processors", []>;
797def ProcA76     : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76",
798                                   "Cortex-A76 ARM processors", []>;
799def ProcA77     : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
800                                   "Cortex-A77 ARM processors", []>;
801def ProcA78     : SubtargetFeature<"cortex-a78", "ARMProcFamily", "CortexA78",
802                                   "Cortex-A78 ARM processors", []>;
803def ProcA78C    : SubtargetFeature<"a78c", "ARMProcFamily", "CortexA78C",
804                                   "Cortex-A78C ARM processors", []>;
805def ProcA710    : SubtargetFeature<"cortex-a710", "ARMProcFamily",
806                                   "CortexA710", "Cortex-A710 ARM processors", []>;
807def ProcX1      : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
808                                   "Cortex-X1 ARM processors", []>;
809def ProcX1C     : SubtargetFeature<"cortex-x1c", "ARMProcFamily", "CortexX1C",
810                                   "Cortex-X1C ARM processors", []>;
811
812def ProcV1      : SubtargetFeature<"neoverse-v1", "ARMProcFamily",
813                                   "NeoverseV1", "Neoverse-V1 ARM processors", []>;
814
815def ProcKrait   : SubtargetFeature<"krait", "ARMProcFamily", "Krait",
816                                   "Qualcomm Krait processors", []>;
817def ProcKryo    : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
818                                   "Qualcomm Kryo processors", []>;
819def ProcSwift   : SubtargetFeature<"swift", "ARMProcFamily", "Swift",
820                                   "Swift ARM processors", []>;
821
822def ProcExynos  : SubtargetFeature<"exynos", "ARMProcFamily", "Exynos",
823                                   "Samsung Exynos processors",
824                                   [FeatureZCZeroing,
825                                    FeatureUseWideStrideVFP,
826                                    FeatureSplatVFPToNeon,
827                                    FeatureSlowVGETLNi32,
828                                    FeatureSlowVDUP32,
829                                    FeatureSlowFPBrcc,
830                                    FeatureProfUnpredicate,
831                                    FeatureHWDivThumb,
832                                    FeatureHWDivARM,
833                                    FeatureHasSlowFPVMLx,
834                                    FeatureHasSlowFPVFMx,
835                                    FeatureHasRetAddrStack,
836                                    FeatureFuseLiterals,
837                                    FeatureFuseAES,
838                                    FeatureExpandMLx,
839                                    FeatureCrypto,
840                                    FeatureCRC]>;
841
842def ProcR4      : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4",
843                                   "Cortex-R4 ARM processors", []>;
844def ProcR5      : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5",
845                                   "Cortex-R5 ARM processors", []>;
846def ProcR7      : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7",
847                                   "Cortex-R7 ARM processors", []>;
848def ProcR52     : SubtargetFeature<"r52", "ARMProcFamily", "CortexR52",
849                                   "Cortex-R52 ARM processors", []>;
850
851def ProcM3      : SubtargetFeature<"m3", "ARMProcFamily", "CortexM3",
852                                   "Cortex-M3 ARM processors", []>;
853def ProcM7      : SubtargetFeature<"m7", "ARMProcFamily", "CortexM7",
854                                   "Cortex-M7 ARM processors", []>;
855
856//===----------------------------------------------------------------------===//
857// ARM Helper classes.
858//
859
860class Architecture<string fname, string aname, list<SubtargetFeature> features>
861  : SubtargetFeature<fname, "ARMArch", aname,
862                     !strconcat(aname, " architecture"), features>;
863
864class ProcNoItin<string Name, list<SubtargetFeature> Features>
865  : Processor<Name, NoItineraries, Features>;
866
867
868//===----------------------------------------------------------------------===//
869// ARM architectures
870//
871
872def ARMv4     : Architecture<"armv4",     "ARMv4",    []>;
873
874def ARMv4t    : Architecture<"armv4t",    "ARMv4t",   [HasV4TOps]>;
875
876def ARMv5t    : Architecture<"armv5t",    "ARMv5t",   [HasV5TOps]>;
877
878def ARMv5te   : Architecture<"armv5te",   "ARMv5te",  [HasV5TEOps]>;
879
880def ARMv5tej  : Architecture<"armv5tej",  "ARMv5tej", [HasV5TEOps]>;
881
882def ARMv6     : Architecture<"armv6",     "ARMv6",    [HasV6Ops,
883                                                       FeatureDSP]>;
884
885def ARMv6t2   : Architecture<"armv6t2",   "ARMv6t2",  [HasV6T2Ops,
886                                                       FeatureDSP]>;
887
888def ARMv6k    : Architecture<"armv6k",    "ARMv6k",   [HasV6KOps]>;
889
890def ARMv6kz   : Architecture<"armv6kz",   "ARMv6kz",  [HasV6KOps,
891                                                       FeatureTrustZone]>;
892
893def ARMv6m    : Architecture<"armv6-m",   "ARMv6m",   [HasV6MOps,
894                                                       FeatureNoARM,
895                                                       ModeThumb,
896                                                       FeatureDB,
897                                                       FeatureMClass,
898                                                       FeatureStrictAlign]>;
899
900def ARMv6sm   : Architecture<"armv6s-m",  "ARMv6sm",  [HasV6MOps,
901                                                       FeatureNoARM,
902                                                       ModeThumb,
903                                                       FeatureDB,
904                                                       FeatureMClass,
905                                                       FeatureStrictAlign]>;
906
907def ARMv7a    : Architecture<"armv7-a",   "ARMv7a",   [HasV7Ops,
908                                                       FeatureNEON,
909                                                       FeatureDB,
910                                                       FeatureDSP,
911                                                       FeatureAClass,
912                                                       FeaturePerfMon]>;
913
914def ARMv7ve   : Architecture<"armv7ve",   "ARMv7ve",  [HasV7Ops,
915                                                       FeatureNEON,
916                                                       FeatureDB,
917                                                       FeatureDSP,
918                                                       FeatureTrustZone,
919                                                       FeatureMP,
920                                                       FeatureVirtualization,
921                                                       FeatureAClass,
922                                                       FeaturePerfMon]>;
923
924def ARMv7r    : Architecture<"armv7-r",   "ARMv7r",   [HasV7Ops,
925                                                       FeatureDB,
926                                                       FeatureDSP,
927                                                       FeatureHWDivThumb,
928                                                       FeatureRClass,
929                                                       FeaturePerfMon]>;
930
931def ARMv7m    : Architecture<"armv7-m",   "ARMv7m",   [HasV7Ops,
932                                                       FeatureThumb2,
933                                                       FeatureNoARM,
934                                                       ModeThumb,
935                                                       FeatureDB,
936                                                       FeatureHWDivThumb,
937                                                       FeatureMClass]>;
938
939def ARMv7em   : Architecture<"armv7e-m",  "ARMv7em",  [HasV7Ops,
940                                                       FeatureThumb2,
941                                                       FeatureNoARM,
942                                                       ModeThumb,
943                                                       FeatureDB,
944                                                       FeatureHWDivThumb,
945                                                       FeatureMClass,
946                                                       FeatureDSP]>;
947
948def ARMv8a    : Architecture<"armv8-a",   "ARMv8a",   [HasV8Ops,
949                                                       FeatureAClass,
950                                                       FeatureDB,
951                                                       FeatureFPARMv8,
952                                                       FeatureNEON,
953                                                       FeatureDSP,
954                                                       FeatureTrustZone,
955                                                       FeatureMP,
956                                                       FeatureVirtualization,
957                                                       FeatureCrypto,
958                                                       FeatureCRC]>;
959
960def ARMv81a   : Architecture<"armv8.1-a", "ARMv81a",  [HasV8_1aOps,
961                                                       FeatureAClass,
962                                                       FeatureDB,
963                                                       FeatureFPARMv8,
964                                                       FeatureNEON,
965                                                       FeatureDSP,
966                                                       FeatureTrustZone,
967                                                       FeatureMP,
968                                                       FeatureVirtualization,
969                                                       FeatureCrypto,
970                                                       FeatureCRC]>;
971
972def ARMv82a   : Architecture<"armv8.2-a", "ARMv82a",  [HasV8_2aOps,
973                                                       FeatureAClass,
974                                                       FeatureDB,
975                                                       FeatureFPARMv8,
976                                                       FeatureNEON,
977                                                       FeatureDSP,
978                                                       FeatureTrustZone,
979                                                       FeatureMP,
980                                                       FeatureVirtualization,
981                                                       FeatureCrypto,
982                                                       FeatureCRC,
983                                                       FeatureRAS]>;
984
985def ARMv83a   : Architecture<"armv8.3-a", "ARMv83a",  [HasV8_3aOps,
986                                                       FeatureAClass,
987                                                       FeatureDB,
988                                                       FeatureFPARMv8,
989                                                       FeatureNEON,
990                                                       FeatureDSP,
991                                                       FeatureTrustZone,
992                                                       FeatureMP,
993                                                       FeatureVirtualization,
994                                                       FeatureCrypto,
995                                                       FeatureCRC,
996                                                       FeatureRAS]>;
997
998def ARMv84a   : Architecture<"armv8.4-a", "ARMv84a",  [HasV8_4aOps,
999                                                       FeatureAClass,
1000                                                       FeatureDB,
1001                                                       FeatureFPARMv8,
1002                                                       FeatureNEON,
1003                                                       FeatureDSP,
1004                                                       FeatureTrustZone,
1005                                                       FeatureMP,
1006                                                       FeatureVirtualization,
1007                                                       FeatureCrypto,
1008                                                       FeatureCRC,
1009                                                       FeatureRAS,
1010                                                       FeatureDotProd]>;
1011
1012def ARMv85a   : Architecture<"armv8.5-a", "ARMv85a",  [HasV8_5aOps,
1013                                                       FeatureAClass,
1014                                                       FeatureDB,
1015                                                       FeatureFPARMv8,
1016                                                       FeatureNEON,
1017                                                       FeatureDSP,
1018                                                       FeatureTrustZone,
1019                                                       FeatureMP,
1020                                                       FeatureVirtualization,
1021                                                       FeatureCrypto,
1022                                                       FeatureCRC,
1023                                                       FeatureRAS,
1024                                                       FeatureDotProd]>;
1025def ARMv86a   : Architecture<"armv8.6-a", "ARMv86a",  [HasV8_6aOps,
1026                                                       FeatureAClass,
1027                                                       FeatureDB,
1028                                                       FeatureFPARMv8,
1029                                                       FeatureNEON,
1030                                                       FeatureDSP,
1031                                                       FeatureTrustZone,
1032                                                       FeatureMP,
1033                                                       FeatureVirtualization,
1034                                                       FeatureCrypto,
1035                                                       FeatureCRC,
1036                                                       FeatureRAS,
1037                                                       FeatureDotProd]>;
1038def ARMv87a   : Architecture<"armv8.7-a", "ARMv87a",  [HasV8_7aOps,
1039                                                       FeatureAClass,
1040                                                       FeatureDB,
1041                                                       FeatureFPARMv8,
1042                                                       FeatureNEON,
1043                                                       FeatureDSP,
1044                                                       FeatureTrustZone,
1045                                                       FeatureMP,
1046                                                       FeatureVirtualization,
1047                                                       FeatureCrypto,
1048                                                       FeatureCRC,
1049                                                       FeatureRAS,
1050                                                       FeatureDotProd]>;
1051def ARMv88a   : Architecture<"armv8.8-a", "ARMv88a",  [HasV8_8aOps,
1052                                                       FeatureAClass,
1053                                                       FeatureDB,
1054                                                       FeatureFPARMv8,
1055                                                       FeatureNEON,
1056                                                       FeatureDSP,
1057                                                       FeatureTrustZone,
1058                                                       FeatureMP,
1059                                                       FeatureVirtualization,
1060                                                       FeatureCrypto,
1061                                                       FeatureCRC,
1062                                                       FeatureRAS,
1063                                                       FeatureDotProd]>;
1064def ARMv89a   : Architecture<"armv8.9-a", "ARMv89a",  [HasV8_9aOps,
1065                                                       FeatureAClass,
1066                                                       FeatureDB,
1067                                                       FeatureFPARMv8,
1068                                                       FeatureNEON,
1069                                                       FeatureDSP,
1070                                                       FeatureTrustZone,
1071                                                       FeatureMP,
1072                                                       FeatureVirtualization,
1073                                                       FeatureCrypto,
1074                                                       FeatureCRC,
1075                                                       FeatureRAS,
1076                                                       FeatureDotProd]>;
1077
1078def ARMv9a   : Architecture<"armv9-a", "ARMv9a",       [HasV9_0aOps,
1079                                                       FeatureAClass,
1080                                                       FeatureDB,
1081                                                       FeatureFPARMv8,
1082                                                       FeatureNEON,
1083                                                       FeatureDSP,
1084                                                       FeatureTrustZone,
1085                                                       FeatureMP,
1086                                                       FeatureVirtualization,
1087                                                       FeatureCRC,
1088                                                       FeatureRAS,
1089                                                       FeatureDotProd]>;
1090def ARMv91a   : Architecture<"armv9.1-a", "ARMv91a",   [HasV9_1aOps,
1091                                                       FeatureAClass,
1092                                                       FeatureDB,
1093                                                       FeatureFPARMv8,
1094                                                       FeatureNEON,
1095                                                       FeatureDSP,
1096                                                       FeatureTrustZone,
1097                                                       FeatureMP,
1098                                                       FeatureVirtualization,
1099                                                       FeatureCRC,
1100                                                       FeatureRAS,
1101                                                       FeatureDotProd]>;
1102def ARMv92a   : Architecture<"armv9.2-a", "ARMv92a",  [HasV9_2aOps,
1103                                                       FeatureAClass,
1104                                                       FeatureDB,
1105                                                       FeatureFPARMv8,
1106                                                       FeatureNEON,
1107                                                       FeatureDSP,
1108                                                       FeatureTrustZone,
1109                                                       FeatureMP,
1110                                                       FeatureVirtualization,
1111                                                       FeatureCRC,
1112                                                       FeatureRAS,
1113                                                       FeatureDotProd]>;
1114def ARMv93a   : Architecture<"armv9.3-a", "ARMv93a",  [HasV9_3aOps,
1115                                                       FeatureAClass,
1116                                                       FeatureDB,
1117                                                       FeatureFPARMv8,
1118                                                       FeatureNEON,
1119                                                       FeatureDSP,
1120                                                       FeatureTrustZone,
1121                                                       FeatureMP,
1122                                                       FeatureVirtualization,
1123                                                       FeatureCrypto,
1124                                                       FeatureCRC,
1125                                                       FeatureRAS,
1126                                                       FeatureDotProd]>;
1127def ARMv94a   : Architecture<"armv9.4-a", "ARMv94a",  [HasV9_4aOps,
1128                                                       FeatureAClass,
1129                                                       FeatureDB,
1130                                                       FeatureFPARMv8,
1131                                                       FeatureNEON,
1132                                                       FeatureDSP,
1133                                                       FeatureTrustZone,
1134                                                       FeatureMP,
1135                                                       FeatureVirtualization,
1136                                                       FeatureCRC,
1137                                                       FeatureRAS,
1138                                                       FeatureDotProd]>;
1139
1140def ARMv8r    : Architecture<"armv8-r",   "ARMv8r",   [HasV8Ops,
1141                                                       FeatureRClass,
1142                                                       FeatureDB,
1143                                                       FeatureDFB,
1144                                                       FeatureDSP,
1145                                                       FeatureCRC,
1146                                                       FeatureMP,
1147                                                       FeatureVirtualization,
1148                                                       FeatureFPARMv8,
1149                                                       FeatureNEON]>;
1150
1151def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
1152                                                      [HasV8MBaselineOps,
1153                                                       FeatureNoARM,
1154                                                       ModeThumb,
1155                                                       FeatureDB,
1156                                                       FeatureHWDivThumb,
1157                                                       FeatureV7Clrex,
1158                                                       Feature8MSecExt,
1159                                                       FeatureAcquireRelease,
1160                                                       FeatureMClass,
1161                                                       FeatureStrictAlign]>;
1162
1163def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline",
1164                                                      [HasV8MMainlineOps,
1165                                                       FeatureNoARM,
1166                                                       ModeThumb,
1167                                                       FeatureDB,
1168                                                       FeatureHWDivThumb,
1169                                                       Feature8MSecExt,
1170                                                       FeatureAcquireRelease,
1171                                                       FeatureMClass]>;
1172
1173def ARMv81mMainline : Architecture<"armv8.1-m.main", "ARMv81mMainline",
1174                                                      [HasV8_1MMainlineOps,
1175                                                       FeatureNoARM,
1176                                                       ModeThumb,
1177                                                       FeatureDB,
1178                                                       FeatureHWDivThumb,
1179                                                       Feature8MSecExt,
1180                                                       FeatureAcquireRelease,
1181                                                       FeatureMClass,
1182                                                       FeatureRAS,
1183                                                       FeatureLOB]>;
1184
1185// Aliases
1186def IWMMXT   : Architecture<"iwmmxt",      "ARMv5te",  [ARMv5te]>;
1187def IWMMXT2  : Architecture<"iwmmxt2",     "ARMv5te",  [ARMv5te]>;
1188def XScale   : Architecture<"xscale",      "ARMv5te",  [ARMv5te]>;
1189def ARMv6j   : Architecture<"armv6j",      "ARMv7a",   [ARMv6]>;
1190def ARMv7k   : Architecture<"armv7k",      "ARMv7a",   [ARMv7a]>;
1191def ARMv7s   : Architecture<"armv7s",      "ARMv7a",   [ARMv7a]>;
1192
1193//===----------------------------------------------------------------------===//
1194// Register File Description
1195//===----------------------------------------------------------------------===//
1196
1197include "ARMRegisterInfo.td"
1198include "ARMRegisterBanks.td"
1199include "ARMCallingConv.td"
1200
1201//===----------------------------------------------------------------------===//
1202// ARM schedules.
1203//===----------------------------------------------------------------------===//
1204//
1205include "ARMPredicates.td"
1206include "ARMSchedule.td"
1207
1208//===----------------------------------------------------------------------===//
1209// Instruction Descriptions
1210//===----------------------------------------------------------------------===//
1211
1212include "ARMInstrInfo.td"
1213def ARMInstrInfo : InstrInfo;
1214
1215//===----------------------------------------------------------------------===//
1216// ARM schedules
1217//
1218include "ARMScheduleV6.td"
1219include "ARMScheduleA8.td"
1220include "ARMScheduleA9.td"
1221include "ARMScheduleSwift.td"
1222include "ARMScheduleR52.td"
1223include "ARMScheduleA57.td"
1224include "ARMScheduleM4.td"
1225include "ARMScheduleM55.td"
1226include "ARMScheduleM7.td"
1227
1228//===----------------------------------------------------------------------===//
1229// ARM processors
1230//
1231// Dummy CPU, used to target architectures
1232def : ProcessorModel<"generic",     CortexA8Model,      []>;
1233
1234// FIXME: Several processors below are not using their own scheduler
1235// model, but one of similar/previous processor. These should be fixed.
1236
1237def : ProcNoItin<"arm8",                                [ARMv4]>;
1238def : ProcNoItin<"arm810",                              [ARMv4]>;
1239def : ProcNoItin<"strongarm",                           [ARMv4]>;
1240def : ProcNoItin<"strongarm110",                        [ARMv4]>;
1241def : ProcNoItin<"strongarm1100",                       [ARMv4]>;
1242def : ProcNoItin<"strongarm1110",                       [ARMv4]>;
1243
1244def : ProcNoItin<"arm7tdmi",                            [ARMv4t]>;
1245def : ProcNoItin<"arm7tdmi-s",                          [ARMv4t]>;
1246def : ProcNoItin<"arm710t",                             [ARMv4t]>;
1247def : ProcNoItin<"arm720t",                             [ARMv4t]>;
1248def : ProcNoItin<"arm9",                                [ARMv4t]>;
1249def : ProcNoItin<"arm9tdmi",                            [ARMv4t]>;
1250def : ProcNoItin<"arm920",                              [ARMv4t]>;
1251def : ProcNoItin<"arm920t",                             [ARMv4t]>;
1252def : ProcNoItin<"arm922t",                             [ARMv4t]>;
1253def : ProcNoItin<"arm940t",                             [ARMv4t]>;
1254def : ProcNoItin<"ep9312",                              [ARMv4t]>;
1255
1256def : ProcNoItin<"arm10tdmi",                           [ARMv5t]>;
1257def : ProcNoItin<"arm1020t",                            [ARMv5t]>;
1258
1259def : ProcNoItin<"arm9e",                               [ARMv5te]>;
1260def : ProcNoItin<"arm926ej-s",                          [ARMv5te]>;
1261def : ProcNoItin<"arm946e-s",                           [ARMv5te]>;
1262def : ProcNoItin<"arm966e-s",                           [ARMv5te]>;
1263def : ProcNoItin<"arm968e-s",                           [ARMv5te]>;
1264def : ProcNoItin<"arm10e",                              [ARMv5te]>;
1265def : ProcNoItin<"arm1020e",                            [ARMv5te]>;
1266def : ProcNoItin<"arm1022e",                            [ARMv5te]>;
1267def : ProcNoItin<"xscale",                              [ARMv5te]>;
1268def : ProcNoItin<"iwmmxt",                              [ARMv5te]>;
1269
1270def : Processor<"arm1136j-s",       ARMV6Itineraries,   [ARMv6]>;
1271def : Processor<"arm1136jf-s",      ARMV6Itineraries,   [ARMv6,
1272                                                         FeatureVFP2,
1273                                                         FeatureHasSlowFPVMLx]>;
1274
1275def : Processor<"cortex-m0",        ARMV6Itineraries,   [ARMv6m,
1276                                                         FeatureHasNoBranchPredictor]>;
1277def : Processor<"cortex-m0plus",    ARMV6Itineraries,   [ARMv6m,
1278                                                         FeatureHasNoBranchPredictor]>;
1279def : Processor<"cortex-m1",        ARMV6Itineraries,   [ARMv6m,
1280                                                         FeatureHasNoBranchPredictor]>;
1281def : Processor<"sc000",            ARMV6Itineraries,   [ARMv6m,
1282                                                         FeatureHasNoBranchPredictor]>;
1283
1284def : Processor<"arm1176jz-s",      ARMV6Itineraries,   [ARMv6kz]>;
1285def : Processor<"arm1176jzf-s",     ARMV6Itineraries,   [ARMv6kz,
1286                                                         FeatureVFP2,
1287                                                         FeatureHasSlowFPVMLx]>;
1288
1289def : Processor<"mpcorenovfp",      ARMV6Itineraries,   [ARMv6k]>;
1290def : Processor<"mpcore",           ARMV6Itineraries,   [ARMv6k,
1291                                                         FeatureVFP2,
1292                                                         FeatureHasSlowFPVMLx]>;
1293
1294def : Processor<"arm1156t2-s",      ARMV6Itineraries,   [ARMv6t2]>;
1295def : Processor<"arm1156t2f-s",     ARMV6Itineraries,   [ARMv6t2,
1296                                                         FeatureVFP2,
1297                                                         FeatureHasSlowFPVMLx]>;
1298
1299def : ProcessorModel<"cortex-a5",   CortexA8Model,      [ARMv7a, ProcA5,
1300                                                         FeatureHasRetAddrStack,
1301                                                         FeatureTrustZone,
1302                                                         FeatureSlowFPBrcc,
1303                                                         FeatureHasSlowFPVMLx,
1304                                                         FeatureHasSlowFPVFMx,
1305                                                         FeatureVMLxForwarding,
1306                                                         FeatureMP,
1307                                                         FeatureVFP4]>;
1308
1309def : ProcessorModel<"cortex-a7",   CortexA8Model,      [ARMv7a, ProcA7,
1310                                                         FeatureHasRetAddrStack,
1311                                                         FeatureTrustZone,
1312                                                         FeatureSlowFPBrcc,
1313                                                         FeatureHasVMLxHazards,
1314                                                         FeatureHasSlowFPVMLx,
1315                                                         FeatureHasSlowFPVFMx,
1316                                                         FeatureVMLxForwarding,
1317                                                         FeatureMP,
1318                                                         FeatureVFP4,
1319                                                         FeatureVirtualization]>;
1320
1321def : ProcessorModel<"cortex-a8",   CortexA8Model,      [ARMv7a, ProcA8,
1322                                                         FeatureHasRetAddrStack,
1323                                                         FeatureNonpipelinedVFP,
1324                                                         FeatureTrustZone,
1325                                                         FeatureSlowFPBrcc,
1326                                                         FeatureHasVMLxHazards,
1327                                                         FeatureHasSlowFPVMLx,
1328                                                         FeatureHasSlowFPVFMx,
1329                                                         FeatureVMLxForwarding]>;
1330
1331def : ProcessorModel<"cortex-a9",   CortexA9Model,      [ARMv7a, ProcA9,
1332                                                         FeatureHasRetAddrStack,
1333                                                         FeatureTrustZone,
1334                                                         FeatureHasVMLxHazards,
1335                                                         FeatureVMLxForwarding,
1336                                                         FeatureFP16,
1337                                                         FeatureAvoidPartialCPSR,
1338                                                         FeatureExpandMLx,
1339                                                         FeaturePreferVMOVSR,
1340                                                         FeatureMuxedUnits,
1341                                                         FeatureNEONForFPMovs,
1342                                                         FeatureCheckVLDnAlign,
1343                                                         FeatureMP]>;
1344
1345def : ProcessorModel<"cortex-a12",  CortexA9Model,      [ARMv7a, ProcA12,
1346                                                         FeatureHasRetAddrStack,
1347                                                         FeatureTrustZone,
1348                                                         FeatureVMLxForwarding,
1349                                                         FeatureVFP4,
1350                                                         FeatureAvoidPartialCPSR,
1351                                                         FeatureVirtualization,
1352                                                         FeatureMP]>;
1353
1354def : ProcessorModel<"cortex-a15",  CortexA9Model,      [ARMv7a, ProcA15,
1355                                                         FeatureDontWidenVMOVS,
1356                                                         FeatureSplatVFPToNeon,
1357                                                         FeatureHasRetAddrStack,
1358                                                         FeatureMuxedUnits,
1359                                                         FeatureTrustZone,
1360                                                         FeatureVFP4,
1361                                                         FeatureMP,
1362                                                         FeatureCheckVLDnAlign,
1363                                                         FeatureAvoidPartialCPSR,
1364                                                         FeatureVirtualization]>;
1365
1366def : ProcessorModel<"cortex-a17",  CortexA9Model,      [ARMv7a, ProcA17,
1367                                                         FeatureHasRetAddrStack,
1368                                                         FeatureTrustZone,
1369                                                         FeatureMP,
1370                                                         FeatureVMLxForwarding,
1371                                                         FeatureVFP4,
1372                                                         FeatureAvoidPartialCPSR,
1373                                                         FeatureVirtualization]>;
1374
1375// FIXME: krait has currently the same features as A9 plus VFP4 and  HWDiv
1376def : ProcessorModel<"krait",       CortexA9Model,      [ARMv7a, ProcKrait,
1377                                                         FeatureHasRetAddrStack,
1378                                                         FeatureMuxedUnits,
1379                                                         FeatureCheckVLDnAlign,
1380                                                         FeatureVMLxForwarding,
1381                                                         FeatureFP16,
1382                                                         FeatureAvoidPartialCPSR,
1383                                                         FeatureVFP4,
1384                                                         FeatureHWDivThumb,
1385                                                         FeatureHWDivARM]>;
1386
1387def : ProcessorModel<"swift",       SwiftModel,         [ARMv7a, ProcSwift,
1388                                                         FeatureHasRetAddrStack,
1389                                                         FeatureNEONForFP,
1390                                                         FeatureVFP4,
1391                                                         FeatureUseWideStrideVFP,
1392                                                         FeatureMP,
1393                                                         FeatureHWDivThumb,
1394                                                         FeatureHWDivARM,
1395                                                         FeatureAvoidPartialCPSR,
1396                                                         FeatureAvoidMOVsShOp,
1397                                                         FeatureHasSlowFPVMLx,
1398                                                         FeatureHasSlowFPVFMx,
1399                                                         FeatureHasVMLxHazards,
1400                                                         FeatureProfUnpredicate,
1401                                                         FeaturePrefISHSTBarrier,
1402                                                         FeatureSlowOddRegister,
1403                                                         FeatureSlowLoadDSubreg,
1404                                                         FeatureSlowVGETLNi32,
1405                                                         FeatureSlowVDUP32,
1406                                                         FeatureUseMISched,
1407                                                         FeatureNoPostRASched]>;
1408
1409def : ProcessorModel<"cortex-r4",   CortexA8Model,      [ARMv7r, ProcR4,
1410                                                         FeatureHasRetAddrStack,
1411                                                         FeatureAvoidPartialCPSR]>;
1412
1413def : ProcessorModel<"cortex-r4f",  CortexA8Model,      [ARMv7r, ProcR4,
1414                                                         FeatureHasRetAddrStack,
1415                                                         FeatureSlowFPBrcc,
1416                                                         FeatureHasSlowFPVMLx,
1417                                                         FeatureHasSlowFPVFMx,
1418                                                         FeatureVFP3_D16,
1419                                                         FeatureAvoidPartialCPSR]>;
1420
1421def : ProcessorModel<"cortex-r5",   CortexA8Model,      [ARMv7r, ProcR5,
1422                                                         FeatureHasRetAddrStack,
1423                                                         FeatureVFP3_D16,
1424                                                         FeatureSlowFPBrcc,
1425                                                         FeatureHWDivARM,
1426                                                         FeatureHasSlowFPVMLx,
1427                                                         FeatureHasSlowFPVFMx,
1428                                                         FeatureAvoidPartialCPSR]>;
1429
1430def : ProcessorModel<"cortex-r7",   CortexA8Model,      [ARMv7r, ProcR7,
1431                                                         FeatureHasRetAddrStack,
1432                                                         FeatureVFP3_D16,
1433                                                         FeatureFP16,
1434                                                         FeatureMP,
1435                                                         FeatureSlowFPBrcc,
1436                                                         FeatureHWDivARM,
1437                                                         FeatureHasSlowFPVMLx,
1438                                                         FeatureHasSlowFPVFMx,
1439                                                         FeatureAvoidPartialCPSR]>;
1440
1441def : ProcessorModel<"cortex-r8",   CortexA8Model,      [ARMv7r,
1442                                                         FeatureHasRetAddrStack,
1443                                                         FeatureVFP3_D16,
1444                                                         FeatureFP16,
1445                                                         FeatureMP,
1446                                                         FeatureSlowFPBrcc,
1447                                                         FeatureHWDivARM,
1448                                                         FeatureHasSlowFPVMLx,
1449                                                         FeatureHasSlowFPVFMx,
1450                                                         FeatureAvoidPartialCPSR]>;
1451
1452def : ProcessorModel<"cortex-m3",   CortexM4Model,      [ARMv7m,
1453                                                         ProcM3,
1454                                                         FeaturePrefLoopAlign32,
1455                                                         FeatureUseMISched,
1456                                                         FeatureHasNoBranchPredictor]>;
1457
1458def : ProcessorModel<"sc300",       CortexM4Model,      [ARMv7m,
1459                                                         ProcM3,
1460                                                         FeatureUseMISched,
1461                                                         FeatureHasNoBranchPredictor]>;
1462
1463def : ProcessorModel<"cortex-m4", CortexM4Model,        [ARMv7em,
1464                                                         FeatureVFP4_D16_SP,
1465                                                         FeaturePrefLoopAlign32,
1466                                                         FeatureHasSlowFPVMLx,
1467                                                         FeatureHasSlowFPVFMx,
1468                                                         FeatureUseMISched,
1469                                                         FeatureHasNoBranchPredictor]>;
1470
1471def : ProcessorModel<"cortex-m7", CortexM7Model,        [ARMv7em,
1472                                                         ProcM7,
1473                                                         FeatureFPARMv8_D16,
1474                                                         FeatureUseMIPipeliner,
1475                                                         FeatureUseMISched]>;
1476
1477def : ProcNoItin<"cortex-m23",                          [ARMv8mBaseline,
1478                                                         FeatureNoMovt,
1479                                                         FeatureHasNoBranchPredictor]>;
1480
1481def : ProcessorModel<"cortex-m33", CortexM4Model,       [ARMv8mMainline,
1482                                                         FeatureDSP,
1483                                                         FeatureFPARMv8_D16_SP,
1484                                                         FeaturePrefLoopAlign32,
1485                                                         FeatureHasSlowFPVMLx,
1486                                                         FeatureHasSlowFPVFMx,
1487                                                         FeatureUseMISched,
1488                                                         FeatureHasNoBranchPredictor,
1489                                                         FeatureFixCMSE_CVE_2021_35465]>;
1490
1491def : ProcessorModel<"cortex-m35p", CortexM4Model,      [ARMv8mMainline,
1492                                                         FeatureDSP,
1493                                                         FeatureFPARMv8_D16_SP,
1494                                                         FeaturePrefLoopAlign32,
1495                                                         FeatureHasSlowFPVMLx,
1496                                                         FeatureHasSlowFPVFMx,
1497                                                         FeatureUseMISched,
1498                                                         FeatureHasNoBranchPredictor,
1499                                                         FeatureFixCMSE_CVE_2021_35465]>;
1500
1501def : ProcessorModel<"cortex-m55", CortexM55Model,      [ARMv81mMainline,
1502                                                         FeatureDSP,
1503                                                         FeatureFPARMv8_D16,
1504                                                         FeatureUseMISched,
1505                                                         FeatureHasNoBranchPredictor,
1506                                                         FeaturePrefLoopAlign32,
1507                                                         FeatureHasSlowFPVMLx,
1508                                                         HasMVEFloatOps,
1509                                                         FeatureFixCMSE_CVE_2021_35465]>;
1510
1511def : ProcessorModel<"cortex-m85", CortexM7Model,       [ARMv81mMainline,
1512                                                         FeatureDSP,
1513                                                         FeatureFPARMv8_D16,
1514                                                         FeaturePACBTI,
1515                                                         FeatureUseMISched,
1516                                                         HasMVEFloatOps]>;
1517
1518def : ProcNoItin<"cortex-a32",                           [ARMv8a,
1519                                                         FeatureHWDivThumb,
1520                                                         FeatureHWDivARM,
1521                                                         FeatureCrypto,
1522                                                         FeatureCRC]>;
1523
1524def : ProcNoItin<"cortex-a35",                          [ARMv8a, ProcA35,
1525                                                         FeatureHWDivThumb,
1526                                                         FeatureHWDivARM,
1527                                                         FeatureCrypto,
1528                                                         FeatureCRC]>;
1529
1530def : ProcNoItin<"cortex-a53",                          [ARMv8a, ProcA53,
1531                                                         FeatureHWDivThumb,
1532                                                         FeatureHWDivARM,
1533                                                         FeatureCrypto,
1534                                                         FeatureCRC,
1535                                                         FeatureFPAO]>;
1536
1537def : ProcNoItin<"cortex-a55",                          [ARMv82a, ProcA55,
1538                                                         FeatureHWDivThumb,
1539                                                         FeatureHWDivARM,
1540                                                         FeatureDotProd]>;
1541
1542def : ProcessorModel<"cortex-a57",  CortexA57Model,     [ARMv8a, ProcA57,
1543                                                         FeatureHWDivThumb,
1544                                                         FeatureHWDivARM,
1545                                                         FeatureCrypto,
1546                                                         FeatureCRC,
1547                                                         FeatureFPAO,
1548                                                         FeatureAvoidPartialCPSR,
1549                                                         FeatureCheapPredicableCPSR,
1550                                                         FeatureFixCortexA57AES1742098]>;
1551
1552def : ProcessorModel<"cortex-a72",  CortexA57Model,     [ARMv8a, ProcA72,
1553                                                         FeatureHWDivThumb,
1554                                                         FeatureHWDivARM,
1555                                                         FeatureCrypto,
1556                                                         FeatureCRC,
1557                                                         FeatureFixCortexA57AES1742098]>;
1558
1559def : ProcNoItin<"cortex-a73",                          [ARMv8a, ProcA73,
1560                                                         FeatureHWDivThumb,
1561                                                         FeatureHWDivARM,
1562                                                         FeatureCrypto,
1563                                                         FeatureCRC]>;
1564
1565def : ProcNoItin<"cortex-a75",                          [ARMv82a, ProcA75,
1566                                                         FeatureHWDivThumb,
1567                                                         FeatureHWDivARM,
1568                                                         FeatureDotProd]>;
1569
1570def : ProcNoItin<"cortex-a76",                          [ARMv82a, ProcA76,
1571                                                         FeatureHWDivThumb,
1572                                                         FeatureHWDivARM,
1573                                                         FeatureCrypto,
1574                                                         FeatureCRC,
1575                                                         FeatureFullFP16,
1576                                                         FeatureDotProd]>;
1577
1578def : ProcNoItin<"cortex-a76ae",                        [ARMv82a, ProcA76,
1579                                                         FeatureHWDivThumb,
1580                                                         FeatureHWDivARM,
1581                                                         FeatureCrypto,
1582                                                         FeatureCRC,
1583                                                         FeatureFullFP16,
1584                                                         FeatureDotProd]>;
1585
1586def : ProcNoItin<"cortex-a77",                          [ARMv82a, ProcA77,
1587                                                         FeatureHWDivThumb,
1588                                                         FeatureHWDivARM,
1589                                                         FeatureCrypto,
1590                                                         FeatureCRC,
1591                                                         FeatureFullFP16,
1592                                                         FeatureDotProd]>;
1593
1594def : ProcNoItin<"cortex-a78",                          [ARMv82a, ProcA78,
1595                                                         FeatureHWDivThumb,
1596                                                         FeatureHWDivARM,
1597                                                         FeatureCrypto,
1598                                                         FeatureCRC,
1599                                                         FeatureFullFP16,
1600                                                         FeatureDotProd]>;
1601
1602def : ProcNoItin<"cortex-a78c",                         [ARMv82a, ProcA78C,
1603                                                         FeatureHWDivThumb,
1604                                                         FeatureHWDivARM,
1605                                                         FeatureCrypto,
1606                                                         FeatureCRC,
1607                                                         FeatureDotProd,
1608                                                         FeatureFullFP16]>;
1609
1610def : ProcNoItin<"cortex-a710",                         [ARMv9a, ProcA710,
1611                                                         FeatureHWDivThumb,
1612                                                         FeatureHWDivARM,
1613                                                         FeatureFP16FML,
1614                                                         FeatureBF16,
1615                                                         FeatureMatMulInt8,
1616                                                         FeatureSB]>;
1617
1618def : ProcNoItin<"cortex-x1",                           [ARMv82a, ProcX1,
1619                                                         FeatureHWDivThumb,
1620                                                         FeatureHWDivARM,
1621                                                         FeatureCrypto,
1622                                                         FeatureCRC,
1623                                                         FeatureFullFP16,
1624                                                         FeatureDotProd]>;
1625
1626def : ProcNoItin<"cortex-x1c",                          [ARMv82a, ProcX1C,
1627                                                         FeatureHWDivThumb,
1628                                                         FeatureHWDivARM,
1629                                                         FeatureCrypto,
1630                                                         FeatureCRC,
1631                                                         FeatureFullFP16,
1632                                                         FeatureDotProd]>;
1633
1634def : ProcNoItin<"neoverse-v1",                         [ARMv84a,
1635                                                         FeatureHWDivThumb,
1636                                                         FeatureHWDivARM,
1637                                                         FeatureCrypto,
1638                                                         FeatureCRC,
1639                                                         FeatureFullFP16,
1640                                                         FeatureBF16,
1641                                                         FeatureMatMulInt8]>;
1642
1643def : ProcNoItin<"neoverse-n1",                         [ARMv82a,
1644                                                         FeatureHWDivThumb,
1645                                                         FeatureHWDivARM,
1646                                                         FeatureCrypto,
1647                                                         FeatureCRC,
1648                                                         FeatureDotProd]>;
1649
1650def : ProcNoItin<"neoverse-n2",                         [ARMv85a,
1651                                                         FeatureBF16,
1652                                                         FeatureMatMulInt8]>;
1653
1654def : ProcessorModel<"cyclone",     SwiftModel,         [ARMv8a, ProcSwift,
1655                                                         FeatureHasRetAddrStack,
1656                                                         FeatureNEONForFP,
1657                                                         FeatureVFP4,
1658                                                         FeatureMP,
1659                                                         FeatureHWDivThumb,
1660                                                         FeatureHWDivARM,
1661                                                         FeatureAvoidPartialCPSR,
1662                                                         FeatureAvoidMOVsShOp,
1663                                                         FeatureHasSlowFPVMLx,
1664                                                         FeatureHasSlowFPVFMx,
1665                                                         FeatureCrypto,
1666                                                         FeatureUseMISched,
1667                                                         FeatureZCZeroing,
1668                                                         FeatureNoPostRASched]>;
1669
1670def : ProcNoItin<"exynos-m3",                           [ARMv8a, ProcExynos]>;
1671def : ProcNoItin<"exynos-m4",                           [ARMv82a, ProcExynos,
1672                                                         FeatureFullFP16,
1673                                                         FeatureDotProd]>;
1674def : ProcNoItin<"exynos-m5",                           [ARMv82a, ProcExynos,
1675                                                         FeatureFullFP16,
1676                                                         FeatureDotProd]>;
1677
1678def : ProcNoItin<"kryo",                                [ARMv8a, ProcKryo,
1679                                                         FeatureHWDivThumb,
1680                                                         FeatureHWDivARM,
1681                                                         FeatureCrypto,
1682                                                         FeatureCRC]>;
1683
1684def : ProcessorModel<"cortex-r52", CortexR52Model,      [ARMv8r, ProcR52,
1685                                                         FeatureUseMISched,
1686                                                         FeatureFPAO]>;
1687
1688//===----------------------------------------------------------------------===//
1689// Declare the target which we are implementing
1690//===----------------------------------------------------------------------===//
1691
1692def ARMAsmWriter : AsmWriter {
1693  string AsmWriterClassName  = "InstPrinter";
1694  int PassSubtarget = 1;
1695  int Variant = 0;
1696  bit isMCAsmWriter = 1;
1697}
1698
1699def ARMAsmParser : AsmParser {
1700  bit ReportMultipleNearMisses = 1;
1701}
1702
1703def ARMAsmParserVariant : AsmParserVariant {
1704  int Variant = 0;
1705  string Name = "ARM";
1706  string BreakCharacters = ".";
1707}
1708
1709def ARM : Target {
1710  // Pull in Instruction Info.
1711  let InstructionSet = ARMInstrInfo;
1712  let AssemblyWriters = [ARMAsmWriter];
1713  let AssemblyParsers = [ARMAsmParser];
1714  let AssemblyParserVariants = [ARMAsmParserVariant];
1715  let AllowRegisterRenaming = 1;
1716}
1717