1206084Srdivacky/*===---- smmintrin.h - SSE4 intrinsics ------------------------------------=== 2206084Srdivacky * 3353358Sdim * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim * See https://llvm.org/LICENSE.txt for license information. 5353358Sdim * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6206084Srdivacky * 7206084Srdivacky *===-----------------------------------------------------------------------=== 8206084Srdivacky */ 9204793Srdivacky 10341825Sdim#ifndef __SMMINTRIN_H 11341825Sdim#define __SMMINTRIN_H 12204793Srdivacky 13204793Srdivacky#include <tmmintrin.h> 14204793Srdivacky 15288943Sdim/* Define the default attributes for the functions in this file. */ 16341825Sdim#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.1"), __min_vector_width__(128))) 17288943Sdim 18204793Srdivacky/* SSE4 Rounding macros. */ 19204793Srdivacky#define _MM_FROUND_TO_NEAREST_INT 0x00 20204793Srdivacky#define _MM_FROUND_TO_NEG_INF 0x01 21204793Srdivacky#define _MM_FROUND_TO_POS_INF 0x02 22204793Srdivacky#define _MM_FROUND_TO_ZERO 0x03 23204793Srdivacky#define _MM_FROUND_CUR_DIRECTION 0x04 24204793Srdivacky 25204793Srdivacky#define _MM_FROUND_RAISE_EXC 0x00 26204793Srdivacky#define _MM_FROUND_NO_EXC 0x08 27204793Srdivacky 28204793Srdivacky#define _MM_FROUND_NINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT) 29204793Srdivacky#define _MM_FROUND_FLOOR (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF) 30204793Srdivacky#define _MM_FROUND_CEIL (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF) 31204793Srdivacky#define _MM_FROUND_TRUNC (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO) 32204793Srdivacky#define _MM_FROUND_RINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION) 33204962Srdivacky#define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION) 34204793Srdivacky 35341825Sdim/// Rounds up each element of the 128-bit vector of [4 x float] to an 36321369Sdim/// integer and returns the rounded values in a 128-bit vector of 37321369Sdim/// [4 x float]. 38321369Sdim/// 39321369Sdim/// \headerfile <x86intrin.h> 40321369Sdim/// 41321369Sdim/// \code 42321369Sdim/// __m128 _mm_ceil_ps(__m128 X); 43321369Sdim/// \endcode 44321369Sdim/// 45321369Sdim/// This intrinsic corresponds to the <c> VROUNDPS / ROUNDPS </c> instruction. 46321369Sdim/// 47321369Sdim/// \param X 48321369Sdim/// A 128-bit vector of [4 x float] values to be rounded up. 49321369Sdim/// \returns A 128-bit vector of [4 x float] containing the rounded values. 50204793Srdivacky#define _mm_ceil_ps(X) _mm_round_ps((X), _MM_FROUND_CEIL) 51321369Sdim 52341825Sdim/// Rounds up each element of the 128-bit vector of [2 x double] to an 53321369Sdim/// integer and returns the rounded values in a 128-bit vector of 54321369Sdim/// [2 x double]. 55321369Sdim/// 56321369Sdim/// \headerfile <x86intrin.h> 57321369Sdim/// 58321369Sdim/// \code 59321369Sdim/// __m128d _mm_ceil_pd(__m128d X); 60321369Sdim/// \endcode 61321369Sdim/// 62321369Sdim/// This intrinsic corresponds to the <c> VROUNDPD / ROUNDPD </c> instruction. 63321369Sdim/// 64321369Sdim/// \param X 65321369Sdim/// A 128-bit vector of [2 x double] values to be rounded up. 66321369Sdim/// \returns A 128-bit vector of [2 x double] containing the rounded values. 67204793Srdivacky#define _mm_ceil_pd(X) _mm_round_pd((X), _MM_FROUND_CEIL) 68321369Sdim 69341825Sdim/// Copies three upper elements of the first 128-bit vector operand to 70321369Sdim/// the corresponding three upper elements of the 128-bit result vector of 71321369Sdim/// [4 x float]. Rounds up the lowest element of the second 128-bit vector 72321369Sdim/// operand to an integer and copies it to the lowest element of the 128-bit 73321369Sdim/// result vector of [4 x float]. 74321369Sdim/// 75321369Sdim/// \headerfile <x86intrin.h> 76321369Sdim/// 77321369Sdim/// \code 78321369Sdim/// __m128 _mm_ceil_ss(__m128 X, __m128 Y); 79321369Sdim/// \endcode 80321369Sdim/// 81321369Sdim/// This intrinsic corresponds to the <c> VROUNDSS / ROUNDSS </c> instruction. 82321369Sdim/// 83321369Sdim/// \param X 84321369Sdim/// A 128-bit vector of [4 x float]. The values stored in bits [127:32] are 85321369Sdim/// copied to the corresponding bits of the result. 86321369Sdim/// \param Y 87321369Sdim/// A 128-bit vector of [4 x float]. The value stored in bits [31:0] is 88321369Sdim/// rounded up to the nearest integer and copied to the corresponding bits 89321369Sdim/// of the result. 90321369Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and rounded 91321369Sdim/// values. 92204793Srdivacky#define _mm_ceil_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_CEIL) 93321369Sdim 94341825Sdim/// Copies the upper element of the first 128-bit vector operand to the 95321369Sdim/// corresponding upper element of the 128-bit result vector of [2 x double]. 96321369Sdim/// Rounds up the lower element of the second 128-bit vector operand to an 97321369Sdim/// integer and copies it to the lower element of the 128-bit result vector 98321369Sdim/// of [2 x double]. 99321369Sdim/// 100321369Sdim/// \headerfile <x86intrin.h> 101321369Sdim/// 102321369Sdim/// \code 103321369Sdim/// __m128d _mm_ceil_sd(__m128d X, __m128d Y); 104321369Sdim/// \endcode 105321369Sdim/// 106321369Sdim/// This intrinsic corresponds to the <c> VROUNDSD / ROUNDSD </c> instruction. 107321369Sdim/// 108321369Sdim/// \param X 109321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [127:64] is 110321369Sdim/// copied to the corresponding bits of the result. 111321369Sdim/// \param Y 112321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [63:0] is 113321369Sdim/// rounded up to the nearest integer and copied to the corresponding bits 114321369Sdim/// of the result. 115321369Sdim/// \returns A 128-bit vector of [2 x double] containing the copied and rounded 116321369Sdim/// values. 117204793Srdivacky#define _mm_ceil_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_CEIL) 118204793Srdivacky 119341825Sdim/// Rounds down each element of the 128-bit vector of [4 x float] to an 120321369Sdim/// an integer and returns the rounded values in a 128-bit vector of 121321369Sdim/// [4 x float]. 122321369Sdim/// 123321369Sdim/// \headerfile <x86intrin.h> 124321369Sdim/// 125321369Sdim/// \code 126321369Sdim/// __m128 _mm_floor_ps(__m128 X); 127321369Sdim/// \endcode 128321369Sdim/// 129321369Sdim/// This intrinsic corresponds to the <c> VROUNDPS / ROUNDPS </c> instruction. 130321369Sdim/// 131321369Sdim/// \param X 132321369Sdim/// A 128-bit vector of [4 x float] values to be rounded down. 133321369Sdim/// \returns A 128-bit vector of [4 x float] containing the rounded values. 134204793Srdivacky#define _mm_floor_ps(X) _mm_round_ps((X), _MM_FROUND_FLOOR) 135321369Sdim 136341825Sdim/// Rounds down each element of the 128-bit vector of [2 x double] to an 137321369Sdim/// integer and returns the rounded values in a 128-bit vector of 138321369Sdim/// [2 x double]. 139321369Sdim/// 140321369Sdim/// \headerfile <x86intrin.h> 141321369Sdim/// 142321369Sdim/// \code 143321369Sdim/// __m128d _mm_floor_pd(__m128d X); 144321369Sdim/// \endcode 145321369Sdim/// 146321369Sdim/// This intrinsic corresponds to the <c> VROUNDPD / ROUNDPD </c> instruction. 147321369Sdim/// 148321369Sdim/// \param X 149321369Sdim/// A 128-bit vector of [2 x double]. 150321369Sdim/// \returns A 128-bit vector of [2 x double] containing the rounded values. 151204793Srdivacky#define _mm_floor_pd(X) _mm_round_pd((X), _MM_FROUND_FLOOR) 152321369Sdim 153341825Sdim/// Copies three upper elements of the first 128-bit vector operand to 154321369Sdim/// the corresponding three upper elements of the 128-bit result vector of 155321369Sdim/// [4 x float]. Rounds down the lowest element of the second 128-bit vector 156321369Sdim/// operand to an integer and copies it to the lowest element of the 128-bit 157321369Sdim/// result vector of [4 x float]. 158321369Sdim/// 159321369Sdim/// \headerfile <x86intrin.h> 160321369Sdim/// 161321369Sdim/// \code 162321369Sdim/// __m128 _mm_floor_ss(__m128 X, __m128 Y); 163321369Sdim/// \endcode 164321369Sdim/// 165321369Sdim/// This intrinsic corresponds to the <c> VROUNDSS / ROUNDSS </c> instruction. 166321369Sdim/// 167321369Sdim/// \param X 168321369Sdim/// A 128-bit vector of [4 x float]. The values stored in bits [127:32] are 169321369Sdim/// copied to the corresponding bits of the result. 170321369Sdim/// \param Y 171321369Sdim/// A 128-bit vector of [4 x float]. The value stored in bits [31:0] is 172321369Sdim/// rounded down to the nearest integer and copied to the corresponding bits 173321369Sdim/// of the result. 174321369Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and rounded 175321369Sdim/// values. 176204793Srdivacky#define _mm_floor_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_FLOOR) 177321369Sdim 178341825Sdim/// Copies the upper element of the first 128-bit vector operand to the 179321369Sdim/// corresponding upper element of the 128-bit result vector of [2 x double]. 180321369Sdim/// Rounds down the lower element of the second 128-bit vector operand to an 181321369Sdim/// integer and copies it to the lower element of the 128-bit result vector 182321369Sdim/// of [2 x double]. 183321369Sdim/// 184321369Sdim/// \headerfile <x86intrin.h> 185321369Sdim/// 186321369Sdim/// \code 187321369Sdim/// __m128d _mm_floor_sd(__m128d X, __m128d Y); 188321369Sdim/// \endcode 189321369Sdim/// 190321369Sdim/// This intrinsic corresponds to the <c> VROUNDSD / ROUNDSD </c> instruction. 191321369Sdim/// 192321369Sdim/// \param X 193321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [127:64] is 194321369Sdim/// copied to the corresponding bits of the result. 195321369Sdim/// \param Y 196321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [63:0] is 197321369Sdim/// rounded down to the nearest integer and copied to the corresponding bits 198321369Sdim/// of the result. 199321369Sdim/// \returns A 128-bit vector of [2 x double] containing the copied and rounded 200321369Sdim/// values. 201204793Srdivacky#define _mm_floor_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_FLOOR) 202204793Srdivacky 203341825Sdim/// Rounds each element of the 128-bit vector of [4 x float] to an 204321369Sdim/// integer value according to the rounding control specified by the second 205321369Sdim/// argument and returns the rounded values in a 128-bit vector of 206321369Sdim/// [4 x float]. 207321369Sdim/// 208321369Sdim/// \headerfile <x86intrin.h> 209321369Sdim/// 210321369Sdim/// \code 211321369Sdim/// __m128 _mm_round_ps(__m128 X, const int M); 212321369Sdim/// \endcode 213321369Sdim/// 214321369Sdim/// This intrinsic corresponds to the <c> VROUNDPS / ROUNDPS </c> instruction. 215321369Sdim/// 216321369Sdim/// \param X 217321369Sdim/// A 128-bit vector of [4 x float]. 218321369Sdim/// \param M 219321369Sdim/// An integer value that specifies the rounding operation. \n 220321369Sdim/// Bits [7:4] are reserved. \n 221321369Sdim/// Bit [3] is a precision exception value: \n 222321369Sdim/// 0: A normal PE exception is used \n 223321369Sdim/// 1: The PE field is not updated \n 224321369Sdim/// Bit [2] is the rounding control source: \n 225321369Sdim/// 0: Use bits [1:0] of \a M \n 226321369Sdim/// 1: Use the current MXCSR setting \n 227321369Sdim/// Bits [1:0] contain the rounding control definition: \n 228321369Sdim/// 00: Nearest \n 229321369Sdim/// 01: Downward (toward negative infinity) \n 230321369Sdim/// 10: Upward (toward positive infinity) \n 231321369Sdim/// 11: Truncated 232321369Sdim/// \returns A 128-bit vector of [4 x float] containing the rounded values. 233341825Sdim#define _mm_round_ps(X, M) \ 234341825Sdim (__m128)__builtin_ia32_roundps((__v4sf)(__m128)(X), (M)) 235204793Srdivacky 236341825Sdim/// Copies three upper elements of the first 128-bit vector operand to 237321369Sdim/// the corresponding three upper elements of the 128-bit result vector of 238321369Sdim/// [4 x float]. Rounds the lowest element of the second 128-bit vector 239321369Sdim/// operand to an integer value according to the rounding control specified 240321369Sdim/// by the third argument and copies it to the lowest element of the 128-bit 241321369Sdim/// result vector of [4 x float]. 242321369Sdim/// 243321369Sdim/// \headerfile <x86intrin.h> 244321369Sdim/// 245321369Sdim/// \code 246321369Sdim/// __m128 _mm_round_ss(__m128 X, __m128 Y, const int M); 247321369Sdim/// \endcode 248321369Sdim/// 249321369Sdim/// This intrinsic corresponds to the <c> VROUNDSS / ROUNDSS </c> instruction. 250321369Sdim/// 251321369Sdim/// \param X 252321369Sdim/// A 128-bit vector of [4 x float]. The values stored in bits [127:32] are 253321369Sdim/// copied to the corresponding bits of the result. 254321369Sdim/// \param Y 255321369Sdim/// A 128-bit vector of [4 x float]. The value stored in bits [31:0] is 256321369Sdim/// rounded to the nearest integer using the specified rounding control and 257321369Sdim/// copied to the corresponding bits of the result. 258321369Sdim/// \param M 259321369Sdim/// An integer value that specifies the rounding operation. \n 260321369Sdim/// Bits [7:4] are reserved. \n 261321369Sdim/// Bit [3] is a precision exception value: \n 262321369Sdim/// 0: A normal PE exception is used \n 263321369Sdim/// 1: The PE field is not updated \n 264321369Sdim/// Bit [2] is the rounding control source: \n 265321369Sdim/// 0: Use bits [1:0] of \a M \n 266321369Sdim/// 1: Use the current MXCSR setting \n 267321369Sdim/// Bits [1:0] contain the rounding control definition: \n 268321369Sdim/// 00: Nearest \n 269321369Sdim/// 01: Downward (toward negative infinity) \n 270321369Sdim/// 10: Upward (toward positive infinity) \n 271321369Sdim/// 11: Truncated 272321369Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and rounded 273321369Sdim/// values. 274341825Sdim#define _mm_round_ss(X, Y, M) \ 275296417Sdim (__m128)__builtin_ia32_roundss((__v4sf)(__m128)(X), \ 276341825Sdim (__v4sf)(__m128)(Y), (M)) 277234353Sdim 278341825Sdim/// Rounds each element of the 128-bit vector of [2 x double] to an 279321369Sdim/// integer value according to the rounding control specified by the second 280321369Sdim/// argument and returns the rounded values in a 128-bit vector of 281321369Sdim/// [2 x double]. 282321369Sdim/// 283321369Sdim/// \headerfile <x86intrin.h> 284321369Sdim/// 285321369Sdim/// \code 286321369Sdim/// __m128d _mm_round_pd(__m128d X, const int M); 287321369Sdim/// \endcode 288321369Sdim/// 289321369Sdim/// This intrinsic corresponds to the <c> VROUNDPD / ROUNDPD </c> instruction. 290321369Sdim/// 291321369Sdim/// \param X 292321369Sdim/// A 128-bit vector of [2 x double]. 293321369Sdim/// \param M 294321369Sdim/// An integer value that specifies the rounding operation. \n 295321369Sdim/// Bits [7:4] are reserved. \n 296321369Sdim/// Bit [3] is a precision exception value: \n 297321369Sdim/// 0: A normal PE exception is used \n 298321369Sdim/// 1: The PE field is not updated \n 299321369Sdim/// Bit [2] is the rounding control source: \n 300321369Sdim/// 0: Use bits [1:0] of \a M \n 301321369Sdim/// 1: Use the current MXCSR setting \n 302321369Sdim/// Bits [1:0] contain the rounding control definition: \n 303321369Sdim/// 00: Nearest \n 304321369Sdim/// 01: Downward (toward negative infinity) \n 305321369Sdim/// 10: Upward (toward positive infinity) \n 306321369Sdim/// 11: Truncated 307321369Sdim/// \returns A 128-bit vector of [2 x double] containing the rounded values. 308341825Sdim#define _mm_round_pd(X, M) \ 309341825Sdim (__m128d)__builtin_ia32_roundpd((__v2df)(__m128d)(X), (M)) 310234353Sdim 311341825Sdim/// Copies the upper element of the first 128-bit vector operand to the 312321369Sdim/// corresponding upper element of the 128-bit result vector of [2 x double]. 313321369Sdim/// Rounds the lower element of the second 128-bit vector operand to an 314321369Sdim/// integer value according to the rounding control specified by the third 315321369Sdim/// argument and copies it to the lower element of the 128-bit result vector 316321369Sdim/// of [2 x double]. 317321369Sdim/// 318321369Sdim/// \headerfile <x86intrin.h> 319321369Sdim/// 320321369Sdim/// \code 321321369Sdim/// __m128d _mm_round_sd(__m128d X, __m128d Y, const int M); 322321369Sdim/// \endcode 323321369Sdim/// 324321369Sdim/// This intrinsic corresponds to the <c> VROUNDSD / ROUNDSD </c> instruction. 325321369Sdim/// 326321369Sdim/// \param X 327321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [127:64] is 328321369Sdim/// copied to the corresponding bits of the result. 329321369Sdim/// \param Y 330321369Sdim/// A 128-bit vector of [2 x double]. The value stored in bits [63:0] is 331321369Sdim/// rounded to the nearest integer using the specified rounding control and 332321369Sdim/// copied to the corresponding bits of the result. 333321369Sdim/// \param M 334321369Sdim/// An integer value that specifies the rounding operation. \n 335321369Sdim/// Bits [7:4] are reserved. \n 336321369Sdim/// Bit [3] is a precision exception value: \n 337321369Sdim/// 0: A normal PE exception is used \n 338321369Sdim/// 1: The PE field is not updated \n 339321369Sdim/// Bit [2] is the rounding control source: \n 340321369Sdim/// 0: Use bits [1:0] of \a M \n 341321369Sdim/// 1: Use the current MXCSR setting \n 342321369Sdim/// Bits [1:0] contain the rounding control definition: \n 343321369Sdim/// 00: Nearest \n 344321369Sdim/// 01: Downward (toward negative infinity) \n 345321369Sdim/// 10: Upward (toward positive infinity) \n 346321369Sdim/// 11: Truncated 347321369Sdim/// \returns A 128-bit vector of [2 x double] containing the copied and rounded 348321369Sdim/// values. 349341825Sdim#define _mm_round_sd(X, Y, M) \ 350296417Sdim (__m128d)__builtin_ia32_roundsd((__v2df)(__m128d)(X), \ 351341825Sdim (__v2df)(__m128d)(Y), (M)) 352234353Sdim 353204793Srdivacky/* SSE4 Packed Blending Intrinsics. */ 354341825Sdim/// Returns a 128-bit vector of [2 x double] where the values are 355321369Sdim/// selected from either the first or second operand as specified by the 356321369Sdim/// third operand, the control mask. 357321369Sdim/// 358321369Sdim/// \headerfile <x86intrin.h> 359321369Sdim/// 360321369Sdim/// \code 361321369Sdim/// __m128d _mm_blend_pd(__m128d V1, __m128d V2, const int M); 362321369Sdim/// \endcode 363321369Sdim/// 364321369Sdim/// This intrinsic corresponds to the <c> VBLENDPD / BLENDPD </c> instruction. 365321369Sdim/// 366321369Sdim/// \param V1 367321369Sdim/// A 128-bit vector of [2 x double]. 368321369Sdim/// \param V2 369321369Sdim/// A 128-bit vector of [2 x double]. 370321369Sdim/// \param M 371321369Sdim/// An immediate integer operand, with mask bits [1:0] specifying how the 372321369Sdim/// values are to be copied. The position of the mask bit corresponds to the 373321369Sdim/// index of a copied value. When a mask bit is 0, the corresponding 64-bit 374321369Sdim/// element in operand \a V1 is copied to the same position in the result. 375321369Sdim/// When a mask bit is 1, the corresponding 64-bit element in operand \a V2 376321369Sdim/// is copied to the same position in the result. 377321369Sdim/// \returns A 128-bit vector of [2 x double] containing the copied values. 378341825Sdim#define _mm_blend_pd(V1, V2, M) \ 379341825Sdim (__m128d) __builtin_ia32_blendpd ((__v2df)(__m128d)(V1), \ 380341825Sdim (__v2df)(__m128d)(V2), (int)(M)) 381204793Srdivacky 382341825Sdim/// Returns a 128-bit vector of [4 x float] where the values are selected 383321369Sdim/// from either the first or second operand as specified by the third 384321369Sdim/// operand, the control mask. 385321369Sdim/// 386321369Sdim/// \headerfile <x86intrin.h> 387321369Sdim/// 388321369Sdim/// \code 389321369Sdim/// __m128 _mm_blend_ps(__m128 V1, __m128 V2, const int M); 390321369Sdim/// \endcode 391321369Sdim/// 392321369Sdim/// This intrinsic corresponds to the <c> VBLENDPS / BLENDPS </c> instruction. 393321369Sdim/// 394321369Sdim/// \param V1 395321369Sdim/// A 128-bit vector of [4 x float]. 396321369Sdim/// \param V2 397321369Sdim/// A 128-bit vector of [4 x float]. 398321369Sdim/// \param M 399321369Sdim/// An immediate integer operand, with mask bits [3:0] specifying how the 400321369Sdim/// values are to be copied. The position of the mask bit corresponds to the 401321369Sdim/// index of a copied value. When a mask bit is 0, the corresponding 32-bit 402321369Sdim/// element in operand \a V1 is copied to the same position in the result. 403321369Sdim/// When a mask bit is 1, the corresponding 32-bit element in operand \a V2 404321369Sdim/// is copied to the same position in the result. 405321369Sdim/// \returns A 128-bit vector of [4 x float] containing the copied values. 406341825Sdim#define _mm_blend_ps(V1, V2, M) \ 407341825Sdim (__m128) __builtin_ia32_blendps ((__v4sf)(__m128)(V1), \ 408341825Sdim (__v4sf)(__m128)(V2), (int)(M)) 409204793Srdivacky 410341825Sdim/// Returns a 128-bit vector of [2 x double] where the values are 411321369Sdim/// selected from either the first or second operand as specified by the 412321369Sdim/// third operand, the control mask. 413321369Sdim/// 414321369Sdim/// \headerfile <x86intrin.h> 415321369Sdim/// 416321369Sdim/// This intrinsic corresponds to the <c> VBLENDVPD / BLENDVPD </c> instruction. 417321369Sdim/// 418321369Sdim/// \param __V1 419321369Sdim/// A 128-bit vector of [2 x double]. 420321369Sdim/// \param __V2 421321369Sdim/// A 128-bit vector of [2 x double]. 422321369Sdim/// \param __M 423321369Sdim/// A 128-bit vector operand, with mask bits 127 and 63 specifying how the 424321369Sdim/// values are to be copied. The position of the mask bit corresponds to the 425321369Sdim/// most significant bit of a copied value. When a mask bit is 0, the 426321369Sdim/// corresponding 64-bit element in operand \a __V1 is copied to the same 427321369Sdim/// position in the result. When a mask bit is 1, the corresponding 64-bit 428321369Sdim/// element in operand \a __V2 is copied to the same position in the result. 429321369Sdim/// \returns A 128-bit vector of [2 x double] containing the copied values. 430288943Sdimstatic __inline__ __m128d __DEFAULT_FN_ATTRS 431204793Srdivacky_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M) 432204793Srdivacky{ 433204793Srdivacky return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2, 434204793Srdivacky (__v2df)__M); 435204793Srdivacky} 436204793Srdivacky 437341825Sdim/// Returns a 128-bit vector of [4 x float] where the values are 438321369Sdim/// selected from either the first or second operand as specified by the 439321369Sdim/// third operand, the control mask. 440321369Sdim/// 441321369Sdim/// \headerfile <x86intrin.h> 442321369Sdim/// 443321369Sdim/// This intrinsic corresponds to the <c> VBLENDVPS / BLENDVPS </c> instruction. 444321369Sdim/// 445321369Sdim/// \param __V1 446321369Sdim/// A 128-bit vector of [4 x float]. 447321369Sdim/// \param __V2 448321369Sdim/// A 128-bit vector of [4 x float]. 449321369Sdim/// \param __M 450321369Sdim/// A 128-bit vector operand, with mask bits 127, 95, 63, and 31 specifying 451321369Sdim/// how the values are to be copied. The position of the mask bit corresponds 452321369Sdim/// to the most significant bit of a copied value. When a mask bit is 0, the 453321369Sdim/// corresponding 32-bit element in operand \a __V1 is copied to the same 454321369Sdim/// position in the result. When a mask bit is 1, the corresponding 32-bit 455321369Sdim/// element in operand \a __V2 is copied to the same position in the result. 456321369Sdim/// \returns A 128-bit vector of [4 x float] containing the copied values. 457288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 458204793Srdivacky_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M) 459204793Srdivacky{ 460204793Srdivacky return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2, 461204793Srdivacky (__v4sf)__M); 462204793Srdivacky} 463204793Srdivacky 464341825Sdim/// Returns a 128-bit vector of [16 x i8] where the values are selected 465321369Sdim/// from either of the first or second operand as specified by the third 466321369Sdim/// operand, the control mask. 467321369Sdim/// 468321369Sdim/// \headerfile <x86intrin.h> 469321369Sdim/// 470321369Sdim/// This intrinsic corresponds to the <c> VPBLENDVB / PBLENDVB </c> instruction. 471321369Sdim/// 472321369Sdim/// \param __V1 473321369Sdim/// A 128-bit vector of [16 x i8]. 474321369Sdim/// \param __V2 475321369Sdim/// A 128-bit vector of [16 x i8]. 476321369Sdim/// \param __M 477341825Sdim/// A 128-bit vector operand, with mask bits 127, 119, 111...7 specifying 478321369Sdim/// how the values are to be copied. The position of the mask bit corresponds 479321369Sdim/// to the most significant bit of a copied value. When a mask bit is 0, the 480321369Sdim/// corresponding 8-bit element in operand \a __V1 is copied to the same 481321369Sdim/// position in the result. When a mask bit is 1, the corresponding 8-bit 482321369Sdim/// element in operand \a __V2 is copied to the same position in the result. 483321369Sdim/// \returns A 128-bit vector of [16 x i8] containing the copied values. 484288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 485204793Srdivacky_mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M) 486204793Srdivacky{ 487204793Srdivacky return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2, 488204793Srdivacky (__v16qi)__M); 489204793Srdivacky} 490204793Srdivacky 491341825Sdim/// Returns a 128-bit vector of [8 x i16] where the values are selected 492321369Sdim/// from either of the first or second operand as specified by the third 493321369Sdim/// operand, the control mask. 494321369Sdim/// 495321369Sdim/// \headerfile <x86intrin.h> 496321369Sdim/// 497321369Sdim/// \code 498321369Sdim/// __m128i _mm_blend_epi16(__m128i V1, __m128i V2, const int M); 499321369Sdim/// \endcode 500321369Sdim/// 501321369Sdim/// This intrinsic corresponds to the <c> VPBLENDW / PBLENDW </c> instruction. 502321369Sdim/// 503321369Sdim/// \param V1 504321369Sdim/// A 128-bit vector of [8 x i16]. 505321369Sdim/// \param V2 506321369Sdim/// A 128-bit vector of [8 x i16]. 507321369Sdim/// \param M 508321369Sdim/// An immediate integer operand, with mask bits [7:0] specifying how the 509321369Sdim/// values are to be copied. The position of the mask bit corresponds to the 510321369Sdim/// index of a copied value. When a mask bit is 0, the corresponding 16-bit 511321369Sdim/// element in operand \a V1 is copied to the same position in the result. 512321369Sdim/// When a mask bit is 1, the corresponding 16-bit element in operand \a V2 513321369Sdim/// is copied to the same position in the result. 514321369Sdim/// \returns A 128-bit vector of [8 x i16] containing the copied values. 515341825Sdim#define _mm_blend_epi16(V1, V2, M) \ 516341825Sdim (__m128i) __builtin_ia32_pblendw128 ((__v8hi)(__m128i)(V1), \ 517341825Sdim (__v8hi)(__m128i)(V2), (int)(M)) 518204793Srdivacky 519204962Srdivacky/* SSE4 Dword Multiply Instructions. */ 520341825Sdim/// Multiples corresponding elements of two 128-bit vectors of [4 x i32] 521321369Sdim/// and returns the lower 32 bits of the each product in a 128-bit vector of 522321369Sdim/// [4 x i32]. 523321369Sdim/// 524321369Sdim/// \headerfile <x86intrin.h> 525321369Sdim/// 526321369Sdim/// This intrinsic corresponds to the <c> VPMULLD / PMULLD </c> instruction. 527321369Sdim/// 528321369Sdim/// \param __V1 529321369Sdim/// A 128-bit integer vector. 530321369Sdim/// \param __V2 531321369Sdim/// A 128-bit integer vector. 532321369Sdim/// \returns A 128-bit integer vector containing the products of both operands. 533288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 534204962Srdivacky_mm_mullo_epi32 (__m128i __V1, __m128i __V2) 535204962Srdivacky{ 536309124Sdim return (__m128i) ((__v4su)__V1 * (__v4su)__V2); 537204962Srdivacky} 538204962Srdivacky 539341825Sdim/// Multiplies corresponding even-indexed elements of two 128-bit 540321369Sdim/// vectors of [4 x i32] and returns a 128-bit vector of [2 x i64] 541321369Sdim/// containing the products. 542321369Sdim/// 543321369Sdim/// \headerfile <x86intrin.h> 544321369Sdim/// 545321369Sdim/// This intrinsic corresponds to the <c> VPMULDQ / PMULDQ </c> instruction. 546321369Sdim/// 547321369Sdim/// \param __V1 548321369Sdim/// A 128-bit vector of [4 x i32]. 549321369Sdim/// \param __V2 550321369Sdim/// A 128-bit vector of [4 x i32]. 551321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the products of both 552321369Sdim/// operands. 553288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 554204962Srdivacky_mm_mul_epi32 (__m128i __V1, __m128i __V2) 555204962Srdivacky{ 556204962Srdivacky return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2); 557204962Srdivacky} 558204962Srdivacky 559204962Srdivacky/* SSE4 Floating Point Dot Product Instructions. */ 560341825Sdim/// Computes the dot product of the two 128-bit vectors of [4 x float] 561321369Sdim/// and returns it in the elements of the 128-bit result vector of 562321369Sdim/// [4 x float]. 563321369Sdim/// 564321369Sdim/// The immediate integer operand controls which input elements 565321369Sdim/// will contribute to the dot product, and where the final results are 566321369Sdim/// returned. 567321369Sdim/// 568321369Sdim/// \headerfile <x86intrin.h> 569321369Sdim/// 570321369Sdim/// \code 571321369Sdim/// __m128 _mm_dp_ps(__m128 X, __m128 Y, const int M); 572321369Sdim/// \endcode 573321369Sdim/// 574321369Sdim/// This intrinsic corresponds to the <c> VDPPS / DPPS </c> instruction. 575321369Sdim/// 576321369Sdim/// \param X 577321369Sdim/// A 128-bit vector of [4 x float]. 578321369Sdim/// \param Y 579321369Sdim/// A 128-bit vector of [4 x float]. 580321369Sdim/// \param M 581321369Sdim/// An immediate integer operand. Mask bits [7:4] determine which elements 582321369Sdim/// of the input vectors are used, with bit [4] corresponding to the lowest 583321369Sdim/// element and bit [7] corresponding to the highest element of each [4 x 584321369Sdim/// float] vector. If a bit is set, the corresponding elements from the two 585321369Sdim/// input vectors are used as an input for dot product; otherwise that input 586321369Sdim/// is treated as zero. Bits [3:0] determine which elements of the result 587321369Sdim/// will receive a copy of the final dot product, with bit [0] corresponding 588321369Sdim/// to the lowest element and bit [3] corresponding to the highest element of 589321369Sdim/// each [4 x float] subvector. If a bit is set, the dot product is returned 590321369Sdim/// in the corresponding element; otherwise that element is set to zero. 591321369Sdim/// \returns A 128-bit vector of [4 x float] containing the dot product. 592341825Sdim#define _mm_dp_ps(X, Y, M) \ 593296417Sdim (__m128) __builtin_ia32_dpps((__v4sf)(__m128)(X), \ 594341825Sdim (__v4sf)(__m128)(Y), (M)) 595204962Srdivacky 596341825Sdim/// Computes the dot product of the two 128-bit vectors of [2 x double] 597321369Sdim/// and returns it in the elements of the 128-bit result vector of 598321369Sdim/// [2 x double]. 599321369Sdim/// 600321369Sdim/// The immediate integer operand controls which input 601321369Sdim/// elements will contribute to the dot product, and where the final results 602321369Sdim/// are returned. 603321369Sdim/// 604321369Sdim/// \headerfile <x86intrin.h> 605321369Sdim/// 606321369Sdim/// \code 607321369Sdim/// __m128d _mm_dp_pd(__m128d X, __m128d Y, const int M); 608321369Sdim/// \endcode 609321369Sdim/// 610321369Sdim/// This intrinsic corresponds to the <c> VDPPD / DPPD </c> instruction. 611321369Sdim/// 612321369Sdim/// \param X 613321369Sdim/// A 128-bit vector of [2 x double]. 614321369Sdim/// \param Y 615321369Sdim/// A 128-bit vector of [2 x double]. 616321369Sdim/// \param M 617321369Sdim/// An immediate integer operand. Mask bits [5:4] determine which elements 618321369Sdim/// of the input vectors are used, with bit [4] corresponding to the lowest 619321369Sdim/// element and bit [5] corresponding to the highest element of each of [2 x 620321369Sdim/// double] vector. If a bit is set, the corresponding elements from the two 621321369Sdim/// input vectors are used as an input for dot product; otherwise that input 622321369Sdim/// is treated as zero. Bits [1:0] determine which elements of the result 623321369Sdim/// will receive a copy of the final dot product, with bit [0] corresponding 624327952Sdim/// to the lowest element and bit [1] corresponding to the highest element of 625321369Sdim/// each [2 x double] vector. If a bit is set, the dot product is returned in 626321369Sdim/// the corresponding element; otherwise that element is set to zero. 627341825Sdim#define _mm_dp_pd(X, Y, M) \ 628296417Sdim (__m128d) __builtin_ia32_dppd((__v2df)(__m128d)(X), \ 629341825Sdim (__v2df)(__m128d)(Y), (M)) 630234353Sdim 631204962Srdivacky/* SSE4 Streaming Load Hint Instruction. */ 632341825Sdim/// Loads integer values from a 128-bit aligned memory location to a 633321369Sdim/// 128-bit integer vector. 634321369Sdim/// 635321369Sdim/// \headerfile <x86intrin.h> 636321369Sdim/// 637321369Sdim/// This intrinsic corresponds to the <c> VMOVNTDQA / MOVNTDQA </c> instruction. 638321369Sdim/// 639321369Sdim/// \param __V 640321369Sdim/// A pointer to a 128-bit aligned memory location that contains the integer 641321369Sdim/// values. 642321369Sdim/// \returns A 128-bit integer vector containing the data stored at the 643321369Sdim/// specified memory location. 644288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 645296417Sdim_mm_stream_load_si128 (__m128i const *__V) 646204962Srdivacky{ 647321369Sdim return (__m128i) __builtin_nontemporal_load ((const __v2di *) __V); 648204962Srdivacky} 649204962Srdivacky 650204962Srdivacky/* SSE4 Packed Integer Min/Max Instructions. */ 651341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 652321369Sdim/// [16 x i8] and returns a 128-bit vector of [16 x i8] containing the lesser 653321369Sdim/// of the two values. 654321369Sdim/// 655321369Sdim/// \headerfile <x86intrin.h> 656321369Sdim/// 657321369Sdim/// This intrinsic corresponds to the <c> VPMINSB / PMINSB </c> instruction. 658321369Sdim/// 659321369Sdim/// \param __V1 660321369Sdim/// A 128-bit vector of [16 x i8]. 661321369Sdim/// \param __V2 662321369Sdim/// A 128-bit vector of [16 x i8] 663321369Sdim/// \returns A 128-bit vector of [16 x i8] containing the lesser values. 664288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 665204962Srdivacky_mm_min_epi8 (__m128i __V1, __m128i __V2) 666204962Srdivacky{ 667204962Srdivacky return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2); 668204962Srdivacky} 669204962Srdivacky 670341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 671321369Sdim/// [16 x i8] and returns a 128-bit vector of [16 x i8] containing the 672321369Sdim/// greater value of the two. 673321369Sdim/// 674321369Sdim/// \headerfile <x86intrin.h> 675321369Sdim/// 676321369Sdim/// This intrinsic corresponds to the <c> VPMAXSB / PMAXSB </c> instruction. 677321369Sdim/// 678321369Sdim/// \param __V1 679321369Sdim/// A 128-bit vector of [16 x i8]. 680321369Sdim/// \param __V2 681321369Sdim/// A 128-bit vector of [16 x i8]. 682321369Sdim/// \returns A 128-bit vector of [16 x i8] containing the greater values. 683288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 684204962Srdivacky_mm_max_epi8 (__m128i __V1, __m128i __V2) 685204962Srdivacky{ 686204962Srdivacky return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2); 687204962Srdivacky} 688204962Srdivacky 689341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 690321369Sdim/// [8 x u16] and returns a 128-bit vector of [8 x u16] containing the lesser 691321369Sdim/// value of the two. 692321369Sdim/// 693321369Sdim/// \headerfile <x86intrin.h> 694321369Sdim/// 695321369Sdim/// This intrinsic corresponds to the <c> VPMINUW / PMINUW </c> instruction. 696321369Sdim/// 697321369Sdim/// \param __V1 698321369Sdim/// A 128-bit vector of [8 x u16]. 699321369Sdim/// \param __V2 700321369Sdim/// A 128-bit vector of [8 x u16]. 701321369Sdim/// \returns A 128-bit vector of [8 x u16] containing the lesser values. 702288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 703204962Srdivacky_mm_min_epu16 (__m128i __V1, __m128i __V2) 704204962Srdivacky{ 705204962Srdivacky return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2); 706204962Srdivacky} 707204962Srdivacky 708341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 709321369Sdim/// [8 x u16] and returns a 128-bit vector of [8 x u16] containing the 710321369Sdim/// greater value of the two. 711321369Sdim/// 712321369Sdim/// \headerfile <x86intrin.h> 713321369Sdim/// 714321369Sdim/// This intrinsic corresponds to the <c> VPMAXUW / PMAXUW </c> instruction. 715321369Sdim/// 716321369Sdim/// \param __V1 717321369Sdim/// A 128-bit vector of [8 x u16]. 718321369Sdim/// \param __V2 719321369Sdim/// A 128-bit vector of [8 x u16]. 720321369Sdim/// \returns A 128-bit vector of [8 x u16] containing the greater values. 721288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 722204962Srdivacky_mm_max_epu16 (__m128i __V1, __m128i __V2) 723204962Srdivacky{ 724204962Srdivacky return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2); 725204962Srdivacky} 726204962Srdivacky 727341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 728321369Sdim/// [4 x i32] and returns a 128-bit vector of [4 x i32] containing the lesser 729321369Sdim/// value of the two. 730321369Sdim/// 731321369Sdim/// \headerfile <x86intrin.h> 732321369Sdim/// 733321369Sdim/// This intrinsic corresponds to the <c> VPMINSD / PMINSD </c> instruction. 734321369Sdim/// 735321369Sdim/// \param __V1 736321369Sdim/// A 128-bit vector of [4 x i32]. 737321369Sdim/// \param __V2 738321369Sdim/// A 128-bit vector of [4 x i32]. 739321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the lesser values. 740288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 741204962Srdivacky_mm_min_epi32 (__m128i __V1, __m128i __V2) 742204962Srdivacky{ 743204962Srdivacky return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2); 744204962Srdivacky} 745204962Srdivacky 746341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 747321369Sdim/// [4 x i32] and returns a 128-bit vector of [4 x i32] containing the 748321369Sdim/// greater value of the two. 749321369Sdim/// 750321369Sdim/// \headerfile <x86intrin.h> 751321369Sdim/// 752321369Sdim/// This intrinsic corresponds to the <c> VPMAXSD / PMAXSD </c> instruction. 753321369Sdim/// 754321369Sdim/// \param __V1 755321369Sdim/// A 128-bit vector of [4 x i32]. 756321369Sdim/// \param __V2 757321369Sdim/// A 128-bit vector of [4 x i32]. 758321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the greater values. 759288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 760204962Srdivacky_mm_max_epi32 (__m128i __V1, __m128i __V2) 761204962Srdivacky{ 762204962Srdivacky return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2); 763204962Srdivacky} 764204962Srdivacky 765341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 766321369Sdim/// [4 x u32] and returns a 128-bit vector of [4 x u32] containing the lesser 767321369Sdim/// value of the two. 768321369Sdim/// 769321369Sdim/// \headerfile <x86intrin.h> 770321369Sdim/// 771321369Sdim/// This intrinsic corresponds to the <c> VPMINUD / PMINUD </c> instruction. 772321369Sdim/// 773321369Sdim/// \param __V1 774321369Sdim/// A 128-bit vector of [4 x u32]. 775321369Sdim/// \param __V2 776321369Sdim/// A 128-bit vector of [4 x u32]. 777321369Sdim/// \returns A 128-bit vector of [4 x u32] containing the lesser values. 778288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 779204962Srdivacky_mm_min_epu32 (__m128i __V1, __m128i __V2) 780204962Srdivacky{ 781204962Srdivacky return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2); 782204962Srdivacky} 783204962Srdivacky 784341825Sdim/// Compares the corresponding elements of two 128-bit vectors of 785321369Sdim/// [4 x u32] and returns a 128-bit vector of [4 x u32] containing the 786321369Sdim/// greater value of the two. 787321369Sdim/// 788321369Sdim/// \headerfile <x86intrin.h> 789321369Sdim/// 790321369Sdim/// This intrinsic corresponds to the <c> VPMAXUD / PMAXUD </c> instruction. 791321369Sdim/// 792321369Sdim/// \param __V1 793321369Sdim/// A 128-bit vector of [4 x u32]. 794321369Sdim/// \param __V2 795321369Sdim/// A 128-bit vector of [4 x u32]. 796321369Sdim/// \returns A 128-bit vector of [4 x u32] containing the greater values. 797288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 798204962Srdivacky_mm_max_epu32 (__m128i __V1, __m128i __V2) 799204962Srdivacky{ 800204962Srdivacky return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2); 801204962Srdivacky} 802204962Srdivacky 803204962Srdivacky/* SSE4 Insertion and Extraction from XMM Register Instructions. */ 804341825Sdim/// Takes the first argument \a X and inserts an element from the second 805321369Sdim/// argument \a Y as selected by the third argument \a N. That result then 806321369Sdim/// has elements zeroed out also as selected by the third argument \a N. The 807321369Sdim/// resulting 128-bit vector of [4 x float] is then returned. 808321369Sdim/// 809321369Sdim/// \headerfile <x86intrin.h> 810321369Sdim/// 811321369Sdim/// \code 812321369Sdim/// __m128 _mm_insert_ps(__m128 X, __m128 Y, const int N); 813321369Sdim/// \endcode 814321369Sdim/// 815321369Sdim/// This intrinsic corresponds to the <c> VINSERTPS </c> instruction. 816321369Sdim/// 817321369Sdim/// \param X 818321369Sdim/// A 128-bit vector source operand of [4 x float]. With the exception of 819321369Sdim/// those bits in the result copied from parameter \a Y and zeroed by bits 820321369Sdim/// [3:0] of \a N, all bits from this parameter are copied to the result. 821321369Sdim/// \param Y 822321369Sdim/// A 128-bit vector source operand of [4 x float]. One single-precision 823321369Sdim/// floating-point element from this source, as determined by the immediate 824321369Sdim/// parameter, is copied to the result. 825321369Sdim/// \param N 826321369Sdim/// Specifies which bits from operand \a Y will be copied, which bits in the 827321369Sdim/// result they will be be copied to, and which bits in the result will be 828321369Sdim/// cleared. The following assignments are made: \n 829321369Sdim/// Bits [7:6] specify the bits to copy from operand \a Y: \n 830321369Sdim/// 00: Selects bits [31:0] from operand \a Y. \n 831321369Sdim/// 01: Selects bits [63:32] from operand \a Y. \n 832321369Sdim/// 10: Selects bits [95:64] from operand \a Y. \n 833321369Sdim/// 11: Selects bits [127:96] from operand \a Y. \n 834321369Sdim/// Bits [5:4] specify the bits in the result to which the selected bits 835321369Sdim/// from operand \a Y are copied: \n 836321369Sdim/// 00: Copies the selected bits from \a Y to result bits [31:0]. \n 837321369Sdim/// 01: Copies the selected bits from \a Y to result bits [63:32]. \n 838321369Sdim/// 10: Copies the selected bits from \a Y to result bits [95:64]. \n 839321369Sdim/// 11: Copies the selected bits from \a Y to result bits [127:96]. \n 840321369Sdim/// Bits[3:0]: If any of these bits are set, the corresponding result 841321369Sdim/// element is cleared. 842327952Sdim/// \returns A 128-bit vector of [4 x float] containing the copied 843327952Sdim/// single-precision floating point elements from the operands. 844204962Srdivacky#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N)) 845321369Sdim 846341825Sdim/// Extracts a 32-bit integer from a 128-bit vector of [4 x float] and 847321369Sdim/// returns it, using the immediate value parameter \a N as a selector. 848321369Sdim/// 849321369Sdim/// \headerfile <x86intrin.h> 850321369Sdim/// 851321369Sdim/// \code 852321369Sdim/// int _mm_extract_ps(__m128 X, const int N); 853321369Sdim/// \endcode 854321369Sdim/// 855321369Sdim/// This intrinsic corresponds to the <c> VEXTRACTPS / EXTRACTPS </c> 856321369Sdim/// instruction. 857321369Sdim/// 858321369Sdim/// \param X 859321369Sdim/// A 128-bit vector of [4 x float]. 860321369Sdim/// \param N 861321369Sdim/// An immediate value. Bits [1:0] determines which bits from the argument 862321369Sdim/// \a X are extracted and returned: \n 863321369Sdim/// 00: Bits [31:0] of parameter \a X are returned. \n 864321369Sdim/// 01: Bits [63:32] of parameter \a X are returned. \n 865321369Sdim/// 10: Bits [95:64] of parameter \a X are returned. \n 866321369Sdim/// 11: Bits [127:96] of parameter \a X are returned. 867321369Sdim/// \returns A 32-bit integer containing the extracted 32 bits of float data. 868204962Srdivacky#define _mm_extract_ps(X, N) (__extension__ \ 869341825Sdim ({ union { int __i; float __f; } __t; \ 870341825Sdim __t.__f = __builtin_ia32_vec_ext_v4sf((__v4sf)(__m128)(X), (int)(N)); \ 871341825Sdim __t.__i;})) 872204962Srdivacky 873204962Srdivacky/* Miscellaneous insert and extract macros. */ 874204962Srdivacky/* Extract a single-precision float from X at index N into D. */ 875341825Sdim#define _MM_EXTRACT_FLOAT(D, X, N) \ 876341825Sdim { (D) = __builtin_ia32_vec_ext_v4sf((__v4sf)(__m128)(X), (int)(N)); } 877296417Sdim 878204962Srdivacky/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create 879204962Srdivacky an index suitable for _mm_insert_ps. */ 880204962Srdivacky#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z)) 881296417Sdim 882204962Srdivacky/* Extract a float from X at index N into the first index of the return. */ 883204962Srdivacky#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X), \ 884204962Srdivacky _MM_MK_INSERTPS_NDX((N), 0, 0x0e)) 885296417Sdim 886205219Srdivacky/* Insert int into packed integer array at index. */ 887341825Sdim/// Constructs a 128-bit vector of [16 x i8] by first making a copy of 888321369Sdim/// the 128-bit integer vector parameter, and then inserting the lower 8 bits 889321369Sdim/// of an integer parameter \a I into an offset specified by the immediate 890321369Sdim/// value parameter \a N. 891321369Sdim/// 892321369Sdim/// \headerfile <x86intrin.h> 893321369Sdim/// 894321369Sdim/// \code 895321369Sdim/// __m128i _mm_insert_epi8(__m128i X, int I, const int N); 896321369Sdim/// \endcode 897321369Sdim/// 898321369Sdim/// This intrinsic corresponds to the <c> VPINSRB / PINSRB </c> instruction. 899321369Sdim/// 900321369Sdim/// \param X 901321369Sdim/// A 128-bit integer vector of [16 x i8]. This vector is copied to the 902321369Sdim/// result and then one of the sixteen elements in the result vector is 903321369Sdim/// replaced by the lower 8 bits of \a I. 904321369Sdim/// \param I 905321369Sdim/// An integer. The lower 8 bits of this operand are written to the result 906321369Sdim/// beginning at the offset specified by \a N. 907321369Sdim/// \param N 908321369Sdim/// An immediate value. Bits [3:0] specify the bit offset in the result at 909321369Sdim/// which the lower 8 bits of \a I are written. \n 910321369Sdim/// 0000: Bits [7:0] of the result are used for insertion. \n 911321369Sdim/// 0001: Bits [15:8] of the result are used for insertion. \n 912321369Sdim/// 0010: Bits [23:16] of the result are used for insertion. \n 913321369Sdim/// 0011: Bits [31:24] of the result are used for insertion. \n 914321369Sdim/// 0100: Bits [39:32] of the result are used for insertion. \n 915321369Sdim/// 0101: Bits [47:40] of the result are used for insertion. \n 916321369Sdim/// 0110: Bits [55:48] of the result are used for insertion. \n 917321369Sdim/// 0111: Bits [63:56] of the result are used for insertion. \n 918321369Sdim/// 1000: Bits [71:64] of the result are used for insertion. \n 919321369Sdim/// 1001: Bits [79:72] of the result are used for insertion. \n 920321369Sdim/// 1010: Bits [87:80] of the result are used for insertion. \n 921321369Sdim/// 1011: Bits [95:88] of the result are used for insertion. \n 922321369Sdim/// 1100: Bits [103:96] of the result are used for insertion. \n 923321369Sdim/// 1101: Bits [111:104] of the result are used for insertion. \n 924321369Sdim/// 1110: Bits [119:112] of the result are used for insertion. \n 925321369Sdim/// 1111: Bits [127:120] of the result are used for insertion. 926321369Sdim/// \returns A 128-bit integer vector containing the constructed values. 927341825Sdim#define _mm_insert_epi8(X, I, N) \ 928341825Sdim (__m128i)__builtin_ia32_vec_set_v16qi((__v16qi)(__m128i)(X), \ 929341825Sdim (int)(I), (int)(N)) 930321369Sdim 931341825Sdim/// Constructs a 128-bit vector of [4 x i32] by first making a copy of 932321369Sdim/// the 128-bit integer vector parameter, and then inserting the 32-bit 933321369Sdim/// integer parameter \a I at the offset specified by the immediate value 934321369Sdim/// parameter \a N. 935321369Sdim/// 936321369Sdim/// \headerfile <x86intrin.h> 937321369Sdim/// 938321369Sdim/// \code 939321369Sdim/// __m128i _mm_insert_epi32(__m128i X, int I, const int N); 940321369Sdim/// \endcode 941321369Sdim/// 942321369Sdim/// This intrinsic corresponds to the <c> VPINSRD / PINSRD </c> instruction. 943321369Sdim/// 944321369Sdim/// \param X 945321369Sdim/// A 128-bit integer vector of [4 x i32]. This vector is copied to the 946321369Sdim/// result and then one of the four elements in the result vector is 947321369Sdim/// replaced by \a I. 948321369Sdim/// \param I 949321369Sdim/// A 32-bit integer that is written to the result beginning at the offset 950321369Sdim/// specified by \a N. 951321369Sdim/// \param N 952321369Sdim/// An immediate value. Bits [1:0] specify the bit offset in the result at 953321369Sdim/// which the integer \a I is written. \n 954321369Sdim/// 00: Bits [31:0] of the result are used for insertion. \n 955321369Sdim/// 01: Bits [63:32] of the result are used for insertion. \n 956321369Sdim/// 10: Bits [95:64] of the result are used for insertion. \n 957321369Sdim/// 11: Bits [127:96] of the result are used for insertion. 958321369Sdim/// \returns A 128-bit integer vector containing the constructed values. 959341825Sdim#define _mm_insert_epi32(X, I, N) \ 960341825Sdim (__m128i)__builtin_ia32_vec_set_v4si((__v4si)(__m128i)(X), \ 961341825Sdim (int)(I), (int)(N)) 962321369Sdim 963205219Srdivacky#ifdef __x86_64__ 964341825Sdim/// Constructs a 128-bit vector of [2 x i64] by first making a copy of 965321369Sdim/// the 128-bit integer vector parameter, and then inserting the 64-bit 966321369Sdim/// integer parameter \a I, using the immediate value parameter \a N as an 967321369Sdim/// insertion location selector. 968321369Sdim/// 969321369Sdim/// \headerfile <x86intrin.h> 970321369Sdim/// 971321369Sdim/// \code 972321369Sdim/// __m128i _mm_insert_epi64(__m128i X, long long I, const int N); 973321369Sdim/// \endcode 974321369Sdim/// 975321369Sdim/// This intrinsic corresponds to the <c> VPINSRQ / PINSRQ </c> instruction. 976321369Sdim/// 977321369Sdim/// \param X 978321369Sdim/// A 128-bit integer vector of [2 x i64]. This vector is copied to the 979321369Sdim/// result and then one of the two elements in the result vector is replaced 980321369Sdim/// by \a I. 981321369Sdim/// \param I 982321369Sdim/// A 64-bit integer that is written to the result beginning at the offset 983321369Sdim/// specified by \a N. 984321369Sdim/// \param N 985321369Sdim/// An immediate value. Bit [0] specifies the bit offset in the result at 986321369Sdim/// which the integer \a I is written. \n 987321369Sdim/// 0: Bits [63:0] of the result are used for insertion. \n 988321369Sdim/// 1: Bits [127:64] of the result are used for insertion. \n 989321369Sdim/// \returns A 128-bit integer vector containing the constructed values. 990341825Sdim#define _mm_insert_epi64(X, I, N) \ 991341825Sdim (__m128i)__builtin_ia32_vec_set_v2di((__v2di)(__m128i)(X), \ 992341825Sdim (long long)(I), (int)(N)) 993205219Srdivacky#endif /* __x86_64__ */ 994204962Srdivacky 995212904Sdim/* Extract int from packed integer array at index. This returns the element 996212904Sdim * as a zero extended value, so it is unsigned. 997212904Sdim */ 998341825Sdim/// Extracts an 8-bit element from the 128-bit integer vector of 999321369Sdim/// [16 x i8], using the immediate value parameter \a N as a selector. 1000321369Sdim/// 1001321369Sdim/// \headerfile <x86intrin.h> 1002321369Sdim/// 1003321369Sdim/// \code 1004321369Sdim/// int _mm_extract_epi8(__m128i X, const int N); 1005321369Sdim/// \endcode 1006321369Sdim/// 1007321369Sdim/// This intrinsic corresponds to the <c> VPEXTRB / PEXTRB </c> instruction. 1008321369Sdim/// 1009321369Sdim/// \param X 1010321369Sdim/// A 128-bit integer vector. 1011321369Sdim/// \param N 1012321369Sdim/// An immediate value. Bits [3:0] specify which 8-bit vector element from 1013321369Sdim/// the argument \a X to extract and copy to the result. \n 1014321369Sdim/// 0000: Bits [7:0] of parameter \a X are extracted. \n 1015321369Sdim/// 0001: Bits [15:8] of the parameter \a X are extracted. \n 1016321369Sdim/// 0010: Bits [23:16] of the parameter \a X are extracted. \n 1017321369Sdim/// 0011: Bits [31:24] of the parameter \a X are extracted. \n 1018321369Sdim/// 0100: Bits [39:32] of the parameter \a X are extracted. \n 1019321369Sdim/// 0101: Bits [47:40] of the parameter \a X are extracted. \n 1020321369Sdim/// 0110: Bits [55:48] of the parameter \a X are extracted. \n 1021321369Sdim/// 0111: Bits [63:56] of the parameter \a X are extracted. \n 1022321369Sdim/// 1000: Bits [71:64] of the parameter \a X are extracted. \n 1023321369Sdim/// 1001: Bits [79:72] of the parameter \a X are extracted. \n 1024321369Sdim/// 1010: Bits [87:80] of the parameter \a X are extracted. \n 1025321369Sdim/// 1011: Bits [95:88] of the parameter \a X are extracted. \n 1026321369Sdim/// 1100: Bits [103:96] of the parameter \a X are extracted. \n 1027321369Sdim/// 1101: Bits [111:104] of the parameter \a X are extracted. \n 1028321369Sdim/// 1110: Bits [119:112] of the parameter \a X are extracted. \n 1029321369Sdim/// 1111: Bits [127:120] of the parameter \a X are extracted. 1030321369Sdim/// \returns An unsigned integer, whose lower 8 bits are selected from the 1031321369Sdim/// 128-bit integer vector parameter and the remaining bits are assigned 1032321369Sdim/// zeros. 1033341825Sdim#define _mm_extract_epi8(X, N) \ 1034341825Sdim (int)(unsigned char)__builtin_ia32_vec_ext_v16qi((__v16qi)(__m128i)(X), \ 1035341825Sdim (int)(N)) 1036321369Sdim 1037341825Sdim/// Extracts a 32-bit element from the 128-bit integer vector of 1038321369Sdim/// [4 x i32], using the immediate value parameter \a N as a selector. 1039321369Sdim/// 1040321369Sdim/// \headerfile <x86intrin.h> 1041321369Sdim/// 1042321369Sdim/// \code 1043321369Sdim/// int _mm_extract_epi32(__m128i X, const int N); 1044321369Sdim/// \endcode 1045321369Sdim/// 1046321369Sdim/// This intrinsic corresponds to the <c> VPEXTRD / PEXTRD </c> instruction. 1047321369Sdim/// 1048321369Sdim/// \param X 1049321369Sdim/// A 128-bit integer vector. 1050321369Sdim/// \param N 1051321369Sdim/// An immediate value. Bits [1:0] specify which 32-bit vector element from 1052321369Sdim/// the argument \a X to extract and copy to the result. \n 1053321369Sdim/// 00: Bits [31:0] of the parameter \a X are extracted. \n 1054321369Sdim/// 01: Bits [63:32] of the parameter \a X are extracted. \n 1055321369Sdim/// 10: Bits [95:64] of the parameter \a X are extracted. \n 1056321369Sdim/// 11: Bits [127:96] of the parameter \a X are exracted. 1057321369Sdim/// \returns An integer, whose lower 32 bits are selected from the 128-bit 1058321369Sdim/// integer vector parameter and the remaining bits are assigned zeros. 1059341825Sdim#define _mm_extract_epi32(X, N) \ 1060341825Sdim (int)__builtin_ia32_vec_ext_v4si((__v4si)(__m128i)(X), (int)(N)) 1061321369Sdim 1062205219Srdivacky#ifdef __x86_64__ 1063341825Sdim/// Extracts a 64-bit element from the 128-bit integer vector of 1064321369Sdim/// [2 x i64], using the immediate value parameter \a N as a selector. 1065321369Sdim/// 1066321369Sdim/// \headerfile <x86intrin.h> 1067321369Sdim/// 1068321369Sdim/// \code 1069321369Sdim/// long long _mm_extract_epi64(__m128i X, const int N); 1070321369Sdim/// \endcode 1071321369Sdim/// 1072321369Sdim/// This intrinsic corresponds to the <c> VPEXTRQ / PEXTRQ </c> instruction. 1073321369Sdim/// 1074321369Sdim/// \param X 1075321369Sdim/// A 128-bit integer vector. 1076321369Sdim/// \param N 1077321369Sdim/// An immediate value. Bit [0] specifies which 64-bit vector element from 1078321369Sdim/// the argument \a X to return. \n 1079321369Sdim/// 0: Bits [63:0] are returned. \n 1080321369Sdim/// 1: Bits [127:64] are returned. \n 1081321369Sdim/// \returns A 64-bit integer. 1082341825Sdim#define _mm_extract_epi64(X, N) \ 1083341825Sdim (long long)__builtin_ia32_vec_ext_v2di((__v2di)(__m128i)(X), (int)(N)) 1084205219Srdivacky#endif /* __x86_64 */ 1085205219Srdivacky 1086205219Srdivacky/* SSE4 128-bit Packed Integer Comparisons. */ 1087341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are all 1088321369Sdim/// zeros. 1089321369Sdim/// 1090321369Sdim/// \headerfile <x86intrin.h> 1091321369Sdim/// 1092321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1093321369Sdim/// 1094321369Sdim/// \param __M 1095321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1096321369Sdim/// \param __V 1097321369Sdim/// A 128-bit integer vector selecting which bits to test in operand \a __M. 1098321369Sdim/// \returns TRUE if the specified bits are all zeros; FALSE otherwise. 1099288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1100205219Srdivacky_mm_testz_si128(__m128i __M, __m128i __V) 1101205219Srdivacky{ 1102205219Srdivacky return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V); 1103205219Srdivacky} 1104205219Srdivacky 1105341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are all 1106321369Sdim/// ones. 1107321369Sdim/// 1108321369Sdim/// \headerfile <x86intrin.h> 1109321369Sdim/// 1110321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1111321369Sdim/// 1112321369Sdim/// \param __M 1113321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1114321369Sdim/// \param __V 1115321369Sdim/// A 128-bit integer vector selecting which bits to test in operand \a __M. 1116321369Sdim/// \returns TRUE if the specified bits are all ones; FALSE otherwise. 1117288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1118205219Srdivacky_mm_testc_si128(__m128i __M, __m128i __V) 1119205219Srdivacky{ 1120205219Srdivacky return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V); 1121205219Srdivacky} 1122205219Srdivacky 1123341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are 1124321369Sdim/// neither all zeros nor all ones. 1125321369Sdim/// 1126321369Sdim/// \headerfile <x86intrin.h> 1127321369Sdim/// 1128321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1129321369Sdim/// 1130321369Sdim/// \param __M 1131321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1132321369Sdim/// \param __V 1133321369Sdim/// A 128-bit integer vector selecting which bits to test in operand \a __M. 1134321369Sdim/// \returns TRUE if the specified bits are neither all zeros nor all ones; 1135321369Sdim/// FALSE otherwise. 1136288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1137205219Srdivacky_mm_testnzc_si128(__m128i __M, __m128i __V) 1138205219Srdivacky{ 1139205219Srdivacky return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V); 1140205219Srdivacky} 1141205219Srdivacky 1142341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are all 1143321369Sdim/// ones. 1144321369Sdim/// 1145321369Sdim/// \headerfile <x86intrin.h> 1146321369Sdim/// 1147321369Sdim/// \code 1148321369Sdim/// int _mm_test_all_ones(__m128i V); 1149321369Sdim/// \endcode 1150321369Sdim/// 1151321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1152321369Sdim/// 1153321369Sdim/// \param V 1154321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1155321369Sdim/// \returns TRUE if the bits specified in the operand are all set to 1; FALSE 1156321369Sdim/// otherwise. 1157205219Srdivacky#define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V))) 1158321369Sdim 1159341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are 1160321369Sdim/// neither all zeros nor all ones. 1161321369Sdim/// 1162321369Sdim/// \headerfile <x86intrin.h> 1163321369Sdim/// 1164321369Sdim/// \code 1165321369Sdim/// int _mm_test_mix_ones_zeros(__m128i M, __m128i V); 1166321369Sdim/// \endcode 1167321369Sdim/// 1168321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1169321369Sdim/// 1170321369Sdim/// \param M 1171321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1172321369Sdim/// \param V 1173321369Sdim/// A 128-bit integer vector selecting which bits to test in operand \a M. 1174321369Sdim/// \returns TRUE if the specified bits are neither all zeros nor all ones; 1175321369Sdim/// FALSE otherwise. 1176205219Srdivacky#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V)) 1177321369Sdim 1178341825Sdim/// Tests whether the specified bits in a 128-bit integer vector are all 1179321369Sdim/// zeros. 1180321369Sdim/// 1181321369Sdim/// \headerfile <x86intrin.h> 1182321369Sdim/// 1183321369Sdim/// \code 1184321369Sdim/// int _mm_test_all_zeros(__m128i M, __m128i V); 1185321369Sdim/// \endcode 1186321369Sdim/// 1187321369Sdim/// This intrinsic corresponds to the <c> VPTEST / PTEST </c> instruction. 1188321369Sdim/// 1189321369Sdim/// \param M 1190321369Sdim/// A 128-bit integer vector containing the bits to be tested. 1191321369Sdim/// \param V 1192321369Sdim/// A 128-bit integer vector selecting which bits to test in operand \a M. 1193321369Sdim/// \returns TRUE if the specified bits are all zeros; FALSE otherwise. 1194234353Sdim#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V)) 1195205219Srdivacky 1196205219Srdivacky/* SSE4 64-bit Packed Integer Comparisons. */ 1197341825Sdim/// Compares each of the corresponding 64-bit values of the 128-bit 1198321369Sdim/// integer vectors for equality. 1199321369Sdim/// 1200321369Sdim/// \headerfile <x86intrin.h> 1201321369Sdim/// 1202321369Sdim/// This intrinsic corresponds to the <c> VPCMPEQQ / PCMPEQQ </c> instruction. 1203321369Sdim/// 1204321369Sdim/// \param __V1 1205321369Sdim/// A 128-bit integer vector. 1206321369Sdim/// \param __V2 1207321369Sdim/// A 128-bit integer vector. 1208321369Sdim/// \returns A 128-bit integer vector containing the comparison results. 1209288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1210205219Srdivacky_mm_cmpeq_epi64(__m128i __V1, __m128i __V2) 1211205219Srdivacky{ 1212234353Sdim return (__m128i)((__v2di)__V1 == (__v2di)__V2); 1213205219Srdivacky} 1214205219Srdivacky 1215205219Srdivacky/* SSE4 Packed Integer Sign-Extension. */ 1216341825Sdim/// Sign-extends each of the lower eight 8-bit integer elements of a 1217321369Sdim/// 128-bit vector of [16 x i8] to 16-bit values and returns them in a 1218321369Sdim/// 128-bit vector of [8 x i16]. The upper eight elements of the input vector 1219321369Sdim/// are unused. 1220321369Sdim/// 1221321369Sdim/// \headerfile <x86intrin.h> 1222321369Sdim/// 1223321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXBW / PMOVSXBW </c> instruction. 1224321369Sdim/// 1225321369Sdim/// \param __V 1226321369Sdim/// A 128-bit vector of [16 x i8]. The lower eight 8-bit elements are sign- 1227321369Sdim/// extended to 16-bit values. 1228321369Sdim/// \returns A 128-bit vector of [8 x i16] containing the sign-extended values. 1229288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1230205219Srdivacky_mm_cvtepi8_epi16(__m128i __V) 1231205219Srdivacky{ 1232296417Sdim /* This function always performs a signed extension, but __v16qi is a char 1233296417Sdim which may be signed or unsigned, so use __v16qs. */ 1234296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8hi); 1235205219Srdivacky} 1236205219Srdivacky 1237341825Sdim/// Sign-extends each of the lower four 8-bit integer elements of a 1238321369Sdim/// 128-bit vector of [16 x i8] to 32-bit values and returns them in a 1239321369Sdim/// 128-bit vector of [4 x i32]. The upper twelve elements of the input 1240321369Sdim/// vector are unused. 1241321369Sdim/// 1242321369Sdim/// \headerfile <x86intrin.h> 1243321369Sdim/// 1244321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXBD / PMOVSXBD </c> instruction. 1245321369Sdim/// 1246321369Sdim/// \param __V 1247341825Sdim/// A 128-bit vector of [16 x i8]. The lower four 8-bit elements are 1248341825Sdim/// sign-extended to 32-bit values. 1249321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the sign-extended values. 1250288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1251205219Srdivacky_mm_cvtepi8_epi32(__m128i __V) 1252205219Srdivacky{ 1253296417Sdim /* This function always performs a signed extension, but __v16qi is a char 1254296417Sdim which may be signed or unsigned, so use __v16qs. */ 1255296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1, 2, 3), __v4si); 1256205219Srdivacky} 1257205219Srdivacky 1258341825Sdim/// Sign-extends each of the lower two 8-bit integer elements of a 1259321369Sdim/// 128-bit integer vector of [16 x i8] to 64-bit values and returns them in 1260321369Sdim/// a 128-bit vector of [2 x i64]. The upper fourteen elements of the input 1261321369Sdim/// vector are unused. 1262321369Sdim/// 1263321369Sdim/// \headerfile <x86intrin.h> 1264321369Sdim/// 1265321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXBQ / PMOVSXBQ </c> instruction. 1266321369Sdim/// 1267321369Sdim/// \param __V 1268341825Sdim/// A 128-bit vector of [16 x i8]. The lower two 8-bit elements are 1269341825Sdim/// sign-extended to 64-bit values. 1270321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values. 1271288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1272205219Srdivacky_mm_cvtepi8_epi64(__m128i __V) 1273205219Srdivacky{ 1274296417Sdim /* This function always performs a signed extension, but __v16qi is a char 1275296417Sdim which may be signed or unsigned, so use __v16qs. */ 1276296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qs)__V, (__v16qs)__V, 0, 1), __v2di); 1277205219Srdivacky} 1278205219Srdivacky 1279341825Sdim/// Sign-extends each of the lower four 16-bit integer elements of a 1280321369Sdim/// 128-bit integer vector of [8 x i16] to 32-bit values and returns them in 1281321369Sdim/// a 128-bit vector of [4 x i32]. The upper four elements of the input 1282321369Sdim/// vector are unused. 1283321369Sdim/// 1284321369Sdim/// \headerfile <x86intrin.h> 1285321369Sdim/// 1286321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXWD / PMOVSXWD </c> instruction. 1287321369Sdim/// 1288321369Sdim/// \param __V 1289341825Sdim/// A 128-bit vector of [8 x i16]. The lower four 16-bit elements are 1290341825Sdim/// sign-extended to 32-bit values. 1291321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the sign-extended values. 1292288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1293205219Srdivacky_mm_cvtepi16_epi32(__m128i __V) 1294205219Srdivacky{ 1295296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1, 2, 3), __v4si); 1296205219Srdivacky} 1297205219Srdivacky 1298341825Sdim/// Sign-extends each of the lower two 16-bit integer elements of a 1299321369Sdim/// 128-bit integer vector of [8 x i16] to 64-bit values and returns them in 1300321369Sdim/// a 128-bit vector of [2 x i64]. The upper six elements of the input 1301321369Sdim/// vector are unused. 1302321369Sdim/// 1303321369Sdim/// \headerfile <x86intrin.h> 1304321369Sdim/// 1305321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXWQ / PMOVSXWQ </c> instruction. 1306321369Sdim/// 1307321369Sdim/// \param __V 1308341825Sdim/// A 128-bit vector of [8 x i16]. The lower two 16-bit elements are 1309341825Sdim/// sign-extended to 64-bit values. 1310321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values. 1311288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1312205219Srdivacky_mm_cvtepi16_epi64(__m128i __V) 1313205219Srdivacky{ 1314296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hi)__V, (__v8hi)__V, 0, 1), __v2di); 1315205219Srdivacky} 1316205219Srdivacky 1317341825Sdim/// Sign-extends each of the lower two 32-bit integer elements of a 1318321369Sdim/// 128-bit integer vector of [4 x i32] to 64-bit values and returns them in 1319321369Sdim/// a 128-bit vector of [2 x i64]. The upper two elements of the input vector 1320321369Sdim/// are unused. 1321321369Sdim/// 1322321369Sdim/// \headerfile <x86intrin.h> 1323321369Sdim/// 1324321369Sdim/// This intrinsic corresponds to the <c> VPMOVSXDQ / PMOVSXDQ </c> instruction. 1325321369Sdim/// 1326321369Sdim/// \param __V 1327341825Sdim/// A 128-bit vector of [4 x i32]. The lower two 32-bit elements are 1328341825Sdim/// sign-extended to 64-bit values. 1329321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the sign-extended values. 1330288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1331205219Srdivacky_mm_cvtepi32_epi64(__m128i __V) 1332205219Srdivacky{ 1333296417Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v4si)__V, (__v4si)__V, 0, 1), __v2di); 1334205219Srdivacky} 1335205219Srdivacky 1336205219Srdivacky/* SSE4 Packed Integer Zero-Extension. */ 1337341825Sdim/// Zero-extends each of the lower eight 8-bit integer elements of a 1338321369Sdim/// 128-bit vector of [16 x i8] to 16-bit values and returns them in a 1339321369Sdim/// 128-bit vector of [8 x i16]. The upper eight elements of the input vector 1340321369Sdim/// are unused. 1341321369Sdim/// 1342321369Sdim/// \headerfile <x86intrin.h> 1343321369Sdim/// 1344321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXBW / PMOVZXBW </c> instruction. 1345321369Sdim/// 1346321369Sdim/// \param __V 1347341825Sdim/// A 128-bit vector of [16 x i8]. The lower eight 8-bit elements are 1348341825Sdim/// zero-extended to 16-bit values. 1349321369Sdim/// \returns A 128-bit vector of [8 x i16] containing the zero-extended values. 1350288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1351205219Srdivacky_mm_cvtepu8_epi16(__m128i __V) 1352205219Srdivacky{ 1353309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3, 4, 5, 6, 7), __v8hi); 1354205219Srdivacky} 1355205219Srdivacky 1356341825Sdim/// Zero-extends each of the lower four 8-bit integer elements of a 1357321369Sdim/// 128-bit vector of [16 x i8] to 32-bit values and returns them in a 1358321369Sdim/// 128-bit vector of [4 x i32]. The upper twelve elements of the input 1359321369Sdim/// vector are unused. 1360321369Sdim/// 1361321369Sdim/// \headerfile <x86intrin.h> 1362321369Sdim/// 1363321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXBD / PMOVZXBD </c> instruction. 1364321369Sdim/// 1365321369Sdim/// \param __V 1366341825Sdim/// A 128-bit vector of [16 x i8]. The lower four 8-bit elements are 1367341825Sdim/// zero-extended to 32-bit values. 1368321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the zero-extended values. 1369288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1370205219Srdivacky_mm_cvtepu8_epi32(__m128i __V) 1371205219Srdivacky{ 1372309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1, 2, 3), __v4si); 1373205219Srdivacky} 1374205219Srdivacky 1375341825Sdim/// Zero-extends each of the lower two 8-bit integer elements of a 1376321369Sdim/// 128-bit integer vector of [16 x i8] to 64-bit values and returns them in 1377321369Sdim/// a 128-bit vector of [2 x i64]. The upper fourteen elements of the input 1378321369Sdim/// vector are unused. 1379321369Sdim/// 1380321369Sdim/// \headerfile <x86intrin.h> 1381321369Sdim/// 1382321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXBQ / PMOVZXBQ </c> instruction. 1383321369Sdim/// 1384321369Sdim/// \param __V 1385341825Sdim/// A 128-bit vector of [16 x i8]. The lower two 8-bit elements are 1386341825Sdim/// zero-extended to 64-bit values. 1387321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values. 1388288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1389205219Srdivacky_mm_cvtepu8_epi64(__m128i __V) 1390205219Srdivacky{ 1391309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v16qu)__V, (__v16qu)__V, 0, 1), __v2di); 1392205219Srdivacky} 1393205219Srdivacky 1394341825Sdim/// Zero-extends each of the lower four 16-bit integer elements of a 1395321369Sdim/// 128-bit integer vector of [8 x i16] to 32-bit values and returns them in 1396321369Sdim/// a 128-bit vector of [4 x i32]. The upper four elements of the input 1397321369Sdim/// vector are unused. 1398321369Sdim/// 1399321369Sdim/// \headerfile <x86intrin.h> 1400321369Sdim/// 1401321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXWD / PMOVZXWD </c> instruction. 1402321369Sdim/// 1403321369Sdim/// \param __V 1404341825Sdim/// A 128-bit vector of [8 x i16]. The lower four 16-bit elements are 1405341825Sdim/// zero-extended to 32-bit values. 1406321369Sdim/// \returns A 128-bit vector of [4 x i32] containing the zero-extended values. 1407288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1408205219Srdivacky_mm_cvtepu16_epi32(__m128i __V) 1409205219Srdivacky{ 1410309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1, 2, 3), __v4si); 1411205219Srdivacky} 1412205219Srdivacky 1413341825Sdim/// Zero-extends each of the lower two 16-bit integer elements of a 1414321369Sdim/// 128-bit integer vector of [8 x i16] to 64-bit values and returns them in 1415321369Sdim/// a 128-bit vector of [2 x i64]. The upper six elements of the input vector 1416321369Sdim/// are unused. 1417321369Sdim/// 1418321369Sdim/// \headerfile <x86intrin.h> 1419321369Sdim/// 1420321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXWQ / PMOVZXWQ </c> instruction. 1421321369Sdim/// 1422321369Sdim/// \param __V 1423341825Sdim/// A 128-bit vector of [8 x i16]. The lower two 16-bit elements are 1424341825Sdim/// zero-extended to 64-bit values. 1425321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values. 1426288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1427205219Srdivacky_mm_cvtepu16_epi64(__m128i __V) 1428205219Srdivacky{ 1429309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v8hu)__V, (__v8hu)__V, 0, 1), __v2di); 1430205219Srdivacky} 1431205219Srdivacky 1432341825Sdim/// Zero-extends each of the lower two 32-bit integer elements of a 1433321369Sdim/// 128-bit integer vector of [4 x i32] to 64-bit values and returns them in 1434321369Sdim/// a 128-bit vector of [2 x i64]. The upper two elements of the input vector 1435321369Sdim/// are unused. 1436321369Sdim/// 1437321369Sdim/// \headerfile <x86intrin.h> 1438321369Sdim/// 1439321369Sdim/// This intrinsic corresponds to the <c> VPMOVZXDQ / PMOVZXDQ </c> instruction. 1440321369Sdim/// 1441321369Sdim/// \param __V 1442341825Sdim/// A 128-bit vector of [4 x i32]. The lower two 32-bit elements are 1443341825Sdim/// zero-extended to 64-bit values. 1444321369Sdim/// \returns A 128-bit vector of [2 x i64] containing the zero-extended values. 1445288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1446205219Srdivacky_mm_cvtepu32_epi64(__m128i __V) 1447205219Srdivacky{ 1448309124Sdim return (__m128i)__builtin_convertvector(__builtin_shufflevector((__v4su)__V, (__v4su)__V, 0, 1), __v2di); 1449205219Srdivacky} 1450205219Srdivacky 1451205219Srdivacky/* SSE4 Pack with Unsigned Saturation. */ 1452341825Sdim/// Converts 32-bit signed integers from both 128-bit integer vector 1453321369Sdim/// operands into 16-bit unsigned integers, and returns the packed result. 1454321369Sdim/// Values greater than 0xFFFF are saturated to 0xFFFF. Values less than 1455321369Sdim/// 0x0000 are saturated to 0x0000. 1456321369Sdim/// 1457321369Sdim/// \headerfile <x86intrin.h> 1458321369Sdim/// 1459321369Sdim/// This intrinsic corresponds to the <c> VPACKUSDW / PACKUSDW </c> instruction. 1460321369Sdim/// 1461321369Sdim/// \param __V1 1462321369Sdim/// A 128-bit vector of [4 x i32]. Each 32-bit element is treated as a 1463321369Sdim/// signed integer and is converted to a 16-bit unsigned integer with 1464321369Sdim/// saturation. Values greater than 0xFFFF are saturated to 0xFFFF. Values 1465321369Sdim/// less than 0x0000 are saturated to 0x0000. The converted [4 x i16] values 1466321369Sdim/// are written to the lower 64 bits of the result. 1467321369Sdim/// \param __V2 1468321369Sdim/// A 128-bit vector of [4 x i32]. Each 32-bit element is treated as a 1469321369Sdim/// signed integer and is converted to a 16-bit unsigned integer with 1470321369Sdim/// saturation. Values greater than 0xFFFF are saturated to 0xFFFF. Values 1471321369Sdim/// less than 0x0000 are saturated to 0x0000. The converted [4 x i16] values 1472321369Sdim/// are written to the higher 64 bits of the result. 1473321369Sdim/// \returns A 128-bit vector of [8 x i16] containing the converted values. 1474288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1475205219Srdivacky_mm_packus_epi32(__m128i __V1, __m128i __V2) 1476205219Srdivacky{ 1477205219Srdivacky return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2); 1478205219Srdivacky} 1479205219Srdivacky 1480205219Srdivacky/* SSE4 Multiple Packed Sums of Absolute Difference. */ 1481341825Sdim/// Subtracts 8-bit unsigned integer values and computes the absolute 1482321369Sdim/// values of the differences to the corresponding bits in the destination. 1483321369Sdim/// Then sums of the absolute differences are returned according to the bit 1484321369Sdim/// fields in the immediate operand. 1485321369Sdim/// 1486321369Sdim/// \headerfile <x86intrin.h> 1487321369Sdim/// 1488321369Sdim/// \code 1489321369Sdim/// __m128i _mm_mpsadbw_epu8(__m128i X, __m128i Y, const int M); 1490321369Sdim/// \endcode 1491321369Sdim/// 1492321369Sdim/// This intrinsic corresponds to the <c> VMPSADBW / MPSADBW </c> instruction. 1493321369Sdim/// 1494321369Sdim/// \param X 1495321369Sdim/// A 128-bit vector of [16 x i8]. 1496321369Sdim/// \param Y 1497321369Sdim/// A 128-bit vector of [16 x i8]. 1498321369Sdim/// \param M 1499321369Sdim/// An 8-bit immediate operand specifying how the absolute differences are to 1500321369Sdim/// be calculated, according to the following algorithm: 1501321369Sdim/// \code 1502321369Sdim/// // M2 represents bit 2 of the immediate operand 1503321369Sdim/// // M10 represents bits [1:0] of the immediate operand 1504341825Sdim/// i = M2 * 4; 1505341825Sdim/// j = M10 * 4; 1506321369Sdim/// for (k = 0; k < 8; k = k + 1) { 1507341825Sdim/// d0 = abs(X[i + k + 0] - Y[j + 0]); 1508341825Sdim/// d1 = abs(X[i + k + 1] - Y[j + 1]); 1509341825Sdim/// d2 = abs(X[i + k + 2] - Y[j + 2]); 1510341825Sdim/// d3 = abs(X[i + k + 3] - Y[j + 3]); 1511341825Sdim/// r[k] = d0 + d1 + d2 + d3; 1512321369Sdim/// } 1513321369Sdim/// \endcode 1514321369Sdim/// \returns A 128-bit integer vector containing the sums of the sets of 1515321369Sdim/// absolute differences between both operands. 1516341825Sdim#define _mm_mpsadbw_epu8(X, Y, M) \ 1517296417Sdim (__m128i) __builtin_ia32_mpsadbw128((__v16qi)(__m128i)(X), \ 1518341825Sdim (__v16qi)(__m128i)(Y), (M)) 1519205219Srdivacky 1520341825Sdim/// Finds the minimum unsigned 16-bit element in the input 128-bit 1521321369Sdim/// vector of [8 x u16] and returns it and along with its index. 1522321369Sdim/// 1523321369Sdim/// \headerfile <x86intrin.h> 1524321369Sdim/// 1525321369Sdim/// This intrinsic corresponds to the <c> VPHMINPOSUW / PHMINPOSUW </c> 1526321369Sdim/// instruction. 1527321369Sdim/// 1528321369Sdim/// \param __V 1529321369Sdim/// A 128-bit vector of [8 x u16]. 1530321369Sdim/// \returns A 128-bit value where bits [15:0] contain the minimum value found 1531321369Sdim/// in parameter \a __V, bits [18:16] contain the index of the minimum value 1532321369Sdim/// and the remaining bits are set to 0. 1533288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 1534234353Sdim_mm_minpos_epu16(__m128i __V) 1535234353Sdim{ 1536234353Sdim return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V); 1537234353Sdim} 1538234353Sdim 1539296417Sdim/* Handle the sse4.2 definitions here. */ 1540296417Sdim 1541205408Srdivacky/* These definitions are normally in nmmintrin.h, but gcc puts them in here 1542205408Srdivacky so we'll do the same. */ 1543205408Srdivacky 1544296417Sdim#undef __DEFAULT_FN_ATTRS 1545296417Sdim#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.2"))) 1546296417Sdim 1547205408Srdivacky/* These specify the type of data that we're comparing. */ 1548205408Srdivacky#define _SIDD_UBYTE_OPS 0x00 1549205408Srdivacky#define _SIDD_UWORD_OPS 0x01 1550205408Srdivacky#define _SIDD_SBYTE_OPS 0x02 1551205408Srdivacky#define _SIDD_SWORD_OPS 0x03 1552205408Srdivacky 1553205408Srdivacky/* These specify the type of comparison operation. */ 1554205408Srdivacky#define _SIDD_CMP_EQUAL_ANY 0x00 1555205408Srdivacky#define _SIDD_CMP_RANGES 0x04 1556205408Srdivacky#define _SIDD_CMP_EQUAL_EACH 0x08 1557205408Srdivacky#define _SIDD_CMP_EQUAL_ORDERED 0x0c 1558205408Srdivacky 1559205408Srdivacky/* These macros specify the polarity of the operation. */ 1560205408Srdivacky#define _SIDD_POSITIVE_POLARITY 0x00 1561205408Srdivacky#define _SIDD_NEGATIVE_POLARITY 0x10 1562205408Srdivacky#define _SIDD_MASKED_POSITIVE_POLARITY 0x20 1563205408Srdivacky#define _SIDD_MASKED_NEGATIVE_POLARITY 0x30 1564205408Srdivacky 1565205408Srdivacky/* These macros are used in _mm_cmpXstri() to specify the return. */ 1566205408Srdivacky#define _SIDD_LEAST_SIGNIFICANT 0x00 1567205408Srdivacky#define _SIDD_MOST_SIGNIFICANT 0x40 1568205408Srdivacky 1569205408Srdivacky/* These macros are used in _mm_cmpXstri() to specify the return. */ 1570205408Srdivacky#define _SIDD_BIT_MASK 0x00 1571205408Srdivacky#define _SIDD_UNIT_MASK 0x40 1572205408Srdivacky 1573205408Srdivacky/* SSE4.2 Packed Comparison Intrinsics. */ 1574341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1575321369Sdim/// data with implicitly defined lengths that is contained in source operands 1576321369Sdim/// \a A and \a B. Returns a 128-bit integer vector representing the result 1577321369Sdim/// mask of the comparison. 1578321369Sdim/// 1579321369Sdim/// \headerfile <x86intrin.h> 1580321369Sdim/// 1581321369Sdim/// \code 1582321369Sdim/// __m128i _mm_cmpistrm(__m128i A, __m128i B, const int M); 1583321369Sdim/// \endcode 1584321369Sdim/// 1585321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRM / PCMPISTRM </c> 1586321369Sdim/// instruction. 1587321369Sdim/// 1588321369Sdim/// \param A 1589321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1590321369Sdim/// compared. 1591321369Sdim/// \param B 1592321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1593321369Sdim/// compared. 1594321369Sdim/// \param M 1595321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1596321369Sdim/// words, the type of comparison to perform, and the format of the return 1597321369Sdim/// value. \n 1598321369Sdim/// Bits [1:0]: Determine source data format. \n 1599321369Sdim/// 00: 16 unsigned bytes \n 1600321369Sdim/// 01: 8 unsigned words \n 1601321369Sdim/// 10: 16 signed bytes \n 1602321369Sdim/// 11: 8 signed words \n 1603321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1604321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1605321369Sdim/// the characters in \a A. \n 1606321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1607321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1608321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1609321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1610321369Sdim/// \a B for equality. \n 1611321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 1612321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1613321369Sdim/// mask of the comparison results. \n 1614321369Sdim/// 00: No effect. \n 1615321369Sdim/// 01: Negate the bit mask. \n 1616321369Sdim/// 10: No effect. \n 1617321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1618321369Sdim/// to the size of \a A or \a B. \n 1619321369Sdim/// Bit [6]: Determines whether the result is zero-extended or expanded to 16 1620321369Sdim/// bytes. \n 1621321369Sdim/// 0: The result is zero-extended to 16 bytes. \n 1622321369Sdim/// 1: The result is expanded to 16 bytes (this expansion is performed by 1623321369Sdim/// repeating each bit 8 or 16 times). 1624321369Sdim/// \returns Returns a 128-bit integer vector representing the result mask of 1625321369Sdim/// the comparison. 1626296417Sdim#define _mm_cmpistrm(A, B, M) \ 1627296417Sdim (__m128i)__builtin_ia32_pcmpistrm128((__v16qi)(__m128i)(A), \ 1628296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 1629321369Sdim 1630341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1631321369Sdim/// data with implicitly defined lengths that is contained in source operands 1632321369Sdim/// \a A and \a B. Returns an integer representing the result index of the 1633321369Sdim/// comparison. 1634321369Sdim/// 1635321369Sdim/// \headerfile <x86intrin.h> 1636321369Sdim/// 1637321369Sdim/// \code 1638321369Sdim/// int _mm_cmpistri(__m128i A, __m128i B, const int M); 1639321369Sdim/// \endcode 1640321369Sdim/// 1641321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 1642321369Sdim/// instruction. 1643321369Sdim/// 1644321369Sdim/// \param A 1645321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1646321369Sdim/// compared. 1647321369Sdim/// \param B 1648321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1649321369Sdim/// compared. 1650321369Sdim/// \param M 1651321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1652321369Sdim/// words, the type of comparison to perform, and the format of the return 1653321369Sdim/// value. \n 1654321369Sdim/// Bits [1:0]: Determine source data format. \n 1655321369Sdim/// 00: 16 unsigned bytes \n 1656321369Sdim/// 01: 8 unsigned words \n 1657321369Sdim/// 10: 16 signed bytes \n 1658321369Sdim/// 11: 8 signed words \n 1659321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1660321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1661321369Sdim/// the characters in \a A. \n 1662321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1663321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1664321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1665321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1666321369Sdim/// \a B for equality. \n 1667321369Sdim/// 11: Substring: Search B for substring matches of \a A. \n 1668321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1669321369Sdim/// mask of the comparison results. \n 1670321369Sdim/// 00: No effect. \n 1671321369Sdim/// 01: Negate the bit mask. \n 1672321369Sdim/// 10: No effect. \n 1673321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1674321369Sdim/// to the size of \a A or \a B. \n 1675321369Sdim/// Bit [6]: Determines whether the index of the lowest set bit or the 1676321369Sdim/// highest set bit is returned. \n 1677321369Sdim/// 0: The index of the least significant set bit. \n 1678321369Sdim/// 1: The index of the most significant set bit. \n 1679321369Sdim/// \returns Returns an integer representing the result index of the comparison. 1680296417Sdim#define _mm_cmpistri(A, B, M) \ 1681296417Sdim (int)__builtin_ia32_pcmpistri128((__v16qi)(__m128i)(A), \ 1682296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 1683205408Srdivacky 1684341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1685321369Sdim/// data with explicitly defined lengths that is contained in source operands 1686321369Sdim/// \a A and \a B. Returns a 128-bit integer vector representing the result 1687321369Sdim/// mask of the comparison. 1688321369Sdim/// 1689321369Sdim/// \headerfile <x86intrin.h> 1690321369Sdim/// 1691321369Sdim/// \code 1692321369Sdim/// __m128i _mm_cmpestrm(__m128i A, int LA, __m128i B, int LB, const int M); 1693321369Sdim/// \endcode 1694321369Sdim/// 1695321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRM / PCMPESTRM </c> 1696321369Sdim/// instruction. 1697321369Sdim/// 1698321369Sdim/// \param A 1699321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1700321369Sdim/// compared. 1701321369Sdim/// \param LA 1702321369Sdim/// An integer that specifies the length of the string in \a A. 1703321369Sdim/// \param B 1704321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1705321369Sdim/// compared. 1706321369Sdim/// \param LB 1707321369Sdim/// An integer that specifies the length of the string in \a B. 1708321369Sdim/// \param M 1709321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1710321369Sdim/// words, the type of comparison to perform, and the format of the return 1711321369Sdim/// value. \n 1712321369Sdim/// Bits [1:0]: Determine source data format. \n 1713321369Sdim/// 00: 16 unsigned bytes \n 1714321369Sdim/// 01: 8 unsigned words \n 1715321369Sdim/// 10: 16 signed bytes \n 1716321369Sdim/// 11: 8 signed words \n 1717321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1718321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1719321369Sdim/// the characters in \a A. \n 1720321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1721321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1722321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1723321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1724321369Sdim/// \a B for equality. \n 1725321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 1726321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1727321369Sdim/// mask of the comparison results. \n 1728321369Sdim/// 00: No effect. \n 1729321369Sdim/// 01: Negate the bit mask. \n 1730321369Sdim/// 10: No effect. \n 1731321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1732321369Sdim/// to the size of \a A or \a B. \n 1733321369Sdim/// Bit [6]: Determines whether the result is zero-extended or expanded to 16 1734321369Sdim/// bytes. \n 1735321369Sdim/// 0: The result is zero-extended to 16 bytes. \n 1736321369Sdim/// 1: The result is expanded to 16 bytes (this expansion is performed by 1737321369Sdim/// repeating each bit 8 or 16 times). \n 1738321369Sdim/// \returns Returns a 128-bit integer vector representing the result mask of 1739321369Sdim/// the comparison. 1740205408Srdivacky#define _mm_cmpestrm(A, LA, B, LB, M) \ 1741296417Sdim (__m128i)__builtin_ia32_pcmpestrm128((__v16qi)(__m128i)(A), (int)(LA), \ 1742296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 1743296417Sdim (int)(M)) 1744321369Sdim 1745341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1746321369Sdim/// data with explicitly defined lengths that is contained in source operands 1747321369Sdim/// \a A and \a B. Returns an integer representing the result index of the 1748321369Sdim/// comparison. 1749321369Sdim/// 1750321369Sdim/// \headerfile <x86intrin.h> 1751321369Sdim/// 1752321369Sdim/// \code 1753321369Sdim/// int _mm_cmpestri(__m128i A, int LA, __m128i B, int LB, const int M); 1754321369Sdim/// \endcode 1755321369Sdim/// 1756321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI / PCMPESTRI </c> 1757321369Sdim/// instruction. 1758321369Sdim/// 1759321369Sdim/// \param A 1760321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1761321369Sdim/// compared. 1762321369Sdim/// \param LA 1763321369Sdim/// An integer that specifies the length of the string in \a A. 1764321369Sdim/// \param B 1765321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1766321369Sdim/// compared. 1767321369Sdim/// \param LB 1768321369Sdim/// An integer that specifies the length of the string in \a B. 1769321369Sdim/// \param M 1770321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1771321369Sdim/// words, the type of comparison to perform, and the format of the return 1772321369Sdim/// value. \n 1773321369Sdim/// Bits [1:0]: Determine source data format. \n 1774321369Sdim/// 00: 16 unsigned bytes \n 1775321369Sdim/// 01: 8 unsigned words \n 1776321369Sdim/// 10: 16 signed bytes \n 1777321369Sdim/// 11: 8 signed words \n 1778321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1779321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1780321369Sdim/// the characters in \a A. \n 1781321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1782321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1783321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1784321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1785321369Sdim/// \a B for equality. \n 1786321369Sdim/// 11: Substring: Search B for substring matches of \a A. \n 1787321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1788321369Sdim/// mask of the comparison results. \n 1789321369Sdim/// 00: No effect. \n 1790321369Sdim/// 01: Negate the bit mask. \n 1791321369Sdim/// 10: No effect. \n 1792321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1793321369Sdim/// to the size of \a A or \a B. \n 1794321369Sdim/// Bit [6]: Determines whether the index of the lowest set bit or the 1795321369Sdim/// highest set bit is returned. \n 1796321369Sdim/// 0: The index of the least significant set bit. \n 1797321369Sdim/// 1: The index of the most significant set bit. \n 1798321369Sdim/// \returns Returns an integer representing the result index of the comparison. 1799234353Sdim#define _mm_cmpestri(A, LA, B, LB, M) \ 1800296417Sdim (int)__builtin_ia32_pcmpestri128((__v16qi)(__m128i)(A), (int)(LA), \ 1801296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 1802296417Sdim (int)(M)) 1803296417Sdim 1804205408Srdivacky/* SSE4.2 Packed Comparison Intrinsics and EFlag Reading. */ 1805341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1806321369Sdim/// data with implicitly defined lengths that is contained in source operands 1807321369Sdim/// \a A and \a B. Returns 1 if the bit mask is zero and the length of the 1808321369Sdim/// string in \a B is the maximum, otherwise, returns 0. 1809321369Sdim/// 1810321369Sdim/// \headerfile <x86intrin.h> 1811321369Sdim/// 1812321369Sdim/// \code 1813321369Sdim/// int _mm_cmpistra(__m128i A, __m128i B, const int M); 1814321369Sdim/// \endcode 1815321369Sdim/// 1816321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 1817321369Sdim/// instruction. 1818321369Sdim/// 1819321369Sdim/// \param A 1820321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1821321369Sdim/// compared. 1822321369Sdim/// \param B 1823321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1824321369Sdim/// compared. 1825321369Sdim/// \param M 1826321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1827321369Sdim/// words and the type of comparison to perform. \n 1828321369Sdim/// Bits [1:0]: Determine source data format. \n 1829321369Sdim/// 00: 16 unsigned bytes \n 1830321369Sdim/// 01: 8 unsigned words \n 1831321369Sdim/// 10: 16 signed bytes \n 1832321369Sdim/// 11: 8 signed words \n 1833321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1834321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1835321369Sdim/// the characters in \a A. \n 1836321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1837321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1838321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1839321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1840321369Sdim/// \a B for equality. \n 1841321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 1842321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1843321369Sdim/// mask of the comparison results. \n 1844321369Sdim/// 00: No effect. \n 1845321369Sdim/// 01: Negate the bit mask. \n 1846321369Sdim/// 10: No effect. \n 1847321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1848321369Sdim/// to the size of \a A or \a B. \n 1849321369Sdim/// \returns Returns 1 if the bit mask is zero and the length of the string in 1850321369Sdim/// \a B is the maximum; otherwise, returns 0. 1851234353Sdim#define _mm_cmpistra(A, B, M) \ 1852296417Sdim (int)__builtin_ia32_pcmpistria128((__v16qi)(__m128i)(A), \ 1853296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 1854321369Sdim 1855341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1856321369Sdim/// data with implicitly defined lengths that is contained in source operands 1857321369Sdim/// \a A and \a B. Returns 1 if the bit mask is non-zero, otherwise, returns 1858321369Sdim/// 0. 1859321369Sdim/// 1860321369Sdim/// \headerfile <x86intrin.h> 1861321369Sdim/// 1862321369Sdim/// \code 1863321369Sdim/// int _mm_cmpistrc(__m128i A, __m128i B, const int M); 1864321369Sdim/// \endcode 1865321369Sdim/// 1866321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 1867321369Sdim/// instruction. 1868321369Sdim/// 1869321369Sdim/// \param A 1870321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1871321369Sdim/// compared. 1872321369Sdim/// \param B 1873321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1874321369Sdim/// compared. 1875321369Sdim/// \param M 1876321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1877321369Sdim/// words and the type of comparison to perform. \n 1878321369Sdim/// Bits [1:0]: Determine source data format. \n 1879321369Sdim/// 00: 16 unsigned bytes \n 1880321369Sdim/// 01: 8 unsigned words \n 1881321369Sdim/// 10: 16 signed bytes \n 1882321369Sdim/// 11: 8 signed words \n 1883321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1884321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1885321369Sdim/// the characters in \a A. \n 1886321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1887321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1888321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1889321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1890321369Sdim/// \a B for equality. \n 1891321369Sdim/// 11: Substring: Search B for substring matches of \a A. \n 1892321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1893321369Sdim/// mask of the comparison results. \n 1894321369Sdim/// 00: No effect. \n 1895321369Sdim/// 01: Negate the bit mask. \n 1896321369Sdim/// 10: No effect. \n 1897321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1898321369Sdim/// to the size of \a A or \a B. 1899321369Sdim/// \returns Returns 1 if the bit mask is non-zero, otherwise, returns 0. 1900234353Sdim#define _mm_cmpistrc(A, B, M) \ 1901296417Sdim (int)__builtin_ia32_pcmpistric128((__v16qi)(__m128i)(A), \ 1902296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 1903321369Sdim 1904341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1905321369Sdim/// data with implicitly defined lengths that is contained in source operands 1906321369Sdim/// \a A and \a B. Returns bit 0 of the resulting bit mask. 1907321369Sdim/// 1908321369Sdim/// \headerfile <x86intrin.h> 1909321369Sdim/// 1910321369Sdim/// \code 1911321369Sdim/// int _mm_cmpistro(__m128i A, __m128i B, const int M); 1912321369Sdim/// \endcode 1913321369Sdim/// 1914321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 1915321369Sdim/// instruction. 1916321369Sdim/// 1917321369Sdim/// \param A 1918321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1919321369Sdim/// compared. 1920321369Sdim/// \param B 1921321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1922321369Sdim/// compared. 1923321369Sdim/// \param M 1924321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1925321369Sdim/// words and the type of comparison to perform. \n 1926321369Sdim/// Bits [1:0]: Determine source data format. \n 1927321369Sdim/// 00: 16 unsigned bytes \n 1928321369Sdim/// 01: 8 unsigned words \n 1929321369Sdim/// 10: 16 signed bytes \n 1930321369Sdim/// 11: 8 signed words \n 1931321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1932321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1933321369Sdim/// the characters in \a A. \n 1934321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1935321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1936321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1937321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1938321369Sdim/// \a B for equality. \n 1939321369Sdim/// 11: Substring: Search B for substring matches of \a A. \n 1940321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1941321369Sdim/// mask of the comparison results. \n 1942321369Sdim/// 00: No effect. \n 1943321369Sdim/// 01: Negate the bit mask. \n 1944321369Sdim/// 10: No effect. \n 1945321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1946321369Sdim/// to the size of \a A or \a B. \n 1947321369Sdim/// \returns Returns bit 0 of the resulting bit mask. 1948234353Sdim#define _mm_cmpistro(A, B, M) \ 1949296417Sdim (int)__builtin_ia32_pcmpistrio128((__v16qi)(__m128i)(A), \ 1950296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 1951321369Sdim 1952341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 1953321369Sdim/// data with implicitly defined lengths that is contained in source operands 1954321369Sdim/// \a A and \a B. Returns 1 if the length of the string in \a A is less than 1955321369Sdim/// the maximum, otherwise, returns 0. 1956321369Sdim/// 1957321369Sdim/// \headerfile <x86intrin.h> 1958321369Sdim/// 1959321369Sdim/// \code 1960321369Sdim/// int _mm_cmpistrs(__m128i A, __m128i B, const int M); 1961321369Sdim/// \endcode 1962321369Sdim/// 1963321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 1964321369Sdim/// instruction. 1965321369Sdim/// 1966321369Sdim/// \param A 1967321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1968321369Sdim/// compared. 1969321369Sdim/// \param B 1970321369Sdim/// A 128-bit integer vector containing one of the source operands to be 1971321369Sdim/// compared. 1972321369Sdim/// \param M 1973321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 1974321369Sdim/// words and the type of comparison to perform. \n 1975321369Sdim/// Bits [1:0]: Determine source data format. \n 1976321369Sdim/// 00: 16 unsigned bytes \n 1977321369Sdim/// 01: 8 unsigned words \n 1978321369Sdim/// 10: 16 signed bytes \n 1979321369Sdim/// 11: 8 signed words \n 1980321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 1981321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 1982321369Sdim/// the characters in \a A. \n 1983321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 1984321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 1985321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 1986321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 1987321369Sdim/// \a B for equality. \n 1988321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 1989321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 1990321369Sdim/// mask of the comparison results. \n 1991321369Sdim/// 00: No effect. \n 1992321369Sdim/// 01: Negate the bit mask. \n 1993321369Sdim/// 10: No effect. \n 1994321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 1995321369Sdim/// to the size of \a A or \a B. \n 1996321369Sdim/// \returns Returns 1 if the length of the string in \a A is less than the 1997321369Sdim/// maximum, otherwise, returns 0. 1998234353Sdim#define _mm_cmpistrs(A, B, M) \ 1999296417Sdim (int)__builtin_ia32_pcmpistris128((__v16qi)(__m128i)(A), \ 2000296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 2001321369Sdim 2002341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2003321369Sdim/// data with implicitly defined lengths that is contained in source operands 2004321369Sdim/// \a A and \a B. Returns 1 if the length of the string in \a B is less than 2005321369Sdim/// the maximum, otherwise, returns 0. 2006321369Sdim/// 2007321369Sdim/// \headerfile <x86intrin.h> 2008321369Sdim/// 2009321369Sdim/// \code 2010321369Sdim/// int _mm_cmpistrz(__m128i A, __m128i B, const int M); 2011321369Sdim/// \endcode 2012321369Sdim/// 2013321369Sdim/// This intrinsic corresponds to the <c> VPCMPISTRI / PCMPISTRI </c> 2014321369Sdim/// instruction. 2015321369Sdim/// 2016321369Sdim/// \param A 2017321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2018321369Sdim/// compared. 2019321369Sdim/// \param B 2020321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2021321369Sdim/// compared. 2022321369Sdim/// \param M 2023321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2024321369Sdim/// words and the type of comparison to perform. \n 2025321369Sdim/// Bits [1:0]: Determine source data format. \n 2026321369Sdim/// 00: 16 unsigned bytes \n 2027321369Sdim/// 01: 8 unsigned words \n 2028321369Sdim/// 10: 16 signed bytes \n 2029321369Sdim/// 11: 8 signed words \n 2030321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2031321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2032321369Sdim/// the characters in \a A. \n 2033321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2034321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2035321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2036321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2037321369Sdim/// \a B for equality. \n 2038321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2039321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 2040321369Sdim/// mask of the comparison results. \n 2041321369Sdim/// 00: No effect. \n 2042321369Sdim/// 01: Negate the bit mask. \n 2043321369Sdim/// 10: No effect. \n 2044321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2045321369Sdim/// to the size of \a A or \a B. 2046321369Sdim/// \returns Returns 1 if the length of the string in \a B is less than the 2047321369Sdim/// maximum, otherwise, returns 0. 2048234353Sdim#define _mm_cmpistrz(A, B, M) \ 2049296417Sdim (int)__builtin_ia32_pcmpistriz128((__v16qi)(__m128i)(A), \ 2050296417Sdim (__v16qi)(__m128i)(B), (int)(M)) 2051205408Srdivacky 2052341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2053321369Sdim/// data with explicitly defined lengths that is contained in source operands 2054321369Sdim/// \a A and \a B. Returns 1 if the bit mask is zero and the length of the 2055321369Sdim/// string in \a B is the maximum, otherwise, returns 0. 2056321369Sdim/// 2057321369Sdim/// \headerfile <x86intrin.h> 2058321369Sdim/// 2059321369Sdim/// \code 2060321369Sdim/// int _mm_cmpestra(__m128i A, int LA, __m128i B, int LB, const int M); 2061321369Sdim/// \endcode 2062321369Sdim/// 2063321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI / PCMPESTRI </c> 2064321369Sdim/// instruction. 2065321369Sdim/// 2066321369Sdim/// \param A 2067321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2068321369Sdim/// compared. 2069321369Sdim/// \param LA 2070321369Sdim/// An integer that specifies the length of the string in \a A. 2071321369Sdim/// \param B 2072321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2073321369Sdim/// compared. 2074321369Sdim/// \param LB 2075321369Sdim/// An integer that specifies the length of the string in \a B. 2076321369Sdim/// \param M 2077321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2078321369Sdim/// words and the type of comparison to perform. \n 2079321369Sdim/// Bits [1:0]: Determine source data format. \n 2080321369Sdim/// 00: 16 unsigned bytes \n 2081321369Sdim/// 01: 8 unsigned words \n 2082321369Sdim/// 10: 16 signed bytes \n 2083321369Sdim/// 11: 8 signed words \n 2084321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2085321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2086321369Sdim/// the characters in \a A. \n 2087321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2088321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2089321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2090321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2091321369Sdim/// \a B for equality. \n 2092321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2093321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 2094321369Sdim/// mask of the comparison results. \n 2095321369Sdim/// 00: No effect. \n 2096321369Sdim/// 01: Negate the bit mask. \n 2097321369Sdim/// 10: No effect. \n 2098321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2099321369Sdim/// to the size of \a A or \a B. 2100321369Sdim/// \returns Returns 1 if the bit mask is zero and the length of the string in 2101321369Sdim/// \a B is the maximum, otherwise, returns 0. 2102205408Srdivacky#define _mm_cmpestra(A, LA, B, LB, M) \ 2103296417Sdim (int)__builtin_ia32_pcmpestria128((__v16qi)(__m128i)(A), (int)(LA), \ 2104296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 2105296417Sdim (int)(M)) 2106321369Sdim 2107341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2108321369Sdim/// data with explicitly defined lengths that is contained in source operands 2109321369Sdim/// \a A and \a B. Returns 1 if the resulting mask is non-zero, otherwise, 2110321369Sdim/// returns 0. 2111321369Sdim/// 2112321369Sdim/// \headerfile <x86intrin.h> 2113321369Sdim/// 2114321369Sdim/// \code 2115321369Sdim/// int _mm_cmpestrc(__m128i A, int LA, __m128i B, int LB, const int M); 2116321369Sdim/// \endcode 2117321369Sdim/// 2118321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI / PCMPESTRI </c> 2119321369Sdim/// instruction. 2120321369Sdim/// 2121321369Sdim/// \param A 2122321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2123321369Sdim/// compared. 2124321369Sdim/// \param LA 2125321369Sdim/// An integer that specifies the length of the string in \a A. 2126321369Sdim/// \param B 2127321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2128321369Sdim/// compared. 2129321369Sdim/// \param LB 2130321369Sdim/// An integer that specifies the length of the string in \a B. 2131321369Sdim/// \param M 2132321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2133321369Sdim/// words and the type of comparison to perform. \n 2134321369Sdim/// Bits [1:0]: Determine source data format. \n 2135321369Sdim/// 00: 16 unsigned bytes \n 2136321369Sdim/// 01: 8 unsigned words \n 2137321369Sdim/// 10: 16 signed bytes \n 2138321369Sdim/// 11: 8 signed words \n 2139321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2140321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2141321369Sdim/// the characters in \a A. \n 2142321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2143321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2144321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2145321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2146321369Sdim/// \a B for equality. \n 2147321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2148321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 2149321369Sdim/// mask of the comparison results. \n 2150321369Sdim/// 00: No effect. \n 2151321369Sdim/// 01: Negate the bit mask. \n 2152321369Sdim/// 10: No effect. \n 2153321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2154321369Sdim/// to the size of \a A or \a B. \n 2155321369Sdim/// \returns Returns 1 if the resulting mask is non-zero, otherwise, returns 0. 2156205408Srdivacky#define _mm_cmpestrc(A, LA, B, LB, M) \ 2157296417Sdim (int)__builtin_ia32_pcmpestric128((__v16qi)(__m128i)(A), (int)(LA), \ 2158296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 2159296417Sdim (int)(M)) 2160321369Sdim 2161341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2162321369Sdim/// data with explicitly defined lengths that is contained in source operands 2163321369Sdim/// \a A and \a B. Returns bit 0 of the resulting bit mask. 2164321369Sdim/// 2165321369Sdim/// \headerfile <x86intrin.h> 2166321369Sdim/// 2167321369Sdim/// \code 2168321369Sdim/// int _mm_cmpestro(__m128i A, int LA, __m128i B, int LB, const int M); 2169321369Sdim/// \endcode 2170321369Sdim/// 2171321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI / PCMPESTRI </c> 2172321369Sdim/// instruction. 2173321369Sdim/// 2174321369Sdim/// \param A 2175321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2176321369Sdim/// compared. 2177321369Sdim/// \param LA 2178321369Sdim/// An integer that specifies the length of the string in \a A. 2179321369Sdim/// \param B 2180321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2181321369Sdim/// compared. 2182321369Sdim/// \param LB 2183321369Sdim/// An integer that specifies the length of the string in \a B. 2184321369Sdim/// \param M 2185321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2186321369Sdim/// words and the type of comparison to perform. \n 2187321369Sdim/// Bits [1:0]: Determine source data format. \n 2188321369Sdim/// 00: 16 unsigned bytes \n 2189321369Sdim/// 01: 8 unsigned words \n 2190321369Sdim/// 10: 16 signed bytes \n 2191321369Sdim/// 11: 8 signed words \n 2192321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2193321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2194321369Sdim/// the characters in \a A. \n 2195321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2196321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2197321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2198321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2199321369Sdim/// \a B for equality. \n 2200321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2201321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 2202321369Sdim/// mask of the comparison results. \n 2203321369Sdim/// 00: No effect. \n 2204321369Sdim/// 01: Negate the bit mask. \n 2205321369Sdim/// 10: No effect. \n 2206321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2207321369Sdim/// to the size of \a A or \a B. 2208321369Sdim/// \returns Returns bit 0 of the resulting bit mask. 2209205408Srdivacky#define _mm_cmpestro(A, LA, B, LB, M) \ 2210296417Sdim (int)__builtin_ia32_pcmpestrio128((__v16qi)(__m128i)(A), (int)(LA), \ 2211296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 2212296417Sdim (int)(M)) 2213321369Sdim 2214341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2215321369Sdim/// data with explicitly defined lengths that is contained in source operands 2216321369Sdim/// \a A and \a B. Returns 1 if the length of the string in \a A is less than 2217321369Sdim/// the maximum, otherwise, returns 0. 2218321369Sdim/// 2219321369Sdim/// \headerfile <x86intrin.h> 2220321369Sdim/// 2221321369Sdim/// \code 2222321369Sdim/// int _mm_cmpestrs(__m128i A, int LA, __m128i B, int LB, const int M); 2223321369Sdim/// \endcode 2224321369Sdim/// 2225321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI / PCMPESTRI </c> 2226321369Sdim/// instruction. 2227321369Sdim/// 2228321369Sdim/// \param A 2229321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2230321369Sdim/// compared. 2231321369Sdim/// \param LA 2232321369Sdim/// An integer that specifies the length of the string in \a A. 2233321369Sdim/// \param B 2234321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2235321369Sdim/// compared. 2236321369Sdim/// \param LB 2237321369Sdim/// An integer that specifies the length of the string in \a B. 2238321369Sdim/// \param M 2239321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2240321369Sdim/// words and the type of comparison to perform. \n 2241321369Sdim/// Bits [1:0]: Determine source data format. \n 2242321369Sdim/// 00: 16 unsigned bytes \n 2243321369Sdim/// 01: 8 unsigned words \n 2244321369Sdim/// 10: 16 signed bytes \n 2245321369Sdim/// 11: 8 signed words \n 2246321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2247321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2248321369Sdim/// the characters in \a A. \n 2249321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2250321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2251321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2252321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2253321369Sdim/// \a B for equality. \n 2254321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2255321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement in the bit 2256321369Sdim/// mask of the comparison results. \n 2257321369Sdim/// 00: No effect. \n 2258321369Sdim/// 01: Negate the bit mask. \n 2259321369Sdim/// 10: No effect. \n 2260321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2261321369Sdim/// to the size of \a A or \a B. \n 2262321369Sdim/// \returns Returns 1 if the length of the string in \a A is less than the 2263321369Sdim/// maximum, otherwise, returns 0. 2264205408Srdivacky#define _mm_cmpestrs(A, LA, B, LB, M) \ 2265296417Sdim (int)__builtin_ia32_pcmpestris128((__v16qi)(__m128i)(A), (int)(LA), \ 2266296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 2267296417Sdim (int)(M)) 2268321369Sdim 2269341825Sdim/// Uses the immediate operand \a M to perform a comparison of string 2270321369Sdim/// data with explicitly defined lengths that is contained in source operands 2271321369Sdim/// \a A and \a B. Returns 1 if the length of the string in \a B is less than 2272321369Sdim/// the maximum, otherwise, returns 0. 2273321369Sdim/// 2274321369Sdim/// \headerfile <x86intrin.h> 2275321369Sdim/// 2276321369Sdim/// \code 2277321369Sdim/// int _mm_cmpestrz(__m128i A, int LA, __m128i B, int LB, const int M); 2278321369Sdim/// \endcode 2279321369Sdim/// 2280321369Sdim/// This intrinsic corresponds to the <c> VPCMPESTRI </c> instruction. 2281321369Sdim/// 2282321369Sdim/// \param A 2283321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2284321369Sdim/// compared. 2285321369Sdim/// \param LA 2286321369Sdim/// An integer that specifies the length of the string in \a A. 2287321369Sdim/// \param B 2288321369Sdim/// A 128-bit integer vector containing one of the source operands to be 2289321369Sdim/// compared. 2290321369Sdim/// \param LB 2291321369Sdim/// An integer that specifies the length of the string in \a B. 2292321369Sdim/// \param M 2293321369Sdim/// An 8-bit immediate operand specifying whether the characters are bytes or 2294321369Sdim/// words and the type of comparison to perform. \n 2295321369Sdim/// Bits [1:0]: Determine source data format. \n 2296321369Sdim/// 00: 16 unsigned bytes \n 2297321369Sdim/// 01: 8 unsigned words \n 2298321369Sdim/// 10: 16 signed bytes \n 2299321369Sdim/// 11: 8 signed words \n 2300321369Sdim/// Bits [3:2]: Determine comparison type and aggregation method. \n 2301321369Sdim/// 00: Subset: Each character in \a B is compared for equality with all 2302321369Sdim/// the characters in \a A. \n 2303321369Sdim/// 01: Ranges: Each character in \a B is compared to \a A. The comparison 2304321369Sdim/// basis is greater than or equal for even-indexed elements in \a A, 2305321369Sdim/// and less than or equal for odd-indexed elements in \a A. \n 2306321369Sdim/// 10: Match: Compare each pair of corresponding characters in \a A and 2307321369Sdim/// \a B for equality. \n 2308321369Sdim/// 11: Substring: Search \a B for substring matches of \a A. \n 2309321369Sdim/// Bits [5:4]: Determine whether to perform a one's complement on the bit 2310321369Sdim/// mask of the comparison results. \n 2311321369Sdim/// 00: No effect. \n 2312321369Sdim/// 01: Negate the bit mask. \n 2313321369Sdim/// 10: No effect. \n 2314321369Sdim/// 11: Negate the bit mask only for bits with an index less than or equal 2315321369Sdim/// to the size of \a A or \a B. 2316321369Sdim/// \returns Returns 1 if the length of the string in \a B is less than the 2317321369Sdim/// maximum, otherwise, returns 0. 2318205408Srdivacky#define _mm_cmpestrz(A, LA, B, LB, M) \ 2319296417Sdim (int)__builtin_ia32_pcmpestriz128((__v16qi)(__m128i)(A), (int)(LA), \ 2320296417Sdim (__v16qi)(__m128i)(B), (int)(LB), \ 2321296417Sdim (int)(M)) 2322205408Srdivacky 2323205408Srdivacky/* SSE4.2 Compare Packed Data -- Greater Than. */ 2324341825Sdim/// Compares each of the corresponding 64-bit values of the 128-bit 2325321369Sdim/// integer vectors to determine if the values in the first operand are 2326321369Sdim/// greater than those in the second operand. 2327321369Sdim/// 2328321369Sdim/// \headerfile <x86intrin.h> 2329321369Sdim/// 2330321369Sdim/// This intrinsic corresponds to the <c> VPCMPGTQ / PCMPGTQ </c> instruction. 2331321369Sdim/// 2332321369Sdim/// \param __V1 2333321369Sdim/// A 128-bit integer vector. 2334321369Sdim/// \param __V2 2335321369Sdim/// A 128-bit integer vector. 2336321369Sdim/// \returns A 128-bit integer vector containing the comparison results. 2337288943Sdimstatic __inline__ __m128i __DEFAULT_FN_ATTRS 2338205408Srdivacky_mm_cmpgt_epi64(__m128i __V1, __m128i __V2) 2339205408Srdivacky{ 2340234353Sdim return (__m128i)((__v2di)__V1 > (__v2di)__V2); 2341205408Srdivacky} 2342205408Srdivacky 2343205408Srdivacky/* SSE4.2 Accumulate CRC32. */ 2344341825Sdim/// Adds the unsigned integer operand to the CRC-32C checksum of the 2345321369Sdim/// unsigned char operand. 2346321369Sdim/// 2347321369Sdim/// \headerfile <x86intrin.h> 2348321369Sdim/// 2349321369Sdim/// This intrinsic corresponds to the <c> CRC32B </c> instruction. 2350321369Sdim/// 2351321369Sdim/// \param __C 2352321369Sdim/// An unsigned integer operand to add to the CRC-32C checksum of operand 2353321369Sdim/// \a __D. 2354321369Sdim/// \param __D 2355321369Sdim/// An unsigned 8-bit integer operand used to compute the CRC-32C checksum. 2356321369Sdim/// \returns The result of adding operand \a __C to the CRC-32C checksum of 2357321369Sdim/// operand \a __D. 2358288943Sdimstatic __inline__ unsigned int __DEFAULT_FN_ATTRS 2359205408Srdivacky_mm_crc32_u8(unsigned int __C, unsigned char __D) 2360205408Srdivacky{ 2361205408Srdivacky return __builtin_ia32_crc32qi(__C, __D); 2362205408Srdivacky} 2363205408Srdivacky 2364341825Sdim/// Adds the unsigned integer operand to the CRC-32C checksum of the 2365321369Sdim/// unsigned short operand. 2366321369Sdim/// 2367321369Sdim/// \headerfile <x86intrin.h> 2368321369Sdim/// 2369321369Sdim/// This intrinsic corresponds to the <c> CRC32W </c> instruction. 2370321369Sdim/// 2371321369Sdim/// \param __C 2372321369Sdim/// An unsigned integer operand to add to the CRC-32C checksum of operand 2373321369Sdim/// \a __D. 2374321369Sdim/// \param __D 2375321369Sdim/// An unsigned 16-bit integer operand used to compute the CRC-32C checksum. 2376321369Sdim/// \returns The result of adding operand \a __C to the CRC-32C checksum of 2377321369Sdim/// operand \a __D. 2378288943Sdimstatic __inline__ unsigned int __DEFAULT_FN_ATTRS 2379205408Srdivacky_mm_crc32_u16(unsigned int __C, unsigned short __D) 2380205408Srdivacky{ 2381205408Srdivacky return __builtin_ia32_crc32hi(__C, __D); 2382205408Srdivacky} 2383205408Srdivacky 2384341825Sdim/// Adds the first unsigned integer operand to the CRC-32C checksum of 2385321369Sdim/// the second unsigned integer operand. 2386321369Sdim/// 2387321369Sdim/// \headerfile <x86intrin.h> 2388321369Sdim/// 2389321369Sdim/// This intrinsic corresponds to the <c> CRC32L </c> instruction. 2390321369Sdim/// 2391321369Sdim/// \param __C 2392321369Sdim/// An unsigned integer operand to add to the CRC-32C checksum of operand 2393321369Sdim/// \a __D. 2394321369Sdim/// \param __D 2395321369Sdim/// An unsigned 32-bit integer operand used to compute the CRC-32C checksum. 2396321369Sdim/// \returns The result of adding operand \a __C to the CRC-32C checksum of 2397321369Sdim/// operand \a __D. 2398288943Sdimstatic __inline__ unsigned int __DEFAULT_FN_ATTRS 2399205408Srdivacky_mm_crc32_u32(unsigned int __C, unsigned int __D) 2400205408Srdivacky{ 2401205408Srdivacky return __builtin_ia32_crc32si(__C, __D); 2402205408Srdivacky} 2403205408Srdivacky 2404205408Srdivacky#ifdef __x86_64__ 2405341825Sdim/// Adds the unsigned integer operand to the CRC-32C checksum of the 2406321369Sdim/// unsigned 64-bit integer operand. 2407321369Sdim/// 2408321369Sdim/// \headerfile <x86intrin.h> 2409321369Sdim/// 2410321369Sdim/// This intrinsic corresponds to the <c> CRC32Q </c> instruction. 2411321369Sdim/// 2412321369Sdim/// \param __C 2413321369Sdim/// An unsigned integer operand to add to the CRC-32C checksum of operand 2414321369Sdim/// \a __D. 2415321369Sdim/// \param __D 2416321369Sdim/// An unsigned 64-bit integer operand used to compute the CRC-32C checksum. 2417321369Sdim/// \returns The result of adding operand \a __C to the CRC-32C checksum of 2418321369Sdim/// operand \a __D. 2419288943Sdimstatic __inline__ unsigned long long __DEFAULT_FN_ATTRS 2420205408Srdivacky_mm_crc32_u64(unsigned long long __C, unsigned long long __D) 2421205408Srdivacky{ 2422205408Srdivacky return __builtin_ia32_crc32di(__C, __D); 2423205408Srdivacky} 2424205408Srdivacky#endif /* __x86_64__ */ 2425205408Srdivacky 2426288943Sdim#undef __DEFAULT_FN_ATTRS 2427288943Sdim 2428234353Sdim#include <popcntintrin.h> 2429205408Srdivacky 2430341825Sdim#endif /* __SMMINTRIN_H */ 2431