1 /*===---- mmintrin.h - MMX intrinsics --------------------------------------===
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
7 *===-----------------------------------------------------------------------===
13 #if !defined(__i386__) && !defined(__x86_64__)
14 #error "This header is only meant to be used on x86 and x64 architecture"
17 typedef long long __m64
__attribute__((__vector_size__(8), __aligned__(8)));
19 typedef long long __v1di
__attribute__((__vector_size__(8)));
20 typedef int __v2si
__attribute__((__vector_size__(8)));
21 typedef short __v4hi
__attribute__((__vector_size__(8)));
22 typedef char __v8qi
__attribute__((__vector_size__(8)));
24 /* Define the default attributes for the functions in this file. */
25 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mmx"), __min_vector_width__(64)))
27 /// Clears the MMX state by setting the state of the x87 stack registers
30 /// \headerfile <x86intrin.h>
32 /// This intrinsic corresponds to the <c> EMMS </c> instruction.
34 static __inline__
void __attribute__((__always_inline__
, __nodebug__
, __target__("mmx")))
37 __builtin_ia32_emms();
40 /// Constructs a 64-bit integer vector, setting the lower 32 bits to the
41 /// value of the 32-bit integer parameter and setting the upper 32 bits to 0.
43 /// \headerfile <x86intrin.h>
45 /// This intrinsic corresponds to the <c> MOVD </c> instruction.
48 /// A 32-bit integer value.
49 /// \returns A 64-bit integer vector. The lower 32 bits contain the value of the
50 /// parameter. The upper 32 bits are set to 0.
51 static __inline__ __m64 __DEFAULT_FN_ATTRS
52 _mm_cvtsi32_si64(int __i
)
54 return (__m64
)__builtin_ia32_vec_init_v2si(__i
, 0);
57 /// Returns the lower 32 bits of a 64-bit integer vector as a 32-bit
60 /// \headerfile <x86intrin.h>
62 /// This intrinsic corresponds to the <c> MOVD </c> instruction.
65 /// A 64-bit integer vector.
66 /// \returns A 32-bit signed integer value containing the lower 32 bits of the
68 static __inline__
int __DEFAULT_FN_ATTRS
69 _mm_cvtsi64_si32(__m64 __m
)
71 return __builtin_ia32_vec_ext_v2si((__v2si
)__m
, 0);
74 /// Casts a 64-bit signed integer value into a 64-bit integer vector.
76 /// \headerfile <x86intrin.h>
78 /// This intrinsic corresponds to the <c> MOVQ </c> instruction.
81 /// A 64-bit signed integer.
82 /// \returns A 64-bit integer vector containing the same bitwise pattern as the
84 static __inline__ __m64 __DEFAULT_FN_ATTRS
85 _mm_cvtsi64_m64(long long __i
)
90 /// Casts a 64-bit integer vector into a 64-bit signed integer value.
92 /// \headerfile <x86intrin.h>
94 /// This intrinsic corresponds to the <c> MOVQ </c> instruction.
97 /// A 64-bit integer vector.
98 /// \returns A 64-bit signed integer containing the same bitwise pattern as the
100 static __inline__
long long __DEFAULT_FN_ATTRS
101 _mm_cvtm64_si64(__m64 __m
)
103 return (long long)__m
;
106 /// Converts 16-bit signed integers from both 64-bit integer vector
107 /// parameters of [4 x i16] into 8-bit signed integer values, and constructs
108 /// a 64-bit integer vector of [8 x i8] as the result. Positive values
109 /// greater than 0x7F are saturated to 0x7F. Negative values less than 0x80
110 /// are saturated to 0x80.
112 /// \headerfile <x86intrin.h>
114 /// This intrinsic corresponds to the <c> PACKSSWB </c> instruction.
117 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
118 /// 16-bit signed integer and is converted to an 8-bit signed integer with
119 /// saturation. Positive values greater than 0x7F are saturated to 0x7F.
120 /// Negative values less than 0x80 are saturated to 0x80. The converted
121 /// [4 x i8] values are written to the lower 32 bits of the result.
123 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
124 /// 16-bit signed integer and is converted to an 8-bit signed integer with
125 /// saturation. Positive values greater than 0x7F are saturated to 0x7F.
126 /// Negative values less than 0x80 are saturated to 0x80. The converted
127 /// [4 x i8] values are written to the upper 32 bits of the result.
128 /// \returns A 64-bit integer vector of [8 x i8] containing the converted
130 static __inline__ __m64 __DEFAULT_FN_ATTRS
131 _mm_packs_pi16(__m64 __m1
, __m64 __m2
)
133 return (__m64
)__builtin_ia32_packsswb((__v4hi
)__m1
, (__v4hi
)__m2
);
136 /// Converts 32-bit signed integers from both 64-bit integer vector
137 /// parameters of [2 x i32] into 16-bit signed integer values, and constructs
138 /// a 64-bit integer vector of [4 x i16] as the result. Positive values
139 /// greater than 0x7FFF are saturated to 0x7FFF. Negative values less than
140 /// 0x8000 are saturated to 0x8000.
142 /// \headerfile <x86intrin.h>
144 /// This intrinsic corresponds to the <c> PACKSSDW </c> instruction.
147 /// A 64-bit integer vector of [2 x i32]. Each 32-bit element is treated as a
148 /// 32-bit signed integer and is converted to a 16-bit signed integer with
149 /// saturation. Positive values greater than 0x7FFF are saturated to 0x7FFF.
150 /// Negative values less than 0x8000 are saturated to 0x8000. The converted
151 /// [2 x i16] values are written to the lower 32 bits of the result.
153 /// A 64-bit integer vector of [2 x i32]. Each 32-bit element is treated as a
154 /// 32-bit signed integer and is converted to a 16-bit signed integer with
155 /// saturation. Positive values greater than 0x7FFF are saturated to 0x7FFF.
156 /// Negative values less than 0x8000 are saturated to 0x8000. The converted
157 /// [2 x i16] values are written to the upper 32 bits of the result.
158 /// \returns A 64-bit integer vector of [4 x i16] containing the converted
160 static __inline__ __m64 __DEFAULT_FN_ATTRS
161 _mm_packs_pi32(__m64 __m1
, __m64 __m2
)
163 return (__m64
)__builtin_ia32_packssdw((__v2si
)__m1
, (__v2si
)__m2
);
166 /// Converts 16-bit signed integers from both 64-bit integer vector
167 /// parameters of [4 x i16] into 8-bit unsigned integer values, and
168 /// constructs a 64-bit integer vector of [8 x i8] as the result. Values
169 /// greater than 0xFF are saturated to 0xFF. Values less than 0 are saturated
172 /// \headerfile <x86intrin.h>
174 /// This intrinsic corresponds to the <c> PACKUSWB </c> instruction.
177 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
178 /// 16-bit signed integer and is converted to an 8-bit unsigned integer with
179 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
180 /// than 0 are saturated to 0. The converted [4 x i8] values are written to
181 /// the lower 32 bits of the result.
183 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
184 /// 16-bit signed integer and is converted to an 8-bit unsigned integer with
185 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
186 /// than 0 are saturated to 0. The converted [4 x i8] values are written to
187 /// the upper 32 bits of the result.
188 /// \returns A 64-bit integer vector of [8 x i8] containing the converted
190 static __inline__ __m64 __DEFAULT_FN_ATTRS
191 _mm_packs_pu16(__m64 __m1
, __m64 __m2
)
193 return (__m64
)__builtin_ia32_packuswb((__v4hi
)__m1
, (__v4hi
)__m2
);
196 /// Unpacks the upper 32 bits from two 64-bit integer vectors of [8 x i8]
197 /// and interleaves them into a 64-bit integer vector of [8 x i8].
199 /// \headerfile <x86intrin.h>
201 /// This intrinsic corresponds to the <c> PUNPCKHBW </c> instruction.
204 /// A 64-bit integer vector of [8 x i8]. \n
205 /// Bits [39:32] are written to bits [7:0] of the result. \n
206 /// Bits [47:40] are written to bits [23:16] of the result. \n
207 /// Bits [55:48] are written to bits [39:32] of the result. \n
208 /// Bits [63:56] are written to bits [55:48] of the result.
210 /// A 64-bit integer vector of [8 x i8].
211 /// Bits [39:32] are written to bits [15:8] of the result. \n
212 /// Bits [47:40] are written to bits [31:24] of the result. \n
213 /// Bits [55:48] are written to bits [47:40] of the result. \n
214 /// Bits [63:56] are written to bits [63:56] of the result.
215 /// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
217 static __inline__ __m64 __DEFAULT_FN_ATTRS
218 _mm_unpackhi_pi8(__m64 __m1
, __m64 __m2
)
220 return (__m64
)__builtin_ia32_punpckhbw((__v8qi
)__m1
, (__v8qi
)__m2
);
223 /// Unpacks the upper 32 bits from two 64-bit integer vectors of
224 /// [4 x i16] and interleaves them into a 64-bit integer vector of [4 x i16].
226 /// \headerfile <x86intrin.h>
228 /// This intrinsic corresponds to the <c> PUNPCKHWD </c> instruction.
231 /// A 64-bit integer vector of [4 x i16].
232 /// Bits [47:32] are written to bits [15:0] of the result. \n
233 /// Bits [63:48] are written to bits [47:32] of the result.
235 /// A 64-bit integer vector of [4 x i16].
236 /// Bits [47:32] are written to bits [31:16] of the result. \n
237 /// Bits [63:48] are written to bits [63:48] of the result.
238 /// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
240 static __inline__ __m64 __DEFAULT_FN_ATTRS
241 _mm_unpackhi_pi16(__m64 __m1
, __m64 __m2
)
243 return (__m64
)__builtin_ia32_punpckhwd((__v4hi
)__m1
, (__v4hi
)__m2
);
246 /// Unpacks the upper 32 bits from two 64-bit integer vectors of
247 /// [2 x i32] and interleaves them into a 64-bit integer vector of [2 x i32].
249 /// \headerfile <x86intrin.h>
251 /// This intrinsic corresponds to the <c> PUNPCKHDQ </c> instruction.
254 /// A 64-bit integer vector of [2 x i32]. The upper 32 bits are written to
255 /// the lower 32 bits of the result.
257 /// A 64-bit integer vector of [2 x i32]. The upper 32 bits are written to
258 /// the upper 32 bits of the result.
259 /// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
261 static __inline__ __m64 __DEFAULT_FN_ATTRS
262 _mm_unpackhi_pi32(__m64 __m1
, __m64 __m2
)
264 return (__m64
)__builtin_ia32_punpckhdq((__v2si
)__m1
, (__v2si
)__m2
);
267 /// Unpacks the lower 32 bits from two 64-bit integer vectors of [8 x i8]
268 /// and interleaves them into a 64-bit integer vector of [8 x i8].
270 /// \headerfile <x86intrin.h>
272 /// This intrinsic corresponds to the <c> PUNPCKLBW </c> instruction.
275 /// A 64-bit integer vector of [8 x i8].
276 /// Bits [7:0] are written to bits [7:0] of the result. \n
277 /// Bits [15:8] are written to bits [23:16] of the result. \n
278 /// Bits [23:16] are written to bits [39:32] of the result. \n
279 /// Bits [31:24] are written to bits [55:48] of the result.
281 /// A 64-bit integer vector of [8 x i8].
282 /// Bits [7:0] are written to bits [15:8] of the result. \n
283 /// Bits [15:8] are written to bits [31:24] of the result. \n
284 /// Bits [23:16] are written to bits [47:40] of the result. \n
285 /// Bits [31:24] are written to bits [63:56] of the result.
286 /// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
288 static __inline__ __m64 __DEFAULT_FN_ATTRS
289 _mm_unpacklo_pi8(__m64 __m1
, __m64 __m2
)
291 return (__m64
)__builtin_ia32_punpcklbw((__v8qi
)__m1
, (__v8qi
)__m2
);
294 /// Unpacks the lower 32 bits from two 64-bit integer vectors of
295 /// [4 x i16] and interleaves them into a 64-bit integer vector of [4 x i16].
297 /// \headerfile <x86intrin.h>
299 /// This intrinsic corresponds to the <c> PUNPCKLWD </c> instruction.
302 /// A 64-bit integer vector of [4 x i16].
303 /// Bits [15:0] are written to bits [15:0] of the result. \n
304 /// Bits [31:16] are written to bits [47:32] of the result.
306 /// A 64-bit integer vector of [4 x i16].
307 /// Bits [15:0] are written to bits [31:16] of the result. \n
308 /// Bits [31:16] are written to bits [63:48] of the result.
309 /// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
311 static __inline__ __m64 __DEFAULT_FN_ATTRS
312 _mm_unpacklo_pi16(__m64 __m1
, __m64 __m2
)
314 return (__m64
)__builtin_ia32_punpcklwd((__v4hi
)__m1
, (__v4hi
)__m2
);
317 /// Unpacks the lower 32 bits from two 64-bit integer vectors of
318 /// [2 x i32] and interleaves them into a 64-bit integer vector of [2 x i32].
320 /// \headerfile <x86intrin.h>
322 /// This intrinsic corresponds to the <c> PUNPCKLDQ </c> instruction.
325 /// A 64-bit integer vector of [2 x i32]. The lower 32 bits are written to
326 /// the lower 32 bits of the result.
328 /// A 64-bit integer vector of [2 x i32]. The lower 32 bits are written to
329 /// the upper 32 bits of the result.
330 /// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
332 static __inline__ __m64 __DEFAULT_FN_ATTRS
333 _mm_unpacklo_pi32(__m64 __m1
, __m64 __m2
)
335 return (__m64
)__builtin_ia32_punpckldq((__v2si
)__m1
, (__v2si
)__m2
);
338 /// Adds each 8-bit integer element of the first 64-bit integer vector
339 /// of [8 x i8] to the corresponding 8-bit integer element of the second
340 /// 64-bit integer vector of [8 x i8]. The lower 8 bits of the results are
341 /// packed into a 64-bit integer vector of [8 x i8].
343 /// \headerfile <x86intrin.h>
345 /// This intrinsic corresponds to the <c> PADDB </c> instruction.
348 /// A 64-bit integer vector of [8 x i8].
350 /// A 64-bit integer vector of [8 x i8].
351 /// \returns A 64-bit integer vector of [8 x i8] containing the sums of both
353 static __inline__ __m64 __DEFAULT_FN_ATTRS
354 _mm_add_pi8(__m64 __m1
, __m64 __m2
)
356 return (__m64
)__builtin_ia32_paddb((__v8qi
)__m1
, (__v8qi
)__m2
);
359 /// Adds each 16-bit integer element of the first 64-bit integer vector
360 /// of [4 x i16] to the corresponding 16-bit integer element of the second
361 /// 64-bit integer vector of [4 x i16]. The lower 16 bits of the results are
362 /// packed into a 64-bit integer vector of [4 x i16].
364 /// \headerfile <x86intrin.h>
366 /// This intrinsic corresponds to the <c> PADDW </c> instruction.
369 /// A 64-bit integer vector of [4 x i16].
371 /// A 64-bit integer vector of [4 x i16].
372 /// \returns A 64-bit integer vector of [4 x i16] containing the sums of both
374 static __inline__ __m64 __DEFAULT_FN_ATTRS
375 _mm_add_pi16(__m64 __m1
, __m64 __m2
)
377 return (__m64
)__builtin_ia32_paddw((__v4hi
)__m1
, (__v4hi
)__m2
);
380 /// Adds each 32-bit integer element of the first 64-bit integer vector
381 /// of [2 x i32] to the corresponding 32-bit integer element of the second
382 /// 64-bit integer vector of [2 x i32]. The lower 32 bits of the results are
383 /// packed into a 64-bit integer vector of [2 x i32].
385 /// \headerfile <x86intrin.h>
387 /// This intrinsic corresponds to the <c> PADDD </c> instruction.
390 /// A 64-bit integer vector of [2 x i32].
392 /// A 64-bit integer vector of [2 x i32].
393 /// \returns A 64-bit integer vector of [2 x i32] containing the sums of both
395 static __inline__ __m64 __DEFAULT_FN_ATTRS
396 _mm_add_pi32(__m64 __m1
, __m64 __m2
)
398 return (__m64
)__builtin_ia32_paddd((__v2si
)__m1
, (__v2si
)__m2
);
401 /// Adds each 8-bit signed integer element of the first 64-bit integer
402 /// vector of [8 x i8] to the corresponding 8-bit signed integer element of
403 /// the second 64-bit integer vector of [8 x i8]. Positive sums greater than
404 /// 0x7F are saturated to 0x7F. Negative sums less than 0x80 are saturated to
405 /// 0x80. The results are packed into a 64-bit integer vector of [8 x i8].
407 /// \headerfile <x86intrin.h>
409 /// This intrinsic corresponds to the <c> PADDSB </c> instruction.
412 /// A 64-bit integer vector of [8 x i8].
414 /// A 64-bit integer vector of [8 x i8].
415 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated sums
416 /// of both parameters.
417 static __inline__ __m64 __DEFAULT_FN_ATTRS
418 _mm_adds_pi8(__m64 __m1
, __m64 __m2
)
420 return (__m64
)__builtin_ia32_paddsb((__v8qi
)__m1
, (__v8qi
)__m2
);
423 /// Adds each 16-bit signed integer element of the first 64-bit integer
424 /// vector of [4 x i16] to the corresponding 16-bit signed integer element of
425 /// the second 64-bit integer vector of [4 x i16]. Positive sums greater than
426 /// 0x7FFF are saturated to 0x7FFF. Negative sums less than 0x8000 are
427 /// saturated to 0x8000. The results are packed into a 64-bit integer vector
430 /// \headerfile <x86intrin.h>
432 /// This intrinsic corresponds to the <c> PADDSW </c> instruction.
435 /// A 64-bit integer vector of [4 x i16].
437 /// A 64-bit integer vector of [4 x i16].
438 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated sums
439 /// of both parameters.
440 static __inline__ __m64 __DEFAULT_FN_ATTRS
441 _mm_adds_pi16(__m64 __m1
, __m64 __m2
)
443 return (__m64
)__builtin_ia32_paddsw((__v4hi
)__m1
, (__v4hi
)__m2
);
446 /// Adds each 8-bit unsigned integer element of the first 64-bit integer
447 /// vector of [8 x i8] to the corresponding 8-bit unsigned integer element of
448 /// the second 64-bit integer vector of [8 x i8]. Sums greater than 0xFF are
449 /// saturated to 0xFF. The results are packed into a 64-bit integer vector of
452 /// \headerfile <x86intrin.h>
454 /// This intrinsic corresponds to the <c> PADDUSB </c> instruction.
457 /// A 64-bit integer vector of [8 x i8].
459 /// A 64-bit integer vector of [8 x i8].
460 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
461 /// unsigned sums of both parameters.
462 static __inline__ __m64 __DEFAULT_FN_ATTRS
463 _mm_adds_pu8(__m64 __m1
, __m64 __m2
)
465 return (__m64
)__builtin_ia32_paddusb((__v8qi
)__m1
, (__v8qi
)__m2
);
468 /// Adds each 16-bit unsigned integer element of the first 64-bit integer
469 /// vector of [4 x i16] to the corresponding 16-bit unsigned integer element
470 /// of the second 64-bit integer vector of [4 x i16]. Sums greater than
471 /// 0xFFFF are saturated to 0xFFFF. The results are packed into a 64-bit
472 /// integer vector of [4 x i16].
474 /// \headerfile <x86intrin.h>
476 /// This intrinsic corresponds to the <c> PADDUSW </c> instruction.
479 /// A 64-bit integer vector of [4 x i16].
481 /// A 64-bit integer vector of [4 x i16].
482 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
483 /// unsigned sums of both parameters.
484 static __inline__ __m64 __DEFAULT_FN_ATTRS
485 _mm_adds_pu16(__m64 __m1
, __m64 __m2
)
487 return (__m64
)__builtin_ia32_paddusw((__v4hi
)__m1
, (__v4hi
)__m2
);
490 /// Subtracts each 8-bit integer element of the second 64-bit integer
491 /// vector of [8 x i8] from the corresponding 8-bit integer element of the
492 /// first 64-bit integer vector of [8 x i8]. The lower 8 bits of the results
493 /// are packed into a 64-bit integer vector of [8 x i8].
495 /// \headerfile <x86intrin.h>
497 /// This intrinsic corresponds to the <c> PSUBB </c> instruction.
500 /// A 64-bit integer vector of [8 x i8] containing the minuends.
502 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
503 /// \returns A 64-bit integer vector of [8 x i8] containing the differences of
505 static __inline__ __m64 __DEFAULT_FN_ATTRS
506 _mm_sub_pi8(__m64 __m1
, __m64 __m2
)
508 return (__m64
)__builtin_ia32_psubb((__v8qi
)__m1
, (__v8qi
)__m2
);
511 /// Subtracts each 16-bit integer element of the second 64-bit integer
512 /// vector of [4 x i16] from the corresponding 16-bit integer element of the
513 /// first 64-bit integer vector of [4 x i16]. The lower 16 bits of the
514 /// results are packed into a 64-bit integer vector of [4 x i16].
516 /// \headerfile <x86intrin.h>
518 /// This intrinsic corresponds to the <c> PSUBW </c> instruction.
521 /// A 64-bit integer vector of [4 x i16] containing the minuends.
523 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
524 /// \returns A 64-bit integer vector of [4 x i16] containing the differences of
526 static __inline__ __m64 __DEFAULT_FN_ATTRS
527 _mm_sub_pi16(__m64 __m1
, __m64 __m2
)
529 return (__m64
)__builtin_ia32_psubw((__v4hi
)__m1
, (__v4hi
)__m2
);
532 /// Subtracts each 32-bit integer element of the second 64-bit integer
533 /// vector of [2 x i32] from the corresponding 32-bit integer element of the
534 /// first 64-bit integer vector of [2 x i32]. The lower 32 bits of the
535 /// results are packed into a 64-bit integer vector of [2 x i32].
537 /// \headerfile <x86intrin.h>
539 /// This intrinsic corresponds to the <c> PSUBD </c> instruction.
542 /// A 64-bit integer vector of [2 x i32] containing the minuends.
544 /// A 64-bit integer vector of [2 x i32] containing the subtrahends.
545 /// \returns A 64-bit integer vector of [2 x i32] containing the differences of
547 static __inline__ __m64 __DEFAULT_FN_ATTRS
548 _mm_sub_pi32(__m64 __m1
, __m64 __m2
)
550 return (__m64
)__builtin_ia32_psubd((__v2si
)__m1
, (__v2si
)__m2
);
553 /// Subtracts each 8-bit signed integer element of the second 64-bit
554 /// integer vector of [8 x i8] from the corresponding 8-bit signed integer
555 /// element of the first 64-bit integer vector of [8 x i8]. Positive results
556 /// greater than 0x7F are saturated to 0x7F. Negative results less than 0x80
557 /// are saturated to 0x80. The results are packed into a 64-bit integer
558 /// vector of [8 x i8].
560 /// \headerfile <x86intrin.h>
562 /// This intrinsic corresponds to the <c> PSUBSB </c> instruction.
565 /// A 64-bit integer vector of [8 x i8] containing the minuends.
567 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
568 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
569 /// differences of both parameters.
570 static __inline__ __m64 __DEFAULT_FN_ATTRS
571 _mm_subs_pi8(__m64 __m1
, __m64 __m2
)
573 return (__m64
)__builtin_ia32_psubsb((__v8qi
)__m1
, (__v8qi
)__m2
);
576 /// Subtracts each 16-bit signed integer element of the second 64-bit
577 /// integer vector of [4 x i16] from the corresponding 16-bit signed integer
578 /// element of the first 64-bit integer vector of [4 x i16]. Positive results
579 /// greater than 0x7FFF are saturated to 0x7FFF. Negative results less than
580 /// 0x8000 are saturated to 0x8000. The results are packed into a 64-bit
581 /// integer vector of [4 x i16].
583 /// \headerfile <x86intrin.h>
585 /// This intrinsic corresponds to the <c> PSUBSW </c> instruction.
588 /// A 64-bit integer vector of [4 x i16] containing the minuends.
590 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
591 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
592 /// differences of both parameters.
593 static __inline__ __m64 __DEFAULT_FN_ATTRS
594 _mm_subs_pi16(__m64 __m1
, __m64 __m2
)
596 return (__m64
)__builtin_ia32_psubsw((__v4hi
)__m1
, (__v4hi
)__m2
);
599 /// Subtracts each 8-bit unsigned integer element of the second 64-bit
600 /// integer vector of [8 x i8] from the corresponding 8-bit unsigned integer
601 /// element of the first 64-bit integer vector of [8 x i8].
603 /// If an element of the first vector is less than the corresponding element
604 /// of the second vector, the result is saturated to 0. The results are
605 /// packed into a 64-bit integer vector of [8 x i8].
607 /// \headerfile <x86intrin.h>
609 /// This intrinsic corresponds to the <c> PSUBUSB </c> instruction.
612 /// A 64-bit integer vector of [8 x i8] containing the minuends.
614 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
615 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
616 /// differences of both parameters.
617 static __inline__ __m64 __DEFAULT_FN_ATTRS
618 _mm_subs_pu8(__m64 __m1
, __m64 __m2
)
620 return (__m64
)__builtin_ia32_psubusb((__v8qi
)__m1
, (__v8qi
)__m2
);
623 /// Subtracts each 16-bit unsigned integer element of the second 64-bit
624 /// integer vector of [4 x i16] from the corresponding 16-bit unsigned
625 /// integer element of the first 64-bit integer vector of [4 x i16].
627 /// If an element of the first vector is less than the corresponding element
628 /// of the second vector, the result is saturated to 0. The results are
629 /// packed into a 64-bit integer vector of [4 x i16].
631 /// \headerfile <x86intrin.h>
633 /// This intrinsic corresponds to the <c> PSUBUSW </c> instruction.
636 /// A 64-bit integer vector of [4 x i16] containing the minuends.
638 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
639 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
640 /// differences of both parameters.
641 static __inline__ __m64 __DEFAULT_FN_ATTRS
642 _mm_subs_pu16(__m64 __m1
, __m64 __m2
)
644 return (__m64
)__builtin_ia32_psubusw((__v4hi
)__m1
, (__v4hi
)__m2
);
647 /// Multiplies each 16-bit signed integer element of the first 64-bit
648 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
649 /// element of the second 64-bit integer vector of [4 x i16] and get four
650 /// 32-bit products. Adds adjacent pairs of products to get two 32-bit sums.
651 /// The lower 32 bits of these two sums are packed into a 64-bit integer
652 /// vector of [2 x i32].
654 /// For example, bits [15:0] of both parameters are multiplied, bits [31:16]
655 /// of both parameters are multiplied, and the sum of both results is written
656 /// to bits [31:0] of the result.
658 /// \headerfile <x86intrin.h>
660 /// This intrinsic corresponds to the <c> PMADDWD </c> instruction.
663 /// A 64-bit integer vector of [4 x i16].
665 /// A 64-bit integer vector of [4 x i16].
666 /// \returns A 64-bit integer vector of [2 x i32] containing the sums of
667 /// products of both parameters.
668 static __inline__ __m64 __DEFAULT_FN_ATTRS
669 _mm_madd_pi16(__m64 __m1
, __m64 __m2
)
671 return (__m64
)__builtin_ia32_pmaddwd((__v4hi
)__m1
, (__v4hi
)__m2
);
674 /// Multiplies each 16-bit signed integer element of the first 64-bit
675 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
676 /// element of the second 64-bit integer vector of [4 x i16]. Packs the upper
677 /// 16 bits of the 32-bit products into a 64-bit integer vector of [4 x i16].
679 /// \headerfile <x86intrin.h>
681 /// This intrinsic corresponds to the <c> PMULHW </c> instruction.
684 /// A 64-bit integer vector of [4 x i16].
686 /// A 64-bit integer vector of [4 x i16].
687 /// \returns A 64-bit integer vector of [4 x i16] containing the upper 16 bits
688 /// of the products of both parameters.
689 static __inline__ __m64 __DEFAULT_FN_ATTRS
690 _mm_mulhi_pi16(__m64 __m1
, __m64 __m2
)
692 return (__m64
)__builtin_ia32_pmulhw((__v4hi
)__m1
, (__v4hi
)__m2
);
695 /// Multiplies each 16-bit signed integer element of the first 64-bit
696 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
697 /// element of the second 64-bit integer vector of [4 x i16]. Packs the lower
698 /// 16 bits of the 32-bit products into a 64-bit integer vector of [4 x i16].
700 /// \headerfile <x86intrin.h>
702 /// This intrinsic corresponds to the <c> PMULLW </c> instruction.
705 /// A 64-bit integer vector of [4 x i16].
707 /// A 64-bit integer vector of [4 x i16].
708 /// \returns A 64-bit integer vector of [4 x i16] containing the lower 16 bits
709 /// of the products of both parameters.
710 static __inline__ __m64 __DEFAULT_FN_ATTRS
711 _mm_mullo_pi16(__m64 __m1
, __m64 __m2
)
713 return (__m64
)__builtin_ia32_pmullw((__v4hi
)__m1
, (__v4hi
)__m2
);
716 /// Left-shifts each 16-bit signed integer element of the first
717 /// parameter, which is a 64-bit integer vector of [4 x i16], by the number
718 /// of bits specified by the second parameter, which is a 64-bit integer. The
719 /// lower 16 bits of the results are packed into a 64-bit integer vector of
722 /// \headerfile <x86intrin.h>
724 /// This intrinsic corresponds to the <c> PSLLW </c> instruction.
727 /// A 64-bit integer vector of [4 x i16].
729 /// A 64-bit integer vector interpreted as a single 64-bit integer.
730 /// \returns A 64-bit integer vector of [4 x i16] containing the left-shifted
731 /// values. If \a __count is greater or equal to 16, the result is set to all
733 static __inline__ __m64 __DEFAULT_FN_ATTRS
734 _mm_sll_pi16(__m64 __m
, __m64 __count
)
736 return (__m64
)__builtin_ia32_psllw((__v4hi
)__m
, __count
);
739 /// Left-shifts each 16-bit signed integer element of a 64-bit integer
740 /// vector of [4 x i16] by the number of bits specified by a 32-bit integer.
741 /// The lower 16 bits of the results are packed into a 64-bit integer vector
744 /// \headerfile <x86intrin.h>
746 /// This intrinsic corresponds to the <c> PSLLW </c> instruction.
749 /// A 64-bit integer vector of [4 x i16].
751 /// A 32-bit integer value.
752 /// \returns A 64-bit integer vector of [4 x i16] containing the left-shifted
753 /// values. If \a __count is greater or equal to 16, the result is set to all
755 static __inline__ __m64 __DEFAULT_FN_ATTRS
756 _mm_slli_pi16(__m64 __m
, int __count
)
758 return (__m64
)__builtin_ia32_psllwi((__v4hi
)__m
, __count
);
761 /// Left-shifts each 32-bit signed integer element of the first
762 /// parameter, which is a 64-bit integer vector of [2 x i32], by the number
763 /// of bits specified by the second parameter, which is a 64-bit integer. The
764 /// lower 32 bits of the results are packed into a 64-bit integer vector of
767 /// \headerfile <x86intrin.h>
769 /// This intrinsic corresponds to the <c> PSLLD </c> instruction.
772 /// A 64-bit integer vector of [2 x i32].
774 /// A 64-bit integer vector interpreted as a single 64-bit integer.
775 /// \returns A 64-bit integer vector of [2 x i32] containing the left-shifted
776 /// values. If \a __count is greater or equal to 32, the result is set to all
778 static __inline__ __m64 __DEFAULT_FN_ATTRS
779 _mm_sll_pi32(__m64 __m
, __m64 __count
)
781 return (__m64
)__builtin_ia32_pslld((__v2si
)__m
, __count
);
784 /// Left-shifts each 32-bit signed integer element of a 64-bit integer
785 /// vector of [2 x i32] by the number of bits specified by a 32-bit integer.
786 /// The lower 32 bits of the results are packed into a 64-bit integer vector
789 /// \headerfile <x86intrin.h>
791 /// This intrinsic corresponds to the <c> PSLLD </c> instruction.
794 /// A 64-bit integer vector of [2 x i32].
796 /// A 32-bit integer value.
797 /// \returns A 64-bit integer vector of [2 x i32] containing the left-shifted
798 /// values. If \a __count is greater or equal to 32, the result is set to all
800 static __inline__ __m64 __DEFAULT_FN_ATTRS
801 _mm_slli_pi32(__m64 __m
, int __count
)
803 return (__m64
)__builtin_ia32_pslldi((__v2si
)__m
, __count
);
806 /// Left-shifts the first 64-bit integer parameter by the number of bits
807 /// specified by the second 64-bit integer parameter. The lower 64 bits of
808 /// result are returned.
810 /// \headerfile <x86intrin.h>
812 /// This intrinsic corresponds to the <c> PSLLQ </c> instruction.
815 /// A 64-bit integer vector interpreted as a single 64-bit integer.
817 /// A 64-bit integer vector interpreted as a single 64-bit integer.
818 /// \returns A 64-bit integer vector containing the left-shifted value. If
819 /// \a __count is greater or equal to 64, the result is set to 0.
820 static __inline__ __m64 __DEFAULT_FN_ATTRS
821 _mm_sll_si64(__m64 __m
, __m64 __count
)
823 return (__m64
)__builtin_ia32_psllq((__v1di
)__m
, __count
);
826 /// Left-shifts the first parameter, which is a 64-bit integer, by the
827 /// number of bits specified by the second parameter, which is a 32-bit
828 /// integer. The lower 64 bits of result are returned.
830 /// \headerfile <x86intrin.h>
832 /// This intrinsic corresponds to the <c> PSLLQ </c> instruction.
835 /// A 64-bit integer vector interpreted as a single 64-bit integer.
837 /// A 32-bit integer value.
838 /// \returns A 64-bit integer vector containing the left-shifted value. If
839 /// \a __count is greater or equal to 64, the result is set to 0.
840 static __inline__ __m64 __DEFAULT_FN_ATTRS
841 _mm_slli_si64(__m64 __m
, int __count
)
843 return (__m64
)__builtin_ia32_psllqi((__v1di
)__m
, __count
);
846 /// Right-shifts each 16-bit integer element of the first parameter,
847 /// which is a 64-bit integer vector of [4 x i16], by the number of bits
848 /// specified by the second parameter, which is a 64-bit integer.
850 /// High-order bits are filled with the sign bit of the initial value of each
851 /// 16-bit element. The 16-bit results are packed into a 64-bit integer
852 /// vector of [4 x i16].
854 /// \headerfile <x86intrin.h>
856 /// This intrinsic corresponds to the <c> PSRAW </c> instruction.
859 /// A 64-bit integer vector of [4 x i16].
861 /// A 64-bit integer vector interpreted as a single 64-bit integer.
862 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
864 static __inline__ __m64 __DEFAULT_FN_ATTRS
865 _mm_sra_pi16(__m64 __m
, __m64 __count
)
867 return (__m64
)__builtin_ia32_psraw((__v4hi
)__m
, __count
);
870 /// Right-shifts each 16-bit integer element of a 64-bit integer vector
871 /// of [4 x i16] by the number of bits specified by a 32-bit integer.
873 /// High-order bits are filled with the sign bit of the initial value of each
874 /// 16-bit element. The 16-bit results are packed into a 64-bit integer
875 /// vector of [4 x i16].
877 /// \headerfile <x86intrin.h>
879 /// This intrinsic corresponds to the <c> PSRAW </c> instruction.
882 /// A 64-bit integer vector of [4 x i16].
884 /// A 32-bit integer value.
885 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
887 static __inline__ __m64 __DEFAULT_FN_ATTRS
888 _mm_srai_pi16(__m64 __m
, int __count
)
890 return (__m64
)__builtin_ia32_psrawi((__v4hi
)__m
, __count
);
893 /// Right-shifts each 32-bit integer element of the first parameter,
894 /// which is a 64-bit integer vector of [2 x i32], by the number of bits
895 /// specified by the second parameter, which is a 64-bit integer.
897 /// High-order bits are filled with the sign bit of the initial value of each
898 /// 32-bit element. The 32-bit results are packed into a 64-bit integer
899 /// vector of [2 x i32].
901 /// \headerfile <x86intrin.h>
903 /// This intrinsic corresponds to the <c> PSRAD </c> instruction.
906 /// A 64-bit integer vector of [2 x i32].
908 /// A 64-bit integer vector interpreted as a single 64-bit integer.
909 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
911 static __inline__ __m64 __DEFAULT_FN_ATTRS
912 _mm_sra_pi32(__m64 __m
, __m64 __count
)
914 return (__m64
)__builtin_ia32_psrad((__v2si
)__m
, __count
);
917 /// Right-shifts each 32-bit integer element of a 64-bit integer vector
918 /// of [2 x i32] by the number of bits specified by a 32-bit integer.
920 /// High-order bits are filled with the sign bit of the initial value of each
921 /// 32-bit element. The 32-bit results are packed into a 64-bit integer
922 /// vector of [2 x i32].
924 /// \headerfile <x86intrin.h>
926 /// This intrinsic corresponds to the <c> PSRAD </c> instruction.
929 /// A 64-bit integer vector of [2 x i32].
931 /// A 32-bit integer value.
932 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
934 static __inline__ __m64 __DEFAULT_FN_ATTRS
935 _mm_srai_pi32(__m64 __m
, int __count
)
937 return (__m64
)__builtin_ia32_psradi((__v2si
)__m
, __count
);
940 /// Right-shifts each 16-bit integer element of the first parameter,
941 /// which is a 64-bit integer vector of [4 x i16], by the number of bits
942 /// specified by the second parameter, which is a 64-bit integer.
944 /// High-order bits are cleared. The 16-bit results are packed into a 64-bit
945 /// integer vector of [4 x i16].
947 /// \headerfile <x86intrin.h>
949 /// This intrinsic corresponds to the <c> PSRLW </c> instruction.
952 /// A 64-bit integer vector of [4 x i16].
954 /// A 64-bit integer vector interpreted as a single 64-bit integer.
955 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
957 static __inline__ __m64 __DEFAULT_FN_ATTRS
958 _mm_srl_pi16(__m64 __m
, __m64 __count
)
960 return (__m64
)__builtin_ia32_psrlw((__v4hi
)__m
, __count
);
963 /// Right-shifts each 16-bit integer element of a 64-bit integer vector
964 /// of [4 x i16] by the number of bits specified by a 32-bit integer.
966 /// High-order bits are cleared. The 16-bit results are packed into a 64-bit
967 /// integer vector of [4 x i16].
969 /// \headerfile <x86intrin.h>
971 /// This intrinsic corresponds to the <c> PSRLW </c> instruction.
974 /// A 64-bit integer vector of [4 x i16].
976 /// A 32-bit integer value.
977 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
979 static __inline__ __m64 __DEFAULT_FN_ATTRS
980 _mm_srli_pi16(__m64 __m
, int __count
)
982 return (__m64
)__builtin_ia32_psrlwi((__v4hi
)__m
, __count
);
985 /// Right-shifts each 32-bit integer element of the first parameter,
986 /// which is a 64-bit integer vector of [2 x i32], by the number of bits
987 /// specified by the second parameter, which is a 64-bit integer.
989 /// High-order bits are cleared. The 32-bit results are packed into a 64-bit
990 /// integer vector of [2 x i32].
992 /// \headerfile <x86intrin.h>
994 /// This intrinsic corresponds to the <c> PSRLD </c> instruction.
997 /// A 64-bit integer vector of [2 x i32].
999 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1000 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
1002 static __inline__ __m64 __DEFAULT_FN_ATTRS
1003 _mm_srl_pi32(__m64 __m
, __m64 __count
)
1005 return (__m64
)__builtin_ia32_psrld((__v2si
)__m
, __count
);
1008 /// Right-shifts each 32-bit integer element of a 64-bit integer vector
1009 /// of [2 x i32] by the number of bits specified by a 32-bit integer.
1011 /// High-order bits are cleared. The 32-bit results are packed into a 64-bit
1012 /// integer vector of [2 x i32].
1014 /// \headerfile <x86intrin.h>
1016 /// This intrinsic corresponds to the <c> PSRLD </c> instruction.
1019 /// A 64-bit integer vector of [2 x i32].
1021 /// A 32-bit integer value.
1022 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
1024 static __inline__ __m64 __DEFAULT_FN_ATTRS
1025 _mm_srli_pi32(__m64 __m
, int __count
)
1027 return (__m64
)__builtin_ia32_psrldi((__v2si
)__m
, __count
);
1030 /// Right-shifts the first 64-bit integer parameter by the number of bits
1031 /// specified by the second 64-bit integer parameter.
1033 /// High-order bits are cleared.
1035 /// \headerfile <x86intrin.h>
1037 /// This intrinsic corresponds to the <c> PSRLQ </c> instruction.
1040 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1042 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1043 /// \returns A 64-bit integer vector containing the right-shifted value.
1044 static __inline__ __m64 __DEFAULT_FN_ATTRS
1045 _mm_srl_si64(__m64 __m
, __m64 __count
)
1047 return (__m64
)__builtin_ia32_psrlq((__v1di
)__m
, __count
);
1050 /// Right-shifts the first parameter, which is a 64-bit integer, by the
1051 /// number of bits specified by the second parameter, which is a 32-bit
1054 /// High-order bits are cleared.
1056 /// \headerfile <x86intrin.h>
1058 /// This intrinsic corresponds to the <c> PSRLQ </c> instruction.
1061 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1063 /// A 32-bit integer value.
1064 /// \returns A 64-bit integer vector containing the right-shifted value.
1065 static __inline__ __m64 __DEFAULT_FN_ATTRS
1066 _mm_srli_si64(__m64 __m
, int __count
)
1068 return (__m64
)__builtin_ia32_psrlqi((__v1di
)__m
, __count
);
1071 /// Performs a bitwise AND of two 64-bit integer vectors.
1073 /// \headerfile <x86intrin.h>
1075 /// This intrinsic corresponds to the <c> PAND </c> instruction.
1078 /// A 64-bit integer vector.
1080 /// A 64-bit integer vector.
1081 /// \returns A 64-bit integer vector containing the bitwise AND of both
1083 static __inline__ __m64 __DEFAULT_FN_ATTRS
1084 _mm_and_si64(__m64 __m1
, __m64 __m2
)
1086 return __builtin_ia32_pand((__v1di
)__m1
, (__v1di
)__m2
);
1089 /// Performs a bitwise NOT of the first 64-bit integer vector, and then
1090 /// performs a bitwise AND of the intermediate result and the second 64-bit
1093 /// \headerfile <x86intrin.h>
1095 /// This intrinsic corresponds to the <c> PANDN </c> instruction.
1098 /// A 64-bit integer vector. The one's complement of this parameter is used
1099 /// in the bitwise AND.
1101 /// A 64-bit integer vector.
1102 /// \returns A 64-bit integer vector containing the bitwise AND of the second
1103 /// parameter and the one's complement of the first parameter.
1104 static __inline__ __m64 __DEFAULT_FN_ATTRS
1105 _mm_andnot_si64(__m64 __m1
, __m64 __m2
)
1107 return __builtin_ia32_pandn((__v1di
)__m1
, (__v1di
)__m2
);
1110 /// Performs a bitwise OR of two 64-bit integer vectors.
1112 /// \headerfile <x86intrin.h>
1114 /// This intrinsic corresponds to the <c> POR </c> instruction.
1117 /// A 64-bit integer vector.
1119 /// A 64-bit integer vector.
1120 /// \returns A 64-bit integer vector containing the bitwise OR of both
1122 static __inline__ __m64 __DEFAULT_FN_ATTRS
1123 _mm_or_si64(__m64 __m1
, __m64 __m2
)
1125 return __builtin_ia32_por((__v1di
)__m1
, (__v1di
)__m2
);
1128 /// Performs a bitwise exclusive OR of two 64-bit integer vectors.
1130 /// \headerfile <x86intrin.h>
1132 /// This intrinsic corresponds to the <c> PXOR </c> instruction.
1135 /// A 64-bit integer vector.
1137 /// A 64-bit integer vector.
1138 /// \returns A 64-bit integer vector containing the bitwise exclusive OR of both
1140 static __inline__ __m64 __DEFAULT_FN_ATTRS
1141 _mm_xor_si64(__m64 __m1
, __m64 __m2
)
1143 return __builtin_ia32_pxor((__v1di
)__m1
, (__v1di
)__m2
);
1146 /// Compares the 8-bit integer elements of two 64-bit integer vectors of
1147 /// [8 x i8] to determine if the element of the first vector is equal to the
1148 /// corresponding element of the second vector.
1150 /// The comparison yields 0 for false, 0xFF for true.
1152 /// \headerfile <x86intrin.h>
1154 /// This intrinsic corresponds to the <c> PCMPEQB </c> instruction.
1157 /// A 64-bit integer vector of [8 x i8].
1159 /// A 64-bit integer vector of [8 x i8].
1160 /// \returns A 64-bit integer vector of [8 x i8] containing the comparison
1162 static __inline__ __m64 __DEFAULT_FN_ATTRS
1163 _mm_cmpeq_pi8(__m64 __m1
, __m64 __m2
)
1165 return (__m64
)__builtin_ia32_pcmpeqb((__v8qi
)__m1
, (__v8qi
)__m2
);
1168 /// Compares the 16-bit integer elements of two 64-bit integer vectors of
1169 /// [4 x i16] to determine if the element of the first vector is equal to the
1170 /// corresponding element of the second vector.
1172 /// The comparison yields 0 for false, 0xFFFF for true.
1174 /// \headerfile <x86intrin.h>
1176 /// This intrinsic corresponds to the <c> PCMPEQW </c> instruction.
1179 /// A 64-bit integer vector of [4 x i16].
1181 /// A 64-bit integer vector of [4 x i16].
1182 /// \returns A 64-bit integer vector of [4 x i16] containing the comparison
1184 static __inline__ __m64 __DEFAULT_FN_ATTRS
1185 _mm_cmpeq_pi16(__m64 __m1
, __m64 __m2
)
1187 return (__m64
)__builtin_ia32_pcmpeqw((__v4hi
)__m1
, (__v4hi
)__m2
);
1190 /// Compares the 32-bit integer elements of two 64-bit integer vectors of
1191 /// [2 x i32] to determine if the element of the first vector is equal to the
1192 /// corresponding element of the second vector.
1194 /// The comparison yields 0 for false, 0xFFFFFFFF for true.
1196 /// \headerfile <x86intrin.h>
1198 /// This intrinsic corresponds to the <c> PCMPEQD </c> instruction.
1201 /// A 64-bit integer vector of [2 x i32].
1203 /// A 64-bit integer vector of [2 x i32].
1204 /// \returns A 64-bit integer vector of [2 x i32] containing the comparison
1206 static __inline__ __m64 __DEFAULT_FN_ATTRS
1207 _mm_cmpeq_pi32(__m64 __m1
, __m64 __m2
)
1209 return (__m64
)__builtin_ia32_pcmpeqd((__v2si
)__m1
, (__v2si
)__m2
);
1212 /// Compares the 8-bit integer elements of two 64-bit integer vectors of
1213 /// [8 x i8] to determine if the element of the first vector is greater than
1214 /// the corresponding element of the second vector.
1216 /// The comparison yields 0 for false, 0xFF for true.
1218 /// \headerfile <x86intrin.h>
1220 /// This intrinsic corresponds to the <c> PCMPGTB </c> instruction.
1223 /// A 64-bit integer vector of [8 x i8].
1225 /// A 64-bit integer vector of [8 x i8].
1226 /// \returns A 64-bit integer vector of [8 x i8] containing the comparison
1228 static __inline__ __m64 __DEFAULT_FN_ATTRS
1229 _mm_cmpgt_pi8(__m64 __m1
, __m64 __m2
)
1231 return (__m64
)__builtin_ia32_pcmpgtb((__v8qi
)__m1
, (__v8qi
)__m2
);
1234 /// Compares the 16-bit integer elements of two 64-bit integer vectors of
1235 /// [4 x i16] to determine if the element of the first vector is greater than
1236 /// the corresponding element of the second vector.
1238 /// The comparison yields 0 for false, 0xFFFF for true.
1240 /// \headerfile <x86intrin.h>
1242 /// This intrinsic corresponds to the <c> PCMPGTW </c> instruction.
1245 /// A 64-bit integer vector of [4 x i16].
1247 /// A 64-bit integer vector of [4 x i16].
1248 /// \returns A 64-bit integer vector of [4 x i16] containing the comparison
1250 static __inline__ __m64 __DEFAULT_FN_ATTRS
1251 _mm_cmpgt_pi16(__m64 __m1
, __m64 __m2
)
1253 return (__m64
)__builtin_ia32_pcmpgtw((__v4hi
)__m1
, (__v4hi
)__m2
);
1256 /// Compares the 32-bit integer elements of two 64-bit integer vectors of
1257 /// [2 x i32] to determine if the element of the first vector is greater than
1258 /// the corresponding element of the second vector.
1260 /// The comparison yields 0 for false, 0xFFFFFFFF for true.
1262 /// \headerfile <x86intrin.h>
1264 /// This intrinsic corresponds to the <c> PCMPGTD </c> instruction.
1267 /// A 64-bit integer vector of [2 x i32].
1269 /// A 64-bit integer vector of [2 x i32].
1270 /// \returns A 64-bit integer vector of [2 x i32] containing the comparison
1272 static __inline__ __m64 __DEFAULT_FN_ATTRS
1273 _mm_cmpgt_pi32(__m64 __m1
, __m64 __m2
)
1275 return (__m64
)__builtin_ia32_pcmpgtd((__v2si
)__m1
, (__v2si
)__m2
);
1278 /// Constructs a 64-bit integer vector initialized to zero.
1280 /// \headerfile <x86intrin.h>
1282 /// This intrinsic corresponds to the <c> PXOR </c> instruction.
1284 /// \returns An initialized 64-bit integer vector with all elements set to zero.
1285 static __inline__ __m64 __DEFAULT_FN_ATTRS
1286 _mm_setzero_si64(void)
1288 return __extension__ (__m64
){ 0LL };
1291 /// Constructs a 64-bit integer vector initialized with the specified
1292 /// 32-bit integer values.
1294 /// \headerfile <x86intrin.h>
1296 /// This intrinsic is a utility function and does not correspond to a specific
1300 /// A 32-bit integer value used to initialize the upper 32 bits of the
1303 /// A 32-bit integer value used to initialize the lower 32 bits of the
1305 /// \returns An initialized 64-bit integer vector.
1306 static __inline__ __m64 __DEFAULT_FN_ATTRS
1307 _mm_set_pi32(int __i1
, int __i0
)
1309 return (__m64
)__builtin_ia32_vec_init_v2si(__i0
, __i1
);
1312 /// Constructs a 64-bit integer vector initialized with the specified
1313 /// 16-bit integer values.
1315 /// \headerfile <x86intrin.h>
1317 /// This intrinsic is a utility function and does not correspond to a specific
1321 /// A 16-bit integer value used to initialize bits [63:48] of the result.
1323 /// A 16-bit integer value used to initialize bits [47:32] of the result.
1325 /// A 16-bit integer value used to initialize bits [31:16] of the result.
1327 /// A 16-bit integer value used to initialize bits [15:0] of the result.
1328 /// \returns An initialized 64-bit integer vector.
1329 static __inline__ __m64 __DEFAULT_FN_ATTRS
1330 _mm_set_pi16(short __s3
, short __s2
, short __s1
, short __s0
)
1332 return (__m64
)__builtin_ia32_vec_init_v4hi(__s0
, __s1
, __s2
, __s3
);
1335 /// Constructs a 64-bit integer vector initialized with the specified
1336 /// 8-bit integer values.
1338 /// \headerfile <x86intrin.h>
1340 /// This intrinsic is a utility function and does not correspond to a specific
1344 /// An 8-bit integer value used to initialize bits [63:56] of the result.
1346 /// An 8-bit integer value used to initialize bits [55:48] of the result.
1348 /// An 8-bit integer value used to initialize bits [47:40] of the result.
1350 /// An 8-bit integer value used to initialize bits [39:32] of the result.
1352 /// An 8-bit integer value used to initialize bits [31:24] of the result.
1354 /// An 8-bit integer value used to initialize bits [23:16] of the result.
1356 /// An 8-bit integer value used to initialize bits [15:8] of the result.
1358 /// An 8-bit integer value used to initialize bits [7:0] of the result.
1359 /// \returns An initialized 64-bit integer vector.
1360 static __inline__ __m64 __DEFAULT_FN_ATTRS
1361 _mm_set_pi8(char __b7
, char __b6
, char __b5
, char __b4
, char __b3
, char __b2
,
1362 char __b1
, char __b0
)
1364 return (__m64
)__builtin_ia32_vec_init_v8qi(__b0
, __b1
, __b2
, __b3
,
1365 __b4
, __b5
, __b6
, __b7
);
1368 /// Constructs a 64-bit integer vector of [2 x i32], with each of the
1369 /// 32-bit integer vector elements set to the specified 32-bit integer
1372 /// \headerfile <x86intrin.h>
1374 /// This intrinsic is a utility function and does not correspond to a specific
1378 /// A 32-bit integer value used to initialize each vector element of the
1380 /// \returns An initialized 64-bit integer vector of [2 x i32].
1381 static __inline__ __m64 __DEFAULT_FN_ATTRS
1382 _mm_set1_pi32(int __i
)
1384 return _mm_set_pi32(__i
, __i
);
1387 /// Constructs a 64-bit integer vector of [4 x i16], with each of the
1388 /// 16-bit integer vector elements set to the specified 16-bit integer
1391 /// \headerfile <x86intrin.h>
1393 /// This intrinsic is a utility function and does not correspond to a specific
1397 /// A 16-bit integer value used to initialize each vector element of the
1399 /// \returns An initialized 64-bit integer vector of [4 x i16].
1400 static __inline__ __m64 __DEFAULT_FN_ATTRS
1401 _mm_set1_pi16(short __w
)
1403 return _mm_set_pi16(__w
, __w
, __w
, __w
);
1406 /// Constructs a 64-bit integer vector of [8 x i8], with each of the
1407 /// 8-bit integer vector elements set to the specified 8-bit integer value.
1409 /// \headerfile <x86intrin.h>
1411 /// This intrinsic is a utility function and does not correspond to a specific
1415 /// An 8-bit integer value used to initialize each vector element of the
1417 /// \returns An initialized 64-bit integer vector of [8 x i8].
1418 static __inline__ __m64 __DEFAULT_FN_ATTRS
1419 _mm_set1_pi8(char __b
)
1421 return _mm_set_pi8(__b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
);
1424 /// Constructs a 64-bit integer vector, initialized in reverse order with
1425 /// the specified 32-bit integer values.
1427 /// \headerfile <x86intrin.h>
1429 /// This intrinsic is a utility function and does not correspond to a specific
1433 /// A 32-bit integer value used to initialize the lower 32 bits of the
1436 /// A 32-bit integer value used to initialize the upper 32 bits of the
1438 /// \returns An initialized 64-bit integer vector.
1439 static __inline__ __m64 __DEFAULT_FN_ATTRS
1440 _mm_setr_pi32(int __i0
, int __i1
)
1442 return _mm_set_pi32(__i1
, __i0
);
1445 /// Constructs a 64-bit integer vector, initialized in reverse order with
1446 /// the specified 16-bit integer values.
1448 /// \headerfile <x86intrin.h>
1450 /// This intrinsic is a utility function and does not correspond to a specific
1454 /// A 16-bit integer value used to initialize bits [15:0] of the result.
1456 /// A 16-bit integer value used to initialize bits [31:16] of the result.
1458 /// A 16-bit integer value used to initialize bits [47:32] of the result.
1460 /// A 16-bit integer value used to initialize bits [63:48] of the result.
1461 /// \returns An initialized 64-bit integer vector.
1462 static __inline__ __m64 __DEFAULT_FN_ATTRS
1463 _mm_setr_pi16(short __w0
, short __w1
, short __w2
, short __w3
)
1465 return _mm_set_pi16(__w3
, __w2
, __w1
, __w0
);
1468 /// Constructs a 64-bit integer vector, initialized in reverse order with
1469 /// the specified 8-bit integer values.
1471 /// \headerfile <x86intrin.h>
1473 /// This intrinsic is a utility function and does not correspond to a specific
1477 /// An 8-bit integer value used to initialize bits [7:0] of the result.
1479 /// An 8-bit integer value used to initialize bits [15:8] of the result.
1481 /// An 8-bit integer value used to initialize bits [23:16] of the result.
1483 /// An 8-bit integer value used to initialize bits [31:24] of the result.
1485 /// An 8-bit integer value used to initialize bits [39:32] of the result.
1487 /// An 8-bit integer value used to initialize bits [47:40] of the result.
1489 /// An 8-bit integer value used to initialize bits [55:48] of the result.
1491 /// An 8-bit integer value used to initialize bits [63:56] of the result.
1492 /// \returns An initialized 64-bit integer vector.
1493 static __inline__ __m64 __DEFAULT_FN_ATTRS
1494 _mm_setr_pi8(char __b0
, char __b1
, char __b2
, char __b3
, char __b4
, char __b5
,
1495 char __b6
, char __b7
)
1497 return _mm_set_pi8(__b7
, __b6
, __b5
, __b4
, __b3
, __b2
, __b1
, __b0
);
1500 #undef __DEFAULT_FN_ATTRS
1502 /* Aliases for compatibility. */
1503 #define _m_empty _mm_empty
1504 #define _m_from_int _mm_cvtsi32_si64
1505 #define _m_from_int64 _mm_cvtsi64_m64
1506 #define _m_to_int _mm_cvtsi64_si32
1507 #define _m_to_int64 _mm_cvtm64_si64
1508 #define _m_packsswb _mm_packs_pi16
1509 #define _m_packssdw _mm_packs_pi32
1510 #define _m_packuswb _mm_packs_pu16
1511 #define _m_punpckhbw _mm_unpackhi_pi8
1512 #define _m_punpckhwd _mm_unpackhi_pi16
1513 #define _m_punpckhdq _mm_unpackhi_pi32
1514 #define _m_punpcklbw _mm_unpacklo_pi8
1515 #define _m_punpcklwd _mm_unpacklo_pi16
1516 #define _m_punpckldq _mm_unpacklo_pi32
1517 #define _m_paddb _mm_add_pi8
1518 #define _m_paddw _mm_add_pi16
1519 #define _m_paddd _mm_add_pi32
1520 #define _m_paddsb _mm_adds_pi8
1521 #define _m_paddsw _mm_adds_pi16
1522 #define _m_paddusb _mm_adds_pu8
1523 #define _m_paddusw _mm_adds_pu16
1524 #define _m_psubb _mm_sub_pi8
1525 #define _m_psubw _mm_sub_pi16
1526 #define _m_psubd _mm_sub_pi32
1527 #define _m_psubsb _mm_subs_pi8
1528 #define _m_psubsw _mm_subs_pi16
1529 #define _m_psubusb _mm_subs_pu8
1530 #define _m_psubusw _mm_subs_pu16
1531 #define _m_pmaddwd _mm_madd_pi16
1532 #define _m_pmulhw _mm_mulhi_pi16
1533 #define _m_pmullw _mm_mullo_pi16
1534 #define _m_psllw _mm_sll_pi16
1535 #define _m_psllwi _mm_slli_pi16
1536 #define _m_pslld _mm_sll_pi32
1537 #define _m_pslldi _mm_slli_pi32
1538 #define _m_psllq _mm_sll_si64
1539 #define _m_psllqi _mm_slli_si64
1540 #define _m_psraw _mm_sra_pi16
1541 #define _m_psrawi _mm_srai_pi16
1542 #define _m_psrad _mm_sra_pi32
1543 #define _m_psradi _mm_srai_pi32
1544 #define _m_psrlw _mm_srl_pi16
1545 #define _m_psrlwi _mm_srli_pi16
1546 #define _m_psrld _mm_srl_pi32
1547 #define _m_psrldi _mm_srli_pi32
1548 #define _m_psrlq _mm_srl_si64
1549 #define _m_psrlqi _mm_srli_si64
1550 #define _m_pand _mm_and_si64
1551 #define _m_pandn _mm_andnot_si64
1552 #define _m_por _mm_or_si64
1553 #define _m_pxor _mm_xor_si64
1554 #define _m_pcmpeqb _mm_cmpeq_pi8
1555 #define _m_pcmpeqw _mm_cmpeq_pi16
1556 #define _m_pcmpeqd _mm_cmpeq_pi32
1557 #define _m_pcmpgtb _mm_cmpgt_pi8
1558 #define _m_pcmpgtw _mm_cmpgt_pi16
1559 #define _m_pcmpgtd _mm_cmpgt_pi32
1561 #endif /* __MMINTRIN_H */