xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARM.td (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
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"
1230include "ARMScheduleM85.td"
1231
1232//===----------------------------------------------------------------------===//
1233// ARM processors
1234//
1235// Dummy CPU, used to target architectures
1236def : ProcessorModel<"generic",     CortexA8Model,      []>;
1237
1238// FIXME: Several processors below are not using their own scheduler
1239// model, but one of similar/previous processor. These should be fixed.
1240
1241def : ProcNoItin<"arm8",                                [ARMv4]>;
1242def : ProcNoItin<"arm810",                              [ARMv4]>;
1243def : ProcNoItin<"strongarm",                           [ARMv4]>;
1244def : ProcNoItin<"strongarm110",                        [ARMv4]>;
1245def : ProcNoItin<"strongarm1100",                       [ARMv4]>;
1246def : ProcNoItin<"strongarm1110",                       [ARMv4]>;
1247
1248def : ProcNoItin<"arm7tdmi",                            [ARMv4t]>;
1249def : ProcNoItin<"arm7tdmi-s",                          [ARMv4t]>;
1250def : ProcNoItin<"arm710t",                             [ARMv4t]>;
1251def : ProcNoItin<"arm720t",                             [ARMv4t]>;
1252def : ProcNoItin<"arm9",                                [ARMv4t]>;
1253def : ProcNoItin<"arm9tdmi",                            [ARMv4t]>;
1254def : ProcNoItin<"arm920",                              [ARMv4t]>;
1255def : ProcNoItin<"arm920t",                             [ARMv4t]>;
1256def : ProcNoItin<"arm922t",                             [ARMv4t]>;
1257def : ProcNoItin<"arm940t",                             [ARMv4t]>;
1258def : ProcNoItin<"ep9312",                              [ARMv4t]>;
1259
1260def : ProcNoItin<"arm10tdmi",                           [ARMv5t]>;
1261def : ProcNoItin<"arm1020t",                            [ARMv5t]>;
1262
1263def : ProcNoItin<"arm9e",                               [ARMv5te]>;
1264def : ProcNoItin<"arm926ej-s",                          [ARMv5te]>;
1265def : ProcNoItin<"arm946e-s",                           [ARMv5te]>;
1266def : ProcNoItin<"arm966e-s",                           [ARMv5te]>;
1267def : ProcNoItin<"arm968e-s",                           [ARMv5te]>;
1268def : ProcNoItin<"arm10e",                              [ARMv5te]>;
1269def : ProcNoItin<"arm1020e",                            [ARMv5te]>;
1270def : ProcNoItin<"arm1022e",                            [ARMv5te]>;
1271def : ProcNoItin<"xscale",                              [ARMv5te]>;
1272def : ProcNoItin<"iwmmxt",                              [ARMv5te]>;
1273
1274def : Processor<"arm1136j-s",       ARMV6Itineraries,   [ARMv6]>;
1275def : Processor<"arm1136jf-s",      ARMV6Itineraries,   [ARMv6,
1276                                                         FeatureVFP2,
1277                                                         FeatureHasSlowFPVMLx]>;
1278
1279def : Processor<"cortex-m0",        ARMV6Itineraries,   [ARMv6m,
1280                                                         FeatureHasNoBranchPredictor]>;
1281def : Processor<"cortex-m0plus",    ARMV6Itineraries,   [ARMv6m,
1282                                                         FeatureHasNoBranchPredictor]>;
1283def : Processor<"cortex-m1",        ARMV6Itineraries,   [ARMv6m,
1284                                                         FeatureHasNoBranchPredictor]>;
1285def : Processor<"sc000",            ARMV6Itineraries,   [ARMv6m,
1286                                                         FeatureHasNoBranchPredictor]>;
1287
1288def : Processor<"arm1176jz-s",      ARMV6Itineraries,   [ARMv6kz]>;
1289def : Processor<"arm1176jzf-s",     ARMV6Itineraries,   [ARMv6kz,
1290                                                         FeatureVFP2,
1291                                                         FeatureHasSlowFPVMLx]>;
1292
1293def : Processor<"mpcorenovfp",      ARMV6Itineraries,   [ARMv6k]>;
1294def : Processor<"mpcore",           ARMV6Itineraries,   [ARMv6k,
1295                                                         FeatureVFP2,
1296                                                         FeatureHasSlowFPVMLx]>;
1297
1298def : Processor<"arm1156t2-s",      ARMV6Itineraries,   [ARMv6t2]>;
1299def : Processor<"arm1156t2f-s",     ARMV6Itineraries,   [ARMv6t2,
1300                                                         FeatureVFP2,
1301                                                         FeatureHasSlowFPVMLx]>;
1302
1303def : ProcessorModel<"cortex-a5",   CortexA8Model,      [ARMv7a, ProcA5,
1304                                                         FeatureHasRetAddrStack,
1305                                                         FeatureTrustZone,
1306                                                         FeatureSlowFPBrcc,
1307                                                         FeatureHasSlowFPVMLx,
1308                                                         FeatureHasSlowFPVFMx,
1309                                                         FeatureVMLxForwarding,
1310                                                         FeatureMP,
1311                                                         FeatureVFP4]>;
1312
1313def : ProcessorModel<"cortex-a7",   CortexA8Model,      [ARMv7a, ProcA7,
1314                                                         FeatureHasRetAddrStack,
1315                                                         FeatureTrustZone,
1316                                                         FeatureSlowFPBrcc,
1317                                                         FeatureHasVMLxHazards,
1318                                                         FeatureHasSlowFPVMLx,
1319                                                         FeatureHasSlowFPVFMx,
1320                                                         FeatureVMLxForwarding,
1321                                                         FeatureMP,
1322                                                         FeatureVFP4,
1323                                                         FeatureVirtualization]>;
1324
1325def : ProcessorModel<"cortex-a8",   CortexA8Model,      [ARMv7a, ProcA8,
1326                                                         FeatureHasRetAddrStack,
1327                                                         FeatureNonpipelinedVFP,
1328                                                         FeatureTrustZone,
1329                                                         FeatureSlowFPBrcc,
1330                                                         FeatureHasVMLxHazards,
1331                                                         FeatureHasSlowFPVMLx,
1332                                                         FeatureHasSlowFPVFMx,
1333                                                         FeatureVMLxForwarding]>;
1334
1335def : ProcessorModel<"cortex-a9",   CortexA9Model,      [ARMv7a, ProcA9,
1336                                                         FeatureHasRetAddrStack,
1337                                                         FeatureTrustZone,
1338                                                         FeatureHasVMLxHazards,
1339                                                         FeatureVMLxForwarding,
1340                                                         FeatureFP16,
1341                                                         FeatureAvoidPartialCPSR,
1342                                                         FeatureExpandMLx,
1343                                                         FeaturePreferVMOVSR,
1344                                                         FeatureMuxedUnits,
1345                                                         FeatureNEONForFPMovs,
1346                                                         FeatureCheckVLDnAlign,
1347                                                         FeatureMP]>;
1348
1349def : ProcessorModel<"cortex-a12",  CortexA9Model,      [ARMv7a, ProcA12,
1350                                                         FeatureHasRetAddrStack,
1351                                                         FeatureTrustZone,
1352                                                         FeatureVMLxForwarding,
1353                                                         FeatureVFP4,
1354                                                         FeatureAvoidPartialCPSR,
1355                                                         FeatureVirtualization,
1356                                                         FeatureMP]>;
1357
1358def : ProcessorModel<"cortex-a15",  CortexA9Model,      [ARMv7a, ProcA15,
1359                                                         FeatureDontWidenVMOVS,
1360                                                         FeatureSplatVFPToNeon,
1361                                                         FeatureHasRetAddrStack,
1362                                                         FeatureMuxedUnits,
1363                                                         FeatureTrustZone,
1364                                                         FeatureVFP4,
1365                                                         FeatureMP,
1366                                                         FeatureCheckVLDnAlign,
1367                                                         FeatureAvoidPartialCPSR,
1368                                                         FeatureVirtualization]>;
1369
1370def : ProcessorModel<"cortex-a17",  CortexA9Model,      [ARMv7a, ProcA17,
1371                                                         FeatureHasRetAddrStack,
1372                                                         FeatureTrustZone,
1373                                                         FeatureMP,
1374                                                         FeatureVMLxForwarding,
1375                                                         FeatureVFP4,
1376                                                         FeatureAvoidPartialCPSR,
1377                                                         FeatureVirtualization]>;
1378
1379// FIXME: krait has currently the same features as A9 plus VFP4 and  HWDiv
1380def : ProcessorModel<"krait",       CortexA9Model,      [ARMv7a, ProcKrait,
1381                                                         FeatureHasRetAddrStack,
1382                                                         FeatureMuxedUnits,
1383                                                         FeatureCheckVLDnAlign,
1384                                                         FeatureVMLxForwarding,
1385                                                         FeatureFP16,
1386                                                         FeatureAvoidPartialCPSR,
1387                                                         FeatureVFP4,
1388                                                         FeatureHWDivThumb,
1389                                                         FeatureHWDivARM]>;
1390
1391def : ProcessorModel<"swift",       SwiftModel,         [ARMv7a, ProcSwift,
1392                                                         FeatureHasRetAddrStack,
1393                                                         FeatureNEONForFP,
1394                                                         FeatureVFP4,
1395                                                         FeatureUseWideStrideVFP,
1396                                                         FeatureMP,
1397                                                         FeatureHWDivThumb,
1398                                                         FeatureHWDivARM,
1399                                                         FeatureAvoidPartialCPSR,
1400                                                         FeatureAvoidMOVsShOp,
1401                                                         FeatureHasSlowFPVMLx,
1402                                                         FeatureHasSlowFPVFMx,
1403                                                         FeatureHasVMLxHazards,
1404                                                         FeatureProfUnpredicate,
1405                                                         FeaturePrefISHSTBarrier,
1406                                                         FeatureSlowOddRegister,
1407                                                         FeatureSlowLoadDSubreg,
1408                                                         FeatureSlowVGETLNi32,
1409                                                         FeatureSlowVDUP32,
1410                                                         FeatureUseMISched,
1411                                                         FeatureNoPostRASched]>;
1412
1413def : ProcessorModel<"cortex-r4",   CortexA8Model,      [ARMv7r, ProcR4,
1414                                                         FeatureHasRetAddrStack,
1415                                                         FeatureAvoidPartialCPSR]>;
1416
1417def : ProcessorModel<"cortex-r4f",  CortexA8Model,      [ARMv7r, ProcR4,
1418                                                         FeatureHasRetAddrStack,
1419                                                         FeatureSlowFPBrcc,
1420                                                         FeatureHasSlowFPVMLx,
1421                                                         FeatureHasSlowFPVFMx,
1422                                                         FeatureVFP3_D16,
1423                                                         FeatureAvoidPartialCPSR]>;
1424
1425def : ProcessorModel<"cortex-r5",   CortexA8Model,      [ARMv7r, ProcR5,
1426                                                         FeatureHasRetAddrStack,
1427                                                         FeatureVFP3_D16,
1428                                                         FeatureSlowFPBrcc,
1429                                                         FeatureHWDivARM,
1430                                                         FeatureHasSlowFPVMLx,
1431                                                         FeatureHasSlowFPVFMx,
1432                                                         FeatureAvoidPartialCPSR]>;
1433
1434def : ProcessorModel<"cortex-r7",   CortexA8Model,      [ARMv7r, ProcR7,
1435                                                         FeatureHasRetAddrStack,
1436                                                         FeatureVFP3_D16,
1437                                                         FeatureFP16,
1438                                                         FeatureMP,
1439                                                         FeatureSlowFPBrcc,
1440                                                         FeatureHWDivARM,
1441                                                         FeatureHasSlowFPVMLx,
1442                                                         FeatureHasSlowFPVFMx,
1443                                                         FeatureAvoidPartialCPSR]>;
1444
1445def : ProcessorModel<"cortex-r8",   CortexA8Model,      [ARMv7r,
1446                                                         FeatureHasRetAddrStack,
1447                                                         FeatureVFP3_D16,
1448                                                         FeatureFP16,
1449                                                         FeatureMP,
1450                                                         FeatureSlowFPBrcc,
1451                                                         FeatureHWDivARM,
1452                                                         FeatureHasSlowFPVMLx,
1453                                                         FeatureHasSlowFPVFMx,
1454                                                         FeatureAvoidPartialCPSR]>;
1455
1456def : ProcessorModel<"cortex-m3",   CortexM4Model,      [ARMv7m,
1457                                                         ProcM3,
1458                                                         FeaturePrefLoopAlign32,
1459                                                         FeatureUseMISched,
1460                                                         FeatureHasNoBranchPredictor]>;
1461
1462def : ProcessorModel<"sc300",       CortexM4Model,      [ARMv7m,
1463                                                         ProcM3,
1464                                                         FeatureUseMISched,
1465                                                         FeatureHasNoBranchPredictor]>;
1466
1467def : ProcessorModel<"cortex-m4", CortexM4Model,        [ARMv7em,
1468                                                         FeatureVFP4_D16_SP,
1469                                                         FeaturePrefLoopAlign32,
1470                                                         FeatureHasSlowFPVMLx,
1471                                                         FeatureHasSlowFPVFMx,
1472                                                         FeatureUseMISched,
1473                                                         FeatureHasNoBranchPredictor]>;
1474
1475def : ProcessorModel<"cortex-m7", CortexM7Model,        [ARMv7em,
1476                                                         ProcM7,
1477                                                         FeatureFPARMv8_D16,
1478                                                         FeatureUseMIPipeliner,
1479                                                         FeatureUseMISched]>;
1480
1481def : ProcNoItin<"cortex-m23",                          [ARMv8mBaseline,
1482                                                         FeatureNoMovt,
1483                                                         FeatureHasNoBranchPredictor]>;
1484
1485def : ProcessorModel<"cortex-m33", CortexM4Model,       [ARMv8mMainline,
1486                                                         FeatureDSP,
1487                                                         FeatureFPARMv8_D16_SP,
1488                                                         FeaturePrefLoopAlign32,
1489                                                         FeatureHasSlowFPVMLx,
1490                                                         FeatureHasSlowFPVFMx,
1491                                                         FeatureUseMISched,
1492                                                         FeatureHasNoBranchPredictor,
1493                                                         FeatureFixCMSE_CVE_2021_35465]>;
1494
1495def : ProcessorModel<"cortex-m35p", CortexM4Model,      [ARMv8mMainline,
1496                                                         FeatureDSP,
1497                                                         FeatureFPARMv8_D16_SP,
1498                                                         FeaturePrefLoopAlign32,
1499                                                         FeatureHasSlowFPVMLx,
1500                                                         FeatureHasSlowFPVFMx,
1501                                                         FeatureUseMISched,
1502                                                         FeatureHasNoBranchPredictor,
1503                                                         FeatureFixCMSE_CVE_2021_35465]>;
1504
1505def : ProcessorModel<"cortex-m55", CortexM55Model,      [ARMv81mMainline,
1506                                                         FeatureDSP,
1507                                                         FeatureFPARMv8_D16,
1508                                                         FeatureUseMISched,
1509                                                         FeatureHasNoBranchPredictor,
1510                                                         FeaturePrefLoopAlign32,
1511                                                         FeatureHasSlowFPVMLx,
1512                                                         HasMVEFloatOps,
1513                                                         FeatureFixCMSE_CVE_2021_35465]>;
1514
1515def : ProcessorModel<"cortex-m85", CortexM85Model,      [ARMv81mMainline,
1516                                                         FeatureDSP,
1517                                                         FeatureFPARMv8_D16,
1518                                                         FeaturePACBTI,
1519                                                         FeatureUseMISched,
1520                                                         HasMVEFloatOps]>;
1521
1522def : ProcessorModel<"cortex-m52", CortexM55Model,      [ARMv81mMainline,
1523                                                         FeatureDSP,
1524                                                         FeatureFPARMv8_D16,
1525                                                         FeatureHasNoBranchPredictor,
1526                                                         FeaturePACBTI,
1527                                                         FeatureUseMISched,
1528                                                         FeaturePrefLoopAlign32,
1529                                                         FeatureHasSlowFPVMLx,
1530                                                         FeatureMVEVectorCostFactor1,
1531                                                         HasMVEFloatOps]>;
1532
1533def : ProcNoItin<"cortex-a32",                           [ARMv8a,
1534                                                         FeatureHWDivThumb,
1535                                                         FeatureHWDivARM,
1536                                                         FeatureCrypto,
1537                                                         FeatureCRC]>;
1538
1539def : ProcNoItin<"cortex-a35",                          [ARMv8a, ProcA35,
1540                                                         FeatureHWDivThumb,
1541                                                         FeatureHWDivARM,
1542                                                         FeatureCrypto,
1543                                                         FeatureCRC]>;
1544
1545def : ProcNoItin<"cortex-a53",                          [ARMv8a, ProcA53,
1546                                                         FeatureHWDivThumb,
1547                                                         FeatureHWDivARM,
1548                                                         FeatureCrypto,
1549                                                         FeatureCRC,
1550                                                         FeatureFPAO]>;
1551
1552def : ProcNoItin<"cortex-a55",                          [ARMv82a, ProcA55,
1553                                                         FeatureHWDivThumb,
1554                                                         FeatureHWDivARM,
1555                                                         FeatureDotProd]>;
1556
1557def : ProcessorModel<"cortex-a57",  CortexA57Model,     [ARMv8a, ProcA57,
1558                                                         FeatureHWDivThumb,
1559                                                         FeatureHWDivARM,
1560                                                         FeatureCrypto,
1561                                                         FeatureCRC,
1562                                                         FeatureFPAO,
1563                                                         FeatureAvoidPartialCPSR,
1564                                                         FeatureCheapPredicableCPSR,
1565                                                         FeatureFixCortexA57AES1742098]>;
1566
1567def : ProcessorModel<"cortex-a72",  CortexA57Model,     [ARMv8a, ProcA72,
1568                                                         FeatureHWDivThumb,
1569                                                         FeatureHWDivARM,
1570                                                         FeatureCrypto,
1571                                                         FeatureCRC,
1572                                                         FeatureFixCortexA57AES1742098]>;
1573
1574def : ProcNoItin<"cortex-a73",                          [ARMv8a, ProcA73,
1575                                                         FeatureHWDivThumb,
1576                                                         FeatureHWDivARM,
1577                                                         FeatureCrypto,
1578                                                         FeatureCRC]>;
1579
1580def : ProcNoItin<"cortex-a75",                          [ARMv82a, ProcA75,
1581                                                         FeatureHWDivThumb,
1582                                                         FeatureHWDivARM,
1583                                                         FeatureDotProd]>;
1584
1585def : ProcNoItin<"cortex-a76",                          [ARMv82a, ProcA76,
1586                                                         FeatureHWDivThumb,
1587                                                         FeatureHWDivARM,
1588                                                         FeatureCrypto,
1589                                                         FeatureCRC,
1590                                                         FeatureFullFP16,
1591                                                         FeatureDotProd]>;
1592
1593def : ProcNoItin<"cortex-a76ae",                        [ARMv82a, ProcA76,
1594                                                         FeatureHWDivThumb,
1595                                                         FeatureHWDivARM,
1596                                                         FeatureCrypto,
1597                                                         FeatureCRC,
1598                                                         FeatureFullFP16,
1599                                                         FeatureDotProd]>;
1600
1601def : ProcNoItin<"cortex-a77",                          [ARMv82a, ProcA77,
1602                                                         FeatureHWDivThumb,
1603                                                         FeatureHWDivARM,
1604                                                         FeatureCrypto,
1605                                                         FeatureCRC,
1606                                                         FeatureFullFP16,
1607                                                         FeatureDotProd]>;
1608
1609def : ProcNoItin<"cortex-a78",                          [ARMv82a, ProcA78,
1610                                                         FeatureHWDivThumb,
1611                                                         FeatureHWDivARM,
1612                                                         FeatureCrypto,
1613                                                         FeatureCRC,
1614                                                         FeatureFullFP16,
1615                                                         FeatureDotProd]>;
1616
1617def : ProcNoItin<"cortex-a78c",                         [ARMv82a, ProcA78C,
1618                                                         FeatureHWDivThumb,
1619                                                         FeatureHWDivARM,
1620                                                         FeatureCrypto,
1621                                                         FeatureCRC,
1622                                                         FeatureDotProd,
1623                                                         FeatureFullFP16]>;
1624
1625def : ProcNoItin<"cortex-a710",                         [ARMv9a, ProcA710,
1626                                                         FeatureHWDivThumb,
1627                                                         FeatureHWDivARM,
1628                                                         FeatureFP16FML,
1629                                                         FeatureBF16,
1630                                                         FeatureMatMulInt8,
1631                                                         FeatureSB]>;
1632
1633def : ProcNoItin<"cortex-x1",                           [ARMv82a, ProcX1,
1634                                                         FeatureHWDivThumb,
1635                                                         FeatureHWDivARM,
1636                                                         FeatureCrypto,
1637                                                         FeatureCRC,
1638                                                         FeatureFullFP16,
1639                                                         FeatureDotProd]>;
1640
1641def : ProcNoItin<"cortex-x1c",                          [ARMv82a, ProcX1C,
1642                                                         FeatureHWDivThumb,
1643                                                         FeatureHWDivARM,
1644                                                         FeatureCrypto,
1645                                                         FeatureCRC,
1646                                                         FeatureFullFP16,
1647                                                         FeatureDotProd]>;
1648
1649def : ProcNoItin<"neoverse-v1",                         [ARMv84a,
1650                                                         FeatureHWDivThumb,
1651                                                         FeatureHWDivARM,
1652                                                         FeatureCrypto,
1653                                                         FeatureCRC,
1654                                                         FeatureFullFP16,
1655                                                         FeatureBF16,
1656                                                         FeatureMatMulInt8]>;
1657
1658def : ProcNoItin<"neoverse-n1",                         [ARMv82a,
1659                                                         FeatureHWDivThumb,
1660                                                         FeatureHWDivARM,
1661                                                         FeatureCrypto,
1662                                                         FeatureCRC,
1663                                                         FeatureDotProd]>;
1664
1665def : ProcNoItin<"neoverse-n2",                         [ARMv9a,
1666                                                         FeatureBF16,
1667                                                         FeatureMatMulInt8]>;
1668
1669def : ProcessorModel<"cyclone",     SwiftModel,         [ARMv8a, ProcSwift,
1670                                                         FeatureHasRetAddrStack,
1671                                                         FeatureNEONForFP,
1672                                                         FeatureVFP4,
1673                                                         FeatureMP,
1674                                                         FeatureHWDivThumb,
1675                                                         FeatureHWDivARM,
1676                                                         FeatureAvoidPartialCPSR,
1677                                                         FeatureAvoidMOVsShOp,
1678                                                         FeatureHasSlowFPVMLx,
1679                                                         FeatureHasSlowFPVFMx,
1680                                                         FeatureCrypto,
1681                                                         FeatureUseMISched,
1682                                                         FeatureZCZeroing,
1683                                                         FeatureNoPostRASched]>;
1684
1685def : ProcNoItin<"exynos-m3",                           [ARMv8a, ProcExynos]>;
1686def : ProcNoItin<"exynos-m4",                           [ARMv82a, ProcExynos,
1687                                                         FeatureFullFP16,
1688                                                         FeatureDotProd]>;
1689def : ProcNoItin<"exynos-m5",                           [ARMv82a, ProcExynos,
1690                                                         FeatureFullFP16,
1691                                                         FeatureDotProd]>;
1692
1693def : ProcNoItin<"kryo",                                [ARMv8a, ProcKryo,
1694                                                         FeatureHWDivThumb,
1695                                                         FeatureHWDivARM,
1696                                                         FeatureCrypto,
1697                                                         FeatureCRC]>;
1698
1699def : ProcessorModel<"cortex-r52", CortexR52Model,      [ARMv8r, ProcR52,
1700                                                         FeatureUseMISched,
1701                                                         FeatureFPAO]>;
1702
1703//===----------------------------------------------------------------------===//
1704// Declare the target which we are implementing
1705//===----------------------------------------------------------------------===//
1706
1707def ARMAsmWriter : AsmWriter {
1708  string AsmWriterClassName  = "InstPrinter";
1709  int PassSubtarget = 1;
1710  int Variant = 0;
1711  bit isMCAsmWriter = 1;
1712}
1713
1714def ARMAsmParser : AsmParser {
1715  bit ReportMultipleNearMisses = 1;
1716}
1717
1718def ARMAsmParserVariant : AsmParserVariant {
1719  int Variant = 0;
1720  string Name = "ARM";
1721  string BreakCharacters = ".";
1722}
1723
1724def ARM : Target {
1725  // Pull in Instruction Info.
1726  let InstructionSet = ARMInstrInfo;
1727  let AssemblyWriters = [ARMAsmWriter];
1728  let AssemblyParsers = [ARMAsmParser];
1729  let AssemblyParserVariants = [ARMAsmParserVariant];
1730  let AllowRegisterRenaming = 1;
1731}
1732