xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARMPredicates.td (revision 480093f4440d54b30b3025afeac24b48f2ba7a2e)
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()">,
100b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV4TOps", "armv4t">;
110b57cec5SDimitry Andricdef NoV4T            : Predicate<"!Subtarget->hasV4TOps()">;
120b57cec5SDimitry Andricdef HasV5T           : Predicate<"Subtarget->hasV5TOps()">,
130b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV5TOps", "armv5t">;
140b57cec5SDimitry Andricdef NoV5T            : Predicate<"!Subtarget->hasV5TOps()">;
150b57cec5SDimitry Andricdef HasV5TE          : Predicate<"Subtarget->hasV5TEOps()">,
160b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV5TEOps", "armv5te">;
170b57cec5SDimitry Andricdef HasV6            : Predicate<"Subtarget->hasV6Ops()">,
180b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV6Ops", "armv6">;
190b57cec5SDimitry Andricdef NoV6             : Predicate<"!Subtarget->hasV6Ops()">;
200b57cec5SDimitry Andricdef HasV6M           : Predicate<"Subtarget->hasV6MOps()">,
210b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV6MOps",
220b57cec5SDimitry Andric                                                    "armv6m or armv6t2">;
230b57cec5SDimitry Andricdef HasV8MBaseline   : Predicate<"Subtarget->hasV8MBaselineOps()">,
240b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8MBaselineOps",
250b57cec5SDimitry Andric                                                    "armv8m.base">;
260b57cec5SDimitry Andricdef HasV8MMainline   : Predicate<"Subtarget->hasV8MMainlineOps()">,
270b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8MMainlineOps",
280b57cec5SDimitry Andric                                                    "armv8m.main">;
290b57cec5SDimitry Andricdef HasV8_1MMainline : Predicate<"Subtarget->hasV8_1MMainlineOps()">,
300b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_1MMainlineOps",
310b57cec5SDimitry Andric                                                    "armv8.1m.main">;
320b57cec5SDimitry Andricdef HasMVEInt        : Predicate<"Subtarget->hasMVEIntegerOps()">,
330b57cec5SDimitry Andric                                 AssemblerPredicate<"HasMVEIntegerOps",
340b57cec5SDimitry Andric                                                    "mve">;
350b57cec5SDimitry Andricdef HasMVEFloat      : Predicate<"Subtarget->hasMVEFloatOps()">,
360b57cec5SDimitry Andric                                 AssemblerPredicate<"HasMVEFloatOps",
370b57cec5SDimitry Andric                                                    "mve.fp">;
380b57cec5SDimitry Andricdef HasFPRegs        : Predicate<"Subtarget->hasFPRegs()">,
390b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFPRegs",
400b57cec5SDimitry Andric                                                    "fp registers">;
410b57cec5SDimitry Andricdef HasFPRegs16      : Predicate<"Subtarget->hasFPRegs16()">,
420b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFPRegs16",
430b57cec5SDimitry Andric                                                    "16-bit fp registers">;
440b57cec5SDimitry Andricdef HasFPRegs64      : Predicate<"Subtarget->hasFPRegs64()">,
450b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFPRegs64",
460b57cec5SDimitry Andric                                                    "64-bit fp registers">;
470b57cec5SDimitry Andricdef HasFPRegsV8_1M   : Predicate<"Subtarget->hasFPRegs() && Subtarget->hasV8_1MMainlineOps()">,
480b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFPRegs,HasV8_1MMainlineOps",
490b57cec5SDimitry Andric                                                    "armv8.1m.main with FP or MVE">;
500b57cec5SDimitry Andricdef HasV6T2          : Predicate<"Subtarget->hasV6T2Ops()">,
510b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV6T2Ops", "armv6t2">;
520b57cec5SDimitry Andricdef NoV6T2           : Predicate<"!Subtarget->hasV6T2Ops()">;
530b57cec5SDimitry Andricdef HasV6K           : Predicate<"Subtarget->hasV6KOps()">,
540b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV6KOps", "armv6k">;
550b57cec5SDimitry Andricdef NoV6K            : Predicate<"!Subtarget->hasV6KOps()">;
560b57cec5SDimitry Andricdef HasV7            : Predicate<"Subtarget->hasV7Ops()">,
570b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV7Ops", "armv7">;
580b57cec5SDimitry Andricdef HasV8            : Predicate<"Subtarget->hasV8Ops()">,
590b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8Ops", "armv8">;
600b57cec5SDimitry Andricdef PreV8            : Predicate<"!Subtarget->hasV8Ops()">,
610b57cec5SDimitry Andric                                 AssemblerPredicate<"!HasV8Ops", "armv7 or earlier">;
620b57cec5SDimitry Andricdef HasV8_1a         : Predicate<"Subtarget->hasV8_1aOps()">,
630b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_1aOps", "armv8.1a">;
640b57cec5SDimitry Andricdef HasV8_2a         : Predicate<"Subtarget->hasV8_2aOps()">,
650b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_2aOps", "armv8.2a">;
660b57cec5SDimitry Andricdef HasV8_3a         : Predicate<"Subtarget->hasV8_3aOps()">,
670b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_3aOps", "armv8.3a">;
680b57cec5SDimitry Andricdef HasV8_4a         : Predicate<"Subtarget->hasV8_4aOps()">,
690b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_4aOps", "armv8.4a">;
700b57cec5SDimitry Andricdef HasV8_5a         : Predicate<"Subtarget->hasV8_5aOps()">,
710b57cec5SDimitry Andric                                 AssemblerPredicate<"HasV8_5aOps", "armv8.5a">;
720b57cec5SDimitry Andricdef NoVFP            : Predicate<"!Subtarget->hasVFP2Base()">;
730b57cec5SDimitry Andricdef HasVFP2          : Predicate<"Subtarget->hasVFP2Base()">,
748bcb0991SDimitry Andric                                 AssemblerPredicate<"FeatureVFP2_SP", "VFP2">;
750b57cec5SDimitry Andricdef HasVFP3          : Predicate<"Subtarget->hasVFP3Base()">,
760b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureVFP3_D16_SP", "VFP3">;
770b57cec5SDimitry Andricdef HasVFP4          : Predicate<"Subtarget->hasVFP4Base()">,
780b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureVFP4_D16_SP", "VFP4">;
790b57cec5SDimitry Andricdef HasDPVFP         : Predicate<"Subtarget->hasFP64()">,
800b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFP64",
810b57cec5SDimitry Andric                                                    "double precision VFP">;
820b57cec5SDimitry Andricdef HasFPARMv8       : Predicate<"Subtarget->hasFPARMv8Base()">,
830b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFPARMv8_D16_SP", "FPARMv8">;
840b57cec5SDimitry Andricdef HasNEON          : Predicate<"Subtarget->hasNEON()">,
850b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureNEON", "NEON">;
860b57cec5SDimitry Andricdef HasSHA2          : Predicate<"Subtarget->hasSHA2()">,
870b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureSHA2", "sha2">;
880b57cec5SDimitry Andricdef HasAES           : Predicate<"Subtarget->hasAES()">,
890b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureAES", "aes">;
900b57cec5SDimitry Andricdef HasCrypto        : Predicate<"Subtarget->hasCrypto()">,
910b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureCrypto", "crypto">;
920b57cec5SDimitry Andricdef HasDotProd       : Predicate<"Subtarget->hasDotProd()">,
930b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureDotProd", "dotprod">;
940b57cec5SDimitry Andricdef HasCRC           : Predicate<"Subtarget->hasCRC()">,
950b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureCRC", "crc">;
960b57cec5SDimitry Andricdef HasRAS           : Predicate<"Subtarget->hasRAS()">,
970b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureRAS", "ras">;
980b57cec5SDimitry Andricdef HasLOB           : Predicate<"Subtarget->hasLOB()">,
990b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureLOB", "lob">;
1000b57cec5SDimitry Andricdef HasFP16          : Predicate<"Subtarget->hasFP16()">,
1010b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFP16","half-float conversions">;
1020b57cec5SDimitry Andricdef HasFullFP16      : Predicate<"Subtarget->hasFullFP16()">,
1030b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFullFP16","full half-float">;
1040b57cec5SDimitry Andricdef HasFP16FML       : Predicate<"Subtarget->hasFP16FML()">,
1050b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureFP16FML","full half-float fml">;
1060b57cec5SDimitry Andricdef HasDivideInThumb : Predicate<"Subtarget->hasDivideInThumbMode()">,
1070b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureHWDivThumb", "divide in THUMB">;
1080b57cec5SDimitry Andricdef HasDivideInARM   : Predicate<"Subtarget->hasDivideInARMMode()">,
1090b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureHWDivARM", "divide in ARM">;
1100b57cec5SDimitry Andricdef HasDSP           : Predicate<"Subtarget->hasDSP()">,
1110b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureDSP", "dsp">;
1120b57cec5SDimitry Andricdef HasDB            : Predicate<"Subtarget->hasDataBarrier()">,
1130b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureDB",
1140b57cec5SDimitry Andric                                                    "data-barriers">;
1150b57cec5SDimitry Andricdef HasDFB           : Predicate<"Subtarget->hasFullDataBarrier()">,
1160b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureDFB",
1170b57cec5SDimitry Andric                                                    "full-data-barrier">;
1180b57cec5SDimitry Andricdef HasV7Clrex  : Predicate<"Subtarget->hasV7Clrex()">,
1190b57cec5SDimitry Andric                            AssemblerPredicate<"FeatureV7Clrex",
1200b57cec5SDimitry Andric                                               "v7 clrex">;
1210b57cec5SDimitry Andricdef HasAcquireRelease : Predicate<"Subtarget->hasAcquireRelease()">,
1220b57cec5SDimitry Andric                                  AssemblerPredicate<"FeatureAcquireRelease",
1230b57cec5SDimitry Andric                                                     "acquire/release">;
1240b57cec5SDimitry Andricdef HasMP            : Predicate<"Subtarget->hasMPExtension()">,
1250b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureMP",
1260b57cec5SDimitry Andric                                                    "mp-extensions">;
1270b57cec5SDimitry Andricdef HasVirtualization: Predicate<"false">,
1280b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureVirtualization",
1290b57cec5SDimitry Andric                                                   "virtualization-extensions">;
1300b57cec5SDimitry Andricdef HasTrustZone     : Predicate<"Subtarget->hasTrustZone()">,
1310b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureTrustZone",
1320b57cec5SDimitry Andric                                                    "TrustZone">;
1330b57cec5SDimitry Andricdef Has8MSecExt      : Predicate<"Subtarget->has8MSecExt()">,
1340b57cec5SDimitry Andric                                 AssemblerPredicate<"Feature8MSecExt",
1350b57cec5SDimitry Andric                                                    "ARMv8-M Security Extensions">;
1360b57cec5SDimitry Andricdef HasZCZ           : Predicate<"Subtarget->hasZeroCycleZeroing()">;
1370b57cec5SDimitry Andricdef UseNEONForFP     : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
1380b57cec5SDimitry Andricdef DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
1390b57cec5SDimitry Andricdef IsThumb          : Predicate<"Subtarget->isThumb()">,
1400b57cec5SDimitry Andric                                 AssemblerPredicate<"ModeThumb", "thumb">;
1410b57cec5SDimitry Andricdef IsThumb1Only     : Predicate<"Subtarget->isThumb1Only()">;
1420b57cec5SDimitry Andricdef IsThumb2         : Predicate<"Subtarget->isThumb2()">,
1430b57cec5SDimitry Andric                                 AssemblerPredicate<"ModeThumb,FeatureThumb2",
1440b57cec5SDimitry Andric                                                    "thumb2">;
1450b57cec5SDimitry Andricdef IsMClass         : Predicate<"Subtarget->isMClass()">,
1460b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureMClass", "armv*m">;
1470b57cec5SDimitry Andricdef IsNotMClass      : Predicate<"!Subtarget->isMClass()">,
1480b57cec5SDimitry Andric                                 AssemblerPredicate<"!FeatureMClass",
1490b57cec5SDimitry Andric                                                    "!armv*m">;
1500b57cec5SDimitry Andricdef IsARM            : Predicate<"!Subtarget->isThumb()">,
1510b57cec5SDimitry Andric                                 AssemblerPredicate<"!ModeThumb", "arm-mode">;
1520b57cec5SDimitry Andricdef IsMachO          : Predicate<"Subtarget->isTargetMachO()">;
1530b57cec5SDimitry Andricdef IsNotMachO       : Predicate<"!Subtarget->isTargetMachO()">;
1540b57cec5SDimitry Andricdef IsNaCl           : Predicate<"Subtarget->isTargetNaCl()">;
1550b57cec5SDimitry Andricdef IsWindows        : Predicate<"Subtarget->isTargetWindows()">;
1560b57cec5SDimitry Andricdef IsNotWindows     : Predicate<"!Subtarget->isTargetWindows()">;
1570b57cec5SDimitry Andricdef IsReadTPHard     : Predicate<"Subtarget->isReadTPHard()">;
1580b57cec5SDimitry Andricdef IsReadTPSoft     : Predicate<"!Subtarget->isReadTPHard()">;
1590b57cec5SDimitry Andricdef UseNaClTrap      : Predicate<"Subtarget->useNaClTrap()">,
1600b57cec5SDimitry Andric                                 AssemblerPredicate<"FeatureNaClTrap", "NaCl">;
1610b57cec5SDimitry Andricdef DontUseNaClTrap  : Predicate<"!Subtarget->useNaClTrap()">;
1620b57cec5SDimitry Andric
1630b57cec5SDimitry Andricdef UseNegativeImmediates :
1640b57cec5SDimitry Andric  Predicate<"false">,
1650b57cec5SDimitry Andric            AssemblerPredicate<"!FeatureNoNegativeImmediates",
1660b57cec5SDimitry Andric                               "NegativeImmediates">;
1670b57cec5SDimitry Andric
1680b57cec5SDimitry Andric// FIXME: Eventually this will be just "hasV6T2Ops".
1690b57cec5SDimitry Andriclet RecomputePerFunction = 1 in {
1700b57cec5SDimitry Andric  def UseMovt          : Predicate<"Subtarget->useMovt()">;
1710b57cec5SDimitry Andric  def DontUseMovt      : Predicate<"!Subtarget->useMovt()">;
1720b57cec5SDimitry Andric  def UseMovtInPic     : Predicate<"Subtarget->useMovt() && Subtarget->allowPositionIndependentMovt()">;
1730b57cec5SDimitry Andric  def DontUseMovtInPic : Predicate<"!Subtarget->useMovt() || !Subtarget->allowPositionIndependentMovt()">;
1740b57cec5SDimitry Andric
1750b57cec5SDimitry Andric  def UseFPVMLx: Predicate<"((Subtarget->useFPVMLx() &&"
1760b57cec5SDimitry Andric                           "  TM.Options.AllowFPOpFusion != FPOpFusion::Fast) ||"
1770b57cec5SDimitry Andric                           "Subtarget->hasMinSize())">;
1780b57cec5SDimitry Andric}
1790b57cec5SDimitry Andricdef UseMulOps        : Predicate<"Subtarget->useMulOps()">;
1800b57cec5SDimitry Andric
1810b57cec5SDimitry Andric// Prefer fused MAC for fp mul + add over fp VMLA / VMLS if they are available.
1820b57cec5SDimitry Andric// But only select them if more precision in FP computation is allowed, and when
1830b57cec5SDimitry Andric// they are not slower than a mul + add sequence.
1840b57cec5SDimitry Andric// Do not use them for Darwin platforms.
185*480093f4SDimitry Andricdef UseFusedMAC      : Predicate<"TM.Options.AllowFPOpFusion =="
1860b57cec5SDimitry Andric                                 "  FPOpFusion::Fast && "
187*480093f4SDimitry Andric                                 "Subtarget->useFPVFMx()">;
1880b57cec5SDimitry Andric
1890b57cec5SDimitry Andricdef HasFastVGETLNi32 : Predicate<"!Subtarget->hasSlowVGETLNi32()">;
1900b57cec5SDimitry Andricdef HasSlowVGETLNi32 : Predicate<"Subtarget->hasSlowVGETLNi32()">;
1910b57cec5SDimitry Andric
1920b57cec5SDimitry Andricdef HasFastVDUP32 : Predicate<"!Subtarget->hasSlowVDUP32()">;
1930b57cec5SDimitry Andricdef HasSlowVDUP32 : Predicate<"Subtarget->hasSlowVDUP32()">;
1940b57cec5SDimitry Andric
1950b57cec5SDimitry Andricdef UseVMOVSR : Predicate<"Subtarget->preferVMOVSR() ||"
1960b57cec5SDimitry Andric                          "!Subtarget->useNEONForSinglePrecisionFP()">;
1970b57cec5SDimitry Andricdef DontUseVMOVSR : Predicate<"!Subtarget->preferVMOVSR() &&"
1980b57cec5SDimitry Andric                              "Subtarget->useNEONForSinglePrecisionFP()">;
1990b57cec5SDimitry Andric
2000b57cec5SDimitry Andriclet RecomputePerFunction = 1 in {
2010b57cec5SDimitry Andric  def IsLE             : Predicate<"MF->getDataLayout().isLittleEndian()">;
2020b57cec5SDimitry Andric  def IsBE             : Predicate<"MF->getDataLayout().isBigEndian()">;
2030b57cec5SDimitry Andric}
2040b57cec5SDimitry Andric
2050b57cec5SDimitry Andricdef GenExecuteOnly : Predicate<"Subtarget->genExecuteOnly()">;
2060b57cec5SDimitry Andric
2070b57cec5SDimitry Andric// Armv8.5-A extensions
2080b57cec5SDimitry Andricdef HasSB            : Predicate<"Subtarget->hasSB()">,
2090b57cec5SDimitry Andric                       AssemblerPredicate<"FeatureSB", "sb">;
210