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