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