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