IntrinsicsPowerPC.td 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938
  1. //===- IntrinsicsPowerPC.td - Defines PowerPC intrinsics ---*- tablegen -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file defines all of the PowerPC-specific intrinsics.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. //===----------------------------------------------------------------------===//
  13. // Definitions for all PowerPC intrinsics.
  14. //
  15. // Non-altivec intrinsics.
  16. let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
  17. // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
  18. def int_ppc_dcba : Intrinsic<[], [llvm_ptr_ty], []>;
  19. def int_ppc_dcbf : ClangBuiltin<"__builtin_dcbf">,
  20. Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
  21. def int_ppc_dcbfps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
  22. def int_ppc_dcbstps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
  23. def int_ppc_dcbi : Intrinsic<[], [llvm_ptr_ty], []>;
  24. def int_ppc_dcbt_with_hint: Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
  25. [IntrArgMemOnly, NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<1>>]>;
  26. def int_ppc_dcbtst_with_hint: Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
  27. [IntrArgMemOnly, NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<1>>]>;
  28. def int_ppc_dcbzl : Intrinsic<[], [llvm_ptr_ty], []>;
  29. // Get content from current FPSCR register
  30. def int_ppc_readflm : ClangBuiltin<"__builtin_readflm">,
  31. Intrinsic<[llvm_double_ty], [],
  32. [IntrNoMerge, IntrHasSideEffects]>;
  33. // Set FPSCR register, and return previous content
  34. def int_ppc_setflm : ClangBuiltin<"__builtin_setflm">,
  35. Intrinsic<[llvm_double_ty], [llvm_double_ty],
  36. [IntrHasSideEffects]>;
  37. // Intrinsics for [double]word extended forms of divide instructions
  38. def int_ppc_divwe : ClangBuiltin<"__builtin_divwe">,
  39. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
  40. [IntrNoMem]>;
  41. def int_ppc_divweu : ClangBuiltin<"__builtin_divweu">,
  42. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
  43. [IntrNoMem]>;
  44. def int_ppc_divde : ClangBuiltin<"__builtin_divde">,
  45. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  46. [IntrNoMem]>;
  47. def int_ppc_divdeu : ClangBuiltin<"__builtin_divdeu">,
  48. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  49. [IntrNoMem]>;
  50. def int_ppc_unpack_longdouble : ClangBuiltin<"__builtin_unpack_longdouble">,
  51. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_ppcf128_ty, llvm_i32_ty],
  52. [IntrNoMem]>;
  53. def int_ppc_pack_longdouble : ClangBuiltin<"__builtin_pack_longdouble">,
  54. DefaultAttrsIntrinsic<[llvm_ppcf128_ty], [llvm_double_ty, llvm_double_ty],
  55. [IntrNoMem]>;
  56. // Generate a random number
  57. def int_ppc_darn : ClangBuiltin<"__builtin_darn">,
  58. Intrinsic<[llvm_i64_ty], [],
  59. [IntrNoMerge, IntrHasSideEffects]>;
  60. def int_ppc_darnraw : ClangBuiltin<"__builtin_darn_raw">,
  61. Intrinsic<[llvm_i64_ty], [],
  62. [IntrNoMerge, IntrHasSideEffects]>;
  63. def int_ppc_darn32 : ClangBuiltin<"__builtin_darn_32">,
  64. Intrinsic<[llvm_i32_ty], [],
  65. [IntrNoMerge, IntrHasSideEffects]>;
  66. // Bit permute doubleword
  67. def int_ppc_bpermd : ClangBuiltin<"__builtin_bpermd">,
  68. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  69. [IntrNoMem]>;
  70. // Parallel Bits Deposit/Extract Doubleword Builtins.
  71. def int_ppc_pdepd
  72. : ClangBuiltin<"__builtin_pdepd">,
  73. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  74. [IntrNoMem]>;
  75. def int_ppc_pextd
  76. : ClangBuiltin<"__builtin_pextd">,
  77. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  78. [IntrNoMem]>;
  79. // Centrifuge Doubleword Builtin.
  80. def int_ppc_cfuged
  81. : ClangBuiltin<"__builtin_cfuged">,
  82. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  83. [IntrNoMem]>;
  84. // Count Leading / Trailing Zeroes under bit Mask Builtins.
  85. def int_ppc_cntlzdm
  86. : ClangBuiltin<"__builtin_cntlzdm">,
  87. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  88. [IntrNoMem]>;
  89. def int_ppc_cnttzdm
  90. : ClangBuiltin<"__builtin_cnttzdm">,
  91. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  92. [IntrNoMem]>;
  93. def int_ppc_truncf128_round_to_odd
  94. : ClangBuiltin<"__builtin_truncf128_round_to_odd">,
  95. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_f128_ty], [IntrNoMem]>;
  96. def int_ppc_sqrtf128_round_to_odd
  97. : ClangBuiltin<"__builtin_sqrtf128_round_to_odd">,
  98. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty], [IntrNoMem]>;
  99. def int_ppc_addf128_round_to_odd
  100. : ClangBuiltin<"__builtin_addf128_round_to_odd">,
  101. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
  102. [IntrNoMem]>;
  103. def int_ppc_subf128_round_to_odd
  104. : ClangBuiltin<"__builtin_subf128_round_to_odd">,
  105. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
  106. [IntrNoMem]>;
  107. def int_ppc_mulf128_round_to_odd
  108. : ClangBuiltin<"__builtin_mulf128_round_to_odd">,
  109. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
  110. [IntrNoMem]>;
  111. def int_ppc_divf128_round_to_odd
  112. : ClangBuiltin<"__builtin_divf128_round_to_odd">,
  113. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
  114. [IntrNoMem]>;
  115. def int_ppc_fmaf128_round_to_odd
  116. : ClangBuiltin<"__builtin_fmaf128_round_to_odd">,
  117. DefaultAttrsIntrinsic<[llvm_f128_ty],
  118. [llvm_f128_ty,llvm_f128_ty,llvm_f128_ty],
  119. [IntrNoMem]>;
  120. def int_ppc_scalar_extract_expq
  121. : ClangBuiltin<"__builtin_vsx_scalar_extract_expq">,
  122. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_f128_ty], [IntrNoMem]>;
  123. def int_ppc_scalar_insert_exp_qp
  124. : ClangBuiltin<"__builtin_vsx_scalar_insert_exp_qp">,
  125. DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty, llvm_i64_ty],
  126. [IntrNoMem]>;
  127. // Intrinsics defined to maintain XL compatibility
  128. def int_ppc_tdw
  129. : ClangBuiltin<"__builtin_ppc_tdw">,
  130. Intrinsic <[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty], [ImmArg<ArgIndex<2>>]>;
  131. def int_ppc_tw
  132. : ClangBuiltin<"__builtin_ppc_tw">,
  133. Intrinsic <[], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [ImmArg<ArgIndex<2>>]>;
  134. def int_ppc_trapd
  135. : ClangBuiltin<"__builtin_ppc_trapd">,
  136. Intrinsic <[], [llvm_i64_ty], []>;
  137. def int_ppc_trap
  138. : ClangBuiltin<"__builtin_ppc_trap">,
  139. Intrinsic <[], [llvm_i32_ty], []>;
  140. def int_ppc_fcfid
  141. : ClangBuiltin<"__builtin_ppc_fcfid">,
  142. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  143. def int_ppc_fcfud
  144. : ClangBuiltin<"__builtin_ppc_fcfud">,
  145. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  146. def int_ppc_fctid
  147. : ClangBuiltin<"__builtin_ppc_fctid">,
  148. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  149. def int_ppc_fctidz
  150. : ClangBuiltin<"__builtin_ppc_fctidz">,
  151. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  152. def int_ppc_fctiw
  153. : ClangBuiltin<"__builtin_ppc_fctiw">,
  154. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  155. def int_ppc_fctiwz
  156. : ClangBuiltin<"__builtin_ppc_fctiwz">,
  157. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  158. def int_ppc_fctudz
  159. : ClangBuiltin<"__builtin_ppc_fctudz">,
  160. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  161. def int_ppc_fctuwz
  162. : ClangBuiltin<"__builtin_ppc_fctuwz">,
  163. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  164. // XL compatible select functions
  165. // TODO: Add llvm_f128_ty support.
  166. def int_ppc_maxfe
  167. : DefaultAttrsIntrinsic<
  168. [llvm_ppcf128_ty],
  169. [llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_vararg_ty],
  170. [IntrNoMem]>;
  171. def int_ppc_maxfl
  172. : DefaultAttrsIntrinsic<
  173. [llvm_double_ty],
  174. [llvm_double_ty, llvm_double_ty, llvm_double_ty, llvm_vararg_ty],
  175. [IntrNoMem]>;
  176. def int_ppc_maxfs
  177. : DefaultAttrsIntrinsic<
  178. [llvm_float_ty],
  179. [llvm_float_ty, llvm_float_ty, llvm_float_ty, llvm_vararg_ty],
  180. [IntrNoMem]>;
  181. def int_ppc_minfe
  182. : DefaultAttrsIntrinsic<
  183. [llvm_ppcf128_ty],
  184. [llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_vararg_ty],
  185. [IntrNoMem]>;
  186. def int_ppc_minfl
  187. : DefaultAttrsIntrinsic<
  188. [llvm_double_ty],
  189. [llvm_double_ty, llvm_double_ty, llvm_double_ty, llvm_vararg_ty],
  190. [IntrNoMem]>;
  191. def int_ppc_minfs
  192. : DefaultAttrsIntrinsic<
  193. [llvm_float_ty],
  194. [llvm_float_ty, llvm_float_ty, llvm_float_ty, llvm_vararg_ty],
  195. [IntrNoMem]>;
  196. }
  197. let TargetPrefix = "ppc" in { // All PPC intrinsics start with "llvm.ppc.".
  198. /// PowerPC_Vec_Intrinsic - Base class for all altivec intrinsics.
  199. class PowerPC_Vec_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
  200. list<LLVMType> param_types,
  201. list<IntrinsicProperty> properties>
  202. : ClangBuiltin<!strconcat("__builtin_altivec_", GCCIntSuffix)>,
  203. DefaultAttrsIntrinsic<ret_types, param_types, properties>;
  204. /// PowerPC_VSX_Intrinsic - Base class for all VSX intrinsics.
  205. class PowerPC_VSX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
  206. list<LLVMType> param_types,
  207. list<IntrinsicProperty> properties>
  208. : ClangBuiltin<!strconcat("__builtin_vsx_", GCCIntSuffix)>,
  209. DefaultAttrsIntrinsic<ret_types, param_types, properties>;
  210. }
  211. //===----------------------------------------------------------------------===//
  212. // PowerPC MMA Intrinsic Multi Class Definitions.
  213. //
  214. multiclass PowerPC_MMA_ACC_Intrinsic<list<LLVMType> args> {
  215. def NAME: DefaultAttrsIntrinsic<[llvm_v512i1_ty], args, [IntrNoMem]>;
  216. def pp : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  217. !listconcat([llvm_v512i1_ty], args),
  218. [IntrNoMem]>;
  219. def pn : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  220. !listconcat([llvm_v512i1_ty], args),
  221. [IntrNoMem]>;
  222. def np : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  223. !listconcat([llvm_v512i1_ty], args),
  224. [IntrNoMem]>;
  225. def nn : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  226. !listconcat([llvm_v512i1_ty], args),
  227. [IntrNoMem]>;
  228. }
  229. multiclass PowerPC_MMA_ACC_PP_Intrinsic<list<LLVMType> args> {
  230. def NAME: DefaultAttrsIntrinsic<[llvm_v512i1_ty], args, [IntrNoMem]>;
  231. def pp : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  232. !listconcat([llvm_v512i1_ty], args),
  233. [IntrNoMem]>;
  234. }
  235. //===----------------------------------------------------------------------===//
  236. // PowerPC Altivec Intrinsic Class Definitions.
  237. //
  238. /// PowerPC_Vec_FF_Intrinsic - A PowerPC intrinsic that takes one v4f32
  239. /// vector and returns one. These intrinsics have no side effects.
  240. class PowerPC_Vec_FF_Intrinsic<string GCCIntSuffix>
  241. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  242. [llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  243. /// PowerPC_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
  244. /// vectors and returns one. These intrinsics have no side effects.
  245. class PowerPC_Vec_FFF_Intrinsic<string GCCIntSuffix>
  246. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  247. [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  248. [IntrNoMem]>;
  249. /// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16i8
  250. /// vectors and returns one. These intrinsics have no side effects.
  251. class PowerPC_Vec_BBB_Intrinsic<string GCCIntSuffix>
  252. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  253. [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  254. [IntrNoMem]>;
  255. /// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
  256. /// vectors and returns one. These intrinsics have no side effects.
  257. class PowerPC_Vec_HHH_Intrinsic<string GCCIntSuffix>
  258. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  259. [llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  260. [IntrNoMem]>;
  261. /// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
  262. /// vectors and returns one. These intrinsics have no side effects.
  263. class PowerPC_Vec_WWW_Intrinsic<string GCCIntSuffix>
  264. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  265. [llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  266. [IntrNoMem]>;
  267. /// PowerPC_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
  268. /// vectors and returns one. These intrinsics have no side effects.
  269. class PowerPC_Vec_DDD_Intrinsic<string GCCIntSuffix>
  270. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  271. [llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  272. [IntrNoMem]>;
  273. /// PowerPC_Vec_QQQ_Intrinsic - A PowerPC intrinsic that takes two v1i128
  274. /// vectors and returns one. These intrinsics have no side effects.
  275. class PowerPC_Vec_QQQ_Intrinsic<string GCCIntSuffix>
  276. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  277. [llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
  278. [IntrNoMem]>;
  279. /// PowerPC_Vec_QDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
  280. /// vectors and returns one v1i128. These intrinsics have no side effects.
  281. class PowerPC_Vec_QDD_Intrinsic<string GCCIntSuffix>
  282. : PowerPC_Vec_Intrinsic<GCCIntSuffix,
  283. [llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  284. [IntrNoMem]>;
  285. //===----------------------------------------------------------------------===//
  286. // PowerPC VSX Intrinsic Class Definitions.
  287. //
  288. /// PowerPC_VSX_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2f64
  289. /// vectors and returns one. These intrinsics have no side effects.
  290. class PowerPC_VSX_Vec_DDD_Intrinsic<string GCCIntSuffix>
  291. : PowerPC_VSX_Intrinsic<GCCIntSuffix,
  292. [llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty],
  293. [IntrNoMem]>;
  294. /// PowerPC_VSX_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
  295. /// vectors and returns one. These intrinsics have no side effects.
  296. class PowerPC_VSX_Vec_FFF_Intrinsic<string GCCIntSuffix>
  297. : PowerPC_VSX_Intrinsic<GCCIntSuffix,
  298. [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  299. [IntrNoMem]>;
  300. /// PowerPC_VSX_Sca_DDD_Intrinsic - A PowerPC intrinsic that takes two f64
  301. /// scalars and returns one. These intrinsics have no side effects.
  302. class PowerPC_VSX_Sca_DDD_Intrinsic<string GCCIntSuffix>
  303. : PowerPC_VSX_Intrinsic<GCCIntSuffix,
  304. [llvm_double_ty], [llvm_double_ty, llvm_double_ty],
  305. [IntrNoMem]>;
  306. //===----------------------------------------------------------------------===//
  307. // PowerPC Altivec Intrinsic Definitions.
  308. let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
  309. // Data Stream Control.
  310. def int_ppc_altivec_dss : ClangBuiltin<"__builtin_altivec_dss">,
  311. Intrinsic<[], [llvm_i32_ty], []>;
  312. def int_ppc_altivec_dssall : ClangBuiltin<"__builtin_altivec_dssall">,
  313. Intrinsic<[], [], []>;
  314. def int_ppc_altivec_dst : ClangBuiltin<"__builtin_altivec_dst">,
  315. Intrinsic<[],
  316. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
  317. []>;
  318. def int_ppc_altivec_dstt : ClangBuiltin<"__builtin_altivec_dstt">,
  319. Intrinsic<[],
  320. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
  321. []>;
  322. def int_ppc_altivec_dstst : ClangBuiltin<"__builtin_altivec_dstst">,
  323. Intrinsic<[],
  324. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
  325. []>;
  326. def int_ppc_altivec_dststt : ClangBuiltin<"__builtin_altivec_dststt">,
  327. Intrinsic<[],
  328. [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
  329. []>;
  330. // VSCR access.
  331. def int_ppc_altivec_mfvscr : ClangBuiltin<"__builtin_altivec_mfvscr">,
  332. Intrinsic<[llvm_v8i16_ty], [], [IntrNoMem, IntrHasSideEffects]>;
  333. def int_ppc_altivec_mtvscr : ClangBuiltin<"__builtin_altivec_mtvscr">,
  334. Intrinsic<[], [llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
  335. // Loads. These don't map directly to GCC builtins because they represent the
  336. // source address with a single pointer.
  337. def int_ppc_altivec_lvx :
  338. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
  339. [IntrReadMem, IntrArgMemOnly]>;
  340. def int_ppc_altivec_lvxl :
  341. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
  342. [IntrReadMem, IntrArgMemOnly]>;
  343. def int_ppc_altivec_lvebx :
  344. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty],
  345. [IntrReadMem, IntrArgMemOnly]>;
  346. def int_ppc_altivec_lvehx :
  347. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_ptr_ty],
  348. [IntrReadMem, IntrArgMemOnly]>;
  349. def int_ppc_altivec_lvewx :
  350. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
  351. [IntrReadMem, IntrArgMemOnly]>;
  352. // Stores. These don't map directly to GCC builtins because they represent the
  353. // source address with a single pointer.
  354. def int_ppc_altivec_stvx :
  355. Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
  356. [IntrWriteMem, IntrArgMemOnly]>;
  357. def int_ppc_altivec_stvxl :
  358. Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
  359. [IntrWriteMem, IntrArgMemOnly]>;
  360. def int_ppc_altivec_stvebx :
  361. Intrinsic<[], [llvm_v16i8_ty, llvm_ptr_ty],
  362. [IntrWriteMem, IntrArgMemOnly]>;
  363. def int_ppc_altivec_stvehx :
  364. Intrinsic<[], [llvm_v8i16_ty, llvm_ptr_ty],
  365. [IntrWriteMem, IntrArgMemOnly]>;
  366. def int_ppc_altivec_stvewx :
  367. Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
  368. [IntrWriteMem, IntrArgMemOnly]>;
  369. // Comparisons setting a vector.
  370. def int_ppc_altivec_vcmpbfp : ClangBuiltin<"__builtin_altivec_vcmpbfp">,
  371. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  372. [IntrNoMem]>;
  373. def int_ppc_altivec_vcmpeqfp : ClangBuiltin<"__builtin_altivec_vcmpeqfp">,
  374. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  375. [IntrNoMem]>;
  376. def int_ppc_altivec_vcmpgefp : ClangBuiltin<"__builtin_altivec_vcmpgefp">,
  377. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  378. [IntrNoMem]>;
  379. def int_ppc_altivec_vcmpgtfp : ClangBuiltin<"__builtin_altivec_vcmpgtfp">,
  380. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
  381. [IntrNoMem]>;
  382. def int_ppc_altivec_vcmpequd : ClangBuiltin<"__builtin_altivec_vcmpequd">,
  383. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  384. [IntrNoMem]>;
  385. def int_ppc_altivec_vcmpgtsd : ClangBuiltin<"__builtin_altivec_vcmpgtsd">,
  386. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  387. [IntrNoMem]>;
  388. def int_ppc_altivec_vcmpgtud : ClangBuiltin<"__builtin_altivec_vcmpgtud">,
  389. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  390. [IntrNoMem]>;
  391. def int_ppc_altivec_vcmpequw : ClangBuiltin<"__builtin_altivec_vcmpequw">,
  392. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  393. [IntrNoMem]>;
  394. def int_ppc_altivec_vcmpgtsw : ClangBuiltin<"__builtin_altivec_vcmpgtsw">,
  395. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  396. [IntrNoMem]>;
  397. def int_ppc_altivec_vcmpgtuw : ClangBuiltin<"__builtin_altivec_vcmpgtuw">,
  398. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  399. [IntrNoMem]>;
  400. def int_ppc_altivec_vcmpnew : ClangBuiltin<"__builtin_altivec_vcmpnew">,
  401. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  402. [IntrNoMem]>;
  403. def int_ppc_altivec_vcmpnezw : ClangBuiltin<"__builtin_altivec_vcmpnezw">,
  404. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  405. [IntrNoMem]>;
  406. def int_ppc_altivec_vcmpequh : ClangBuiltin<"__builtin_altivec_vcmpequh">,
  407. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  408. [IntrNoMem]>;
  409. def int_ppc_altivec_vcmpgtsh : ClangBuiltin<"__builtin_altivec_vcmpgtsh">,
  410. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  411. [IntrNoMem]>;
  412. def int_ppc_altivec_vcmpgtuh : ClangBuiltin<"__builtin_altivec_vcmpgtuh">,
  413. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  414. [IntrNoMem]>;
  415. def int_ppc_altivec_vcmpneh : ClangBuiltin<"__builtin_altivec_vcmpneh">,
  416. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  417. [IntrNoMem]>;
  418. def int_ppc_altivec_vcmpnezh : ClangBuiltin<"__builtin_altivec_vcmpnezh">,
  419. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  420. [IntrNoMem]>;
  421. def int_ppc_altivec_vcmpequb : ClangBuiltin<"__builtin_altivec_vcmpequb">,
  422. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  423. [IntrNoMem]>;
  424. def int_ppc_altivec_vcmpgtsb : ClangBuiltin<"__builtin_altivec_vcmpgtsb">,
  425. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  426. [IntrNoMem]>;
  427. def int_ppc_altivec_vcmpgtub : ClangBuiltin<"__builtin_altivec_vcmpgtub">,
  428. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  429. [IntrNoMem]>;
  430. def int_ppc_altivec_vcmpneb : ClangBuiltin<"__builtin_altivec_vcmpneb">,
  431. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  432. [IntrNoMem]>;
  433. def int_ppc_altivec_vcmpnezb : ClangBuiltin<"__builtin_altivec_vcmpnezb">,
  434. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  435. [IntrNoMem]>;
  436. def int_ppc_altivec_vcmpequq : ClangBuiltin<"__builtin_altivec_vcmpequq">,
  437. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
  438. [IntrNoMem]>;
  439. def int_ppc_altivec_vcmpgtsq : ClangBuiltin<"__builtin_altivec_vcmpgtsq">,
  440. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
  441. [IntrNoMem]>;
  442. def int_ppc_altivec_vcmpgtuq : ClangBuiltin<"__builtin_altivec_vcmpgtuq">,
  443. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
  444. [IntrNoMem]>;
  445. def int_ppc_altivec_vcmpequq_p : ClangBuiltin<"__builtin_altivec_vcmpequq_p">,
  446. DefaultAttrsIntrinsic<[llvm_i32_ty],
  447. [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
  448. [IntrNoMem]>;
  449. def int_ppc_altivec_vcmpgtsq_p : ClangBuiltin<"__builtin_altivec_vcmpgtsq_p">,
  450. DefaultAttrsIntrinsic<[llvm_i32_ty],
  451. [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
  452. [IntrNoMem]>;
  453. def int_ppc_altivec_vcmpgtuq_p : ClangBuiltin<"__builtin_altivec_vcmpgtuq_p">,
  454. DefaultAttrsIntrinsic<[llvm_i32_ty],
  455. [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
  456. [IntrNoMem]>;
  457. // Predicate Comparisons. The first operand specifies interpretation of CR6.
  458. def int_ppc_altivec_vcmpbfp_p : ClangBuiltin<"__builtin_altivec_vcmpbfp_p">,
  459. DefaultAttrsIntrinsic<[llvm_i32_ty],
  460. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  461. [IntrNoMem]>;
  462. def int_ppc_altivec_vcmpeqfp_p : ClangBuiltin<"__builtin_altivec_vcmpeqfp_p">,
  463. DefaultAttrsIntrinsic<[llvm_i32_ty],
  464. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  465. [IntrNoMem]>;
  466. def int_ppc_altivec_vcmpgefp_p : ClangBuiltin<"__builtin_altivec_vcmpgefp_p">,
  467. DefaultAttrsIntrinsic<[llvm_i32_ty],
  468. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  469. [IntrNoMem]>;
  470. def int_ppc_altivec_vcmpgtfp_p : ClangBuiltin<"__builtin_altivec_vcmpgtfp_p">,
  471. DefaultAttrsIntrinsic<[llvm_i32_ty],
  472. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  473. [IntrNoMem]>;
  474. def int_ppc_altivec_vcmpequd_p : ClangBuiltin<"__builtin_altivec_vcmpequd_p">,
  475. DefaultAttrsIntrinsic<[llvm_i32_ty],
  476. [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
  477. [IntrNoMem]>;
  478. def int_ppc_altivec_vcmpgtsd_p : ClangBuiltin<"__builtin_altivec_vcmpgtsd_p">,
  479. DefaultAttrsIntrinsic<[llvm_i32_ty],
  480. [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
  481. [IntrNoMem]>;
  482. def int_ppc_altivec_vcmpgtud_p : ClangBuiltin<"__builtin_altivec_vcmpgtud_p">,
  483. DefaultAttrsIntrinsic<[llvm_i32_ty],
  484. [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
  485. [IntrNoMem]>;
  486. def int_ppc_altivec_vcmpequw_p : ClangBuiltin<"__builtin_altivec_vcmpequw_p">,
  487. DefaultAttrsIntrinsic<[llvm_i32_ty],
  488. [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
  489. [IntrNoMem]>;
  490. def int_ppc_altivec_vcmpgtsw_p : ClangBuiltin<"__builtin_altivec_vcmpgtsw_p">,
  491. DefaultAttrsIntrinsic<[llvm_i32_ty],
  492. [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
  493. [IntrNoMem]>;
  494. def int_ppc_altivec_vcmpgtuw_p : ClangBuiltin<"__builtin_altivec_vcmpgtuw_p">,
  495. DefaultAttrsIntrinsic<[llvm_i32_ty],
  496. [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
  497. [IntrNoMem]>;
  498. def int_ppc_altivec_vcmpnew_p : ClangBuiltin<"__builtin_altivec_vcmpnew_p">,
  499. DefaultAttrsIntrinsic<[llvm_i32_ty],
  500. [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
  501. [IntrNoMem]>;
  502. def int_ppc_altivec_vcmpnezw_p : ClangBuiltin<"__builtin_altivec_vcmpnezw_p">,
  503. DefaultAttrsIntrinsic<[llvm_i32_ty],
  504. [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
  505. [IntrNoMem]>;
  506. def int_ppc_altivec_vcmpequh_p : ClangBuiltin<"__builtin_altivec_vcmpequh_p">,
  507. DefaultAttrsIntrinsic<[llvm_i32_ty],
  508. [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
  509. [IntrNoMem]>;
  510. def int_ppc_altivec_vcmpgtsh_p : ClangBuiltin<"__builtin_altivec_vcmpgtsh_p">,
  511. DefaultAttrsIntrinsic<[llvm_i32_ty],
  512. [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
  513. [IntrNoMem]>;
  514. def int_ppc_altivec_vcmpgtuh_p : ClangBuiltin<"__builtin_altivec_vcmpgtuh_p">,
  515. DefaultAttrsIntrinsic<[llvm_i32_ty],
  516. [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
  517. [IntrNoMem]>;
  518. def int_ppc_altivec_vcmpneh_p : ClangBuiltin<"__builtin_altivec_vcmpneh_p">,
  519. DefaultAttrsIntrinsic<[llvm_i32_ty],
  520. [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
  521. [IntrNoMem]>;
  522. def int_ppc_altivec_vcmpnezh_p : ClangBuiltin<"__builtin_altivec_vcmpnezh_p">,
  523. DefaultAttrsIntrinsic<[llvm_i32_ty],
  524. [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
  525. [IntrNoMem]>;
  526. def int_ppc_altivec_vcmpequb_p : ClangBuiltin<"__builtin_altivec_vcmpequb_p">,
  527. DefaultAttrsIntrinsic<[llvm_i32_ty],
  528. [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
  529. [IntrNoMem]>;
  530. def int_ppc_altivec_vcmpgtsb_p : ClangBuiltin<"__builtin_altivec_vcmpgtsb_p">,
  531. DefaultAttrsIntrinsic<[llvm_i32_ty],
  532. [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
  533. [IntrNoMem]>;
  534. def int_ppc_altivec_vcmpgtub_p : ClangBuiltin<"__builtin_altivec_vcmpgtub_p">,
  535. DefaultAttrsIntrinsic<[llvm_i32_ty],
  536. [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
  537. [IntrNoMem]>;
  538. def int_ppc_altivec_vcmpneb_p : ClangBuiltin<"__builtin_altivec_vcmpneb_p">,
  539. DefaultAttrsIntrinsic<[llvm_i32_ty],
  540. [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
  541. [IntrNoMem]>;
  542. def int_ppc_altivec_vcmpnezb_p : ClangBuiltin<"__builtin_altivec_vcmpnezb_p">,
  543. DefaultAttrsIntrinsic<[llvm_i32_ty],
  544. [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
  545. [IntrNoMem]>;
  546. def int_ppc_altivec_vclzlsbb : ClangBuiltin<"__builtin_altivec_vclzlsbb">,
  547. DefaultAttrsIntrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
  548. def int_ppc_altivec_vctzlsbb : ClangBuiltin<"__builtin_altivec_vctzlsbb">,
  549. DefaultAttrsIntrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
  550. def int_ppc_altivec_vprtybw : ClangBuiltin<"__builtin_altivec_vprtybw">,
  551. DefaultAttrsIntrinsic<[llvm_v4i32_ty],[llvm_v4i32_ty],[IntrNoMem]>;
  552. def int_ppc_altivec_vprtybd : ClangBuiltin<"__builtin_altivec_vprtybd">,
  553. DefaultAttrsIntrinsic<[llvm_v2i64_ty],[llvm_v2i64_ty],[IntrNoMem]>;
  554. def int_ppc_altivec_vprtybq : ClangBuiltin<"__builtin_altivec_vprtybq">,
  555. DefaultAttrsIntrinsic<[llvm_v1i128_ty],[llvm_v1i128_ty],[IntrNoMem]>;
  556. // BCD intrinsics.
  557. def int_ppc_bcdadd : ClangBuiltin<"__builtin_ppc_bcdadd">,
  558. DefaultAttrsIntrinsic<
  559. [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  560. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  561. def int_ppc_bcdadd_p : ClangBuiltin<"__builtin_ppc_bcdadd_p">,
  562. DefaultAttrsIntrinsic<
  563. [llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty, llvm_v16i8_ty],
  564. [IntrNoMem, ImmArg<ArgIndex<0>>]>;
  565. def int_ppc_bcdsub : ClangBuiltin<"__builtin_ppc_bcdsub">,
  566. DefaultAttrsIntrinsic<
  567. [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  568. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  569. def int_ppc_bcdsub_p : ClangBuiltin<"__builtin_ppc_bcdsub_p">,
  570. DefaultAttrsIntrinsic<
  571. [llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty, llvm_v16i8_ty],
  572. [IntrNoMem, ImmArg<ArgIndex<0>>]>;
  573. // P10 Vector Extract with Mask
  574. def int_ppc_altivec_vextractbm : ClangBuiltin<"__builtin_altivec_vextractbm">,
  575. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  576. def int_ppc_altivec_vextracthm : ClangBuiltin<"__builtin_altivec_vextracthm">,
  577. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  578. def int_ppc_altivec_vextractwm : ClangBuiltin<"__builtin_altivec_vextractwm">,
  579. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
  580. def int_ppc_altivec_vextractdm : ClangBuiltin<"__builtin_altivec_vextractdm">,
  581. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v2i64_ty], [IntrNoMem]>;
  582. def int_ppc_altivec_vextractqm : ClangBuiltin<"__builtin_altivec_vextractqm">,
  583. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v1i128_ty], [IntrNoMem]>;
  584. // P10 Vector Expand with Mask
  585. def int_ppc_altivec_vexpandbm : ClangBuiltin<"__builtin_altivec_vexpandbm">,
  586. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  587. def int_ppc_altivec_vexpandhm : ClangBuiltin<"__builtin_altivec_vexpandhm">,
  588. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  589. def int_ppc_altivec_vexpandwm : ClangBuiltin<"__builtin_altivec_vexpandwm">,
  590. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
  591. def int_ppc_altivec_vexpanddm : ClangBuiltin<"__builtin_altivec_vexpanddm">,
  592. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
  593. def int_ppc_altivec_vexpandqm : ClangBuiltin<"__builtin_altivec_vexpandqm">,
  594. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty], [IntrNoMem]>;
  595. // P10 Vector Count with Mask intrinsics.
  596. def int_ppc_altivec_vcntmbb : ClangBuiltin<"__builtin_altivec_vcntmbb">,
  597. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v16i8_ty, llvm_i32_ty],
  598. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  599. def int_ppc_altivec_vcntmbh : ClangBuiltin<"__builtin_altivec_vcntmbh">,
  600. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v8i16_ty, llvm_i32_ty],
  601. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  602. def int_ppc_altivec_vcntmbw : ClangBuiltin<"__builtin_altivec_vcntmbw">,
  603. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v4i32_ty, llvm_i32_ty],
  604. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  605. def int_ppc_altivec_vcntmbd : ClangBuiltin<"__builtin_altivec_vcntmbd">,
  606. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v2i64_ty, llvm_i32_ty],
  607. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  608. // P10 Move to VSR with Mask Intrinsics.
  609. def int_ppc_altivec_mtvsrbm : ClangBuiltin<"__builtin_altivec_mtvsrbm">,
  610. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_i64_ty], [IntrNoMem]>;
  611. def int_ppc_altivec_mtvsrhm : ClangBuiltin<"__builtin_altivec_mtvsrhm">,
  612. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_i64_ty], [IntrNoMem]>;
  613. def int_ppc_altivec_mtvsrwm : ClangBuiltin<"__builtin_altivec_mtvsrwm">,
  614. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_i64_ty], [IntrNoMem]>;
  615. def int_ppc_altivec_mtvsrdm : ClangBuiltin<"__builtin_altivec_mtvsrdm">,
  616. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_i64_ty], [IntrNoMem]>;
  617. def int_ppc_altivec_mtvsrqm : ClangBuiltin<"__builtin_altivec_mtvsrqm">,
  618. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_i64_ty], [IntrNoMem]>;
  619. // P10 Vector Parallel Bits Deposit/Extract Doubleword Builtins.
  620. def int_ppc_altivec_vpdepd : ClangBuiltin<"__builtin_altivec_vpdepd">,
  621. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  622. [IntrNoMem]>;
  623. def int_ppc_altivec_vpextd : ClangBuiltin<"__builtin_altivec_vpextd">,
  624. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  625. [IntrNoMem]>;
  626. // P10 Vector String Isolate Intrinsics.
  627. def int_ppc_altivec_vstribr : ClangBuiltin<"__builtin_altivec_vstribr">,
  628. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  629. def int_ppc_altivec_vstribl : ClangBuiltin<"__builtin_altivec_vstribl">,
  630. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  631. def int_ppc_altivec_vstrihr : ClangBuiltin<"__builtin_altivec_vstrihr">,
  632. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  633. def int_ppc_altivec_vstrihl : ClangBuiltin<"__builtin_altivec_vstrihl">,
  634. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  635. // Predicate Intrinsics: The first operand specifies interpretation of CR6.
  636. def int_ppc_altivec_vstribr_p : ClangBuiltin<"__builtin_altivec_vstribr_p">,
  637. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty],
  638. [IntrNoMem]>;
  639. def int_ppc_altivec_vstribl_p : ClangBuiltin<"__builtin_altivec_vstribl_p">,
  640. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty],
  641. [IntrNoMem]>;
  642. def int_ppc_altivec_vstrihr_p : ClangBuiltin<"__builtin_altivec_vstrihr_p">,
  643. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v8i16_ty],
  644. [IntrNoMem]>;
  645. def int_ppc_altivec_vstrihl_p : ClangBuiltin<"__builtin_altivec_vstrihl_p">,
  646. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v8i16_ty],
  647. [IntrNoMem]>;
  648. // P10 Vector Centrifuge Builtin.
  649. def int_ppc_altivec_vcfuged : ClangBuiltin<"__builtin_altivec_vcfuged">,
  650. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  651. [IntrNoMem]>;
  652. // P10 Vector Gather Every Nth Bit Builtin.
  653. def int_ppc_altivec_vgnb : ClangBuiltin<"__builtin_altivec_vgnb">,
  654. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v1i128_ty, llvm_i32_ty],
  655. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  656. // P10 Vector Clear Bytes
  657. def int_ppc_altivec_vclrlb : ClangBuiltin<"__builtin_altivec_vclrlb">,
  658. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i32_ty],
  659. [IntrNoMem]>;
  660. def int_ppc_altivec_vclrrb : ClangBuiltin<"__builtin_altivec_vclrrb">,
  661. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i32_ty],
  662. [IntrNoMem]>;
  663. // P10 Vector Shift Double Bit Immediate.
  664. def int_ppc_altivec_vsldbi : ClangBuiltin<"__builtin_altivec_vsldbi">,
  665. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  666. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  667. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  668. def int_ppc_altivec_vsrdbi : ClangBuiltin<"__builtin_altivec_vsrdbi">,
  669. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  670. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  671. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  672. // P10 Vector Insert.
  673. def int_ppc_altivec_vinsblx : ClangBuiltin<"__builtin_altivec_vinsblx">,
  674. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  675. [llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty],
  676. [IntrNoMem]>;
  677. def int_ppc_altivec_vinsbrx : ClangBuiltin<"__builtin_altivec_vinsbrx">,
  678. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  679. [llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty],
  680. [IntrNoMem]>;
  681. def int_ppc_altivec_vinshlx : ClangBuiltin<"__builtin_altivec_vinshlx">,
  682. DefaultAttrsIntrinsic<[llvm_v8i16_ty],
  683. [llvm_v8i16_ty, llvm_i32_ty, llvm_i32_ty],
  684. [IntrNoMem]>;
  685. def int_ppc_altivec_vinshrx : ClangBuiltin<"__builtin_altivec_vinshrx">,
  686. DefaultAttrsIntrinsic<[llvm_v8i16_ty],
  687. [llvm_v8i16_ty, llvm_i32_ty, llvm_i32_ty],
  688. [IntrNoMem]>;
  689. def int_ppc_altivec_vinswlx : ClangBuiltin<"__builtin_altivec_vinswlx">,
  690. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  691. [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
  692. [IntrNoMem]>;
  693. def int_ppc_altivec_vinswrx : ClangBuiltin<"__builtin_altivec_vinswrx">,
  694. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  695. [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
  696. [IntrNoMem]>;
  697. def int_ppc_altivec_vinsdlx : ClangBuiltin<"__builtin_altivec_vinsdlx">,
  698. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  699. [llvm_v2i64_ty, llvm_i64_ty, llvm_i64_ty],
  700. [IntrNoMem]>;
  701. def int_ppc_altivec_vinsdrx : ClangBuiltin<"__builtin_altivec_vinsdrx">,
  702. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  703. [llvm_v2i64_ty, llvm_i64_ty, llvm_i64_ty],
  704. [IntrNoMem]>;
  705. def int_ppc_altivec_vinsbvlx : ClangBuiltin<"__builtin_altivec_vinsbvlx">,
  706. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  707. [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty],
  708. [IntrNoMem]>;
  709. def int_ppc_altivec_vinsbvrx : ClangBuiltin<"__builtin_altivec_vinsbvrx">,
  710. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  711. [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty],
  712. [IntrNoMem]>;
  713. def int_ppc_altivec_vinshvlx : ClangBuiltin<"__builtin_altivec_vinshvlx">,
  714. DefaultAttrsIntrinsic<[llvm_v8i16_ty],
  715. [llvm_v8i16_ty, llvm_i32_ty, llvm_v8i16_ty],
  716. [IntrNoMem]>;
  717. def int_ppc_altivec_vinshvrx : ClangBuiltin<"__builtin_altivec_vinshvrx">,
  718. DefaultAttrsIntrinsic<[llvm_v8i16_ty],
  719. [llvm_v8i16_ty, llvm_i32_ty, llvm_v8i16_ty],
  720. [IntrNoMem]>;
  721. def int_ppc_altivec_vinswvlx : ClangBuiltin<"__builtin_altivec_vinswvlx">,
  722. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  723. [llvm_v4i32_ty, llvm_i32_ty, llvm_v4i32_ty],
  724. [IntrNoMem]>;
  725. def int_ppc_altivec_vinswvrx : ClangBuiltin<"__builtin_altivec_vinswvrx">,
  726. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  727. [llvm_v4i32_ty, llvm_i32_ty, llvm_v4i32_ty],
  728. [IntrNoMem]>;
  729. // P10 Vector Insert with immediate.
  730. def int_ppc_altivec_vinsw :
  731. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  732. [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
  733. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  734. def int_ppc_altivec_vinsd :
  735. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  736. [llvm_v2i64_ty, llvm_i64_ty, llvm_i32_ty],
  737. [IntrNoMem, ImmArg<ArgIndex<2>>]>;
  738. // P10 Vector Extract.
  739. def int_ppc_altivec_vextdubvlx : ClangBuiltin<"__builtin_altivec_vextdubvlx">,
  740. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  741. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  742. [IntrNoMem]>;
  743. def int_ppc_altivec_vextdubvrx : ClangBuiltin<"__builtin_altivec_vextdubvrx">,
  744. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  745. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
  746. [IntrNoMem]>;
  747. def int_ppc_altivec_vextduhvlx : ClangBuiltin<"__builtin_altivec_vextduhvlx">,
  748. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  749. [llvm_v8i16_ty, llvm_v8i16_ty, llvm_i32_ty],
  750. [IntrNoMem]>;
  751. def int_ppc_altivec_vextduhvrx : ClangBuiltin<"__builtin_altivec_vextduhvrx">,
  752. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  753. [llvm_v8i16_ty, llvm_v8i16_ty, llvm_i32_ty],
  754. [IntrNoMem]>;
  755. def int_ppc_altivec_vextduwvlx : ClangBuiltin<"__builtin_altivec_vextduwvlx">,
  756. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  757. [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
  758. [IntrNoMem]>;
  759. def int_ppc_altivec_vextduwvrx : ClangBuiltin<"__builtin_altivec_vextduwvrx">,
  760. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  761. [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
  762. [IntrNoMem]>;
  763. def int_ppc_altivec_vextddvlx : ClangBuiltin<"__builtin_altivec_vextddvlx">,
  764. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  765. [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
  766. [IntrNoMem]>;
  767. def int_ppc_altivec_vextddvrx : ClangBuiltin<"__builtin_altivec_vextddvrx">,
  768. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  769. [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
  770. [IntrNoMem]>;
  771. }
  772. // Vector average.
  773. def int_ppc_altivec_vavgsb : PowerPC_Vec_BBB_Intrinsic<"vavgsb">;
  774. def int_ppc_altivec_vavgsh : PowerPC_Vec_HHH_Intrinsic<"vavgsh">;
  775. def int_ppc_altivec_vavgsw : PowerPC_Vec_WWW_Intrinsic<"vavgsw">;
  776. def int_ppc_altivec_vavgub : PowerPC_Vec_BBB_Intrinsic<"vavgub">;
  777. def int_ppc_altivec_vavguh : PowerPC_Vec_HHH_Intrinsic<"vavguh">;
  778. def int_ppc_altivec_vavguw : PowerPC_Vec_WWW_Intrinsic<"vavguw">;
  779. // Vector maximum.
  780. def int_ppc_altivec_vmaxfp : PowerPC_Vec_FFF_Intrinsic<"vmaxfp">;
  781. def int_ppc_altivec_vmaxsb : PowerPC_Vec_BBB_Intrinsic<"vmaxsb">;
  782. def int_ppc_altivec_vmaxsh : PowerPC_Vec_HHH_Intrinsic<"vmaxsh">;
  783. def int_ppc_altivec_vmaxsw : PowerPC_Vec_WWW_Intrinsic<"vmaxsw">;
  784. def int_ppc_altivec_vmaxsd : PowerPC_Vec_DDD_Intrinsic<"vmaxsd">;
  785. def int_ppc_altivec_vmaxub : PowerPC_Vec_BBB_Intrinsic<"vmaxub">;
  786. def int_ppc_altivec_vmaxuh : PowerPC_Vec_HHH_Intrinsic<"vmaxuh">;
  787. def int_ppc_altivec_vmaxuw : PowerPC_Vec_WWW_Intrinsic<"vmaxuw">;
  788. def int_ppc_altivec_vmaxud : PowerPC_Vec_DDD_Intrinsic<"vmaxud">;
  789. // Vector minimum.
  790. def int_ppc_altivec_vminfp : PowerPC_Vec_FFF_Intrinsic<"vminfp">;
  791. def int_ppc_altivec_vminsb : PowerPC_Vec_BBB_Intrinsic<"vminsb">;
  792. def int_ppc_altivec_vminsh : PowerPC_Vec_HHH_Intrinsic<"vminsh">;
  793. def int_ppc_altivec_vminsw : PowerPC_Vec_WWW_Intrinsic<"vminsw">;
  794. def int_ppc_altivec_vminsd : PowerPC_Vec_DDD_Intrinsic<"vminsd">;
  795. def int_ppc_altivec_vminub : PowerPC_Vec_BBB_Intrinsic<"vminub">;
  796. def int_ppc_altivec_vminuh : PowerPC_Vec_HHH_Intrinsic<"vminuh">;
  797. def int_ppc_altivec_vminuw : PowerPC_Vec_WWW_Intrinsic<"vminuw">;
  798. def int_ppc_altivec_vminud : PowerPC_Vec_DDD_Intrinsic<"vminud">;
  799. // Saturating adds.
  800. def int_ppc_altivec_vaddubs : PowerPC_Vec_BBB_Intrinsic<"vaddubs">;
  801. def int_ppc_altivec_vaddsbs : PowerPC_Vec_BBB_Intrinsic<"vaddsbs">;
  802. def int_ppc_altivec_vadduhs : PowerPC_Vec_HHH_Intrinsic<"vadduhs">;
  803. def int_ppc_altivec_vaddshs : PowerPC_Vec_HHH_Intrinsic<"vaddshs">;
  804. def int_ppc_altivec_vadduws : PowerPC_Vec_WWW_Intrinsic<"vadduws">;
  805. def int_ppc_altivec_vaddsws : PowerPC_Vec_WWW_Intrinsic<"vaddsws">;
  806. def int_ppc_altivec_vaddcuw : PowerPC_Vec_WWW_Intrinsic<"vaddcuw">;
  807. def int_ppc_altivec_vaddcuq : PowerPC_Vec_QQQ_Intrinsic<"vaddcuq">;
  808. // Saturating subs.
  809. def int_ppc_altivec_vsububs : PowerPC_Vec_BBB_Intrinsic<"vsububs">;
  810. def int_ppc_altivec_vsubsbs : PowerPC_Vec_BBB_Intrinsic<"vsubsbs">;
  811. def int_ppc_altivec_vsubuhs : PowerPC_Vec_HHH_Intrinsic<"vsubuhs">;
  812. def int_ppc_altivec_vsubshs : PowerPC_Vec_HHH_Intrinsic<"vsubshs">;
  813. def int_ppc_altivec_vsubuws : PowerPC_Vec_WWW_Intrinsic<"vsubuws">;
  814. def int_ppc_altivec_vsubsws : PowerPC_Vec_WWW_Intrinsic<"vsubsws">;
  815. def int_ppc_altivec_vsubcuw : PowerPC_Vec_WWW_Intrinsic<"vsubcuw">;
  816. def int_ppc_altivec_vsubcuq : PowerPC_Vec_QQQ_Intrinsic<"vsubcuq">;
  817. let TargetPrefix = "ppc" in { // All PPC intrinsics start with "llvm.ppc.".
  818. // Saturating multiply-adds.
  819. def int_ppc_altivec_vmhaddshs : ClangBuiltin<"__builtin_altivec_vmhaddshs">,
  820. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
  821. llvm_v8i16_ty, llvm_v8i16_ty],
  822. [IntrNoMem, IntrHasSideEffects]>;
  823. def int_ppc_altivec_vmhraddshs : ClangBuiltin<"__builtin_altivec_vmhraddshs">,
  824. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
  825. llvm_v8i16_ty, llvm_v8i16_ty],
  826. [IntrNoMem, IntrHasSideEffects]>;
  827. def int_ppc_altivec_vmaddfp : ClangBuiltin<"__builtin_altivec_vmaddfp">,
  828. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
  829. llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  830. def int_ppc_altivec_vnmsubfp : ClangBuiltin<"__builtin_altivec_vnmsubfp">,
  831. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
  832. llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  833. // Vector Multiply Sum Instructions.
  834. def int_ppc_altivec_vmsummbm : ClangBuiltin<"__builtin_altivec_vmsummbm">,
  835. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
  836. llvm_v4i32_ty], [IntrNoMem]>;
  837. def int_ppc_altivec_vmsumshm : ClangBuiltin<"__builtin_altivec_vmsumshm">,
  838. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
  839. llvm_v4i32_ty], [IntrNoMem]>;
  840. def int_ppc_altivec_vmsumshs : ClangBuiltin<"__builtin_altivec_vmsumshs">,
  841. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
  842. llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
  843. def int_ppc_altivec_vmsumubm : ClangBuiltin<"__builtin_altivec_vmsumubm">,
  844. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
  845. llvm_v4i32_ty], [IntrNoMem]>;
  846. def int_ppc_altivec_vmsumuhm : ClangBuiltin<"__builtin_altivec_vmsumuhm">,
  847. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
  848. llvm_v4i32_ty], [IntrNoMem]>;
  849. def int_ppc_altivec_vmsumudm : ClangBuiltin<"__builtin_altivec_vmsumudm">,
  850. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
  851. llvm_v1i128_ty], [IntrNoMem]>;
  852. def int_ppc_altivec_vmsumuhs : ClangBuiltin<"__builtin_altivec_vmsumuhs">,
  853. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
  854. llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
  855. def int_ppc_altivec_vmsumcud : ClangBuiltin<"__builtin_altivec_vmsumcud">,
  856. DefaultAttrsIntrinsic<[llvm_v1i128_ty],
  857. [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v1i128_ty],
  858. [IntrNoMem]>;
  859. // Vector Multiply Instructions.
  860. def int_ppc_altivec_vmulesb : ClangBuiltin<"__builtin_altivec_vmulesb">,
  861. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  862. [IntrNoMem]>;
  863. def int_ppc_altivec_vmulesh : ClangBuiltin<"__builtin_altivec_vmulesh">,
  864. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  865. [IntrNoMem]>;
  866. def int_ppc_altivec_vmulesw : ClangBuiltin<"__builtin_altivec_vmulesw">,
  867. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  868. [IntrNoMem]>;
  869. def int_ppc_altivec_vmulesd : PowerPC_Vec_QDD_Intrinsic<"vmulesd">;
  870. def int_ppc_altivec_vmuleub : ClangBuiltin<"__builtin_altivec_vmuleub">,
  871. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  872. [IntrNoMem]>;
  873. def int_ppc_altivec_vmuleuh : ClangBuiltin<"__builtin_altivec_vmuleuh">,
  874. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  875. [IntrNoMem]>;
  876. def int_ppc_altivec_vmuleuw : ClangBuiltin<"__builtin_altivec_vmuleuw">,
  877. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  878. [IntrNoMem]>;
  879. def int_ppc_altivec_vmuleud : PowerPC_Vec_QDD_Intrinsic<"vmuleud">;
  880. def int_ppc_altivec_vmulosb : ClangBuiltin<"__builtin_altivec_vmulosb">,
  881. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  882. [IntrNoMem]>;
  883. def int_ppc_altivec_vmulosh : ClangBuiltin<"__builtin_altivec_vmulosh">,
  884. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  885. [IntrNoMem]>;
  886. def int_ppc_altivec_vmulosw : ClangBuiltin<"__builtin_altivec_vmulosw">,
  887. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  888. [IntrNoMem]>;
  889. def int_ppc_altivec_vmulosd : PowerPC_Vec_QDD_Intrinsic<"vmulosd">;
  890. def int_ppc_altivec_vmuloub : ClangBuiltin<"__builtin_altivec_vmuloub">,
  891. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  892. [IntrNoMem]>;
  893. def int_ppc_altivec_vmulouh : ClangBuiltin<"__builtin_altivec_vmulouh">,
  894. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  895. [IntrNoMem]>;
  896. def int_ppc_altivec_vmulouw : ClangBuiltin<"__builtin_altivec_vmulouw">,
  897. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  898. [IntrNoMem]>;
  899. def int_ppc_altivec_vmuloud : PowerPC_Vec_QDD_Intrinsic<"vmuloud">;
  900. // Vector Sum Instructions.
  901. def int_ppc_altivec_vsumsws : ClangBuiltin<"__builtin_altivec_vsumsws">,
  902. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  903. [IntrNoMem, IntrHasSideEffects]>;
  904. def int_ppc_altivec_vsum2sws : ClangBuiltin<"__builtin_altivec_vsum2sws">,
  905. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  906. [IntrNoMem, IntrHasSideEffects]>;
  907. def int_ppc_altivec_vsum4sbs : ClangBuiltin<"__builtin_altivec_vsum4sbs">,
  908. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
  909. [IntrNoMem, IntrHasSideEffects]>;
  910. def int_ppc_altivec_vsum4shs : ClangBuiltin<"__builtin_altivec_vsum4shs">,
  911. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v4i32_ty],
  912. [IntrNoMem, IntrHasSideEffects]>;
  913. def int_ppc_altivec_vsum4ubs : ClangBuiltin<"__builtin_altivec_vsum4ubs">,
  914. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
  915. [IntrNoMem, IntrHasSideEffects]>;
  916. // Vector Sign Extension Instructions
  917. def int_ppc_altivec_vextsb2w : ClangBuiltin<"__builtin_altivec_vextsb2w">,
  918. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  919. def int_ppc_altivec_vextsb2d : ClangBuiltin<"__builtin_altivec_vextsb2d">,
  920. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  921. def int_ppc_altivec_vextsh2w : ClangBuiltin<"__builtin_altivec_vextsh2w">,
  922. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  923. def int_ppc_altivec_vextsh2d : ClangBuiltin<"__builtin_altivec_vextsh2d">,
  924. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  925. def int_ppc_altivec_vextsw2d : ClangBuiltin<"__builtin_altivec_vextsw2d">,
  926. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
  927. def int_ppc_altivec_vextsd2q : ClangBuiltin<"__builtin_altivec_vextsd2q">,
  928. DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty], [IntrNoMem]>;
  929. // Other multiplies.
  930. def int_ppc_altivec_vmladduhm : ClangBuiltin<"__builtin_altivec_vmladduhm">,
  931. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
  932. llvm_v8i16_ty], [IntrNoMem]>;
  933. // Packs.
  934. def int_ppc_altivec_vpkpx : ClangBuiltin<"__builtin_altivec_vpkpx">,
  935. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  936. [IntrNoMem]>;
  937. def int_ppc_altivec_vpkshss : ClangBuiltin<"__builtin_altivec_vpkshss">,
  938. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  939. [IntrNoMem, IntrHasSideEffects]>;
  940. def int_ppc_altivec_vpkshus : ClangBuiltin<"__builtin_altivec_vpkshus">,
  941. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  942. [IntrNoMem, IntrHasSideEffects]>;
  943. def int_ppc_altivec_vpkswss : ClangBuiltin<"__builtin_altivec_vpkswss">,
  944. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  945. [IntrNoMem, IntrHasSideEffects]>;
  946. def int_ppc_altivec_vpkswus : ClangBuiltin<"__builtin_altivec_vpkswus">,
  947. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  948. [IntrNoMem, IntrHasSideEffects]>;
  949. def int_ppc_altivec_vpksdss : ClangBuiltin<"__builtin_altivec_vpksdss">,
  950. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  951. [IntrNoMem, IntrHasSideEffects]>;
  952. def int_ppc_altivec_vpksdus : ClangBuiltin<"__builtin_altivec_vpksdus">,
  953. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  954. [IntrNoMem, IntrHasSideEffects]>;
  955. // vpkuhum is lowered to a shuffle.
  956. def int_ppc_altivec_vpkuhus : ClangBuiltin<"__builtin_altivec_vpkuhus">,
  957. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
  958. [IntrNoMem, IntrHasSideEffects]>;
  959. // vpkuwum is lowered to a shuffle.
  960. def int_ppc_altivec_vpkuwus : ClangBuiltin<"__builtin_altivec_vpkuwus">,
  961. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
  962. [IntrNoMem, IntrHasSideEffects]>;
  963. // vpkudum is lowered to a shuffle.
  964. def int_ppc_altivec_vpkudus : ClangBuiltin<"__builtin_altivec_vpkudus">,
  965. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  966. [IntrNoMem, IntrHasSideEffects]>;
  967. // Unpacks.
  968. def int_ppc_altivec_vupkhpx : ClangBuiltin<"__builtin_altivec_vupkhpx">,
  969. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  970. def int_ppc_altivec_vupkhsb : ClangBuiltin<"__builtin_altivec_vupkhsb">,
  971. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  972. def int_ppc_altivec_vupkhsh : ClangBuiltin<"__builtin_altivec_vupkhsh">,
  973. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  974. def int_ppc_altivec_vupkhsw : ClangBuiltin<"__builtin_altivec_vupkhsw">,
  975. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
  976. def int_ppc_altivec_vupklpx : ClangBuiltin<"__builtin_altivec_vupklpx">,
  977. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  978. def int_ppc_altivec_vupklsb : ClangBuiltin<"__builtin_altivec_vupklsb">,
  979. DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  980. def int_ppc_altivec_vupklsh : ClangBuiltin<"__builtin_altivec_vupklsh">,
  981. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
  982. def int_ppc_altivec_vupklsw : ClangBuiltin<"__builtin_altivec_vupklsw">,
  983. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
  984. // FP <-> integer conversion.
  985. def int_ppc_altivec_vcfsx : ClangBuiltin<"__builtin_altivec_vcfsx">,
  986. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
  987. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  988. def int_ppc_altivec_vcfux : ClangBuiltin<"__builtin_altivec_vcfux">,
  989. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
  990. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  991. def int_ppc_altivec_vctsxs : ClangBuiltin<"__builtin_altivec_vctsxs">,
  992. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
  993. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  994. def int_ppc_altivec_vctuxs : ClangBuiltin<"__builtin_altivec_vctuxs">,
  995. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
  996. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  997. def int_ppc_altivec_vrfim : ClangBuiltin<"__builtin_altivec_vrfim">,
  998. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  999. def int_ppc_altivec_vrfin : ClangBuiltin<"__builtin_altivec_vrfin">,
  1000. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1001. def int_ppc_altivec_vrfip : ClangBuiltin<"__builtin_altivec_vrfip">,
  1002. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1003. def int_ppc_altivec_vrfiz : ClangBuiltin<"__builtin_altivec_vrfiz">,
  1004. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1005. // Add Extended Quadword
  1006. def int_ppc_altivec_vaddeuqm : ClangBuiltin<"__builtin_altivec_vaddeuqm">,
  1007. DefaultAttrsIntrinsic<[llvm_v1i128_ty],
  1008. [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
  1009. [IntrNoMem]>;
  1010. def int_ppc_altivec_vaddecuq : ClangBuiltin<"__builtin_altivec_vaddecuq">,
  1011. DefaultAttrsIntrinsic<[llvm_v1i128_ty],
  1012. [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
  1013. [IntrNoMem]>;
  1014. // Sub Extended Quadword
  1015. def int_ppc_altivec_vsubeuqm : ClangBuiltin<"__builtin_altivec_vsubeuqm">,
  1016. DefaultAttrsIntrinsic<[llvm_v1i128_ty],
  1017. [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
  1018. [IntrNoMem]>;
  1019. def int_ppc_altivec_vsubecuq : ClangBuiltin<"__builtin_altivec_vsubecuq">,
  1020. DefaultAttrsIntrinsic<[llvm_v1i128_ty],
  1021. [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
  1022. [IntrNoMem]>;
  1023. // P10 Vector Count Leading / Trailing Zeroes under bit Mask Builtins.
  1024. def int_ppc_altivec_vclzdm : ClangBuiltin<"__builtin_altivec_vclzdm">,
  1025. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  1026. [IntrNoMem]>;
  1027. def int_ppc_altivec_vctzdm : ClangBuiltin<"__builtin_altivec_vctzdm">,
  1028. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
  1029. [IntrNoMem]>;
  1030. }
  1031. def int_ppc_altivec_vsl : PowerPC_Vec_WWW_Intrinsic<"vsl">;
  1032. def int_ppc_altivec_vslo : PowerPC_Vec_WWW_Intrinsic<"vslo">;
  1033. def int_ppc_altivec_vslb : PowerPC_Vec_BBB_Intrinsic<"vslb">;
  1034. def int_ppc_altivec_vslv : PowerPC_Vec_BBB_Intrinsic<"vslv">;
  1035. def int_ppc_altivec_vsrv : PowerPC_Vec_BBB_Intrinsic<"vsrv">;
  1036. def int_ppc_altivec_vslh : PowerPC_Vec_HHH_Intrinsic<"vslh">;
  1037. def int_ppc_altivec_vslw : PowerPC_Vec_WWW_Intrinsic<"vslw">;
  1038. // Right Shifts.
  1039. def int_ppc_altivec_vsr : PowerPC_Vec_WWW_Intrinsic<"vsr">;
  1040. def int_ppc_altivec_vsro : PowerPC_Vec_WWW_Intrinsic<"vsro">;
  1041. def int_ppc_altivec_vsrb : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
  1042. def int_ppc_altivec_vsrh : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
  1043. def int_ppc_altivec_vsrw : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
  1044. def int_ppc_altivec_vsrab : PowerPC_Vec_BBB_Intrinsic<"vsrab">;
  1045. def int_ppc_altivec_vsrah : PowerPC_Vec_HHH_Intrinsic<"vsrah">;
  1046. def int_ppc_altivec_vsraw : PowerPC_Vec_WWW_Intrinsic<"vsraw">;
  1047. // Rotates.
  1048. def int_ppc_altivec_vrlb : PowerPC_Vec_BBB_Intrinsic<"vrlb">;
  1049. def int_ppc_altivec_vrlh : PowerPC_Vec_HHH_Intrinsic<"vrlh">;
  1050. def int_ppc_altivec_vrlw : PowerPC_Vec_WWW_Intrinsic<"vrlw">;
  1051. def int_ppc_altivec_vrld : PowerPC_Vec_DDD_Intrinsic<"vrld">;
  1052. let TargetPrefix = "ppc" in { // All PPC intrinsics start with "llvm.ppc.".
  1053. // Miscellaneous.
  1054. def int_ppc_altivec_lvsl :
  1055. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
  1056. def int_ppc_altivec_lvsr :
  1057. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
  1058. def int_ppc_altivec_vperm : ClangBuiltin<"__builtin_altivec_vperm_4si">,
  1059. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
  1060. llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
  1061. def int_ppc_altivec_vsel : ClangBuiltin<"__builtin_altivec_vsel_4si">,
  1062. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
  1063. llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
  1064. def int_ppc_altivec_vgbbd : ClangBuiltin<"__builtin_altivec_vgbbd">,
  1065. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
  1066. def int_ppc_altivec_vbpermq : ClangBuiltin<"__builtin_altivec_vbpermq">,
  1067. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
  1068. [IntrNoMem]>;
  1069. def int_ppc_altivec_vbpermd : ClangBuiltin<"__builtin_altivec_vbpermd">,
  1070. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v16i8_ty],
  1071. [IntrNoMem]>;
  1072. }
  1073. def int_ppc_altivec_vexptefp : PowerPC_Vec_FF_Intrinsic<"vexptefp">;
  1074. def int_ppc_altivec_vlogefp : PowerPC_Vec_FF_Intrinsic<"vlogefp">;
  1075. def int_ppc_altivec_vrefp : PowerPC_Vec_FF_Intrinsic<"vrefp">;
  1076. def int_ppc_altivec_vrsqrtefp : PowerPC_Vec_FF_Intrinsic<"vrsqrtefp">;
  1077. // Power8 Intrinsics
  1078. // Crypto
  1079. let TargetPrefix = "ppc" in { // All PPC intrinsics start with "llvm.ppc.".
  1080. def int_ppc_altivec_crypto_vsbox :
  1081. ClangBuiltin<"__builtin_altivec_crypto_vsbox">,
  1082. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
  1083. def int_ppc_altivec_crypto_vpermxor :
  1084. ClangBuiltin<"__builtin_altivec_crypto_vpermxor">,
  1085. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
  1086. llvm_v16i8_ty], [IntrNoMem]>;
  1087. def int_ppc_altivec_crypto_vpermxor_be :
  1088. ClangBuiltin<"__builtin_altivec_crypto_vpermxor_be">,
  1089. DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
  1090. llvm_v16i8_ty], [IntrNoMem]>;
  1091. def int_ppc_altivec_crypto_vshasigmad :
  1092. ClangBuiltin<"__builtin_altivec_crypto_vshasigmad">,
  1093. DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i32_ty,
  1094. llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>,
  1095. ImmArg<ArgIndex<2>>]>;
  1096. def int_ppc_altivec_crypto_vshasigmaw :
  1097. ClangBuiltin<"__builtin_altivec_crypto_vshasigmaw">,
  1098. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_i32_ty,
  1099. llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>,
  1100. ImmArg<ArgIndex<2>>]>;
  1101. }
  1102. def int_ppc_altivec_crypto_vcipher :
  1103. PowerPC_Vec_DDD_Intrinsic<"crypto_vcipher">;
  1104. def int_ppc_altivec_crypto_vcipherlast :
  1105. PowerPC_Vec_DDD_Intrinsic<"crypto_vcipherlast">;
  1106. def int_ppc_altivec_crypto_vncipher :
  1107. PowerPC_Vec_DDD_Intrinsic<"crypto_vncipher">;
  1108. def int_ppc_altivec_crypto_vncipherlast :
  1109. PowerPC_Vec_DDD_Intrinsic<"crypto_vncipherlast">;
  1110. def int_ppc_altivec_crypto_vpmsumb :
  1111. PowerPC_Vec_BBB_Intrinsic<"crypto_vpmsumb">;
  1112. def int_ppc_altivec_crypto_vpmsumh :
  1113. PowerPC_Vec_HHH_Intrinsic<"crypto_vpmsumh">;
  1114. def int_ppc_altivec_crypto_vpmsumw :
  1115. PowerPC_Vec_WWW_Intrinsic<"crypto_vpmsumw">;
  1116. def int_ppc_altivec_crypto_vpmsumd :
  1117. PowerPC_Vec_DDD_Intrinsic<"crypto_vpmsumd">;
  1118. // Absolute Difference intrinsics
  1119. def int_ppc_altivec_vabsdub : PowerPC_Vec_BBB_Intrinsic<"vabsdub">;
  1120. def int_ppc_altivec_vabsduh : PowerPC_Vec_HHH_Intrinsic<"vabsduh">;
  1121. def int_ppc_altivec_vabsduw : PowerPC_Vec_WWW_Intrinsic<"vabsduw">;
  1122. // Vector rotates
  1123. def int_ppc_altivec_vrlwnm :
  1124. PowerPC_Vec_Intrinsic<"vrlwnm", [llvm_v4i32_ty],
  1125. [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
  1126. def int_ppc_altivec_vrlwmi :
  1127. PowerPC_Vec_Intrinsic<"vrlwmi", [llvm_v4i32_ty],
  1128. [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
  1129. [IntrNoMem]>;
  1130. def int_ppc_altivec_vrldnm :
  1131. PowerPC_Vec_Intrinsic<"vrldnm", [llvm_v2i64_ty],
  1132. [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
  1133. def int_ppc_altivec_vrldmi :
  1134. PowerPC_Vec_Intrinsic<"vrldmi", [llvm_v2i64_ty],
  1135. [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
  1136. [IntrNoMem]>;
  1137. def int_ppc_altivec_vrlqnm :
  1138. PowerPC_Vec_Intrinsic<"vrlqnm", [llvm_v1i128_ty],
  1139. [llvm_v1i128_ty, llvm_v1i128_ty],
  1140. [IntrNoMem]>;
  1141. def int_ppc_altivec_vrlqmi :
  1142. PowerPC_Vec_Intrinsic<"vrlqmi", [llvm_v1i128_ty],
  1143. [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
  1144. [IntrNoMem]>;
  1145. // Vector Divide Extended Intrinsics.
  1146. def int_ppc_altivec_vdivesw : PowerPC_Vec_WWW_Intrinsic<"vdivesw">;
  1147. def int_ppc_altivec_vdiveuw : PowerPC_Vec_WWW_Intrinsic<"vdiveuw">;
  1148. def int_ppc_altivec_vdivesd : PowerPC_Vec_DDD_Intrinsic<"vdivesd">;
  1149. def int_ppc_altivec_vdiveud : PowerPC_Vec_DDD_Intrinsic<"vdiveud">;
  1150. def int_ppc_altivec_vdivesq : PowerPC_Vec_QQQ_Intrinsic<"vdivesq">;
  1151. def int_ppc_altivec_vdiveuq : PowerPC_Vec_QQQ_Intrinsic<"vdiveuq">;
  1152. // Vector Multiply High Intrinsics.
  1153. def int_ppc_altivec_vmulhsw : PowerPC_Vec_WWW_Intrinsic<"vmulhsw">;
  1154. def int_ppc_altivec_vmulhuw : PowerPC_Vec_WWW_Intrinsic<"vmulhuw">;
  1155. def int_ppc_altivec_vmulhsd : PowerPC_Vec_DDD_Intrinsic<"vmulhsd">;
  1156. def int_ppc_altivec_vmulhud : PowerPC_Vec_DDD_Intrinsic<"vmulhud">;
  1157. //===----------------------------------------------------------------------===//
  1158. // PowerPC VSX Intrinsic Definitions.
  1159. let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
  1160. // Vector load.
  1161. def int_ppc_vsx_lxvw4x :
  1162. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
  1163. [IntrReadMem, IntrArgMemOnly]>;
  1164. def int_ppc_vsx_lxvd2x :
  1165. DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_ptr_ty],
  1166. [IntrReadMem, IntrArgMemOnly]>;
  1167. def int_ppc_vsx_lxvw4x_be :
  1168. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
  1169. [IntrReadMem, IntrArgMemOnly]>;
  1170. def int_ppc_vsx_lxvd2x_be :
  1171. DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_ptr_ty],
  1172. [IntrReadMem, IntrArgMemOnly]>;
  1173. def int_ppc_vsx_lxvl :
  1174. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty],
  1175. [IntrReadMem, IntrArgMemOnly]>;
  1176. def int_ppc_vsx_lxvll :
  1177. DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty],
  1178. [IntrReadMem, IntrArgMemOnly]>;
  1179. def int_ppc_vsx_lxvp :
  1180. DefaultAttrsIntrinsic<[llvm_v256i1_ty], [llvm_ptr_ty],
  1181. [IntrReadMem, IntrArgMemOnly]>;
  1182. // Vector store.
  1183. def int_ppc_vsx_stxvw4x : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
  1184. [IntrWriteMem, IntrArgMemOnly]>;
  1185. def int_ppc_vsx_stxvd2x : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
  1186. [IntrWriteMem, IntrArgMemOnly]>;
  1187. def int_ppc_vsx_stxvw4x_be : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
  1188. [IntrWriteMem, IntrArgMemOnly]>;
  1189. def int_ppc_vsx_stxvd2x_be : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
  1190. [IntrWriteMem, IntrArgMemOnly]>;
  1191. def int_ppc_vsx_stxvl :
  1192. Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
  1193. [IntrWriteMem, IntrArgMemOnly]>;
  1194. def int_ppc_vsx_stxvll :
  1195. Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
  1196. [IntrWriteMem, IntrArgMemOnly]>;
  1197. def int_ppc_vsx_stxvp :
  1198. Intrinsic<[], [llvm_v256i1_ty, llvm_ptr_ty], [IntrWriteMem,
  1199. IntrArgMemOnly]>;
  1200. // Vector and scalar maximum.
  1201. def int_ppc_vsx_xvmaxdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmaxdp">;
  1202. def int_ppc_vsx_xvmaxsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvmaxsp">;
  1203. def int_ppc_vsx_xsmaxdp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmaxdp">;
  1204. // Vector and scalar minimum.
  1205. def int_ppc_vsx_xvmindp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmindp">;
  1206. def int_ppc_vsx_xvminsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvminsp">;
  1207. def int_ppc_vsx_xsmindp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmindp">;
  1208. // Vector divide.
  1209. def int_ppc_vsx_xvdivdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvdivdp">;
  1210. def int_ppc_vsx_xvdivsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvdivsp">;
  1211. // Vector round-to-infinity (ceil)
  1212. def int_ppc_vsx_xvrspip :
  1213. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1214. def int_ppc_vsx_xvrdpip :
  1215. DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
  1216. // Vector reciprocal estimate
  1217. def int_ppc_vsx_xvresp : ClangBuiltin<"__builtin_vsx_xvresp">,
  1218. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1219. def int_ppc_vsx_xvredp : ClangBuiltin<"__builtin_vsx_xvredp">,
  1220. DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
  1221. // Vector rsqrte
  1222. def int_ppc_vsx_xvrsqrtesp : ClangBuiltin<"__builtin_vsx_xvrsqrtesp">,
  1223. DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1224. def int_ppc_vsx_xvrsqrtedp : ClangBuiltin<"__builtin_vsx_xvrsqrtedp">,
  1225. DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
  1226. // Vector compare
  1227. def int_ppc_vsx_xvcmpeqdp :
  1228. PowerPC_VSX_Intrinsic<"xvcmpeqdp", [llvm_v2i64_ty],
  1229. [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
  1230. def int_ppc_vsx_xvcmpeqdp_p : ClangBuiltin<"__builtin_vsx_xvcmpeqdp_p">,
  1231. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1232. [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
  1233. [IntrNoMem]>;
  1234. def int_ppc_vsx_xvcmpeqsp :
  1235. PowerPC_VSX_Intrinsic<"xvcmpeqsp", [llvm_v4i32_ty],
  1236. [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  1237. def int_ppc_vsx_xvcmpeqsp_p : ClangBuiltin<"__builtin_vsx_xvcmpeqsp_p">,
  1238. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1239. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  1240. [IntrNoMem]>;
  1241. def int_ppc_vsx_xvcmpgedp :
  1242. PowerPC_VSX_Intrinsic<"xvcmpgedp", [llvm_v2i64_ty],
  1243. [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
  1244. def int_ppc_vsx_xvcmpgedp_p : ClangBuiltin<"__builtin_vsx_xvcmpgedp_p">,
  1245. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1246. [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
  1247. [IntrNoMem]>;
  1248. def int_ppc_vsx_xvcmpgesp :
  1249. PowerPC_VSX_Intrinsic<"xvcmpgesp", [llvm_v4i32_ty],
  1250. [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  1251. def int_ppc_vsx_xvcmpgesp_p : ClangBuiltin<"__builtin_vsx_xvcmpgesp_p">,
  1252. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1253. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  1254. [IntrNoMem]>;
  1255. def int_ppc_vsx_xvcmpgtdp :
  1256. PowerPC_VSX_Intrinsic<"xvcmpgtdp", [llvm_v2i64_ty],
  1257. [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
  1258. def int_ppc_vsx_xvcmpgtdp_p : ClangBuiltin<"__builtin_vsx_xvcmpgtdp_p">,
  1259. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1260. [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
  1261. [IntrNoMem]>;
  1262. def int_ppc_vsx_xvcmpgtsp :
  1263. PowerPC_VSX_Intrinsic<"xvcmpgtsp", [llvm_v4i32_ty],
  1264. [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  1265. def int_ppc_vsx_xvcmpgtsp_p : ClangBuiltin<"__builtin_vsx_xvcmpgtsp_p">,
  1266. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1267. [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
  1268. [IntrNoMem]>;
  1269. def int_ppc_vsx_xxleqv :
  1270. PowerPC_VSX_Intrinsic<"xxleqv", [llvm_v4i32_ty],
  1271. [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
  1272. def int_ppc_vsx_xviexpdp :
  1273. PowerPC_VSX_Intrinsic<"xviexpdp",[llvm_v2f64_ty],
  1274. [llvm_v2i64_ty, llvm_v2i64_ty],[IntrNoMem]>;
  1275. def int_ppc_vsx_xviexpsp :
  1276. PowerPC_VSX_Intrinsic<"xviexpsp",[llvm_v4f32_ty],
  1277. [llvm_v4i32_ty, llvm_v4i32_ty],[IntrNoMem]>;
  1278. def int_ppc_vsx_xvcvdpsxws :
  1279. PowerPC_VSX_Intrinsic<"xvcvdpsxws", [llvm_v4i32_ty],
  1280. [llvm_v2f64_ty], [IntrNoMem]>;
  1281. def int_ppc_vsx_xvcvdpuxws :
  1282. PowerPC_VSX_Intrinsic<"xvcvdpuxws", [llvm_v4i32_ty],
  1283. [llvm_v2f64_ty], [IntrNoMem]>;
  1284. def int_ppc_vsx_xvcvspsxds :
  1285. PowerPC_VSX_Intrinsic<"xvcvspsxds", [llvm_v2i64_ty],
  1286. [llvm_v4f32_ty], [IntrNoMem]>;
  1287. def int_ppc_vsx_xvcvspuxds :
  1288. PowerPC_VSX_Intrinsic<"xvcvspuxds", [llvm_v2i64_ty],
  1289. [llvm_v4f32_ty], [IntrNoMem]>;
  1290. def int_ppc_vsx_xvcvsxwdp :
  1291. PowerPC_VSX_Intrinsic<"xvcvsxwdp", [llvm_v2f64_ty],
  1292. [llvm_v4i32_ty], [IntrNoMem]>;
  1293. def int_ppc_vsx_xvcvuxwdp :
  1294. PowerPC_VSX_Intrinsic<"xvcvuxwdp", [llvm_v2f64_ty],
  1295. [llvm_v4i32_ty], [IntrNoMem]>;
  1296. def int_ppc_vsx_xvcvspdp :
  1297. PowerPC_VSX_Intrinsic<"xvcvspdp", [llvm_v2f64_ty],
  1298. [llvm_v4f32_ty], [IntrNoMem]>;
  1299. def int_ppc_vsx_xvcvsxdsp :
  1300. PowerPC_VSX_Intrinsic<"xvcvsxdsp", [llvm_v4f32_ty],
  1301. [llvm_v2i64_ty], [IntrNoMem]>;
  1302. def int_ppc_vsx_xvcvuxdsp :
  1303. PowerPC_VSX_Intrinsic<"xvcvuxdsp", [llvm_v4f32_ty],
  1304. [llvm_v2i64_ty], [IntrNoMem]>;
  1305. def int_ppc_vsx_xvcvdpsp :
  1306. PowerPC_VSX_Intrinsic<"xvcvdpsp", [llvm_v4f32_ty],
  1307. [llvm_v2f64_ty], [IntrNoMem]>;
  1308. def int_ppc_vsx_xvcvsphp :
  1309. PowerPC_VSX_Intrinsic<"xvcvsphp", [llvm_v4f32_ty],
  1310. [llvm_v4f32_ty], [IntrNoMem]>;
  1311. def int_ppc_vsx_xvxexpdp :
  1312. PowerPC_VSX_Intrinsic<"xvxexpdp", [llvm_v2i64_ty],
  1313. [llvm_v2f64_ty], [IntrNoMem]>;
  1314. def int_ppc_vsx_xvxexpsp :
  1315. PowerPC_VSX_Intrinsic<"xvxexpsp", [llvm_v4i32_ty],
  1316. [llvm_v4f32_ty], [IntrNoMem]>;
  1317. def int_ppc_vsx_xvxsigdp :
  1318. PowerPC_VSX_Intrinsic<"xvxsigdp", [llvm_v2i64_ty],
  1319. [llvm_v2f64_ty], [IntrNoMem]>;
  1320. def int_ppc_vsx_xvxsigsp :
  1321. PowerPC_VSX_Intrinsic<"xvxsigsp", [llvm_v4i32_ty],
  1322. [llvm_v4f32_ty], [IntrNoMem]>;
  1323. def int_ppc_vsx_xvtstdcdp :
  1324. PowerPC_VSX_Intrinsic<"xvtstdcdp", [llvm_v2i64_ty],
  1325. [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  1326. def int_ppc_vsx_xvtstdcsp :
  1327. PowerPC_VSX_Intrinsic<"xvtstdcsp", [llvm_v4i32_ty],
  1328. [llvm_v4f32_ty,llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  1329. def int_ppc_vsx_xvcvhpsp :
  1330. PowerPC_VSX_Intrinsic<"xvcvhpsp", [llvm_v4f32_ty],
  1331. [llvm_v8i16_ty],[IntrNoMem]>;
  1332. def int_ppc_vsx_xvcvspbf16 :
  1333. PowerPC_VSX_Intrinsic<"xvcvspbf16", [llvm_v16i8_ty],
  1334. [llvm_v16i8_ty], [IntrNoMem]>;
  1335. def int_ppc_vsx_xvcvbf16spn :
  1336. PowerPC_VSX_Intrinsic<"xvcvbf16spn", [llvm_v16i8_ty],
  1337. [llvm_v16i8_ty], [IntrNoMem]>;
  1338. def int_ppc_vsx_xxextractuw :
  1339. PowerPC_VSX_Intrinsic<"xxextractuw",[llvm_v2i64_ty],
  1340. [llvm_v2i64_ty,llvm_i32_ty], [IntrNoMem]>;
  1341. def int_ppc_vsx_xxinsertw :
  1342. PowerPC_VSX_Intrinsic<"xxinsertw",[llvm_v4i32_ty],
  1343. [llvm_v4i32_ty,llvm_v2i64_ty,llvm_i32_ty],
  1344. [IntrNoMem]>;
  1345. def int_ppc_vsx_xvtlsbb :
  1346. PowerPC_VSX_Intrinsic<"xvtlsbb", [llvm_i32_ty],
  1347. [llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
  1348. def int_ppc_vsx_xvtdivdp :
  1349. PowerPC_VSX_Intrinsic<"xvtdivdp", [llvm_i32_ty],
  1350. [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
  1351. def int_ppc_vsx_xvtdivsp :
  1352. PowerPC_VSX_Intrinsic<"xvtdivsp", [llvm_i32_ty],
  1353. [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
  1354. def int_ppc_vsx_xvtsqrtdp :
  1355. PowerPC_VSX_Intrinsic<"xvtsqrtdp", [llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
  1356. def int_ppc_vsx_xvtsqrtsp :
  1357. PowerPC_VSX_Intrinsic<"xvtsqrtsp", [llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
  1358. def int_ppc_vsx_xxeval :
  1359. PowerPC_VSX_Intrinsic<"xxeval", [llvm_v2i64_ty],
  1360. [llvm_v2i64_ty, llvm_v2i64_ty,
  1361. llvm_v2i64_ty, llvm_i32_ty],
  1362. [IntrNoMem, ImmArg<ArgIndex<3>>]>;
  1363. def int_ppc_vsx_xxgenpcvbm :
  1364. PowerPC_VSX_Intrinsic<"xxgenpcvbm", [llvm_v16i8_ty],
  1365. [llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
  1366. def int_ppc_vsx_xxgenpcvhm :
  1367. PowerPC_VSX_Intrinsic<"xxgenpcvhm", [llvm_v8i16_ty],
  1368. [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem]>;
  1369. def int_ppc_vsx_xxgenpcvwm :
  1370. PowerPC_VSX_Intrinsic<"xxgenpcvwm", [llvm_v4i32_ty],
  1371. [llvm_v4i32_ty, llvm_i32_ty], [IntrNoMem]>;
  1372. def int_ppc_vsx_xxgenpcvdm :
  1373. PowerPC_VSX_Intrinsic<"xxgenpcvdm", [llvm_v2i64_ty],
  1374. [llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>;
  1375. // P10 VSX Vector permute extended.
  1376. def int_ppc_vsx_xxpermx :
  1377. ClangBuiltin<"__builtin_vsx_xxpermx">,
  1378. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  1379. [llvm_v16i8_ty,llvm_v16i8_ty,llvm_v16i8_ty,
  1380. llvm_i32_ty],
  1381. [IntrNoMem, ImmArg<ArgIndex<3>>]>;
  1382. // P10 VSX Vector Blend Variable.
  1383. def int_ppc_vsx_xxblendvb: ClangBuiltin<"__builtin_vsx_xxblendvb">,
  1384. DefaultAttrsIntrinsic<[llvm_v16i8_ty],
  1385. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
  1386. [IntrNoMem]>;
  1387. def int_ppc_vsx_xxblendvh: ClangBuiltin<"__builtin_vsx_xxblendvh">,
  1388. DefaultAttrsIntrinsic<[llvm_v8i16_ty],
  1389. [llvm_v8i16_ty, llvm_v8i16_ty,llvm_v8i16_ty],
  1390. [IntrNoMem]>;
  1391. def int_ppc_vsx_xxblendvw: ClangBuiltin<"__builtin_vsx_xxblendvw">,
  1392. DefaultAttrsIntrinsic<[llvm_v4i32_ty],
  1393. [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
  1394. [IntrNoMem]>;
  1395. def int_ppc_vsx_xxblendvd: ClangBuiltin<"__builtin_vsx_xxblendvd">,
  1396. DefaultAttrsIntrinsic<[llvm_v2i64_ty],
  1397. [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
  1398. [IntrNoMem]>;
  1399. }
  1400. //===----------------------------------------------------------------------===//
  1401. // PowerPC HTM Intrinsic Definitions.
  1402. let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
  1403. def int_ppc_tbegin : ClangBuiltin<"__builtin_tbegin">,
  1404. Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
  1405. def int_ppc_tend : ClangBuiltin<"__builtin_tend">,
  1406. Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
  1407. def int_ppc_tabort : ClangBuiltin<"__builtin_tabort">,
  1408. Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
  1409. def int_ppc_tabortwc : ClangBuiltin<"__builtin_tabortwc">,
  1410. Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
  1411. def int_ppc_tabortwci : ClangBuiltin<"__builtin_tabortwci">,
  1412. Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
  1413. def int_ppc_tabortdc : ClangBuiltin<"__builtin_tabortdc">,
  1414. Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
  1415. def int_ppc_tabortdci : ClangBuiltin<"__builtin_tabortdci">,
  1416. Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
  1417. def int_ppc_tcheck : ClangBuiltin<"__builtin_tcheck">,
  1418. Intrinsic<[llvm_i32_ty], [], []>;
  1419. def int_ppc_treclaim : ClangBuiltin<"__builtin_treclaim">,
  1420. Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
  1421. def int_ppc_trechkpt : ClangBuiltin<"__builtin_trechkpt">,
  1422. Intrinsic<[llvm_i32_ty], [], []>;
  1423. def int_ppc_tsr : ClangBuiltin<"__builtin_tsr">,
  1424. Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
  1425. def int_ppc_get_texasr : ClangBuiltin<"__builtin_get_texasr">,
  1426. Intrinsic<[llvm_i64_ty], [], []>;
  1427. def int_ppc_get_texasru : ClangBuiltin<"__builtin_get_texasru">,
  1428. Intrinsic<[llvm_i64_ty], [], []>;
  1429. def int_ppc_get_tfhar : ClangBuiltin<"__builtin_get_tfhar">,
  1430. Intrinsic<[llvm_i64_ty], [], []>;
  1431. def int_ppc_get_tfiar : ClangBuiltin<"__builtin_get_tfiar">,
  1432. Intrinsic<[llvm_i64_ty], [], []>;
  1433. def int_ppc_set_texasr : ClangBuiltin<"__builtin_set_texasr">,
  1434. Intrinsic<[], [llvm_i64_ty], []>;
  1435. def int_ppc_set_texasru : ClangBuiltin<"__builtin_set_texasru">,
  1436. Intrinsic<[], [llvm_i64_ty], []>;
  1437. def int_ppc_set_tfhar : ClangBuiltin<"__builtin_set_tfhar">,
  1438. Intrinsic<[], [llvm_i64_ty], []>;
  1439. def int_ppc_set_tfiar : ClangBuiltin<"__builtin_set_tfiar">,
  1440. Intrinsic<[], [llvm_i64_ty], []>;
  1441. // Extended mnemonics
  1442. def int_ppc_tendall : ClangBuiltin<"__builtin_tendall">,
  1443. Intrinsic<[llvm_i32_ty], [], []>;
  1444. def int_ppc_tresume : ClangBuiltin<"__builtin_tresume">,
  1445. Intrinsic<[llvm_i32_ty], [], []>;
  1446. def int_ppc_tsuspend : ClangBuiltin<"__builtin_tsuspend">,
  1447. Intrinsic<[llvm_i32_ty], [], []>;
  1448. def int_ppc_ttest : ClangBuiltin<"__builtin_ttest">,
  1449. Intrinsic<[llvm_i64_ty], [], []>;
  1450. // We currently use llvm.ppc.cfence in the context of atomic load which
  1451. // in LLVM IR requires its type to be one of integer, pointer and
  1452. // float point type. So llvm_any_ty here refers to type mentioned above.
  1453. // Backend is supposed to lower these types to appropriate MVTs.
  1454. def int_ppc_cfence : Intrinsic<[], [llvm_any_ty], []>;
  1455. // PowerPC set FPSCR Intrinsic Definitions.
  1456. def int_ppc_setrnd : ClangBuiltin<"__builtin_setrnd">,
  1457. Intrinsic<[llvm_double_ty], [llvm_i32_ty], []>;
  1458. }
  1459. let TargetPrefix = "ppc" in {
  1460. def int_ppc_vsx_assemble_pair :
  1461. DefaultAttrsIntrinsic<[llvm_v256i1_ty],
  1462. [llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
  1463. def int_ppc_vsx_disassemble_pair :
  1464. DefaultAttrsIntrinsic<[llvm_v16i8_ty, llvm_v16i8_ty],
  1465. [llvm_v256i1_ty], [IntrNoMem]>;
  1466. def int_ppc_mma_assemble_acc :
  1467. DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  1468. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty,
  1469. llvm_v16i8_ty], [IntrNoMem]>;
  1470. def int_ppc_mma_disassemble_acc :
  1471. DefaultAttrsIntrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty,
  1472. llvm_v16i8_ty], [llvm_v512i1_ty], [IntrNoMem]>;
  1473. def int_ppc_mma_xxmtacc :
  1474. DefaultAttrsIntrinsic<[llvm_v512i1_ty], [llvm_v512i1_ty], [IntrNoMem]>;
  1475. def int_ppc_mma_xxmfacc :
  1476. DefaultAttrsIntrinsic<[llvm_v512i1_ty], [llvm_v512i1_ty], [IntrNoMem]>;
  1477. def int_ppc_mma_xxsetaccz :
  1478. DefaultAttrsIntrinsic<[llvm_v512i1_ty], [], [IntrNoMem]>;
  1479. // MMA Reduced-Precision: Outer Product Intrinsic Definitions.
  1480. defm int_ppc_mma_xvi4ger8 :
  1481. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1482. defm int_ppc_mma_pmxvi4ger8 :
  1483. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1484. llvm_i32_ty, llvm_i32_ty]>;
  1485. defm int_ppc_mma_xvi8ger4 :
  1486. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1487. defm int_ppc_mma_pmxvi8ger4 :
  1488. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1489. llvm_i32_ty, llvm_i32_ty]>;
  1490. defm int_ppc_mma_xvi16ger2s :
  1491. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1492. defm int_ppc_mma_pmxvi16ger2s :
  1493. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1494. llvm_i32_ty, llvm_i32_ty]>;
  1495. defm int_ppc_mma_xvf16ger2 :
  1496. PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1497. defm int_ppc_mma_pmxvf16ger2 :
  1498. PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1499. llvm_i32_ty, llvm_i32_ty]>;
  1500. defm int_ppc_mma_xvf32ger :
  1501. PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1502. defm int_ppc_mma_pmxvf32ger :
  1503. PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1504. llvm_i32_ty]>;
  1505. defm int_ppc_mma_xvf64ger :
  1506. PowerPC_MMA_ACC_Intrinsic<[llvm_v256i1_ty, llvm_v16i8_ty]>;
  1507. defm int_ppc_mma_pmxvf64ger :
  1508. PowerPC_MMA_ACC_Intrinsic<[llvm_v256i1_ty, llvm_v16i8_ty, llvm_i32_ty,
  1509. llvm_i32_ty]>;
  1510. // MMA Reduced-Precision: bfloat16 Outer Product Intrinsic Definitions.
  1511. defm int_ppc_mma_xvbf16ger2 :
  1512. PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1513. defm int_ppc_mma_pmxvbf16ger2 :
  1514. PowerPC_MMA_ACC_Intrinsic<
  1515. [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
  1516. // MMA Reduced-Precision: Missing Integer-based Outer Product Operations.
  1517. defm int_ppc_mma_xvi16ger2 :
  1518. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
  1519. defm int_ppc_mma_pmxvi16ger2 :
  1520. PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
  1521. llvm_i32_ty, llvm_i32_ty]>;
  1522. def int_ppc_mma_xvi8ger4spp :
  1523. DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  1524. [llvm_v512i1_ty, llvm_v16i8_ty, llvm_v16i8_ty],
  1525. [IntrNoMem]>;
  1526. def int_ppc_mma_pmxvi8ger4spp :
  1527. DefaultAttrsIntrinsic<[llvm_v512i1_ty],
  1528. [llvm_v512i1_ty, llvm_v16i8_ty, llvm_v16i8_ty,
  1529. llvm_i32_ty, llvm_i32_ty, llvm_i32_ty],
  1530. [IntrNoMem]>;
  1531. }
  1532. // XL Compat intrinsics.
  1533. let TargetPrefix = "ppc" in {
  1534. def int_ppc_dcbfl : ClangBuiltin<"__builtin_ppc_dcbfl">,
  1535. Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
  1536. def int_ppc_dcbflp : ClangBuiltin<"__builtin_ppc_dcbflp">,
  1537. Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
  1538. def int_ppc_dcbst : ClangBuiltin<"__builtin_ppc_dcbst">,
  1539. Intrinsic<[], [llvm_ptr_ty], []>;
  1540. def int_ppc_dcbt : ClangBuiltin<"__builtin_ppc_dcbt">,
  1541. Intrinsic<[], [llvm_ptr_ty],
  1542. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1543. def int_ppc_dcbtst : ClangBuiltin<"__builtin_ppc_dcbtst">,
  1544. Intrinsic<[], [llvm_ptr_ty],
  1545. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1546. def int_ppc_dcbz : ClangBuiltin<"__builtin_ppc_dcbz">,
  1547. Intrinsic<[], [llvm_ptr_ty], []>;
  1548. def int_ppc_icbt : ClangBuiltin<"__builtin_ppc_icbt">,
  1549. Intrinsic<[], [llvm_ptr_ty], []>;
  1550. // Population Count in each Byte.
  1551. def int_ppc_popcntb :
  1552. DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyint_ty], [IntrNoMem]>;
  1553. // sync instruction (i.e. sync 0, a.k.a hwsync)
  1554. def int_ppc_sync : ClangBuiltin<"__builtin_ppc_sync">,
  1555. Intrinsic<[], [], []>;
  1556. def int_ppc_iospace_sync : ClangBuiltin<"__builtin_ppc_iospace_sync">,
  1557. Intrinsic<[], [], []>;
  1558. // isync instruction
  1559. def int_ppc_isync : ClangBuiltin<"__builtin_ppc_isync">,
  1560. Intrinsic<[], [], []>;
  1561. // lwsync is sync 1
  1562. def int_ppc_lwsync : ClangBuiltin<"__builtin_ppc_lwsync">,
  1563. Intrinsic<[], [], []>;
  1564. def int_ppc_iospace_lwsync : ClangBuiltin<"__builtin_ppc_iospace_lwsync">,
  1565. Intrinsic<[], [], []>;
  1566. // eieio instruction
  1567. def int_ppc_eieio : ClangBuiltin<"__builtin_ppc_eieio">,
  1568. Intrinsic<[],[],[]>;
  1569. def int_ppc_iospace_eieio : ClangBuiltin<"__builtin_ppc_iospace_eieio">,
  1570. Intrinsic<[],[],[]>;
  1571. def int_ppc_stdcx :
  1572. ClangBuiltin<"__builtin_ppc_stdcx">,
  1573. Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i64_ty],
  1574. [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
  1575. def int_ppc_stwcx :
  1576. ClangBuiltin<"__builtin_ppc_stwcx">,
  1577. Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
  1578. [IntrWriteMem, IntrArgMemOnly]>;
  1579. def int_ppc_sthcx :
  1580. Intrinsic<[llvm_i32_ty], [ llvm_ptr_ty, llvm_i32_ty ],
  1581. [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
  1582. def int_ppc_stbcx :
  1583. ClangBuiltin<"__builtin_ppc_stbcx">,
  1584. Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
  1585. [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
  1586. def int_ppc_dcbtstt : ClangBuiltin<"__builtin_ppc_dcbtstt">,
  1587. Intrinsic<[], [llvm_ptr_ty],
  1588. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1589. def int_ppc_dcbtt : ClangBuiltin<"__builtin_ppc_dcbtt">,
  1590. Intrinsic<[], [llvm_ptr_ty],
  1591. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1592. def int_ppc_mftbu : ClangBuiltin<"__builtin_ppc_mftbu">,
  1593. DefaultAttrsIntrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
  1594. def int_ppc_mfmsr : ClangBuiltin<"__builtin_ppc_mfmsr">,
  1595. DefaultAttrsIntrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
  1596. def int_ppc_mfspr
  1597. : Intrinsic<[llvm_anyint_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
  1598. def int_ppc_mtmsr
  1599. : ClangBuiltin<"__builtin_ppc_mtmsr">, Intrinsic<[], [llvm_i32_ty], []>;
  1600. def int_ppc_mtspr
  1601. : Intrinsic<[], [llvm_i32_ty, llvm_anyint_ty], [ImmArg<ArgIndex<0>>]>;
  1602. def int_ppc_stfiw : ClangBuiltin<"__builtin_ppc_stfiw">,
  1603. Intrinsic<[], [llvm_ptr_ty, llvm_double_ty],
  1604. [IntrWriteMem]>;
  1605. // compare
  1606. def int_ppc_cmpeqb
  1607. : ClangBuiltin<"__builtin_ppc_cmpeqb">,
  1608. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  1609. [IntrNoMem]>;
  1610. def int_ppc_cmprb
  1611. : ClangBuiltin<"__builtin_ppc_cmprb">,
  1612. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty,
  1613. llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<0>>]>;
  1614. def int_ppc_setb
  1615. : ClangBuiltin<"__builtin_ppc_setb">,
  1616. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  1617. [IntrNoMem]>;
  1618. def int_ppc_cmpb
  1619. : DefaultAttrsIntrinsic<[llvm_anyint_ty],
  1620. [llvm_anyint_ty, llvm_anyint_ty], [IntrNoMem]>;
  1621. // multiply
  1622. def int_ppc_mulhd
  1623. : ClangBuiltin<"__builtin_ppc_mulhd">,
  1624. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  1625. [IntrNoMem]>;
  1626. def int_ppc_mulhdu
  1627. : ClangBuiltin<"__builtin_ppc_mulhdu">,
  1628. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
  1629. [IntrNoMem]>;
  1630. def int_ppc_mulhw
  1631. : ClangBuiltin<"__builtin_ppc_mulhw">,
  1632. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
  1633. [IntrNoMem]>;
  1634. def int_ppc_mulhwu
  1635. : ClangBuiltin<"__builtin_ppc_mulhwu">,
  1636. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
  1637. [IntrNoMem]>;
  1638. def int_ppc_maddhd
  1639. : ClangBuiltin<"__builtin_ppc_maddhd">,
  1640. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
  1641. llvm_i64_ty], [IntrNoMem]>;
  1642. def int_ppc_maddhdu
  1643. : ClangBuiltin<"__builtin_ppc_maddhdu">,
  1644. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
  1645. llvm_i64_ty], [IntrNoMem]>;
  1646. def int_ppc_maddld
  1647. : ClangBuiltin<"__builtin_ppc_maddld">,
  1648. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
  1649. llvm_i64_ty], [IntrNoMem]>;
  1650. // load
  1651. def int_ppc_load2r
  1652. : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_ptr_ty],
  1653. [IntrReadMem, IntrArgMemOnly]>;
  1654. def int_ppc_load4r
  1655. : ClangBuiltin<"__builtin_ppc_load4r">,
  1656. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_ptr_ty],
  1657. [IntrReadMem, IntrArgMemOnly]>;
  1658. def int_ppc_load8r
  1659. : ClangBuiltin<"__builtin_ppc_load8r">,
  1660. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty],
  1661. [IntrReadMem, IntrArgMemOnly]>;
  1662. // store
  1663. def int_ppc_store2r
  1664. : ClangBuiltin<"__builtin_ppc_store2r">,
  1665. Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], [IntrWriteMem]>;
  1666. def int_ppc_store4r
  1667. : ClangBuiltin<"__builtin_ppc_store4r">,
  1668. Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], [IntrWriteMem]>;
  1669. def int_ppc_store8r
  1670. : ClangBuiltin<"__builtin_ppc_store8r">,
  1671. Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty], [IntrWriteMem]>;
  1672. def int_ppc_insert_exp
  1673. : ClangBuiltin<"__builtin_ppc_insert_exp">,
  1674. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty, llvm_i64_ty],
  1675. [IntrNoMem]>;
  1676. def int_ppc_extract_exp
  1677. : ClangBuiltin<"__builtin_ppc_extract_exp">,
  1678. DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_double_ty], [IntrNoMem]>;
  1679. def int_ppc_extract_sig
  1680. : ClangBuiltin<"__builtin_ppc_extract_sig">,
  1681. DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_double_ty], [IntrNoMem]>;
  1682. def int_ppc_mtfsb0
  1683. : ClangBuiltin<"__builtin_ppc_mtfsb0">,
  1684. DefaultAttrsIntrinsic<[], [llvm_i32_ty],
  1685. [IntrNoMem, IntrHasSideEffects,
  1686. ImmArg<ArgIndex<0>>]>;
  1687. def int_ppc_mtfsb1
  1688. : ClangBuiltin<"__builtin_ppc_mtfsb1">,
  1689. DefaultAttrsIntrinsic<[], [llvm_i32_ty],
  1690. [IntrNoMem, IntrHasSideEffects,
  1691. ImmArg<ArgIndex<0>>]>;
  1692. def int_ppc_mtfsf :
  1693. DefaultAttrsIntrinsic<[], [llvm_i32_ty, llvm_double_ty],
  1694. [IntrNoMem, IntrHasSideEffects,
  1695. ImmArg<ArgIndex<0>>]>;
  1696. def int_ppc_mtfsfi
  1697. : ClangBuiltin<"__builtin_ppc_mtfsfi">,
  1698. DefaultAttrsIntrinsic<[], [llvm_i32_ty, llvm_i32_ty],
  1699. [IntrNoMem, IntrHasSideEffects,
  1700. ImmArg<ArgIndex<0>>,ImmArg<ArgIndex<1>>]>;
  1701. def int_ppc_fmsub
  1702. : ClangBuiltin<"__builtin_ppc_fmsub">,
  1703. DefaultAttrsIntrinsic<[llvm_double_ty],
  1704. [llvm_double_ty, llvm_double_ty, llvm_double_ty],
  1705. [IntrNoMem]>;
  1706. def int_ppc_fmsubs
  1707. : ClangBuiltin<"__builtin_ppc_fmsubs">,
  1708. DefaultAttrsIntrinsic<[llvm_float_ty],
  1709. [llvm_float_ty, llvm_float_ty, llvm_float_ty],
  1710. [IntrNoMem]>;
  1711. def int_ppc_fnmadd
  1712. : ClangBuiltin<"__builtin_ppc_fnmadd">,
  1713. DefaultAttrsIntrinsic<[llvm_double_ty],
  1714. [llvm_double_ty, llvm_double_ty, llvm_double_ty],
  1715. [IntrNoMem]>;
  1716. def int_ppc_fnmadds
  1717. : ClangBuiltin<"__builtin_ppc_fnmadds">,
  1718. DefaultAttrsIntrinsic<[llvm_float_ty],
  1719. [llvm_float_ty, llvm_float_ty, llvm_float_ty],
  1720. [IntrNoMem]>;
  1721. def int_ppc_fnmsub
  1722. : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
  1723. [LLVMMatchType<0>, LLVMMatchType<0>,
  1724. LLVMMatchType<0>],
  1725. [IntrNoMem]>;
  1726. def int_ppc_fre
  1727. : ClangBuiltin<"__builtin_ppc_fre">,
  1728. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  1729. def int_ppc_fres
  1730. : ClangBuiltin<"__builtin_ppc_fres">,
  1731. DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
  1732. def int_ppc_addex
  1733. : ClangBuiltin<"__builtin_ppc_addex">,
  1734. Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty],
  1735. [IntrNoMem, IntrHasSideEffects, ImmArg<ArgIndex<2>>]>;
  1736. def int_ppc_fsel : ClangBuiltin<"__builtin_ppc_fsel">,
  1737. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty, llvm_double_ty,
  1738. llvm_double_ty], [IntrNoMem]>;
  1739. def int_ppc_fsels : ClangBuiltin<"__builtin_ppc_fsels">,
  1740. DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty,
  1741. llvm_float_ty], [IntrNoMem]>;
  1742. def int_ppc_frsqrte : ClangBuiltin<"__builtin_ppc_frsqrte">,
  1743. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  1744. def int_ppc_frsqrtes : ClangBuiltin<"__builtin_ppc_frsqrtes">,
  1745. DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
  1746. def int_ppc_compare_exp_uo : ClangBuiltin<"__builtin_ppc_compare_exp_uo">,
  1747. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1748. [llvm_double_ty, llvm_double_ty],
  1749. [IntrNoMem]>;
  1750. def int_ppc_compare_exp_lt : ClangBuiltin<"__builtin_ppc_compare_exp_lt">,
  1751. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1752. [llvm_double_ty, llvm_double_ty],
  1753. [IntrNoMem]>;
  1754. def int_ppc_compare_exp_gt : ClangBuiltin<"__builtin_ppc_compare_exp_gt">,
  1755. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1756. [llvm_double_ty, llvm_double_ty],
  1757. [IntrNoMem]>;
  1758. def int_ppc_compare_exp_eq : ClangBuiltin<"__builtin_ppc_compare_exp_eq">,
  1759. DefaultAttrsIntrinsic<[llvm_i32_ty],
  1760. [llvm_double_ty, llvm_double_ty],
  1761. [IntrNoMem]>;
  1762. def int_ppc_test_data_class : Intrinsic<[llvm_i32_ty],
  1763. [llvm_anyfloat_ty, llvm_i32_ty],
  1764. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  1765. def int_ppc_fnabs
  1766. : ClangBuiltin<"__builtin_ppc_fnabs">,
  1767. DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
  1768. def int_ppc_fnabss
  1769. : ClangBuiltin<"__builtin_ppc_fnabss">,
  1770. DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
  1771. def int_ppc_convert_f128_to_ppcf128
  1772. : DefaultAttrsIntrinsic<[llvm_ppcf128_ty], [llvm_f128_ty], [IntrNoMem]>;
  1773. def int_ppc_convert_ppcf128_to_f128
  1774. : DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_ppcf128_ty], [IntrNoMem]>;
  1775. }
  1776. //===----------------------------------------------------------------------===//
  1777. // PowerPC Atomic Intrinsic Definitions.
  1778. let TargetPrefix = "ppc" in {
  1779. class AtomicRMW128Intrinsic
  1780. : Intrinsic<[llvm_i64_ty, llvm_i64_ty],
  1781. [llvm_ptr_ty, llvm_i64_ty, llvm_i64_ty],
  1782. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1783. def int_ppc_atomicrmw_xchg_i128 : AtomicRMW128Intrinsic;
  1784. def int_ppc_atomicrmw_add_i128 : AtomicRMW128Intrinsic;
  1785. def int_ppc_atomicrmw_sub_i128 : AtomicRMW128Intrinsic;
  1786. def int_ppc_atomicrmw_and_i128 : AtomicRMW128Intrinsic;
  1787. def int_ppc_atomicrmw_or_i128 : AtomicRMW128Intrinsic;
  1788. def int_ppc_atomicrmw_xor_i128 : AtomicRMW128Intrinsic;
  1789. def int_ppc_atomicrmw_nand_i128 : AtomicRMW128Intrinsic;
  1790. def int_ppc_cmpxchg_i128 : Intrinsic<[llvm_i64_ty, llvm_i64_ty],
  1791. [llvm_ptr_ty,
  1792. llvm_i64_ty, llvm_i64_ty,
  1793. llvm_i64_ty, llvm_i64_ty],
  1794. [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
  1795. def int_ppc_atomic_load_i128 :
  1796. Intrinsic<[llvm_i64_ty, llvm_i64_ty],
  1797. [llvm_ptr_ty],
  1798. [IntrArgMemOnly, IntrReadMem, NoCapture<ArgIndex<0>>]>;
  1799. def int_ppc_atomic_store_i128 :
  1800. Intrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_ptr_ty],
  1801. [IntrArgMemOnly, IntrWriteMem, NoCapture<ArgIndex<2>>]>;
  1802. }