Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

382 lines
13 KiB

  1. /**
  2. *** Copyright (C) 1985-1999 Intel Corporation. All rights reserved.
  3. ***
  4. *** The information and source code contained herein is the exclusive
  5. *** property of Intel Corporation and may not be disclosed, examined
  6. *** or reproduced in whole or in part without explicit written authorization
  7. *** from the company.
  8. ***
  9. **/
  10. /*
  11. * emmintrin.h
  12. *
  13. * Principal header file for Willamette New Instruction intrinsics
  14. *
  15. * The intrinsics package can be used in 2 ways, based whether or not
  16. * _EMM_FUNCTIONALITY is defined; if it is, the C implementation
  17. * will be used (the "functional intrinsics").
  18. */
  19. #ifndef _INCLUDED_EMM
  20. #define _INCLUDED_EMM
  21. /*
  22. * the __m128 & __m64 types are required for the intrinsics
  23. */
  24. #include <xmmintrin.h>
  25. #ifdef __ICL
  26. #ifdef _EMM_FUNCTIONALITY
  27. #include "emm_func.h"
  28. #else
  29. typedef long long __m128d;
  30. typedef long long __m128i;
  31. #endif
  32. #elif _MSC_VER >= 1300
  33. typedef union __declspec(intrin_type) __declspec(align(16)) __m128i {
  34. __int8 m128i_i8[16];
  35. __int16 m128i_i16[8];
  36. __int32 m128i_i32[4];
  37. __int64 m128i_i64[2];
  38. unsigned __int8 m128i_u8[16];
  39. unsigned __int16 m128i_u16[8];
  40. unsigned __int32 m128i_u32[4];
  41. unsigned __int64 m128i_u64[2];
  42. } __m128i;
  43. typedef struct __declspec(intrin_type) __declspec(align(16)) __m128d {
  44. double m128d_f64[2];
  45. } __m128d;
  46. #endif
  47. /*
  48. * Macro function for shuffle
  49. */
  50. #define _MM_SHUFFLE2(x,y) (((x)<<1) | (y))
  51. /*****************************************************/
  52. /* INTRINSICS FUNCTION PROTOTYPES START HERE */
  53. /*****************************************************/
  54. #if defined __cplusplus
  55. extern "C" { /* Begin "C" */
  56. /* Intrinsics use C name-mangling. */
  57. #endif /* __cplusplus */
  58. /*
  59. * DP, arithmetic
  60. */
  61. extern __m128d _mm_add_sd(__m128d a, __m128d b);
  62. extern __m128d _mm_add_pd(__m128d a, __m128d b);
  63. extern __m128d _mm_sub_sd(__m128d a, __m128d b);
  64. extern __m128d _mm_sub_pd(__m128d a, __m128d b);
  65. extern __m128d _mm_mul_sd(__m128d a, __m128d b);
  66. extern __m128d _mm_mul_pd(__m128d a, __m128d b);
  67. extern __m128d _mm_sqrt_sd(__m128d a, __m128d b);
  68. extern __m128d _mm_sqrt_pd(__m128d a);
  69. extern __m128d _mm_div_sd(__m128d a, __m128d b);
  70. extern __m128d _mm_div_pd(__m128d a, __m128d b);
  71. extern __m128d _mm_min_sd(__m128d a, __m128d b);
  72. extern __m128d _mm_min_pd(__m128d a, __m128d b);
  73. extern __m128d _mm_max_sd(__m128d a, __m128d b);
  74. extern __m128d _mm_max_pd(__m128d a, __m128d b);
  75. /*
  76. * DP, logicals
  77. */
  78. extern __m128d _mm_and_pd(__m128d a, __m128d b);
  79. extern __m128d _mm_andnot_pd(__m128d a, __m128d b);
  80. extern __m128d _mm_or_pd(__m128d a, __m128d b);
  81. extern __m128d _mm_xor_pd(__m128d a, __m128d b);
  82. /*
  83. * DP, comparisons
  84. */
  85. extern __m128d _mm_cmpeq_sd(__m128d a, __m128d b);
  86. extern __m128d _mm_cmpeq_pd(__m128d a, __m128d b);
  87. extern __m128d _mm_cmplt_sd(__m128d a, __m128d b);
  88. extern __m128d _mm_cmplt_pd(__m128d a, __m128d b);
  89. extern __m128d _mm_cmple_sd(__m128d a, __m128d b);
  90. extern __m128d _mm_cmple_pd(__m128d a, __m128d b);
  91. extern __m128d _mm_cmpgt_sd(__m128d a, __m128d b);
  92. extern __m128d _mm_cmpgt_pd(__m128d a, __m128d b);
  93. extern __m128d _mm_cmpge_sd(__m128d a, __m128d b);
  94. extern __m128d _mm_cmpge_pd(__m128d a, __m128d b);
  95. extern __m128d _mm_cmpneq_sd(__m128d a, __m128d b);
  96. extern __m128d _mm_cmpneq_pd(__m128d a, __m128d b);
  97. extern __m128d _mm_cmpnlt_sd(__m128d a, __m128d b);
  98. extern __m128d _mm_cmpnlt_pd(__m128d a, __m128d b);
  99. extern __m128d _mm_cmpnle_sd(__m128d a, __m128d b);
  100. extern __m128d _mm_cmpnle_pd(__m128d a, __m128d b);
  101. extern __m128d _mm_cmpngt_sd(__m128d a, __m128d b);
  102. extern __m128d _mm_cmpngt_pd(__m128d a, __m128d b);
  103. extern __m128d _mm_cmpnge_sd(__m128d a, __m128d b);
  104. extern __m128d _mm_cmpnge_pd(__m128d a, __m128d b);
  105. extern __m128d _mm_cmpord_pd(__m128d a, __m128d b);
  106. extern __m128d _mm_cmpord_sd(__m128d a, __m128d b);
  107. extern __m128d _mm_cmpunord_pd(__m128d a, __m128d b);
  108. extern __m128d _mm_cmpunord_sd(__m128d a, __m128d b);
  109. extern int _mm_comieq_sd(__m128d a, __m128d b);
  110. extern int _mm_comilt_sd(__m128d a, __m128d b);
  111. extern int _mm_comile_sd(__m128d a, __m128d b);
  112. extern int _mm_comigt_sd(__m128d a, __m128d b);
  113. extern int _mm_comige_sd(__m128d a, __m128d b);
  114. extern int _mm_comineq_sd(__m128d a, __m128d b);
  115. extern int _mm_ucomieq_sd(__m128d a, __m128d b);
  116. extern int _mm_ucomilt_sd(__m128d a, __m128d b);
  117. extern int _mm_ucomile_sd(__m128d a, __m128d b);
  118. extern int _mm_ucomigt_sd(__m128d a, __m128d b);
  119. extern int _mm_ucomige_sd(__m128d a, __m128d b);
  120. extern int _mm_ucomineq_sd(__m128d a, __m128d b);
  121. /*
  122. * DP, converts
  123. */
  124. extern __m128d _mm_cvtepi32_pd(__m128i a);
  125. extern __m128i _mm_cvtpd_epi32(__m128d a);
  126. extern __m128i _mm_cvttpd_epi32(__m128d a);
  127. extern __m128 _mm_cvtepi32_ps(__m128i a);
  128. extern __m128i _mm_cvtps_epi32(__m128 a);
  129. extern __m128i _mm_cvttps_epi32(__m128 a);
  130. extern __m128 _mm_cvtpd_ps(__m128d a);
  131. extern __m128d _mm_cvtps_pd(__m128 a);
  132. extern __m128 _mm_cvtsd_ss(__m128 a, __m128d b);
  133. extern __m128d _mm_cvtss_sd(__m128d a, __m128 b);
  134. extern int _mm_cvtsd_si32(__m128d a);
  135. extern int _mm_cvttsd_si32(__m128d a);
  136. extern __m128d _mm_cvtsi32_sd(__m128d a, int b);
  137. extern __m64 _mm_cvtpd_pi32(__m128d a);
  138. extern __m64 _mm_cvttpd_pi32(__m128d a);
  139. extern __m128d _mm_cvtpi32_pd(__m64 a);
  140. /*
  141. * DP, misc
  142. */
  143. extern __m128d _mm_unpackhi_pd(__m128d a, __m128d b);
  144. extern __m128d _mm_unpacklo_pd(__m128d a, __m128d b);
  145. extern int _mm_movemask_pd(__m128d a);
  146. extern __m128d _mm_shuffle_pd(__m128d a, __m128d b, int i);
  147. /*
  148. * DP, loads
  149. */
  150. extern __m128d _mm_load_pd(double const*dp);
  151. extern __m128d _mm_load1_pd(double const*dp);
  152. extern __m128d _mm_loadr_pd(double const*dp);
  153. extern __m128d _mm_loadu_pd(double const*dp);
  154. extern __m128d _mm_load_sd(double const*dp);
  155. extern __m128d _mm_loadh_pd(__m128d a, double const*dp);
  156. extern __m128d _mm_loadl_pd(__m128d a, double const*dp);
  157. /*
  158. * DP, sets
  159. */
  160. extern __m128d _mm_set_sd(double w);
  161. extern __m128d _mm_set1_pd(double a);
  162. extern __m128d _mm_set_pd(double z, double y);
  163. extern __m128d _mm_setr_pd(double y, double z);
  164. extern __m128d _mm_setzero_pd(void);
  165. extern __m128d _mm_move_sd(__m128d a, __m128d b);;
  166. /*
  167. * DP, stores
  168. */
  169. extern void _mm_store_sd(double *dp, __m128d a);
  170. extern void _mm_store1_pd(double *dp, __m128d a);
  171. extern void _mm_store_pd(double *dp, __m128d a);
  172. extern void _mm_storeu_pd(double *dp, __m128d a);
  173. extern void _mm_storer_pd(double *dp, __m128d a);
  174. extern void _mm_storeh_pd(double *dp, __m128d a);
  175. extern void _mm_storel_pd(double *dp, __m128d a);
  176. /*
  177. * Integer, arithmetic
  178. */
  179. extern __m128i _mm_add_epi8(__m128i a, __m128i b);
  180. extern __m128i _mm_add_epi16(__m128i a, __m128i b);
  181. extern __m128i _mm_add_epi32(__m128i a, __m128i b);
  182. extern __m64 _mm_add_si64(__m64 a, __m64 b);
  183. extern __m128i _mm_add_epi64(__m128i a, __m128i b);
  184. extern __m128i _mm_adds_epi8(__m128i a, __m128i b);
  185. extern __m128i _mm_adds_epi16(__m128i a, __m128i b);
  186. extern __m128i _mm_adds_epu8(__m128i a, __m128i b);
  187. extern __m128i _mm_adds_epu16(__m128i a, __m128i b);
  188. extern __m128i _mm_avg_epu8(__m128i a, __m128i b);
  189. extern __m128i _mm_avg_epu16(__m128i a, __m128i b);
  190. extern __m128i _mm_madd_epi16(__m128i a, __m128i b);
  191. extern __m128i _mm_max_epi16(__m128i a, __m128i b);
  192. extern __m128i _mm_max_epu8(__m128i a, __m128i b);
  193. extern __m128i _mm_min_epi16(__m128i a, __m128i b);
  194. extern __m128i _mm_min_epu8(__m128i a, __m128i b);
  195. extern __m128i _mm_mulhi_epi16(__m128i a, __m128i b);
  196. extern __m128i _mm_mulhi_epu16(__m128i a, __m128i b);
  197. extern __m128i _mm_mullo_epi16(__m128i a, __m128i b);
  198. extern __m64 _mm_mul_su32(__m64 a, __m64 b);
  199. extern __m128i _mm_mul_epu32(__m128i a, __m128i b);
  200. extern __m128i _mm_sad_epu8(__m128i a, __m128i b);
  201. extern __m128i _mm_sub_epi8(__m128i a, __m128i b);
  202. extern __m128i _mm_sub_epi16(__m128i a, __m128i b);
  203. extern __m128i _mm_sub_epi32(__m128i a, __m128i b);
  204. extern __m64 _mm_sub_si64(__m64 a, __m64 b);
  205. extern __m128i _mm_sub_epi64(__m128i a, __m128i b);
  206. extern __m128i _mm_subs_epi8(__m128i a, __m128i b);
  207. extern __m128i _mm_subs_epi16(__m128i a, __m128i b);
  208. extern __m128i _mm_subs_epu8(__m128i a, __m128i b);
  209. extern __m128i _mm_subs_epu16(__m128i a, __m128i b);
  210. /*
  211. * Integer, logicals
  212. */
  213. extern __m128i _mm_and_si128(__m128i a, __m128i b);
  214. extern __m128i _mm_andnot_si128(__m128i a, __m128i b);
  215. extern __m128i _mm_or_si128(__m128i a, __m128i b);
  216. extern __m128i _mm_xor_si128(__m128i a, __m128i b);
  217. /*
  218. * Integer, shifts
  219. */
  220. extern __m128i _mm_slli_si128(__m128i a, int imm);
  221. extern __m128i _mm_slli_epi16(__m128i a, int count);
  222. extern __m128i _mm_sll_epi16(__m128i a, __m128i count);
  223. extern __m128i _mm_slli_epi32(__m128i a, int count);
  224. extern __m128i _mm_sll_epi32(__m128i a, __m128i count);
  225. extern __m128i _mm_slli_epi64(__m128i a, int count);
  226. extern __m128i _mm_sll_epi64(__m128i a, __m128i count);
  227. extern __m128i _mm_srai_epi16(__m128i a, int count);
  228. extern __m128i _mm_sra_epi16(__m128i a, __m128i count);
  229. extern __m128i _mm_srai_epi32(__m128i a, int count);
  230. extern __m128i _mm_sra_epi32(__m128i a, __m128i count);
  231. extern __m128i _mm_srli_si128(__m128i a, int imm);
  232. extern __m128i _mm_srli_epi16(__m128i a, int count);
  233. extern __m128i _mm_srl_epi16(__m128i a, __m128i count);
  234. extern __m128i _mm_srli_epi32(__m128i a, int count);
  235. extern __m128i _mm_srl_epi32(__m128i a, __m128i count);
  236. extern __m128i _mm_srli_epi64(__m128i a, int count);
  237. extern __m128i _mm_srl_epi64(__m128i a, __m128i count);
  238. /*
  239. * Integer, comparisons
  240. */
  241. extern __m128i _mm_cmpeq_epi8(__m128i a, __m128i b);
  242. extern __m128i _mm_cmpeq_epi16(__m128i a, __m128i b);
  243. extern __m128i _mm_cmpeq_epi32(__m128i a, __m128i b);
  244. extern __m128i _mm_cmpgt_epi8(__m128i a, __m128i b);
  245. extern __m128i _mm_cmpgt_epi16(__m128i a, __m128i b);
  246. extern __m128i _mm_cmpgt_epi32(__m128i a, __m128i b);
  247. extern __m128i _mm_cmplt_epi8(__m128i a, __m128i b);
  248. extern __m128i _mm_cmplt_epi16(__m128i a, __m128i b);
  249. extern __m128i _mm_cmplt_epi32(__m128i a, __m128i b);
  250. /*
  251. * Integer, converts
  252. */
  253. extern __m128i _mm_cvtsi32_si128(int a);
  254. extern int _mm_cvtsi128_si32(__m128i a);
  255. /*
  256. * Integer, misc
  257. */
  258. extern __m128i _mm_packs_epi16(__m128i a, __m128i b);
  259. extern __m128i _mm_packs_epi32(__m128i a, __m128i b);
  260. extern __m128i _mm_packus_epi16(__m128i a, __m128i b);
  261. extern int _mm_extract_epi16(__m128i a, int imm);
  262. extern __m128i _mm_insert_epi16(__m128i a, int b, int imm);
  263. extern int _mm_movemask_epi8(__m128i a);
  264. extern __m128i _mm_shuffle_epi32(__m128i a, int imm);
  265. extern __m128i _mm_shufflehi_epi16(__m128i a, int imm);
  266. extern __m128i _mm_shufflelo_epi16(__m128i a, int imm);
  267. extern __m128i _mm_unpackhi_epi8(__m128i a, __m128i b);
  268. extern __m128i _mm_unpackhi_epi16(__m128i a, __m128i b);
  269. extern __m128i _mm_unpackhi_epi32(__m128i a, __m128i b);
  270. extern __m128i _mm_unpackhi_epi64(__m128i a, __m128i b);
  271. extern __m128i _mm_unpacklo_epi8(__m128i a, __m128i b);
  272. extern __m128i _mm_unpacklo_epi16(__m128i a, __m128i b);
  273. extern __m128i _mm_unpacklo_epi32(__m128i a, __m128i b);
  274. extern __m128i _mm_unpacklo_epi64(__m128i a, __m128i b);
  275. /*
  276. * Integer, loads
  277. */
  278. extern __m128i _mm_load_si128(__m128i const*p);
  279. extern __m128i _mm_loadu_si128(__m128i const*p);
  280. extern __m128i _mm_loadl_epi64(__m128i const*p);
  281. /*
  282. * Integer, sets
  283. */
  284. extern __m128i _mm_set_epi64(__m64 q1, __m64 q0);
  285. extern __m128i _mm_set_epi32(int i3, int i2, int i1, int i0);
  286. extern __m128i _mm_set_epi16(short w7, short w6, short w5, short w4,
  287. short w3, short w2, short w1, short w0);
  288. extern __m128i _mm_set_epi8(char b15, char b14, char b13, char b12,
  289. char b11, char b10, char b9, char b8,
  290. char b7, char b6, char b5, char b4,
  291. char b3, char b2, char b1, char b0);
  292. extern __m128i _mm_set1_epi64(__m64 q);
  293. extern __m128i _mm_set1_epi32(int i);
  294. extern __m128i _mm_set1_epi16(short w);
  295. extern __m128i _mm_set1_epi8(char b);
  296. extern __m128i _mm_setl_epi64(__m128i q);
  297. extern __m128i _mm_setr_epi64(__m64 q0, __m64 q1);
  298. extern __m128i _mm_setr_epi32(int i0, int i1, int i2, int i3);
  299. extern __m128i _mm_setr_epi16(short w0, short w1, short w2, short w3,
  300. short w4, short w5, short w6, short w7);
  301. extern __m128i _mm_setr_epi8(char b15, char b14, char b13, char b12,
  302. char b11, char b10, char b9, char b8,
  303. char b7, char b6, char b5, char b4,
  304. char b3, char b2, char b1, char b0);
  305. extern __m128i _mm_setzero_si128();
  306. /*
  307. * Integer, stores
  308. */
  309. extern void _mm_store_si128(__m128i *p, __m128i b);
  310. extern void _mm_storeu_si128(__m128i *p, __m128i b);
  311. extern void _mm_storel_epi64(__m128i *p, __m128i q);
  312. extern void _mm_maskmoveu_si128(__m128i d, __m128i n, char *p);
  313. /*
  314. * Integer, moves
  315. */
  316. extern __m128i _mm_move_epi64(__m128i q);
  317. extern __m128i _mm_movpi64_epi64(__m64 q);
  318. extern __m64 _mm_movepi64_pi64(__m128i q);
  319. /*
  320. * Cacheability support
  321. */
  322. extern void _mm_stream_pd(double *dp, __m128d a);;
  323. extern void _mm_stream_si128(__m128i *p, __m128i a);
  324. extern void _mm_clflush(void const*p);
  325. extern void _mm_lfence(void);
  326. extern void _mm_mfence(void);
  327. extern void _mm_stream_si32(int *p, int i);
  328. extern void _mm_pause(void);
  329. #if defined __cplusplus
  330. }; /* End "C" */
  331. #endif /* __cplusplus */
  332. #endif /* _INCLUDED_EMM */