AArch64SchedPredExynos.td 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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<CheckFpOrNEON>;
  104. // Identify 128-bit NEON instructions.
  105. def ExynosQFormPred : MCSchedPredicate<CheckQForm>;
  106. // Identify instructions that reset a register efficiently.
  107. def ExynosResetFn : TIIPredicate<
  108. "isExynosResetFast",
  109. MCOpcodeSwitchStatement<
  110. [MCOpcodeSwitchCase<
  111. [ADR, ADRP,
  112. MOVNWi, MOVNXi,
  113. MOVZWi, MOVZXi],
  114. MCReturnStatement<TruePred>>,
  115. MCOpcodeSwitchCase<
  116. [ORRWri, ORRXri],
  117. MCReturnStatement<
  118. CheckAll<
  119. [CheckIsRegOperand<1>,
  120. CheckAny<
  121. [CheckRegOperand<1, WZR>,
  122. CheckRegOperand<1, XZR>]>]>>>],
  123. MCReturnStatement<
  124. CheckAny<
  125. [IsCopyIdiomFn,
  126. IsZeroFPIdiomFn]>>>>;
  127. def ExynosResetPred : MCSchedPredicate<ExynosResetFn>;
  128. // Identify EXTR as the alias for ROR (immediate).
  129. def ExynosRotateRightImmPred : MCSchedPredicate<
  130. CheckAll<[CheckOpcode<[EXTRWrri, EXTRXrri]>,
  131. CheckSameRegOperand<1, 2>]>>;
  132. // Identify cheap arithmetic and logic immediate instructions.
  133. def ExynosCheapFn : TIIPredicate<
  134. "isExynosCheapAsMove",
  135. MCOpcodeSwitchStatement<
  136. [MCOpcodeSwitchCase<
  137. IsArithLogicImmOp.ValidOpcodes,
  138. MCReturnStatement<TruePred>>],
  139. MCReturnStatement<
  140. CheckAny<
  141. [ExynosArithFn, ExynosResetFn, ExynosLogicFn]>>>>;