xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARMPredicates.td (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
10b57cec5SDimitry Andric//===-- ARMPredicates.td - ARM Instruction Predicates ------*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric
90b57cec5SDimitry Andricdef HasV4T           : Predicate<"Subtarget->hasV4TOps()">,
105ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV4TOps), "armv4t">;
110b57cec5SDimitry Andricdef NoV4T            : Predicate<"!Subtarget->hasV4TOps()">;
120b57cec5SDimitry Andricdef HasV5T           : Predicate<"Subtarget->hasV5TOps()">,
135ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV5TOps), "armv5t">;
140b57cec5SDimitry Andricdef NoV5T            : Predicate<"!Subtarget->hasV5TOps()">;
150b57cec5SDimitry Andricdef HasV5TE          : Predicate<"Subtarget->hasV5TEOps()">,
165ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV5TEOps), "armv5te">;
170b57cec5SDimitry Andricdef HasV6            : Predicate<"Subtarget->hasV6Ops()">,
185ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV6Ops), "armv6">;
190b57cec5SDimitry Andricdef NoV6             : Predicate<"!Subtarget->hasV6Ops()">;
200b57cec5SDimitry Andricdef HasV6M           : Predicate<"Subtarget->hasV6MOps()">,
215ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV6MOps),
220b57cec5SDimitry Andric                                                    "armv6m or armv6t2">;
230b57cec5SDimitry Andricdef HasV8MBaseline   : Predicate<"Subtarget->hasV8MBaselineOps()">,
245ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8MBaselineOps),
250b57cec5SDimitry Andric                                                    "armv8m.base">;
260b57cec5SDimitry Andricdef HasV8MMainline   : Predicate<"Subtarget->hasV8MMainlineOps()">,
275ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8MMainlineOps),
280b57cec5SDimitry Andric                                                    "armv8m.main">;
290b57cec5SDimitry Andricdef HasV8_1MMainline : Predicate<"Subtarget->hasV8_1MMainlineOps()">,
305ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_1MMainlineOps),
310b57cec5SDimitry Andric                                                    "armv8.1m.main">;
320b57cec5SDimitry Andricdef HasMVEInt        : Predicate<"Subtarget->hasMVEIntegerOps()">,
335ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasMVEIntegerOps),
340b57cec5SDimitry Andric                                                    "mve">;
350b57cec5SDimitry Andricdef HasMVEFloat      : Predicate<"Subtarget->hasMVEFloatOps()">,
365ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasMVEFloatOps),
370b57cec5SDimitry Andric                                                    "mve.fp">;
385ffd83dbSDimitry Andricdef HasCDE           : Predicate<"Subtarget->hasCDEOps()">,
395ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasCDEOps),
405ffd83dbSDimitry Andric                                                    "cde">;
410b57cec5SDimitry Andricdef HasFPRegs        : Predicate<"Subtarget->hasFPRegs()">,
425ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFPRegs),
430b57cec5SDimitry Andric                                                    "fp registers">;
440b57cec5SDimitry Andricdef HasFPRegs16      : Predicate<"Subtarget->hasFPRegs16()">,
455ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFPRegs16),
465ffd83dbSDimitry Andric                                                    "16-bit fp registers">;
475ffd83dbSDimitry Andricdef HasNoFPRegs16    : Predicate<"!Subtarget->hasFPRegs16()">,
485ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of (not FeatureFPRegs16)),
490b57cec5SDimitry Andric                                                    "16-bit fp registers">;
500b57cec5SDimitry Andricdef HasFPRegs64      : Predicate<"Subtarget->hasFPRegs64()">,
515ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFPRegs64),
520b57cec5SDimitry Andric                                                    "64-bit fp registers">;
530b57cec5SDimitry Andricdef HasFPRegsV8_1M   : Predicate<"Subtarget->hasFPRegs() && Subtarget->hasV8_1MMainlineOps()">,
545ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFPRegs, HasV8_1MMainlineOps),
550b57cec5SDimitry Andric                                                    "armv8.1m.main with FP or MVE">;
560b57cec5SDimitry Andricdef HasV6T2          : Predicate<"Subtarget->hasV6T2Ops()">,
575ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV6T2Ops), "armv6t2">;
580b57cec5SDimitry Andricdef NoV6T2           : Predicate<"!Subtarget->hasV6T2Ops()">;
590b57cec5SDimitry Andricdef HasV6K           : Predicate<"Subtarget->hasV6KOps()">,
605ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV6KOps), "armv6k">;
610b57cec5SDimitry Andricdef NoV6K            : Predicate<"!Subtarget->hasV6KOps()">;
620b57cec5SDimitry Andricdef HasV7            : Predicate<"Subtarget->hasV7Ops()">,
635ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV7Ops), "armv7">;
640b57cec5SDimitry Andricdef HasV8            : Predicate<"Subtarget->hasV8Ops()">,
655ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8Ops), "armv8">;
660b57cec5SDimitry Andricdef PreV8            : Predicate<"!Subtarget->hasV8Ops()">,
675ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of (not HasV8Ops)), "armv7 or earlier">;
680b57cec5SDimitry Andricdef HasV8_1a         : Predicate<"Subtarget->hasV8_1aOps()">,
695ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_1aOps), "armv8.1a">;
700b57cec5SDimitry Andricdef HasV8_2a         : Predicate<"Subtarget->hasV8_2aOps()">,
715ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_2aOps), "armv8.2a">;
720b57cec5SDimitry Andricdef HasV8_3a         : Predicate<"Subtarget->hasV8_3aOps()">,
735ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_3aOps), "armv8.3a">;
740b57cec5SDimitry Andricdef HasV8_4a         : Predicate<"Subtarget->hasV8_4aOps()">,
755ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_4aOps), "armv8.4a">;
760b57cec5SDimitry Andricdef HasV8_5a         : Predicate<"Subtarget->hasV8_5aOps()">,
775ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_5aOps), "armv8.5a">;
785ffd83dbSDimitry Andricdef HasV8_6a         : Predicate<"Subtarget->hasV8_6aOps()">,
795ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of HasV8_6aOps), "armv8.6a">;
80*e8d8bef9SDimitry Andricdef HasV8_7a         : Predicate<"Subtarget->hasV8_7aOps()">,
81*e8d8bef9SDimitry Andric                                 AssemblerPredicate<(all_of HasV8_7aOps), "armv8.7a">;
820b57cec5SDimitry Andricdef NoVFP            : Predicate<"!Subtarget->hasVFP2Base()">;
830b57cec5SDimitry Andricdef HasVFP2          : Predicate<"Subtarget->hasVFP2Base()">,
845ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureVFP2_SP), "VFP2">;
850b57cec5SDimitry Andricdef HasVFP3          : Predicate<"Subtarget->hasVFP3Base()">,
865ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureVFP3_D16_SP), "VFP3">;
870b57cec5SDimitry Andricdef HasVFP4          : Predicate<"Subtarget->hasVFP4Base()">,
885ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureVFP4_D16_SP), "VFP4">;
890b57cec5SDimitry Andricdef HasDPVFP         : Predicate<"Subtarget->hasFP64()">,
905ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFP64),
910b57cec5SDimitry Andric                                                    "double precision VFP">;
920b57cec5SDimitry Andricdef HasFPARMv8       : Predicate<"Subtarget->hasFPARMv8Base()">,
935ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFPARMv8_D16_SP), "FPARMv8">;
940b57cec5SDimitry Andricdef HasNEON          : Predicate<"Subtarget->hasNEON()">,
955ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureNEON), "NEON">;
960b57cec5SDimitry Andricdef HasSHA2          : Predicate<"Subtarget->hasSHA2()">,
975ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureSHA2), "sha2">;
980b57cec5SDimitry Andricdef HasAES           : Predicate<"Subtarget->hasAES()">,
995ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureAES), "aes">;
1000b57cec5SDimitry Andricdef HasCrypto        : Predicate<"Subtarget->hasCrypto()">,
1015ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureCrypto), "crypto">;
1020b57cec5SDimitry Andricdef HasDotProd       : Predicate<"Subtarget->hasDotProd()">,
1035ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureDotProd), "dotprod">;
1040b57cec5SDimitry Andricdef HasCRC           : Predicate<"Subtarget->hasCRC()">,
1055ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureCRC), "crc">;
1060b57cec5SDimitry Andricdef HasRAS           : Predicate<"Subtarget->hasRAS()">,
1075ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureRAS), "ras">;
1080b57cec5SDimitry Andricdef HasLOB           : Predicate<"Subtarget->hasLOB()">,
1095ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureLOB), "lob">;
1100b57cec5SDimitry Andricdef HasFP16          : Predicate<"Subtarget->hasFP16()">,
1115ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFP16),"half-float conversions">;
1120b57cec5SDimitry Andricdef HasFullFP16      : Predicate<"Subtarget->hasFullFP16()">,
1135ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFullFP16),"full half-float">;
1140b57cec5SDimitry Andricdef HasFP16FML       : Predicate<"Subtarget->hasFP16FML()">,
1155ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureFP16FML),"full half-float fml">;
1165ffd83dbSDimitry Andricdef HasBF16          : Predicate<"Subtarget->hasBF16()">,
1175ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureBF16),"BFloat16 floating point extension">;
1185ffd83dbSDimitry Andricdef HasMatMulInt8    : Predicate<"Subtarget->hasMatMulInt8()">,
1195ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureMatMulInt8),"8-bit integer matrix multiply">;
1200b57cec5SDimitry Andricdef HasDivideInThumb : Predicate<"Subtarget->hasDivideInThumbMode()">,
1215ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureHWDivThumb), "divide in THUMB">;
1220b57cec5SDimitry Andricdef HasDivideInARM   : Predicate<"Subtarget->hasDivideInARMMode()">,
1235ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureHWDivARM), "divide in ARM">;
1240b57cec5SDimitry Andricdef HasDSP           : Predicate<"Subtarget->hasDSP()">,
1255ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureDSP), "dsp">;
1260b57cec5SDimitry Andricdef HasDB            : Predicate<"Subtarget->hasDataBarrier()">,
1275ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureDB),
1280b57cec5SDimitry Andric                                                    "data-barriers">;
1290b57cec5SDimitry Andricdef HasDFB           : Predicate<"Subtarget->hasFullDataBarrier()">,
1305ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureDFB),
1310b57cec5SDimitry Andric                                                    "full-data-barrier">;
1320b57cec5SDimitry Andricdef HasV7Clrex  : Predicate<"Subtarget->hasV7Clrex()">,
1335ffd83dbSDimitry Andric                            AssemblerPredicate<(all_of FeatureV7Clrex),
1340b57cec5SDimitry Andric                                               "v7 clrex">;
1350b57cec5SDimitry Andricdef HasAcquireRelease : Predicate<"Subtarget->hasAcquireRelease()">,
1365ffd83dbSDimitry Andric                                  AssemblerPredicate<(all_of FeatureAcquireRelease),
1370b57cec5SDimitry Andric                                                     "acquire/release">;
1380b57cec5SDimitry Andricdef HasMP            : Predicate<"Subtarget->hasMPExtension()">,
1395ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureMP),
1400b57cec5SDimitry Andric                                                    "mp-extensions">;
1410b57cec5SDimitry Andricdef HasVirtualization: Predicate<"false">,
1425ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureVirtualization),
1430b57cec5SDimitry Andric                                                   "virtualization-extensions">;
1440b57cec5SDimitry Andricdef HasTrustZone     : Predicate<"Subtarget->hasTrustZone()">,
1455ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureTrustZone),
1460b57cec5SDimitry Andric                                                    "TrustZone">;
1470b57cec5SDimitry Andricdef Has8MSecExt      : Predicate<"Subtarget->has8MSecExt()">,
1485ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of Feature8MSecExt),
1490b57cec5SDimitry Andric                                                    "ARMv8-M Security Extensions">;
1500b57cec5SDimitry Andricdef HasZCZ           : Predicate<"Subtarget->hasZeroCycleZeroing()">;
1510b57cec5SDimitry Andricdef UseNEONForFP     : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
1520b57cec5SDimitry Andricdef DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
1530b57cec5SDimitry Andricdef IsThumb          : Predicate<"Subtarget->isThumb()">,
1545ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of ModeThumb), "thumb">;
1550b57cec5SDimitry Andricdef IsThumb1Only     : Predicate<"Subtarget->isThumb1Only()">;
1560b57cec5SDimitry Andricdef IsThumb2         : Predicate<"Subtarget->isThumb2()">,
1575ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of ModeThumb, FeatureThumb2),
1580b57cec5SDimitry Andric                                                    "thumb2">;
1590b57cec5SDimitry Andricdef IsMClass         : Predicate<"Subtarget->isMClass()">,
1605ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureMClass), "armv*m">;
1610b57cec5SDimitry Andricdef IsNotMClass      : Predicate<"!Subtarget->isMClass()">,
1625ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of (not FeatureMClass)),
1630b57cec5SDimitry Andric                                                    "!armv*m">;
1640b57cec5SDimitry Andricdef IsARM            : Predicate<"!Subtarget->isThumb()">,
1655ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of (not ModeThumb)), "arm-mode">;
1660b57cec5SDimitry Andricdef IsMachO          : Predicate<"Subtarget->isTargetMachO()">;
1670b57cec5SDimitry Andricdef IsNotMachO       : Predicate<"!Subtarget->isTargetMachO()">;
1680b57cec5SDimitry Andricdef IsNaCl           : Predicate<"Subtarget->isTargetNaCl()">;
1690b57cec5SDimitry Andricdef IsWindows        : Predicate<"Subtarget->isTargetWindows()">;
1700b57cec5SDimitry Andricdef IsNotWindows     : Predicate<"!Subtarget->isTargetWindows()">;
1710b57cec5SDimitry Andricdef IsReadTPHard     : Predicate<"Subtarget->isReadTPHard()">;
1720b57cec5SDimitry Andricdef IsReadTPSoft     : Predicate<"!Subtarget->isReadTPHard()">;
1730b57cec5SDimitry Andricdef UseNaClTrap      : Predicate<"Subtarget->useNaClTrap()">,
1745ffd83dbSDimitry Andric                                 AssemblerPredicate<(all_of FeatureNaClTrap), "NaCl">;
1750b57cec5SDimitry Andricdef DontUseNaClTrap  : Predicate<"!Subtarget->useNaClTrap()">;
1760b57cec5SDimitry Andric
1770b57cec5SDimitry Andricdef UseNegativeImmediates :
1780b57cec5SDimitry Andric  Predicate<"false">,
1795ffd83dbSDimitry Andric            AssemblerPredicate<(all_of (not FeatureNoNegativeImmediates)),
1800b57cec5SDimitry Andric                               "NegativeImmediates">;
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andric// FIXME: Eventually this will be just "hasV6T2Ops".
1830b57cec5SDimitry Andriclet RecomputePerFunction = 1 in {
1840b57cec5SDimitry Andric  def UseMovt          : Predicate<"Subtarget->useMovt()">;
1850b57cec5SDimitry Andric  def DontUseMovt      : Predicate<"!Subtarget->useMovt()">;
1860b57cec5SDimitry Andric  def UseMovtInPic     : Predicate<"Subtarget->useMovt() && Subtarget->allowPositionIndependentMovt()">;
1870b57cec5SDimitry Andric  def DontUseMovtInPic : Predicate<"!Subtarget->useMovt() || !Subtarget->allowPositionIndependentMovt()">;
1880b57cec5SDimitry Andric
1890b57cec5SDimitry Andric  def UseFPVMLx: Predicate<"((Subtarget->useFPVMLx() &&"
1900b57cec5SDimitry Andric                           "  TM.Options.AllowFPOpFusion != FPOpFusion::Fast) ||"
1910b57cec5SDimitry Andric                           "Subtarget->hasMinSize())">;
192*e8d8bef9SDimitry Andric  def SLSBLRMitigation : Predicate<[{ MF->getSubtarget<ARMSubtarget>().hardenSlsBlr() }]>;
193*e8d8bef9SDimitry Andric  def NoSLSBLRMitigation : Predicate<[{ !MF->getSubtarget<ARMSubtarget>().hardenSlsBlr() }]>;
194*e8d8bef9SDimitry Andric
1950b57cec5SDimitry Andric}
1960b57cec5SDimitry Andricdef UseMulOps        : Predicate<"Subtarget->useMulOps()">;
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andric// Prefer fused MAC for fp mul + add over fp VMLA / VMLS if they are available.
1990b57cec5SDimitry Andric// But only select them if more precision in FP computation is allowed, and when
2000b57cec5SDimitry Andric// they are not slower than a mul + add sequence.
2010b57cec5SDimitry Andric// Do not use them for Darwin platforms.
202480093f4SDimitry Andricdef UseFusedMAC      : Predicate<"TM.Options.AllowFPOpFusion =="
2030b57cec5SDimitry Andric                                 "  FPOpFusion::Fast && "
204480093f4SDimitry Andric                                 "Subtarget->useFPVFMx()">;
2050b57cec5SDimitry Andric
2060b57cec5SDimitry Andricdef HasFastVGETLNi32 : Predicate<"!Subtarget->hasSlowVGETLNi32()">;
2070b57cec5SDimitry Andricdef HasSlowVGETLNi32 : Predicate<"Subtarget->hasSlowVGETLNi32()">;
2080b57cec5SDimitry Andric
2090b57cec5SDimitry Andricdef HasFastVDUP32 : Predicate<"!Subtarget->hasSlowVDUP32()">;
2100b57cec5SDimitry Andricdef HasSlowVDUP32 : Predicate<"Subtarget->hasSlowVDUP32()">;
2110b57cec5SDimitry Andric
2120b57cec5SDimitry Andricdef UseVMOVSR : Predicate<"Subtarget->preferVMOVSR() ||"
2130b57cec5SDimitry Andric                          "!Subtarget->useNEONForSinglePrecisionFP()">;
2140b57cec5SDimitry Andricdef DontUseVMOVSR : Predicate<"!Subtarget->preferVMOVSR() &&"
2150b57cec5SDimitry Andric                              "Subtarget->useNEONForSinglePrecisionFP()">;
2160b57cec5SDimitry Andric
2170b57cec5SDimitry Andriclet RecomputePerFunction = 1 in {
2180b57cec5SDimitry Andric  def IsLE             : Predicate<"MF->getDataLayout().isLittleEndian()">;
2190b57cec5SDimitry Andric  def IsBE             : Predicate<"MF->getDataLayout().isBigEndian()">;
2200b57cec5SDimitry Andric}
2210b57cec5SDimitry Andric
2220b57cec5SDimitry Andricdef GenExecuteOnly : Predicate<"Subtarget->genExecuteOnly()">;
2230b57cec5SDimitry Andric
2240b57cec5SDimitry Andric// Armv8.5-A extensions
2250b57cec5SDimitry Andricdef HasSB            : Predicate<"Subtarget->hasSB()">,
2265ffd83dbSDimitry Andric                       AssemblerPredicate<(all_of FeatureSB), "sb">;
227