xref: /llvm-project-15.0.7/llvm/lib/Target/ARM/ARM.td (revision fbdcfcd4)
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
22def ModeThumb             : SubtargetFeature<"thumb-mode", "InThumbMode",
23                                             "true", "Thumb mode">;
24
25def ModeSoftFloat         : SubtargetFeature<"soft-float","UseSoftFloat",
26                                             "true", "Use software floating "
27                                             "point features.">;
28
29
30//===----------------------------------------------------------------------===//
31// ARM Subtarget features.
32//
33
34// Floating Point, HW Division and Neon Support
35
36// FP loads/stores/moves, shared between VFP and MVE (even in the integer-only
37// version).
38def FeatureFPRegs         : SubtargetFeature<"fpregs", "HasFPRegs", "true",
39                                             "Enable FP registers">;
40
41// 16-bit FP loads/stores/moves, shared between VFP (with the v8.2A FP16
42// extension) and MVE (even in the integer-only version).
43def FeatureFPRegs16       : SubtargetFeature<"fpregs16", "HasFPRegs16", "true",
44                                             "Enable 16-bit FP registers",
45                                             [FeatureFPRegs]>;
46
47def FeatureFPRegs64       : SubtargetFeature<"fpregs64", "HasFPRegs64", "true",
48                                             "Enable 64-bit FP registers",
49                                             [FeatureFPRegs]>;
50
51def FeatureFP64           : SubtargetFeature<"fp64", "HasFP64", "true",
52                                             "Floating point unit supports "
53                                             "double precision",
54                                             [FeatureFPRegs64]>;
55
56def FeatureD32            : SubtargetFeature<"d32", "HasD32", "true",
57                                             "Extend FP to 32 double registers">;
58
59multiclass VFPver<string name, string query, string description,
60                  list<SubtargetFeature> prev,
61                  list<SubtargetFeature> otherimplies,
62                  list<SubtargetFeature> vfp2prev = []> {
63  def _D16_SP: SubtargetFeature<
64    name#"d16sp", query#"D16SP", "true",
65    description#" with only 16 d-registers and no double precision",
66    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16_SP")) #
67      !foreach(v, vfp2prev, !cast<SubtargetFeature>(v # "_SP")) #
68      otherimplies>;
69  def _SP: SubtargetFeature<
70    name#"sp", query#"SP", "true",
71    description#" with no double precision",
72    !foreach(v, prev, !cast<SubtargetFeature>(v # "_SP")) #
73      otherimplies # [FeatureD32, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
74  def _D16: SubtargetFeature<
75    name#"d16", query#"D16", "true",
76    description#" with only 16 d-registers",
77    !foreach(v, prev, !cast<SubtargetFeature>(v # "_D16")) #
78      vfp2prev #
79      otherimplies # [FeatureFP64, !cast<SubtargetFeature>(NAME # "_D16_SP")]>;
80  def "": SubtargetFeature<
81    name, query, "true", description,
82    prev # otherimplies # [
83        !cast<SubtargetFeature>(NAME # "_D16"),
84        !cast<SubtargetFeature>(NAME # "_SP")]>;
85}
86
87def FeatureVFP2_SP        : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true",
88                                             "Enable VFP2 instructions with "
89                                             "no double precision",
90                                             [FeatureFPRegs]>;
91
92def FeatureVFP2           : SubtargetFeature<"vfp2", "HasVFPv2", "true",
93                                             "Enable VFP2 instructions",
94                                             [FeatureFP64, FeatureVFP2_SP]>;
95
96defm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions",
97                         [], [], [FeatureVFP2]>;
98
99def FeatureNEON           : SubtargetFeature<"neon", "HasNEON", "true",
100                                             "Enable NEON instructions",
101                                             [FeatureVFP3]>;
102
103def FeatureFP16           : SubtargetFeature<"fp16", "HasFP16", "true",
104                                             "Enable half-precision "
105                                             "floating point">;
106
107defm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable VFP4 instructions",
108                         [FeatureVFP3], [FeatureFP16]>;
109
110defm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP",
111                         [FeatureVFP4], []>;
112
113def FeatureFullFP16       : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
114                                             "Enable full half-precision "
115                                             "floating point",
116                                             [FeatureFPARMv8_D16_SP, FeatureFPRegs16]>;
117
118def FeatureFP16FML        : SubtargetFeature<"fp16fml", "HasFP16FML", "true",
119                                             "Enable full half-precision "
120                                             "floating point fml instructions",
121                                             [FeatureFullFP16]>;
122
123def FeatureHWDivThumb     : SubtargetFeature<"hwdiv",
124                                             "HasHardwareDivideInThumb", "true",
125                                             "Enable divide instructions in Thumb">;
126
127def FeatureHWDivARM       : SubtargetFeature<"hwdiv-arm",
128                                             "HasHardwareDivideInARM", "true",
129                                             "Enable divide instructions in ARM mode">;
130
131// Atomic Support
132def FeatureDB             : SubtargetFeature<"db", "HasDataBarrier", "true",
133                                             "Has data barrier (dmb/dsb) instructions">;
134
135def FeatureV7Clrex        : SubtargetFeature<"v7clrex", "HasV7Clrex", "true",
136                                             "Has v7 clrex instruction">;
137
138def FeatureDFB  : SubtargetFeature<"dfb", "HasFullDataBarrier", "true",
139                                   "Has full data barrier (dfb) instruction">;
140
141def FeatureAcquireRelease : SubtargetFeature<"acquire-release",
142                                             "HasAcquireRelease", "true",
143                                             "Has v8 acquire/release (lda/ldaex "
144                                             " etc) instructions">;
145
146
147def FeatureSlowFPBrcc     : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
148                                             "FP compare + branch is slow">;
149
150def FeaturePerfMon        : SubtargetFeature<"perfmon", "HasPerfMon", "true",
151                                             "Enable support for Performance "
152                                             "Monitor extensions">;
153
154
155// TrustZone Security Extensions
156def FeatureTrustZone      : SubtargetFeature<"trustzone", "HasTrustZone", "true",
157                                             "Enable support for TrustZone "
158                                             "security extensions">;
159
160def Feature8MSecExt       : SubtargetFeature<"8msecext", "Has8MSecExt", "true",
161                                             "Enable support for ARMv8-M "
162                                             "Security Extensions">;
163
164def FeatureSHA2           : SubtargetFeature<"sha2", "HasSHA2", "true",
165                                             "Enable SHA1 and SHA256 support", [FeatureNEON]>;
166
167def FeatureAES            : SubtargetFeature<"aes", "HasAES", "true",
168                                             "Enable AES support", [FeatureNEON]>;
169
170def FeatureCrypto         : SubtargetFeature<"crypto", "HasCrypto", "true",
171                                             "Enable support for "
172                                             "Cryptography extensions",
173                                             [FeatureNEON, FeatureSHA2, FeatureAES]>;
174
175def FeatureCRC            : SubtargetFeature<"crc", "HasCRC", "true",
176                                             "Enable support for CRC instructions">;
177
178def FeatureDotProd        : SubtargetFeature<"dotprod", "HasDotProd", "true",
179                                             "Enable support for dot product instructions",
180                                             [FeatureNEON]>;
181
182// Not to be confused with FeatureHasRetAddrStack (return address stack)
183def FeatureRAS            : SubtargetFeature<"ras", "HasRAS", "true",
184                                             "Enable Reliability, Availability "
185                                             "and Serviceability extensions">;
186
187// Fast computation of non-negative address offsets
188def FeatureFPAO           : SubtargetFeature<"fpao", "HasFPAO", "true",
189                                             "Enable fast computation of "
190                                             "positive address offsets">;
191
192// Fast execution of AES crypto operations
193def FeatureFuseAES        : SubtargetFeature<"fuse-aes", "HasFuseAES", "true",
194                                             "CPU fuses AES crypto operations">;
195
196// Fast execution of bottom and top halves of literal generation
197def FeatureFuseLiterals   : SubtargetFeature<"fuse-literals", "HasFuseLiterals", "true",
198                                             "CPU fuses literal generation operations">;
199
200// The way of reading thread pointer
201def FeatureReadTp :  SubtargetFeature<"read-tp-hard", "ReadTPHard", "true",
202                                      "Reading thread pointer from register">;
203
204// Cyclone can zero VFP registers in 0 cycles.
205def FeatureZCZeroing      : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
206                                             "Has zero-cycle zeroing instructions">;
207
208// Whether it is profitable to unpredicate certain instructions during if-conversion
209def FeatureProfUnpredicate : SubtargetFeature<"prof-unpr",
210                                              "IsProfitableToUnpredicate", "true",
211                                              "Is profitable to unpredicate">;
212
213// Some targets (e.g. Swift) have microcoded VGETLNi32.
214def FeatureSlowVGETLNi32  : SubtargetFeature<"slow-vgetlni32",
215                                             "HasSlowVGETLNi32", "true",
216                                             "Has slow VGETLNi32 - prefer VMOV">;
217
218// Some targets (e.g. Swift) have microcoded VDUP32.
219def FeatureSlowVDUP32     : SubtargetFeature<"slow-vdup32", "HasSlowVDUP32",
220                                             "true",
221                                             "Has slow VDUP32 - prefer VMOV">;
222
223// Some targets (e.g. Cortex-A9) prefer VMOVSR to VMOVDRR even when using NEON
224// for scalar FP, as this allows more effective execution domain optimization.
225def FeaturePreferVMOVSR   : SubtargetFeature<"prefer-vmovsr", "PreferVMOVSR",
226                                             "true", "Prefer VMOVSR">;
227
228// Swift has ISHST barriers compatible with Atomic Release semantics but weaker
229// than ISH
230def FeaturePrefISHSTBarrier : SubtargetFeature<"prefer-ishst", "PreferISHST",
231                                               "true", "Prefer ISHST barriers">;
232
233// Some targets (e.g. Cortex-A9) have muxed AGU and NEON/FPU.
234def FeatureMuxedUnits     : SubtargetFeature<"muxed-units", "HasMuxedUnits",
235                                             "true",
236                                             "Has muxed AGU and NEON/FPU">;
237
238// Whether VLDM/VSTM starting with odd register number need more microops
239// than single VLDRS
240def FeatureSlowOddRegister : SubtargetFeature<"slow-odd-reg", "SlowOddRegister",
241                                              "true", "VLDM/VSTM starting "
242                                              "with an odd register is slow">;
243
244// Some targets have a renaming dependency when loading into D subregisters.
245def FeatureSlowLoadDSubreg : SubtargetFeature<"slow-load-D-subreg",
246                                              "SlowLoadDSubregister", "true",
247                                              "Loading into D subregs is slow">;
248
249def FeatureUseWideStrideVFP : SubtargetFeature<"wide-stride-vfp",
250                                               "UseWideStrideVFP", "true",
251                                               "Use a wide stride when allocating VFP registers">;
252
253// Some targets (e.g. Cortex-A15) never want VMOVS to be widened to VMOVD.
254def FeatureDontWidenVMOVS : SubtargetFeature<"dont-widen-vmovs",
255                                             "DontWidenVMOVS", "true",
256                                             "Don't widen VMOVS to VMOVD">;
257
258// Some targets (e.g. Cortex-A15) prefer to avoid mixing operations on different
259// VFP register widths.
260def FeatureSplatVFPToNeon : SubtargetFeature<"splat-vfp-neon",
261                                             "SplatVFPToNeon", "true",
262                                             "Splat register from VFP to NEON",
263                                             [FeatureDontWidenVMOVS]>;
264
265// Whether or not it is profitable to expand VFP/NEON MLA/MLS instructions.
266def FeatureExpandMLx      : SubtargetFeature<"expand-fp-mlx",
267                                             "ExpandMLx", "true",
268                                             "Expand VFP/NEON MLA/MLS instructions">;
269
270// Some targets have special RAW hazards for VFP/NEON VMLA/VMLS.
271def FeatureHasVMLxHazards : SubtargetFeature<"vmlx-hazards", "HasVMLxHazards",
272                                             "true", "Has VMLx hazards">;
273
274// Some targets (e.g. Cortex-A9) want to convert VMOVRS, VMOVSR and VMOVS from
275// VFP to NEON, as an execution domain optimization.
276def FeatureNEONForFPMovs  : SubtargetFeature<"neon-fpmovs",
277                                             "UseNEONForFPMovs", "true",
278                                             "Convert VMOVSR, VMOVRS, "
279                                             "VMOVS to NEON">;
280
281// Some processors benefit from using NEON instructions for scalar
282// single-precision FP operations. This affects instruction selection and should
283// only be enabled if the handling of denormals is not important.
284def FeatureNEONForFP      : SubtargetFeature<"neonfp",
285                                             "UseNEONForSinglePrecisionFP",
286                                             "true",
287                                             "Use NEON for single precision FP">;
288
289// On some processors, VLDn instructions that access unaligned data take one
290// extra cycle. Take that into account when computing operand latencies.
291def FeatureCheckVLDnAlign : SubtargetFeature<"vldn-align", "CheckVLDnAlign",
292                                             "true",
293                                             "Check for VLDn unaligned access">;
294
295// Some processors have a nonpipelined VFP coprocessor.
296def FeatureNonpipelinedVFP : SubtargetFeature<"nonpipelined-vfp",
297                                              "NonpipelinedVFP", "true",
298                                              "VFP instructions are not pipelined">;
299
300// Some processors have FP multiply-accumulate instructions that don't
301// play nicely with other VFP / NEON instructions, and it's generally better
302// to just not use them.
303def FeatureHasSlowFPVMLx  : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
304                                             "Disable VFP / NEON MAC instructions">;
305
306// VFPv4 added VFMA instructions that can similar be fast or slow.
307def FeatureHasSlowFPVFMx  : SubtargetFeature<"slowfpvfmx", "SlowFPVFMx", "true",
308                                             "Disable VFP / NEON FMA instructions">;
309
310// Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
311def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
312                                             "HasVMLxForwarding", "true",
313                                             "Has multiplier accumulator forwarding">;
314
315// Disable 32-bit to 16-bit narrowing for experimentation.
316def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
317                                             "Prefer 32-bit Thumb instrs">;
318
319def FeaturePrefLoopAlign32 : SubtargetFeature<"loop-align", "PrefLoopLogAlignment","2",
320                                              "Prefer 32-bit alignment for loops">;
321
322def FeatureMVEVectorCostFactor1 : SubtargetFeature<"mve1beat", "MVEVectorCostFactor", "1",
323                        "Model MVE instructions as a 1 beat per tick architecture">;
324
325def FeatureMVEVectorCostFactor2 : SubtargetFeature<"mve2beat", "MVEVectorCostFactor", "2",
326                        "Model MVE instructions as a 2 beats per tick architecture">;
327
328def FeatureMVEVectorCostFactor4 : SubtargetFeature<"mve4beat", "MVEVectorCostFactor", "4",
329                        "Model MVE instructions as a 4 beats per tick architecture">;
330
331/// Some instructions update CPSR partially, which can add false dependency for
332/// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
333/// mapped to a separate physical register. Avoid partial CPSR update for these
334/// processors.
335def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
336                                               "AvoidCPSRPartialUpdate", "true",
337                                 "Avoid CPSR partial update for OOO execution">;
338
339/// Disable +1 predication cost for instructions updating CPSR.
340/// Enabled for Cortex-A57.
341def FeatureCheapPredicableCPSR : SubtargetFeature<"cheap-predicable-cpsr",
342                                                  "CheapPredicableCPSRDef",
343                                                  "true",
344                  "Disable +1 predication cost for instructions updating CPSR">;
345
346def FeatureAvoidMOVsShOp  : SubtargetFeature<"avoid-movs-shop",
347                                             "AvoidMOVsShifterOperand", "true",
348                                             "Avoid movs instructions with "
349                                             "shifter operand">;
350
351// Some processors perform return stack prediction. CodeGen should avoid issue
352// "normal" call instructions to callees which do not return.
353def FeatureHasRetAddrStack : SubtargetFeature<"ret-addr-stack",
354                                              "HasRetAddrStack", "true",
355                                              "Has return address stack">;
356
357// Some processors have no branch predictor, which changes the expected cost of
358// taking a branch which affects the choice of whether to use predicated
359// instructions.
360def FeatureHasNoBranchPredictor : SubtargetFeature<"no-branch-predictor",
361                                                   "HasBranchPredictor", "false",
362                                                   "Has no branch predictor">;
363
364/// DSP extension.
365def FeatureDSP            : SubtargetFeature<"dsp", "HasDSP", "true",
366                                             "Supports DSP instructions in "
367                                             "ARM and/or Thumb2">;
368
369// Multiprocessing extension.
370def FeatureMP             : SubtargetFeature<"mp", "HasMPExtension", "true",
371                                        "Supports Multiprocessing extension">;
372
373// Virtualization extension - requires HW divide (ARMv7-AR ARMARM - 4.4.8).
374def FeatureVirtualization : SubtargetFeature<"virtualization",
375                                             "HasVirtualization", "true",
376                                             "Supports Virtualization extension",
377                                             [FeatureHWDivThumb, FeatureHWDivARM]>;
378
379// Special TRAP encoding for NaCl, which looks like a TRAP in Thumb too.
380// See ARMInstrInfo.td for details.
381def FeatureNaClTrap       : SubtargetFeature<"nacl-trap", "UseNaClTrap", "true",
382                                             "NaCl trap">;
383
384def FeatureStrictAlign    : SubtargetFeature<"strict-align",
385                                             "StrictAlign", "true",
386                                             "Disallow all unaligned memory "
387                                             "access">;
388
389def FeatureLongCalls      : SubtargetFeature<"long-calls", "GenLongCalls", "true",
390                                             "Generate calls via indirect call "
391                                             "instructions">;
392
393def FeatureExecuteOnly    : SubtargetFeature<"execute-only",
394                                             "GenExecuteOnly", "true",
395                                             "Enable the generation of "
396                                             "execute only code.">;
397
398def FeatureReserveR9      : SubtargetFeature<"reserve-r9", "ReserveR9", "true",
399                                             "Reserve R9, making it unavailable"
400                                             " as GPR">;
401
402def FeatureNoMovt         : SubtargetFeature<"no-movt", "NoMovt", "true",
403                                             "Don't use movt/movw pairs for "
404                                             "32-bit imms">;
405
406def FeatureNoNegativeImmediates
407                          : SubtargetFeature<"no-neg-immediates",
408                                             "NegativeImmediates", "false",
409                                             "Convert immediates and instructions "
410                                             "to their negated or complemented "
411                                             "equivalent when the immediate does "
412                                             "not fit in the encoding.">;
413
414// Use the MachineScheduler for instruction scheduling for the subtarget.
415def FeatureUseMISched: SubtargetFeature<"use-misched", "UseMISched", "true",
416                                        "Use the MachineScheduler">;
417
418def FeatureNoPostRASched : SubtargetFeature<"disable-postra-scheduler",
419    "DisablePostRAScheduler", "true",
420    "Don't schedule again after register allocation">;
421
422// Armv8.5-A extensions
423
424def FeatureSB       : SubtargetFeature<"sb", "HasSB", "true",
425  "Enable v8.5a Speculation Barrier" >;
426
427// Armv8.6-A extensions
428def FeatureBF16     : SubtargetFeature<"bf16", "HasBF16", "true",
429  "Enable support for BFloat16 instructions",  [FeatureNEON]>;
430
431def FeatureMatMulInt8 : SubtargetFeature<"i8mm", "HasMatMulInt8",
432    "true", "Enable Matrix Multiply Int8 Extension", [FeatureNEON]>;
433
434// Armv8.1-M extensions
435
436def FeatureLOB            : SubtargetFeature<"lob", "HasLOB", "true",
437                                             "Enable Low Overhead Branch "
438                                             "extensions">;
439
440//===----------------------------------------------------------------------===//
441// ARM architecture class
442//
443
444// A-series ISA
445def FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass",
446                                     "Is application profile ('A' series)">;
447
448// R-series ISA
449def FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass",
450                                     "Is realtime profile ('R' series)">;
451
452// M-series ISA
453def FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass",
454                                     "Is microcontroller profile ('M' series)">;
455
456
457def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
458                                     "Enable Thumb2 instructions">;
459
460def FeatureNoARM  : SubtargetFeature<"noarm", "NoARM", "true",
461                                     "Does not support ARM mode execution">;
462
463//===----------------------------------------------------------------------===//
464// ARM ISAa.
465//
466
467def HasV4TOps   : SubtargetFeature<"v4t", "HasV4TOps", "true",
468                                   "Support ARM v4T instructions">;
469
470def HasV5TOps   : SubtargetFeature<"v5t", "HasV5TOps", "true",
471                                   "Support ARM v5T instructions",
472                                   [HasV4TOps]>;
473
474def HasV5TEOps  : SubtargetFeature<"v5te", "HasV5TEOps", "true",
475                                   "Support ARM v5TE, v5TEj, and "
476                                   "v5TExp instructions",
477                                   [HasV5TOps]>;
478
479def HasV6Ops    : SubtargetFeature<"v6", "HasV6Ops", "true",
480                                   "Support ARM v6 instructions",
481                                   [HasV5TEOps]>;
482
483def HasV6MOps   : SubtargetFeature<"v6m", "HasV6MOps", "true",
484                                   "Support ARM v6M instructions",
485                                   [HasV6Ops]>;
486
487def HasV8MBaselineOps : SubtargetFeature<"v8m", "HasV8MBaselineOps", "true",
488                                         "Support ARM v8M Baseline instructions",
489                                         [HasV6MOps]>;
490
491def HasV6KOps   : SubtargetFeature<"v6k", "HasV6KOps", "true",
492                                   "Support ARM v6k instructions",
493                                   [HasV6Ops]>;
494
495def HasV6T2Ops  : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
496                                   "Support ARM v6t2 instructions",
497                                   [HasV8MBaselineOps, HasV6KOps, FeatureThumb2]>;
498
499def HasV7Ops    : SubtargetFeature<"v7", "HasV7Ops", "true",
500                                   "Support ARM v7 instructions",
501                                   [HasV6T2Ops, FeaturePerfMon,
502                                    FeatureV7Clrex]>;
503
504def HasV8MMainlineOps :
505                  SubtargetFeature<"v8m.main", "HasV8MMainlineOps", "true",
506                                   "Support ARM v8M Mainline instructions",
507                                   [HasV7Ops]>;
508
509def HasV8Ops    : SubtargetFeature<"v8", "HasV8Ops", "true",
510                                   "Support ARM v8 instructions",
511                                   [HasV7Ops, FeatureAcquireRelease]>;
512
513def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
514                                   "Support ARM v8.1a instructions",
515                                   [HasV8Ops]>;
516
517def HasV8_2aOps : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
518                                   "Support ARM v8.2a instructions",
519                                   [HasV8_1aOps]>;
520
521def HasV8_3aOps   : SubtargetFeature<"v8.3a", "HasV8_3aOps", "true",
522                                   "Support ARM v8.3a instructions",
523                                   [HasV8_2aOps]>;
524
525def HasV8_4aOps   : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
526                                   "Support ARM v8.4a instructions",
527                                   [HasV8_3aOps, FeatureDotProd]>;
528
529def HasV8_5aOps   : SubtargetFeature<"v8.5a", "HasV8_5aOps", "true",
530                                   "Support ARM v8.5a instructions",
531                                   [HasV8_4aOps, FeatureSB]>;
532
533def HasV8_6aOps   : SubtargetFeature<"v8.6a", "HasV8_6aOps", "true",
534                                   "Support ARM v8.6a instructions",
535                                   [HasV8_5aOps, FeatureBF16,
536                                    FeatureMatMulInt8]>;
537
538def HasV8_1MMainlineOps : SubtargetFeature<
539               "v8.1m.main", "HasV8_1MMainlineOps", "true",
540               "Support ARM v8-1M Mainline instructions",
541               [HasV8MMainlineOps]>;
542def HasMVEIntegerOps : SubtargetFeature<
543               "mve", "HasMVEIntegerOps", "true",
544               "Support M-Class Vector Extension with integer ops",
545               [HasV8_1MMainlineOps, FeatureDSP, FeatureFPRegs16, FeatureFPRegs64]>;
546def HasMVEFloatOps : SubtargetFeature<
547               "mve.fp", "HasMVEFloatOps", "true",
548               "Support M-Class Vector Extension with integer and floating ops",
549               [HasMVEIntegerOps, FeatureFPARMv8_D16_SP, FeatureFullFP16]>;
550
551def HasCDEOps : SubtargetFeature<"cde", "HasCDEOps", "true",
552                                 "Support CDE instructions",
553                                 [HasV8MMainlineOps]>;
554
555foreach i = {0-7} in
556    def FeatureCoprocCDE#i : SubtargetFeature<"cdecp"#i,
557                                              "CoprocCDE["#i#"]", "true",
558                                              "Coprocessor "#i#" ISA is CDEv1",
559                                              [HasCDEOps]>;
560
561//===----------------------------------------------------------------------===//
562// ARM Processor subtarget features.
563//
564
565def ProcA5      : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5",
566                                   "Cortex-A5 ARM processors", []>;
567def ProcA7      : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7",
568                                   "Cortex-A7 ARM processors", []>;
569def ProcA8      : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
570                                   "Cortex-A8 ARM processors", []>;
571def ProcA9      : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
572                                   "Cortex-A9 ARM processors", []>;
573def ProcA12     : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12",
574                                   "Cortex-A12 ARM processors", []>;
575def ProcA15     : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15",
576                                   "Cortex-A15 ARM processors", []>;
577def ProcA17     : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17",
578                                   "Cortex-A17 ARM processors", []>;
579def ProcA32     : SubtargetFeature<"a32", "ARMProcFamily", "CortexA32",
580                                   "Cortex-A32 ARM processors", []>;
581def ProcA35     : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
582                                   "Cortex-A35 ARM processors", []>;
583def ProcA53     : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
584                                   "Cortex-A53 ARM processors", []>;
585def ProcA55     : SubtargetFeature<"a55", "ARMProcFamily", "CortexA55",
586                                   "Cortex-A55 ARM processors", []>;
587def ProcA57     : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
588                                   "Cortex-A57 ARM processors", []>;
589def ProcA72     : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
590                                   "Cortex-A72 ARM processors", []>;
591def ProcA73     : SubtargetFeature<"a73", "ARMProcFamily", "CortexA73",
592                                   "Cortex-A73 ARM processors", []>;
593def ProcA75     : SubtargetFeature<"a75", "ARMProcFamily", "CortexA75",
594                                   "Cortex-A75 ARM processors", []>;
595def ProcA76     : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76",
596                                   "Cortex-A76 ARM processors", []>;
597
598def ProcKrait   : SubtargetFeature<"krait", "ARMProcFamily", "Krait",
599                                   "Qualcomm Krait processors", []>;
600def ProcKryo    : SubtargetFeature<"kryo", "ARMProcFamily", "Kryo",
601                                   "Qualcomm Kryo processors", []>;
602def ProcSwift   : SubtargetFeature<"swift", "ARMProcFamily", "Swift",
603                                   "Swift ARM processors", []>;
604
605def ProcExynos  : SubtargetFeature<"exynos", "ARMProcFamily", "Exynos",
606                                   "Samsung Exynos processors",
607                                   [FeatureZCZeroing,
608                                    FeatureUseWideStrideVFP,
609                                    FeatureSplatVFPToNeon,
610                                    FeatureSlowVGETLNi32,
611                                    FeatureSlowVDUP32,
612                                    FeatureSlowFPBrcc,
613                                    FeatureProfUnpredicate,
614                                    FeatureHWDivThumb,
615                                    FeatureHWDivARM,
616                                    FeatureHasSlowFPVMLx,
617                                    FeatureHasSlowFPVFMx,
618                                    FeatureHasRetAddrStack,
619                                    FeatureFuseLiterals,
620                                    FeatureFuseAES,
621                                    FeatureExpandMLx,
622                                    FeatureCrypto,
623                                    FeatureCRC]>;
624
625def ProcR4      : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4",
626                                   "Cortex-R4 ARM processors", []>;
627def ProcR5      : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5",
628                                   "Cortex-R5 ARM processors", []>;
629def ProcR7      : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7",
630                                   "Cortex-R7 ARM processors", []>;
631def ProcR52     : SubtargetFeature<"r52", "ARMProcFamily", "CortexR52",
632                                   "Cortex-R52 ARM processors", []>;
633
634def ProcM3      : SubtargetFeature<"m3", "ARMProcFamily", "CortexM3",
635                                   "Cortex-M3 ARM processors", []>;
636
637
638//===----------------------------------------------------------------------===//
639// ARM Helper classes.
640//
641
642class Architecture<string fname, string aname, list<SubtargetFeature> features>
643  : SubtargetFeature<fname, "ARMArch", aname,
644                     !strconcat(aname, " architecture"), features>;
645
646class ProcNoItin<string Name, list<SubtargetFeature> Features>
647  : Processor<Name, NoItineraries, Features>;
648
649
650//===----------------------------------------------------------------------===//
651// ARM architectures
652//
653
654def ARMv2     : Architecture<"armv2",     "ARMv2",    []>;
655
656def ARMv2a    : Architecture<"armv2a",    "ARMv2a",   []>;
657
658def ARMv3     : Architecture<"armv3",     "ARMv3",    []>;
659
660def ARMv3m    : Architecture<"armv3m",    "ARMv3m",   []>;
661
662def ARMv4     : Architecture<"armv4",     "ARMv4",    []>;
663
664def ARMv4t    : Architecture<"armv4t",    "ARMv4t",   [HasV4TOps]>;
665
666def ARMv5t    : Architecture<"armv5t",    "ARMv5t",   [HasV5TOps]>;
667
668def ARMv5te   : Architecture<"armv5te",   "ARMv5te",  [HasV5TEOps]>;
669
670def ARMv5tej  : Architecture<"armv5tej",  "ARMv5tej", [HasV5TEOps]>;
671
672def ARMv6     : Architecture<"armv6",     "ARMv6",    [HasV6Ops,
673                                                       FeatureDSP]>;
674
675def ARMv6t2   : Architecture<"armv6t2",   "ARMv6t2",  [HasV6T2Ops,
676                                                       FeatureDSP]>;
677
678def ARMv6k    : Architecture<"armv6k",    "ARMv6k",   [HasV6KOps]>;
679
680def ARMv6kz   : Architecture<"armv6kz",   "ARMv6kz",  [HasV6KOps,
681                                                       FeatureTrustZone]>;
682
683def ARMv6m    : Architecture<"armv6-m",   "ARMv6m",   [HasV6MOps,
684                                                       FeatureNoARM,
685                                                       ModeThumb,
686                                                       FeatureDB,
687                                                       FeatureMClass,
688                                                       FeatureStrictAlign]>;
689
690def ARMv6sm   : Architecture<"armv6s-m",  "ARMv6sm",  [HasV6MOps,
691                                                       FeatureNoARM,
692                                                       ModeThumb,
693                                                       FeatureDB,
694                                                       FeatureMClass,
695                                                       FeatureStrictAlign]>;
696
697def ARMv7a    : Architecture<"armv7-a",   "ARMv7a",   [HasV7Ops,
698                                                       FeatureNEON,
699                                                       FeatureDB,
700                                                       FeatureDSP,
701                                                       FeatureAClass]>;
702
703def ARMv7ve   : Architecture<"armv7ve",   "ARMv7ve",  [HasV7Ops,
704                                                       FeatureNEON,
705                                                       FeatureDB,
706                                                       FeatureDSP,
707                                                       FeatureTrustZone,
708                                                       FeatureMP,
709                                                       FeatureVirtualization,
710                                                       FeatureAClass]>;
711
712def ARMv7r    : Architecture<"armv7-r",   "ARMv7r",   [HasV7Ops,
713                                                       FeatureDB,
714                                                       FeatureDSP,
715                                                       FeatureHWDivThumb,
716                                                       FeatureRClass]>;
717
718def ARMv7m    : Architecture<"armv7-m",   "ARMv7m",   [HasV7Ops,
719                                                       FeatureThumb2,
720                                                       FeatureNoARM,
721                                                       ModeThumb,
722                                                       FeatureDB,
723                                                       FeatureHWDivThumb,
724                                                       FeatureMClass]>;
725
726def ARMv7em   : Architecture<"armv7e-m",  "ARMv7em",  [HasV7Ops,
727                                                       FeatureThumb2,
728                                                       FeatureNoARM,
729                                                       ModeThumb,
730                                                       FeatureDB,
731                                                       FeatureHWDivThumb,
732                                                       FeatureMClass,
733                                                       FeatureDSP]>;
734
735def ARMv8a    : Architecture<"armv8-a",   "ARMv8a",   [HasV8Ops,
736                                                       FeatureAClass,
737                                                       FeatureDB,
738                                                       FeatureFPARMv8,
739                                                       FeatureNEON,
740                                                       FeatureDSP,
741                                                       FeatureTrustZone,
742                                                       FeatureMP,
743                                                       FeatureVirtualization,
744                                                       FeatureCrypto,
745                                                       FeatureCRC]>;
746
747def ARMv81a   : Architecture<"armv8.1-a", "ARMv81a",  [HasV8_1aOps,
748                                                       FeatureAClass,
749                                                       FeatureDB,
750                                                       FeatureFPARMv8,
751                                                       FeatureNEON,
752                                                       FeatureDSP,
753                                                       FeatureTrustZone,
754                                                       FeatureMP,
755                                                       FeatureVirtualization,
756                                                       FeatureCrypto,
757                                                       FeatureCRC]>;
758
759def ARMv82a   : Architecture<"armv8.2-a", "ARMv82a",  [HasV8_2aOps,
760                                                       FeatureAClass,
761                                                       FeatureDB,
762                                                       FeatureFPARMv8,
763                                                       FeatureNEON,
764                                                       FeatureDSP,
765                                                       FeatureTrustZone,
766                                                       FeatureMP,
767                                                       FeatureVirtualization,
768                                                       FeatureCrypto,
769                                                       FeatureCRC,
770                                                       FeatureRAS]>;
771
772def ARMv83a   : Architecture<"armv8.3-a", "ARMv83a",  [HasV8_3aOps,
773                                                       FeatureAClass,
774                                                       FeatureDB,
775                                                       FeatureFPARMv8,
776                                                       FeatureNEON,
777                                                       FeatureDSP,
778                                                       FeatureTrustZone,
779                                                       FeatureMP,
780                                                       FeatureVirtualization,
781                                                       FeatureCrypto,
782                                                       FeatureCRC,
783                                                       FeatureRAS]>;
784
785def ARMv84a   : Architecture<"armv8.4-a", "ARMv84a",  [HasV8_4aOps,
786                                                       FeatureAClass,
787                                                       FeatureDB,
788                                                       FeatureFPARMv8,
789                                                       FeatureNEON,
790                                                       FeatureDSP,
791                                                       FeatureTrustZone,
792                                                       FeatureMP,
793                                                       FeatureVirtualization,
794                                                       FeatureCrypto,
795                                                       FeatureCRC,
796                                                       FeatureRAS,
797                                                       FeatureDotProd]>;
798
799def ARMv85a   : Architecture<"armv8.5-a", "ARMv85a",  [HasV8_5aOps,
800                                                       FeatureAClass,
801                                                       FeatureDB,
802                                                       FeatureFPARMv8,
803                                                       FeatureNEON,
804                                                       FeatureDSP,
805                                                       FeatureTrustZone,
806                                                       FeatureMP,
807                                                       FeatureVirtualization,
808                                                       FeatureCrypto,
809                                                       FeatureCRC,
810                                                       FeatureRAS,
811                                                       FeatureDotProd]>;
812def ARMv86a   : Architecture<"armv8.6-a", "ARMv86a",  [HasV8_6aOps,
813                                                       FeatureAClass,
814                                                       FeatureDB,
815                                                       FeatureFPARMv8,
816                                                       FeatureNEON,
817                                                       FeatureDSP,
818                                                       FeatureTrustZone,
819                                                       FeatureMP,
820                                                       FeatureVirtualization,
821                                                       FeatureCrypto,
822                                                       FeatureCRC,
823                                                       FeatureRAS,
824                                                       FeatureDotProd]>;
825
826def ARMv8r    : Architecture<"armv8-r",   "ARMv8r",   [HasV8Ops,
827                                                       FeatureRClass,
828                                                       FeatureDB,
829                                                       FeatureDFB,
830                                                       FeatureDSP,
831                                                       FeatureCRC,
832                                                       FeatureMP,
833                                                       FeatureVirtualization,
834                                                       FeatureFPARMv8,
835                                                       FeatureNEON]>;
836
837def ARMv8mBaseline : Architecture<"armv8-m.base", "ARMv8mBaseline",
838                                                      [HasV8MBaselineOps,
839                                                       FeatureNoARM,
840                                                       ModeThumb,
841                                                       FeatureDB,
842                                                       FeatureHWDivThumb,
843                                                       FeatureV7Clrex,
844                                                       Feature8MSecExt,
845                                                       FeatureAcquireRelease,
846                                                       FeatureMClass,
847                                                       FeatureStrictAlign]>;
848
849def ARMv8mMainline : Architecture<"armv8-m.main", "ARMv8mMainline",
850                                                      [HasV8MMainlineOps,
851                                                       FeatureNoARM,
852                                                       ModeThumb,
853                                                       FeatureDB,
854                                                       FeatureHWDivThumb,
855                                                       Feature8MSecExt,
856                                                       FeatureAcquireRelease,
857                                                       FeatureMClass]>;
858
859def ARMv81mMainline : Architecture<"armv8.1-m.main", "ARMv81mMainline",
860                                                      [HasV8_1MMainlineOps,
861                                                       FeatureNoARM,
862                                                       ModeThumb,
863                                                       FeatureDB,
864                                                       FeatureHWDivThumb,
865                                                       Feature8MSecExt,
866                                                       FeatureAcquireRelease,
867                                                       FeatureMClass,
868                                                       FeatureRAS,
869                                                       FeatureLOB]>;
870
871// Aliases
872def IWMMXT   : Architecture<"iwmmxt",      "ARMv5te",  [ARMv5te]>;
873def IWMMXT2  : Architecture<"iwmmxt2",     "ARMv5te",  [ARMv5te]>;
874def XScale   : Architecture<"xscale",      "ARMv5te",  [ARMv5te]>;
875def ARMv6j   : Architecture<"armv6j",      "ARMv7a",   [ARMv6]>;
876def ARMv7k   : Architecture<"armv7k",      "ARMv7a",   [ARMv7a]>;
877def ARMv7s   : Architecture<"armv7s",      "ARMv7a",   [ARMv7a]>;
878
879
880//===----------------------------------------------------------------------===//
881// ARM schedules.
882//===----------------------------------------------------------------------===//
883//
884include "ARMPredicates.td"
885include "ARMSchedule.td"
886
887//===----------------------------------------------------------------------===//
888// ARM processors
889//
890
891// Dummy CPU, used to target architectures
892def : ProcessorModel<"generic",     CortexA8Model,      []>;
893
894// FIXME: Several processors below are not using their own scheduler
895// model, but one of similar/previous processor. These should be fixed.
896
897def : ProcNoItin<"arm8",                                [ARMv4]>;
898def : ProcNoItin<"arm810",                              [ARMv4]>;
899def : ProcNoItin<"strongarm",                           [ARMv4]>;
900def : ProcNoItin<"strongarm110",                        [ARMv4]>;
901def : ProcNoItin<"strongarm1100",                       [ARMv4]>;
902def : ProcNoItin<"strongarm1110",                       [ARMv4]>;
903
904def : ProcNoItin<"arm7tdmi",                            [ARMv4t]>;
905def : ProcNoItin<"arm7tdmi-s",                          [ARMv4t]>;
906def : ProcNoItin<"arm710t",                             [ARMv4t]>;
907def : ProcNoItin<"arm720t",                             [ARMv4t]>;
908def : ProcNoItin<"arm9",                                [ARMv4t]>;
909def : ProcNoItin<"arm9tdmi",                            [ARMv4t]>;
910def : ProcNoItin<"arm920",                              [ARMv4t]>;
911def : ProcNoItin<"arm920t",                             [ARMv4t]>;
912def : ProcNoItin<"arm922t",                             [ARMv4t]>;
913def : ProcNoItin<"arm940t",                             [ARMv4t]>;
914def : ProcNoItin<"ep9312",                              [ARMv4t]>;
915
916def : ProcNoItin<"arm10tdmi",                           [ARMv5t]>;
917def : ProcNoItin<"arm1020t",                            [ARMv5t]>;
918
919def : ProcNoItin<"arm9e",                               [ARMv5te]>;
920def : ProcNoItin<"arm926ej-s",                          [ARMv5te]>;
921def : ProcNoItin<"arm946e-s",                           [ARMv5te]>;
922def : ProcNoItin<"arm966e-s",                           [ARMv5te]>;
923def : ProcNoItin<"arm968e-s",                           [ARMv5te]>;
924def : ProcNoItin<"arm10e",                              [ARMv5te]>;
925def : ProcNoItin<"arm1020e",                            [ARMv5te]>;
926def : ProcNoItin<"arm1022e",                            [ARMv5te]>;
927def : ProcNoItin<"xscale",                              [ARMv5te]>;
928def : ProcNoItin<"iwmmxt",                              [ARMv5te]>;
929
930def : Processor<"arm1136j-s",       ARMV6Itineraries,   [ARMv6]>;
931def : Processor<"arm1136jf-s",      ARMV6Itineraries,   [ARMv6,
932                                                         FeatureVFP2,
933                                                         FeatureHasSlowFPVMLx]>;
934
935def : Processor<"cortex-m0",        ARMV6Itineraries,   [ARMv6m]>;
936def : Processor<"cortex-m0plus",    ARMV6Itineraries,   [ARMv6m]>;
937def : Processor<"cortex-m1",        ARMV6Itineraries,   [ARMv6m]>;
938def : Processor<"sc000",            ARMV6Itineraries,   [ARMv6m]>;
939
940def : Processor<"arm1176j-s",       ARMV6Itineraries,   [ARMv6kz]>;
941def : Processor<"arm1176jz-s",      ARMV6Itineraries,   [ARMv6kz]>;
942def : Processor<"arm1176jzf-s",     ARMV6Itineraries,   [ARMv6kz,
943                                                         FeatureVFP2,
944                                                         FeatureHasSlowFPVMLx]>;
945
946def : Processor<"mpcorenovfp",      ARMV6Itineraries,   [ARMv6k]>;
947def : Processor<"mpcore",           ARMV6Itineraries,   [ARMv6k,
948                                                         FeatureVFP2,
949                                                         FeatureHasSlowFPVMLx]>;
950
951def : Processor<"arm1156t2-s",      ARMV6Itineraries,   [ARMv6t2]>;
952def : Processor<"arm1156t2f-s",     ARMV6Itineraries,   [ARMv6t2,
953                                                         FeatureVFP2,
954                                                         FeatureHasSlowFPVMLx]>;
955
956def : ProcessorModel<"cortex-a5",   CortexA8Model,      [ARMv7a, ProcA5,
957                                                         FeatureHasRetAddrStack,
958                                                         FeatureTrustZone,
959                                                         FeatureSlowFPBrcc,
960                                                         FeatureHasSlowFPVMLx,
961                                                         FeatureHasSlowFPVFMx,
962                                                         FeatureVMLxForwarding,
963                                                         FeatureMP,
964                                                         FeatureVFP4]>;
965
966def : ProcessorModel<"cortex-a7",   CortexA8Model,      [ARMv7a, ProcA7,
967                                                         FeatureHasRetAddrStack,
968                                                         FeatureTrustZone,
969                                                         FeatureSlowFPBrcc,
970                                                         FeatureHasVMLxHazards,
971                                                         FeatureHasSlowFPVMLx,
972                                                         FeatureHasSlowFPVFMx,
973                                                         FeatureVMLxForwarding,
974                                                         FeatureMP,
975                                                         FeatureVFP4,
976                                                         FeatureVirtualization]>;
977
978def : ProcessorModel<"cortex-a8",   CortexA8Model,      [ARMv7a, ProcA8,
979                                                         FeatureHasRetAddrStack,
980                                                         FeatureNonpipelinedVFP,
981                                                         FeatureTrustZone,
982                                                         FeatureSlowFPBrcc,
983                                                         FeatureHasVMLxHazards,
984                                                         FeatureHasSlowFPVMLx,
985                                                         FeatureHasSlowFPVFMx,
986                                                         FeatureVMLxForwarding]>;
987
988def : ProcessorModel<"cortex-a9",   CortexA9Model,      [ARMv7a, ProcA9,
989                                                         FeatureHasRetAddrStack,
990                                                         FeatureTrustZone,
991                                                         FeatureHasVMLxHazards,
992                                                         FeatureVMLxForwarding,
993                                                         FeatureFP16,
994                                                         FeatureAvoidPartialCPSR,
995                                                         FeatureExpandMLx,
996                                                         FeaturePreferVMOVSR,
997                                                         FeatureMuxedUnits,
998                                                         FeatureNEONForFPMovs,
999                                                         FeatureCheckVLDnAlign,
1000                                                         FeatureMP]>;
1001
1002def : ProcessorModel<"cortex-a12",  CortexA9Model,      [ARMv7a, ProcA12,
1003                                                         FeatureHasRetAddrStack,
1004                                                         FeatureTrustZone,
1005                                                         FeatureVMLxForwarding,
1006                                                         FeatureVFP4,
1007                                                         FeatureAvoidPartialCPSR,
1008                                                         FeatureVirtualization,
1009                                                         FeatureMP]>;
1010
1011def : ProcessorModel<"cortex-a15",  CortexA9Model,      [ARMv7a, ProcA15,
1012                                                         FeatureDontWidenVMOVS,
1013                                                         FeatureSplatVFPToNeon,
1014                                                         FeatureHasRetAddrStack,
1015                                                         FeatureMuxedUnits,
1016                                                         FeatureTrustZone,
1017                                                         FeatureVFP4,
1018                                                         FeatureMP,
1019                                                         FeatureCheckVLDnAlign,
1020                                                         FeatureAvoidPartialCPSR,
1021                                                         FeatureVirtualization]>;
1022
1023def : ProcessorModel<"cortex-a17",  CortexA9Model,      [ARMv7a, ProcA17,
1024                                                         FeatureHasRetAddrStack,
1025                                                         FeatureTrustZone,
1026                                                         FeatureMP,
1027                                                         FeatureVMLxForwarding,
1028                                                         FeatureVFP4,
1029                                                         FeatureAvoidPartialCPSR,
1030                                                         FeatureVirtualization]>;
1031
1032// FIXME: krait has currently the same features as A9 plus VFP4 and  HWDiv
1033def : ProcessorModel<"krait",       CortexA9Model,      [ARMv7a, ProcKrait,
1034                                                         FeatureHasRetAddrStack,
1035                                                         FeatureMuxedUnits,
1036                                                         FeatureCheckVLDnAlign,
1037                                                         FeatureVMLxForwarding,
1038                                                         FeatureFP16,
1039                                                         FeatureAvoidPartialCPSR,
1040                                                         FeatureVFP4,
1041                                                         FeatureHWDivThumb,
1042                                                         FeatureHWDivARM]>;
1043
1044def : ProcessorModel<"swift",       SwiftModel,         [ARMv7a, ProcSwift,
1045                                                         FeatureHasRetAddrStack,
1046                                                         FeatureNEONForFP,
1047                                                         FeatureVFP4,
1048                                                         FeatureUseWideStrideVFP,
1049                                                         FeatureMP,
1050                                                         FeatureHWDivThumb,
1051                                                         FeatureHWDivARM,
1052                                                         FeatureAvoidPartialCPSR,
1053                                                         FeatureAvoidMOVsShOp,
1054                                                         FeatureHasSlowFPVMLx,
1055                                                         FeatureHasSlowFPVFMx,
1056                                                         FeatureHasVMLxHazards,
1057                                                         FeatureProfUnpredicate,
1058                                                         FeaturePrefISHSTBarrier,
1059                                                         FeatureSlowOddRegister,
1060                                                         FeatureSlowLoadDSubreg,
1061                                                         FeatureSlowVGETLNi32,
1062                                                         FeatureSlowVDUP32,
1063                                                         FeatureUseMISched,
1064                                                         FeatureNoPostRASched]>;
1065
1066def : ProcessorModel<"cortex-r4",   CortexA8Model,      [ARMv7r, ProcR4,
1067                                                         FeatureHasRetAddrStack,
1068                                                         FeatureAvoidPartialCPSR]>;
1069
1070def : ProcessorModel<"cortex-r4f",  CortexA8Model,      [ARMv7r, ProcR4,
1071                                                         FeatureHasRetAddrStack,
1072                                                         FeatureSlowFPBrcc,
1073                                                         FeatureHasSlowFPVMLx,
1074                                                         FeatureHasSlowFPVFMx,
1075                                                         FeatureVFP3_D16,
1076                                                         FeatureAvoidPartialCPSR]>;
1077
1078def : ProcessorModel<"cortex-r5",   CortexA8Model,      [ARMv7r, ProcR5,
1079                                                         FeatureHasRetAddrStack,
1080                                                         FeatureVFP3_D16,
1081                                                         FeatureSlowFPBrcc,
1082                                                         FeatureHWDivARM,
1083                                                         FeatureHasSlowFPVMLx,
1084                                                         FeatureHasSlowFPVFMx,
1085                                                         FeatureAvoidPartialCPSR]>;
1086
1087def : ProcessorModel<"cortex-r7",   CortexA8Model,      [ARMv7r, ProcR7,
1088                                                         FeatureHasRetAddrStack,
1089                                                         FeatureVFP3_D16,
1090                                                         FeatureFP16,
1091                                                         FeatureMP,
1092                                                         FeatureSlowFPBrcc,
1093                                                         FeatureHWDivARM,
1094                                                         FeatureHasSlowFPVMLx,
1095                                                         FeatureHasSlowFPVFMx,
1096                                                         FeatureAvoidPartialCPSR]>;
1097
1098def : ProcessorModel<"cortex-r8",   CortexA8Model,      [ARMv7r,
1099                                                         FeatureHasRetAddrStack,
1100                                                         FeatureVFP3_D16,
1101                                                         FeatureFP16,
1102                                                         FeatureMP,
1103                                                         FeatureSlowFPBrcc,
1104                                                         FeatureHWDivARM,
1105                                                         FeatureHasSlowFPVMLx,
1106                                                         FeatureHasSlowFPVFMx,
1107                                                         FeatureAvoidPartialCPSR]>;
1108
1109def : ProcessorModel<"cortex-m3",   CortexM4Model,      [ARMv7m,
1110                                                         ProcM3,
1111                                                         FeaturePrefLoopAlign32,
1112                                                         FeatureUseMISched,
1113                                                         FeatureHasNoBranchPredictor]>;
1114
1115def : ProcessorModel<"sc300",       CortexM4Model,      [ARMv7m,
1116                                                         ProcM3,
1117                                                         FeatureUseMISched,
1118                                                         FeatureHasNoBranchPredictor]>;
1119
1120def : ProcessorModel<"cortex-m4", CortexM4Model,        [ARMv7em,
1121                                                         FeatureVFP4_D16_SP,
1122                                                         FeaturePrefLoopAlign32,
1123                                                         FeatureHasSlowFPVMLx,
1124                                                         FeatureHasSlowFPVFMx,
1125                                                         FeatureUseMISched,
1126                                                         FeatureHasNoBranchPredictor]>;
1127
1128def : ProcNoItin<"cortex-m7",                           [ARMv7em,
1129                                                         FeatureFPARMv8_D16]>;
1130
1131def : ProcNoItin<"cortex-m23",                          [ARMv8mBaseline,
1132                                                         FeatureNoMovt]>;
1133
1134def : ProcessorModel<"cortex-m33", CortexM4Model,       [ARMv8mMainline,
1135                                                         FeatureDSP,
1136                                                         FeatureFPARMv8_D16_SP,
1137                                                         FeaturePrefLoopAlign32,
1138                                                         FeatureHasSlowFPVMLx,
1139                                                         FeatureHasSlowFPVFMx,
1140                                                         FeatureUseMISched,
1141                                                         FeatureHasNoBranchPredictor]>;
1142
1143def : ProcessorModel<"cortex-m35p", CortexM4Model,      [ARMv8mMainline,
1144                                                         FeatureDSP,
1145                                                         FeatureFPARMv8_D16_SP,
1146                                                         FeaturePrefLoopAlign32,
1147                                                         FeatureHasSlowFPVMLx,
1148                                                         FeatureHasSlowFPVFMx,
1149                                                         FeatureUseMISched,
1150                                                         FeatureHasNoBranchPredictor]>;
1151
1152def : ProcessorModel<"cortex-m55", CortexM4Model,      [ARMv81mMainline,
1153                                                         FeatureDSP,
1154                                                         FeatureFPARMv8_D16,
1155                                                         FeatureUseMISched,
1156                                                         FeatureHasNoBranchPredictor,
1157                                                         FeaturePrefLoopAlign32,
1158                                                         FeatureHasSlowFPVMLx,
1159                                                         HasMVEFloatOps]>;
1160
1161def : ProcNoItin<"cortex-a32",                           [ARMv8a,
1162                                                         FeatureHWDivThumb,
1163                                                         FeatureHWDivARM,
1164                                                         FeatureCrypto,
1165                                                         FeatureCRC]>;
1166
1167def : ProcNoItin<"cortex-a35",                          [ARMv8a, ProcA35,
1168                                                         FeatureHWDivThumb,
1169                                                         FeatureHWDivARM,
1170                                                         FeatureCrypto,
1171                                                         FeatureCRC]>;
1172
1173def : ProcNoItin<"cortex-a53",                          [ARMv8a, ProcA53,
1174                                                         FeatureHWDivThumb,
1175                                                         FeatureHWDivARM,
1176                                                         FeatureCrypto,
1177                                                         FeatureCRC,
1178                                                         FeatureFPAO]>;
1179
1180def : ProcNoItin<"cortex-a55",                          [ARMv82a, ProcA55,
1181                                                         FeatureHWDivThumb,
1182                                                         FeatureHWDivARM,
1183                                                         FeatureDotProd]>;
1184
1185def : ProcessorModel<"cortex-a57",  CortexA57Model,     [ARMv8a, ProcA57,
1186                                                         FeatureHWDivThumb,
1187                                                         FeatureHWDivARM,
1188                                                         FeatureCrypto,
1189                                                         FeatureCRC,
1190                                                         FeatureFPAO,
1191                                                         FeatureAvoidPartialCPSR,
1192                                                         FeatureCheapPredicableCPSR]>;
1193
1194def : ProcessorModel<"cortex-a72",  CortexA57Model,     [ARMv8a, ProcA72,
1195                                                         FeatureHWDivThumb,
1196                                                         FeatureHWDivARM,
1197                                                         FeatureCrypto,
1198                                                         FeatureCRC]>;
1199
1200def : ProcNoItin<"cortex-a73",                          [ARMv8a, ProcA73,
1201                                                         FeatureHWDivThumb,
1202                                                         FeatureHWDivARM,
1203                                                         FeatureCrypto,
1204                                                         FeatureCRC]>;
1205
1206def : ProcNoItin<"cortex-a75",                          [ARMv82a, ProcA75,
1207                                                         FeatureHWDivThumb,
1208                                                         FeatureHWDivARM,
1209                                                         FeatureDotProd]>;
1210
1211def : ProcNoItin<"cortex-a76",                          [ARMv82a, ProcA76,
1212                                                         FeatureHWDivThumb,
1213                                                         FeatureHWDivARM,
1214                                                         FeatureCrypto,
1215                                                         FeatureCRC,
1216                                                         FeatureFullFP16,
1217                                                         FeatureDotProd]>;
1218
1219def : ProcNoItin<"cortex-a76ae",                        [ARMv82a, ProcA76,
1220                                                         FeatureHWDivThumb,
1221                                                         FeatureHWDivARM,
1222                                                         FeatureCrypto,
1223                                                         FeatureCRC,
1224                                                         FeatureFullFP16,
1225                                                         FeatureDotProd]>;
1226
1227def : ProcNoItin<"neoverse-n1",                         [ARMv82a,
1228                                                         FeatureHWDivThumb,
1229                                                         FeatureHWDivARM,
1230                                                         FeatureCrypto,
1231                                                         FeatureCRC,
1232                                                         FeatureDotProd]>;
1233
1234def : ProcessorModel<"cyclone",     SwiftModel,         [ARMv8a, ProcSwift,
1235                                                         FeatureHasRetAddrStack,
1236                                                         FeatureNEONForFP,
1237                                                         FeatureVFP4,
1238                                                         FeatureMP,
1239                                                         FeatureHWDivThumb,
1240                                                         FeatureHWDivARM,
1241                                                         FeatureAvoidPartialCPSR,
1242                                                         FeatureAvoidMOVsShOp,
1243                                                         FeatureHasSlowFPVMLx,
1244                                                         FeatureHasSlowFPVFMx,
1245                                                         FeatureCrypto,
1246                                                         FeatureUseMISched,
1247                                                         FeatureZCZeroing,
1248                                                         FeatureNoPostRASched]>;
1249
1250def : ProcNoItin<"exynos-m3",                           [ARMv8a, ProcExynos]>;
1251def : ProcNoItin<"exynos-m4",                           [ARMv82a, ProcExynos,
1252                                                         FeatureFullFP16,
1253                                                         FeatureDotProd]>;
1254def : ProcNoItin<"exynos-m5",                           [ARMv82a, ProcExynos,
1255                                                         FeatureFullFP16,
1256                                                         FeatureDotProd]>;
1257
1258def : ProcNoItin<"kryo",                                [ARMv8a, ProcKryo,
1259                                                         FeatureHWDivThumb,
1260                                                         FeatureHWDivARM,
1261                                                         FeatureCrypto,
1262                                                         FeatureCRC]>;
1263
1264def : ProcessorModel<"cortex-r52", CortexR52Model,      [ARMv8r, ProcR52,
1265                                                         FeatureUseMISched,
1266                                                         FeatureFPAO]>;
1267
1268//===----------------------------------------------------------------------===//
1269// Register File Description
1270//===----------------------------------------------------------------------===//
1271
1272include "ARMRegisterInfo.td"
1273include "ARMRegisterBanks.td"
1274include "ARMCallingConv.td"
1275
1276//===----------------------------------------------------------------------===//
1277// Instruction Descriptions
1278//===----------------------------------------------------------------------===//
1279
1280include "ARMInstrInfo.td"
1281def ARMInstrInfo : InstrInfo;
1282
1283//===----------------------------------------------------------------------===//
1284// Declare the target which we are implementing
1285//===----------------------------------------------------------------------===//
1286
1287def ARMAsmWriter : AsmWriter {
1288  string AsmWriterClassName  = "InstPrinter";
1289  int PassSubtarget = 1;
1290  int Variant = 0;
1291  bit isMCAsmWriter = 1;
1292}
1293
1294def ARMAsmParser : AsmParser {
1295  bit ReportMultipleNearMisses = 1;
1296}
1297
1298def ARMAsmParserVariant : AsmParserVariant {
1299  int Variant = 0;
1300  string Name = "ARM";
1301  string BreakCharacters = ".";
1302}
1303
1304def ARM : Target {
1305  // Pull in Instruction Info.
1306  let InstructionSet = ARMInstrInfo;
1307  let AssemblyWriters = [ARMAsmWriter];
1308  let AssemblyParsers = [ARMAsmParser];
1309  let AssemblyParserVariants = [ARMAsmParserVariant];
1310  let AllowRegisterRenaming = 1;
1311}
1312