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