X86InstrAMX.td 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //===---- X86InstrAMX.td - AMX Instruction Set Extension --*- 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 describes the instructions that make up the Intel AMX instruction
  10. // set.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //===----------------------------------------------------------------------===//
  14. // AMX instructions
  15. let Predicates = [HasAMXTILE, In64BitMode] in {
  16. let SchedRW = [WriteSystem] in {
  17. let hasSideEffects = 1,
  18. Defs = [TMM0,TMM1,TMM2,TMM3,TMM4,TMM5,TMM6,TMM7] in
  19. def LDTILECFG : I <0x49, MRM0m, (outs), (ins opaquemem:$src),
  20. "ldtilecfg\t$src",
  21. [(int_x86_ldtilecfg addr:$src)]>, VEX, T8PS;
  22. let hasSideEffects = 1 in
  23. def STTILECFG : I <0x49, MRM0m, (outs), (ins opaquemem:$src),
  24. "sttilecfg\t$src",
  25. [(int_x86_sttilecfg addr:$src)]>, VEX, T8PD;
  26. let mayLoad = 1 in
  27. def TILELOADD : I<0x4b, MRMSrcMemFSIB, (outs TILE:$dst),
  28. (ins sibmem:$src),
  29. "tileloadd\t{$src, $dst|$dst, $src}", []>,
  30. VEX, T8XD;
  31. let mayLoad = 1 in
  32. def TILELOADDT1 : I<0x4b, MRMSrcMemFSIB, (outs TILE:$dst),
  33. (ins sibmem:$src),
  34. "tileloaddt1\t{$src, $dst|$dst, $src}", []>,
  35. VEX, T8PD;
  36. let Defs = [TMM0,TMM1,TMM2,TMM3,TMM4,TMM5,TMM6,TMM7] in
  37. def TILERELEASE : I<0x49, MRM_C0, (outs), (ins),
  38. "tilerelease", [(int_x86_tilerelease)]>, VEX, T8PS;
  39. let mayStore = 1 in
  40. def TILESTORED : I<0x4b, MRMDestMemFSIB, (outs),
  41. (ins sibmem:$dst, TILE:$src),
  42. "tilestored\t{$src, $dst|$dst, $src}", []>,
  43. VEX, T8XS;
  44. def TILEZERO : I<0x49, MRMr0, (outs TILE:$dst), (ins),
  45. "tilezero\t$dst", []>,
  46. VEX, T8XD;
  47. // Pseduo instruction for RA.
  48. def PLDTILECFGV : PseudoI<(outs), (ins opaquemem:$src),
  49. [(int_x86_ldtilecfg_internal addr:$src)]>;
  50. def PTILELOADDV : PseudoI<(outs TILE:$dst), (ins GR16:$src1,
  51. GR16:$src2,
  52. opaquemem:$src3), []>;
  53. def PTILELOADDT1V : PseudoI<(outs TILE:$dst), (ins GR16:$src1,
  54. GR16:$src2,
  55. opaquemem:$src3), []>;
  56. def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,
  57. GR16:$src2, opaquemem:$src3,
  58. TILE:$src4), []>;
  59. let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1 in
  60. def PTILEZEROV : PseudoI<(outs TILE:$dst), (ins GR16:$src1, GR16:$src2),
  61. [(set TILE:$dst, (int_x86_tilezero_internal
  62. GR16:$src1, GR16:$src2))]>;
  63. let usesCustomInserter = 1 in {
  64. // Pseudo instructions, using immediates instead of tile registers.
  65. // To be translated to the actual instructions in X86ISelLowering.cpp
  66. def PTILELOADD : PseudoI<(outs), (ins u8imm:$src1, sibmem:$src2), []>;
  67. def PTILELOADDT1 : PseudoI<(outs), (ins u8imm:$src1,
  68. sibmem:$src2), []>;
  69. def PTILESTORED : PseudoI<(outs), (ins i8mem:$dst, u8imm:$src), []>;
  70. def PTILEZERO : PseudoI<(outs), (ins u8imm:$src),
  71. [(int_x86_tilezero timm:$src)]>;
  72. }
  73. } // SchedRW
  74. } // HasAMXTILE
  75. let Predicates = [HasAMXINT8, In64BitMode] in {
  76. let SchedRW = [WriteSystem] in {
  77. let Constraints = "$src1 = $dst" in {
  78. def TDPBSSD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
  79. (ins TILE:$src1, TILE:$src2, TILE:$src3),
  80. "tdpbssd\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
  81. VEX_4V, T8XD;
  82. def TDPBSUD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
  83. (ins TILE:$src1, TILE:$src2, TILE:$src3),
  84. "tdpbsud\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
  85. VEX_4V, T8XS;
  86. def TDPBUSD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
  87. (ins TILE:$src1, TILE:$src2, TILE:$src3),
  88. "tdpbusd\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
  89. VEX_4V, T8PD;
  90. def TDPBUUD : I<0x5e, MRMSrcReg4VOp3, (outs TILE:$dst),
  91. (ins TILE:$src1, TILE:$src2, TILE:$src3),
  92. "tdpbuud\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>,
  93. VEX_4V, T8PS;
  94. }
  95. // Pseduo instruction for RA.
  96. let Constraints = "$src4 = $dst" in {
  97. def PTDPBSSDV : PseudoI<(outs TILE:$dst), (ins GR16:$src1,
  98. GR16:$src2, GR16:$src3, TILE:$src4,
  99. TILE:$src5, TILE:$src6),
  100. [(set TILE: $dst,
  101. (int_x86_tdpbssd_internal GR16:$src1, GR16:$src2,
  102. GR16:$src3, TILE:$src4, TILE:$src5, TILE:$src6))]>;
  103. def PTDPBSUDV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
  104. GR16:$src2, GR16:$src3, TILE:$src4,
  105. TILE:$src5, TILE:$src6),
  106. [(set TILE: $dst,
  107. (int_x86_tdpbsud_internal GR16:$src1, GR16:$src2,
  108. GR16:$src3, TILE:$src4, TILE:$src5, TILE:$src6))]>;
  109. def PTDPBUSDV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
  110. GR16:$src2, GR16:$src3, TILE:$src4,
  111. TILE:$src5, TILE:$src6),
  112. [(set TILE: $dst,
  113. (int_x86_tdpbusd_internal GR16:$src1, GR16:$src2,
  114. GR16:$src3, TILE:$src4, TILE:$src5, TILE:$src6))]>;
  115. def PTDPBUUDV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
  116. GR16:$src2, GR16:$src3, TILE:$src4,
  117. TILE:$src5, TILE:$src6),
  118. [(set TILE: $dst,
  119. (int_x86_tdpbuud_internal GR16:$src1, GR16:$src2,
  120. GR16:$src3, TILE:$src4, TILE:$src5, TILE:$src6))]>;
  121. }
  122. let usesCustomInserter = 1 in {
  123. // Pseudo instructions, using immediates instead of tile registers.
  124. // To be translated to the actual instructions in X86ISelLowering.cpp
  125. def PTDPBSSD : PseudoI<(outs), (ins u8imm:$src1,
  126. u8imm:$src2, u8imm:$src3),
  127. [(int_x86_tdpbssd timm:$src1,
  128. timm:$src2, timm:$src3)]>;
  129. def PTDPBSUD : PseudoI<(outs), (ins u8imm:$src1,
  130. u8imm:$src2, u8imm:$src3),
  131. [(int_x86_tdpbsud timm:$src1,
  132. timm:$src2, timm:$src3)]>;
  133. def PTDPBUSD : PseudoI<(outs), (ins u8imm:$src1,
  134. u8imm:$src2, u8imm:$src3),
  135. [(int_x86_tdpbusd timm:$src1,
  136. timm:$src2, timm:$src3)]>;
  137. def PTDPBUUD : PseudoI<(outs), (ins u8imm:$src1,
  138. u8imm:$src2, u8imm:$src3),
  139. [(int_x86_tdpbuud timm:$src1,
  140. timm:$src2, timm:$src3)]>;
  141. }
  142. }
  143. } // HasAMXTILE
  144. let Predicates = [HasAMXBF16, In64BitMode] in {
  145. let SchedRW = [WriteSystem] in {
  146. let Constraints = "$src1 = $dst" in
  147. def TDPBF16PS : I<0x5c, MRMSrcReg4VOp3, (outs TILE:$dst),
  148. (ins TILE:$src1, TILE:$src2, TILE:$src3),
  149. "tdpbf16ps\t{$src3, $src2, $dst|$dst, $src2, $src3}",
  150. []>, VEX_4V, T8XS;
  151. // Pseduo instruction for RA.
  152. let Constraints = "$src4 = $dst" in
  153. def PTDPBF16PSV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
  154. GR16:$src2, GR16:$src3, TILE:$src4,
  155. TILE:$src5, TILE:$src6),
  156. [(set TILE: $dst,
  157. (int_x86_tdpbf16ps_internal GR16:$src1,
  158. GR16:$src2, GR16:$src3, TILE:$src4,
  159. TILE:$src5, TILE:$src6))]>;
  160. let usesCustomInserter = 1 in {
  161. // Pseudo instructions, using immediates instead of tile registers.
  162. // To be translated to the actual instructions in X86ISelLowering.cpp
  163. def PTDPBF16PS : PseudoI<(outs), (ins u8imm:$src1,
  164. u8imm:$src2, u8imm:$src3),
  165. [(int_x86_tdpbf16ps timm:$src1,
  166. timm:$src2, timm:$src3)]>;
  167. }
  168. }
  169. } // HasAMXTILE, HasAMXBF16