X86InstrFragmentsSIMD.td 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246
  1. //===-- X86InstrFragmentsSIMD.td - x86 SIMD ISA ------------*- 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 provides pattern fragments useful for SIMD instructions.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. //===----------------------------------------------------------------------===//
  13. // MMX specific DAG Nodes.
  14. //===----------------------------------------------------------------------===//
  15. // Low word of MMX to GPR.
  16. def MMX_X86movd2w : SDNode<"X86ISD::MMX_MOVD2W", SDTypeProfile<1, 1,
  17. [SDTCisVT<0, i32>, SDTCisVT<1, x86mmx>]>>;
  18. // GPR to low word of MMX.
  19. def MMX_X86movw2d : SDNode<"X86ISD::MMX_MOVW2D", SDTypeProfile<1, 1,
  20. [SDTCisVT<0, x86mmx>, SDTCisVT<1, i32>]>>;
  21. //===----------------------------------------------------------------------===//
  22. // MMX Pattern Fragments
  23. //===----------------------------------------------------------------------===//
  24. def load_mmx : PatFrag<(ops node:$ptr), (x86mmx (load node:$ptr))>;
  25. //===----------------------------------------------------------------------===//
  26. // SSE specific DAG Nodes.
  27. //===----------------------------------------------------------------------===//
  28. def SDTX86VFCMP : SDTypeProfile<1, 3, [SDTCisFP<0>, SDTCisVec<0>,
  29. SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
  30. SDTCisVT<3, i8>]>;
  31. def X86fmin : SDNode<"X86ISD::FMIN", SDTFPBinOp>;
  32. def X86fmax : SDNode<"X86ISD::FMAX", SDTFPBinOp>;
  33. def X86fmins : SDNode<"X86ISD::FMINS", SDTFPBinOp>;
  34. def X86fmaxs : SDNode<"X86ISD::FMAXS", SDTFPBinOp>;
  35. // Commutative and Associative FMIN and FMAX.
  36. def X86fminc : SDNode<"X86ISD::FMINC", SDTFPBinOp,
  37. [SDNPCommutative, SDNPAssociative]>;
  38. def X86fmaxc : SDNode<"X86ISD::FMAXC", SDTFPBinOp,
  39. [SDNPCommutative, SDNPAssociative]>;
  40. def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp,
  41. [SDNPCommutative, SDNPAssociative]>;
  42. def X86for : SDNode<"X86ISD::FOR", SDTFPBinOp,
  43. [SDNPCommutative, SDNPAssociative]>;
  44. def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp,
  45. [SDNPCommutative, SDNPAssociative]>;
  46. def X86fandn : SDNode<"X86ISD::FANDN", SDTFPBinOp>;
  47. def X86frsqrt : SDNode<"X86ISD::FRSQRT", SDTFPUnaryOp>;
  48. def X86frcp : SDNode<"X86ISD::FRCP", SDTFPUnaryOp>;
  49. def X86fhadd : SDNode<"X86ISD::FHADD", SDTFPBinOp>;
  50. def X86fhsub : SDNode<"X86ISD::FHSUB", SDTFPBinOp>;
  51. def X86hadd : SDNode<"X86ISD::HADD", SDTIntBinOp>;
  52. def X86hsub : SDNode<"X86ISD::HSUB", SDTIntBinOp>;
  53. def X86comi : SDNode<"X86ISD::COMI", SDTX86FCmp>;
  54. def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86FCmp>;
  55. def SDTX86Cmps : SDTypeProfile<1, 3, [SDTCisFP<0>, SDTCisSameAs<0, 1>,
  56. SDTCisSameAs<1, 2>, SDTCisVT<3, i8>]>;
  57. def X86cmps : SDNode<"X86ISD::FSETCC", SDTX86Cmps>;
  58. def X86pshufb : SDNode<"X86ISD::PSHUFB",
  59. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i8>, SDTCisSameAs<0,1>,
  60. SDTCisSameAs<0,2>]>>;
  61. def X86psadbw : SDNode<"X86ISD::PSADBW",
  62. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i64>,
  63. SDTCVecEltisVT<1, i8>,
  64. SDTCisSameSizeAs<0,1>,
  65. SDTCisSameAs<1,2>]>, [SDNPCommutative]>;
  66. def X86dbpsadbw : SDNode<"X86ISD::DBPSADBW",
  67. SDTypeProfile<1, 3, [SDTCVecEltisVT<0, i16>,
  68. SDTCVecEltisVT<1, i8>,
  69. SDTCisSameSizeAs<0,1>,
  70. SDTCisSameAs<1,2>, SDTCisVT<3, i8>]>>;
  71. def X86andnp : SDNode<"X86ISD::ANDNP",
  72. SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  73. SDTCisSameAs<0,2>]>>;
  74. def X86multishift : SDNode<"X86ISD::MULTISHIFT",
  75. SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
  76. SDTCisSameAs<1,2>]>>;
  77. def X86pextrb : SDNode<"X86ISD::PEXTRB",
  78. SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisVT<1, v16i8>,
  79. SDTCisVT<2, i8>]>>;
  80. def X86pextrw : SDNode<"X86ISD::PEXTRW",
  81. SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisVT<1, v8i16>,
  82. SDTCisVT<2, i8>]>>;
  83. def X86pinsrb : SDNode<"X86ISD::PINSRB",
  84. SDTypeProfile<1, 3, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>,
  85. SDTCisVT<2, i32>, SDTCisVT<3, i8>]>>;
  86. def X86pinsrw : SDNode<"X86ISD::PINSRW",
  87. SDTypeProfile<1, 3, [SDTCisVT<0, v8i16>, SDTCisSameAs<0,1>,
  88. SDTCisVT<2, i32>, SDTCisVT<3, i8>]>>;
  89. def X86insertps : SDNode<"X86ISD::INSERTPS",
  90. SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisSameAs<0,1>,
  91. SDTCisVT<2, v4f32>, SDTCisVT<3, i8>]>>;
  92. def X86vzmovl : SDNode<"X86ISD::VZEXT_MOVL",
  93. SDTypeProfile<1, 1, [SDTCisSameAs<0,1>]>>;
  94. def X86vzld : SDNode<"X86ISD::VZEXT_LOAD", SDTLoad,
  95. [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
  96. def X86vextractst : SDNode<"X86ISD::VEXTRACT_STORE", SDTStore,
  97. [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
  98. def X86VBroadcastld : SDNode<"X86ISD::VBROADCAST_LOAD", SDTLoad,
  99. [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
  100. def X86SubVBroadcastld : SDNode<"X86ISD::SUBV_BROADCAST_LOAD", SDTLoad,
  101. [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
  102. def SDTVtrunc : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
  103. SDTCisInt<0>, SDTCisInt<1>,
  104. SDTCisOpSmallerThanOp<0, 1>]>;
  105. def SDTVmtrunc : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisVec<1>,
  106. SDTCisInt<0>, SDTCisInt<1>,
  107. SDTCisOpSmallerThanOp<0, 1>,
  108. SDTCisSameAs<0, 2>,
  109. SDTCVecEltisVT<3, i1>,
  110. SDTCisSameNumEltsAs<1, 3>]>;
  111. def X86vtrunc : SDNode<"X86ISD::VTRUNC", SDTVtrunc>;
  112. def X86vtruncs : SDNode<"X86ISD::VTRUNCS", SDTVtrunc>;
  113. def X86vtruncus : SDNode<"X86ISD::VTRUNCUS", SDTVtrunc>;
  114. def X86vmtrunc : SDNode<"X86ISD::VMTRUNC", SDTVmtrunc>;
  115. def X86vmtruncs : SDNode<"X86ISD::VMTRUNCS", SDTVmtrunc>;
  116. def X86vmtruncus : SDNode<"X86ISD::VMTRUNCUS", SDTVmtrunc>;
  117. def X86vfpext : SDNode<"X86ISD::VFPEXT",
  118. SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVec<0>,
  119. SDTCisFP<1>, SDTCisVec<1>]>>;
  120. def X86strict_vfpext : SDNode<"X86ISD::STRICT_VFPEXT",
  121. SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVec<0>,
  122. SDTCisFP<1>, SDTCisVec<1>]>,
  123. [SDNPHasChain]>;
  124. def X86any_vfpext : PatFrags<(ops node:$src),
  125. [(X86strict_vfpext node:$src),
  126. (X86vfpext node:$src)]>;
  127. def X86vfpround: SDNode<"X86ISD::VFPROUND",
  128. SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVec<0>,
  129. SDTCisFP<1>, SDTCisVec<1>,
  130. SDTCisOpSmallerThanOp<0, 1>]>>;
  131. def X86strict_vfpround: SDNode<"X86ISD::STRICT_VFPROUND",
  132. SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVec<0>,
  133. SDTCisFP<1>, SDTCisVec<1>,
  134. SDTCisOpSmallerThanOp<0, 1>]>,
  135. [SDNPHasChain]>;
  136. def X86any_vfpround : PatFrags<(ops node:$src),
  137. [(X86strict_vfpround node:$src),
  138. (X86vfpround node:$src)]>;
  139. def X86frounds : SDNode<"X86ISD::VFPROUNDS",
  140. SDTypeProfile<1, 2, [SDTCisFP<0>, SDTCisVec<0>,
  141. SDTCisSameAs<0, 1>,
  142. SDTCisFP<2>, SDTCisVec<2>,
  143. SDTCisSameSizeAs<0, 2>]>>;
  144. def X86froundsRnd: SDNode<"X86ISD::VFPROUNDS_RND",
  145. SDTypeProfile<1, 3, [SDTCisFP<0>, SDTCisVec<0>,
  146. SDTCisSameAs<0, 1>,
  147. SDTCisFP<2>, SDTCisVec<2>,
  148. SDTCisSameSizeAs<0, 2>,
  149. SDTCisVT<3, i32>]>>;
  150. def X86fpexts : SDNode<"X86ISD::VFPEXTS",
  151. SDTypeProfile<1, 2, [SDTCisFP<0>, SDTCisVec<0>,
  152. SDTCisSameAs<0, 1>,
  153. SDTCisFP<2>, SDTCisVec<2>,
  154. SDTCisSameSizeAs<0, 2>]>>;
  155. def X86fpextsSAE : SDNode<"X86ISD::VFPEXTS_SAE",
  156. SDTypeProfile<1, 2, [SDTCisFP<0>, SDTCisVec<0>,
  157. SDTCisSameAs<0, 1>,
  158. SDTCisFP<2>, SDTCisVec<2>,
  159. SDTCisSameSizeAs<0, 2>]>>;
  160. def X86vmfpround: SDNode<"X86ISD::VMFPROUND",
  161. SDTypeProfile<1, 3, [SDTCisFP<0>, SDTCisVec<0>,
  162. SDTCisFP<1>, SDTCisVec<1>,
  163. SDTCisSameAs<0, 2>,
  164. SDTCVecEltisVT<3, i1>,
  165. SDTCisSameNumEltsAs<1, 3>]>>;
  166. def X86vshiftimm : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  167. SDTCisVT<2, i8>, SDTCisInt<0>]>;
  168. def X86vshldq : SDNode<"X86ISD::VSHLDQ", X86vshiftimm>;
  169. def X86vshrdq : SDNode<"X86ISD::VSRLDQ", X86vshiftimm>;
  170. def X86pcmpeq : SDNode<"X86ISD::PCMPEQ", SDTIntBinOp, [SDNPCommutative]>;
  171. def X86pcmpgt : SDNode<"X86ISD::PCMPGT", SDTIntBinOp>;
  172. def X86cmpp : SDNode<"X86ISD::CMPP", SDTX86VFCMP>;
  173. def X86strict_cmpp : SDNode<"X86ISD::STRICT_CMPP", SDTX86VFCMP, [SDNPHasChain]>;
  174. def X86any_cmpp : PatFrags<(ops node:$src1, node:$src2, node:$src3),
  175. [(X86strict_cmpp node:$src1, node:$src2, node:$src3),
  176. (X86cmpp node:$src1, node:$src2, node:$src3)]>;
  177. def X86CmpMaskCC :
  178. SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCVecEltisVT<0, i1>,
  179. SDTCisVec<1>, SDTCisSameAs<2, 1>,
  180. SDTCisSameNumEltsAs<0, 1>, SDTCisVT<3, i8>]>;
  181. def X86MaskCmpMaskCC :
  182. SDTypeProfile<1, 4, [SDTCisVec<0>, SDTCVecEltisVT<0, i1>,
  183. SDTCisVec<1>, SDTCisSameAs<2, 1>,
  184. SDTCisSameNumEltsAs<0, 1>, SDTCisVT<3, i8>, SDTCisSameAs<4, 0>]>;
  185. def X86CmpMaskCCScalar :
  186. SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisFP<1>, SDTCisSameAs<1, 2>,
  187. SDTCisVT<3, i8>]>;
  188. def X86cmpm : SDNode<"X86ISD::CMPM", X86CmpMaskCC>;
  189. def X86cmpmm : SDNode<"X86ISD::CMPMM", X86MaskCmpMaskCC>;
  190. def X86strict_cmpm : SDNode<"X86ISD::STRICT_CMPM", X86CmpMaskCC, [SDNPHasChain]>;
  191. def X86any_cmpm : PatFrags<(ops node:$src1, node:$src2, node:$src3),
  192. [(X86strict_cmpm node:$src1, node:$src2, node:$src3),
  193. (X86cmpm node:$src1, node:$src2, node:$src3)]>;
  194. def X86cmpmmSAE : SDNode<"X86ISD::CMPMM_SAE", X86MaskCmpMaskCC>;
  195. def X86cmpms : SDNode<"X86ISD::FSETCCM", X86CmpMaskCCScalar>;
  196. def X86cmpmsSAE : SDNode<"X86ISD::FSETCCM_SAE", X86CmpMaskCCScalar>;
  197. def X86phminpos: SDNode<"X86ISD::PHMINPOS",
  198. SDTypeProfile<1, 1, [SDTCisVT<0, v8i16>, SDTCisVT<1, v8i16>]>>;
  199. def X86vshiftuniform : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  200. SDTCisVec<2>, SDTCisInt<0>,
  201. SDTCisInt<2>]>;
  202. def X86vshl : SDNode<"X86ISD::VSHL", X86vshiftuniform>;
  203. def X86vsrl : SDNode<"X86ISD::VSRL", X86vshiftuniform>;
  204. def X86vsra : SDNode<"X86ISD::VSRA", X86vshiftuniform>;
  205. def X86vshiftvariable : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  206. SDTCisSameAs<0,2>, SDTCisInt<0>]>;
  207. def X86vshlv : SDNode<"X86ISD::VSHLV", X86vshiftvariable>;
  208. def X86vsrlv : SDNode<"X86ISD::VSRLV", X86vshiftvariable>;
  209. def X86vsrav : SDNode<"X86ISD::VSRAV", X86vshiftvariable>;
  210. def X86vshli : SDNode<"X86ISD::VSHLI", X86vshiftimm>;
  211. def X86vsrli : SDNode<"X86ISD::VSRLI", X86vshiftimm>;
  212. def X86vsrai : SDNode<"X86ISD::VSRAI", X86vshiftimm>;
  213. def X86kshiftl : SDNode<"X86ISD::KSHIFTL",
  214. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i1>,
  215. SDTCisSameAs<0, 1>,
  216. SDTCisVT<2, i8>]>>;
  217. def X86kshiftr : SDNode<"X86ISD::KSHIFTR",
  218. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i1>,
  219. SDTCisSameAs<0, 1>,
  220. SDTCisVT<2, i8>]>>;
  221. def X86kadd : SDNode<"X86ISD::KADD", SDTIntBinOp, [SDNPCommutative]>;
  222. def X86vrotli : SDNode<"X86ISD::VROTLI", X86vshiftimm>;
  223. def X86vrotri : SDNode<"X86ISD::VROTRI", X86vshiftimm>;
  224. def X86vpshl : SDNode<"X86ISD::VPSHL", X86vshiftvariable>;
  225. def X86vpsha : SDNode<"X86ISD::VPSHA", X86vshiftvariable>;
  226. def X86vpcom : SDNode<"X86ISD::VPCOM",
  227. SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  228. SDTCisSameAs<0,2>,
  229. SDTCisVT<3, i8>, SDTCisInt<0>]>>;
  230. def X86vpcomu : SDNode<"X86ISD::VPCOMU",
  231. SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  232. SDTCisSameAs<0,2>,
  233. SDTCisVT<3, i8>, SDTCisInt<0>]>>;
  234. def X86vpermil2 : SDNode<"X86ISD::VPERMIL2",
  235. SDTypeProfile<1, 4, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  236. SDTCisSameAs<0,2>,
  237. SDTCisFP<0>, SDTCisInt<3>,
  238. SDTCisSameNumEltsAs<0, 3>,
  239. SDTCisSameSizeAs<0,3>,
  240. SDTCisVT<4, i8>]>>;
  241. def X86vpperm : SDNode<"X86ISD::VPPERM",
  242. SDTypeProfile<1, 3, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>,
  243. SDTCisSameAs<0,2>, SDTCisSameAs<0, 3>]>>;
  244. def SDTX86CmpPTest : SDTypeProfile<1, 2, [SDTCisVT<0, i32>,
  245. SDTCisVec<1>,
  246. SDTCisSameAs<2, 1>]>;
  247. def X86mulhrs : SDNode<"X86ISD::MULHRS", SDTIntBinOp, [SDNPCommutative]>;
  248. def X86avg : SDNode<"X86ISD::AVG" , SDTIntBinOp, [SDNPCommutative]>;
  249. def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
  250. def X86testp : SDNode<"X86ISD::TESTP", SDTX86CmpPTest>;
  251. def X86kortest : SDNode<"X86ISD::KORTEST", SDTX86CmpPTest>;
  252. def X86ktest : SDNode<"X86ISD::KTEST", SDTX86CmpPTest>;
  253. def X86movmsk : SDNode<"X86ISD::MOVMSK",
  254. SDTypeProfile<1, 1, [SDTCisVT<0, i32>, SDTCisVec<1>]>>;
  255. def X86selects : SDNode<"X86ISD::SELECTS",
  256. SDTypeProfile<1, 3, [SDTCisVT<1, v1i1>,
  257. SDTCisSameAs<0, 2>,
  258. SDTCisSameAs<2, 3>]>>;
  259. def X86pmuludq : SDNode<"X86ISD::PMULUDQ",
  260. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i64>,
  261. SDTCisSameAs<0,1>,
  262. SDTCisSameAs<1,2>]>,
  263. [SDNPCommutative]>;
  264. def X86pmuldq : SDNode<"X86ISD::PMULDQ",
  265. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i64>,
  266. SDTCisSameAs<0,1>,
  267. SDTCisSameAs<1,2>]>,
  268. [SDNPCommutative]>;
  269. def X86extrqi : SDNode<"X86ISD::EXTRQI",
  270. SDTypeProfile<1, 3, [SDTCisVT<0, v2i64>, SDTCisSameAs<0,1>,
  271. SDTCisVT<2, i8>, SDTCisVT<3, i8>]>>;
  272. def X86insertqi : SDNode<"X86ISD::INSERTQI",
  273. SDTypeProfile<1, 4, [SDTCisVT<0, v2i64>, SDTCisSameAs<0,1>,
  274. SDTCisSameAs<1,2>, SDTCisVT<3, i8>,
  275. SDTCisVT<4, i8>]>>;
  276. // Specific shuffle nodes - At some point ISD::VECTOR_SHUFFLE will always get
  277. // translated into one of the target nodes below during lowering.
  278. // Note: this is a work in progress...
  279. def SDTShuff1Op : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0,1>]>;
  280. def SDTShuff2Op : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  281. SDTCisSameAs<0,2>]>;
  282. def SDTShuff2OpFP : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisFP<0>,
  283. SDTCisSameAs<0,1>, SDTCisSameAs<0,2>]>;
  284. def SDTShuff2OpM : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  285. SDTCisFP<0>, SDTCisInt<2>,
  286. SDTCisSameNumEltsAs<0,2>,
  287. SDTCisSameSizeAs<0,2>]>;
  288. def SDTShuff2OpI : SDTypeProfile<1, 2, [SDTCisVec<0>,
  289. SDTCisSameAs<0,1>, SDTCisVT<2, i8>]>;
  290. def SDTShuff3OpI : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  291. SDTCisSameAs<0,2>, SDTCisVT<3, i8>]>;
  292. def SDTFPBinOpImm: SDTypeProfile<1, 3, [SDTCisFP<0>, SDTCisVec<0>,
  293. SDTCisSameAs<0,1>,
  294. SDTCisSameAs<0,2>,
  295. SDTCisVT<3, i32>]>;
  296. def SDTFPTernaryOpImm: SDTypeProfile<1, 4, [SDTCisFP<0>, SDTCisSameAs<0,1>,
  297. SDTCisSameAs<0,2>,
  298. SDTCisInt<3>,
  299. SDTCisSameSizeAs<0, 3>,
  300. SDTCisSameNumEltsAs<0, 3>,
  301. SDTCisVT<4, i32>]>;
  302. def SDTFPUnaryOpImm: SDTypeProfile<1, 2, [SDTCisFP<0>,
  303. SDTCisSameAs<0,1>,
  304. SDTCisVT<2, i32>]>;
  305. def SDTVBroadcast : SDTypeProfile<1, 1, [SDTCisVec<0>]>;
  306. def SDTVBroadcastm : SDTypeProfile<1, 1, [SDTCisVec<0>,
  307. SDTCisInt<0>, SDTCisInt<1>]>;
  308. def SDTBlend : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  309. SDTCisSameAs<1,2>, SDTCisVT<3, i8>]>;
  310. def SDTTernlog : SDTypeProfile<1, 4, [SDTCisInt<0>, SDTCisVec<0>,
  311. SDTCisSameAs<0,1>, SDTCisSameAs<0,2>,
  312. SDTCisSameAs<0,3>, SDTCisVT<4, i8>]>;
  313. def SDTFPBinOpRound : SDTypeProfile<1, 3, [ // fadd_round, fmul_round, etc.
  314. SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0>, SDTCisVT<3, i32>]>;
  315. def SDTFPUnaryOpRound : SDTypeProfile<1, 2, [ // fsqrt_round, fgetexp_round, etc.
  316. SDTCisSameAs<0, 1>, SDTCisFP<0>, SDTCisVT<2, i32>]>;
  317. def SDTFmaRound : SDTypeProfile<1, 4, [SDTCisSameAs<0,1>,
  318. SDTCisSameAs<1,2>, SDTCisSameAs<1,3>,
  319. SDTCisFP<0>, SDTCisVT<4, i32>]>;
  320. def X86PAlignr : SDNode<"X86ISD::PALIGNR",
  321. SDTypeProfile<1, 3, [SDTCVecEltisVT<0, i8>,
  322. SDTCisSameAs<0,1>,
  323. SDTCisSameAs<0,2>,
  324. SDTCisVT<3, i8>]>>;
  325. def X86VAlign : SDNode<"X86ISD::VALIGN", SDTShuff3OpI>;
  326. def X86VShld : SDNode<"X86ISD::VSHLD", SDTShuff3OpI>;
  327. def X86VShrd : SDNode<"X86ISD::VSHRD", SDTShuff3OpI>;
  328. def X86VShldv : SDNode<"X86ISD::VSHLDV",
  329. SDTypeProfile<1, 3, [SDTCisVec<0>,
  330. SDTCisSameAs<0,1>,
  331. SDTCisSameAs<0,2>,
  332. SDTCisSameAs<0,3>]>>;
  333. def X86VShrdv : SDNode<"X86ISD::VSHRDV",
  334. SDTypeProfile<1, 3, [SDTCisVec<0>,
  335. SDTCisSameAs<0,1>,
  336. SDTCisSameAs<0,2>,
  337. SDTCisSameAs<0,3>]>>;
  338. def X86Conflict : SDNode<"X86ISD::CONFLICT", SDTIntUnaryOp>;
  339. def X86PShufd : SDNode<"X86ISD::PSHUFD", SDTShuff2OpI>;
  340. def X86PShufhw : SDNode<"X86ISD::PSHUFHW", SDTShuff2OpI>;
  341. def X86PShuflw : SDNode<"X86ISD::PSHUFLW", SDTShuff2OpI>;
  342. def X86Shufp : SDNode<"X86ISD::SHUFP", SDTShuff3OpI>;
  343. def X86Shuf128 : SDNode<"X86ISD::SHUF128", SDTShuff3OpI>;
  344. def X86Movddup : SDNode<"X86ISD::MOVDDUP", SDTShuff1Op>;
  345. def X86Movshdup : SDNode<"X86ISD::MOVSHDUP", SDTShuff1Op>;
  346. def X86Movsldup : SDNode<"X86ISD::MOVSLDUP", SDTShuff1Op>;
  347. def X86Movsd : SDNode<"X86ISD::MOVSD",
  348. SDTypeProfile<1, 2, [SDTCisVT<0, v2f64>,
  349. SDTCisVT<1, v2f64>,
  350. SDTCisVT<2, v2f64>]>>;
  351. def X86Movss : SDNode<"X86ISD::MOVSS",
  352. SDTypeProfile<1, 2, [SDTCisVT<0, v4f32>,
  353. SDTCisVT<1, v4f32>,
  354. SDTCisVT<2, v4f32>]>>;
  355. def X86Movsh : SDNode<"X86ISD::MOVSH",
  356. SDTypeProfile<1, 2, [SDTCisVT<0, v8f16>,
  357. SDTCisVT<1, v8f16>,
  358. SDTCisVT<2, v8f16>]>>;
  359. def X86Movlhps : SDNode<"X86ISD::MOVLHPS",
  360. SDTypeProfile<1, 2, [SDTCisVT<0, v4f32>,
  361. SDTCisVT<1, v4f32>,
  362. SDTCisVT<2, v4f32>]>>;
  363. def X86Movhlps : SDNode<"X86ISD::MOVHLPS",
  364. SDTypeProfile<1, 2, [SDTCisVT<0, v4f32>,
  365. SDTCisVT<1, v4f32>,
  366. SDTCisVT<2, v4f32>]>>;
  367. def SDTPack : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisInt<0>,
  368. SDTCisVec<1>, SDTCisInt<1>,
  369. SDTCisSameSizeAs<0,1>,
  370. SDTCisSameAs<1,2>,
  371. SDTCisOpSmallerThanOp<0, 1>]>;
  372. def X86Packss : SDNode<"X86ISD::PACKSS", SDTPack>;
  373. def X86Packus : SDNode<"X86ISD::PACKUS", SDTPack>;
  374. def X86Unpckl : SDNode<"X86ISD::UNPCKL", SDTShuff2Op>;
  375. def X86Unpckh : SDNode<"X86ISD::UNPCKH", SDTShuff2Op>;
  376. def X86vpmaddubsw : SDNode<"X86ISD::VPMADDUBSW",
  377. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i16>,
  378. SDTCVecEltisVT<1, i8>,
  379. SDTCisSameSizeAs<0,1>,
  380. SDTCisSameAs<1,2>]>>;
  381. def X86vpmaddwd : SDNode<"X86ISD::VPMADDWD",
  382. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i32>,
  383. SDTCVecEltisVT<1, i16>,
  384. SDTCisSameSizeAs<0,1>,
  385. SDTCisSameAs<1,2>]>,
  386. [SDNPCommutative]>;
  387. def X86VPermilpv : SDNode<"X86ISD::VPERMILPV", SDTShuff2OpM>;
  388. def X86VPermilpi : SDNode<"X86ISD::VPERMILPI", SDTShuff2OpI>;
  389. def X86VPermv : SDNode<"X86ISD::VPERMV",
  390. SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisInt<1>,
  391. SDTCisSameNumEltsAs<0,1>,
  392. SDTCisSameSizeAs<0,1>,
  393. SDTCisSameAs<0,2>]>>;
  394. def X86VPermi : SDNode<"X86ISD::VPERMI", SDTShuff2OpI>;
  395. def X86VPermt2 : SDNode<"X86ISD::VPERMV3",
  396. SDTypeProfile<1, 3, [SDTCisVec<0>,
  397. SDTCisSameAs<0,1>, SDTCisInt<2>,
  398. SDTCisVec<2>, SDTCisSameNumEltsAs<0, 2>,
  399. SDTCisSameSizeAs<0,2>,
  400. SDTCisSameAs<0,3>]>, []>;
  401. def X86vpternlog : SDNode<"X86ISD::VPTERNLOG", SDTTernlog>;
  402. def X86VPerm2x128 : SDNode<"X86ISD::VPERM2X128", SDTShuff3OpI>;
  403. def X86VFixupimm : SDNode<"X86ISD::VFIXUPIMM", SDTFPTernaryOpImm>;
  404. def X86VFixupimmSAE : SDNode<"X86ISD::VFIXUPIMM_SAE", SDTFPTernaryOpImm>;
  405. def X86VFixupimms : SDNode<"X86ISD::VFIXUPIMMS", SDTFPTernaryOpImm>;
  406. def X86VFixupimmSAEs : SDNode<"X86ISD::VFIXUPIMMS_SAE", SDTFPTernaryOpImm>;
  407. def X86VRange : SDNode<"X86ISD::VRANGE", SDTFPBinOpImm>;
  408. def X86VRangeSAE : SDNode<"X86ISD::VRANGE_SAE", SDTFPBinOpImm>;
  409. def X86VReduce : SDNode<"X86ISD::VREDUCE", SDTFPUnaryOpImm>;
  410. def X86VReduceSAE : SDNode<"X86ISD::VREDUCE_SAE", SDTFPUnaryOpImm>;
  411. def X86VRndScale : SDNode<"X86ISD::VRNDSCALE", SDTFPUnaryOpImm>;
  412. def X86strict_VRndScale : SDNode<"X86ISD::STRICT_VRNDSCALE", SDTFPUnaryOpImm,
  413. [SDNPHasChain]>;
  414. def X86any_VRndScale : PatFrags<(ops node:$src1, node:$src2),
  415. [(X86strict_VRndScale node:$src1, node:$src2),
  416. (X86VRndScale node:$src1, node:$src2)]>;
  417. def X86VRndScaleSAE: SDNode<"X86ISD::VRNDSCALE_SAE", SDTFPUnaryOpImm>;
  418. def X86VGetMant : SDNode<"X86ISD::VGETMANT", SDTFPUnaryOpImm>;
  419. def X86VGetMantSAE : SDNode<"X86ISD::VGETMANT_SAE", SDTFPUnaryOpImm>;
  420. def X86Vfpclass : SDNode<"X86ISD::VFPCLASS",
  421. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i1>,
  422. SDTCisFP<1>,
  423. SDTCisSameNumEltsAs<0,1>,
  424. SDTCisVT<2, i32>]>, []>;
  425. def X86Vfpclasss : SDNode<"X86ISD::VFPCLASSS",
  426. SDTypeProfile<1, 2, [SDTCisVT<0, v1i1>,
  427. SDTCisFP<1>, SDTCisVT<2, i32>]>,[]>;
  428. def X86VBroadcast : SDNode<"X86ISD::VBROADCAST", SDTVBroadcast>;
  429. def X86VBroadcastm : SDNode<"X86ISD::VBROADCASTM", SDTVBroadcastm>;
  430. def X86Blendi : SDNode<"X86ISD::BLENDI", SDTBlend>;
  431. def X86Blendv : SDNode<"X86ISD::BLENDV",
  432. SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisInt<1>,
  433. SDTCisSameAs<0, 2>,
  434. SDTCisSameAs<2, 3>,
  435. SDTCisSameNumEltsAs<0, 1>,
  436. SDTCisSameSizeAs<0, 1>]>>;
  437. def X86Addsub : SDNode<"X86ISD::ADDSUB", SDTFPBinOp>;
  438. def X86faddRnd : SDNode<"X86ISD::FADD_RND", SDTFPBinOpRound>;
  439. def X86fadds : SDNode<"X86ISD::FADDS", SDTFPBinOp>;
  440. def X86faddRnds : SDNode<"X86ISD::FADDS_RND", SDTFPBinOpRound>;
  441. def X86fsubRnd : SDNode<"X86ISD::FSUB_RND", SDTFPBinOpRound>;
  442. def X86fsubs : SDNode<"X86ISD::FSUBS", SDTFPBinOp>;
  443. def X86fsubRnds : SDNode<"X86ISD::FSUBS_RND", SDTFPBinOpRound>;
  444. def X86fmulRnd : SDNode<"X86ISD::FMUL_RND", SDTFPBinOpRound>;
  445. def X86fmuls : SDNode<"X86ISD::FMULS", SDTFPBinOp>;
  446. def X86fmulRnds : SDNode<"X86ISD::FMULS_RND", SDTFPBinOpRound>;
  447. def X86fdivRnd : SDNode<"X86ISD::FDIV_RND", SDTFPBinOpRound>;
  448. def X86fdivs : SDNode<"X86ISD::FDIVS", SDTFPBinOp>;
  449. def X86fdivRnds : SDNode<"X86ISD::FDIVS_RND", SDTFPBinOpRound>;
  450. def X86fmaxSAE : SDNode<"X86ISD::FMAX_SAE", SDTFPBinOp>;
  451. def X86fmaxSAEs : SDNode<"X86ISD::FMAXS_SAE", SDTFPBinOp>;
  452. def X86fminSAE : SDNode<"X86ISD::FMIN_SAE", SDTFPBinOp>;
  453. def X86fminSAEs : SDNode<"X86ISD::FMINS_SAE", SDTFPBinOp>;
  454. def X86scalef : SDNode<"X86ISD::SCALEF", SDTFPBinOp>;
  455. def X86scalefRnd : SDNode<"X86ISD::SCALEF_RND", SDTFPBinOpRound>;
  456. def X86scalefs : SDNode<"X86ISD::SCALEFS", SDTFPBinOp>;
  457. def X86scalefsRnd: SDNode<"X86ISD::SCALEFS_RND", SDTFPBinOpRound>;
  458. def X86fsqrtRnd : SDNode<"X86ISD::FSQRT_RND", SDTFPUnaryOpRound>;
  459. def X86fsqrts : SDNode<"X86ISD::FSQRTS", SDTFPBinOp>;
  460. def X86fsqrtRnds : SDNode<"X86ISD::FSQRTS_RND", SDTFPBinOpRound>;
  461. def X86fgetexp : SDNode<"X86ISD::FGETEXP", SDTFPUnaryOp>;
  462. def X86fgetexpSAE : SDNode<"X86ISD::FGETEXP_SAE", SDTFPUnaryOp>;
  463. def X86fgetexps : SDNode<"X86ISD::FGETEXPS", SDTFPBinOp>;
  464. def X86fgetexpSAEs : SDNode<"X86ISD::FGETEXPS_SAE", SDTFPBinOp>;
  465. def X86Fnmadd : SDNode<"X86ISD::FNMADD", SDTFPTernaryOp, [SDNPCommutative]>;
  466. def X86strict_Fnmadd : SDNode<"X86ISD::STRICT_FNMADD", SDTFPTernaryOp, [SDNPCommutative, SDNPHasChain]>;
  467. def X86any_Fnmadd : PatFrags<(ops node:$src1, node:$src2, node:$src3),
  468. [(X86strict_Fnmadd node:$src1, node:$src2, node:$src3),
  469. (X86Fnmadd node:$src1, node:$src2, node:$src3)]>;
  470. def X86Fmsub : SDNode<"X86ISD::FMSUB", SDTFPTernaryOp, [SDNPCommutative]>;
  471. def X86strict_Fmsub : SDNode<"X86ISD::STRICT_FMSUB", SDTFPTernaryOp, [SDNPCommutative, SDNPHasChain]>;
  472. def X86any_Fmsub : PatFrags<(ops node:$src1, node:$src2, node:$src3),
  473. [(X86strict_Fmsub node:$src1, node:$src2, node:$src3),
  474. (X86Fmsub node:$src1, node:$src2, node:$src3)]>;
  475. def X86Fnmsub : SDNode<"X86ISD::FNMSUB", SDTFPTernaryOp, [SDNPCommutative]>;
  476. def X86strict_Fnmsub : SDNode<"X86ISD::STRICT_FNMSUB", SDTFPTernaryOp, [SDNPCommutative, SDNPHasChain]>;
  477. def X86any_Fnmsub : PatFrags<(ops node:$src1, node:$src2, node:$src3),
  478. [(X86strict_Fnmsub node:$src1, node:$src2, node:$src3),
  479. (X86Fnmsub node:$src1, node:$src2, node:$src3)]>;
  480. def X86Fmaddsub : SDNode<"X86ISD::FMADDSUB", SDTFPTernaryOp, [SDNPCommutative]>;
  481. def X86Fmsubadd : SDNode<"X86ISD::FMSUBADD", SDTFPTernaryOp, [SDNPCommutative]>;
  482. def X86FmaddRnd : SDNode<"X86ISD::FMADD_RND", SDTFmaRound, [SDNPCommutative]>;
  483. def X86FnmaddRnd : SDNode<"X86ISD::FNMADD_RND", SDTFmaRound, [SDNPCommutative]>;
  484. def X86FmsubRnd : SDNode<"X86ISD::FMSUB_RND", SDTFmaRound, [SDNPCommutative]>;
  485. def X86FnmsubRnd : SDNode<"X86ISD::FNMSUB_RND", SDTFmaRound, [SDNPCommutative]>;
  486. def X86FmaddsubRnd : SDNode<"X86ISD::FMADDSUB_RND", SDTFmaRound, [SDNPCommutative]>;
  487. def X86FmsubaddRnd : SDNode<"X86ISD::FMSUBADD_RND", SDTFmaRound, [SDNPCommutative]>;
  488. def X86vp2intersect : SDNode<"X86ISD::VP2INTERSECT",
  489. SDTypeProfile<1, 2, [SDTCisVT<0, untyped>,
  490. SDTCisVec<1>, SDTCisSameAs<1, 2>]>>;
  491. def SDTIFma : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<0,1>,
  492. SDTCisSameAs<1,2>, SDTCisSameAs<1,3>]>;
  493. def x86vpmadd52l : SDNode<"X86ISD::VPMADD52L", SDTIFma, [SDNPCommutative]>;
  494. def x86vpmadd52h : SDNode<"X86ISD::VPMADD52H", SDTIFma, [SDNPCommutative]>;
  495. def x86vfmaddc : SDNode<"X86ISD::VFMADDC", SDTFPTernaryOp, [SDNPCommutative]>;
  496. def x86vfmaddcRnd : SDNode<"X86ISD::VFMADDC_RND", SDTFmaRound, [SDNPCommutative]>;
  497. def x86vfcmaddc : SDNode<"X86ISD::VFCMADDC", SDTFPTernaryOp>;
  498. def x86vfcmaddcRnd : SDNode<"X86ISD::VFCMADDC_RND", SDTFmaRound>;
  499. def x86vfmulc : SDNode<"X86ISD::VFMULC", SDTFPBinOp, [SDNPCommutative]>;
  500. def x86vfmulcRnd : SDNode<"X86ISD::VFMULC_RND", SDTFPBinOpRound, [SDNPCommutative]>;
  501. def x86vfcmulc : SDNode<"X86ISD::VFCMULC", SDTFPBinOp>;
  502. def x86vfcmulcRnd : SDNode<"X86ISD::VFCMULC_RND", SDTFPBinOpRound>;
  503. def x86vfmaddcSh : SDNode<"X86ISD::VFMADDCSH", SDTFPTernaryOp, [SDNPCommutative]>;
  504. def x86vfcmaddcSh : SDNode<"X86ISD::VFCMADDCSH", SDTFPTernaryOp>;
  505. def x86vfmulcSh : SDNode<"X86ISD::VFMULCSH", SDTFPBinOp, [SDNPCommutative]>;
  506. def x86vfcmulcSh : SDNode<"X86ISD::VFCMULCSH", SDTFPBinOp>;
  507. def x86vfmaddcShRnd : SDNode<"X86ISD::VFMADDCSH_RND", SDTFmaRound, [SDNPCommutative]>;
  508. def x86vfcmaddcShRnd : SDNode<"X86ISD::VFCMADDCSH_RND",SDTFmaRound>;
  509. def x86vfmulcShRnd : SDNode<"X86ISD::VFMULCSH_RND", SDTFPBinOpRound, [SDNPCommutative]>;
  510. def x86vfcmulcShRnd : SDNode<"X86ISD::VFCMULCSH_RND", SDTFPBinOpRound>;
  511. def X86rsqrt14 : SDNode<"X86ISD::RSQRT14", SDTFPUnaryOp>;
  512. def X86rcp14 : SDNode<"X86ISD::RCP14", SDTFPUnaryOp>;
  513. // VNNI
  514. def SDTVnni : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
  515. SDTCisSameAs<1,2>, SDTCisSameAs<1,3>]>;
  516. def X86Vpdpbusd : SDNode<"X86ISD::VPDPBUSD", SDTVnni>;
  517. def X86Vpdpbusds : SDNode<"X86ISD::VPDPBUSDS", SDTVnni>;
  518. def X86Vpdpwssd : SDNode<"X86ISD::VPDPWSSD", SDTVnni>;
  519. def X86Vpdpwssds : SDNode<"X86ISD::VPDPWSSDS", SDTVnni>;
  520. def X86rsqrt28 : SDNode<"X86ISD::RSQRT28", SDTFPUnaryOp>;
  521. def X86rsqrt28SAE: SDNode<"X86ISD::RSQRT28_SAE", SDTFPUnaryOp>;
  522. def X86rcp28 : SDNode<"X86ISD::RCP28", SDTFPUnaryOp>;
  523. def X86rcp28SAE : SDNode<"X86ISD::RCP28_SAE", SDTFPUnaryOp>;
  524. def X86exp2 : SDNode<"X86ISD::EXP2", SDTFPUnaryOp>;
  525. def X86exp2SAE : SDNode<"X86ISD::EXP2_SAE", SDTFPUnaryOp>;
  526. def X86rsqrt14s : SDNode<"X86ISD::RSQRT14S", SDTFPBinOp>;
  527. def X86rcp14s : SDNode<"X86ISD::RCP14S", SDTFPBinOp>;
  528. def X86rsqrt28s : SDNode<"X86ISD::RSQRT28S", SDTFPBinOp>;
  529. def X86rsqrt28SAEs : SDNode<"X86ISD::RSQRT28S_SAE", SDTFPBinOp>;
  530. def X86rcp28s : SDNode<"X86ISD::RCP28S", SDTFPBinOp>;
  531. def X86rcp28SAEs : SDNode<"X86ISD::RCP28S_SAE", SDTFPBinOp>;
  532. def X86Ranges : SDNode<"X86ISD::VRANGES", SDTFPBinOpImm>;
  533. def X86RndScales : SDNode<"X86ISD::VRNDSCALES", SDTFPBinOpImm>;
  534. def X86Reduces : SDNode<"X86ISD::VREDUCES", SDTFPBinOpImm>;
  535. def X86GetMants : SDNode<"X86ISD::VGETMANTS", SDTFPBinOpImm>;
  536. def X86RangesSAE : SDNode<"X86ISD::VRANGES_SAE", SDTFPBinOpImm>;
  537. def X86RndScalesSAE : SDNode<"X86ISD::VRNDSCALES_SAE", SDTFPBinOpImm>;
  538. def X86ReducesSAE : SDNode<"X86ISD::VREDUCES_SAE", SDTFPBinOpImm>;
  539. def X86GetMantsSAE : SDNode<"X86ISD::VGETMANTS_SAE", SDTFPBinOpImm>;
  540. def X86compress: SDNode<"X86ISD::COMPRESS", SDTypeProfile<1, 3,
  541. [SDTCisSameAs<0, 1>, SDTCisVec<1>,
  542. SDTCisSameAs<0, 2>, SDTCVecEltisVT<3, i1>,
  543. SDTCisSameNumEltsAs<0, 3>]>, []>;
  544. def X86expand : SDNode<"X86ISD::EXPAND", SDTypeProfile<1, 3,
  545. [SDTCisSameAs<0, 1>, SDTCisVec<1>,
  546. SDTCisSameAs<0, 2>, SDTCVecEltisVT<3, i1>,
  547. SDTCisSameNumEltsAs<0, 3>]>, []>;
  548. // vpshufbitqmb
  549. def X86Vpshufbitqmb : SDNode<"X86ISD::VPSHUFBITQMB",
  550. SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
  551. SDTCisSameAs<1,2>,
  552. SDTCVecEltisVT<0,i1>,
  553. SDTCisSameNumEltsAs<0,1>]>>;
  554. def SDTintToFP: SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisFP<0>,
  555. SDTCisSameAs<0,1>, SDTCisInt<2>]>;
  556. def SDTintToFPRound: SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisFP<0>,
  557. SDTCisSameAs<0,1>, SDTCisInt<2>,
  558. SDTCisVT<3, i32>]>;
  559. def SDTFloatToInt: SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
  560. SDTCisInt<0>, SDTCisFP<1>]>;
  561. def SDTFloatToIntRnd: SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
  562. SDTCisInt<0>, SDTCisFP<1>,
  563. SDTCisVT<2, i32>]>;
  564. def SDTSFloatToInt: SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisFP<1>,
  565. SDTCisVec<1>]>;
  566. def SDTSFloatToIntRnd: SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisFP<1>,
  567. SDTCisVec<1>, SDTCisVT<2, i32>]>;
  568. def SDTVintToFP: SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
  569. SDTCisFP<0>, SDTCisInt<1>]>;
  570. def SDTVintToFPRound: SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
  571. SDTCisFP<0>, SDTCisInt<1>,
  572. SDTCisVT<2, i32>]>;
  573. // Scalar
  574. def X86SintToFp : SDNode<"X86ISD::SCALAR_SINT_TO_FP", SDTintToFP>;
  575. def X86SintToFpRnd : SDNode<"X86ISD::SCALAR_SINT_TO_FP_RND", SDTintToFPRound>;
  576. def X86UintToFp : SDNode<"X86ISD::SCALAR_UINT_TO_FP", SDTintToFP>;
  577. def X86UintToFpRnd : SDNode<"X86ISD::SCALAR_UINT_TO_FP_RND", SDTintToFPRound>;
  578. def X86cvtts2Int : SDNode<"X86ISD::CVTTS2SI", SDTSFloatToInt>;
  579. def X86cvtts2UInt : SDNode<"X86ISD::CVTTS2UI", SDTSFloatToInt>;
  580. def X86cvtts2IntSAE : SDNode<"X86ISD::CVTTS2SI_SAE", SDTSFloatToInt>;
  581. def X86cvtts2UIntSAE : SDNode<"X86ISD::CVTTS2UI_SAE", SDTSFloatToInt>;
  582. def X86cvts2si : SDNode<"X86ISD::CVTS2SI", SDTSFloatToInt>;
  583. def X86cvts2usi : SDNode<"X86ISD::CVTS2UI", SDTSFloatToInt>;
  584. def X86cvts2siRnd : SDNode<"X86ISD::CVTS2SI_RND", SDTSFloatToIntRnd>;
  585. def X86cvts2usiRnd : SDNode<"X86ISD::CVTS2UI_RND", SDTSFloatToIntRnd>;
  586. // Vector with rounding mode
  587. // cvtt fp-to-int staff
  588. def X86cvttp2siSAE : SDNode<"X86ISD::CVTTP2SI_SAE", SDTFloatToInt>;
  589. def X86cvttp2uiSAE : SDNode<"X86ISD::CVTTP2UI_SAE", SDTFloatToInt>;
  590. def X86VSintToFpRnd : SDNode<"X86ISD::SINT_TO_FP_RND", SDTVintToFPRound>;
  591. def X86VUintToFpRnd : SDNode<"X86ISD::UINT_TO_FP_RND", SDTVintToFPRound>;
  592. // cvt fp-to-int staff
  593. def X86cvtp2IntRnd : SDNode<"X86ISD::CVTP2SI_RND", SDTFloatToIntRnd>;
  594. def X86cvtp2UIntRnd : SDNode<"X86ISD::CVTP2UI_RND", SDTFloatToIntRnd>;
  595. // Vector without rounding mode
  596. // cvtt fp-to-int staff
  597. def X86cvttp2si : SDNode<"X86ISD::CVTTP2SI", SDTFloatToInt>;
  598. def X86cvttp2ui : SDNode<"X86ISD::CVTTP2UI", SDTFloatToInt>;
  599. def X86strict_cvttp2si : SDNode<"X86ISD::STRICT_CVTTP2SI", SDTFloatToInt, [SDNPHasChain]>;
  600. def X86strict_cvttp2ui : SDNode<"X86ISD::STRICT_CVTTP2UI", SDTFloatToInt, [SDNPHasChain]>;
  601. def X86any_cvttp2si : PatFrags<(ops node:$src),
  602. [(X86strict_cvttp2si node:$src),
  603. (X86cvttp2si node:$src)]>;
  604. def X86any_cvttp2ui : PatFrags<(ops node:$src),
  605. [(X86strict_cvttp2ui node:$src),
  606. (X86cvttp2ui node:$src)]>;
  607. def X86VSintToFP : SDNode<"X86ISD::CVTSI2P", SDTVintToFP>;
  608. def X86VUintToFP : SDNode<"X86ISD::CVTUI2P", SDTVintToFP>;
  609. def X86strict_VSintToFP : SDNode<"X86ISD::STRICT_CVTSI2P", SDTVintToFP, [SDNPHasChain]>;
  610. def X86strict_VUintToFP : SDNode<"X86ISD::STRICT_CVTUI2P", SDTVintToFP, [SDNPHasChain]>;
  611. def X86any_VSintToFP : PatFrags<(ops node:$src),
  612. [(X86strict_VSintToFP node:$src),
  613. (X86VSintToFP node:$src)]>;
  614. def X86any_VUintToFP : PatFrags<(ops node:$src),
  615. [(X86strict_VUintToFP node:$src),
  616. (X86VUintToFP node:$src)]>;
  617. // cvt int-to-fp staff
  618. def X86cvtp2Int : SDNode<"X86ISD::CVTP2SI", SDTFloatToInt>;
  619. def X86cvtp2UInt : SDNode<"X86ISD::CVTP2UI", SDTFloatToInt>;
  620. // Masked versions of above
  621. def SDTMVintToFP: SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisVec<1>,
  622. SDTCisFP<0>, SDTCisInt<1>,
  623. SDTCisSameAs<0, 2>,
  624. SDTCVecEltisVT<3, i1>,
  625. SDTCisSameNumEltsAs<1, 3>]>;
  626. def SDTMFloatToInt: SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisVec<1>,
  627. SDTCisInt<0>, SDTCisFP<1>,
  628. SDTCisSameSizeAs<0, 1>,
  629. SDTCisSameAs<0, 2>,
  630. SDTCVecEltisVT<3, i1>,
  631. SDTCisSameNumEltsAs<1, 3>]>;
  632. def X86VMSintToFP : SDNode<"X86ISD::MCVTSI2P", SDTMVintToFP>;
  633. def X86VMUintToFP : SDNode<"X86ISD::MCVTUI2P", SDTMVintToFP>;
  634. def X86mcvtp2Int : SDNode<"X86ISD::MCVTP2SI", SDTMFloatToInt>;
  635. def X86mcvtp2UInt : SDNode<"X86ISD::MCVTP2UI", SDTMFloatToInt>;
  636. def X86mcvttp2si : SDNode<"X86ISD::MCVTTP2SI", SDTMFloatToInt>;
  637. def X86mcvttp2ui : SDNode<"X86ISD::MCVTTP2UI", SDTMFloatToInt>;
  638. def SDTcvtph2ps : SDTypeProfile<1, 1, [SDTCVecEltisVT<0, f32>,
  639. SDTCVecEltisVT<1, i16>]>;
  640. def X86cvtph2ps : SDNode<"X86ISD::CVTPH2PS", SDTcvtph2ps>;
  641. def X86strict_cvtph2ps : SDNode<"X86ISD::STRICT_CVTPH2PS", SDTcvtph2ps,
  642. [SDNPHasChain]>;
  643. def X86any_cvtph2ps : PatFrags<(ops node:$src),
  644. [(X86strict_cvtph2ps node:$src),
  645. (X86cvtph2ps node:$src)]>;
  646. def X86cvtph2psSAE : SDNode<"X86ISD::CVTPH2PS_SAE", SDTcvtph2ps>;
  647. def SDTcvtps2ph : SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i16>,
  648. SDTCVecEltisVT<1, f32>,
  649. SDTCisVT<2, i32>]>;
  650. def X86cvtps2ph : SDNode<"X86ISD::CVTPS2PH", SDTcvtps2ph>;
  651. def X86strict_cvtps2ph : SDNode<"X86ISD::STRICT_CVTPS2PH", SDTcvtps2ph,
  652. [SDNPHasChain]>;
  653. def X86any_cvtps2ph : PatFrags<(ops node:$src1, node:$src2),
  654. [(X86strict_cvtps2ph node:$src1, node:$src2),
  655. (X86cvtps2ph node:$src1, node:$src2)]>;
  656. def X86mcvtps2ph : SDNode<"X86ISD::MCVTPS2PH",
  657. SDTypeProfile<1, 4, [SDTCVecEltisVT<0, i16>,
  658. SDTCVecEltisVT<1, f32>,
  659. SDTCisVT<2, i32>,
  660. SDTCisSameAs<0, 3>,
  661. SDTCVecEltisVT<4, i1>,
  662. SDTCisSameNumEltsAs<1, 4>]> >;
  663. def X86vfpextSAE : SDNode<"X86ISD::VFPEXT_SAE",
  664. SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVec<0>,
  665. SDTCisFP<1>, SDTCisVec<1>,
  666. SDTCisOpSmallerThanOp<1, 0>]>>;
  667. def X86vfproundRnd: SDNode<"X86ISD::VFPROUND_RND",
  668. SDTypeProfile<1, 2, [SDTCisFP<0>, SDTCisVec<0>,
  669. SDTCisFP<1>, SDTCisVec<1>,
  670. SDTCisOpSmallerThanOp<0, 1>,
  671. SDTCisVT<2, i32>]>>;
  672. // cvt fp to bfloat16
  673. def X86cvtne2ps2bf16 : SDNode<"X86ISD::CVTNE2PS2BF16",
  674. SDTypeProfile<1, 2, [SDTCVecEltisVT<0, i16>,
  675. SDTCVecEltisVT<1, f32>,
  676. SDTCisSameSizeAs<0,1>,
  677. SDTCisSameAs<1,2>]>>;
  678. def X86mcvtneps2bf16 : SDNode<"X86ISD::MCVTNEPS2BF16",
  679. SDTypeProfile<1, 3, [SDTCVecEltisVT<0, i16>,
  680. SDTCVecEltisVT<1, f32>,
  681. SDTCisSameAs<0, 2>,
  682. SDTCVecEltisVT<3, i1>,
  683. SDTCisSameNumEltsAs<1, 3>]>>;
  684. def X86cvtneps2bf16 : SDNode<"X86ISD::CVTNEPS2BF16",
  685. SDTypeProfile<1, 1, [SDTCVecEltisVT<0, i16>,
  686. SDTCVecEltisVT<1, f32>]>>;
  687. def X86dpbf16ps : SDNode<"X86ISD::DPBF16PS",
  688. SDTypeProfile<1, 3, [SDTCVecEltisVT<0, f32>,
  689. SDTCisSameAs<0,1>,
  690. SDTCVecEltisVT<2, i32>,
  691. SDTCisSameAs<2,3>]>>;
  692. // galois field arithmetic
  693. def X86GF2P8affineinvqb : SDNode<"X86ISD::GF2P8AFFINEINVQB", SDTBlend>;
  694. def X86GF2P8affineqb : SDNode<"X86ISD::GF2P8AFFINEQB", SDTBlend>;
  695. def X86GF2P8mulb : SDNode<"X86ISD::GF2P8MULB", SDTIntBinOp>;
  696. def SDTX86MaskedStore: SDTypeProfile<0, 3, [ // masked store
  697. SDTCisVec<0>, SDTCisPtrTy<1>, SDTCisVec<2>, SDTCisSameNumEltsAs<0, 2>
  698. ]>;
  699. //===----------------------------------------------------------------------===//
  700. // SSE pattern fragments
  701. //===----------------------------------------------------------------------===//
  702. // 128-bit load pattern fragments
  703. def loadv8f16 : PatFrag<(ops node:$ptr), (v8f16 (load node:$ptr))>;
  704. def loadv4f32 : PatFrag<(ops node:$ptr), (v4f32 (load node:$ptr))>;
  705. def loadv2f64 : PatFrag<(ops node:$ptr), (v2f64 (load node:$ptr))>;
  706. def loadv2i64 : PatFrag<(ops node:$ptr), (v2i64 (load node:$ptr))>;
  707. def loadv4i32 : PatFrag<(ops node:$ptr), (v4i32 (load node:$ptr))>;
  708. def loadv8i16 : PatFrag<(ops node:$ptr), (v8i16 (load node:$ptr))>;
  709. def loadv16i8 : PatFrag<(ops node:$ptr), (v16i8 (load node:$ptr))>;
  710. // 256-bit load pattern fragments
  711. def loadv16f16 : PatFrag<(ops node:$ptr), (v16f16 (load node:$ptr))>;
  712. def loadv8f32 : PatFrag<(ops node:$ptr), (v8f32 (load node:$ptr))>;
  713. def loadv4f64 : PatFrag<(ops node:$ptr), (v4f64 (load node:$ptr))>;
  714. def loadv4i64 : PatFrag<(ops node:$ptr), (v4i64 (load node:$ptr))>;
  715. def loadv8i32 : PatFrag<(ops node:$ptr), (v8i32 (load node:$ptr))>;
  716. def loadv16i16 : PatFrag<(ops node:$ptr), (v16i16 (load node:$ptr))>;
  717. def loadv32i8 : PatFrag<(ops node:$ptr), (v32i8 (load node:$ptr))>;
  718. // 512-bit load pattern fragments
  719. def loadv32f16 : PatFrag<(ops node:$ptr), (v32f16 (load node:$ptr))>;
  720. def loadv16f32 : PatFrag<(ops node:$ptr), (v16f32 (load node:$ptr))>;
  721. def loadv8f64 : PatFrag<(ops node:$ptr), (v8f64 (load node:$ptr))>;
  722. def loadv8i64 : PatFrag<(ops node:$ptr), (v8i64 (load node:$ptr))>;
  723. def loadv16i32 : PatFrag<(ops node:$ptr), (v16i32 (load node:$ptr))>;
  724. def loadv32i16 : PatFrag<(ops node:$ptr), (v32i16 (load node:$ptr))>;
  725. def loadv64i8 : PatFrag<(ops node:$ptr), (v64i8 (load node:$ptr))>;
  726. // 128-/256-/512-bit extload pattern fragments
  727. def extloadv2f32 : PatFrag<(ops node:$ptr), (extloadvf32 node:$ptr)>;
  728. def extloadv4f32 : PatFrag<(ops node:$ptr), (extloadvf32 node:$ptr)>;
  729. def extloadv8f32 : PatFrag<(ops node:$ptr), (extloadvf32 node:$ptr)>;
  730. def extloadv2f16 : PatFrag<(ops node:$ptr), (extloadvf16 node:$ptr)>;
  731. def extloadv4f16 : PatFrag<(ops node:$ptr), (extloadvf16 node:$ptr)>;
  732. def extloadv8f16 : PatFrag<(ops node:$ptr), (extloadvf16 node:$ptr)>;
  733. def extloadv16f16 : PatFrag<(ops node:$ptr), (extloadvf16 node:$ptr)>;
  734. // Like 'store', but always requires vector size alignment.
  735. def alignedstore : PatFrag<(ops node:$val, node:$ptr),
  736. (store node:$val, node:$ptr), [{
  737. auto *St = cast<StoreSDNode>(N);
  738. return St->getAlignment() >= St->getMemoryVT().getStoreSize();
  739. }]>;
  740. // Like 'load', but always requires vector size alignment.
  741. def alignedload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
  742. auto *Ld = cast<LoadSDNode>(N);
  743. return Ld->getAlignment() >= Ld->getMemoryVT().getStoreSize();
  744. }]>;
  745. // 128-bit aligned load pattern fragments
  746. // NOTE: all 128-bit integer vector loads are promoted to v2i64
  747. def alignedloadv8f16 : PatFrag<(ops node:$ptr),
  748. (v8f16 (alignedload node:$ptr))>;
  749. def alignedloadv4f32 : PatFrag<(ops node:$ptr),
  750. (v4f32 (alignedload node:$ptr))>;
  751. def alignedloadv2f64 : PatFrag<(ops node:$ptr),
  752. (v2f64 (alignedload node:$ptr))>;
  753. def alignedloadv2i64 : PatFrag<(ops node:$ptr),
  754. (v2i64 (alignedload node:$ptr))>;
  755. def alignedloadv4i32 : PatFrag<(ops node:$ptr),
  756. (v4i32 (alignedload node:$ptr))>;
  757. def alignedloadv8i16 : PatFrag<(ops node:$ptr),
  758. (v8i16 (alignedload node:$ptr))>;
  759. def alignedloadv16i8 : PatFrag<(ops node:$ptr),
  760. (v16i8 (alignedload node:$ptr))>;
  761. // 256-bit aligned load pattern fragments
  762. // NOTE: all 256-bit integer vector loads are promoted to v4i64
  763. def alignedloadv16f16 : PatFrag<(ops node:$ptr),
  764. (v16f16 (alignedload node:$ptr))>;
  765. def alignedloadv8f32 : PatFrag<(ops node:$ptr),
  766. (v8f32 (alignedload node:$ptr))>;
  767. def alignedloadv4f64 : PatFrag<(ops node:$ptr),
  768. (v4f64 (alignedload node:$ptr))>;
  769. def alignedloadv4i64 : PatFrag<(ops node:$ptr),
  770. (v4i64 (alignedload node:$ptr))>;
  771. def alignedloadv8i32 : PatFrag<(ops node:$ptr),
  772. (v8i32 (alignedload node:$ptr))>;
  773. def alignedloadv16i16 : PatFrag<(ops node:$ptr),
  774. (v16i16 (alignedload node:$ptr))>;
  775. def alignedloadv32i8 : PatFrag<(ops node:$ptr),
  776. (v32i8 (alignedload node:$ptr))>;
  777. // 512-bit aligned load pattern fragments
  778. def alignedloadv32f16 : PatFrag<(ops node:$ptr),
  779. (v32f16 (alignedload node:$ptr))>;
  780. def alignedloadv16f32 : PatFrag<(ops node:$ptr),
  781. (v16f32 (alignedload node:$ptr))>;
  782. def alignedloadv8f64 : PatFrag<(ops node:$ptr),
  783. (v8f64 (alignedload node:$ptr))>;
  784. def alignedloadv8i64 : PatFrag<(ops node:$ptr),
  785. (v8i64 (alignedload node:$ptr))>;
  786. def alignedloadv16i32 : PatFrag<(ops node:$ptr),
  787. (v16i32 (alignedload node:$ptr))>;
  788. def alignedloadv32i16 : PatFrag<(ops node:$ptr),
  789. (v32i16 (alignedload node:$ptr))>;
  790. def alignedloadv64i8 : PatFrag<(ops node:$ptr),
  791. (v64i8 (alignedload node:$ptr))>;
  792. // Like 'load', but uses special alignment checks suitable for use in
  793. // memory operands in most SSE instructions, which are required to
  794. // be naturally aligned on some targets but not on others. If the subtarget
  795. // allows unaligned accesses, match any load, though this may require
  796. // setting a feature bit in the processor (on startup, for example).
  797. // Opteron 10h and later implement such a feature.
  798. def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{
  799. auto *Ld = cast<LoadSDNode>(N);
  800. return Subtarget->hasSSEUnalignedMem() ||
  801. Ld->getAlignment() >= Ld->getMemoryVT().getStoreSize();
  802. }]>;
  803. // 128-bit memop pattern fragments
  804. // NOTE: all 128-bit integer vector loads are promoted to v2i64
  805. def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>;
  806. def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>;
  807. def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>;
  808. def memopv4i32 : PatFrag<(ops node:$ptr), (v4i32 (memop node:$ptr))>;
  809. def memopv8i16 : PatFrag<(ops node:$ptr), (v8i16 (memop node:$ptr))>;
  810. def memopv16i8 : PatFrag<(ops node:$ptr), (v16i8 (memop node:$ptr))>;
  811. // 128-bit bitconvert pattern fragments
  812. def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>;
  813. def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>;
  814. def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>;
  815. def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>;
  816. def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>;
  817. def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>;
  818. // 256-bit bitconvert pattern fragments
  819. def bc_v32i8 : PatFrag<(ops node:$in), (v32i8 (bitconvert node:$in))>;
  820. def bc_v16i16 : PatFrag<(ops node:$in), (v16i16 (bitconvert node:$in))>;
  821. def bc_v8i32 : PatFrag<(ops node:$in), (v8i32 (bitconvert node:$in))>;
  822. def bc_v4i64 : PatFrag<(ops node:$in), (v4i64 (bitconvert node:$in))>;
  823. def bc_v8f32 : PatFrag<(ops node:$in), (v8f32 (bitconvert node:$in))>;
  824. def bc_v4f64 : PatFrag<(ops node:$in), (v4f64 (bitconvert node:$in))>;
  825. // 512-bit bitconvert pattern fragments
  826. def bc_v64i8 : PatFrag<(ops node:$in), (v64i8 (bitconvert node:$in))>;
  827. def bc_v32i16 : PatFrag<(ops node:$in), (v32i16 (bitconvert node:$in))>;
  828. def bc_v16i32 : PatFrag<(ops node:$in), (v16i32 (bitconvert node:$in))>;
  829. def bc_v8i64 : PatFrag<(ops node:$in), (v8i64 (bitconvert node:$in))>;
  830. def bc_v8f64 : PatFrag<(ops node:$in), (v8f64 (bitconvert node:$in))>;
  831. def bc_v16f32 : PatFrag<(ops node:$in), (v16f32 (bitconvert node:$in))>;
  832. def X86vzload16 : PatFrag<(ops node:$src),
  833. (X86vzld node:$src), [{
  834. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 2;
  835. }]>;
  836. def X86vzload32 : PatFrag<(ops node:$src),
  837. (X86vzld node:$src), [{
  838. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 4;
  839. }]>;
  840. def X86vzload64 : PatFrag<(ops node:$src),
  841. (X86vzld node:$src), [{
  842. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 8;
  843. }]>;
  844. def X86vextractstore64 : PatFrag<(ops node:$val, node:$ptr),
  845. (X86vextractst node:$val, node:$ptr), [{
  846. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 8;
  847. }]>;
  848. def X86VBroadcastld8 : PatFrag<(ops node:$src),
  849. (X86VBroadcastld node:$src), [{
  850. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 1;
  851. }]>;
  852. def X86VBroadcastld16 : PatFrag<(ops node:$src),
  853. (X86VBroadcastld node:$src), [{
  854. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 2;
  855. }]>;
  856. def X86VBroadcastld32 : PatFrag<(ops node:$src),
  857. (X86VBroadcastld node:$src), [{
  858. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 4;
  859. }]>;
  860. def X86VBroadcastld64 : PatFrag<(ops node:$src),
  861. (X86VBroadcastld node:$src), [{
  862. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 8;
  863. }]>;
  864. def X86SubVBroadcastld128 : PatFrag<(ops node:$src),
  865. (X86SubVBroadcastld node:$src), [{
  866. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 16;
  867. }]>;
  868. def X86SubVBroadcastld256 : PatFrag<(ops node:$src),
  869. (X86SubVBroadcastld node:$src), [{
  870. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getStoreSize() == 32;
  871. }]>;
  872. // Scalar SSE intrinsic fragments to match several different types of loads.
  873. // Used by scalar SSE intrinsic instructions which have 128 bit types, but
  874. // only load a single element.
  875. // FIXME: We should add more canolicalizing in DAGCombine. Particulary removing
  876. // the simple_load case.
  877. def sse_load_f16 : PatFrags<(ops node:$ptr),
  878. [(v8f16 (simple_load node:$ptr)),
  879. (v8f16 (X86vzload16 node:$ptr)),
  880. (v8f16 (scalar_to_vector (loadf16 node:$ptr)))]>;
  881. def sse_load_f32 : PatFrags<(ops node:$ptr),
  882. [(v4f32 (simple_load node:$ptr)),
  883. (v4f32 (X86vzload32 node:$ptr)),
  884. (v4f32 (scalar_to_vector (loadf32 node:$ptr)))]>;
  885. def sse_load_f64 : PatFrags<(ops node:$ptr),
  886. [(v2f64 (simple_load node:$ptr)),
  887. (v2f64 (X86vzload64 node:$ptr)),
  888. (v2f64 (scalar_to_vector (loadf64 node:$ptr)))]>;
  889. def shmem : X86MemOperand<"printwordmem", X86Mem16AsmOperand>;
  890. def ssmem : X86MemOperand<"printdwordmem", X86Mem32AsmOperand>;
  891. def sdmem : X86MemOperand<"printqwordmem", X86Mem64AsmOperand>;
  892. def fp16imm0 : PatLeaf<(f16 fpimm), [{
  893. return N->isExactlyValue(+0.0);
  894. }]>;
  895. def fp32imm0 : PatLeaf<(f32 fpimm), [{
  896. return N->isExactlyValue(+0.0);
  897. }]>;
  898. def fp64imm0 : PatLeaf<(f64 fpimm), [{
  899. return N->isExactlyValue(+0.0);
  900. }]>;
  901. def fp128imm0 : PatLeaf<(f128 fpimm), [{
  902. return N->isExactlyValue(+0.0);
  903. }]>;
  904. // EXTRACT_get_vextract128_imm xform function: convert extract_subvector index
  905. // to VEXTRACTF128/VEXTRACTI128 imm.
  906. def EXTRACT_get_vextract128_imm : SDNodeXForm<extract_subvector, [{
  907. return getExtractVEXTRACTImmediate(N, 128, SDLoc(N));
  908. }]>;
  909. // INSERT_get_vinsert128_imm xform function: convert insert_subvector index to
  910. // VINSERTF128/VINSERTI128 imm.
  911. def INSERT_get_vinsert128_imm : SDNodeXForm<insert_subvector, [{
  912. return getInsertVINSERTImmediate(N, 128, SDLoc(N));
  913. }]>;
  914. // INSERT_get_vperm2x128_imm xform function: convert insert_subvector index to
  915. // commuted VPERM2F128/VPERM2I128 imm.
  916. def INSERT_get_vperm2x128_commutedimm : SDNodeXForm<insert_subvector, [{
  917. return getPermuteVINSERTCommutedImmediate(N, 128, SDLoc(N));
  918. }]>;
  919. // EXTRACT_get_vextract256_imm xform function: convert extract_subvector index
  920. // to VEXTRACTF64x4 imm.
  921. def EXTRACT_get_vextract256_imm : SDNodeXForm<extract_subvector, [{
  922. return getExtractVEXTRACTImmediate(N, 256, SDLoc(N));
  923. }]>;
  924. // INSERT_get_vinsert256_imm xform function: convert insert_subvector index to
  925. // VINSERTF64x4 imm.
  926. def INSERT_get_vinsert256_imm : SDNodeXForm<insert_subvector, [{
  927. return getInsertVINSERTImmediate(N, 256, SDLoc(N));
  928. }]>;
  929. def vextract128_extract : PatFrag<(ops node:$bigvec, node:$index),
  930. (extract_subvector node:$bigvec,
  931. node:$index), [{
  932. // Index 0 can be handled via extract_subreg.
  933. return !isNullConstant(N->getOperand(1));
  934. }], EXTRACT_get_vextract128_imm>;
  935. def vinsert128_insert : PatFrag<(ops node:$bigvec, node:$smallvec,
  936. node:$index),
  937. (insert_subvector node:$bigvec, node:$smallvec,
  938. node:$index), [{}],
  939. INSERT_get_vinsert128_imm>;
  940. def vextract256_extract : PatFrag<(ops node:$bigvec, node:$index),
  941. (extract_subvector node:$bigvec,
  942. node:$index), [{
  943. // Index 0 can be handled via extract_subreg.
  944. return !isNullConstant(N->getOperand(1));
  945. }], EXTRACT_get_vextract256_imm>;
  946. def vinsert256_insert : PatFrag<(ops node:$bigvec, node:$smallvec,
  947. node:$index),
  948. (insert_subvector node:$bigvec, node:$smallvec,
  949. node:$index), [{}],
  950. INSERT_get_vinsert256_imm>;
  951. def masked_load : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  952. (masked_ld node:$src1, undef, node:$src2, node:$src3), [{
  953. return !cast<MaskedLoadSDNode>(N)->isExpandingLoad() &&
  954. cast<MaskedLoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD &&
  955. cast<MaskedLoadSDNode>(N)->isUnindexed();
  956. }]>;
  957. def masked_load_aligned : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  958. (masked_load node:$src1, node:$src2, node:$src3), [{
  959. // Use the node type to determine the size the alignment needs to match.
  960. // We can't use memory VT because type widening changes the node VT, but
  961. // not the memory VT.
  962. auto *Ld = cast<MaskedLoadSDNode>(N);
  963. return Ld->getAlignment() >= Ld->getValueType(0).getStoreSize();
  964. }]>;
  965. def X86mExpandingLoad : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  966. (masked_ld node:$src1, undef, node:$src2, node:$src3), [{
  967. return cast<MaskedLoadSDNode>(N)->isExpandingLoad() &&
  968. cast<MaskedLoadSDNode>(N)->isUnindexed();
  969. }]>;
  970. // Masked store fragments.
  971. // X86mstore can't be implemented in core DAG files because some targets
  972. // do not support vector types (llvm-tblgen will fail).
  973. def masked_store : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  974. (masked_st node:$src1, node:$src2, undef, node:$src3), [{
  975. return !cast<MaskedStoreSDNode>(N)->isTruncatingStore() &&
  976. !cast<MaskedStoreSDNode>(N)->isCompressingStore() &&
  977. cast<MaskedStoreSDNode>(N)->isUnindexed();
  978. }]>;
  979. def masked_store_aligned : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  980. (masked_store node:$src1, node:$src2, node:$src3), [{
  981. // Use the node type to determine the size the alignment needs to match.
  982. // We can't use memory VT because type widening changes the node VT, but
  983. // not the memory VT.
  984. auto *St = cast<MaskedStoreSDNode>(N);
  985. return St->getAlignment() >= St->getOperand(1).getValueType().getStoreSize();
  986. }]>;
  987. def X86mCompressingStore : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  988. (masked_st node:$src1, node:$src2, undef, node:$src3), [{
  989. return cast<MaskedStoreSDNode>(N)->isCompressingStore() &&
  990. cast<MaskedStoreSDNode>(N)->isUnindexed();
  991. }]>;
  992. // masked truncstore fragments
  993. // X86mtruncstore can't be implemented in core DAG files because some targets
  994. // doesn't support vector type ( llvm-tblgen will fail)
  995. def X86mtruncstore : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  996. (masked_st node:$src1, node:$src2, undef, node:$src3), [{
  997. return cast<MaskedStoreSDNode>(N)->isTruncatingStore() &&
  998. cast<MaskedStoreSDNode>(N)->isUnindexed();
  999. }]>;
  1000. def masked_truncstorevi8 :
  1001. PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1002. (X86mtruncstore node:$src1, node:$src2, node:$src3), [{
  1003. return cast<MaskedStoreSDNode>(N)->getMemoryVT().getScalarType() == MVT::i8;
  1004. }]>;
  1005. def masked_truncstorevi16 :
  1006. PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1007. (X86mtruncstore node:$src1, node:$src2, node:$src3), [{
  1008. return cast<MaskedStoreSDNode>(N)->getMemoryVT().getScalarType() == MVT::i16;
  1009. }]>;
  1010. def masked_truncstorevi32 :
  1011. PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1012. (X86mtruncstore node:$src1, node:$src2, node:$src3), [{
  1013. return cast<MaskedStoreSDNode>(N)->getMemoryVT().getScalarType() == MVT::i32;
  1014. }]>;
  1015. def X86TruncSStore : SDNode<"X86ISD::VTRUNCSTORES", SDTStore,
  1016. [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
  1017. def X86TruncUSStore : SDNode<"X86ISD::VTRUNCSTOREUS", SDTStore,
  1018. [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
  1019. def X86MTruncSStore : SDNode<"X86ISD::VMTRUNCSTORES", SDTX86MaskedStore,
  1020. [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
  1021. def X86MTruncUSStore : SDNode<"X86ISD::VMTRUNCSTOREUS", SDTX86MaskedStore,
  1022. [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;
  1023. def truncstore_s_vi8 : PatFrag<(ops node:$val, node:$ptr),
  1024. (X86TruncSStore node:$val, node:$ptr), [{
  1025. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i8;
  1026. }]>;
  1027. def truncstore_us_vi8 : PatFrag<(ops node:$val, node:$ptr),
  1028. (X86TruncUSStore node:$val, node:$ptr), [{
  1029. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i8;
  1030. }]>;
  1031. def truncstore_s_vi16 : PatFrag<(ops node:$val, node:$ptr),
  1032. (X86TruncSStore node:$val, node:$ptr), [{
  1033. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i16;
  1034. }]>;
  1035. def truncstore_us_vi16 : PatFrag<(ops node:$val, node:$ptr),
  1036. (X86TruncUSStore node:$val, node:$ptr), [{
  1037. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i16;
  1038. }]>;
  1039. def truncstore_s_vi32 : PatFrag<(ops node:$val, node:$ptr),
  1040. (X86TruncSStore node:$val, node:$ptr), [{
  1041. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i32;
  1042. }]>;
  1043. def truncstore_us_vi32 : PatFrag<(ops node:$val, node:$ptr),
  1044. (X86TruncUSStore node:$val, node:$ptr), [{
  1045. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i32;
  1046. }]>;
  1047. def masked_truncstore_s_vi8 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1048. (X86MTruncSStore node:$src1, node:$src2, node:$src3), [{
  1049. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i8;
  1050. }]>;
  1051. def masked_truncstore_us_vi8 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1052. (X86MTruncUSStore node:$src1, node:$src2, node:$src3), [{
  1053. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i8;
  1054. }]>;
  1055. def masked_truncstore_s_vi16 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1056. (X86MTruncSStore node:$src1, node:$src2, node:$src3), [{
  1057. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i16;
  1058. }]>;
  1059. def masked_truncstore_us_vi16 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1060. (X86MTruncUSStore node:$src1, node:$src2, node:$src3), [{
  1061. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i16;
  1062. }]>;
  1063. def masked_truncstore_s_vi32 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1064. (X86MTruncSStore node:$src1, node:$src2, node:$src3), [{
  1065. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i32;
  1066. }]>;
  1067. def masked_truncstore_us_vi32 : PatFrag<(ops node:$src1, node:$src2, node:$src3),
  1068. (X86MTruncUSStore node:$src1, node:$src2, node:$src3), [{
  1069. return cast<MemIntrinsicSDNode>(N)->getMemoryVT().getScalarType() == MVT::i32;
  1070. }]>;