xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARM.td (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
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
707// Armv9.5-A is a v9-only architecture. From v9.5-A onwards there's no mapping
708// to an equivalent v8.x version.
709def HasV9_5aOps   : SubtargetFeature<"v9.5a", "HasV9_5aOps", "true",
710                                   "Support ARM v9.5a instructions",
711                                   [HasV9_4aOps]>;
712
713def HasV8_1MMainlineOps : SubtargetFeature<
714               "v8.1m.main", "HasV8_1MMainlineOps", "true",
715               "Support ARM v8-1M Mainline instructions",
716               [HasV8MMainlineOps]>;
717def HasMVEIntegerOps : SubtargetFeature<
718               "mve", "HasMVEIntegerOps", "true",
719               "Support M-Class Vector Extension with integer ops",
720               [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>;
721def HasMVEFloatOps : SubtargetFeature<
722               "mve.fp", "HasMVEFloatOps", "true",
723               "Support M-Class Vector Extension with integer and floating ops",
724               [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>;
725
726def HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true",
727                                 "Support CDE instructions",
728                                 [HasV8MMainlineOps]>;
729
730foreach i = {0-7} in
731    def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i,
732                                              "CoprocCDE["#i#"]", "true",
733                                              "Coprocessor "#i#" ISA is CDEv1",
734                                              [HasCDEOps]>;
735
736//===----------------------------------------------------------------------===//
737// Control codegen mitigation against Straight Line Speculation vulnerability.
738//===----------------------------------------------------------------------===//
739
740/// Harden against Straight Line Speculation for Returns and Indirect Branches.
741def FeatureHardenSlsRetBr : SubtargetFeature<"harden-sls-retbr",
742  "HardenSlsRetBr", "true",
743  "Harden against straight line speculation across RETurn and BranchRegister "
744  "instructions">;
745/// Harden against Straight Line Speculation for indirect calls.
746def FeatureHardenSlsBlr : SubtargetFeature<"harden-sls-blr",
747  "HardenSlsBlr", "true",
748  "Harden against straight line speculation across indirect calls">;
749/// Generate thunk code for SLS mitigation in the normal text section.
750def FeatureHardenSlsNoComdat : SubtargetFeature<"harden-sls-nocomdat",
751  "HardenSlsNoComdat", "true",
752  "Generate thunk code for SLS mitigation in the normal text section">;
753
754//===----------------------------------------------------------------------===//
755// Endianness of instruction encodings in memory.
756//
757// In the current Arm architecture, this is usually little-endian regardless of
758// data endianness. But before Armv7 it was typical for instruction endianness
759// to match data endianness, so that a big-endian system was consistently big-
760// endian. And Armv7-R can be configured to use big-endian instructions.
761//
762// Additionally, even when targeting Armv7-A, big-endian instructions can be
763// found in relocatable object files, because the Arm ABI specifies that the
764// linker byte-reverses them depending on the target architecture.
765//
766// So we have a feature here to indicate that instructions are stored big-
767// endian, which you can set when instantiating an MCDisassembler.
768def ModeBigEndianInstructions : SubtargetFeature<"big-endian-instructions",
769    "BigEndianInstructions", "true",
770     "Expect instructions to be stored big-endian.">;
771
772//===----------------------------------------------------------------------===//
773// ARM Processor subtarget features.
774//
775
776def ProcA5      : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5",
777                                   "Cortex-A5 ARM processors", []>;
778def ProcA7      : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7",
779                                   "Cortex-A7 ARM processors", []>;
780def ProcA8      : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
781                                   "Cortex-A8 ARM processors", []>;
782def ProcA9      : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
783                                   "Cortex-A9 ARM processors", []>;
784def ProcA12     : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12",
785                                   "Cortex-A12 ARM processors", []>;
786def ProcA15     : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15",
787                                   "Cortex-A15 ARM processors", []>;
788def ProcA17     : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17",
789                                   "Cortex-A17 ARM processors", []>;
790def ProcA32     : SubtargetFeature<"a32", "ARMProcFamily", "CortexA32",
791                                   "Cortex-A32 ARM processors", []>;
792def ProcA35     : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
793                                   "Cortex-A35 ARM processors", []>;
794def ProcA53     : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
795                                   "Cortex-A53 ARM processors", []>;
796def ProcA55     : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55",
797                                   "Cortex-A55 ARM processors", []>;
798def ProcA57     : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
799                                   "Cortex-A57 ARM processors", []>;
800def ProcA72     : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
801                                   "Cortex-A72 ARM processors", []>;
802def ProcA73     : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
803                                   "Cortex-A73 ARM processors", []>;
804def ProcA75     : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75",
805                                   "Cortex-A75 ARM processors", []>;
806def ProcA76     : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76",
807                                   "Cortex-A76 ARM processors", []>;
808def ProcA77     : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
809                                   "Cortex-A77 ARM processors", []>;
810def ProcA78     : SubtargetFeature<"cortex-a78", "ARMProcFamily", "CortexA78",
811                                   "Cortex-A78 ARM processors", []>;
812def ProcA78C    : SubtargetFeature<"a78c", "ARMProcFamily", "CortexA78C",
813                                   "Cortex-A78C ARM processors", []>;
814def ProcA710    : SubtargetFeature<"cortex-a710", "ARMProcFamily",
815                                   "CortexA710", "Cortex-A710 ARM processors", []>;
816def ProcX1      : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
817                                   "Cortex-X1 ARM processors", []>;
818def ProcX1C     : SubtargetFeature<"cortex-x1c", "ARMProcFamily", "CortexX1C",
819                                   "Cortex-X1C ARM processors", []>;
820
821def ProcV1      : SubtargetFeature<"neoverse-v1", "ARMProcFamily",
822                                   "NeoverseV1", "Neoverse-V1 ARM processors", []>;
823
824def ProcKrait   : SubtargetFeature<"krait", "ARMProcFamily", "Krait",
825                                   "Qualcomm Krait processors", []>;
826def ProcKryo    : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
827                                   "Qualcomm Kryo processors", []>;
828def ProcSwift   : SubtargetFeature<"swift", "ARMProcFamily", "Swift",
829                                   "Swift ARM processors", []>;
830
831def ProcExynos  : SubtargetFeature<"exynos", "ARMProcFamily", "Exynos",
832                                   "Samsung Exynos processors",
833                                   [FeatureZCZeroing,
834                                    FeatureUseWideStrideVFP,
835                                    FeatureSplatVFPToNeon,
836                                    FeatureSlowVGETLNi32,
837                                    FeatureSlowVDUP32,
838                                    FeatureSlowFPBrcc,
839                                    FeatureProfUnpredicate,
840                                    FeatureHWDivThumb,
841                                    FeatureHWDivARM,
842                                    FeatureHasSlowFPVMLx,
843                                    FeatureHasSlowFPVFMx,
844                                    FeatureHasRetAddrStack,
845                                    FeatureFuseLiterals,
846                                    FeatureFuseAES,
847                                    FeatureExpandMLx,
848                                    FeatureCrypto,
849                                    FeatureCRC]>;
850
851def ProcR4      : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4",
852                                   "Cortex-R4 ARM processors", []>;
853def ProcR5      : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5",
854                                   "Cortex-R5 ARM processors", []>;
855def ProcR7      : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7",
856                                   "Cortex-R7 ARM processors", []>;
857def ProcR52     : SubtargetFeature<"r52", "ARMProcFamily", "CortexR52",
858                                   "Cortex-R52 ARM processors", []>;
859
860def ProcM3      : SubtargetFeature<"m3", "ARMProcFamily", "CortexM3",
861                                   "Cortex-M3 ARM processors", []>;
862def ProcM7      : SubtargetFeature<"m7", "ARMProcFamily", "CortexM7",
863                                   "Cortex-M7 ARM processors", []>;
864
865//===----------------------------------------------------------------------===//
866// ARM Helper classes.
867//
868
869class Architecture<string fname, string aname, list<SubtargetFeature> features>
870  : SubtargetFeature<fname, "ARMArch", aname,
871                     !strconcat(aname, " architecture"), features>;
872
873class ProcNoItin<string Name, list<SubtargetFeature> Features>
874  : Processor<Name, NoItineraries, Features>;
875
876
877//===----------------------------------------------------------------------===//
878// ARM architectures
879//
880
881def ARMv4     : Architecture<"armv4",     "ARMv4",    []>;
882
883def ARMv4t    : Architecture<"armv4t",    "ARMv4t",   [HasV4TOps]>;
884
885def ARMv5t    : Architecture<"armv5t",    "ARMv5t",   [HasV5TOps]>;
886
887def ARMv5te   : Architecture<"armv5te",   "ARMv5te",  [HasV5TEOps]>;
888
889def ARMv5tej  : Architecture<"armv5tej",  "ARMv5tej", [HasV5TEOps]>;
890
891def ARMv6     : Architecture<"armv6",     "ARMv6",    [HasV6Ops,
892                                                       FeatureDSP]>;
893
894def ARMv6t2   : Architecture<"armv6t2",   "ARMv6t2",  [HasV6T2Ops,
895                                                       FeatureDSP]>;
896
897def ARMv6k    : Architecture<"armv6k",    "ARMv6k",   [HasV6KOps]>;
898
899def ARMv6kz   : Architecture<"armv6kz",   "ARMv6kz",  [HasV6KOps,
900                                                       FeatureTrustZone]>;
901
902def ARMv6m    : Architecture<"armv6-m",   "ARMv6m",   [HasV6MOps,
903                                                       FeatureNoARM,
904                                                       ModeThumb,
905                                                       FeatureDB,
906                                                       FeatureMClass,
907                                                       FeatureStrictAlign]>;
908
909def ARMv6sm   : Architecture<"armv6s-m",  "ARMv6sm",  [HasV6MOps,
910                                                       FeatureNoARM,
911                                                       ModeThumb,
912                                                       FeatureDB,
913                                                       FeatureMClass,
914                                                       FeatureStrictAlign]>;
915
916def ARMv7a    : Architecture<"armv7-a",   "ARMv7a",   [HasV7Ops,
917                                                       FeatureNEON,
918                                                       FeatureDB,
919                                                       FeatureDSP,
920                                                       FeatureAClass,
921                                                       FeaturePerfMon]>;
922
923def ARMv7ve   : Architecture<"armv7ve",   "ARMv7ve",  [HasV7Ops,
924                                                       FeatureNEON,
925                                                       FeatureDB,
926                                                       FeatureDSP,
927                                                       FeatureTrustZone,
928                                                       FeatureMP,
929                                                       FeatureVirtualization,
930                                                       FeatureAClass,
931                                                       FeaturePerfMon]>;
932
933def ARMv7r    : Architecture<"armv7-r",   "ARMv7r",   [HasV7Ops,
934                                                       FeatureDB,
935                                                       FeatureDSP,
936                                                       FeatureHWDivThumb,
937                                                       FeatureRClass,
938                                                       FeaturePerfMon]>;
939
940def ARMv7m    : Architecture<"armv7-m",   "ARMv7m",   [HasV7Ops,
941                                                       FeatureThumb2,
942                                                       FeatureNoARM,
943                                                       ModeThumb,
944                                                       FeatureDB,
945                                                       FeatureHWDivThumb,
946                                                       FeatureMClass]>;
947
948def ARMv7em   : Architecture<"armv7e-m",  "ARMv7em",  [HasV7Ops,
949                                                       FeatureThumb2,
950                                                       FeatureNoARM,
951                                                       ModeThumb,
952                                                       FeatureDB,
953                                                       FeatureHWDivThumb,
954                                                       FeatureMClass,
955                                                       FeatureDSP]>;
956
957def ARMv8a    : Architecture<"armv8-a",   "ARMv8a",   [HasV8Ops,
958                                                       FeatureAClass,
959                                                       FeatureDB,
960                                                       FeatureFPARMv8,
961                                                       FeatureNEON,
962                                                       FeatureDSP,
963                                                       FeatureTrustZone,
964                                                       FeatureMP,
965                                                       FeatureVirtualization,
966                                                       FeatureCrypto,
967                                                       FeatureCRC]>;
968
969def ARMv81a   : Architecture<"armv8.1-a", "ARMv81a",  [HasV8_1aOps,
970                                                       FeatureAClass,
971                                                       FeatureDB,
972                                                       FeatureFPARMv8,
973                                                       FeatureNEON,
974                                                       FeatureDSP,
975                                                       FeatureTrustZone,
976                                                       FeatureMP,
977                                                       FeatureVirtualization,
978                                                       FeatureCrypto,
979                                                       FeatureCRC]>;
980
981def ARMv82a   : Architecture<"armv8.2-a", "ARMv82a",  [HasV8_2aOps,
982                                                       FeatureAClass,
983                                                       FeatureDB,
984                                                       FeatureFPARMv8,
985                                                       FeatureNEON,
986                                                       FeatureDSP,
987                                                       FeatureTrustZone,
988                                                       FeatureMP,
989                                                       FeatureVirtualization,
990                                                       FeatureCrypto,
991                                                       FeatureCRC,
992                                                       FeatureRAS]>;
993
994def ARMv83a   : Architecture<"armv8.3-a", "ARMv83a",  [HasV8_3aOps,
995                                                       FeatureAClass,
996                                                       FeatureDB,
997                                                       FeatureFPARMv8,
998                                                       FeatureNEON,
999                                                       FeatureDSP,
1000                                                       FeatureTrustZone,
1001                                                       FeatureMP,
1002                                                       FeatureVirtualization,
1003                                                       FeatureCrypto,
1004                                                       FeatureCRC,
1005                                                       FeatureRAS]>;
1006
1007def ARMv84a   : Architecture<"armv8.4-a", "ARMv84a",  [HasV8_4aOps,
1008                                                       FeatureAClass,
1009                                                       FeatureDB,
1010                                                       FeatureFPARMv8,
1011                                                       FeatureNEON,
1012                                                       FeatureDSP,
1013                                                       FeatureTrustZone,
1014                                                       FeatureMP,
1015                                                       FeatureVirtualization,
1016                                                       FeatureCrypto,
1017                                                       FeatureCRC,
1018                                                       FeatureRAS,
1019                                                       FeatureDotProd]>;
1020
1021def ARMv85a   : Architecture<"armv8.5-a", "ARMv85a",  [HasV8_5aOps,
1022                                                       FeatureAClass,
1023                                                       FeatureDB,
1024                                                       FeatureFPARMv8,
1025                                                       FeatureNEON,
1026                                                       FeatureDSP,
1027                                                       FeatureTrustZone,
1028                                                       FeatureMP,
1029                                                       FeatureVirtualization,
1030                                                       FeatureCrypto,
1031                                                       FeatureCRC,
1032                                                       FeatureRAS,
1033                                                       FeatureDotProd]>;
1034def ARMv86a   : Architecture<"armv8.6-a", "ARMv86a",  [HasV8_6aOps,
1035                                                       FeatureAClass,
1036                                                       FeatureDB,
1037                                                       FeatureFPARMv8,
1038                                                       FeatureNEON,
1039                                                       FeatureDSP,
1040                                                       FeatureTrustZone,
1041                                                       FeatureMP,
1042                                                       FeatureVirtualization,
1043                                                       FeatureCrypto,
1044                                                       FeatureCRC,
1045                                                       FeatureRAS,
1046                                                       FeatureDotProd]>;
1047def ARMv87a   : Architecture<"armv8.7-a", "ARMv87a",  [HasV8_7aOps,
1048                                                       FeatureAClass,
1049                                                       FeatureDB,
1050                                                       FeatureFPARMv8,
1051                                                       FeatureNEON,
1052                                                       FeatureDSP,
1053                                                       FeatureTrustZone,
1054                                                       FeatureMP,
1055                                                       FeatureVirtualization,
1056                                                       FeatureCrypto,
1057                                                       FeatureCRC,
1058                                                       FeatureRAS,
1059                                                       FeatureDotProd]>;
1060def ARMv88a   : Architecture<"armv8.8-a", "ARMv88a",  [HasV8_8aOps,
1061                                                       FeatureAClass,
1062                                                       FeatureDB,
1063                                                       FeatureFPARMv8,
1064                                                       FeatureNEON,
1065                                                       FeatureDSP,
1066                                                       FeatureTrustZone,
1067                                                       FeatureMP,
1068                                                       FeatureVirtualization,
1069                                                       FeatureCrypto,
1070                                                       FeatureCRC,
1071                                                       FeatureRAS,
1072                                                       FeatureDotProd]>;
1073def ARMv89a   : Architecture<"armv8.9-a", "ARMv89a",  [HasV8_9aOps,
1074                                                       FeatureAClass,
1075                                                       FeatureDB,
1076                                                       FeatureFPARMv8,
1077                                                       FeatureNEON,
1078                                                       FeatureDSP,
1079                                                       FeatureTrustZone,
1080                                                       FeatureMP,
1081                                                       FeatureVirtualization,
1082                                                       FeatureCrypto,
1083                                                       FeatureCRC,
1084                                                       FeatureRAS,
1085                                                       FeatureDotProd]>;
1086
1087def ARMv9a   : Architecture<"armv9-a", "ARMv9a",       [HasV9_0aOps,
1088                                                       FeatureAClass,
1089                                                       FeatureDB,
1090                                                       FeatureFPARMv8,
1091                                                       FeatureNEON,
1092                                                       FeatureDSP,
1093                                                       FeatureTrustZone,
1094                                                       FeatureMP,
1095                                                       FeatureVirtualization,
1096                                                       FeatureCRC,
1097                                                       FeatureRAS,
1098                                                       FeatureDotProd]>;
1099def ARMv91a   : Architecture<"armv9.1-a", "ARMv91a",   [HasV9_1aOps,
1100                                                       FeatureAClass,
1101                                                       FeatureDB,
1102                                                       FeatureFPARMv8,
1103                                                       FeatureNEON,
1104                                                       FeatureDSP,
1105                                                       FeatureTrustZone,
1106                                                       FeatureMP,
1107                                                       FeatureVirtualization,
1108                                                       FeatureCRC,
1109                                                       FeatureRAS,
1110                                                       FeatureDotProd]>;
1111def ARMv92a   : Architecture<"armv9.2-a", "ARMv92a",  [HasV9_2aOps,
1112                                                       FeatureAClass,
1113                                                       FeatureDB,
1114                                                       FeatureFPARMv8,
1115                                                       FeatureNEON,
1116                                                       FeatureDSP,
1117                                                       FeatureTrustZone,
1118                                                       FeatureMP,
1119                                                       FeatureVirtualization,
1120                                                       FeatureCRC,
1121                                                       FeatureRAS,
1122                                                       FeatureDotProd]>;
1123def ARMv93a   : Architecture<"armv9.3-a", "ARMv93a",  [HasV9_3aOps,
1124                                                       FeatureAClass,
1125                                                       FeatureDB,
1126                                                       FeatureFPARMv8,
1127                                                       FeatureNEON,
1128                                                       FeatureDSP,
1129                                                       FeatureTrustZone,
1130                                                       FeatureMP,
1131                                                       FeatureVirtualization,
1132                                                       FeatureCrypto,
1133                                                       FeatureCRC,
1134                                                       FeatureRAS,
1135                                                       FeatureDotProd]>;
1136def ARMv94a   : Architecture<"armv9.4-a", "ARMv94a",  [HasV9_4aOps,
1137                                                       FeatureAClass,
1138                                                       FeatureDB,
1139                                                       FeatureFPARMv8,
1140                                                       FeatureNEON,
1141                                                       FeatureDSP,
1142                                                       FeatureTrustZone,
1143                                                       FeatureMP,
1144                                                       FeatureVirtualization,
1145                                                       FeatureCRC,
1146                                                       FeatureRAS,
1147                                                       FeatureDotProd]>;
1148def ARMv95a   : Architecture<"armv9.5-a", "ARMv95a",  [HasV9_5aOps,
1149                                                       FeatureAClass,
1150                                                       FeatureDB,
1151                                                       FeatureFPARMv8,
1152                                                       FeatureNEON,
1153                                                       FeatureDSP,
1154                                                       FeatureTrustZone,
1155                                                       FeatureMP,
1156                                                       FeatureVirtualization,
1157                                                       FeatureCRC,
1158                                                       FeatureRAS,
1159                                                       FeatureDotProd]>;
1160
1161def ARMv8r    : Architecture<"armv8-r",   "ARMv8r",   [HasV8Ops,
1162                                                       FeatureRClass,
1163                                                       FeatureDB,
1164                                                       FeatureDFB,
1165                                                       FeatureDSP,
1166                                                       FeatureCRC,
1167                                                       FeatureMP,
1168                                                       FeatureVirtualization,
1169                                                       FeatureFPARMv8,
1170                                                       FeatureNEON]>;
1171
1172def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
1173                                                      [HasV8MBaselineOps,
1174                                                       FeatureNoARM,
1175                                                       ModeThumb,
1176                                                       FeatureDB,
1177                                                       FeatureHWDivThumb,
1178                                                       FeatureV7Clrex,
1179                                                       Feature8MSecExt,
1180                                                       FeatureAcquireRelease,
1181                                                       FeatureMClass,
1182                                                       FeatureStrictAlign]>;
1183
1184def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline",
1185                                                      [HasV8MMainlineOps,
1186                                                       FeatureNoARM,
1187                                                       ModeThumb,
1188                                                       FeatureDB,
1189                                                       FeatureHWDivThumb,
1190                                                       Feature8MSecExt,
1191                                                       FeatureAcquireRelease,
1192                                                       FeatureMClass]>;
1193
1194def ARMv81mMainline : Architecture<"armv8.1-m.main", "ARMv81mMainline",
1195                                                      [HasV8_1MMainlineOps,
1196                                                       FeatureNoARM,
1197                                                       ModeThumb,
1198                                                       FeatureDB,
1199                                                       FeatureHWDivThumb,
1200                                                       Feature8MSecExt,
1201                                                       FeatureAcquireRelease,
1202                                                       FeatureMClass,
1203                                                       FeatureRAS,
1204                                                       FeatureLOB]>;
1205
1206// Aliases
1207def IWMMXT   : Architecture<"iwmmxt",      "ARMv5te",  [ARMv5te]>;
1208def IWMMXT2  : Architecture<"iwmmxt2",     "ARMv5te",  [ARMv5te]>;
1209def XScale   : Architecture<"xscale",      "ARMv5te",  [ARMv5te]>;
1210def ARMv6j   : Architecture<"armv6j",      "ARMv7a",   [ARMv6]>;
1211def ARMv7k   : Architecture<"armv7k",      "ARMv7a",   [ARMv7a]>;
1212def ARMv7s   : Architecture<"armv7s",      "ARMv7a",   [ARMv7a]>;
1213
1214//===----------------------------------------------------------------------===//
1215// Register File Description
1216//===----------------------------------------------------------------------===//
1217
1218include "ARMRegisterInfo.td"
1219include "ARMRegisterBanks.td"
1220include "ARMCallingConv.td"
1221
1222//===----------------------------------------------------------------------===//
1223// ARM schedules.
1224//===----------------------------------------------------------------------===//
1225//
1226include "ARMPredicates.td"
1227include "ARMSchedule.td"
1228
1229//===----------------------------------------------------------------------===//
1230// Instruction Descriptions
1231//===----------------------------------------------------------------------===//
1232
1233include "ARMInstrInfo.td"
1234def ARMInstrInfo : InstrInfo;
1235
1236//===----------------------------------------------------------------------===//
1237// ARM schedules
1238//
1239include "ARMScheduleV6.td"
1240include "ARMScheduleA8.td"
1241include "ARMScheduleA9.td"
1242include "ARMScheduleSwift.td"
1243include "ARMScheduleR52.td"
1244include "ARMScheduleA57.td"
1245include "ARMScheduleM4.td"
1246include "ARMScheduleM55.td"
1247include "ARMScheduleM7.td"
1248include "ARMScheduleM85.td"
1249
1250//===----------------------------------------------------------------------===//
1251// ARM processors
1252//
1253// Dummy CPU, used to target architectures
1254def : ProcessorModel<"generic",     CortexA8Model,      []>;
1255
1256// FIXME: Several processors below are not using their own scheduler
1257// model, but one of similar/previous processor. These should be fixed.
1258
1259def : ProcNoItin<"arm8",                                [ARMv4]>;
1260def : ProcNoItin<"arm810",                              [ARMv4]>;
1261def : ProcNoItin<"strongarm",                           [ARMv4]>;
1262def : ProcNoItin<"strongarm110",                        [ARMv4]>;
1263def : ProcNoItin<"strongarm1100",                       [ARMv4]>;
1264def : ProcNoItin<"strongarm1110",                       [ARMv4]>;
1265
1266def : ProcNoItin<"arm7tdmi",                            [ARMv4t]>;
1267def : ProcNoItin<"arm7tdmi-s",                          [ARMv4t]>;
1268def : ProcNoItin<"arm710t",                             [ARMv4t]>;
1269def : ProcNoItin<"arm720t",                             [ARMv4t]>;
1270def : ProcNoItin<"arm9",                                [ARMv4t]>;
1271def : ProcNoItin<"arm9tdmi",                            [ARMv4t]>;
1272def : ProcNoItin<"arm920",                              [ARMv4t]>;
1273def : ProcNoItin<"arm920t",                             [ARMv4t]>;
1274def : ProcNoItin<"arm922t",                             [ARMv4t]>;
1275def : ProcNoItin<"arm940t",                             [ARMv4t]>;
1276def : ProcNoItin<"ep9312",                              [ARMv4t]>;
1277
1278def : ProcNoItin<"arm10tdmi",                           [ARMv5t]>;
1279def : ProcNoItin<"arm1020t",                            [ARMv5t]>;
1280
1281def : ProcNoItin<"arm9e",                               [ARMv5te]>;
1282def : ProcNoItin<"arm926ej-s",                          [ARMv5te]>;
1283def : ProcNoItin<"arm946e-s",                           [ARMv5te]>;
1284def : ProcNoItin<"arm966e-s",                           [ARMv5te]>;
1285def : ProcNoItin<"arm968e-s",                           [ARMv5te]>;
1286def : ProcNoItin<"arm10e",                              [ARMv5te]>;
1287def : ProcNoItin<"arm1020e",                            [ARMv5te]>;
1288def : ProcNoItin<"arm1022e",                            [ARMv5te]>;
1289def : ProcNoItin<"xscale",                              [ARMv5te]>;
1290def : ProcNoItin<"iwmmxt",                              [ARMv5te]>;
1291
1292def : Processor<"arm1136j-s",       ARMV6Itineraries,   [ARMv6]>;
1293def : Processor<"arm1136jf-s",      ARMV6Itineraries,   [ARMv6,
1294                                                         FeatureVFP2,
1295                                                         FeatureHasSlowFPVMLx]>;
1296
1297def : Processor<"cortex-m0",        ARMV6Itineraries,   [ARMv6m,
1298                                                         FeatureHasNoBranchPredictor]>;
1299def : Processor<"cortex-m0plus",    ARMV6Itineraries,   [ARMv6m,
1300                                                         FeatureHasNoBranchPredictor]>;
1301def : Processor<"cortex-m1",        ARMV6Itineraries,   [ARMv6m,
1302                                                         FeatureHasNoBranchPredictor]>;
1303def : Processor<"sc000",            ARMV6Itineraries,   [ARMv6m,
1304                                                         FeatureHasNoBranchPredictor]>;
1305
1306def : Processor<"arm1176jz-s",      ARMV6Itineraries,   [ARMv6kz]>;
1307def : Processor<"arm1176jzf-s",     ARMV6Itineraries,   [ARMv6kz,
1308                                                         FeatureVFP2,
1309                                                         FeatureHasSlowFPVMLx]>;
1310
1311def : Processor<"mpcorenovfp",      ARMV6Itineraries,   [ARMv6k]>;
1312def : Processor<"mpcore",           ARMV6Itineraries,   [ARMv6k,
1313                                                         FeatureVFP2,
1314                                                         FeatureHasSlowFPVMLx]>;
1315
1316def : Processor<"arm1156t2-s",      ARMV6Itineraries,   [ARMv6t2]>;
1317def : Processor<"arm1156t2f-s",     ARMV6Itineraries,   [ARMv6t2,
1318                                                         FeatureVFP2,
1319                                                         FeatureHasSlowFPVMLx]>;
1320
1321def : ProcessorModel<"cortex-a5",   CortexA8Model,      [ARMv7a, ProcA5,
1322                                                         FeatureHasRetAddrStack,
1323                                                         FeatureTrustZone,
1324                                                         FeatureSlowFPBrcc,
1325                                                         FeatureHasSlowFPVMLx,
1326                                                         FeatureHasSlowFPVFMx,
1327                                                         FeatureVMLxForwarding,
1328                                                         FeatureMP,
1329                                                         FeatureVFP4]>;
1330
1331def : ProcessorModel<"cortex-a7",   CortexA8Model,      [ARMv7a, ProcA7,
1332                                                         FeatureHasRetAddrStack,
1333                                                         FeatureTrustZone,
1334                                                         FeatureSlowFPBrcc,
1335                                                         FeatureHasVMLxHazards,
1336                                                         FeatureHasSlowFPVMLx,
1337                                                         FeatureHasSlowFPVFMx,
1338                                                         FeatureVMLxForwarding,
1339                                                         FeatureMP,
1340                                                         FeatureVFP4,
1341                                                         FeatureVirtualization]>;
1342
1343def : ProcessorModel<"cortex-a8",   CortexA8Model,      [ARMv7a, ProcA8,
1344                                                         FeatureHasRetAddrStack,
1345                                                         FeatureNonpipelinedVFP,
1346                                                         FeatureTrustZone,
1347                                                         FeatureSlowFPBrcc,
1348                                                         FeatureHasVMLxHazards,
1349                                                         FeatureHasSlowFPVMLx,
1350                                                         FeatureHasSlowFPVFMx,
1351                                                         FeatureVMLxForwarding]>;
1352
1353def : ProcessorModel<"cortex-a9",   CortexA9Model,      [ARMv7a, ProcA9,
1354                                                         FeatureHasRetAddrStack,
1355                                                         FeatureTrustZone,
1356                                                         FeatureHasVMLxHazards,
1357                                                         FeatureVMLxForwarding,
1358                                                         FeatureFP16,
1359                                                         FeatureAvoidPartialCPSR,
1360                                                         FeatureExpandMLx,
1361                                                         FeaturePreferVMOVSR,
1362                                                         FeatureMuxedUnits,
1363                                                         FeatureNEONForFPMovs,
1364                                                         FeatureCheckVLDnAlign,
1365                                                         FeatureMP]>;
1366
1367def : ProcessorModel<"cortex-a12",  CortexA9Model,      [ARMv7a, ProcA12,
1368                                                         FeatureHasRetAddrStack,
1369                                                         FeatureTrustZone,
1370                                                         FeatureVMLxForwarding,
1371                                                         FeatureVFP4,
1372                                                         FeatureAvoidPartialCPSR,
1373                                                         FeatureVirtualization,
1374                                                         FeatureMP]>;
1375
1376def : ProcessorModel<"cortex-a15",  CortexA9Model,      [ARMv7a, ProcA15,
1377                                                         FeatureDontWidenVMOVS,
1378                                                         FeatureSplatVFPToNeon,
1379                                                         FeatureHasRetAddrStack,
1380                                                         FeatureMuxedUnits,
1381                                                         FeatureTrustZone,
1382                                                         FeatureVFP4,
1383                                                         FeatureMP,
1384                                                         FeatureCheckVLDnAlign,
1385                                                         FeatureAvoidPartialCPSR,
1386                                                         FeatureVirtualization]>;
1387
1388def : ProcessorModel<"cortex-a17",  CortexA9Model,      [ARMv7a, ProcA17,
1389                                                         FeatureHasRetAddrStack,
1390                                                         FeatureTrustZone,
1391                                                         FeatureMP,
1392                                                         FeatureVMLxForwarding,
1393                                                         FeatureVFP4,
1394                                                         FeatureAvoidPartialCPSR,
1395                                                         FeatureVirtualization]>;
1396
1397// FIXME: krait has currently the same features as A9 plus VFP4 and  HWDiv
1398def : ProcessorModel<"krait",       CortexA9Model,      [ARMv7a, ProcKrait,
1399                                                         FeatureHasRetAddrStack,
1400                                                         FeatureMuxedUnits,
1401                                                         FeatureCheckVLDnAlign,
1402                                                         FeatureVMLxForwarding,
1403                                                         FeatureFP16,
1404                                                         FeatureAvoidPartialCPSR,
1405                                                         FeatureVFP4,
1406                                                         FeatureHWDivThumb,
1407                                                         FeatureHWDivARM]>;
1408
1409def : ProcessorModel<"swift",       SwiftModel,         [ARMv7a, ProcSwift,
1410                                                         FeatureHasRetAddrStack,
1411                                                         FeatureNEONForFP,
1412                                                         FeatureVFP4,
1413                                                         FeatureUseWideStrideVFP,
1414                                                         FeatureMP,
1415                                                         FeatureHWDivThumb,
1416                                                         FeatureHWDivARM,
1417                                                         FeatureAvoidPartialCPSR,
1418                                                         FeatureAvoidMOVsShOp,
1419                                                         FeatureHasSlowFPVMLx,
1420                                                         FeatureHasSlowFPVFMx,
1421                                                         FeatureHasVMLxHazards,
1422                                                         FeatureProfUnpredicate,
1423                                                         FeaturePrefISHSTBarrier,
1424                                                         FeatureSlowOddRegister,
1425                                                         FeatureSlowLoadDSubreg,
1426                                                         FeatureSlowVGETLNi32,
1427                                                         FeatureSlowVDUP32,
1428                                                         FeatureUseMISched,
1429                                                         FeatureNoPostRASched]>;
1430
1431def : ProcessorModel<"cortex-r4",   CortexA8Model,      [ARMv7r, ProcR4,
1432                                                         FeatureHasRetAddrStack,
1433                                                         FeatureAvoidPartialCPSR]>;
1434
1435def : ProcessorModel<"cortex-r4f",  CortexA8Model,      [ARMv7r, ProcR4,
1436                                                         FeatureHasRetAddrStack,
1437                                                         FeatureSlowFPBrcc,
1438                                                         FeatureHasSlowFPVMLx,
1439                                                         FeatureHasSlowFPVFMx,
1440                                                         FeatureVFP3_D16,
1441                                                         FeatureAvoidPartialCPSR]>;
1442
1443def : ProcessorModel<"cortex-r5",   CortexA8Model,      [ARMv7r, ProcR5,
1444                                                         FeatureHasRetAddrStack,
1445                                                         FeatureVFP3_D16,
1446                                                         FeatureSlowFPBrcc,
1447                                                         FeatureHWDivARM,
1448                                                         FeatureHasSlowFPVMLx,
1449                                                         FeatureHasSlowFPVFMx,
1450                                                         FeatureAvoidPartialCPSR]>;
1451
1452def : ProcessorModel<"cortex-r7",   CortexA8Model,      [ARMv7r, ProcR7,
1453                                                         FeatureHasRetAddrStack,
1454                                                         FeatureVFP3_D16,
1455                                                         FeatureFP16,
1456                                                         FeatureMP,
1457                                                         FeatureSlowFPBrcc,
1458                                                         FeatureHWDivARM,
1459                                                         FeatureHasSlowFPVMLx,
1460                                                         FeatureHasSlowFPVFMx,
1461                                                         FeatureAvoidPartialCPSR]>;
1462
1463def : ProcessorModel<"cortex-r8",   CortexA8Model,      [ARMv7r,
1464                                                         FeatureHasRetAddrStack,
1465                                                         FeatureVFP3_D16,
1466                                                         FeatureFP16,
1467                                                         FeatureMP,
1468                                                         FeatureSlowFPBrcc,
1469                                                         FeatureHWDivARM,
1470                                                         FeatureHasSlowFPVMLx,
1471                                                         FeatureHasSlowFPVFMx,
1472                                                         FeatureAvoidPartialCPSR]>;
1473
1474def : ProcessorModel<"cortex-m3",   CortexM4Model,      [ARMv7m,
1475                                                         ProcM3,
1476                                                         FeaturePrefLoopAlign32,
1477                                                         FeatureUseMISched,
1478                                                         FeatureHasNoBranchPredictor]>;
1479
1480def : ProcessorModel<"sc300",       CortexM4Model,      [ARMv7m,
1481                                                         ProcM3,
1482                                                         FeatureUseMISched,
1483                                                         FeatureHasNoBranchPredictor]>;
1484
1485def : ProcessorModel<"cortex-m4", CortexM4Model,        [ARMv7em,
1486                                                         FeatureVFP4_D16_SP,
1487                                                         FeaturePrefLoopAlign32,
1488                                                         FeatureHasSlowFPVMLx,
1489                                                         FeatureHasSlowFPVFMx,
1490                                                         FeatureUseMISched,
1491                                                         FeatureHasNoBranchPredictor]>;
1492
1493def : ProcessorModel<"cortex-m7", CortexM7Model,        [ARMv7em,
1494                                                         ProcM7,
1495                                                         FeatureFPARMv8_D16,
1496                                                         FeatureUseMIPipeliner,
1497                                                         FeatureUseMISched]>;
1498
1499def : ProcNoItin<"cortex-m23",                          [ARMv8mBaseline,
1500                                                         FeatureNoMovt,
1501                                                         FeatureHasNoBranchPredictor]>;
1502
1503def : ProcessorModel<"cortex-m33", CortexM4Model,       [ARMv8mMainline,
1504                                                         FeatureDSP,
1505                                                         FeatureFPARMv8_D16_SP,
1506                                                         FeaturePrefLoopAlign32,
1507                                                         FeatureHasSlowFPVMLx,
1508                                                         FeatureHasSlowFPVFMx,
1509                                                         FeatureUseMISched,
1510                                                         FeatureHasNoBranchPredictor,
1511                                                         FeatureFixCMSE_CVE_2021_35465]>;
1512
1513def : ProcessorModel<"cortex-m35p", CortexM4Model,      [ARMv8mMainline,
1514                                                         FeatureDSP,
1515                                                         FeatureFPARMv8_D16_SP,
1516                                                         FeaturePrefLoopAlign32,
1517                                                         FeatureHasSlowFPVMLx,
1518                                                         FeatureHasSlowFPVFMx,
1519                                                         FeatureUseMISched,
1520                                                         FeatureHasNoBranchPredictor,
1521                                                         FeatureFixCMSE_CVE_2021_35465]>;
1522
1523def : ProcessorModel<"cortex-m55", CortexM55Model,      [ARMv81mMainline,
1524                                                         FeatureDSP,
1525                                                         FeatureFPARMv8_D16,
1526                                                         FeatureUseMISched,
1527                                                         FeatureHasNoBranchPredictor,
1528                                                         FeaturePrefLoopAlign32,
1529                                                         FeatureHasSlowFPVMLx,
1530                                                         HasMVEFloatOps,
1531                                                         FeatureFixCMSE_CVE_2021_35465]>;
1532
1533def : ProcessorModel<"cortex-m85", CortexM85Model,      [ARMv81mMainline,
1534                                                         FeatureDSP,
1535                                                         FeatureFPARMv8_D16,
1536                                                         FeaturePACBTI,
1537                                                         FeatureUseMISched,
1538                                                         HasMVEFloatOps]>;
1539
1540def : ProcessorModel<"cortex-m52", CortexM55Model,      [ARMv81mMainline,
1541                                                         FeatureDSP,
1542                                                         FeatureFPARMv8_D16,
1543                                                         FeatureHasNoBranchPredictor,
1544                                                         FeaturePACBTI,
1545                                                         FeatureUseMISched,
1546                                                         FeaturePrefLoopAlign32,
1547                                                         FeatureHasSlowFPVMLx,
1548                                                         FeatureMVEVectorCostFactor1,
1549                                                         HasMVEFloatOps]>;
1550
1551def : ProcNoItin<"cortex-a32",                           [ARMv8a,
1552                                                         FeatureHWDivThumb,
1553                                                         FeatureHWDivARM,
1554                                                         FeatureCrypto,
1555                                                         FeatureCRC]>;
1556
1557def : ProcNoItin<"cortex-a35",                          [ARMv8a, ProcA35,
1558                                                         FeatureHWDivThumb,
1559                                                         FeatureHWDivARM,
1560                                                         FeatureCrypto,
1561                                                         FeatureCRC]>;
1562
1563def : ProcNoItin<"cortex-a53",                          [ARMv8a, ProcA53,
1564                                                         FeatureHWDivThumb,
1565                                                         FeatureHWDivARM,
1566                                                         FeatureCrypto,
1567                                                         FeatureCRC,
1568                                                         FeatureFPAO]>;
1569
1570def : ProcNoItin<"cortex-a55",                          [ARMv82a, ProcA55,
1571                                                         FeatureHWDivThumb,
1572                                                         FeatureHWDivARM,
1573                                                         FeatureDotProd]>;
1574
1575def : ProcessorModel<"cortex-a57",  CortexA57Model,     [ARMv8a, ProcA57,
1576                                                         FeatureHWDivThumb,
1577                                                         FeatureHWDivARM,
1578                                                         FeatureCrypto,
1579                                                         FeatureCRC,
1580                                                         FeatureFPAO,
1581                                                         FeatureAvoidPartialCPSR,
1582                                                         FeatureCheapPredicableCPSR,
1583                                                         FeatureFixCortexA57AES1742098]>;
1584
1585def : ProcessorModel<"cortex-a72",  CortexA57Model,     [ARMv8a, ProcA72,
1586                                                         FeatureHWDivThumb,
1587                                                         FeatureHWDivARM,
1588                                                         FeatureCrypto,
1589                                                         FeatureCRC,
1590                                                         FeatureFixCortexA57AES1742098]>;
1591
1592def : ProcNoItin<"cortex-a73",                          [ARMv8a, ProcA73,
1593                                                         FeatureHWDivThumb,
1594                                                         FeatureHWDivARM,
1595                                                         FeatureCrypto,
1596                                                         FeatureCRC]>;
1597
1598def : ProcNoItin<"cortex-a75",                          [ARMv82a, ProcA75,
1599                                                         FeatureHWDivThumb,
1600                                                         FeatureHWDivARM,
1601                                                         FeatureDotProd]>;
1602
1603def : ProcNoItin<"cortex-a76",                          [ARMv82a, ProcA76,
1604                                                         FeatureHWDivThumb,
1605                                                         FeatureHWDivARM,
1606                                                         FeatureCrypto,
1607                                                         FeatureCRC,
1608                                                         FeatureFullFP16,
1609                                                         FeatureDotProd]>;
1610
1611def : ProcNoItin<"cortex-a76ae",                        [ARMv82a, ProcA76,
1612                                                         FeatureHWDivThumb,
1613                                                         FeatureHWDivARM,
1614                                                         FeatureCrypto,
1615                                                         FeatureCRC,
1616                                                         FeatureFullFP16,
1617                                                         FeatureDotProd]>;
1618
1619def : ProcNoItin<"cortex-a77",                          [ARMv82a, ProcA77,
1620                                                         FeatureHWDivThumb,
1621                                                         FeatureHWDivARM,
1622                                                         FeatureCrypto,
1623                                                         FeatureCRC,
1624                                                         FeatureFullFP16,
1625                                                         FeatureDotProd]>;
1626
1627def : ProcNoItin<"cortex-a78",                          [ARMv82a, ProcA78,
1628                                                         FeatureHWDivThumb,
1629                                                         FeatureHWDivARM,
1630                                                         FeatureCrypto,
1631                                                         FeatureCRC,
1632                                                         FeatureFullFP16,
1633                                                         FeatureDotProd]>;
1634
1635def : ProcNoItin<"cortex-a78c",                         [ARMv82a, ProcA78C,
1636                                                         FeatureHWDivThumb,
1637                                                         FeatureHWDivARM,
1638                                                         FeatureCrypto,
1639                                                         FeatureCRC,
1640                                                         FeatureDotProd,
1641                                                         FeatureFullFP16]>;
1642
1643def : ProcNoItin<"cortex-a710",                         [ARMv9a, ProcA710,
1644                                                         FeatureHWDivThumb,
1645                                                         FeatureHWDivARM,
1646                                                         FeatureFP16FML,
1647                                                         FeatureBF16,
1648                                                         FeatureMatMulInt8,
1649                                                         FeatureSB]>;
1650
1651def : ProcNoItin<"cortex-x1",                           [ARMv82a, ProcX1,
1652                                                         FeatureHWDivThumb,
1653                                                         FeatureHWDivARM,
1654                                                         FeatureCrypto,
1655                                                         FeatureCRC,
1656                                                         FeatureFullFP16,
1657                                                         FeatureDotProd]>;
1658
1659def : ProcNoItin<"cortex-x1c",                          [ARMv82a, ProcX1C,
1660                                                         FeatureHWDivThumb,
1661                                                         FeatureHWDivARM,
1662                                                         FeatureCrypto,
1663                                                         FeatureCRC,
1664                                                         FeatureFullFP16,
1665                                                         FeatureDotProd]>;
1666
1667def : ProcNoItin<"neoverse-v1",                         [ARMv84a,
1668                                                         FeatureHWDivThumb,
1669                                                         FeatureHWDivARM,
1670                                                         FeatureCrypto,
1671                                                         FeatureCRC,
1672                                                         FeatureFullFP16,
1673                                                         FeatureBF16,
1674                                                         FeatureMatMulInt8]>;
1675
1676def : ProcNoItin<"neoverse-n1",                         [ARMv82a,
1677                                                         FeatureHWDivThumb,
1678                                                         FeatureHWDivARM,
1679                                                         FeatureCrypto,
1680                                                         FeatureCRC,
1681                                                         FeatureDotProd]>;
1682
1683def : ProcNoItin<"neoverse-n2",                         [ARMv9a,
1684                                                         FeatureBF16,
1685                                                         FeatureMatMulInt8]>;
1686
1687def : ProcessorModel<"cyclone",     SwiftModel,         [ARMv8a, ProcSwift,
1688                                                         FeatureHasRetAddrStack,
1689                                                         FeatureNEONForFP,
1690                                                         FeatureVFP4,
1691                                                         FeatureMP,
1692                                                         FeatureHWDivThumb,
1693                                                         FeatureHWDivARM,
1694                                                         FeatureAvoidPartialCPSR,
1695                                                         FeatureAvoidMOVsShOp,
1696                                                         FeatureHasSlowFPVMLx,
1697                                                         FeatureHasSlowFPVFMx,
1698                                                         FeatureCrypto,
1699                                                         FeatureUseMISched,
1700                                                         FeatureZCZeroing,
1701                                                         FeatureNoPostRASched]>;
1702
1703def : ProcNoItin<"exynos-m3",                           [ARMv8a, ProcExynos]>;
1704def : ProcNoItin<"exynos-m4",                           [ARMv82a, ProcExynos,
1705                                                         FeatureFullFP16,
1706                                                         FeatureDotProd]>;
1707def : ProcNoItin<"exynos-m5",                           [ARMv82a, ProcExynos,
1708                                                         FeatureFullFP16,
1709                                                         FeatureDotProd]>;
1710
1711def : ProcNoItin<"kryo",                                [ARMv8a, ProcKryo,
1712                                                         FeatureHWDivThumb,
1713                                                         FeatureHWDivARM,
1714                                                         FeatureCrypto,
1715                                                         FeatureCRC]>;
1716
1717def : ProcessorModel<"cortex-r52", CortexR52Model,      [ARMv8r, ProcR52,
1718                                                         FeatureUseMISched,
1719                                                         FeatureFPAO]>;
1720
1721//===----------------------------------------------------------------------===//
1722// Declare the target which we are implementing
1723//===----------------------------------------------------------------------===//
1724
1725def ARMAsmWriter : AsmWriter {
1726  string AsmWriterClassName  = "InstPrinter";
1727  int PassSubtarget = 1;
1728  int Variant = 0;
1729  bit isMCAsmWriter = 1;
1730}
1731
1732def ARMAsmParser : AsmParser {
1733  bit ReportMultipleNearMisses = 1;
1734}
1735
1736def ARMAsmParserVariant : AsmParserVariant {
1737  int Variant = 0;
1738  string Name = "ARM";
1739  string BreakCharacters = ".";
1740}
1741
1742def ARM : Target {
1743  // Pull in Instruction Info.
1744  let InstructionSet = ARMInstrInfo;
1745  let AssemblyWriters = [ARMAsmWriter];
1746  let AssemblyParsers = [ARMAsmParser];
1747  let AssemblyParserVariants = [ARMAsmParserVariant];
1748  let AllowRegisterRenaming = 1;
1749}
1750