xopintrin.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. /* Copyright (C) 2007-2019 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef _X86INTRIN_H_INCLUDED
  19. # error "Never use <xopintrin.h> directly; include <x86intrin.h> instead."
  20. #endif
  21. #ifndef _XOPMMINTRIN_H_INCLUDED
  22. #define _XOPMMINTRIN_H_INCLUDED
  23. #include <fma4intrin.h>
  24. #ifndef __XOP__
  25. #pragma GCC push_options
  26. #pragma GCC target("xop")
  27. #define __DISABLE_XOP__
  28. #endif /* __XOP__ */
  29. /* Integer multiply/add instructions. */
  30. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  31. _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
  32. {
  33. return (__m128i) __builtin_ia32_vpmacssww ((__v8hi)__A,(__v8hi)__B, (__v8hi)__C);
  34. }
  35. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  36. _mm_macc_epi16(__m128i __A, __m128i __B, __m128i __C)
  37. {
  38. return (__m128i) __builtin_ia32_vpmacsww ((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
  39. }
  40. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  41. _mm_maccsd_epi16(__m128i __A, __m128i __B, __m128i __C)
  42. {
  43. return (__m128i) __builtin_ia32_vpmacsswd ((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
  44. }
  45. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  46. _mm_maccd_epi16(__m128i __A, __m128i __B, __m128i __C)
  47. {
  48. return (__m128i) __builtin_ia32_vpmacswd ((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
  49. }
  50. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  51. _mm_maccs_epi32(__m128i __A, __m128i __B, __m128i __C)
  52. {
  53. return (__m128i) __builtin_ia32_vpmacssdd ((__v4si)__A, (__v4si)__B, (__v4si)__C);
  54. }
  55. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  56. _mm_macc_epi32(__m128i __A, __m128i __B, __m128i __C)
  57. {
  58. return (__m128i) __builtin_ia32_vpmacsdd ((__v4si)__A, (__v4si)__B, (__v4si)__C);
  59. }
  60. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  61. _mm_maccslo_epi32(__m128i __A, __m128i __B, __m128i __C)
  62. {
  63. return (__m128i) __builtin_ia32_vpmacssdql ((__v4si)__A, (__v4si)__B, (__v2di)__C);
  64. }
  65. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  66. _mm_macclo_epi32(__m128i __A, __m128i __B, __m128i __C)
  67. {
  68. return (__m128i) __builtin_ia32_vpmacsdql ((__v4si)__A, (__v4si)__B, (__v2di)__C);
  69. }
  70. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  71. _mm_maccshi_epi32(__m128i __A, __m128i __B, __m128i __C)
  72. {
  73. return (__m128i) __builtin_ia32_vpmacssdqh ((__v4si)__A, (__v4si)__B, (__v2di)__C);
  74. }
  75. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  76. _mm_macchi_epi32(__m128i __A, __m128i __B, __m128i __C)
  77. {
  78. return (__m128i) __builtin_ia32_vpmacsdqh ((__v4si)__A, (__v4si)__B, (__v2di)__C);
  79. }
  80. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  81. _mm_maddsd_epi16(__m128i __A, __m128i __B, __m128i __C)
  82. {
  83. return (__m128i) __builtin_ia32_vpmadcsswd ((__v8hi)__A,(__v8hi)__B,(__v4si)__C);
  84. }
  85. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  86. _mm_maddd_epi16(__m128i __A, __m128i __B, __m128i __C)
  87. {
  88. return (__m128i) __builtin_ia32_vpmadcswd ((__v8hi)__A,(__v8hi)__B,(__v4si)__C);
  89. }
  90. /* Packed Integer Horizontal Add and Subtract */
  91. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  92. _mm_haddw_epi8(__m128i __A)
  93. {
  94. return (__m128i) __builtin_ia32_vphaddbw ((__v16qi)__A);
  95. }
  96. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  97. _mm_haddd_epi8(__m128i __A)
  98. {
  99. return (__m128i) __builtin_ia32_vphaddbd ((__v16qi)__A);
  100. }
  101. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  102. _mm_haddq_epi8(__m128i __A)
  103. {
  104. return (__m128i) __builtin_ia32_vphaddbq ((__v16qi)__A);
  105. }
  106. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  107. _mm_haddd_epi16(__m128i __A)
  108. {
  109. return (__m128i) __builtin_ia32_vphaddwd ((__v8hi)__A);
  110. }
  111. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  112. _mm_haddq_epi16(__m128i __A)
  113. {
  114. return (__m128i) __builtin_ia32_vphaddwq ((__v8hi)__A);
  115. }
  116. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  117. _mm_haddq_epi32(__m128i __A)
  118. {
  119. return (__m128i) __builtin_ia32_vphadddq ((__v4si)__A);
  120. }
  121. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  122. _mm_haddw_epu8(__m128i __A)
  123. {
  124. return (__m128i) __builtin_ia32_vphaddubw ((__v16qi)__A);
  125. }
  126. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  127. _mm_haddd_epu8(__m128i __A)
  128. {
  129. return (__m128i) __builtin_ia32_vphaddubd ((__v16qi)__A);
  130. }
  131. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  132. _mm_haddq_epu8(__m128i __A)
  133. {
  134. return (__m128i) __builtin_ia32_vphaddubq ((__v16qi)__A);
  135. }
  136. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  137. _mm_haddd_epu16(__m128i __A)
  138. {
  139. return (__m128i) __builtin_ia32_vphadduwd ((__v8hi)__A);
  140. }
  141. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  142. _mm_haddq_epu16(__m128i __A)
  143. {
  144. return (__m128i) __builtin_ia32_vphadduwq ((__v8hi)__A);
  145. }
  146. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  147. _mm_haddq_epu32(__m128i __A)
  148. {
  149. return (__m128i) __builtin_ia32_vphaddudq ((__v4si)__A);
  150. }
  151. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  152. _mm_hsubw_epi8(__m128i __A)
  153. {
  154. return (__m128i) __builtin_ia32_vphsubbw ((__v16qi)__A);
  155. }
  156. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  157. _mm_hsubd_epi16(__m128i __A)
  158. {
  159. return (__m128i) __builtin_ia32_vphsubwd ((__v8hi)__A);
  160. }
  161. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  162. _mm_hsubq_epi32(__m128i __A)
  163. {
  164. return (__m128i) __builtin_ia32_vphsubdq ((__v4si)__A);
  165. }
  166. /* Vector conditional move and permute */
  167. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  168. _mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C)
  169. {
  170. return (__m128i) __builtin_ia32_vpcmov (__A, __B, __C);
  171. }
  172. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  173. _mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
  174. {
  175. return (__m128i) __builtin_ia32_vpperm ((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
  176. }
  177. /* Packed Integer Rotates and Shifts
  178. Rotates - Non-Immediate form */
  179. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  180. _mm_rot_epi8(__m128i __A, __m128i __B)
  181. {
  182. return (__m128i) __builtin_ia32_vprotb ((__v16qi)__A, (__v16qi)__B);
  183. }
  184. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  185. _mm_rot_epi16(__m128i __A, __m128i __B)
  186. {
  187. return (__m128i) __builtin_ia32_vprotw ((__v8hi)__A, (__v8hi)__B);
  188. }
  189. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  190. _mm_rot_epi32(__m128i __A, __m128i __B)
  191. {
  192. return (__m128i) __builtin_ia32_vprotd ((__v4si)__A, (__v4si)__B);
  193. }
  194. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  195. _mm_rot_epi64(__m128i __A, __m128i __B)
  196. {
  197. return (__m128i) __builtin_ia32_vprotq ((__v2di)__A, (__v2di)__B);
  198. }
  199. /* Rotates - Immediate form */
  200. #ifdef __OPTIMIZE__
  201. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  202. _mm_roti_epi8(__m128i __A, const int __B)
  203. {
  204. return (__m128i) __builtin_ia32_vprotbi ((__v16qi)__A, __B);
  205. }
  206. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  207. _mm_roti_epi16(__m128i __A, const int __B)
  208. {
  209. return (__m128i) __builtin_ia32_vprotwi ((__v8hi)__A, __B);
  210. }
  211. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  212. _mm_roti_epi32(__m128i __A, const int __B)
  213. {
  214. return (__m128i) __builtin_ia32_vprotdi ((__v4si)__A, __B);
  215. }
  216. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  217. _mm_roti_epi64(__m128i __A, const int __B)
  218. {
  219. return (__m128i) __builtin_ia32_vprotqi ((__v2di)__A, __B);
  220. }
  221. #else
  222. #define _mm_roti_epi8(A, N) \
  223. ((__m128i) __builtin_ia32_vprotbi ((__v16qi)(__m128i)(A), (int)(N)))
  224. #define _mm_roti_epi16(A, N) \
  225. ((__m128i) __builtin_ia32_vprotwi ((__v8hi)(__m128i)(A), (int)(N)))
  226. #define _mm_roti_epi32(A, N) \
  227. ((__m128i) __builtin_ia32_vprotdi ((__v4si)(__m128i)(A), (int)(N)))
  228. #define _mm_roti_epi64(A, N) \
  229. ((__m128i) __builtin_ia32_vprotqi ((__v2di)(__m128i)(A), (int)(N)))
  230. #endif
  231. /* Shifts */
  232. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  233. _mm_shl_epi8(__m128i __A, __m128i __B)
  234. {
  235. return (__m128i) __builtin_ia32_vpshlb ((__v16qi)__A, (__v16qi)__B);
  236. }
  237. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  238. _mm_shl_epi16(__m128i __A, __m128i __B)
  239. {
  240. return (__m128i) __builtin_ia32_vpshlw ((__v8hi)__A, (__v8hi)__B);
  241. }
  242. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  243. _mm_shl_epi32(__m128i __A, __m128i __B)
  244. {
  245. return (__m128i) __builtin_ia32_vpshld ((__v4si)__A, (__v4si)__B);
  246. }
  247. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  248. _mm_shl_epi64(__m128i __A, __m128i __B)
  249. {
  250. return (__m128i) __builtin_ia32_vpshlq ((__v2di)__A, (__v2di)__B);
  251. }
  252. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  253. _mm_sha_epi8(__m128i __A, __m128i __B)
  254. {
  255. return (__m128i) __builtin_ia32_vpshab ((__v16qi)__A, (__v16qi)__B);
  256. }
  257. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  258. _mm_sha_epi16(__m128i __A, __m128i __B)
  259. {
  260. return (__m128i) __builtin_ia32_vpshaw ((__v8hi)__A, (__v8hi)__B);
  261. }
  262. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  263. _mm_sha_epi32(__m128i __A, __m128i __B)
  264. {
  265. return (__m128i) __builtin_ia32_vpshad ((__v4si)__A, (__v4si)__B);
  266. }
  267. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  268. _mm_sha_epi64(__m128i __A, __m128i __B)
  269. {
  270. return (__m128i) __builtin_ia32_vpshaq ((__v2di)__A, (__v2di)__B);
  271. }
  272. /* Compare and Predicate Generation
  273. pcom (integer, unsigned bytes) */
  274. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  275. _mm_comlt_epu8(__m128i __A, __m128i __B)
  276. {
  277. return (__m128i) __builtin_ia32_vpcomltub ((__v16qi)__A, (__v16qi)__B);
  278. }
  279. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  280. _mm_comle_epu8(__m128i __A, __m128i __B)
  281. {
  282. return (__m128i) __builtin_ia32_vpcomleub ((__v16qi)__A, (__v16qi)__B);
  283. }
  284. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  285. _mm_comgt_epu8(__m128i __A, __m128i __B)
  286. {
  287. return (__m128i) __builtin_ia32_vpcomgtub ((__v16qi)__A, (__v16qi)__B);
  288. }
  289. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  290. _mm_comge_epu8(__m128i __A, __m128i __B)
  291. {
  292. return (__m128i) __builtin_ia32_vpcomgeub ((__v16qi)__A, (__v16qi)__B);
  293. }
  294. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  295. _mm_comeq_epu8(__m128i __A, __m128i __B)
  296. {
  297. return (__m128i) __builtin_ia32_vpcomequb ((__v16qi)__A, (__v16qi)__B);
  298. }
  299. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  300. _mm_comneq_epu8(__m128i __A, __m128i __B)
  301. {
  302. return (__m128i) __builtin_ia32_vpcomnequb ((__v16qi)__A, (__v16qi)__B);
  303. }
  304. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  305. _mm_comfalse_epu8(__m128i __A, __m128i __B)
  306. {
  307. return (__m128i) __builtin_ia32_vpcomfalseub ((__v16qi)__A, (__v16qi)__B);
  308. }
  309. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  310. _mm_comtrue_epu8(__m128i __A, __m128i __B)
  311. {
  312. return (__m128i) __builtin_ia32_vpcomtrueub ((__v16qi)__A, (__v16qi)__B);
  313. }
  314. /*pcom (integer, unsigned words) */
  315. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  316. _mm_comlt_epu16(__m128i __A, __m128i __B)
  317. {
  318. return (__m128i) __builtin_ia32_vpcomltuw ((__v8hi)__A, (__v8hi)__B);
  319. }
  320. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  321. _mm_comle_epu16(__m128i __A, __m128i __B)
  322. {
  323. return (__m128i) __builtin_ia32_vpcomleuw ((__v8hi)__A, (__v8hi)__B);
  324. }
  325. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  326. _mm_comgt_epu16(__m128i __A, __m128i __B)
  327. {
  328. return (__m128i) __builtin_ia32_vpcomgtuw ((__v8hi)__A, (__v8hi)__B);
  329. }
  330. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  331. _mm_comge_epu16(__m128i __A, __m128i __B)
  332. {
  333. return (__m128i) __builtin_ia32_vpcomgeuw ((__v8hi)__A, (__v8hi)__B);
  334. }
  335. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  336. _mm_comeq_epu16(__m128i __A, __m128i __B)
  337. {
  338. return (__m128i) __builtin_ia32_vpcomequw ((__v8hi)__A, (__v8hi)__B);
  339. }
  340. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  341. _mm_comneq_epu16(__m128i __A, __m128i __B)
  342. {
  343. return (__m128i) __builtin_ia32_vpcomnequw ((__v8hi)__A, (__v8hi)__B);
  344. }
  345. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  346. _mm_comfalse_epu16(__m128i __A, __m128i __B)
  347. {
  348. return (__m128i) __builtin_ia32_vpcomfalseuw ((__v8hi)__A, (__v8hi)__B);
  349. }
  350. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  351. _mm_comtrue_epu16(__m128i __A, __m128i __B)
  352. {
  353. return (__m128i) __builtin_ia32_vpcomtrueuw ((__v8hi)__A, (__v8hi)__B);
  354. }
  355. /*pcom (integer, unsigned double words) */
  356. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  357. _mm_comlt_epu32(__m128i __A, __m128i __B)
  358. {
  359. return (__m128i) __builtin_ia32_vpcomltud ((__v4si)__A, (__v4si)__B);
  360. }
  361. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  362. _mm_comle_epu32(__m128i __A, __m128i __B)
  363. {
  364. return (__m128i) __builtin_ia32_vpcomleud ((__v4si)__A, (__v4si)__B);
  365. }
  366. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  367. _mm_comgt_epu32(__m128i __A, __m128i __B)
  368. {
  369. return (__m128i) __builtin_ia32_vpcomgtud ((__v4si)__A, (__v4si)__B);
  370. }
  371. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  372. _mm_comge_epu32(__m128i __A, __m128i __B)
  373. {
  374. return (__m128i) __builtin_ia32_vpcomgeud ((__v4si)__A, (__v4si)__B);
  375. }
  376. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  377. _mm_comeq_epu32(__m128i __A, __m128i __B)
  378. {
  379. return (__m128i) __builtin_ia32_vpcomequd ((__v4si)__A, (__v4si)__B);
  380. }
  381. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  382. _mm_comneq_epu32(__m128i __A, __m128i __B)
  383. {
  384. return (__m128i) __builtin_ia32_vpcomnequd ((__v4si)__A, (__v4si)__B);
  385. }
  386. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  387. _mm_comfalse_epu32(__m128i __A, __m128i __B)
  388. {
  389. return (__m128i) __builtin_ia32_vpcomfalseud ((__v4si)__A, (__v4si)__B);
  390. }
  391. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  392. _mm_comtrue_epu32(__m128i __A, __m128i __B)
  393. {
  394. return (__m128i) __builtin_ia32_vpcomtrueud ((__v4si)__A, (__v4si)__B);
  395. }
  396. /*pcom (integer, unsigned quad words) */
  397. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  398. _mm_comlt_epu64(__m128i __A, __m128i __B)
  399. {
  400. return (__m128i) __builtin_ia32_vpcomltuq ((__v2di)__A, (__v2di)__B);
  401. }
  402. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  403. _mm_comle_epu64(__m128i __A, __m128i __B)
  404. {
  405. return (__m128i) __builtin_ia32_vpcomleuq ((__v2di)__A, (__v2di)__B);
  406. }
  407. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  408. _mm_comgt_epu64(__m128i __A, __m128i __B)
  409. {
  410. return (__m128i) __builtin_ia32_vpcomgtuq ((__v2di)__A, (__v2di)__B);
  411. }
  412. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  413. _mm_comge_epu64(__m128i __A, __m128i __B)
  414. {
  415. return (__m128i) __builtin_ia32_vpcomgeuq ((__v2di)__A, (__v2di)__B);
  416. }
  417. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  418. _mm_comeq_epu64(__m128i __A, __m128i __B)
  419. {
  420. return (__m128i) __builtin_ia32_vpcomequq ((__v2di)__A, (__v2di)__B);
  421. }
  422. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  423. _mm_comneq_epu64(__m128i __A, __m128i __B)
  424. {
  425. return (__m128i) __builtin_ia32_vpcomnequq ((__v2di)__A, (__v2di)__B);
  426. }
  427. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  428. _mm_comfalse_epu64(__m128i __A, __m128i __B)
  429. {
  430. return (__m128i) __builtin_ia32_vpcomfalseuq ((__v2di)__A, (__v2di)__B);
  431. }
  432. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  433. _mm_comtrue_epu64(__m128i __A, __m128i __B)
  434. {
  435. return (__m128i) __builtin_ia32_vpcomtrueuq ((__v2di)__A, (__v2di)__B);
  436. }
  437. /*pcom (integer, signed bytes) */
  438. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  439. _mm_comlt_epi8(__m128i __A, __m128i __B)
  440. {
  441. return (__m128i) __builtin_ia32_vpcomltb ((__v16qi)__A, (__v16qi)__B);
  442. }
  443. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  444. _mm_comle_epi8(__m128i __A, __m128i __B)
  445. {
  446. return (__m128i) __builtin_ia32_vpcomleb ((__v16qi)__A, (__v16qi)__B);
  447. }
  448. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  449. _mm_comgt_epi8(__m128i __A, __m128i __B)
  450. {
  451. return (__m128i) __builtin_ia32_vpcomgtb ((__v16qi)__A, (__v16qi)__B);
  452. }
  453. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  454. _mm_comge_epi8(__m128i __A, __m128i __B)
  455. {
  456. return (__m128i) __builtin_ia32_vpcomgeb ((__v16qi)__A, (__v16qi)__B);
  457. }
  458. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  459. _mm_comeq_epi8(__m128i __A, __m128i __B)
  460. {
  461. return (__m128i) __builtin_ia32_vpcomeqb ((__v16qi)__A, (__v16qi)__B);
  462. }
  463. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  464. _mm_comneq_epi8(__m128i __A, __m128i __B)
  465. {
  466. return (__m128i) __builtin_ia32_vpcomneqb ((__v16qi)__A, (__v16qi)__B);
  467. }
  468. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  469. _mm_comfalse_epi8(__m128i __A, __m128i __B)
  470. {
  471. return (__m128i) __builtin_ia32_vpcomfalseb ((__v16qi)__A, (__v16qi)__B);
  472. }
  473. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  474. _mm_comtrue_epi8(__m128i __A, __m128i __B)
  475. {
  476. return (__m128i) __builtin_ia32_vpcomtrueb ((__v16qi)__A, (__v16qi)__B);
  477. }
  478. /*pcom (integer, signed words) */
  479. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  480. _mm_comlt_epi16(__m128i __A, __m128i __B)
  481. {
  482. return (__m128i) __builtin_ia32_vpcomltw ((__v8hi)__A, (__v8hi)__B);
  483. }
  484. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  485. _mm_comle_epi16(__m128i __A, __m128i __B)
  486. {
  487. return (__m128i) __builtin_ia32_vpcomlew ((__v8hi)__A, (__v8hi)__B);
  488. }
  489. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  490. _mm_comgt_epi16(__m128i __A, __m128i __B)
  491. {
  492. return (__m128i) __builtin_ia32_vpcomgtw ((__v8hi)__A, (__v8hi)__B);
  493. }
  494. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  495. _mm_comge_epi16(__m128i __A, __m128i __B)
  496. {
  497. return (__m128i) __builtin_ia32_vpcomgew ((__v8hi)__A, (__v8hi)__B);
  498. }
  499. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  500. _mm_comeq_epi16(__m128i __A, __m128i __B)
  501. {
  502. return (__m128i) __builtin_ia32_vpcomeqw ((__v8hi)__A, (__v8hi)__B);
  503. }
  504. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  505. _mm_comneq_epi16(__m128i __A, __m128i __B)
  506. {
  507. return (__m128i) __builtin_ia32_vpcomneqw ((__v8hi)__A, (__v8hi)__B);
  508. }
  509. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  510. _mm_comfalse_epi16(__m128i __A, __m128i __B)
  511. {
  512. return (__m128i) __builtin_ia32_vpcomfalsew ((__v8hi)__A, (__v8hi)__B);
  513. }
  514. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  515. _mm_comtrue_epi16(__m128i __A, __m128i __B)
  516. {
  517. return (__m128i) __builtin_ia32_vpcomtruew ((__v8hi)__A, (__v8hi)__B);
  518. }
  519. /*pcom (integer, signed double words) */
  520. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  521. _mm_comlt_epi32(__m128i __A, __m128i __B)
  522. {
  523. return (__m128i) __builtin_ia32_vpcomltd ((__v4si)__A, (__v4si)__B);
  524. }
  525. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  526. _mm_comle_epi32(__m128i __A, __m128i __B)
  527. {
  528. return (__m128i) __builtin_ia32_vpcomled ((__v4si)__A, (__v4si)__B);
  529. }
  530. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  531. _mm_comgt_epi32(__m128i __A, __m128i __B)
  532. {
  533. return (__m128i) __builtin_ia32_vpcomgtd ((__v4si)__A, (__v4si)__B);
  534. }
  535. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  536. _mm_comge_epi32(__m128i __A, __m128i __B)
  537. {
  538. return (__m128i) __builtin_ia32_vpcomged ((__v4si)__A, (__v4si)__B);
  539. }
  540. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  541. _mm_comeq_epi32(__m128i __A, __m128i __B)
  542. {
  543. return (__m128i) __builtin_ia32_vpcomeqd ((__v4si)__A, (__v4si)__B);
  544. }
  545. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  546. _mm_comneq_epi32(__m128i __A, __m128i __B)
  547. {
  548. return (__m128i) __builtin_ia32_vpcomneqd ((__v4si)__A, (__v4si)__B);
  549. }
  550. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  551. _mm_comfalse_epi32(__m128i __A, __m128i __B)
  552. {
  553. return (__m128i) __builtin_ia32_vpcomfalsed ((__v4si)__A, (__v4si)__B);
  554. }
  555. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  556. _mm_comtrue_epi32(__m128i __A, __m128i __B)
  557. {
  558. return (__m128i) __builtin_ia32_vpcomtrued ((__v4si)__A, (__v4si)__B);
  559. }
  560. /*pcom (integer, signed quad words) */
  561. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  562. _mm_comlt_epi64(__m128i __A, __m128i __B)
  563. {
  564. return (__m128i) __builtin_ia32_vpcomltq ((__v2di)__A, (__v2di)__B);
  565. }
  566. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  567. _mm_comle_epi64(__m128i __A, __m128i __B)
  568. {
  569. return (__m128i) __builtin_ia32_vpcomleq ((__v2di)__A, (__v2di)__B);
  570. }
  571. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  572. _mm_comgt_epi64(__m128i __A, __m128i __B)
  573. {
  574. return (__m128i) __builtin_ia32_vpcomgtq ((__v2di)__A, (__v2di)__B);
  575. }
  576. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  577. _mm_comge_epi64(__m128i __A, __m128i __B)
  578. {
  579. return (__m128i) __builtin_ia32_vpcomgeq ((__v2di)__A, (__v2di)__B);
  580. }
  581. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  582. _mm_comeq_epi64(__m128i __A, __m128i __B)
  583. {
  584. return (__m128i) __builtin_ia32_vpcomeqq ((__v2di)__A, (__v2di)__B);
  585. }
  586. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  587. _mm_comneq_epi64(__m128i __A, __m128i __B)
  588. {
  589. return (__m128i) __builtin_ia32_vpcomneqq ((__v2di)__A, (__v2di)__B);
  590. }
  591. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  592. _mm_comfalse_epi64(__m128i __A, __m128i __B)
  593. {
  594. return (__m128i) __builtin_ia32_vpcomfalseq ((__v2di)__A, (__v2di)__B);
  595. }
  596. extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  597. _mm_comtrue_epi64(__m128i __A, __m128i __B)
  598. {
  599. return (__m128i) __builtin_ia32_vpcomtrueq ((__v2di)__A, (__v2di)__B);
  600. }
  601. /* FRCZ */
  602. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  603. _mm_frcz_ps (__m128 __A)
  604. {
  605. return (__m128) __builtin_ia32_vfrczps ((__v4sf)__A);
  606. }
  607. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  608. _mm_frcz_pd (__m128d __A)
  609. {
  610. return (__m128d) __builtin_ia32_vfrczpd ((__v2df)__A);
  611. }
  612. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  613. _mm_frcz_ss (__m128 __A, __m128 __B)
  614. {
  615. return (__m128) __builtin_ia32_movss ((__v4sf)__A,
  616. (__v4sf)
  617. __builtin_ia32_vfrczss ((__v4sf)__B));
  618. }
  619. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  620. _mm_frcz_sd (__m128d __A, __m128d __B)
  621. {
  622. return (__m128d) __builtin_ia32_movsd ((__v2df)__A,
  623. (__v2df)
  624. __builtin_ia32_vfrczsd ((__v2df)__B));
  625. }
  626. extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  627. _mm256_frcz_ps (__m256 __A)
  628. {
  629. return (__m256) __builtin_ia32_vfrczps256 ((__v8sf)__A);
  630. }
  631. extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  632. _mm256_frcz_pd (__m256d __A)
  633. {
  634. return (__m256d) __builtin_ia32_vfrczpd256 ((__v4df)__A);
  635. }
  636. /* PERMIL2 */
  637. #ifdef __OPTIMIZE__
  638. extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  639. _mm_permute2_pd (__m128d __X, __m128d __Y, __m128i __C, const int __I)
  640. {
  641. return (__m128d) __builtin_ia32_vpermil2pd ((__v2df)__X,
  642. (__v2df)__Y,
  643. (__v2di)__C,
  644. __I);
  645. }
  646. extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  647. _mm256_permute2_pd (__m256d __X, __m256d __Y, __m256i __C, const int __I)
  648. {
  649. return (__m256d) __builtin_ia32_vpermil2pd256 ((__v4df)__X,
  650. (__v4df)__Y,
  651. (__v4di)__C,
  652. __I);
  653. }
  654. extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  655. _mm_permute2_ps (__m128 __X, __m128 __Y, __m128i __C, const int __I)
  656. {
  657. return (__m128) __builtin_ia32_vpermil2ps ((__v4sf)__X,
  658. (__v4sf)__Y,
  659. (__v4si)__C,
  660. __I);
  661. }
  662. extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  663. _mm256_permute2_ps (__m256 __X, __m256 __Y, __m256i __C, const int __I)
  664. {
  665. return (__m256) __builtin_ia32_vpermil2ps256 ((__v8sf)__X,
  666. (__v8sf)__Y,
  667. (__v8si)__C,
  668. __I);
  669. }
  670. #else
  671. #define _mm_permute2_pd(X, Y, C, I) \
  672. ((__m128d) __builtin_ia32_vpermil2pd ((__v2df)(__m128d)(X), \
  673. (__v2df)(__m128d)(Y), \
  674. (__v2di)(__m128i)(C), \
  675. (int)(I)))
  676. #define _mm256_permute2_pd(X, Y, C, I) \
  677. ((__m256d) __builtin_ia32_vpermil2pd256 ((__v4df)(__m256d)(X), \
  678. (__v4df)(__m256d)(Y), \
  679. (__v4di)(__m256i)(C), \
  680. (int)(I)))
  681. #define _mm_permute2_ps(X, Y, C, I) \
  682. ((__m128) __builtin_ia32_vpermil2ps ((__v4sf)(__m128)(X), \
  683. (__v4sf)(__m128)(Y), \
  684. (__v4si)(__m128i)(C), \
  685. (int)(I)))
  686. #define _mm256_permute2_ps(X, Y, C, I) \
  687. ((__m256) __builtin_ia32_vpermil2ps256 ((__v8sf)(__m256)(X), \
  688. (__v8sf)(__m256)(Y), \
  689. (__v8si)(__m256i)(C), \
  690. (int)(I)))
  691. #endif /* __OPTIMIZE__ */
  692. #ifdef __DISABLE_XOP__
  693. #undef __DISABLE_XOP__
  694. #pragma GCC pop_options
  695. #endif /* __DISABLE_XOP__ */
  696. #endif /* _XOPMMINTRIN_H_INCLUDED */