AArch64SchedPredExynos.td 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //===- AArch64SchedPredExynos.td - AArch64 Sched Preds -----*- 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. //
  9. // This file defines scheduling predicate definitions that are used by the
  10. // AArch64 Exynos processors.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. // Auxiliary predicates.
  14. // Check the shift in arithmetic and logic instructions.
  15. def ExynosCheckShift : CheckAny<[CheckShiftBy0,
  16. CheckAll<
  17. [CheckShiftLSL,
  18. CheckAny<
  19. [CheckShiftBy1,
  20. CheckShiftBy2,
  21. CheckShiftBy3]>]>]>;
  22. // Exynos predicates.
  23. // Identify BLR specifying the LR register as the indirect target register.
  24. def ExynosBranchLinkLRPred : MCSchedPredicate<
  25. CheckAll<[CheckOpcode<[BLR]>,
  26. CheckRegOperand<0, LR>]>>;
  27. // Identify arithmetic instructions without or with limited extension or shift.
  28. def ExynosArithFn : TIIPredicate<
  29. "isExynosArithFast",
  30. MCOpcodeSwitchStatement<
  31. [MCOpcodeSwitchCase<
  32. IsArithExtOp.ValidOpcodes,
  33. MCReturnStatement<
  34. CheckAny<[CheckExtBy0,
  35. CheckAll<
  36. [CheckAny<
  37. [CheckExtUXTW,
  38. CheckExtUXTX]>,
  39. CheckAny<
  40. [CheckExtBy1,
  41. CheckExtBy2,
  42. CheckExtBy3]>]>]>>>,
  43. MCOpcodeSwitchCase<
  44. IsArithShiftOp.ValidOpcodes,
  45. MCReturnStatement<ExynosCheckShift>>,
  46. MCOpcodeSwitchCase<
  47. IsArithUnshiftOp.ValidOpcodes,
  48. MCReturnStatement<TruePred>>,
  49. MCOpcodeSwitchCase<
  50. IsArithImmOp.ValidOpcodes,
  51. MCReturnStatement<TruePred>>],
  52. MCReturnStatement<FalsePred>>>;
  53. def ExynosArithPred : MCSchedPredicate<ExynosArithFn>;
  54. // Identify logic instructions with limited shift.
  55. def ExynosLogicFn : TIIPredicate<
  56. "isExynosLogicFast",
  57. MCOpcodeSwitchStatement<
  58. [MCOpcodeSwitchCase<
  59. IsLogicShiftOp.ValidOpcodes,
  60. MCReturnStatement<ExynosCheckShift>>,
  61. MCOpcodeSwitchCase<
  62. IsLogicUnshiftOp.ValidOpcodes,
  63. MCReturnStatement<TruePred>>,
  64. MCOpcodeSwitchCase<
  65. IsLogicImmOp.ValidOpcodes,
  66. MCReturnStatement<TruePred>>],
  67. MCReturnStatement<FalsePred>>>;
  68. def ExynosLogicPred : MCSchedPredicate<ExynosLogicFn>;
  69. // Identify more logic instructions with limited shift.
  70. def ExynosLogicExFn : TIIPredicate<
  71. "isExynosLogicExFast",
  72. MCOpcodeSwitchStatement<
  73. [MCOpcodeSwitchCase<
  74. IsLogicShiftOp.ValidOpcodes,
  75. MCReturnStatement<
  76. CheckAny<
  77. [ExynosCheckShift,
  78. CheckAll<
  79. [CheckShiftLSL,
  80. CheckShiftBy8]>]>>>,
  81. MCOpcodeSwitchCase<
  82. IsLogicUnshiftOp.ValidOpcodes,
  83. MCReturnStatement<TruePred>>,
  84. MCOpcodeSwitchCase<
  85. IsLogicImmOp.ValidOpcodes,
  86. MCReturnStatement<TruePred>>],
  87. MCReturnStatement<FalsePred>>>;
  88. def ExynosLogicExPred : MCSchedPredicate<ExynosLogicExFn>;
  89. // Identify a load or store using the register offset addressing mode
  90. // with a scaled non-extended register.
  91. def ExynosScaledIdxFn : TIIPredicate<"isExynosScaledAddr",
  92. MCOpcodeSwitchStatement<
  93. [MCOpcodeSwitchCase<
  94. IsLoadStoreRegOffsetOp.ValidOpcodes,
  95. MCReturnStatement<
  96. CheckAny<
  97. [CheckMemExtSXTW,
  98. CheckMemExtUXTW,
  99. CheckMemScaled]>>>],
  100. MCReturnStatement<FalsePred>>>;
  101. def ExynosScaledIdxPred : MCSchedPredicate<ExynosScaledIdxFn>;
  102. // Identify FP instructions.
  103. def ExynosFPPred : MCSchedPredicate<CheckAny<[CheckHForm,
  104. CheckSForm,
  105. CheckDForm,
  106. CheckQForm]>>;
  107. // Identify 128-bit NEON instructions.
  108. def ExynosQFormPred : MCSchedPredicate<CheckQForm>;
  109. // Identify instructions that reset a register efficiently.
  110. def ExynosResetFn : TIIPredicate<
  111. "isExynosResetFast",
  112. MCOpcodeSwitchStatement<
  113. [MCOpcodeSwitchCase<
  114. [ADR, ADRP,
  115. MOVNWi, MOVNXi,
  116. MOVZWi, MOVZXi],
  117. MCReturnStatement<TruePred>>,
  118. MCOpcodeSwitchCase<
  119. [ORRWri, ORRXri],
  120. MCReturnStatement<
  121. CheckAll<
  122. [CheckIsRegOperand<1>,
  123. CheckAny<
  124. [CheckRegOperand<1, WZR>,
  125. CheckRegOperand<1, XZR>]>]>>>],
  126. MCReturnStatement<
  127. CheckAny<
  128. [IsCopyIdiomFn,
  129. IsZeroFPIdiomFn]>>>>;
  130. def ExynosResetPred : MCSchedPredicate<ExynosResetFn>;
  131. // Identify EXTR as the alias for ROR (immediate).
  132. def ExynosRotateRightImmPred : MCSchedPredicate<
  133. CheckAll<[CheckOpcode<[EXTRWrri, EXTRXrri]>,
  134. CheckSameRegOperand<1, 2>]>>;
  135. // Identify cheap arithmetic and logic immediate instructions.
  136. def ExynosCheapFn : TIIPredicate<
  137. "isExynosCheapAsMove",
  138. MCOpcodeSwitchStatement<
  139. [MCOpcodeSwitchCase<
  140. IsArithLogicImmOp.ValidOpcodes,
  141. MCReturnStatement<TruePred>>],
  142. MCReturnStatement<
  143. CheckAny<
  144. [ExynosArithFn, ExynosResetFn, ExynosLogicFn]>>>>;