ARMPredicates.td 15 KB

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