IntrinsicsHexagon.td 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. //===- IntrinsicsHexagon.td - Defines Hexagon intrinsics ---*- tablegen -*-===//
  2. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  3. // See https://llvm.org/LICENSE.txt for license information.
  4. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. //
  6. //===----------------------------------------------------------------------===//
  7. //
  8. // This file defines all of the Hexagon-specific intrinsics.
  9. //
  10. //===----------------------------------------------------------------------===//
  11. //===----------------------------------------------------------------------===//
  12. // Definitions for all Hexagon intrinsics.
  13. //
  14. // All Hexagon intrinsics start with "llvm.hexagon.".
  15. let TargetPrefix = "hexagon" in {
  16. /// Hexagon_Intrinsic - Base class for the majority of Hexagon intrinsics.
  17. class Hexagon_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
  18. list<LLVMType> param_types,
  19. list<IntrinsicProperty> properties>
  20. : ClangBuiltin<!strconcat("__builtin_", GCCIntSuffix)>,
  21. DefaultAttrsIntrinsic<ret_types, param_types, properties>;
  22. /// Hexagon_NonGCC_Intrinsic - Base class for bitcode convertible Hexagon
  23. /// intrinsics.
  24. class Hexagon_NonGCC_Intrinsic<list<LLVMType> ret_types,
  25. list<LLVMType> param_types,
  26. list<IntrinsicProperty> properties>
  27. : DefaultAttrsIntrinsic<ret_types, param_types, properties>;
  28. }
  29. class Hexagon_mem_memmemsi_Intrinsic<string GCCIntSuffix>
  30. : Hexagon_Intrinsic<GCCIntSuffix,
  31. [llvm_ptr_ty], [llvm_ptr_ty, llvm_ptr_ty,
  32. llvm_i32_ty],
  33. [IntrArgMemOnly]>;
  34. class Hexagon_mem_memsisi_Intrinsic<string GCCIntSuffix>
  35. : Hexagon_Intrinsic<GCCIntSuffix,
  36. [llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty,
  37. llvm_i32_ty],
  38. [IntrWriteMem]>;
  39. class Hexagon_mem_memdisi_Intrinsic<string GCCIntSuffix>
  40. : Hexagon_Intrinsic<GCCIntSuffix,
  41. [llvm_ptr_ty], [llvm_ptr_ty, llvm_i64_ty,
  42. llvm_i32_ty],
  43. [IntrWriteMem]>;
  44. class Hexagon_mem_memmemsisi_Intrinsic<string GCCIntSuffix>
  45. : Hexagon_Intrinsic<GCCIntSuffix,
  46. [llvm_ptr_ty], [llvm_ptr_ty, llvm_ptr_ty,
  47. llvm_i32_ty, llvm_i32_ty],
  48. [IntrArgMemOnly, ImmArg<ArgIndex<3>>]>;
  49. class Hexagon_mem_memsisisi_Intrinsic<string GCCIntSuffix>
  50. : Hexagon_Intrinsic<GCCIntSuffix,
  51. [llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty,
  52. llvm_i32_ty, llvm_i32_ty],
  53. [IntrWriteMem, ImmArg<ArgIndex<3>>]>;
  54. class Hexagon_mem_memdisisi_Intrinsic<string GCCIntSuffix>
  55. : Hexagon_Intrinsic<GCCIntSuffix,
  56. [llvm_ptr_ty], [llvm_ptr_ty, llvm_i64_ty,
  57. llvm_i32_ty, llvm_i32_ty],
  58. [IntrWriteMem, ImmArg<ArgIndex<3>>]>;
  59. //
  60. // BUILTIN_INFO_NONCONST(circ_ldd,PTR_ftype_PTRPTRSISI,4)
  61. //
  62. def int_hexagon_circ_ldd :
  63. Hexagon_mem_memmemsisi_Intrinsic<"circ_ldd">;
  64. //
  65. // BUILTIN_INFO_NONCONST(circ_ldw,PTR_ftype_PTRPTRSISI,4)
  66. //
  67. def int_hexagon_circ_ldw :
  68. Hexagon_mem_memmemsisi_Intrinsic<"circ_ldw">;
  69. //
  70. // BUILTIN_INFO_NONCONST(circ_ldh,PTR_ftype_PTRPTRSISI,4)
  71. //
  72. def int_hexagon_circ_ldh :
  73. Hexagon_mem_memmemsisi_Intrinsic<"circ_ldh">;
  74. //
  75. // BUILTIN_INFO_NONCONST(circ_lduh,PTR_ftype_PTRPTRSISI,4)
  76. //
  77. def int_hexagon_circ_lduh :
  78. Hexagon_mem_memmemsisi_Intrinsic<"circ_lduh">;
  79. //
  80. // BUILTIN_INFO_NONCONST(circ_ldb,PTR_ftype_PTRPTRSISI,4)
  81. //
  82. def int_hexagon_circ_ldb :
  83. Hexagon_mem_memmemsisi_Intrinsic<"circ_ldb">;
  84. //
  85. // BUILTIN_INFO_NONCONST(circ_ldub,PTR_ftype_PTRPTRSISI,4)
  86. //
  87. def int_hexagon_circ_ldub :
  88. Hexagon_mem_memmemsisi_Intrinsic<"circ_ldub">;
  89. //
  90. // BUILTIN_INFO_NONCONST(circ_std,PTR_ftype_PTRDISISI,4)
  91. //
  92. def int_hexagon_circ_std :
  93. Hexagon_mem_memdisisi_Intrinsic<"circ_std">;
  94. //
  95. // BUILTIN_INFO_NONCONST(circ_stw,PTR_ftype_PTRSISISI,4)
  96. //
  97. def int_hexagon_circ_stw :
  98. Hexagon_mem_memsisisi_Intrinsic<"circ_stw">;
  99. //
  100. // BUILTIN_INFO_NONCONST(circ_sth,PTR_ftype_PTRSISISI,4)
  101. //
  102. def int_hexagon_circ_sth :
  103. Hexagon_mem_memsisisi_Intrinsic<"circ_sth">;
  104. //
  105. // BUILTIN_INFO_NONCONST(circ_sthhi,PTR_ftype_PTRSISISI,4)
  106. //
  107. def int_hexagon_circ_sthhi :
  108. Hexagon_mem_memsisisi_Intrinsic<"circ_sthhi">;
  109. //
  110. // BUILTIN_INFO_NONCONST(circ_stb,PTR_ftype_PTRSISISI,4)
  111. //
  112. def int_hexagon_circ_stb :
  113. Hexagon_mem_memsisisi_Intrinsic<"circ_stb">;
  114. def int_hexagon_prefetch :
  115. Hexagon_Intrinsic<"HEXAGON_prefetch", [], [llvm_ptr_ty], []>;
  116. def llvm_ptr32_ty : LLVMPointerType<llvm_i32_ty>;
  117. def llvm_ptr64_ty : LLVMPointerType<llvm_i64_ty>;
  118. // Mark locked loads as read/write to prevent any accidental reordering.
  119. // These don't use Hexagon_Intrinsic, because they are not nosync, and as such
  120. // cannot use default attributes.
  121. let TargetPrefix = "hexagon" in {
  122. def int_hexagon_L2_loadw_locked :
  123. ClangBuiltin<"__builtin_HEXAGON_L2_loadw_locked">,
  124. Intrinsic<[llvm_i32_ty], [llvm_ptr32_ty],
  125. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  126. def int_hexagon_L4_loadd_locked :
  127. ClangBuiltin<"__builtin__HEXAGON_L4_loadd_locked">,
  128. Intrinsic<[llvm_i64_ty], [llvm_ptr64_ty],
  129. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  130. def int_hexagon_S2_storew_locked :
  131. ClangBuiltin<"__builtin_HEXAGON_S2_storew_locked">,
  132. Intrinsic<[llvm_i32_ty],
  133. [llvm_ptr32_ty, llvm_i32_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  134. def int_hexagon_S4_stored_locked :
  135. ClangBuiltin<"__builtin_HEXAGON_S4_stored_locked">,
  136. Intrinsic<[llvm_i32_ty],
  137. [llvm_ptr64_ty, llvm_i64_ty], [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  138. }
  139. def int_hexagon_vmemcpy : Hexagon_Intrinsic<"hexagon_vmemcpy",
  140. [], [llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty],
  141. [IntrArgMemOnly, NoCapture<ArgIndex<0>>, NoCapture<ArgIndex<1>>, WriteOnly<ArgIndex<0>>, ReadOnly<ArgIndex<1>>]>;
  142. def int_hexagon_vmemset : Hexagon_Intrinsic<"hexagon_vmemset",
  143. [], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
  144. [IntrArgMemOnly, NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>]>;
  145. multiclass Hexagon_custom_circ_ld_Intrinsic<LLVMType ElTy> {
  146. def NAME#_pci : Hexagon_NonGCC_Intrinsic<
  147. [ElTy, llvm_ptr_ty],
  148. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty],
  149. [IntrArgMemOnly, NoCapture<ArgIndex<3>>]>;
  150. def NAME#_pcr : Hexagon_NonGCC_Intrinsic<
  151. [ElTy, llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_ptr_ty],
  152. [IntrArgMemOnly, NoCapture<ArgIndex<2>>]>;
  153. }
  154. defm int_hexagon_L2_loadrub : Hexagon_custom_circ_ld_Intrinsic<llvm_i32_ty>;
  155. defm int_hexagon_L2_loadrb : Hexagon_custom_circ_ld_Intrinsic<llvm_i32_ty>;
  156. defm int_hexagon_L2_loadruh : Hexagon_custom_circ_ld_Intrinsic<llvm_i32_ty>;
  157. defm int_hexagon_L2_loadrh : Hexagon_custom_circ_ld_Intrinsic<llvm_i32_ty>;
  158. defm int_hexagon_L2_loadri : Hexagon_custom_circ_ld_Intrinsic<llvm_i32_ty>;
  159. defm int_hexagon_L2_loadrd : Hexagon_custom_circ_ld_Intrinsic<llvm_i64_ty>;
  160. multiclass Hexagon_custom_circ_st_Intrinsic<LLVMType ElTy> {
  161. def NAME#_pci : Hexagon_NonGCC_Intrinsic<
  162. [llvm_ptr_ty],
  163. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, ElTy, llvm_ptr_ty],
  164. [IntrArgMemOnly, NoCapture<ArgIndex<4>>]>;
  165. def NAME#_pcr : Hexagon_NonGCC_Intrinsic<
  166. [llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty, ElTy, llvm_ptr_ty],
  167. [IntrArgMemOnly, NoCapture<ArgIndex<3>>]>;
  168. }
  169. defm int_hexagon_S2_storerb : Hexagon_custom_circ_st_Intrinsic<llvm_i32_ty>;
  170. defm int_hexagon_S2_storerh : Hexagon_custom_circ_st_Intrinsic<llvm_i32_ty>;
  171. defm int_hexagon_S2_storerf : Hexagon_custom_circ_st_Intrinsic<llvm_i32_ty>;
  172. defm int_hexagon_S2_storeri : Hexagon_custom_circ_st_Intrinsic<llvm_i32_ty>;
  173. defm int_hexagon_S2_storerd : Hexagon_custom_circ_st_Intrinsic<llvm_i64_ty>;
  174. // The front-end emits the intrinsic call with only two arguments. The third
  175. // argument from the builtin is already used by front-end to write to memory
  176. // by generating a store.
  177. class Hexagon_custom_brev_ld_Intrinsic<LLVMType ElTy>
  178. : Hexagon_NonGCC_Intrinsic<
  179. [ElTy, llvm_ptr_ty], [llvm_ptr_ty, llvm_i32_ty],
  180. [IntrReadMem]>;
  181. def int_hexagon_L2_loadrub_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i32_ty>;
  182. def int_hexagon_L2_loadrb_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i32_ty>;
  183. def int_hexagon_L2_loadruh_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i32_ty>;
  184. def int_hexagon_L2_loadrh_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i32_ty>;
  185. def int_hexagon_L2_loadri_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i32_ty>;
  186. def int_hexagon_L2_loadrd_pbr : Hexagon_custom_brev_ld_Intrinsic<llvm_i64_ty>;
  187. def int_hexagon_S2_storerb_pbr : Hexagon_mem_memsisi_Intrinsic<"brev_stb">;
  188. def int_hexagon_S2_storerh_pbr : Hexagon_mem_memsisi_Intrinsic<"brev_sth">;
  189. def int_hexagon_S2_storerf_pbr : Hexagon_mem_memsisi_Intrinsic<"brev_sthhi">;
  190. def int_hexagon_S2_storeri_pbr : Hexagon_mem_memsisi_Intrinsic<"brev_stw">;
  191. def int_hexagon_S2_storerd_pbr : Hexagon_mem_memdisi_Intrinsic<"brev_std">;
  192. // tag : V6_vrmpybub_rtt
  193. class Hexagon_v32i32_v16i32i64_rtt_Intrinsic<string GCCIntSuffix>
  194. : Hexagon_Intrinsic<GCCIntSuffix,
  195. [llvm_v32i32_ty], [llvm_v16i32_ty,llvm_i64_ty],
  196. [IntrNoMem]>;
  197. // tag : V6_vrmpybub_rtt_128B
  198. class Hexagon_v64i32_v32i32i64_rtt_Intrinsic<string GCCIntSuffix>
  199. : Hexagon_Intrinsic<GCCIntSuffix,
  200. [llvm_v64i32_ty], [llvm_v32i32_ty,llvm_i64_ty],
  201. [IntrNoMem]>;
  202. // tag : V6_vrmpybub_rtt_acc
  203. class Hexagon_v32i32_v32i32v16i32i64_rtt_Intrinsic<string GCCIntSuffix>
  204. : Hexagon_Intrinsic<GCCIntSuffix,
  205. [llvm_v32i32_ty], [llvm_v32i32_ty,llvm_v16i32_ty,llvm_i64_ty],
  206. [IntrNoMem]>;
  207. // tag : V6_vrmpybub_rtt_acc_128B
  208. class Hexagon_v64i32_v64i32v32i32i64_rtt_Intrinsic<string GCCIntSuffix>
  209. : Hexagon_Intrinsic<GCCIntSuffix,
  210. [llvm_v64i32_ty], [llvm_v64i32_ty,llvm_v32i32_ty,llvm_i64_ty],
  211. [IntrNoMem]>;
  212. def int_hexagon_V6_vrmpybub_rtt :
  213. Hexagon_v32i32_v16i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpybub_rtt">;
  214. def int_hexagon_V6_vrmpybub_rtt_128B :
  215. Hexagon_v64i32_v32i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpybub_rtt_128B">;
  216. def int_hexagon_V6_vrmpybub_rtt_acc :
  217. Hexagon_v32i32_v32i32v16i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpybub_rtt_acc">;
  218. def int_hexagon_V6_vrmpybub_rtt_acc_128B :
  219. Hexagon_v64i32_v64i32v32i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpybub_rtt_acc_128B">;
  220. def int_hexagon_V6_vrmpyub_rtt :
  221. Hexagon_v32i32_v16i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpyub_rtt">;
  222. def int_hexagon_V6_vrmpyub_rtt_128B :
  223. Hexagon_v64i32_v32i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpyub_rtt_128B">;
  224. def int_hexagon_V6_vrmpyub_rtt_acc :
  225. Hexagon_v32i32_v32i32v16i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpyub_rtt_acc">;
  226. def int_hexagon_V6_vrmpyub_rtt_acc_128B :
  227. Hexagon_v64i32_v64i32v32i32i64_rtt_Intrinsic<"HEXAGON_V6_vrmpyub_rtt_acc_128B">;
  228. // HVX conditional loads/stores
  229. class Hexagon_pred_vload_imm<LLVMType ValTy>
  230. : Hexagon_NonGCC_Intrinsic<
  231. [ValTy],
  232. [llvm_i1_ty, LLVMPointerType<ValTy>, llvm_i32_ty],
  233. [IntrReadMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>,
  234. ImmArg<ArgIndex<2>>]>;
  235. class Hexagon_pred_vload_imm_64B: Hexagon_pred_vload_imm<llvm_v16i32_ty>;
  236. class Hexagon_pred_vload_imm_128B: Hexagon_pred_vload_imm<llvm_v32i32_ty>;
  237. def int_hexagon_V6_vL32b_pred_ai: Hexagon_pred_vload_imm_64B;
  238. def int_hexagon_V6_vL32b_npred_ai: Hexagon_pred_vload_imm_64B;
  239. def int_hexagon_V6_vL32b_nt_pred_ai: Hexagon_pred_vload_imm_64B;
  240. def int_hexagon_V6_vL32b_nt_npred_ai: Hexagon_pred_vload_imm_64B;
  241. def int_hexagon_V6_vL32b_pred_ai_128B: Hexagon_pred_vload_imm_128B;
  242. def int_hexagon_V6_vL32b_npred_ai_128B: Hexagon_pred_vload_imm_128B;
  243. def int_hexagon_V6_vL32b_nt_pred_ai_128B: Hexagon_pred_vload_imm_128B;
  244. def int_hexagon_V6_vL32b_nt_npred_ai_128B: Hexagon_pred_vload_imm_128B;
  245. class Hexagom_pred_vload_upd<LLVMType ValTy, bit TakesImm>
  246. : Hexagon_NonGCC_Intrinsic<
  247. [ValTy, LLVMPointerType<ValTy>],
  248. [llvm_i1_ty, LLVMPointerType<ValTy>, llvm_i32_ty],
  249. !if(TakesImm,
  250. [IntrReadMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>,
  251. ImmArg<ArgIndex<2>>],
  252. [IntrReadMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>])>;
  253. class Hexagom_pred_vload_upd_64B<bit TakesImm>
  254. : Hexagom_pred_vload_upd<llvm_v16i32_ty, TakesImm>;
  255. class Hexagom_pred_vload_upd_128B<bit TakesImm>
  256. : Hexagom_pred_vload_upd<llvm_v32i32_ty, TakesImm>;
  257. def int_hexagon_V6_vL32b_pred_pi: Hexagom_pred_vload_upd_64B<1>;
  258. def int_hexagon_V6_vL32b_npred_pi: Hexagom_pred_vload_upd_64B<1>;
  259. def int_hexagon_V6_vL32b_nt_pred_pi: Hexagom_pred_vload_upd_64B<1>;
  260. def int_hexagon_V6_vL32b_nt_npred_pi: Hexagom_pred_vload_upd_64B<1>;
  261. def int_hexagon_V6_vL32b_pred_pi_128B: Hexagom_pred_vload_upd_128B<1>;
  262. def int_hexagon_V6_vL32b_npred_pi_128B: Hexagom_pred_vload_upd_128B<1>;
  263. def int_hexagon_V6_vL32b_nt_pred_pi_128B: Hexagom_pred_vload_upd_128B<1>;
  264. def int_hexagon_V6_vL32b_nt_npred_pi_128B: Hexagom_pred_vload_upd_128B<1>;
  265. def int_hexagon_V6_vL32b_pred_ppu: Hexagom_pred_vload_upd_64B<0>;
  266. def int_hexagon_V6_vL32b_npred_ppu: Hexagom_pred_vload_upd_64B<0>;
  267. def int_hexagon_V6_vL32b_nt_pred_ppu: Hexagom_pred_vload_upd_64B<0>;
  268. def int_hexagon_V6_vL32b_nt_npred_ppu: Hexagom_pred_vload_upd_64B<0>;
  269. def int_hexagon_V6_vL32b_pred_ppu_128B: Hexagom_pred_vload_upd_128B<0>;
  270. def int_hexagon_V6_vL32b_npred_ppu_128B: Hexagom_pred_vload_upd_128B<0>;
  271. def int_hexagon_V6_vL32b_nt_pred_ppu_128B: Hexagom_pred_vload_upd_128B<0>;
  272. def int_hexagon_V6_vL32b_nt_npred_ppu_128B: Hexagom_pred_vload_upd_128B<0>;
  273. class Hexagon_pred_vstore_imm<LLVMType ValTy>
  274. : Hexagon_NonGCC_Intrinsic<
  275. [],
  276. [llvm_i1_ty, LLVMPointerType<ValTy>, llvm_i32_ty, ValTy],
  277. [IntrWriteMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>,
  278. ImmArg<ArgIndex<2>>]>;
  279. class Hexagon_pred_vstore_imm_64B: Hexagon_pred_vstore_imm<llvm_v16i32_ty>;
  280. class Hexagon_pred_vstore_imm_128B: Hexagon_pred_vstore_imm<llvm_v32i32_ty>;
  281. def int_hexagon_V6_vS32b_pred_ai: Hexagon_pred_vstore_imm_64B;
  282. def int_hexagon_V6_vS32b_npred_ai: Hexagon_pred_vstore_imm_64B;
  283. def int_hexagon_V6_vS32Ub_pred_ai: Hexagon_pred_vstore_imm_64B;
  284. def int_hexagon_V6_vS32Ub_npred_ai: Hexagon_pred_vstore_imm_64B;
  285. def int_hexagon_V6_vS32b_nt_pred_ai: Hexagon_pred_vstore_imm_64B;
  286. def int_hexagon_V6_vS32b_nt_npred_ai: Hexagon_pred_vstore_imm_64B;
  287. def int_hexagon_V6_vS32b_pred_ai_128B: Hexagon_pred_vstore_imm_128B;
  288. def int_hexagon_V6_vS32b_npred_ai_128B: Hexagon_pred_vstore_imm_128B;
  289. def int_hexagon_V6_vS32Ub_pred_ai_128B: Hexagon_pred_vstore_imm_128B;
  290. def int_hexagon_V6_vS32Ub_npred_ai_128B: Hexagon_pred_vstore_imm_128B;
  291. def int_hexagon_V6_vS32b_nt_pred_ai_128B: Hexagon_pred_vstore_imm_128B;
  292. def int_hexagon_V6_vS32b_nt_npred_ai_128B: Hexagon_pred_vstore_imm_128B;
  293. class Hexagon_pred_vstore_upd<LLVMType ValTy, bit TakesImm>
  294. : Hexagon_NonGCC_Intrinsic<
  295. [LLVMPointerType<ValTy>],
  296. [llvm_i1_ty, LLVMPointerType<ValTy>, llvm_i32_ty, ValTy],
  297. !if(TakesImm,
  298. [IntrWriteMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>,
  299. ImmArg<ArgIndex<2>>],
  300. [IntrWriteMem, IntrArgMemOnly, NoCapture<ArgIndex<1>>])>;
  301. class Hexagon_pred_vstore_upd_64B<bit TakesImm>
  302. : Hexagon_pred_vstore_upd<llvm_v16i32_ty, TakesImm>;
  303. class Hexagon_pred_vstore_upd_128B<bit TakesImm>
  304. : Hexagon_pred_vstore_upd<llvm_v32i32_ty, TakesImm>;
  305. def int_hexagon_V6_vS32b_pred_pi: Hexagon_pred_vstore_upd_64B<1>;
  306. def int_hexagon_V6_vS32b_npred_pi: Hexagon_pred_vstore_upd_64B<1>;
  307. def int_hexagon_V6_vS32Ub_pred_pi: Hexagon_pred_vstore_upd_64B<1>;
  308. def int_hexagon_V6_vS32Ub_npred_pi: Hexagon_pred_vstore_upd_64B<1>;
  309. def int_hexagon_V6_vS32b_nt_pred_pi: Hexagon_pred_vstore_upd_64B<1>;
  310. def int_hexagon_V6_vS32b_nt_npred_pi: Hexagon_pred_vstore_upd_64B<1>;
  311. def int_hexagon_V6_vS32b_pred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  312. def int_hexagon_V6_vS32b_npred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  313. def int_hexagon_V6_vS32Ub_pred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  314. def int_hexagon_V6_vS32Ub_npred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  315. def int_hexagon_V6_vS32b_nt_pred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  316. def int_hexagon_V6_vS32b_nt_npred_pi_128B: Hexagon_pred_vstore_upd_128B<1>;
  317. def int_hexagon_V6_vS32b_pred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  318. def int_hexagon_V6_vS32b_npred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  319. def int_hexagon_V6_vS32Ub_pred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  320. def int_hexagon_V6_vS32Ub_npred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  321. def int_hexagon_V6_vS32b_nt_pred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  322. def int_hexagon_V6_vS32b_nt_npred_ppu: Hexagon_pred_vstore_upd_64B<0>;
  323. def int_hexagon_V6_vS32b_pred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  324. def int_hexagon_V6_vS32b_npred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  325. def int_hexagon_V6_vS32Ub_pred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  326. def int_hexagon_V6_vS32Ub_npred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  327. def int_hexagon_V6_vS32b_nt_pred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  328. def int_hexagon_V6_vS32b_nt_npred_ppu_128B: Hexagon_pred_vstore_upd_128B<0>;
  329. // HVX Vector predicate casts.
  330. // These intrinsics do not emit (nor do they correspond to) any instructions,
  331. // they are no-ops.
  332. def int_hexagon_V6_pred_typecast :
  333. Hexagon_NonGCC_Intrinsic<[llvm_anyvector_ty], [llvm_anyvector_ty], [IntrNoMem]>;
  334. def int_hexagon_V6_pred_typecast_128B :
  335. Hexagon_NonGCC_Intrinsic<[llvm_anyvector_ty], [llvm_anyvector_ty], [IntrNoMem]>;
  336. // HVX full-precision multiplication.
  337. // V6_vmpyss_parts(Vu,Vv) = (MulHS(Vu,Vv), Mul(Vu,Vv))
  338. // V6_vmpyuu_parts(Vu,Vv) = (MulHU(Vu,Vv), Mul(Vu,Vv))
  339. // V6_vmpyus_parts(Vu,Vv) = (MulHUS(Vu,Vv), Mul(Vu,Vv))
  340. //
  341. // Both, the (purportedly) 64b and the _128B versions are exactly equivalent
  342. // regardless of the HVX mode, they are both defined for consistency.
  343. // The purpose of these intrinsics is to have a uniform way of multiplying two
  344. // integer vectors in the LLVM IR. Many HVX multiply operations interleave
  345. // the even-odd results, except for 32x32 multiplications. Also, different
  346. // HVX versions have different instructions that can be used, so defer the
  347. // instruction choice to the isel.
  348. class Hexagon_vv_vv_pure:
  349. Hexagon_NonGCC_Intrinsic<
  350. [llvm_anyvector_ty, LLVMMatchType<0>],
  351. [LLVMMatchType<0>, LLVMMatchType<0>],
  352. [IntrNoMem]>;
  353. def int_hexagon_V6_vmpyss_parts: Hexagon_vv_vv_pure;
  354. def int_hexagon_V6_vmpyss_parts_128B: Hexagon_vv_vv_pure;
  355. def int_hexagon_V6_vmpyuu_parts: Hexagon_vv_vv_pure;
  356. def int_hexagon_V6_vmpyuu_parts_128B: Hexagon_vv_vv_pure;
  357. def int_hexagon_V6_vmpyus_parts: Hexagon_vv_vv_pure;
  358. def int_hexagon_V6_vmpyus_parts_128B: Hexagon_vv_vv_pure;
  359. // Masked vector stores
  360. //
  361. // These are all deprecated, the intrinsics matching instruction names
  362. // should be used instead, e.g. int_hexagon_V6_vS32b_qpred_ai, etc.
  363. class Hexagon_custom_vms_Intrinsic
  364. : Hexagon_NonGCC_Intrinsic<
  365. [], [llvm_v64i1_ty,llvm_ptr_ty,llvm_v16i32_ty], [IntrWriteMem]>;
  366. class Hexagon_custom_vms_Intrinsic_128B
  367. : Hexagon_NonGCC_Intrinsic<
  368. [], [llvm_v128i1_ty,llvm_ptr_ty,llvm_v32i32_ty], [IntrWriteMem]>;
  369. def int_hexagon_V6_vmaskedstoreq: Hexagon_custom_vms_Intrinsic;
  370. def int_hexagon_V6_vmaskedstorenq: Hexagon_custom_vms_Intrinsic;
  371. def int_hexagon_V6_vmaskedstorentq: Hexagon_custom_vms_Intrinsic;
  372. def int_hexagon_V6_vmaskedstorentnq: Hexagon_custom_vms_Intrinsic;
  373. def int_hexagon_V6_vmaskedstoreq_128B: Hexagon_custom_vms_Intrinsic_128B;
  374. def int_hexagon_V6_vmaskedstorenq_128B: Hexagon_custom_vms_Intrinsic_128B;
  375. def int_hexagon_V6_vmaskedstorentq_128B: Hexagon_custom_vms_Intrinsic_128B;
  376. def int_hexagon_V6_vmaskedstorentnq_128B: Hexagon_custom_vms_Intrinsic_128B;
  377. // Intrinsic for instrumentation based profiling using a custom handler. The
  378. // name of the handler is passed as the first operand to the intrinsic. The
  379. // handler can take only one int32 input which is passed as the second
  380. // operand to the intrinsic.
  381. def int_hexagon_instrprof_custom
  382. : Hexagon_NonGCC_Intrinsic<[],
  383. [llvm_ptr_ty, llvm_i32_ty],
  384. [IntrInaccessibleMemOnly]>;
  385. include "llvm/IR/IntrinsicsHexagonDep.td"