Add some testing for thumb1 and thumb2 inline asm immediate constraints
[oota-llvm.git] / lib / Target / ARM / ARM.td
1 //===-- ARM.td - Describe the ARM Target Machine -----------*- tablegen -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 //===----------------------------------------------------------------------===//
14 // Target-independent interfaces which we are implementing
15 //===----------------------------------------------------------------------===//
16
17 include "llvm/Target/Target.td"
18
19 //===----------------------------------------------------------------------===//
20 // ARM Helper classes.
21 //
22
23 class ProcNoItin<string Name, list<SubtargetFeature> Features>
24  : Processor<Name, NoItineraries, Features>;
25
26 class Architecture<string fname, string aname, list<SubtargetFeature> features >
27   : SubtargetFeature<fname, "ARMArch", aname,
28                      !strconcat(aname, " architecture"), features>;
29
30 //===----------------------------------------------------------------------===//
31 // ARM Subtarget state.
32 //
33
34 def ModeThumb  : SubtargetFeature<"thumb-mode", "InThumbMode", "true",
35                                   "Thumb mode">;
36
37 def ModeSoftFloat : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
38                                      "Use software floating point features.">;
39
40 //===----------------------------------------------------------------------===//
41 // ARM Subtarget features.
42 //
43
44 def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true",
45                                    "Enable VFP2 instructions">;
46 def FeatureVFP3 : SubtargetFeature<"vfp3", "HasVFPv3", "true",
47                                    "Enable VFP3 instructions",
48                                    [FeatureVFP2]>;
49 def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true",
50                                    "Enable NEON instructions",
51                                    [FeatureVFP3]>;
52 def FeatureThumb2 : SubtargetFeature<"thumb2", "HasThumb2", "true",
53                                      "Enable Thumb2 instructions">;
54 def FeatureNoARM  : SubtargetFeature<"noarm", "NoARM", "true",
55                                      "Does not support ARM mode execution",
56                                      [ModeThumb]>;
57 def FeatureFP16   : SubtargetFeature<"fp16", "HasFP16", "true",
58                                      "Enable half-precision floating point">;
59 def FeatureVFP4   : SubtargetFeature<"vfp4", "HasVFPv4", "true",
60                                      "Enable VFP4 instructions",
61                                      [FeatureVFP3, FeatureFP16]>;
62 def FeatureFPARMv8 : SubtargetFeature<"fp-armv8", "HasFPARMv8",
63                                    "true", "Enable ARMv8 FP",
64                                    [FeatureVFP4]>;
65 def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true",
66                                        "Enable full half-precision floating point",
67                                        [FeatureFPARMv8]>;
68 def FeatureD16    : SubtargetFeature<"d16", "HasD16", "true",
69                                      "Restrict FP to 16 double registers">;
70 def FeatureHWDiv  : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
71                                      "Enable divide instructions">;
72 def FeatureHWDivARM  : SubtargetFeature<"hwdiv-arm",
73                                         "HasHardwareDivideInARM", "true",
74                                       "Enable divide instructions in ARM mode">;
75 def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
76                                  "Enable Thumb2 extract and pack instructions">;
77 def FeatureDB     : SubtargetFeature<"db", "HasDataBarrier", "true",
78                                    "Has data barrier (dmb / dsb) instructions">;
79 def FeatureSlowFPBrcc : SubtargetFeature<"slow-fp-brcc", "SlowFPBrcc", "true",
80                                          "FP compare + branch is slow">;
81 def FeatureVFPOnlySP : SubtargetFeature<"fp-only-sp", "FPOnlySP", "true",
82                           "Floating point unit supports single precision only">;
83 def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
84                            "Enable support for Performance Monitor extensions">;
85 def FeatureTrustZone : SubtargetFeature<"trustzone", "HasTrustZone", "true",
86                           "Enable support for TrustZone security extensions">;
87 def FeatureCrypto : SubtargetFeature<"crypto", "HasCrypto", "true",
88                           "Enable support for Cryptography extensions",
89                           [FeatureNEON]>;
90 def FeatureCRC : SubtargetFeature<"crc", "HasCRC", "true",
91                           "Enable support for CRC instructions">;
92
93 // Cyclone has preferred instructions for zeroing VFP registers, which can
94 // execute in 0 cycles.
95 def FeatureZCZeroing : SubtargetFeature<"zcz", "HasZeroCycleZeroing", "true",
96                                         "Has zero-cycle zeroing instructions">;
97
98 // Some processors have FP multiply-accumulate instructions that don't
99 // play nicely with other VFP / NEON instructions, and it's generally better
100 // to just not use them.
101 def FeatureHasSlowFPVMLx : SubtargetFeature<"slowfpvmlx", "SlowFPVMLx", "true",
102                                          "Disable VFP / NEON MAC instructions">;
103
104 // Cortex-A8 / A9 Advanced SIMD has multiplier accumulator forwarding.
105 def FeatureVMLxForwarding : SubtargetFeature<"vmlx-forwarding",
106                                        "HasVMLxForwarding", "true",
107                                        "Has multiplier accumulator forwarding">;
108
109 // Some processors benefit from using NEON instructions for scalar
110 // single-precision FP operations.
111 def FeatureNEONForFP : SubtargetFeature<"neonfp", "UseNEONForSinglePrecisionFP",
112                                         "true",
113                                         "Use NEON for single precision FP">;
114
115 // Disable 32-bit to 16-bit narrowing for experimentation.
116 def FeaturePref32BitThumb : SubtargetFeature<"32bit", "Pref32BitThumb", "true",
117                                              "Prefer 32-bit Thumb instrs">;
118
119 /// Some instructions update CPSR partially, which can add false dependency for
120 /// out-of-order implementation, e.g. Cortex-A9, unless each individual bit is
121 /// mapped to a separate physical register. Avoid partial CPSR update for these
122 /// processors.
123 def FeatureAvoidPartialCPSR : SubtargetFeature<"avoid-partial-cpsr",
124                                                "AvoidCPSRPartialUpdate", "true",
125                                  "Avoid CPSR partial update for OOO execution">;
126
127 def FeatureAvoidMOVsShOp : SubtargetFeature<"avoid-movs-shop",
128                                             "AvoidMOVsShifterOperand", "true",
129                                 "Avoid movs instructions with shifter operand">;
130
131 // Some processors perform return stack prediction. CodeGen should avoid issue
132 // "normal" call instructions to callees which do not return.
133 def FeatureHasRAS : SubtargetFeature<"ras", "HasRAS", "true",
134                                      "Has return address stack">;
135
136 /// DSP extension.
137 def FeatureDSP : SubtargetFeature<"dsp", "HasDSP", "true",
138                               "Supports DSP instructions in ARM and/or Thumb2">;
139
140 // Multiprocessing extension.
141 def FeatureMP : SubtargetFeature<"mp", "HasMPExtension", "true",
142                                  "Supports Multiprocessing extension">;
143
144 // Virtualization extension - requires HW divide (ARMv7-AR ARMARM - 4.4.8).
145 def FeatureVirtualization : SubtargetFeature<"virtualization",
146                                  "HasVirtualization", "true",
147                                  "Supports Virtualization extension",
148                                  [FeatureHWDiv, FeatureHWDivARM]>;
149
150 // M-series ISA
151 def FeatureMClass : SubtargetFeature<"mclass", "ARMProcClass", "MClass",
152                                      "Is microcontroller profile ('M' series)">;
153
154 // R-series ISA
155 def FeatureRClass : SubtargetFeature<"rclass", "ARMProcClass", "RClass",
156                                      "Is realtime profile ('R' series)">;
157
158 // A-series ISA
159 def FeatureAClass : SubtargetFeature<"aclass", "ARMProcClass", "AClass",
160                                      "Is application profile ('A' series)">;
161
162 // Special TRAP encoding for NaCl, which looks like a TRAP in Thumb too.
163 // See ARMInstrInfo.td for details.
164 def FeatureNaClTrap : SubtargetFeature<"nacl-trap", "UseNaClTrap", "true",
165                                        "NaCl trap">;
166
167 def FeatureStrictAlign : SubtargetFeature<"strict-align",
168                                           "StrictAlign", "true",
169                                           "Disallow all unaligned memory "
170                                           "access">;
171
172 def FeatureLongCalls : SubtargetFeature<"long-calls", "GenLongCalls", "true",
173                                         "Generate calls via indirect call "
174                                         "instructions">;
175
176 def FeatureReserveR9 : SubtargetFeature<"reserve-r9", "ReserveR9", "true",
177                                         "Reserve R9, making it unavailable as "
178                                         "GPR">;
179
180 def FeatureNoMovt : SubtargetFeature<"no-movt", "NoMovt", "true",
181                                      "Don't use movt/movw pairs for 32-bit "
182                                      "imms">;
183
184
185 //===----------------------------------------------------------------------===//
186 // ARM ISAa.
187 //
188
189 def HasV4TOps   : SubtargetFeature<"v4t", "HasV4TOps", "true",
190                                    "Support ARM v4T instructions">;
191 def HasV5TOps   : SubtargetFeature<"v5t", "HasV5TOps", "true",
192                                    "Support ARM v5T instructions",
193                                    [HasV4TOps]>;
194 def HasV5TEOps  : SubtargetFeature<"v5te", "HasV5TEOps", "true",
195                              "Support ARM v5TE, v5TEj, and v5TExp instructions",
196                                    [HasV5TOps]>;
197 def HasV6Ops    : SubtargetFeature<"v6", "HasV6Ops", "true",
198                                    "Support ARM v6 instructions",
199                                    [HasV5TEOps]>;
200 def HasV6MOps   : SubtargetFeature<"v6m", "HasV6MOps", "true",
201                                    "Support ARM v6M instructions",
202                                    [HasV6Ops]>;
203 def HasV6KOps   : SubtargetFeature<"v6k", "HasV6KOps", "true",
204                                    "Support ARM v6k instructions",
205                                    [HasV6Ops]>;
206 def HasV6T2Ops  : SubtargetFeature<"v6t2", "HasV6T2Ops", "true",
207                                    "Support ARM v6t2 instructions",
208                                    [HasV6MOps, HasV6KOps, FeatureThumb2]>;
209 def HasV7Ops    : SubtargetFeature<"v7", "HasV7Ops", "true",
210                                    "Support ARM v7 instructions",
211                                    [HasV6T2Ops, FeaturePerfMon]>;
212 def HasV8Ops    : SubtargetFeature<"v8", "HasV8Ops", "true",
213                                    "Support ARM v8 instructions",
214                                    [HasV7Ops]>;
215 def HasV8_1aOps : SubtargetFeature<"v8.1a", "HasV8_1aOps", "true",
216                                    "Support ARM v8.1a instructions",
217                                    [HasV8Ops]>;
218 def HasV8_2aOps   : SubtargetFeature<"v8.2a", "HasV8_2aOps", "true",
219                                    "Support ARM v8.2a instructions",
220                                    [HasV8_1aOps]>;
221
222
223 //===----------------------------------------------------------------------===//
224 // ARM Processor subtarget features.
225 //
226
227 def ProcA5      : SubtargetFeature<"a5", "ARMProcFamily", "CortexA5",
228                                    "Cortex-A5 ARM processors", []>;
229 def ProcA7      : SubtargetFeature<"a7", "ARMProcFamily", "CortexA7",
230                                    "Cortex-A7 ARM processors", []>;
231 def ProcA8      : SubtargetFeature<"a8", "ARMProcFamily", "CortexA8",
232                                    "Cortex-A8 ARM processors", []>;
233 def ProcA9      : SubtargetFeature<"a9", "ARMProcFamily", "CortexA9",
234                                    "Cortex-A9 ARM processors", []>;
235 def ProcA12     : SubtargetFeature<"a12", "ARMProcFamily", "CortexA12",
236                                    "Cortex-A12 ARM processors", []>;
237 def ProcA15     : SubtargetFeature<"a15", "ARMProcFamily", "CortexA15",
238                                    "Cortex-A15 ARM processors", []>;
239 def ProcA17     : SubtargetFeature<"a17", "ARMProcFamily", "CortexA17",
240                                    "Cortex-A17 ARM processors", []>;
241 def ProcA35     : SubtargetFeature<"a35", "ARMProcFamily", "CortexA35",
242                                    "Cortex-A35 ARM processors", []>;
243 def ProcA53     : SubtargetFeature<"a53", "ARMProcFamily", "CortexA53",
244                                    "Cortex-A53 ARM processors", []>;
245 def ProcA57     : SubtargetFeature<"a57", "ARMProcFamily", "CortexA57",
246                                    "Cortex-A57 ARM processors", []>;
247 def ProcA72     : SubtargetFeature<"a72", "ARMProcFamily", "CortexA72",
248                                    "Cortex-A72 ARM processors", []>;
249
250 def ProcKrait   : SubtargetFeature<"krait", "ARMProcFamily", "Krait",
251                                    "Qualcomm ARM processors", []>;
252 def ProcSwift   : SubtargetFeature<"swift", "ARMProcFamily", "Swift",
253                                    "Swift ARM processors", []>;
254
255 def ProcExynosM1 : SubtargetFeature<"exynosm1", "ARMProcFamily", "ExynosM1",
256                                     "Samsung Exynos-M1 processors", []>;
257
258 def ProcR4      : SubtargetFeature<"r4", "ARMProcFamily", "CortexR4",
259                                     "Cortex-R4 ARM processors", []>;
260 def ProcR5      : SubtargetFeature<"r5", "ARMProcFamily", "CortexR5",
261                                    "Cortex-R5 ARM processors", []>;
262 def ProcR7      : SubtargetFeature<"r7", "ARMProcFamily", "CortexR7",
263                                    "Cortex-R7 ARM processors", []>;
264
265
266 //===----------------------------------------------------------------------===//
267 // ARM schedules.
268 //
269
270 include "ARMSchedule.td"
271
272
273 //===----------------------------------------------------------------------===//
274 // ARM architectures
275 //
276
277 def ARMv2     : Architecture<"armv2",     "ARMv2",    []>;
278
279 def ARMv2a    : Architecture<"armv2a",    "ARMv2a",   []>;
280
281 def ARMv3     : Architecture<"armv3",     "ARMv3",    []>;
282
283 def ARMv3m    : Architecture<"armv3m",    "ARMv3m",   []>;
284
285 def ARMv4     : Architecture<"armv4",     "ARMv4",    []>;
286
287 def ARMv4t    : Architecture<"armv4t",    "ARMv4t",   [HasV4TOps]>;
288
289 def ARMv5t    : Architecture<"armv5t",    "ARMv5t",   [HasV5TOps]>;
290
291 def ARMv5te   : Architecture<"armv5te",   "ARMv5te",  [HasV5TEOps]>;
292
293 def ARMv5tej  : Architecture<"armv5tej",  "ARMv5tej", [HasV5TEOps]>;
294
295 def ARMv6     : Architecture<"armv6",     "ARMv6",    [HasV6Ops]>;
296
297 def ARMv6t2   : Architecture<"armv6t2",   "ARMv6t2",  [HasV6T2Ops,
298                                                        FeatureDSP]>;
299
300 def ARMv6k    : Architecture<"armv6k",    "ARMv6k",   [HasV6KOps]>;
301
302 def ARMv6kz   : Architecture<"armv6kz",   "ARMv6kz",  [HasV6KOps,
303                                                        FeatureTrustZone]>;
304
305 def ARMv6m    : Architecture<"armv6-m",   "ARMv6m",   [HasV6MOps,
306                                                        FeatureNoARM,
307                                                        FeatureDB,
308                                                        FeatureMClass]>;
309
310 def ARMv6sm   : Architecture<"armv6s-m",  "ARMv6sm",  [HasV6MOps,
311                                                        FeatureNoARM,
312                                                        FeatureDB,
313                                                        FeatureMClass]>;
314
315 def ARMv7a    : Architecture<"armv7-a",   "ARMv7a",   [HasV7Ops,
316                                                        FeatureNEON,
317                                                        FeatureDB,
318                                                        FeatureDSP,
319                                                        FeatureAClass]>;
320
321 def ARMv7r    : Architecture<"armv7-r",   "ARMv7r",   [HasV7Ops,
322                                                        FeatureDB,
323                                                        FeatureDSP,
324                                                        FeatureHWDiv,
325                                                        FeatureRClass]>;
326
327 def ARMv7m    : Architecture<"armv7-m",   "ARMv7m",   [HasV7Ops,
328                                                        FeatureThumb2,
329                                                        FeatureNoARM,
330                                                        FeatureDB,
331                                                        FeatureHWDiv,
332                                                        FeatureMClass]>;
333
334 def ARMv7em   : Architecture<"armv7e-m",  "ARMv7em",  [HasV7Ops,
335                                                        FeatureThumb2,
336                                                        FeatureNoARM,
337                                                        FeatureDB,
338                                                        FeatureHWDiv,
339                                                        FeatureMClass,
340                                                        FeatureDSP,
341                                                        FeatureT2XtPk]>;
342
343 def ARMv8a    : Architecture<"armv8-a",   "ARMv8a",   [HasV8Ops,
344                                                        FeatureAClass,
345                                                        FeatureDB,
346                                                        FeatureFPARMv8,
347                                                        FeatureNEON,
348                                                        FeatureDSP,
349                                                        FeatureTrustZone,
350                                                        FeatureMP,
351                                                        FeatureVirtualization,
352                                                        FeatureCrypto,
353                                                        FeatureCRC]>;
354
355 def ARMv81a   : Architecture<"armv8.1-a", "ARMv81a",  [HasV8_1aOps,
356                                                        FeatureAClass,
357                                                        FeatureDB,
358                                                        FeatureFPARMv8,
359                                                        FeatureNEON,
360                                                        FeatureDSP,
361                                                        FeatureTrustZone,
362                                                        FeatureMP,
363                                                        FeatureVirtualization,
364                                                        FeatureCrypto,
365                                                        FeatureCRC]>;
366
367 def ARMv82a   : Architecture<"armv8.2-a", "ARMv82a",  [HasV8_2aOps,
368                                                        FeatureAClass,
369                                                        FeatureDB,
370                                                        FeatureFPARMv8,
371                                                        FeatureNEON,
372                                                        FeatureDSP,
373                                                        FeatureTrustZone,
374                                                        FeatureMP,
375                                                        FeatureVirtualization,
376                                                        FeatureCrypto,
377                                                        FeatureCRC]>;
378
379 // Aliases
380 def IWMMXT   : Architecture<"iwmmxt",      "ARMv5te",  [ARMv5te]>;
381 def IWMMXT2  : Architecture<"iwmmxt2",     "ARMv5te",  [ARMv5te]>;
382 def XScale   : Architecture<"xscale",      "ARMv5te",  [ARMv5te]>;
383 def ARMv6j   : Architecture<"armv6j",      "ARMv7a",   [ARMv6]>;
384 def ARMv7k   : Architecture<"armv7k",      "ARMv7a",   [ARMv7a]>;
385 def ARMv7s   : Architecture<"armv7s",      "ARMv7a",   [ARMv7a]>;
386
387
388 //===----------------------------------------------------------------------===//
389 // ARM processors
390 //
391
392 // Dummy CPU, used to target architectures
393 def : ProcNoItin<"generic",                             []>;
394
395 def : ProcNoItin<"arm8",                                [ARMv4]>;
396 def : ProcNoItin<"arm810",                              [ARMv4]>;
397 def : ProcNoItin<"strongarm",                           [ARMv4]>;
398 def : ProcNoItin<"strongarm110",                        [ARMv4]>;
399 def : ProcNoItin<"strongarm1100",                       [ARMv4]>;
400 def : ProcNoItin<"strongarm1110",                       [ARMv4]>;
401
402 def : ProcNoItin<"arm7tdmi",                            [ARMv4t]>;
403 def : ProcNoItin<"arm7tdmi-s",                          [ARMv4t]>;
404 def : ProcNoItin<"arm710t",                             [ARMv4t]>;
405 def : ProcNoItin<"arm720t",                             [ARMv4t]>;
406 def : ProcNoItin<"arm9",                                [ARMv4t]>;
407 def : ProcNoItin<"arm9tdmi",                            [ARMv4t]>;
408 def : ProcNoItin<"arm920",                              [ARMv4t]>;
409 def : ProcNoItin<"arm920t",                             [ARMv4t]>;
410 def : ProcNoItin<"arm922t",                             [ARMv4t]>;
411 def : ProcNoItin<"arm940t",                             [ARMv4t]>;
412 def : ProcNoItin<"ep9312",                              [ARMv4t]>;
413
414 def : ProcNoItin<"arm10tdmi",                           [ARMv5t]>;
415 def : ProcNoItin<"arm1020t",                            [ARMv5t]>;
416
417 def : ProcNoItin<"arm9e",                               [ARMv5te]>;
418 def : ProcNoItin<"arm926ej-s",                          [ARMv5te]>;
419 def : ProcNoItin<"arm946e-s",                           [ARMv5te]>;
420 def : ProcNoItin<"arm966e-s",                           [ARMv5te]>;
421 def : ProcNoItin<"arm968e-s",                           [ARMv5te]>;
422 def : ProcNoItin<"arm10e",                              [ARMv5te]>;
423 def : ProcNoItin<"arm1020e",                            [ARMv5te]>;
424 def : ProcNoItin<"arm1022e",                            [ARMv5te]>;
425 def : ProcNoItin<"xscale",                              [ARMv5te]>;
426 def : ProcNoItin<"iwmmxt",                              [ARMv5te]>;
427
428 def : Processor<"arm1136j-s",       ARMV6Itineraries,   [ARMv6]>;
429 def : Processor<"arm1136jf-s",      ARMV6Itineraries,   [ARMv6,
430                                                          FeatureVFP2,
431                                                          FeatureHasSlowFPVMLx]>;
432
433 def : Processor<"cortex-m0",        ARMV6Itineraries,   [ARMv6m]>;
434 def : Processor<"cortex-m0plus",    ARMV6Itineraries,   [ARMv6m]>;
435 def : Processor<"cortex-m1",        ARMV6Itineraries,   [ARMv6m]>;
436 def : Processor<"sc000",            ARMV6Itineraries,   [ARMv6m]>;
437
438 def : Processor<"arm1176jz-s",      ARMV6Itineraries,   [ARMv6kz]>;
439 def : Processor<"arm1176jzf-s",     ARMV6Itineraries,   [ARMv6kz,
440                                                          FeatureVFP2,
441                                                          FeatureHasSlowFPVMLx]>;
442
443 def : Processor<"mpcorenovfp",      ARMV6Itineraries,   [ARMv6k]>;
444 def : Processor<"mpcore",           ARMV6Itineraries,   [ARMv6k,
445                                                          FeatureVFP2,
446                                                          FeatureHasSlowFPVMLx]>;
447
448 def : Processor<"arm1156t2-s",      ARMV6Itineraries,   [ARMv6t2]>;
449 def : Processor<"arm1156t2f-s",     ARMV6Itineraries,   [ARMv6t2,
450                                                          FeatureVFP2,
451                                                          FeatureHasSlowFPVMLx]>;
452
453 // FIXME: A5 has currently the same Schedule model as A8
454 def : ProcessorModel<"cortex-a5",   CortexA8Model,      [ARMv7a, ProcA5,
455                                                          FeatureHasRAS,
456                                                          FeatureTrustZone,
457                                                          FeatureSlowFPBrcc,
458                                                          FeatureHasSlowFPVMLx,
459                                                          FeatureVMLxForwarding,
460                                                          FeatureT2XtPk,
461                                                          FeatureMP,
462                                                          FeatureVFP4]>;
463
464 def : ProcessorModel<"cortex-a7",   CortexA8Model,      [ARMv7a, ProcA7,
465                                                          FeatureHasRAS,
466                                                          FeatureTrustZone,
467                                                          FeatureSlowFPBrcc,
468                                                          FeatureHasSlowFPVMLx,
469                                                          FeatureVMLxForwarding,
470                                                          FeatureT2XtPk,
471                                                          FeatureMP,
472                                                          FeatureVFP4,
473                                                          FeatureHWDiv,
474                                                          FeatureHWDivARM,
475                                                          FeatureVirtualization]>;
476
477 def : ProcessorModel<"cortex-a8",   CortexA8Model,      [ARMv7a, ProcA8,
478                                                          FeatureHasRAS,
479                                                          FeatureTrustZone,
480                                                          FeatureSlowFPBrcc,
481                                                          FeatureHasSlowFPVMLx,
482                                                          FeatureVMLxForwarding,
483                                                          FeatureT2XtPk]>;
484
485 def : ProcessorModel<"cortex-a9",   CortexA9Model,      [ARMv7a, ProcA9,
486                                                          FeatureHasRAS,
487                                                          FeatureTrustZone,
488                                                          FeatureVMLxForwarding,
489                                                          FeatureT2XtPk,
490                                                          FeatureFP16,
491                                                          FeatureAvoidPartialCPSR,
492                                                          FeatureMP]>;
493
494 // FIXME: A12 has currently the same Schedule model as A9
495 def : ProcessorModel<"cortex-a12",  CortexA9Model,      [ARMv7a, ProcA12,
496                                                          FeatureHasRAS,
497                                                          FeatureTrustZone,
498                                                          FeatureVMLxForwarding,
499                                                          FeatureT2XtPk,
500                                                          FeatureVFP4,
501                                                          FeatureHWDiv,
502                                                          FeatureHWDivARM,
503                                                          FeatureAvoidPartialCPSR,
504                                                          FeatureVirtualization,
505                                                          FeatureMP]>;
506
507 // FIXME: A15 has currently the same Schedule model as A9.
508 def : ProcessorModel<"cortex-a15",  CortexA9Model,      [ARMv7a, ProcA15,
509                                                          FeatureHasRAS,
510                                                          FeatureTrustZone,
511                                                          FeatureT2XtPk,
512                                                          FeatureVFP4,
513                                                          FeatureMP,
514                                                          FeatureHWDiv,
515                                                          FeatureHWDivARM,
516                                                          FeatureAvoidPartialCPSR,
517                                                          FeatureVirtualization]>;
518
519 // FIXME: A17 has currently the same Schedule model as A9
520 def : ProcessorModel<"cortex-a17",  CortexA9Model,      [ARMv7a, ProcA17,
521                                                          FeatureHasRAS,
522                                                          FeatureTrustZone,
523                                                          FeatureMP,
524                                                          FeatureVMLxForwarding,
525                                                          FeatureT2XtPk,
526                                                          FeatureVFP4,
527                                                          FeatureHWDiv,
528                                                          FeatureHWDivARM,
529                                                          FeatureAvoidPartialCPSR,
530                                                          FeatureVirtualization]>;
531
532 // FIXME: krait has currently the same Schedule model as A9
533 // FIXME: krait has currently the same features as A9 plus VFP4 and hardware
534 //        division features.
535 def : ProcessorModel<"krait",       CortexA9Model,      [ARMv7a, ProcKrait,
536                                                          FeatureHasRAS,
537                                                          FeatureVMLxForwarding,
538                                                          FeatureT2XtPk,
539                                                          FeatureFP16,
540                                                          FeatureAvoidPartialCPSR,
541                                                          FeatureVFP4,
542                                                          FeatureHWDiv,
543                                                          FeatureHWDivARM]>;
544
545 def : ProcessorModel<"swift",       SwiftModel,         [ARMv7a, ProcSwift,
546                                                          FeatureHasRAS,
547                                                          FeatureNEONForFP,
548                                                          FeatureT2XtPk,
549                                                          FeatureVFP4,
550                                                          FeatureMP,
551                                                          FeatureHWDiv,
552                                                          FeatureHWDivARM,
553                                                          FeatureAvoidPartialCPSR,
554                                                          FeatureAvoidMOVsShOp,
555                                                          FeatureHasSlowFPVMLx]>;
556
557 // FIXME: R4 has currently the same ProcessorModel as A8.
558 def : ProcessorModel<"cortex-r4",   CortexA8Model,      [ARMv7r, ProcR4,
559                                                          FeatureHasRAS,
560                                                          FeatureAvoidPartialCPSR,
561                                                          FeatureT2XtPk]>;
562
563 // FIXME: R4F has currently the same ProcessorModel as A8.
564 def : ProcessorModel<"cortex-r4f",  CortexA8Model,      [ARMv7r, ProcR4,
565                                                          FeatureHasRAS,
566                                                          FeatureSlowFPBrcc,
567                                                          FeatureHasSlowFPVMLx,
568                                                          FeatureVFP3,
569                                                          FeatureD16,
570                                                          FeatureAvoidPartialCPSR,
571                                                          FeatureT2XtPk]>;
572
573 // FIXME: R5 has currently the same ProcessorModel as A8.
574 def : ProcessorModel<"cortex-r5",   CortexA8Model,      [ARMv7r, ProcR5,
575                                                          FeatureHasRAS,
576                                                          FeatureVFP3,
577                                                          FeatureD16,
578                                                          FeatureSlowFPBrcc,
579                                                          FeatureHWDivARM,
580                                                          FeatureHasSlowFPVMLx,
581                                                          FeatureAvoidPartialCPSR,
582                                                          FeatureT2XtPk]>;
583
584 // FIXME: R7 has currently the same ProcessorModel as A8 and is modelled as R5.
585 def : ProcessorModel<"cortex-r7",   CortexA8Model,      [ARMv7r, ProcR7,
586                                                          FeatureHasRAS,
587                                                          FeatureVFP3,
588                                                          FeatureVFPOnlySP,
589                                                          FeatureD16,
590                                                          FeatureFP16,
591                                                          FeatureMP,
592                                                          FeatureSlowFPBrcc,
593                                                          FeatureHWDivARM,
594                                                          FeatureHasSlowFPVMLx,
595                                                          FeatureAvoidPartialCPSR,
596                                                          FeatureT2XtPk]>;
597
598 def : ProcNoItin<"cortex-m3",                           [ARMv7m]>;
599 def : ProcNoItin<"sc300",                               [ARMv7m]>;
600
601 def : ProcNoItin<"cortex-m4",                           [ARMv7em,
602                                                          FeatureVFP4,
603                                                          FeatureVFPOnlySP,
604                                                          FeatureD16]>;
605
606 def : ProcNoItin<"cortex-m7",                           [ARMv7em,
607                                                          FeatureFPARMv8,
608                                                          FeatureD16]>;
609
610
611 def : ProcNoItin<"cortex-a35",                          [ARMv8a, ProcA35,
612                                                          FeatureHWDiv,
613                                                          FeatureHWDivARM,
614                                                          FeatureT2XtPk,
615                                                          FeatureCrypto,
616                                                          FeatureCRC]>;
617
618 def : ProcNoItin<"cortex-a53",                          [ARMv8a, ProcA53,
619                                                          FeatureHWDiv,
620                                                          FeatureHWDivARM,
621                                                          FeatureT2XtPk,
622                                                          FeatureCrypto,
623                                                          FeatureCRC]>;
624
625 def : ProcNoItin<"cortex-a57",                          [ARMv8a, ProcA57,
626                                                          FeatureHWDiv,
627                                                          FeatureHWDivARM,
628                                                          FeatureT2XtPk,
629                                                          FeatureCrypto,
630                                                          FeatureCRC]>;
631
632 def : ProcNoItin<"cortex-a72",                          [ARMv8a, ProcA72,
633                                                          FeatureHWDiv,
634                                                          FeatureHWDivARM,
635                                                          FeatureT2XtPk,
636                                                          FeatureCrypto,
637                                                          FeatureCRC]>;
638
639 // Cyclone is very similar to swift
640 def : ProcessorModel<"cyclone",     SwiftModel,         [ARMv8a, ProcSwift,
641                                                          FeatureHasRAS,
642                                                          FeatureNEONForFP,
643                                                          FeatureT2XtPk,
644                                                          FeatureVFP4,
645                                                          FeatureMP,
646                                                          FeatureHWDiv,
647                                                          FeatureHWDivARM,
648                                                          FeatureAvoidPartialCPSR,
649                                                          FeatureAvoidMOVsShOp,
650                                                          FeatureHasSlowFPVMLx,
651                                                          FeatureCrypto,
652                                                          FeatureZCZeroing]>;
653
654 def : ProcNoItin<"exynos-m1",                           [ARMv8a, ProcExynosM1,
655                                                          FeatureHWDiv,
656                                                          FeatureHWDivARM,
657                                                          FeatureT2XtPk,
658                                                          FeatureCrypto,
659                                                          FeatureCRC]>;
660
661 //===----------------------------------------------------------------------===//
662 // Register File Description
663 //===----------------------------------------------------------------------===//
664
665 include "ARMRegisterInfo.td"
666
667 include "ARMCallingConv.td"
668
669 //===----------------------------------------------------------------------===//
670 // Instruction Descriptions
671 //===----------------------------------------------------------------------===//
672
673 include "ARMInstrInfo.td"
674
675 def ARMInstrInfo : InstrInfo;
676
677 //===----------------------------------------------------------------------===//
678 // Declare the target which we are implementing
679 //===----------------------------------------------------------------------===//
680
681 def ARMAsmWriter : AsmWriter {
682   string AsmWriterClassName  = "InstPrinter";
683   int PassSubtarget = 1;
684   int Variant = 0;
685   bit isMCAsmWriter = 1;
686 }
687
688 def ARMAsmParserVariant : AsmParserVariant {
689   int Variant = 0;
690   string Name = "ARM";
691   string BreakCharacters = ".";
692 }
693
694 def ARM : Target {
695   // Pull in Instruction Info:
696   let InstructionSet = ARMInstrInfo;
697   let AssemblyWriters = [ARMAsmWriter];
698   let AssemblyParserVariants = [ARMAsmParserVariant];
699 }