AArch64SMEInstrInfo.td 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //=- AArch64SMEInstrInfo.td - AArch64 SME Instructions -*- 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. // AArch64 Scalable Matrix Extension (SME) Instruction definitions.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. //===----------------------------------------------------------------------===//
  13. // Add vector elements horizontally or vertically to ZA tile.
  14. //===----------------------------------------------------------------------===//
  15. let Predicates = [HasSME] in {
  16. def ADDHA_MPPZ_S : sme_add_vector_to_tile_u32<0b0, "addha">;
  17. def ADDVA_MPPZ_S : sme_add_vector_to_tile_u32<0b1, "addva">;
  18. }
  19. let Predicates = [HasSMEI64] in {
  20. def ADDHA_MPPZ_D : sme_add_vector_to_tile_u64<0b0, "addha">;
  21. def ADDVA_MPPZ_D : sme_add_vector_to_tile_u64<0b1, "addva">;
  22. }
  23. let Predicates = [HasSME] in {
  24. //===----------------------------------------------------------------------===//
  25. // Outer products
  26. //===----------------------------------------------------------------------===//
  27. defm BFMOPA_MPPZZ : sme_bf16_outer_product<0b0, "bfmopa">;
  28. defm BFMOPS_MPPZZ : sme_bf16_outer_product<0b1, "bfmops">;
  29. def FMOPA_MPPZZ_S : sme_outer_product_fp32<0b0, "fmopa">;
  30. def FMOPS_MPPZZ_S : sme_outer_product_fp32<0b1, "fmops">;
  31. }
  32. let Predicates = [HasSMEF64] in {
  33. def FMOPA_MPPZZ_D : sme_outer_product_fp64<0b0, "fmopa">;
  34. def FMOPS_MPPZZ_D : sme_outer_product_fp64<0b1, "fmops">;
  35. }
  36. let Predicates = [HasSME] in {
  37. defm FMOPAL_MPPZZ : sme_f16_outer_product<0b0, "fmopa">;
  38. defm FMOPSL_MPPZZ : sme_f16_outer_product<0b1, "fmops">;
  39. def SMOPA_MPPZZ_S : sme_int_outer_product_i32<0b000, "smopa">;
  40. def SMOPS_MPPZZ_S : sme_int_outer_product_i32<0b001, "smops">;
  41. def UMOPA_MPPZZ_S : sme_int_outer_product_i32<0b110, "umopa">;
  42. def UMOPS_MPPZZ_S : sme_int_outer_product_i32<0b111, "umops">;
  43. def SUMOPA_MPPZZ_S : sme_int_outer_product_i32<0b010, "sumopa">;
  44. def SUMOPS_MPPZZ_S : sme_int_outer_product_i32<0b011, "sumops">;
  45. def USMOPA_MPPZZ_S : sme_int_outer_product_i32<0b100, "usmopa">;
  46. def USMOPS_MPPZZ_S : sme_int_outer_product_i32<0b101, "usmops">;
  47. }
  48. let Predicates = [HasSMEI64] in {
  49. def SMOPA_MPPZZ_D : sme_int_outer_product_i64<0b000, "smopa">;
  50. def SMOPS_MPPZZ_D : sme_int_outer_product_i64<0b001, "smops">;
  51. def UMOPA_MPPZZ_D : sme_int_outer_product_i64<0b110, "umopa">;
  52. def UMOPS_MPPZZ_D : sme_int_outer_product_i64<0b111, "umops">;
  53. def SUMOPA_MPPZZ_D : sme_int_outer_product_i64<0b010, "sumopa">;
  54. def SUMOPS_MPPZZ_D : sme_int_outer_product_i64<0b011, "sumops">;
  55. def USMOPA_MPPZZ_D : sme_int_outer_product_i64<0b100, "usmopa">;
  56. def USMOPS_MPPZZ_D : sme_int_outer_product_i64<0b101, "usmops">;
  57. }
  58. let Predicates = [HasSME] in {
  59. //===----------------------------------------------------------------------===//
  60. // Loads and stores
  61. //===----------------------------------------------------------------------===//
  62. defm LD1_MXIPXX : sme_mem_ld_ss<"ld1">;
  63. defm ST1_MXIPXX : sme_mem_st_ss<"st1">;
  64. //===----------------------------------------------------------------------===//
  65. // Spill + fill
  66. //===----------------------------------------------------------------------===//
  67. defm LDR_ZA : sme_fill<"ldr">;
  68. defm STR_ZA : sme_spill<"str">;
  69. //===----------------------------------------------------------------------===//
  70. // Move instructions
  71. //===----------------------------------------------------------------------===//
  72. defm INSERT_MXIPZ : sme_vector_to_tile<"mova">;
  73. defm EXTRACT_ZPMXI : sme_tile_to_vector<"mova">;
  74. //===----------------------------------------------------------------------===//
  75. // Zero instruction
  76. //===----------------------------------------------------------------------===//
  77. defm ZERO_M : sme_zero<"zero">;
  78. //===----------------------------------------------------------------------===//
  79. // Mode selection and state access instructions
  80. //===----------------------------------------------------------------------===//
  81. // SME defines three pstate fields to set or clear PSTATE.SM, PSTATE.ZA, or
  82. // both fields:
  83. //
  84. // MSR SVCRSM, #<imm1>
  85. // MSR SVCRZA, #<imm1>
  86. // MSR SVCRSMZA, #<imm1>
  87. //
  88. // It's tricky to using the existing pstate operand defined in
  89. // AArch64SystemOperands.td since it only encodes 5 bits including op1;op2,
  90. // when these fields are also encoded in CRm[3:1].
  91. class MSRpstatesvcrImm0_1
  92. : PstateWriteSimple<(ins svcr_op:$pstatefield, imm0_1:$imm), "msr",
  93. "\t$pstatefield, $imm">,
  94. Sched<[WriteSys]> {
  95. bits<3> pstatefield;
  96. bit imm;
  97. let Inst{18-16} = 0b011; // op1
  98. let Inst{11-9} = pstatefield;
  99. let Inst{8} = imm;
  100. let Inst{7-5} = 0b011; // op2
  101. }
  102. def MSRpstatesvcrImm1 : MSRpstatesvcrImm0_1;
  103. def : InstAlias<"smstart", (MSRpstatesvcrImm1 0b011, 0b1)>;
  104. def : InstAlias<"smstart sm", (MSRpstatesvcrImm1 0b001, 0b1)>;
  105. def : InstAlias<"smstart za", (MSRpstatesvcrImm1 0b010, 0b1)>;
  106. def : InstAlias<"smstop", (MSRpstatesvcrImm1 0b011, 0b0)>;
  107. def : InstAlias<"smstop sm", (MSRpstatesvcrImm1 0b001, 0b0)>;
  108. def : InstAlias<"smstop za", (MSRpstatesvcrImm1 0b010, 0b0)>;
  109. //===----------------------------------------------------------------------===//
  110. // SVE2 instructions
  111. //===----------------------------------------------------------------------===//
  112. def REVD_ZPmZ : sve2_int_perm_revd<"revd">;
  113. defm SCLAMP_ZZZ : sve2_clamp<"sclamp", 0b0>;
  114. defm UCLAMP_ZZZ : sve2_clamp<"uclamp", 0b1>;
  115. defm PSEL_PPPRI : sve2_int_perm_sel_p<"psel">;
  116. } // End let Predicates = [HasSME]