xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARMPredicates.td (revision ec4deee4e4f2aef1b97d9424f25d04e91fd7dc10)
1//===-- ARMPredicates.td - ARM Instruction Predicates ------*- 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
9def HasV4T           : Predicate<"Subtarget->hasV4TOps()">,
10                                 AssemblerPredicate<"HasV4TOps", "armv4t">;
11def NoV4T            : Predicate<"!Subtarget->hasV4TOps()">;
12def HasV5T           : Predicate<"Subtarget->hasV5TOps()">,
13                                 AssemblerPredicate<"HasV5TOps", "armv5t">;
14def NoV5T            : Predicate<"!Subtarget->hasV5TOps()">;
15def HasV5TE          : Predicate<"Subtarget->hasV5TEOps()">,
16                                 AssemblerPredicate<"HasV5TEOps", "armv5te">;
17def HasV6            : Predicate<"Subtarget->hasV6Ops()">,
18                                 AssemblerPredicate<"HasV6Ops", "armv6">;
19def NoV6             : Predicate<"!Subtarget->hasV6Ops()">;
20def HasV6M           : Predicate<"Subtarget->hasV6MOps()">,
21                                 AssemblerPredicate<"HasV6MOps",
22                                                    "armv6m or armv6t2">;
23def HasV8MBaseline   : Predicate<"Subtarget->hasV8MBaselineOps()">,
24                                 AssemblerPredicate<"HasV8MBaselineOps",
25                                                    "armv8m.base">;
26def HasV8MMainline   : Predicate<"Subtarget->hasV8MMainlineOps()">,
27                                 AssemblerPredicate<"HasV8MMainlineOps",
28                                                    "armv8m.main">;
29def HasV8_1MMainline : Predicate<"Subtarget->hasV8_1MMainlineOps()">,
30                                 AssemblerPredicate<"HasV8_1MMainlineOps",
31                                                    "armv8.1m.main">;
32def HasMVEInt        : Predicate<"Subtarget->hasMVEIntegerOps()">,
33                                 AssemblerPredicate<"HasMVEIntegerOps",
34                                                    "mve">;
35def HasMVEFloat      : Predicate<"Subtarget->hasMVEFloatOps()">,
36                                 AssemblerPredicate<"HasMVEFloatOps",
37                                                    "mve.fp">;
38def HasFPRegs        : Predicate<"Subtarget->hasFPRegs()">,
39                                 AssemblerPredicate<"FeatureFPRegs",
40                                                    "fp registers">;
41def HasFPRegs16      : Predicate<"Subtarget->hasFPRegs16()">,
42                                 AssemblerPredicate<"FeatureFPRegs16",
43                                                    "16-bit fp registers">;
44def HasFPRegs64      : Predicate<"Subtarget->hasFPRegs64()">,
45                                 AssemblerPredicate<"FeatureFPRegs64",
46                                                    "64-bit fp registers">;
47def HasFPRegsV8_1M   : Predicate<"Subtarget->hasFPRegs() && Subtarget->hasV8_1MMainlineOps()">,
48                                 AssemblerPredicate<"FeatureFPRegs,HasV8_1MMainlineOps",
49                                                    "armv8.1m.main with FP or MVE">;
50def HasV6T2          : Predicate<"Subtarget->hasV6T2Ops()">,
51                                 AssemblerPredicate<"HasV6T2Ops", "armv6t2">;
52def NoV6T2           : Predicate<"!Subtarget->hasV6T2Ops()">;
53def HasV6K           : Predicate<"Subtarget->hasV6KOps()">,
54                                 AssemblerPredicate<"HasV6KOps", "armv6k">;
55def NoV6K            : Predicate<"!Subtarget->hasV6KOps()">;
56def HasV7            : Predicate<"Subtarget->hasV7Ops()">,
57                                 AssemblerPredicate<"HasV7Ops", "armv7">;
58def HasV8            : Predicate<"Subtarget->hasV8Ops()">,
59                                 AssemblerPredicate<"HasV8Ops", "armv8">;
60def PreV8            : Predicate<"!Subtarget->hasV8Ops()">,
61                                 AssemblerPredicate<"!HasV8Ops", "armv7 or earlier">;
62def HasV8_1a         : Predicate<"Subtarget->hasV8_1aOps()">,
63                                 AssemblerPredicate<"HasV8_1aOps", "armv8.1a">;
64def HasV8_2a         : Predicate<"Subtarget->hasV8_2aOps()">,
65                                 AssemblerPredicate<"HasV8_2aOps", "armv8.2a">;
66def HasV8_3a         : Predicate<"Subtarget->hasV8_3aOps()">,
67                                 AssemblerPredicate<"HasV8_3aOps", "armv8.3a">;
68def HasV8_4a         : Predicate<"Subtarget->hasV8_4aOps()">,
69                                 AssemblerPredicate<"HasV8_4aOps", "armv8.4a">;
70def HasV8_5a         : Predicate<"Subtarget->hasV8_5aOps()">,
71                                 AssemblerPredicate<"HasV8_5aOps", "armv8.5a">;
72def NoVFP            : Predicate<"!Subtarget->hasVFP2Base()">;
73def HasVFP2          : Predicate<"Subtarget->hasVFP2Base()">,
74                                 AssemblerPredicate<"FeatureVFP2_SP", "VFP2">;
75def HasVFP3          : Predicate<"Subtarget->hasVFP3Base()">,
76                                 AssemblerPredicate<"FeatureVFP3_D16_SP", "VFP3">;
77def HasVFP4          : Predicate<"Subtarget->hasVFP4Base()">,
78                                 AssemblerPredicate<"FeatureVFP4_D16_SP", "VFP4">;
79def HasDPVFP         : Predicate<"Subtarget->hasFP64()">,
80                                 AssemblerPredicate<"FeatureFP64",
81                                                    "double precision VFP">;
82def HasFPARMv8       : Predicate<"Subtarget->hasFPARMv8Base()">,
83                                 AssemblerPredicate<"FeatureFPARMv8_D16_SP", "FPARMv8">;
84def HasNEON          : Predicate<"Subtarget->hasNEON()">,
85                                 AssemblerPredicate<"FeatureNEON", "NEON">;
86def HasSHA2          : Predicate<"Subtarget->hasSHA2()">,
87                                 AssemblerPredicate<"FeatureSHA2", "sha2">;
88def HasAES           : Predicate<"Subtarget->hasAES()">,
89                                 AssemblerPredicate<"FeatureAES", "aes">;
90def HasCrypto        : Predicate<"Subtarget->hasCrypto()">,
91                                 AssemblerPredicate<"FeatureCrypto", "crypto">;
92def HasDotProd       : Predicate<"Subtarget->hasDotProd()">,
93                                 AssemblerPredicate<"FeatureDotProd", "dotprod">;
94def HasCRC           : Predicate<"Subtarget->hasCRC()">,
95                                 AssemblerPredicate<"FeatureCRC", "crc">;
96def HasRAS           : Predicate<"Subtarget->hasRAS()">,
97                                 AssemblerPredicate<"FeatureRAS", "ras">;
98def HasLOB           : Predicate<"Subtarget->hasLOB()">,
99                                 AssemblerPredicate<"FeatureLOB", "lob">;
100def HasFP16          : Predicate<"Subtarget->hasFP16()">,
101                                 AssemblerPredicate<"FeatureFP16","half-float conversions">;
102def HasFullFP16      : Predicate<"Subtarget->hasFullFP16()">,
103                                 AssemblerPredicate<"FeatureFullFP16","full half-float">;
104def HasFP16FML       : Predicate<"Subtarget->hasFP16FML()">,
105                                 AssemblerPredicate<"FeatureFP16FML","full half-float fml">;
106def HasDivideInThumb : Predicate<"Subtarget->hasDivideInThumbMode()">,
107                                 AssemblerPredicate<"FeatureHWDivThumb", "divide in THUMB">;
108def HasDivideInARM   : Predicate<"Subtarget->hasDivideInARMMode()">,
109                                 AssemblerPredicate<"FeatureHWDivARM", "divide in ARM">;
110def HasDSP           : Predicate<"Subtarget->hasDSP()">,
111                                 AssemblerPredicate<"FeatureDSP", "dsp">;
112def HasDB            : Predicate<"Subtarget->hasDataBarrier()">,
113                                 AssemblerPredicate<"FeatureDB",
114                                                    "data-barriers">;
115def HasDFB           : Predicate<"Subtarget->hasFullDataBarrier()">,
116                                 AssemblerPredicate<"FeatureDFB",
117                                                    "full-data-barrier">;
118def HasV7Clrex  : Predicate<"Subtarget->hasV7Clrex()">,
119                            AssemblerPredicate<"FeatureV7Clrex",
120                                               "v7 clrex">;
121def HasAcquireRelease : Predicate<"Subtarget->hasAcquireRelease()">,
122                                  AssemblerPredicate<"FeatureAcquireRelease",
123                                                     "acquire/release">;
124def HasMP            : Predicate<"Subtarget->hasMPExtension()">,
125                                 AssemblerPredicate<"FeatureMP",
126                                                    "mp-extensions">;
127def HasVirtualization: Predicate<"false">,
128                                 AssemblerPredicate<"FeatureVirtualization",
129                                                   "virtualization-extensions">;
130def HasTrustZone     : Predicate<"Subtarget->hasTrustZone()">,
131                                 AssemblerPredicate<"FeatureTrustZone",
132                                                    "TrustZone">;
133def Has8MSecExt      : Predicate<"Subtarget->has8MSecExt()">,
134                                 AssemblerPredicate<"Feature8MSecExt",
135                                                    "ARMv8-M Security Extensions">;
136def HasZCZ           : Predicate<"Subtarget->hasZeroCycleZeroing()">;
137def UseNEONForFP     : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
138def DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
139def IsThumb          : Predicate<"Subtarget->isThumb()">,
140                                 AssemblerPredicate<"ModeThumb", "thumb">;
141def IsThumb1Only     : Predicate<"Subtarget->isThumb1Only()">;
142def IsThumb2         : Predicate<"Subtarget->isThumb2()">,
143                                 AssemblerPredicate<"ModeThumb,FeatureThumb2",
144                                                    "thumb2">;
145def IsMClass         : Predicate<"Subtarget->isMClass()">,
146                                 AssemblerPredicate<"FeatureMClass", "armv*m">;
147def IsNotMClass      : Predicate<"!Subtarget->isMClass()">,
148                                 AssemblerPredicate<"!FeatureMClass",
149                                                    "!armv*m">;
150def IsARM            : Predicate<"!Subtarget->isThumb()">,
151                                 AssemblerPredicate<"!ModeThumb", "arm-mode">;
152def IsMachO          : Predicate<"Subtarget->isTargetMachO()">;
153def IsNotMachO       : Predicate<"!Subtarget->isTargetMachO()">;
154def IsNaCl           : Predicate<"Subtarget->isTargetNaCl()">;
155def IsWindows        : Predicate<"Subtarget->isTargetWindows()">;
156def IsNotWindows     : Predicate<"!Subtarget->isTargetWindows()">;
157def IsReadTPHard     : Predicate<"Subtarget->isReadTPHard()">;
158def IsReadTPSoft     : Predicate<"!Subtarget->isReadTPHard()">;
159def UseNaClTrap      : Predicate<"Subtarget->useNaClTrap()">,
160                                 AssemblerPredicate<"FeatureNaClTrap", "NaCl">;
161def DontUseNaClTrap  : Predicate<"!Subtarget->useNaClTrap()">;
162
163def UseNegativeImmediates :
164  Predicate<"false">,
165            AssemblerPredicate<"!FeatureNoNegativeImmediates",
166                               "NegativeImmediates">;
167
168// FIXME: Eventually this will be just "hasV6T2Ops".
169let RecomputePerFunction = 1 in {
170  def UseMovt          : Predicate<"Subtarget->useMovt()">;
171  def DontUseMovt      : Predicate<"!Subtarget->useMovt()">;
172  def UseMovtInPic     : Predicate<"Subtarget->useMovt() && Subtarget->allowPositionIndependentMovt()">;
173  def DontUseMovtInPic : Predicate<"!Subtarget->useMovt() || !Subtarget->allowPositionIndependentMovt()">;
174
175  def UseFPVMLx: Predicate<"((Subtarget->useFPVMLx() &&"
176                           "  TM.Options.AllowFPOpFusion != FPOpFusion::Fast) ||"
177                           "Subtarget->hasMinSize())">;
178}
179def UseMulOps        : Predicate<"Subtarget->useMulOps()">;
180
181// Prefer fused MAC for fp mul + add over fp VMLA / VMLS if they are available.
182// But only select them if more precision in FP computation is allowed, and when
183// they are not slower than a mul + add sequence.
184// Do not use them for Darwin platforms.
185def UseFusedMAC      : Predicate<"TM.Options.AllowFPOpFusion =="
186                                 "  FPOpFusion::Fast && "
187                                 "Subtarget->useFPVFMx()">;
188
189def HasFastVGETLNi32 : Predicate<"!Subtarget->hasSlowVGETLNi32()">;
190def HasSlowVGETLNi32 : Predicate<"Subtarget->hasSlowVGETLNi32()">;
191
192def HasFastVDUP32 : Predicate<"!Subtarget->hasSlowVDUP32()">;
193def HasSlowVDUP32 : Predicate<"Subtarget->hasSlowVDUP32()">;
194
195def UseVMOVSR : Predicate<"Subtarget->preferVMOVSR() ||"
196                          "!Subtarget->useNEONForSinglePrecisionFP()">;
197def DontUseVMOVSR : Predicate<"!Subtarget->preferVMOVSR() &&"
198                              "Subtarget->useNEONForSinglePrecisionFP()">;
199
200let RecomputePerFunction = 1 in {
201  def IsLE             : Predicate<"MF->getDataLayout().isLittleEndian()">;
202  def IsBE             : Predicate<"MF->getDataLayout().isBigEndian()">;
203}
204
205def GenExecuteOnly : Predicate<"Subtarget->genExecuteOnly()">;
206
207// Armv8.5-A extensions
208def HasSB            : Predicate<"Subtarget->hasSB()">,
209                       AssemblerPredicate<"FeatureSB", "sb">;
210