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 \
26 __attribute__((__always_inline__, __nodebug__, __target__("mmx,no-evex512"), \
27 __min_vector_width__(64)))
29 /// Clears the MMX state by setting the state of the x87 stack registers
32 /// \headerfile <x86intrin.h>
34 /// This intrinsic corresponds to the <c> EMMS </c> instruction.
36 static __inline__
void __attribute__((__always_inline__
, __nodebug__
,
37 __target__("mmx,no-evex512")))
39 __builtin_ia32_emms();
42 /// Constructs a 64-bit integer vector, setting the lower 32 bits to the
43 /// value of the 32-bit integer parameter and setting the upper 32 bits to 0.
45 /// \headerfile <x86intrin.h>
47 /// This intrinsic corresponds to the <c> MOVD </c> instruction.
50 /// A 32-bit integer value.
51 /// \returns A 64-bit integer vector. The lower 32 bits contain the value of the
52 /// parameter. The upper 32 bits are set to 0.
53 static __inline__ __m64 __DEFAULT_FN_ATTRS
54 _mm_cvtsi32_si64(int __i
)
56 return (__m64
)__builtin_ia32_vec_init_v2si(__i
, 0);
59 /// Returns the lower 32 bits of a 64-bit integer vector as a 32-bit
62 /// \headerfile <x86intrin.h>
64 /// This intrinsic corresponds to the <c> MOVD </c> instruction.
67 /// A 64-bit integer vector.
68 /// \returns A 32-bit signed integer value containing the lower 32 bits of the
70 static __inline__
int __DEFAULT_FN_ATTRS
71 _mm_cvtsi64_si32(__m64 __m
)
73 return __builtin_ia32_vec_ext_v2si((__v2si
)__m
, 0);
76 /// Casts a 64-bit signed integer value into a 64-bit integer vector.
78 /// \headerfile <x86intrin.h>
80 /// This intrinsic corresponds to the <c> MOVQ </c> instruction.
83 /// A 64-bit signed integer.
84 /// \returns A 64-bit integer vector containing the same bitwise pattern as the
86 static __inline__ __m64 __DEFAULT_FN_ATTRS
87 _mm_cvtsi64_m64(long long __i
)
92 /// Casts a 64-bit integer vector into a 64-bit signed integer value.
94 /// \headerfile <x86intrin.h>
96 /// This intrinsic corresponds to the <c> MOVQ </c> instruction.
99 /// A 64-bit integer vector.
100 /// \returns A 64-bit signed integer containing the same bitwise pattern as the
102 static __inline__
long long __DEFAULT_FN_ATTRS
103 _mm_cvtm64_si64(__m64 __m
)
105 return (long long)__m
;
108 /// Converts 16-bit signed integers from both 64-bit integer vector
109 /// parameters of [4 x i16] into 8-bit signed integer values, and constructs
110 /// a 64-bit integer vector of [8 x i8] as the result. Positive values
111 /// greater than 0x7F are saturated to 0x7F. Negative values less than 0x80
112 /// are saturated to 0x80.
114 /// \headerfile <x86intrin.h>
116 /// This intrinsic corresponds to the <c> PACKSSWB </c> instruction.
119 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
120 /// 16-bit signed integer and is converted to an 8-bit signed integer with
121 /// saturation. Positive values greater than 0x7F are saturated to 0x7F.
122 /// Negative values less than 0x80 are saturated to 0x80. The converted
123 /// [4 x i8] values are written to the lower 32 bits of the result.
125 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
126 /// 16-bit signed integer and is converted to an 8-bit signed integer with
127 /// saturation. Positive values greater than 0x7F are saturated to 0x7F.
128 /// Negative values less than 0x80 are saturated to 0x80. The converted
129 /// [4 x i8] values are written to the upper 32 bits of the result.
130 /// \returns A 64-bit integer vector of [8 x i8] containing the converted
132 static __inline__ __m64 __DEFAULT_FN_ATTRS
133 _mm_packs_pi16(__m64 __m1
, __m64 __m2
)
135 return (__m64
)__builtin_ia32_packsswb((__v4hi
)__m1
, (__v4hi
)__m2
);
138 /// Converts 32-bit signed integers from both 64-bit integer vector
139 /// parameters of [2 x i32] into 16-bit signed integer values, and constructs
140 /// a 64-bit integer vector of [4 x i16] as the result. Positive values
141 /// greater than 0x7FFF are saturated to 0x7FFF. Negative values less than
142 /// 0x8000 are saturated to 0x8000.
144 /// \headerfile <x86intrin.h>
146 /// This intrinsic corresponds to the <c> PACKSSDW </c> instruction.
149 /// A 64-bit integer vector of [2 x i32]. Each 32-bit element is treated as a
150 /// 32-bit signed integer and is converted to a 16-bit signed integer with
151 /// saturation. Positive values greater than 0x7FFF are saturated to 0x7FFF.
152 /// Negative values less than 0x8000 are saturated to 0x8000. The converted
153 /// [2 x i16] values are written to the lower 32 bits of the result.
155 /// A 64-bit integer vector of [2 x i32]. Each 32-bit element is treated as a
156 /// 32-bit signed integer and is converted to a 16-bit signed integer with
157 /// saturation. Positive values greater than 0x7FFF are saturated to 0x7FFF.
158 /// Negative values less than 0x8000 are saturated to 0x8000. The converted
159 /// [2 x i16] values are written to the upper 32 bits of the result.
160 /// \returns A 64-bit integer vector of [4 x i16] containing the converted
162 static __inline__ __m64 __DEFAULT_FN_ATTRS
163 _mm_packs_pi32(__m64 __m1
, __m64 __m2
)
165 return (__m64
)__builtin_ia32_packssdw((__v2si
)__m1
, (__v2si
)__m2
);
168 /// Converts 16-bit signed integers from both 64-bit integer vector
169 /// parameters of [4 x i16] into 8-bit unsigned integer values, and
170 /// constructs a 64-bit integer vector of [8 x i8] as the result. Values
171 /// greater than 0xFF are saturated to 0xFF. Values less than 0 are saturated
174 /// \headerfile <x86intrin.h>
176 /// This intrinsic corresponds to the <c> PACKUSWB </c> instruction.
179 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
180 /// 16-bit signed integer and is converted to an 8-bit unsigned integer with
181 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
182 /// than 0 are saturated to 0. The converted [4 x i8] values are written to
183 /// the lower 32 bits of the result.
185 /// A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as a
186 /// 16-bit signed integer and is converted to an 8-bit unsigned integer with
187 /// saturation. Values greater than 0xFF are saturated to 0xFF. Values less
188 /// than 0 are saturated to 0. The converted [4 x i8] values are written to
189 /// the upper 32 bits of the result.
190 /// \returns A 64-bit integer vector of [8 x i8] containing the converted
192 static __inline__ __m64 __DEFAULT_FN_ATTRS
193 _mm_packs_pu16(__m64 __m1
, __m64 __m2
)
195 return (__m64
)__builtin_ia32_packuswb((__v4hi
)__m1
, (__v4hi
)__m2
);
198 /// Unpacks the upper 32 bits from two 64-bit integer vectors of [8 x i8]
199 /// and interleaves them into a 64-bit integer vector of [8 x i8].
201 /// \headerfile <x86intrin.h>
203 /// This intrinsic corresponds to the <c> PUNPCKHBW </c> instruction.
206 /// A 64-bit integer vector of [8 x i8]. \n
207 /// Bits [39:32] are written to bits [7:0] of the result. \n
208 /// Bits [47:40] are written to bits [23:16] of the result. \n
209 /// Bits [55:48] are written to bits [39:32] of the result. \n
210 /// Bits [63:56] are written to bits [55:48] of the result.
212 /// A 64-bit integer vector of [8 x i8].
213 /// Bits [39:32] are written to bits [15:8] of the result. \n
214 /// Bits [47:40] are written to bits [31:24] of the result. \n
215 /// Bits [55:48] are written to bits [47:40] of the result. \n
216 /// Bits [63:56] are written to bits [63:56] of the result.
217 /// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
219 static __inline__ __m64 __DEFAULT_FN_ATTRS
220 _mm_unpackhi_pi8(__m64 __m1
, __m64 __m2
)
222 return (__m64
)__builtin_ia32_punpckhbw((__v8qi
)__m1
, (__v8qi
)__m2
);
225 /// Unpacks the upper 32 bits from two 64-bit integer vectors of
226 /// [4 x i16] and interleaves them into a 64-bit integer vector of [4 x i16].
228 /// \headerfile <x86intrin.h>
230 /// This intrinsic corresponds to the <c> PUNPCKHWD </c> instruction.
233 /// A 64-bit integer vector of [4 x i16].
234 /// Bits [47:32] are written to bits [15:0] of the result. \n
235 /// Bits [63:48] are written to bits [47:32] of the result.
237 /// A 64-bit integer vector of [4 x i16].
238 /// Bits [47:32] are written to bits [31:16] of the result. \n
239 /// Bits [63:48] are written to bits [63:48] of the result.
240 /// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
242 static __inline__ __m64 __DEFAULT_FN_ATTRS
243 _mm_unpackhi_pi16(__m64 __m1
, __m64 __m2
)
245 return (__m64
)__builtin_ia32_punpckhwd((__v4hi
)__m1
, (__v4hi
)__m2
);
248 /// Unpacks the upper 32 bits from two 64-bit integer vectors of
249 /// [2 x i32] and interleaves them into a 64-bit integer vector of [2 x i32].
251 /// \headerfile <x86intrin.h>
253 /// This intrinsic corresponds to the <c> PUNPCKHDQ </c> instruction.
256 /// A 64-bit integer vector of [2 x i32]. The upper 32 bits are written to
257 /// the lower 32 bits of the result.
259 /// A 64-bit integer vector of [2 x i32]. The upper 32 bits are written to
260 /// the upper 32 bits of the result.
261 /// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
263 static __inline__ __m64 __DEFAULT_FN_ATTRS
264 _mm_unpackhi_pi32(__m64 __m1
, __m64 __m2
)
266 return (__m64
)__builtin_ia32_punpckhdq((__v2si
)__m1
, (__v2si
)__m2
);
269 /// Unpacks the lower 32 bits from two 64-bit integer vectors of [8 x i8]
270 /// and interleaves them into a 64-bit integer vector of [8 x i8].
272 /// \headerfile <x86intrin.h>
274 /// This intrinsic corresponds to the <c> PUNPCKLBW </c> instruction.
277 /// A 64-bit integer vector of [8 x i8].
278 /// Bits [7:0] are written to bits [7:0] of the result. \n
279 /// Bits [15:8] are written to bits [23:16] of the result. \n
280 /// Bits [23:16] are written to bits [39:32] of the result. \n
281 /// Bits [31:24] are written to bits [55:48] of the result.
283 /// A 64-bit integer vector of [8 x i8].
284 /// Bits [7:0] are written to bits [15:8] of the result. \n
285 /// Bits [15:8] are written to bits [31:24] of the result. \n
286 /// Bits [23:16] are written to bits [47:40] of the result. \n
287 /// Bits [31:24] are written to bits [63:56] of the result.
288 /// \returns A 64-bit integer vector of [8 x i8] containing the interleaved
290 static __inline__ __m64 __DEFAULT_FN_ATTRS
291 _mm_unpacklo_pi8(__m64 __m1
, __m64 __m2
)
293 return (__m64
)__builtin_ia32_punpcklbw((__v8qi
)__m1
, (__v8qi
)__m2
);
296 /// Unpacks the lower 32 bits from two 64-bit integer vectors of
297 /// [4 x i16] and interleaves them into a 64-bit integer vector of [4 x i16].
299 /// \headerfile <x86intrin.h>
301 /// This intrinsic corresponds to the <c> PUNPCKLWD </c> instruction.
304 /// A 64-bit integer vector of [4 x i16].
305 /// Bits [15:0] are written to bits [15:0] of the result. \n
306 /// Bits [31:16] are written to bits [47:32] of the result.
308 /// A 64-bit integer vector of [4 x i16].
309 /// Bits [15:0] are written to bits [31:16] of the result. \n
310 /// Bits [31:16] are written to bits [63:48] of the result.
311 /// \returns A 64-bit integer vector of [4 x i16] containing the interleaved
313 static __inline__ __m64 __DEFAULT_FN_ATTRS
314 _mm_unpacklo_pi16(__m64 __m1
, __m64 __m2
)
316 return (__m64
)__builtin_ia32_punpcklwd((__v4hi
)__m1
, (__v4hi
)__m2
);
319 /// Unpacks the lower 32 bits from two 64-bit integer vectors of
320 /// [2 x i32] and interleaves them into a 64-bit integer vector of [2 x i32].
322 /// \headerfile <x86intrin.h>
324 /// This intrinsic corresponds to the <c> PUNPCKLDQ </c> instruction.
327 /// A 64-bit integer vector of [2 x i32]. The lower 32 bits are written to
328 /// the lower 32 bits of the result.
330 /// A 64-bit integer vector of [2 x i32]. The lower 32 bits are written to
331 /// the upper 32 bits of the result.
332 /// \returns A 64-bit integer vector of [2 x i32] containing the interleaved
334 static __inline__ __m64 __DEFAULT_FN_ATTRS
335 _mm_unpacklo_pi32(__m64 __m1
, __m64 __m2
)
337 return (__m64
)__builtin_ia32_punpckldq((__v2si
)__m1
, (__v2si
)__m2
);
340 /// Adds each 8-bit integer element of the first 64-bit integer vector
341 /// of [8 x i8] to the corresponding 8-bit integer element of the second
342 /// 64-bit integer vector of [8 x i8]. The lower 8 bits of the results are
343 /// packed into a 64-bit integer vector of [8 x i8].
345 /// \headerfile <x86intrin.h>
347 /// This intrinsic corresponds to the <c> PADDB </c> instruction.
350 /// A 64-bit integer vector of [8 x i8].
352 /// A 64-bit integer vector of [8 x i8].
353 /// \returns A 64-bit integer vector of [8 x i8] containing the sums of both
355 static __inline__ __m64 __DEFAULT_FN_ATTRS
356 _mm_add_pi8(__m64 __m1
, __m64 __m2
)
358 return (__m64
)__builtin_ia32_paddb((__v8qi
)__m1
, (__v8qi
)__m2
);
361 /// Adds each 16-bit integer element of the first 64-bit integer vector
362 /// of [4 x i16] to the corresponding 16-bit integer element of the second
363 /// 64-bit integer vector of [4 x i16]. The lower 16 bits of the results are
364 /// packed into a 64-bit integer vector of [4 x i16].
366 /// \headerfile <x86intrin.h>
368 /// This intrinsic corresponds to the <c> PADDW </c> instruction.
371 /// A 64-bit integer vector of [4 x i16].
373 /// A 64-bit integer vector of [4 x i16].
374 /// \returns A 64-bit integer vector of [4 x i16] containing the sums of both
376 static __inline__ __m64 __DEFAULT_FN_ATTRS
377 _mm_add_pi16(__m64 __m1
, __m64 __m2
)
379 return (__m64
)__builtin_ia32_paddw((__v4hi
)__m1
, (__v4hi
)__m2
);
382 /// Adds each 32-bit integer element of the first 64-bit integer vector
383 /// of [2 x i32] to the corresponding 32-bit integer element of the second
384 /// 64-bit integer vector of [2 x i32]. The lower 32 bits of the results are
385 /// packed into a 64-bit integer vector of [2 x i32].
387 /// \headerfile <x86intrin.h>
389 /// This intrinsic corresponds to the <c> PADDD </c> instruction.
392 /// A 64-bit integer vector of [2 x i32].
394 /// A 64-bit integer vector of [2 x i32].
395 /// \returns A 64-bit integer vector of [2 x i32] containing the sums of both
397 static __inline__ __m64 __DEFAULT_FN_ATTRS
398 _mm_add_pi32(__m64 __m1
, __m64 __m2
)
400 return (__m64
)__builtin_ia32_paddd((__v2si
)__m1
, (__v2si
)__m2
);
403 /// Adds each 8-bit signed integer element of the first 64-bit integer
404 /// vector of [8 x i8] to the corresponding 8-bit signed integer element of
405 /// the second 64-bit integer vector of [8 x i8]. Positive sums greater than
406 /// 0x7F are saturated to 0x7F. Negative sums less than 0x80 are saturated to
407 /// 0x80. The results are packed into a 64-bit integer vector of [8 x i8].
409 /// \headerfile <x86intrin.h>
411 /// This intrinsic corresponds to the <c> PADDSB </c> instruction.
414 /// A 64-bit integer vector of [8 x i8].
416 /// A 64-bit integer vector of [8 x i8].
417 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated sums
418 /// of both parameters.
419 static __inline__ __m64 __DEFAULT_FN_ATTRS
420 _mm_adds_pi8(__m64 __m1
, __m64 __m2
)
422 return (__m64
)__builtin_ia32_paddsb((__v8qi
)__m1
, (__v8qi
)__m2
);
425 /// Adds each 16-bit signed integer element of the first 64-bit integer
426 /// vector of [4 x i16] to the corresponding 16-bit signed integer element of
427 /// the second 64-bit integer vector of [4 x i16]. Positive sums greater than
428 /// 0x7FFF are saturated to 0x7FFF. Negative sums less than 0x8000 are
429 /// saturated to 0x8000. The results are packed into a 64-bit integer vector
432 /// \headerfile <x86intrin.h>
434 /// This intrinsic corresponds to the <c> PADDSW </c> instruction.
437 /// A 64-bit integer vector of [4 x i16].
439 /// A 64-bit integer vector of [4 x i16].
440 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated sums
441 /// of both parameters.
442 static __inline__ __m64 __DEFAULT_FN_ATTRS
443 _mm_adds_pi16(__m64 __m1
, __m64 __m2
)
445 return (__m64
)__builtin_ia32_paddsw((__v4hi
)__m1
, (__v4hi
)__m2
);
448 /// Adds each 8-bit unsigned integer element of the first 64-bit integer
449 /// vector of [8 x i8] to the corresponding 8-bit unsigned integer element of
450 /// the second 64-bit integer vector of [8 x i8]. Sums greater than 0xFF are
451 /// saturated to 0xFF. The results are packed into a 64-bit integer vector of
454 /// \headerfile <x86intrin.h>
456 /// This intrinsic corresponds to the <c> PADDUSB </c> instruction.
459 /// A 64-bit integer vector of [8 x i8].
461 /// A 64-bit integer vector of [8 x i8].
462 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
463 /// unsigned sums of both parameters.
464 static __inline__ __m64 __DEFAULT_FN_ATTRS
465 _mm_adds_pu8(__m64 __m1
, __m64 __m2
)
467 return (__m64
)__builtin_ia32_paddusb((__v8qi
)__m1
, (__v8qi
)__m2
);
470 /// Adds each 16-bit unsigned integer element of the first 64-bit integer
471 /// vector of [4 x i16] to the corresponding 16-bit unsigned integer element
472 /// of the second 64-bit integer vector of [4 x i16]. Sums greater than
473 /// 0xFFFF are saturated to 0xFFFF. The results are packed into a 64-bit
474 /// integer vector of [4 x i16].
476 /// \headerfile <x86intrin.h>
478 /// This intrinsic corresponds to the <c> PADDUSW </c> instruction.
481 /// A 64-bit integer vector of [4 x i16].
483 /// A 64-bit integer vector of [4 x i16].
484 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
485 /// unsigned sums of both parameters.
486 static __inline__ __m64 __DEFAULT_FN_ATTRS
487 _mm_adds_pu16(__m64 __m1
, __m64 __m2
)
489 return (__m64
)__builtin_ia32_paddusw((__v4hi
)__m1
, (__v4hi
)__m2
);
492 /// Subtracts each 8-bit integer element of the second 64-bit integer
493 /// vector of [8 x i8] from the corresponding 8-bit integer element of the
494 /// first 64-bit integer vector of [8 x i8]. The lower 8 bits of the results
495 /// are packed into a 64-bit integer vector of [8 x i8].
497 /// \headerfile <x86intrin.h>
499 /// This intrinsic corresponds to the <c> PSUBB </c> instruction.
502 /// A 64-bit integer vector of [8 x i8] containing the minuends.
504 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
505 /// \returns A 64-bit integer vector of [8 x i8] containing the differences of
507 static __inline__ __m64 __DEFAULT_FN_ATTRS
508 _mm_sub_pi8(__m64 __m1
, __m64 __m2
)
510 return (__m64
)__builtin_ia32_psubb((__v8qi
)__m1
, (__v8qi
)__m2
);
513 /// Subtracts each 16-bit integer element of the second 64-bit integer
514 /// vector of [4 x i16] from the corresponding 16-bit integer element of the
515 /// first 64-bit integer vector of [4 x i16]. The lower 16 bits of the
516 /// results are packed into a 64-bit integer vector of [4 x i16].
518 /// \headerfile <x86intrin.h>
520 /// This intrinsic corresponds to the <c> PSUBW </c> instruction.
523 /// A 64-bit integer vector of [4 x i16] containing the minuends.
525 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
526 /// \returns A 64-bit integer vector of [4 x i16] containing the differences of
528 static __inline__ __m64 __DEFAULT_FN_ATTRS
529 _mm_sub_pi16(__m64 __m1
, __m64 __m2
)
531 return (__m64
)__builtin_ia32_psubw((__v4hi
)__m1
, (__v4hi
)__m2
);
534 /// Subtracts each 32-bit integer element of the second 64-bit integer
535 /// vector of [2 x i32] from the corresponding 32-bit integer element of the
536 /// first 64-bit integer vector of [2 x i32]. The lower 32 bits of the
537 /// results are packed into a 64-bit integer vector of [2 x i32].
539 /// \headerfile <x86intrin.h>
541 /// This intrinsic corresponds to the <c> PSUBD </c> instruction.
544 /// A 64-bit integer vector of [2 x i32] containing the minuends.
546 /// A 64-bit integer vector of [2 x i32] containing the subtrahends.
547 /// \returns A 64-bit integer vector of [2 x i32] containing the differences of
549 static __inline__ __m64 __DEFAULT_FN_ATTRS
550 _mm_sub_pi32(__m64 __m1
, __m64 __m2
)
552 return (__m64
)__builtin_ia32_psubd((__v2si
)__m1
, (__v2si
)__m2
);
555 /// Subtracts each 8-bit signed integer element of the second 64-bit
556 /// integer vector of [8 x i8] from the corresponding 8-bit signed integer
557 /// element of the first 64-bit integer vector of [8 x i8]. Positive results
558 /// greater than 0x7F are saturated to 0x7F. Negative results less than 0x80
559 /// are saturated to 0x80. The results are packed into a 64-bit integer
560 /// vector of [8 x i8].
562 /// \headerfile <x86intrin.h>
564 /// This intrinsic corresponds to the <c> PSUBSB </c> instruction.
567 /// A 64-bit integer vector of [8 x i8] containing the minuends.
569 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
570 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
571 /// differences of both parameters.
572 static __inline__ __m64 __DEFAULT_FN_ATTRS
573 _mm_subs_pi8(__m64 __m1
, __m64 __m2
)
575 return (__m64
)__builtin_ia32_psubsb((__v8qi
)__m1
, (__v8qi
)__m2
);
578 /// Subtracts each 16-bit signed integer element of the second 64-bit
579 /// integer vector of [4 x i16] from the corresponding 16-bit signed integer
580 /// element of the first 64-bit integer vector of [4 x i16]. Positive results
581 /// greater than 0x7FFF are saturated to 0x7FFF. Negative results less than
582 /// 0x8000 are saturated to 0x8000. The results are packed into a 64-bit
583 /// integer vector of [4 x i16].
585 /// \headerfile <x86intrin.h>
587 /// This intrinsic corresponds to the <c> PSUBSW </c> instruction.
590 /// A 64-bit integer vector of [4 x i16] containing the minuends.
592 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
593 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
594 /// differences of both parameters.
595 static __inline__ __m64 __DEFAULT_FN_ATTRS
596 _mm_subs_pi16(__m64 __m1
, __m64 __m2
)
598 return (__m64
)__builtin_ia32_psubsw((__v4hi
)__m1
, (__v4hi
)__m2
);
601 /// Subtracts each 8-bit unsigned integer element of the second 64-bit
602 /// integer vector of [8 x i8] from the corresponding 8-bit unsigned integer
603 /// element of the first 64-bit integer vector of [8 x i8].
605 /// If an element of the first vector is less than the corresponding element
606 /// of the second vector, the result is saturated to 0. The results are
607 /// packed into a 64-bit integer vector of [8 x i8].
609 /// \headerfile <x86intrin.h>
611 /// This intrinsic corresponds to the <c> PSUBUSB </c> instruction.
614 /// A 64-bit integer vector of [8 x i8] containing the minuends.
616 /// A 64-bit integer vector of [8 x i8] containing the subtrahends.
617 /// \returns A 64-bit integer vector of [8 x i8] containing the saturated
618 /// differences of both parameters.
619 static __inline__ __m64 __DEFAULT_FN_ATTRS
620 _mm_subs_pu8(__m64 __m1
, __m64 __m2
)
622 return (__m64
)__builtin_ia32_psubusb((__v8qi
)__m1
, (__v8qi
)__m2
);
625 /// Subtracts each 16-bit unsigned integer element of the second 64-bit
626 /// integer vector of [4 x i16] from the corresponding 16-bit unsigned
627 /// integer element of the first 64-bit integer vector of [4 x i16].
629 /// If an element of the first vector is less than the corresponding element
630 /// of the second vector, the result is saturated to 0. The results are
631 /// packed into a 64-bit integer vector of [4 x i16].
633 /// \headerfile <x86intrin.h>
635 /// This intrinsic corresponds to the <c> PSUBUSW </c> instruction.
638 /// A 64-bit integer vector of [4 x i16] containing the minuends.
640 /// A 64-bit integer vector of [4 x i16] containing the subtrahends.
641 /// \returns A 64-bit integer vector of [4 x i16] containing the saturated
642 /// differences of both parameters.
643 static __inline__ __m64 __DEFAULT_FN_ATTRS
644 _mm_subs_pu16(__m64 __m1
, __m64 __m2
)
646 return (__m64
)__builtin_ia32_psubusw((__v4hi
)__m1
, (__v4hi
)__m2
);
649 /// Multiplies each 16-bit signed integer element of the first 64-bit
650 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
651 /// element of the second 64-bit integer vector of [4 x i16] and get four
652 /// 32-bit products. Adds adjacent pairs of products to get two 32-bit sums.
653 /// The lower 32 bits of these two sums are packed into a 64-bit integer
654 /// vector of [2 x i32].
656 /// For example, bits [15:0] of both parameters are multiplied, bits [31:16]
657 /// of both parameters are multiplied, and the sum of both results is written
658 /// to bits [31:0] of the result.
660 /// \headerfile <x86intrin.h>
662 /// This intrinsic corresponds to the <c> PMADDWD </c> instruction.
665 /// A 64-bit integer vector of [4 x i16].
667 /// A 64-bit integer vector of [4 x i16].
668 /// \returns A 64-bit integer vector of [2 x i32] containing the sums of
669 /// products of both parameters.
670 static __inline__ __m64 __DEFAULT_FN_ATTRS
671 _mm_madd_pi16(__m64 __m1
, __m64 __m2
)
673 return (__m64
)__builtin_ia32_pmaddwd((__v4hi
)__m1
, (__v4hi
)__m2
);
676 /// Multiplies each 16-bit signed integer element of the first 64-bit
677 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
678 /// element of the second 64-bit integer vector of [4 x i16]. Packs the upper
679 /// 16 bits of the 32-bit products into a 64-bit integer vector of [4 x i16].
681 /// \headerfile <x86intrin.h>
683 /// This intrinsic corresponds to the <c> PMULHW </c> instruction.
686 /// A 64-bit integer vector of [4 x i16].
688 /// A 64-bit integer vector of [4 x i16].
689 /// \returns A 64-bit integer vector of [4 x i16] containing the upper 16 bits
690 /// of the products of both parameters.
691 static __inline__ __m64 __DEFAULT_FN_ATTRS
692 _mm_mulhi_pi16(__m64 __m1
, __m64 __m2
)
694 return (__m64
)__builtin_ia32_pmulhw((__v4hi
)__m1
, (__v4hi
)__m2
);
697 /// Multiplies each 16-bit signed integer element of the first 64-bit
698 /// integer vector of [4 x i16] by the corresponding 16-bit signed integer
699 /// element of the second 64-bit integer vector of [4 x i16]. Packs the lower
700 /// 16 bits of the 32-bit products into a 64-bit integer vector of [4 x i16].
702 /// \headerfile <x86intrin.h>
704 /// This intrinsic corresponds to the <c> PMULLW </c> instruction.
707 /// A 64-bit integer vector of [4 x i16].
709 /// A 64-bit integer vector of [4 x i16].
710 /// \returns A 64-bit integer vector of [4 x i16] containing the lower 16 bits
711 /// of the products of both parameters.
712 static __inline__ __m64 __DEFAULT_FN_ATTRS
713 _mm_mullo_pi16(__m64 __m1
, __m64 __m2
)
715 return (__m64
)__builtin_ia32_pmullw((__v4hi
)__m1
, (__v4hi
)__m2
);
718 /// Left-shifts each 16-bit signed integer element of the first
719 /// parameter, which is a 64-bit integer vector of [4 x i16], by the number
720 /// of bits specified by the second parameter, which is a 64-bit integer. The
721 /// lower 16 bits of the results are packed into a 64-bit integer vector of
724 /// \headerfile <x86intrin.h>
726 /// This intrinsic corresponds to the <c> PSLLW </c> instruction.
729 /// A 64-bit integer vector of [4 x i16].
731 /// A 64-bit integer vector interpreted as a single 64-bit integer.
732 /// \returns A 64-bit integer vector of [4 x i16] containing the left-shifted
733 /// values. If \a __count is greater or equal to 16, the result is set to all
735 static __inline__ __m64 __DEFAULT_FN_ATTRS
736 _mm_sll_pi16(__m64 __m
, __m64 __count
)
738 return (__m64
)__builtin_ia32_psllw((__v4hi
)__m
, __count
);
741 /// Left-shifts each 16-bit signed integer element of a 64-bit integer
742 /// vector of [4 x i16] by the number of bits specified by a 32-bit integer.
743 /// The lower 16 bits of the results are packed into a 64-bit integer vector
746 /// \headerfile <x86intrin.h>
748 /// This intrinsic corresponds to the <c> PSLLW </c> instruction.
751 /// A 64-bit integer vector of [4 x i16].
753 /// A 32-bit integer value.
754 /// \returns A 64-bit integer vector of [4 x i16] containing the left-shifted
755 /// values. If \a __count is greater or equal to 16, the result is set to all
757 static __inline__ __m64 __DEFAULT_FN_ATTRS
758 _mm_slli_pi16(__m64 __m
, int __count
)
760 return (__m64
)__builtin_ia32_psllwi((__v4hi
)__m
, __count
);
763 /// Left-shifts each 32-bit signed integer element of the first
764 /// parameter, which is a 64-bit integer vector of [2 x i32], by the number
765 /// of bits specified by the second parameter, which is a 64-bit integer. The
766 /// lower 32 bits of the results are packed into a 64-bit integer vector of
769 /// \headerfile <x86intrin.h>
771 /// This intrinsic corresponds to the <c> PSLLD </c> instruction.
774 /// A 64-bit integer vector of [2 x i32].
776 /// A 64-bit integer vector interpreted as a single 64-bit integer.
777 /// \returns A 64-bit integer vector of [2 x i32] containing the left-shifted
778 /// values. If \a __count is greater or equal to 32, the result is set to all
780 static __inline__ __m64 __DEFAULT_FN_ATTRS
781 _mm_sll_pi32(__m64 __m
, __m64 __count
)
783 return (__m64
)__builtin_ia32_pslld((__v2si
)__m
, __count
);
786 /// Left-shifts each 32-bit signed integer element of a 64-bit integer
787 /// vector of [2 x i32] by the number of bits specified by a 32-bit integer.
788 /// The lower 32 bits of the results are packed into a 64-bit integer vector
791 /// \headerfile <x86intrin.h>
793 /// This intrinsic corresponds to the <c> PSLLD </c> instruction.
796 /// A 64-bit integer vector of [2 x i32].
798 /// A 32-bit integer value.
799 /// \returns A 64-bit integer vector of [2 x i32] containing the left-shifted
800 /// values. If \a __count is greater or equal to 32, the result is set to all
802 static __inline__ __m64 __DEFAULT_FN_ATTRS
803 _mm_slli_pi32(__m64 __m
, int __count
)
805 return (__m64
)__builtin_ia32_pslldi((__v2si
)__m
, __count
);
808 /// Left-shifts the first 64-bit integer parameter by the number of bits
809 /// specified by the second 64-bit integer parameter. The lower 64 bits of
810 /// result are returned.
812 /// \headerfile <x86intrin.h>
814 /// This intrinsic corresponds to the <c> PSLLQ </c> instruction.
817 /// A 64-bit integer vector interpreted as a single 64-bit integer.
819 /// A 64-bit integer vector interpreted as a single 64-bit integer.
820 /// \returns A 64-bit integer vector containing the left-shifted value. If
821 /// \a __count is greater or equal to 64, the result is set to 0.
822 static __inline__ __m64 __DEFAULT_FN_ATTRS
823 _mm_sll_si64(__m64 __m
, __m64 __count
)
825 return (__m64
)__builtin_ia32_psllq((__v1di
)__m
, __count
);
828 /// Left-shifts the first parameter, which is a 64-bit integer, by the
829 /// number of bits specified by the second parameter, which is a 32-bit
830 /// integer. The lower 64 bits of result are returned.
832 /// \headerfile <x86intrin.h>
834 /// This intrinsic corresponds to the <c> PSLLQ </c> instruction.
837 /// A 64-bit integer vector interpreted as a single 64-bit integer.
839 /// A 32-bit integer value.
840 /// \returns A 64-bit integer vector containing the left-shifted value. If
841 /// \a __count is greater or equal to 64, the result is set to 0.
842 static __inline__ __m64 __DEFAULT_FN_ATTRS
843 _mm_slli_si64(__m64 __m
, int __count
)
845 return (__m64
)__builtin_ia32_psllqi((__v1di
)__m
, __count
);
848 /// Right-shifts each 16-bit integer element of the first parameter,
849 /// which is a 64-bit integer vector of [4 x i16], by the number of bits
850 /// specified by the second parameter, which is a 64-bit integer.
852 /// High-order bits are filled with the sign bit of the initial value of each
853 /// 16-bit element. The 16-bit results are packed into a 64-bit integer
854 /// vector of [4 x i16].
856 /// \headerfile <x86intrin.h>
858 /// This intrinsic corresponds to the <c> PSRAW </c> instruction.
861 /// A 64-bit integer vector of [4 x i16].
863 /// A 64-bit integer vector interpreted as a single 64-bit integer.
864 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
866 static __inline__ __m64 __DEFAULT_FN_ATTRS
867 _mm_sra_pi16(__m64 __m
, __m64 __count
)
869 return (__m64
)__builtin_ia32_psraw((__v4hi
)__m
, __count
);
872 /// Right-shifts each 16-bit integer element of a 64-bit integer vector
873 /// of [4 x i16] by the number of bits specified by a 32-bit integer.
875 /// High-order bits are filled with the sign bit of the initial value of each
876 /// 16-bit element. The 16-bit results are packed into a 64-bit integer
877 /// vector of [4 x i16].
879 /// \headerfile <x86intrin.h>
881 /// This intrinsic corresponds to the <c> PSRAW </c> instruction.
884 /// A 64-bit integer vector of [4 x i16].
886 /// A 32-bit integer value.
887 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
889 static __inline__ __m64 __DEFAULT_FN_ATTRS
890 _mm_srai_pi16(__m64 __m
, int __count
)
892 return (__m64
)__builtin_ia32_psrawi((__v4hi
)__m
, __count
);
895 /// Right-shifts each 32-bit integer element of the first parameter,
896 /// which is a 64-bit integer vector of [2 x i32], by the number of bits
897 /// specified by the second parameter, which is a 64-bit integer.
899 /// High-order bits are filled with the sign bit of the initial value of each
900 /// 32-bit element. The 32-bit results are packed into a 64-bit integer
901 /// vector of [2 x i32].
903 /// \headerfile <x86intrin.h>
905 /// This intrinsic corresponds to the <c> PSRAD </c> instruction.
908 /// A 64-bit integer vector of [2 x i32].
910 /// A 64-bit integer vector interpreted as a single 64-bit integer.
911 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
913 static __inline__ __m64 __DEFAULT_FN_ATTRS
914 _mm_sra_pi32(__m64 __m
, __m64 __count
)
916 return (__m64
)__builtin_ia32_psrad((__v2si
)__m
, __count
);
919 /// Right-shifts each 32-bit integer element of a 64-bit integer vector
920 /// of [2 x i32] by the number of bits specified by a 32-bit integer.
922 /// High-order bits are filled with the sign bit of the initial value of each
923 /// 32-bit element. The 32-bit results are packed into a 64-bit integer
924 /// vector of [2 x i32].
926 /// \headerfile <x86intrin.h>
928 /// This intrinsic corresponds to the <c> PSRAD </c> instruction.
931 /// A 64-bit integer vector of [2 x i32].
933 /// A 32-bit integer value.
934 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
936 static __inline__ __m64 __DEFAULT_FN_ATTRS
937 _mm_srai_pi32(__m64 __m
, int __count
)
939 return (__m64
)__builtin_ia32_psradi((__v2si
)__m
, __count
);
942 /// Right-shifts each 16-bit integer element of the first parameter,
943 /// which is a 64-bit integer vector of [4 x i16], by the number of bits
944 /// specified by the second parameter, which is a 64-bit integer.
946 /// High-order bits are cleared. The 16-bit results are packed into a 64-bit
947 /// integer vector of [4 x i16].
949 /// \headerfile <x86intrin.h>
951 /// This intrinsic corresponds to the <c> PSRLW </c> instruction.
954 /// A 64-bit integer vector of [4 x i16].
956 /// A 64-bit integer vector interpreted as a single 64-bit integer.
957 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
959 static __inline__ __m64 __DEFAULT_FN_ATTRS
960 _mm_srl_pi16(__m64 __m
, __m64 __count
)
962 return (__m64
)__builtin_ia32_psrlw((__v4hi
)__m
, __count
);
965 /// Right-shifts each 16-bit integer element of a 64-bit integer vector
966 /// of [4 x i16] by the number of bits specified by a 32-bit integer.
968 /// High-order bits are cleared. The 16-bit results are packed into a 64-bit
969 /// integer vector of [4 x i16].
971 /// \headerfile <x86intrin.h>
973 /// This intrinsic corresponds to the <c> PSRLW </c> instruction.
976 /// A 64-bit integer vector of [4 x i16].
978 /// A 32-bit integer value.
979 /// \returns A 64-bit integer vector of [4 x i16] containing the right-shifted
981 static __inline__ __m64 __DEFAULT_FN_ATTRS
982 _mm_srli_pi16(__m64 __m
, int __count
)
984 return (__m64
)__builtin_ia32_psrlwi((__v4hi
)__m
, __count
);
987 /// Right-shifts each 32-bit integer element of the first parameter,
988 /// which is a 64-bit integer vector of [2 x i32], by the number of bits
989 /// specified by the second parameter, which is a 64-bit integer.
991 /// High-order bits are cleared. The 32-bit results are packed into a 64-bit
992 /// integer vector of [2 x i32].
994 /// \headerfile <x86intrin.h>
996 /// This intrinsic corresponds to the <c> PSRLD </c> instruction.
999 /// A 64-bit integer vector of [2 x i32].
1001 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1002 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
1004 static __inline__ __m64 __DEFAULT_FN_ATTRS
1005 _mm_srl_pi32(__m64 __m
, __m64 __count
)
1007 return (__m64
)__builtin_ia32_psrld((__v2si
)__m
, __count
);
1010 /// Right-shifts each 32-bit integer element of a 64-bit integer vector
1011 /// of [2 x i32] by the number of bits specified by a 32-bit integer.
1013 /// High-order bits are cleared. The 32-bit results are packed into a 64-bit
1014 /// integer vector of [2 x i32].
1016 /// \headerfile <x86intrin.h>
1018 /// This intrinsic corresponds to the <c> PSRLD </c> instruction.
1021 /// A 64-bit integer vector of [2 x i32].
1023 /// A 32-bit integer value.
1024 /// \returns A 64-bit integer vector of [2 x i32] containing the right-shifted
1026 static __inline__ __m64 __DEFAULT_FN_ATTRS
1027 _mm_srli_pi32(__m64 __m
, int __count
)
1029 return (__m64
)__builtin_ia32_psrldi((__v2si
)__m
, __count
);
1032 /// Right-shifts the first 64-bit integer parameter by the number of bits
1033 /// specified by the second 64-bit integer parameter.
1035 /// High-order bits are cleared.
1037 /// \headerfile <x86intrin.h>
1039 /// This intrinsic corresponds to the <c> PSRLQ </c> instruction.
1042 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1044 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1045 /// \returns A 64-bit integer vector containing the right-shifted value.
1046 static __inline__ __m64 __DEFAULT_FN_ATTRS
1047 _mm_srl_si64(__m64 __m
, __m64 __count
)
1049 return (__m64
)__builtin_ia32_psrlq((__v1di
)__m
, __count
);
1052 /// Right-shifts the first parameter, which is a 64-bit integer, by the
1053 /// number of bits specified by the second parameter, which is a 32-bit
1056 /// High-order bits are cleared.
1058 /// \headerfile <x86intrin.h>
1060 /// This intrinsic corresponds to the <c> PSRLQ </c> instruction.
1063 /// A 64-bit integer vector interpreted as a single 64-bit integer.
1065 /// A 32-bit integer value.
1066 /// \returns A 64-bit integer vector containing the right-shifted value.
1067 static __inline__ __m64 __DEFAULT_FN_ATTRS
1068 _mm_srli_si64(__m64 __m
, int __count
)
1070 return (__m64
)__builtin_ia32_psrlqi((__v1di
)__m
, __count
);
1073 /// Performs a bitwise AND of two 64-bit integer vectors.
1075 /// \headerfile <x86intrin.h>
1077 /// This intrinsic corresponds to the <c> PAND </c> instruction.
1080 /// A 64-bit integer vector.
1082 /// A 64-bit integer vector.
1083 /// \returns A 64-bit integer vector containing the bitwise AND of both
1085 static __inline__ __m64 __DEFAULT_FN_ATTRS
1086 _mm_and_si64(__m64 __m1
, __m64 __m2
)
1088 return __builtin_ia32_pand((__v1di
)__m1
, (__v1di
)__m2
);
1091 /// Performs a bitwise NOT of the first 64-bit integer vector, and then
1092 /// performs a bitwise AND of the intermediate result and the second 64-bit
1095 /// \headerfile <x86intrin.h>
1097 /// This intrinsic corresponds to the <c> PANDN </c> instruction.
1100 /// A 64-bit integer vector. The one's complement of this parameter is used
1101 /// in the bitwise AND.
1103 /// A 64-bit integer vector.
1104 /// \returns A 64-bit integer vector containing the bitwise AND of the second
1105 /// parameter and the one's complement of the first parameter.
1106 static __inline__ __m64 __DEFAULT_FN_ATTRS
1107 _mm_andnot_si64(__m64 __m1
, __m64 __m2
)
1109 return __builtin_ia32_pandn((__v1di
)__m1
, (__v1di
)__m2
);
1112 /// Performs a bitwise OR of two 64-bit integer vectors.
1114 /// \headerfile <x86intrin.h>
1116 /// This intrinsic corresponds to the <c> POR </c> instruction.
1119 /// A 64-bit integer vector.
1121 /// A 64-bit integer vector.
1122 /// \returns A 64-bit integer vector containing the bitwise OR of both
1124 static __inline__ __m64 __DEFAULT_FN_ATTRS
1125 _mm_or_si64(__m64 __m1
, __m64 __m2
)
1127 return __builtin_ia32_por((__v1di
)__m1
, (__v1di
)__m2
);
1130 /// Performs a bitwise exclusive OR of two 64-bit integer vectors.
1132 /// \headerfile <x86intrin.h>
1134 /// This intrinsic corresponds to the <c> PXOR </c> instruction.
1137 /// A 64-bit integer vector.
1139 /// A 64-bit integer vector.
1140 /// \returns A 64-bit integer vector containing the bitwise exclusive OR of both
1142 static __inline__ __m64 __DEFAULT_FN_ATTRS
1143 _mm_xor_si64(__m64 __m1
, __m64 __m2
)
1145 return __builtin_ia32_pxor((__v1di
)__m1
, (__v1di
)__m2
);
1148 /// Compares the 8-bit integer elements of two 64-bit integer vectors of
1149 /// [8 x i8] to determine if the element of the first vector is equal to the
1150 /// corresponding element of the second vector.
1152 /// The comparison yields 0 for false, 0xFF for true.
1154 /// \headerfile <x86intrin.h>
1156 /// This intrinsic corresponds to the <c> PCMPEQB </c> instruction.
1159 /// A 64-bit integer vector of [8 x i8].
1161 /// A 64-bit integer vector of [8 x i8].
1162 /// \returns A 64-bit integer vector of [8 x i8] containing the comparison
1164 static __inline__ __m64 __DEFAULT_FN_ATTRS
1165 _mm_cmpeq_pi8(__m64 __m1
, __m64 __m2
)
1167 return (__m64
)__builtin_ia32_pcmpeqb((__v8qi
)__m1
, (__v8qi
)__m2
);
1170 /// Compares the 16-bit integer elements of two 64-bit integer vectors of
1171 /// [4 x i16] to determine if the element of the first vector is equal to the
1172 /// corresponding element of the second vector.
1174 /// The comparison yields 0 for false, 0xFFFF for true.
1176 /// \headerfile <x86intrin.h>
1178 /// This intrinsic corresponds to the <c> PCMPEQW </c> instruction.
1181 /// A 64-bit integer vector of [4 x i16].
1183 /// A 64-bit integer vector of [4 x i16].
1184 /// \returns A 64-bit integer vector of [4 x i16] containing the comparison
1186 static __inline__ __m64 __DEFAULT_FN_ATTRS
1187 _mm_cmpeq_pi16(__m64 __m1
, __m64 __m2
)
1189 return (__m64
)__builtin_ia32_pcmpeqw((__v4hi
)__m1
, (__v4hi
)__m2
);
1192 /// Compares the 32-bit integer elements of two 64-bit integer vectors of
1193 /// [2 x i32] to determine if the element of the first vector is equal to the
1194 /// corresponding element of the second vector.
1196 /// The comparison yields 0 for false, 0xFFFFFFFF for true.
1198 /// \headerfile <x86intrin.h>
1200 /// This intrinsic corresponds to the <c> PCMPEQD </c> instruction.
1203 /// A 64-bit integer vector of [2 x i32].
1205 /// A 64-bit integer vector of [2 x i32].
1206 /// \returns A 64-bit integer vector of [2 x i32] containing the comparison
1208 static __inline__ __m64 __DEFAULT_FN_ATTRS
1209 _mm_cmpeq_pi32(__m64 __m1
, __m64 __m2
)
1211 return (__m64
)__builtin_ia32_pcmpeqd((__v2si
)__m1
, (__v2si
)__m2
);
1214 /// Compares the 8-bit integer elements of two 64-bit integer vectors of
1215 /// [8 x i8] to determine if the element of the first vector is greater than
1216 /// the corresponding element of the second vector.
1218 /// The comparison yields 0 for false, 0xFF for true.
1220 /// \headerfile <x86intrin.h>
1222 /// This intrinsic corresponds to the <c> PCMPGTB </c> instruction.
1225 /// A 64-bit integer vector of [8 x i8].
1227 /// A 64-bit integer vector of [8 x i8].
1228 /// \returns A 64-bit integer vector of [8 x i8] containing the comparison
1230 static __inline__ __m64 __DEFAULT_FN_ATTRS
1231 _mm_cmpgt_pi8(__m64 __m1
, __m64 __m2
)
1233 return (__m64
)__builtin_ia32_pcmpgtb((__v8qi
)__m1
, (__v8qi
)__m2
);
1236 /// Compares the 16-bit integer elements of two 64-bit integer vectors of
1237 /// [4 x i16] to determine if the element of the first vector is greater than
1238 /// the corresponding element of the second vector.
1240 /// The comparison yields 0 for false, 0xFFFF for true.
1242 /// \headerfile <x86intrin.h>
1244 /// This intrinsic corresponds to the <c> PCMPGTW </c> instruction.
1247 /// A 64-bit integer vector of [4 x i16].
1249 /// A 64-bit integer vector of [4 x i16].
1250 /// \returns A 64-bit integer vector of [4 x i16] containing the comparison
1252 static __inline__ __m64 __DEFAULT_FN_ATTRS
1253 _mm_cmpgt_pi16(__m64 __m1
, __m64 __m2
)
1255 return (__m64
)__builtin_ia32_pcmpgtw((__v4hi
)__m1
, (__v4hi
)__m2
);
1258 /// Compares the 32-bit integer elements of two 64-bit integer vectors of
1259 /// [2 x i32] to determine if the element of the first vector is greater than
1260 /// the corresponding element of the second vector.
1262 /// The comparison yields 0 for false, 0xFFFFFFFF for true.
1264 /// \headerfile <x86intrin.h>
1266 /// This intrinsic corresponds to the <c> PCMPGTD </c> instruction.
1269 /// A 64-bit integer vector of [2 x i32].
1271 /// A 64-bit integer vector of [2 x i32].
1272 /// \returns A 64-bit integer vector of [2 x i32] containing the comparison
1274 static __inline__ __m64 __DEFAULT_FN_ATTRS
1275 _mm_cmpgt_pi32(__m64 __m1
, __m64 __m2
)
1277 return (__m64
)__builtin_ia32_pcmpgtd((__v2si
)__m1
, (__v2si
)__m2
);
1280 /// Constructs a 64-bit integer vector initialized to zero.
1282 /// \headerfile <x86intrin.h>
1284 /// This intrinsic corresponds to the <c> PXOR </c> instruction.
1286 /// \returns An initialized 64-bit integer vector with all elements set to zero.
1287 static __inline__ __m64 __DEFAULT_FN_ATTRS
1288 _mm_setzero_si64(void)
1290 return __extension__ (__m64
){ 0LL };
1293 /// Constructs a 64-bit integer vector initialized with the specified
1294 /// 32-bit integer values.
1296 /// \headerfile <x86intrin.h>
1298 /// This intrinsic is a utility function and does not correspond to a specific
1302 /// A 32-bit integer value used to initialize the upper 32 bits of the
1305 /// A 32-bit integer value used to initialize the lower 32 bits of the
1307 /// \returns An initialized 64-bit integer vector.
1308 static __inline__ __m64 __DEFAULT_FN_ATTRS
1309 _mm_set_pi32(int __i1
, int __i0
)
1311 return (__m64
)__builtin_ia32_vec_init_v2si(__i0
, __i1
);
1314 /// Constructs a 64-bit integer vector initialized with the specified
1315 /// 16-bit integer values.
1317 /// \headerfile <x86intrin.h>
1319 /// This intrinsic is a utility function and does not correspond to a specific
1323 /// A 16-bit integer value used to initialize bits [63:48] of the result.
1325 /// A 16-bit integer value used to initialize bits [47:32] of the result.
1327 /// A 16-bit integer value used to initialize bits [31:16] of the result.
1329 /// A 16-bit integer value used to initialize bits [15:0] of the result.
1330 /// \returns An initialized 64-bit integer vector.
1331 static __inline__ __m64 __DEFAULT_FN_ATTRS
1332 _mm_set_pi16(short __s3
, short __s2
, short __s1
, short __s0
)
1334 return (__m64
)__builtin_ia32_vec_init_v4hi(__s0
, __s1
, __s2
, __s3
);
1337 /// Constructs a 64-bit integer vector initialized with the specified
1338 /// 8-bit integer values.
1340 /// \headerfile <x86intrin.h>
1342 /// This intrinsic is a utility function and does not correspond to a specific
1346 /// An 8-bit integer value used to initialize bits [63:56] of the result.
1348 /// An 8-bit integer value used to initialize bits [55:48] of the result.
1350 /// An 8-bit integer value used to initialize bits [47:40] of the result.
1352 /// An 8-bit integer value used to initialize bits [39:32] of the result.
1354 /// An 8-bit integer value used to initialize bits [31:24] of the result.
1356 /// An 8-bit integer value used to initialize bits [23:16] of the result.
1358 /// An 8-bit integer value used to initialize bits [15:8] of the result.
1360 /// An 8-bit integer value used to initialize bits [7:0] of the result.
1361 /// \returns An initialized 64-bit integer vector.
1362 static __inline__ __m64 __DEFAULT_FN_ATTRS
1363 _mm_set_pi8(char __b7
, char __b6
, char __b5
, char __b4
, char __b3
, char __b2
,
1364 char __b1
, char __b0
)
1366 return (__m64
)__builtin_ia32_vec_init_v8qi(__b0
, __b1
, __b2
, __b3
,
1367 __b4
, __b5
, __b6
, __b7
);
1370 /// Constructs a 64-bit integer vector of [2 x i32], with each of the
1371 /// 32-bit integer vector elements set to the specified 32-bit integer
1374 /// \headerfile <x86intrin.h>
1376 /// This intrinsic is a utility function and does not correspond to a specific
1380 /// A 32-bit integer value used to initialize each vector element of the
1382 /// \returns An initialized 64-bit integer vector of [2 x i32].
1383 static __inline__ __m64 __DEFAULT_FN_ATTRS
1384 _mm_set1_pi32(int __i
)
1386 return _mm_set_pi32(__i
, __i
);
1389 /// Constructs a 64-bit integer vector of [4 x i16], with each of the
1390 /// 16-bit integer vector elements set to the specified 16-bit integer
1393 /// \headerfile <x86intrin.h>
1395 /// This intrinsic is a utility function and does not correspond to a specific
1399 /// A 16-bit integer value used to initialize each vector element of the
1401 /// \returns An initialized 64-bit integer vector of [4 x i16].
1402 static __inline__ __m64 __DEFAULT_FN_ATTRS
1403 _mm_set1_pi16(short __w
)
1405 return _mm_set_pi16(__w
, __w
, __w
, __w
);
1408 /// Constructs a 64-bit integer vector of [8 x i8], with each of the
1409 /// 8-bit integer vector elements set to the specified 8-bit integer value.
1411 /// \headerfile <x86intrin.h>
1413 /// This intrinsic is a utility function and does not correspond to a specific
1417 /// An 8-bit integer value used to initialize each vector element of the
1419 /// \returns An initialized 64-bit integer vector of [8 x i8].
1420 static __inline__ __m64 __DEFAULT_FN_ATTRS
1421 _mm_set1_pi8(char __b
)
1423 return _mm_set_pi8(__b
, __b
, __b
, __b
, __b
, __b
, __b
, __b
);
1426 /// Constructs a 64-bit integer vector, initialized in reverse order with
1427 /// the specified 32-bit integer values.
1429 /// \headerfile <x86intrin.h>
1431 /// This intrinsic is a utility function and does not correspond to a specific
1435 /// A 32-bit integer value used to initialize the lower 32 bits of the
1438 /// A 32-bit integer value used to initialize the upper 32 bits of the
1440 /// \returns An initialized 64-bit integer vector.
1441 static __inline__ __m64 __DEFAULT_FN_ATTRS
1442 _mm_setr_pi32(int __i0
, int __i1
)
1444 return _mm_set_pi32(__i1
, __i0
);
1447 /// Constructs a 64-bit integer vector, initialized in reverse order with
1448 /// the specified 16-bit integer values.
1450 /// \headerfile <x86intrin.h>
1452 /// This intrinsic is a utility function and does not correspond to a specific
1456 /// A 16-bit integer value used to initialize bits [15:0] of the result.
1458 /// A 16-bit integer value used to initialize bits [31:16] of the result.
1460 /// A 16-bit integer value used to initialize bits [47:32] of the result.
1462 /// A 16-bit integer value used to initialize bits [63:48] of the result.
1463 /// \returns An initialized 64-bit integer vector.
1464 static __inline__ __m64 __DEFAULT_FN_ATTRS
1465 _mm_setr_pi16(short __w0
, short __w1
, short __w2
, short __w3
)
1467 return _mm_set_pi16(__w3
, __w2
, __w1
, __w0
);
1470 /// Constructs a 64-bit integer vector, initialized in reverse order with
1471 /// the specified 8-bit integer values.
1473 /// \headerfile <x86intrin.h>
1475 /// This intrinsic is a utility function and does not correspond to a specific
1479 /// An 8-bit integer value used to initialize bits [7:0] of the result.
1481 /// An 8-bit integer value used to initialize bits [15:8] of the result.
1483 /// An 8-bit integer value used to initialize bits [23:16] of the result.
1485 /// An 8-bit integer value used to initialize bits [31:24] of the result.
1487 /// An 8-bit integer value used to initialize bits [39:32] of the result.
1489 /// An 8-bit integer value used to initialize bits [47:40] of the result.
1491 /// An 8-bit integer value used to initialize bits [55:48] of the result.
1493 /// An 8-bit integer value used to initialize bits [63:56] of the result.
1494 /// \returns An initialized 64-bit integer vector.
1495 static __inline__ __m64 __DEFAULT_FN_ATTRS
1496 _mm_setr_pi8(char __b0
, char __b1
, char __b2
, char __b3
, char __b4
, char __b5
,
1497 char __b6
, char __b7
)
1499 return _mm_set_pi8(__b7
, __b6
, __b5
, __b4
, __b3
, __b2
, __b1
, __b0
);
1502 #undef __DEFAULT_FN_ATTRS
1504 /* Aliases for compatibility. */
1505 #define _m_empty _mm_empty
1506 #define _m_from_int _mm_cvtsi32_si64
1507 #define _m_from_int64 _mm_cvtsi64_m64
1508 #define _m_to_int _mm_cvtsi64_si32
1509 #define _m_to_int64 _mm_cvtm64_si64
1510 #define _m_packsswb _mm_packs_pi16
1511 #define _m_packssdw _mm_packs_pi32
1512 #define _m_packuswb _mm_packs_pu16
1513 #define _m_punpckhbw _mm_unpackhi_pi8
1514 #define _m_punpckhwd _mm_unpackhi_pi16
1515 #define _m_punpckhdq _mm_unpackhi_pi32
1516 #define _m_punpcklbw _mm_unpacklo_pi8
1517 #define _m_punpcklwd _mm_unpacklo_pi16
1518 #define _m_punpckldq _mm_unpacklo_pi32
1519 #define _m_paddb _mm_add_pi8
1520 #define _m_paddw _mm_add_pi16
1521 #define _m_paddd _mm_add_pi32
1522 #define _m_paddsb _mm_adds_pi8
1523 #define _m_paddsw _mm_adds_pi16
1524 #define _m_paddusb _mm_adds_pu8
1525 #define _m_paddusw _mm_adds_pu16
1526 #define _m_psubb _mm_sub_pi8
1527 #define _m_psubw _mm_sub_pi16
1528 #define _m_psubd _mm_sub_pi32
1529 #define _m_psubsb _mm_subs_pi8
1530 #define _m_psubsw _mm_subs_pi16
1531 #define _m_psubusb _mm_subs_pu8
1532 #define _m_psubusw _mm_subs_pu16
1533 #define _m_pmaddwd _mm_madd_pi16
1534 #define _m_pmulhw _mm_mulhi_pi16
1535 #define _m_pmullw _mm_mullo_pi16
1536 #define _m_psllw _mm_sll_pi16
1537 #define _m_psllwi _mm_slli_pi16
1538 #define _m_pslld _mm_sll_pi32
1539 #define _m_pslldi _mm_slli_pi32
1540 #define _m_psllq _mm_sll_si64
1541 #define _m_psllqi _mm_slli_si64
1542 #define _m_psraw _mm_sra_pi16
1543 #define _m_psrawi _mm_srai_pi16
1544 #define _m_psrad _mm_sra_pi32
1545 #define _m_psradi _mm_srai_pi32
1546 #define _m_psrlw _mm_srl_pi16
1547 #define _m_psrlwi _mm_srli_pi16
1548 #define _m_psrld _mm_srl_pi32
1549 #define _m_psrldi _mm_srli_pi32
1550 #define _m_psrlq _mm_srl_si64
1551 #define _m_psrlqi _mm_srli_si64
1552 #define _m_pand _mm_and_si64
1553 #define _m_pandn _mm_andnot_si64
1554 #define _m_por _mm_or_si64
1555 #define _m_pxor _mm_xor_si64
1556 #define _m_pcmpeqb _mm_cmpeq_pi8
1557 #define _m_pcmpeqw _mm_cmpeq_pi16
1558 #define _m_pcmpeqd _mm_cmpeq_pi32
1559 #define _m_pcmpgtb _mm_cmpgt_pi8
1560 #define _m_pcmpgtw _mm_cmpgt_pi16
1561 #define _m_pcmpgtd _mm_cmpgt_pi32
1563 #endif /* __MMINTRIN_H */