xmmintrin.h revision 321369
1193326Sed/*===---- xmmintrin.h - SSE intrinsics -------------------------------------=== 2193326Sed * 3193326Sed * Permission is hereby granted, free of charge, to any person obtaining a copy 4193326Sed * of this software and associated documentation files (the "Software"), to deal 5193326Sed * in the Software without restriction, including without limitation the rights 6193326Sed * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7193326Sed * copies of the Software, and to permit persons to whom the Software is 8193326Sed * furnished to do so, subject to the following conditions: 9193326Sed * 10193326Sed * The above copyright notice and this permission notice shall be included in 11193326Sed * all copies or substantial portions of the Software. 12193326Sed * 13193326Sed * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14193326Sed * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15193326Sed * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16193326Sed * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17193326Sed * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18193326Sed * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19193326Sed * THE SOFTWARE. 20193326Sed * 21193326Sed *===-----------------------------------------------------------------------=== 22193326Sed */ 23296417Sdim 24193326Sed#ifndef __XMMINTRIN_H 25193326Sed#define __XMMINTRIN_H 26193326Sed 27193326Sed#include <mmintrin.h> 28193326Sed 29205408Srdivackytypedef int __v4si __attribute__((__vector_size__(16))); 30193326Sedtypedef float __v4sf __attribute__((__vector_size__(16))); 31193326Sedtypedef float __m128 __attribute__((__vector_size__(16))); 32193326Sed 33309124Sdim/* Unsigned types */ 34309124Sdimtypedef unsigned int __v4su __attribute__((__vector_size__(16))); 35309124Sdim 36276479Sdim/* This header should only be included in a hosted environment as it depends on 37276479Sdim * a standard library to provide allocation routines. */ 38218893Sdim#if __STDC_HOSTED__ 39193326Sed#include <mm_malloc.h> 40218893Sdim#endif 41193326Sed 42288943Sdim/* Define the default attributes for the functions in this file. */ 43296417Sdim#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse"))) 44288943Sdim 45309124Sdim/// \brief Adds the 32-bit float values in the low-order bits of the operands. 46309124Sdim/// 47309124Sdim/// \headerfile <x86intrin.h> 48309124Sdim/// 49314564Sdim/// This intrinsic corresponds to the <c> VADDSS / ADDSS </c> instructions. 50309124Sdim/// 51309124Sdim/// \param __a 52309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 53309124Sdim/// The lower 32 bits of this operand are used in the calculation. 54309124Sdim/// \param __b 55309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 56309124Sdim/// The lower 32 bits of this operand are used in the calculation. 57309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the sum 58309124Sdim/// of the lower 32 bits of both operands. The upper 96 bits are copied from 59309124Sdim/// the upper 96 bits of the first source operand. 60288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 61249423Sdim_mm_add_ss(__m128 __a, __m128 __b) 62193326Sed{ 63249423Sdim __a[0] += __b[0]; 64249423Sdim return __a; 65193326Sed} 66193326Sed 67309124Sdim/// \brief Adds two 128-bit vectors of [4 x float], and returns the results of 68309124Sdim/// the addition. 69309124Sdim/// 70309124Sdim/// \headerfile <x86intrin.h> 71309124Sdim/// 72314564Sdim/// This intrinsic corresponds to the <c> VADDPS / ADDPS </c> instructions. 73309124Sdim/// 74309124Sdim/// \param __a 75309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 76309124Sdim/// \param __b 77309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 78309124Sdim/// \returns A 128-bit vector of [4 x float] containing the sums of both 79309124Sdim/// operands. 80288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 81249423Sdim_mm_add_ps(__m128 __a, __m128 __b) 82193326Sed{ 83309124Sdim return (__m128)((__v4sf)__a + (__v4sf)__b); 84193326Sed} 85193326Sed 86309124Sdim/// \brief Subtracts the 32-bit float value in the low-order bits of the second 87309124Sdim/// operand from the corresponding value in the first operand. 88309124Sdim/// 89309124Sdim/// \headerfile <x86intrin.h> 90309124Sdim/// 91314564Sdim/// This intrinsic corresponds to the <c> VSUBSS / SUBSS </c> instructions. 92309124Sdim/// 93309124Sdim/// \param __a 94309124Sdim/// A 128-bit vector of [4 x float] containing the minuend. The lower 32 bits 95309124Sdim/// of this operand are used in the calculation. 96309124Sdim/// \param __b 97309124Sdim/// A 128-bit vector of [4 x float] containing the subtrahend. The lower 32 98309124Sdim/// bits of this operand are used in the calculation. 99309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 100309124Sdim/// difference of the lower 32 bits of both operands. The upper 96 bits are 101309124Sdim/// copied from the upper 96 bits of the first source operand. 102288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 103249423Sdim_mm_sub_ss(__m128 __a, __m128 __b) 104193326Sed{ 105249423Sdim __a[0] -= __b[0]; 106249423Sdim return __a; 107193326Sed} 108193326Sed 109309124Sdim/// \brief Subtracts each of the values of the second operand from the first 110309124Sdim/// operand, both of which are 128-bit vectors of [4 x float] and returns 111309124Sdim/// the results of the subtraction. 112309124Sdim/// 113309124Sdim/// \headerfile <x86intrin.h> 114309124Sdim/// 115314564Sdim/// This intrinsic corresponds to the <c> VSUBPS / SUBPS </c> instructions. 116309124Sdim/// 117309124Sdim/// \param __a 118309124Sdim/// A 128-bit vector of [4 x float] containing the minuend. 119309124Sdim/// \param __b 120309124Sdim/// A 128-bit vector of [4 x float] containing the subtrahend. 121309124Sdim/// \returns A 128-bit vector of [4 x float] containing the differences between 122309124Sdim/// both operands. 123288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 124249423Sdim_mm_sub_ps(__m128 __a, __m128 __b) 125193326Sed{ 126309124Sdim return (__m128)((__v4sf)__a - (__v4sf)__b); 127193326Sed} 128193326Sed 129309124Sdim/// \brief Multiplies two 32-bit float values in the low-order bits of the 130309124Sdim/// operands. 131309124Sdim/// 132309124Sdim/// \headerfile <x86intrin.h> 133309124Sdim/// 134314564Sdim/// This intrinsic corresponds to the <c> VMULSS / MULSS </c> instructions. 135309124Sdim/// 136309124Sdim/// \param __a 137309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 138309124Sdim/// The lower 32 bits of this operand are used in the calculation. 139309124Sdim/// \param __b 140309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 141309124Sdim/// The lower 32 bits of this operand are used in the calculation. 142309124Sdim/// \returns A 128-bit vector of [4 x float] containing the product of the lower 143309124Sdim/// 32 bits of both operands. The upper 96 bits are copied from the upper 96 144309124Sdim/// bits of the first source operand. 145288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 146249423Sdim_mm_mul_ss(__m128 __a, __m128 __b) 147193326Sed{ 148249423Sdim __a[0] *= __b[0]; 149249423Sdim return __a; 150193326Sed} 151193326Sed 152309124Sdim/// \brief Multiplies two 128-bit vectors of [4 x float] and returns the 153309124Sdim/// results of the multiplication. 154309124Sdim/// 155309124Sdim/// \headerfile <x86intrin.h> 156309124Sdim/// 157314564Sdim/// This intrinsic corresponds to the <c> VMULPS / MULPS </c> instructions. 158309124Sdim/// 159309124Sdim/// \param __a 160309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 161309124Sdim/// \param __b 162309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 163309124Sdim/// \returns A 128-bit vector of [4 x float] containing the products of both 164309124Sdim/// operands. 165288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 166249423Sdim_mm_mul_ps(__m128 __a, __m128 __b) 167193326Sed{ 168309124Sdim return (__m128)((__v4sf)__a * (__v4sf)__b); 169193326Sed} 170193326Sed 171309124Sdim/// \brief Divides the value in the low-order 32 bits of the first operand by 172309124Sdim/// the corresponding value in the second operand. 173309124Sdim/// 174309124Sdim/// \headerfile <x86intrin.h> 175309124Sdim/// 176314564Sdim/// This intrinsic corresponds to the <c> VDIVSS / DIVSS </c> instructions. 177309124Sdim/// 178309124Sdim/// \param __a 179309124Sdim/// A 128-bit vector of [4 x float] containing the dividend. The lower 32 180309124Sdim/// bits of this operand are used in the calculation. 181309124Sdim/// \param __b 182309124Sdim/// A 128-bit vector of [4 x float] containing the divisor. The lower 32 bits 183309124Sdim/// of this operand are used in the calculation. 184309124Sdim/// \returns A 128-bit vector of [4 x float] containing the quotients of the 185309124Sdim/// lower 32 bits of both operands. The upper 96 bits are copied from the 186309124Sdim/// upper 96 bits of the first source operand. 187288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 188249423Sdim_mm_div_ss(__m128 __a, __m128 __b) 189193326Sed{ 190249423Sdim __a[0] /= __b[0]; 191249423Sdim return __a; 192193326Sed} 193193326Sed 194309124Sdim/// \brief Divides two 128-bit vectors of [4 x float]. 195309124Sdim/// 196309124Sdim/// \headerfile <x86intrin.h> 197309124Sdim/// 198314564Sdim/// This intrinsic corresponds to the <c> VDIVPS / DIVPS </c> instructions. 199309124Sdim/// 200309124Sdim/// \param __a 201309124Sdim/// A 128-bit vector of [4 x float] containing the dividend. 202309124Sdim/// \param __b 203309124Sdim/// A 128-bit vector of [4 x float] containing the divisor. 204309124Sdim/// \returns A 128-bit vector of [4 x float] containing the quotients of both 205309124Sdim/// operands. 206288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 207249423Sdim_mm_div_ps(__m128 __a, __m128 __b) 208193326Sed{ 209309124Sdim return (__m128)((__v4sf)__a / (__v4sf)__b); 210193326Sed} 211193326Sed 212309124Sdim/// \brief Calculates the square root of the value stored in the low-order bits 213309124Sdim/// of a 128-bit vector of [4 x float]. 214309124Sdim/// 215309124Sdim/// \headerfile <x86intrin.h> 216309124Sdim/// 217314564Sdim/// This intrinsic corresponds to the <c> VSQRTSS / SQRTSS </c> instructions. 218309124Sdim/// 219309124Sdim/// \param __a 220309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 221309124Sdim/// used in the calculation. 222309124Sdim/// \returns A 128-bit vector of [4 x float] containing the square root of the 223309124Sdim/// value in the low-order bits of the operand. 224288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 225249423Sdim_mm_sqrt_ss(__m128 __a) 226193326Sed{ 227309124Sdim __m128 __c = __builtin_ia32_sqrtss((__v4sf)__a); 228249423Sdim return (__m128) { __c[0], __a[1], __a[2], __a[3] }; 229193326Sed} 230193326Sed 231309124Sdim/// \brief Calculates the square roots of the values stored in a 128-bit vector 232309124Sdim/// of [4 x float]. 233309124Sdim/// 234309124Sdim/// \headerfile <x86intrin.h> 235309124Sdim/// 236314564Sdim/// This intrinsic corresponds to the <c> VSQRTPS / SQRTPS </c> instructions. 237309124Sdim/// 238309124Sdim/// \param __a 239309124Sdim/// A 128-bit vector of [4 x float]. 240309124Sdim/// \returns A 128-bit vector of [4 x float] containing the square roots of the 241309124Sdim/// values in the operand. 242288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 243249423Sdim_mm_sqrt_ps(__m128 __a) 244193326Sed{ 245309124Sdim return __builtin_ia32_sqrtps((__v4sf)__a); 246193326Sed} 247193326Sed 248309124Sdim/// \brief Calculates the approximate reciprocal of the value stored in the 249309124Sdim/// low-order bits of a 128-bit vector of [4 x float]. 250309124Sdim/// 251309124Sdim/// \headerfile <x86intrin.h> 252309124Sdim/// 253314564Sdim/// This intrinsic corresponds to the <c> VRCPSS / RCPSS </c> instructions. 254309124Sdim/// 255309124Sdim/// \param __a 256309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 257309124Sdim/// used in the calculation. 258309124Sdim/// \returns A 128-bit vector of [4 x float] containing the approximate 259309124Sdim/// reciprocal of the value in the low-order bits of the operand. 260288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 261249423Sdim_mm_rcp_ss(__m128 __a) 262193326Sed{ 263309124Sdim __m128 __c = __builtin_ia32_rcpss((__v4sf)__a); 264249423Sdim return (__m128) { __c[0], __a[1], __a[2], __a[3] }; 265193326Sed} 266193326Sed 267309124Sdim/// \brief Calculates the approximate reciprocals of the values stored in a 268309124Sdim/// 128-bit vector of [4 x float]. 269309124Sdim/// 270309124Sdim/// \headerfile <x86intrin.h> 271309124Sdim/// 272314564Sdim/// This intrinsic corresponds to the <c> VRCPPS / RCPPS </c> instructions. 273309124Sdim/// 274309124Sdim/// \param __a 275309124Sdim/// A 128-bit vector of [4 x float]. 276309124Sdim/// \returns A 128-bit vector of [4 x float] containing the approximate 277309124Sdim/// reciprocals of the values in the operand. 278288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 279249423Sdim_mm_rcp_ps(__m128 __a) 280193326Sed{ 281309124Sdim return __builtin_ia32_rcpps((__v4sf)__a); 282193326Sed} 283193326Sed 284309124Sdim/// \brief Calculates the approximate reciprocal of the square root of the value 285309124Sdim/// stored in the low-order bits of a 128-bit vector of [4 x float]. 286309124Sdim/// 287309124Sdim/// \headerfile <x86intrin.h> 288309124Sdim/// 289314564Sdim/// This intrinsic corresponds to the <c> VRSQRTSS / RSQRTSS </c> instructions. 290309124Sdim/// 291309124Sdim/// \param __a 292309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 293309124Sdim/// used in the calculation. 294309124Sdim/// \returns A 128-bit vector of [4 x float] containing the approximate 295309124Sdim/// reciprocal of the square root of the value in the low-order bits of the 296309124Sdim/// operand. 297288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 298249423Sdim_mm_rsqrt_ss(__m128 __a) 299193326Sed{ 300309124Sdim __m128 __c = __builtin_ia32_rsqrtss((__v4sf)__a); 301249423Sdim return (__m128) { __c[0], __a[1], __a[2], __a[3] }; 302193326Sed} 303193326Sed 304309124Sdim/// \brief Calculates the approximate reciprocals of the square roots of the 305309124Sdim/// values stored in a 128-bit vector of [4 x float]. 306309124Sdim/// 307309124Sdim/// \headerfile <x86intrin.h> 308309124Sdim/// 309314564Sdim/// This intrinsic corresponds to the <c> VRSQRTPS / RSQRTPS </c> instructions. 310309124Sdim/// 311309124Sdim/// \param __a 312309124Sdim/// A 128-bit vector of [4 x float]. 313309124Sdim/// \returns A 128-bit vector of [4 x float] containing the approximate 314309124Sdim/// reciprocals of the square roots of the values in the operand. 315288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 316249423Sdim_mm_rsqrt_ps(__m128 __a) 317193326Sed{ 318309124Sdim return __builtin_ia32_rsqrtps((__v4sf)__a); 319193326Sed} 320193326Sed 321309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 322309124Sdim/// operands and returns the lesser value in the low-order bits of the 323309124Sdim/// vector of [4 x float]. 324309124Sdim/// 325309124Sdim/// \headerfile <x86intrin.h> 326309124Sdim/// 327314564Sdim/// This intrinsic corresponds to the <c> VMINSS / MINSS </c> instructions. 328309124Sdim/// 329309124Sdim/// \param __a 330309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 331309124Sdim/// 32 bits of this operand are used in the comparison. 332309124Sdim/// \param __b 333309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 334309124Sdim/// 32 bits of this operand are used in the comparison. 335309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 336309124Sdim/// minimum value between both operands. The upper 96 bits are copied from 337309124Sdim/// the upper 96 bits of the first source operand. 338288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 339249423Sdim_mm_min_ss(__m128 __a, __m128 __b) 340193326Sed{ 341309124Sdim return __builtin_ia32_minss((__v4sf)__a, (__v4sf)__b); 342193326Sed} 343193326Sed 344314564Sdim/// \brief Compares two 128-bit vectors of [4 x float] and returns the lesser 345314564Sdim/// of each pair of values. 346309124Sdim/// 347309124Sdim/// \headerfile <x86intrin.h> 348309124Sdim/// 349314564Sdim/// This intrinsic corresponds to the <c> VMINPS / MINPS </c> instructions. 350309124Sdim/// 351309124Sdim/// \param __a 352309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. 353309124Sdim/// \param __b 354309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. 355309124Sdim/// \returns A 128-bit vector of [4 x float] containing the minimum values 356309124Sdim/// between both operands. 357288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 358249423Sdim_mm_min_ps(__m128 __a, __m128 __b) 359193326Sed{ 360309124Sdim return __builtin_ia32_minps((__v4sf)__a, (__v4sf)__b); 361193326Sed} 362193326Sed 363309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 364314564Sdim/// operands and returns the greater value in the low-order bits of a 128-bit 365314564Sdim/// vector of [4 x float]. 366309124Sdim/// 367309124Sdim/// \headerfile <x86intrin.h> 368309124Sdim/// 369314564Sdim/// This intrinsic corresponds to the <c> VMAXSS / MAXSS </c> instructions. 370309124Sdim/// 371309124Sdim/// \param __a 372309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 373309124Sdim/// 32 bits of this operand are used in the comparison. 374309124Sdim/// \param __b 375309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 376309124Sdim/// 32 bits of this operand are used in the comparison. 377309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 378309124Sdim/// maximum value between both operands. The upper 96 bits are copied from 379309124Sdim/// the upper 96 bits of the first source operand. 380288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 381249423Sdim_mm_max_ss(__m128 __a, __m128 __b) 382193326Sed{ 383309124Sdim return __builtin_ia32_maxss((__v4sf)__a, (__v4sf)__b); 384193326Sed} 385193326Sed 386309124Sdim/// \brief Compares two 128-bit vectors of [4 x float] and returns the greater 387309124Sdim/// of each pair of values. 388309124Sdim/// 389309124Sdim/// \headerfile <x86intrin.h> 390309124Sdim/// 391314564Sdim/// This intrinsic corresponds to the <c> VMAXPS / MAXPS </c> instructions. 392309124Sdim/// 393309124Sdim/// \param __a 394309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. 395309124Sdim/// \param __b 396309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. 397309124Sdim/// \returns A 128-bit vector of [4 x float] containing the maximum values 398309124Sdim/// between both operands. 399288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 400249423Sdim_mm_max_ps(__m128 __a, __m128 __b) 401193326Sed{ 402309124Sdim return __builtin_ia32_maxps((__v4sf)__a, (__v4sf)__b); 403193326Sed} 404193326Sed 405309124Sdim/// \brief Performs a bitwise AND of two 128-bit vectors of [4 x float]. 406309124Sdim/// 407309124Sdim/// \headerfile <x86intrin.h> 408309124Sdim/// 409314564Sdim/// This intrinsic corresponds to the <c> VANDPS / ANDPS </c> instructions. 410309124Sdim/// 411309124Sdim/// \param __a 412309124Sdim/// A 128-bit vector containing one of the source operands. 413309124Sdim/// \param __b 414309124Sdim/// A 128-bit vector containing one of the source operands. 415309124Sdim/// \returns A 128-bit vector of [4 x float] containing the bitwise AND of the 416309124Sdim/// values between both operands. 417288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 418249423Sdim_mm_and_ps(__m128 __a, __m128 __b) 419193326Sed{ 420309124Sdim return (__m128)((__v4su)__a & (__v4su)__b); 421193326Sed} 422193326Sed 423309124Sdim/// \brief Performs a bitwise AND of two 128-bit vectors of [4 x float], using 424309124Sdim/// the one's complement of the values contained in the first source 425309124Sdim/// operand. 426309124Sdim/// 427309124Sdim/// \headerfile <x86intrin.h> 428309124Sdim/// 429314564Sdim/// This intrinsic corresponds to the <c> VANDNPS / ANDNPS </c> instructions. 430309124Sdim/// 431309124Sdim/// \param __a 432309124Sdim/// A 128-bit vector of [4 x float] containing the first source operand. The 433309124Sdim/// one's complement of this value is used in the bitwise AND. 434309124Sdim/// \param __b 435309124Sdim/// A 128-bit vector of [4 x float] containing the second source operand. 436309124Sdim/// \returns A 128-bit vector of [4 x float] containing the bitwise AND of the 437309124Sdim/// one's complement of the first operand and the values in the second 438309124Sdim/// operand. 439288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 440249423Sdim_mm_andnot_ps(__m128 __a, __m128 __b) 441193326Sed{ 442309124Sdim return (__m128)(~(__v4su)__a & (__v4su)__b); 443193326Sed} 444193326Sed 445309124Sdim/// \brief Performs a bitwise OR of two 128-bit vectors of [4 x float]. 446309124Sdim/// 447309124Sdim/// \headerfile <x86intrin.h> 448309124Sdim/// 449314564Sdim/// This intrinsic corresponds to the <c> VORPS / ORPS </c> instructions. 450309124Sdim/// 451309124Sdim/// \param __a 452309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 453309124Sdim/// \param __b 454309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 455309124Sdim/// \returns A 128-bit vector of [4 x float] containing the bitwise OR of the 456309124Sdim/// values between both operands. 457288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 458249423Sdim_mm_or_ps(__m128 __a, __m128 __b) 459193326Sed{ 460309124Sdim return (__m128)((__v4su)__a | (__v4su)__b); 461193326Sed} 462193326Sed 463309124Sdim/// \brief Performs a bitwise exclusive OR of two 128-bit vectors of 464309124Sdim/// [4 x float]. 465309124Sdim/// 466309124Sdim/// \headerfile <x86intrin.h> 467309124Sdim/// 468314564Sdim/// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instructions. 469309124Sdim/// 470309124Sdim/// \param __a 471309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 472309124Sdim/// \param __b 473309124Sdim/// A 128-bit vector of [4 x float] containing one of the source operands. 474309124Sdim/// \returns A 128-bit vector of [4 x float] containing the bitwise exclusive OR 475309124Sdim/// of the values between both operands. 476288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 477249423Sdim_mm_xor_ps(__m128 __a, __m128 __b) 478193326Sed{ 479309124Sdim return (__m128)((__v4su)__a ^ (__v4su)__b); 480193326Sed} 481193326Sed 482309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 483309124Sdim/// operands for equality and returns the result of the comparison in the 484309124Sdim/// low-order bits of a vector [4 x float]. 485309124Sdim/// 486309124Sdim/// \headerfile <x86intrin.h> 487309124Sdim/// 488314564Sdim/// This intrinsic corresponds to the <c> VCMPEQSS / CMPEQSS </c> instructions. 489309124Sdim/// 490309124Sdim/// \param __a 491309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 492309124Sdim/// 32 bits of this operand are used in the comparison. 493309124Sdim/// \param __b 494309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 495309124Sdim/// 32 bits of this operand are used in the comparison. 496309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 497309124Sdim/// in the low-order bits. 498288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 499249423Sdim_mm_cmpeq_ss(__m128 __a, __m128 __b) 500193326Sed{ 501309124Sdim return (__m128)__builtin_ia32_cmpeqss((__v4sf)__a, (__v4sf)__b); 502193326Sed} 503193326Sed 504309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 505309124Sdim/// 128-bit vectors of [4 x float] for equality. 506309124Sdim/// 507309124Sdim/// \headerfile <x86intrin.h> 508309124Sdim/// 509314564Sdim/// This intrinsic corresponds to the <c> VCMPEQPS / CMPEQPS </c> instructions. 510309124Sdim/// 511309124Sdim/// \param __a 512309124Sdim/// A 128-bit vector of [4 x float]. 513309124Sdim/// \param __b 514309124Sdim/// A 128-bit vector of [4 x float]. 515309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 516288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 517249423Sdim_mm_cmpeq_ps(__m128 __a, __m128 __b) 518193326Sed{ 519309124Sdim return (__m128)__builtin_ia32_cmpeqps((__v4sf)__a, (__v4sf)__b); 520193326Sed} 521193326Sed 522309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 523309124Sdim/// operands to determine if the value in the first operand is less than the 524309124Sdim/// corresponding value in the second operand and returns the result of the 525309124Sdim/// comparison in the low-order bits of a vector of [4 x float]. 526309124Sdim/// 527309124Sdim/// \headerfile <x86intrin.h> 528309124Sdim/// 529314564Sdim/// This intrinsic corresponds to the <c> VCMPLTSS / CMPLTSS </c> instructions. 530309124Sdim/// 531309124Sdim/// \param __a 532309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 533309124Sdim/// 32 bits of this operand are used in the comparison. 534309124Sdim/// \param __b 535309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 536309124Sdim/// 32 bits of this operand are used in the comparison. 537309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 538309124Sdim/// in the low-order bits. 539288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 540249423Sdim_mm_cmplt_ss(__m128 __a, __m128 __b) 541193326Sed{ 542309124Sdim return (__m128)__builtin_ia32_cmpltss((__v4sf)__a, (__v4sf)__b); 543193326Sed} 544193326Sed 545309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 546309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 547309124Sdim/// operand are less than those in the second operand. 548309124Sdim/// 549309124Sdim/// \headerfile <x86intrin.h> 550309124Sdim/// 551314564Sdim/// This intrinsic corresponds to the <c> VCMPLTPS / CMPLTPS </c> instructions. 552309124Sdim/// 553309124Sdim/// \param __a 554309124Sdim/// A 128-bit vector of [4 x float]. 555309124Sdim/// \param __b 556309124Sdim/// A 128-bit vector of [4 x float]. 557309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 558288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 559249423Sdim_mm_cmplt_ps(__m128 __a, __m128 __b) 560193326Sed{ 561309124Sdim return (__m128)__builtin_ia32_cmpltps((__v4sf)__a, (__v4sf)__b); 562193326Sed} 563193326Sed 564309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 565309124Sdim/// operands to determine if the value in the first operand is less than or 566309124Sdim/// equal to the corresponding value in the second operand and returns the 567309124Sdim/// result of the comparison in the low-order bits of a vector of 568309124Sdim/// [4 x float]. 569309124Sdim/// 570309124Sdim/// \headerfile <x86intrin.h> 571309124Sdim/// 572314564Sdim/// This intrinsic corresponds to the <c> VCMPLESS / CMPLESS </c> instructions. 573309124Sdim/// 574309124Sdim/// \param __a 575309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 576309124Sdim/// 32 bits of this operand are used in the comparison. 577309124Sdim/// \param __b 578309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 579309124Sdim/// 32 bits of this operand are used in the comparison. 580309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 581309124Sdim/// in the low-order bits. 582288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 583249423Sdim_mm_cmple_ss(__m128 __a, __m128 __b) 584193326Sed{ 585309124Sdim return (__m128)__builtin_ia32_cmpless((__v4sf)__a, (__v4sf)__b); 586193326Sed} 587193326Sed 588309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 589309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 590309124Sdim/// operand are less than or equal to those in the second operand. 591309124Sdim/// 592309124Sdim/// \headerfile <x86intrin.h> 593309124Sdim/// 594314564Sdim/// This intrinsic corresponds to the <c> VCMPLEPS / CMPLEPS </c> instructions. 595309124Sdim/// 596309124Sdim/// \param __a 597309124Sdim/// A 128-bit vector of [4 x float]. 598309124Sdim/// \param __b 599309124Sdim/// A 128-bit vector of [4 x float]. 600309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 601288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 602249423Sdim_mm_cmple_ps(__m128 __a, __m128 __b) 603193326Sed{ 604309124Sdim return (__m128)__builtin_ia32_cmpleps((__v4sf)__a, (__v4sf)__b); 605193326Sed} 606193326Sed 607309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 608309124Sdim/// operands to determine if the value in the first operand is greater than 609309124Sdim/// the corresponding value in the second operand and returns the result of 610309124Sdim/// the comparison in the low-order bits of a vector of [4 x float]. 611309124Sdim/// 612309124Sdim/// \headerfile <x86intrin.h> 613309124Sdim/// 614314564Sdim/// This intrinsic corresponds to the <c> VCMPLTSS / CMPLTSS </c> instructions. 615309124Sdim/// 616309124Sdim/// \param __a 617309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 618309124Sdim/// 32 bits of this operand are used in the comparison. 619309124Sdim/// \param __b 620309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 621309124Sdim/// 32 bits of this operand are used in the comparison. 622309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 623309124Sdim/// in the low-order bits. 624288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 625249423Sdim_mm_cmpgt_ss(__m128 __a, __m128 __b) 626193326Sed{ 627309124Sdim return (__m128)__builtin_shufflevector((__v4sf)__a, 628309124Sdim (__v4sf)__builtin_ia32_cmpltss((__v4sf)__b, (__v4sf)__a), 629261991Sdim 4, 1, 2, 3); 630193326Sed} 631193326Sed 632309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 633309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 634309124Sdim/// operand are greater than those in the second operand. 635309124Sdim/// 636309124Sdim/// \headerfile <x86intrin.h> 637309124Sdim/// 638314564Sdim/// This intrinsic corresponds to the <c> VCMPLTPS / CMPLTPS </c> instructions. 639309124Sdim/// 640309124Sdim/// \param __a 641309124Sdim/// A 128-bit vector of [4 x float]. 642309124Sdim/// \param __b 643309124Sdim/// A 128-bit vector of [4 x float]. 644309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 645288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 646249423Sdim_mm_cmpgt_ps(__m128 __a, __m128 __b) 647193326Sed{ 648309124Sdim return (__m128)__builtin_ia32_cmpltps((__v4sf)__b, (__v4sf)__a); 649193326Sed} 650193326Sed 651309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 652309124Sdim/// operands to determine if the value in the first operand is greater than 653309124Sdim/// or equal to the corresponding value in the second operand and returns 654309124Sdim/// the result of the comparison in the low-order bits of a vector of 655309124Sdim/// [4 x float]. 656309124Sdim/// 657309124Sdim/// \headerfile <x86intrin.h> 658309124Sdim/// 659314564Sdim/// This intrinsic corresponds to the <c> VCMPLESS / CMPLESS </c> instructions. 660309124Sdim/// 661309124Sdim/// \param __a 662309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 663309124Sdim/// 32 bits of this operand are used in the comparison. 664309124Sdim/// \param __b 665309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 666309124Sdim/// 32 bits of this operand are used in the comparison. 667309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 668309124Sdim/// in the low-order bits. 669288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 670249423Sdim_mm_cmpge_ss(__m128 __a, __m128 __b) 671193326Sed{ 672309124Sdim return (__m128)__builtin_shufflevector((__v4sf)__a, 673309124Sdim (__v4sf)__builtin_ia32_cmpless((__v4sf)__b, (__v4sf)__a), 674261991Sdim 4, 1, 2, 3); 675193326Sed} 676193326Sed 677309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 678309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 679309124Sdim/// operand are greater than or equal to those in the second operand. 680309124Sdim/// 681309124Sdim/// \headerfile <x86intrin.h> 682309124Sdim/// 683314564Sdim/// This intrinsic corresponds to the <c> VCMPLEPS / CMPLEPS </c> instructions. 684309124Sdim/// 685309124Sdim/// \param __a 686309124Sdim/// A 128-bit vector of [4 x float]. 687309124Sdim/// \param __b 688309124Sdim/// A 128-bit vector of [4 x float]. 689309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 690288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 691249423Sdim_mm_cmpge_ps(__m128 __a, __m128 __b) 692193326Sed{ 693309124Sdim return (__m128)__builtin_ia32_cmpleps((__v4sf)__b, (__v4sf)__a); 694193326Sed} 695193326Sed 696309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 697309124Sdim/// operands for inequality and returns the result of the comparison in the 698309124Sdim/// low-order bits of a vector of [4 x float]. 699309124Sdim/// 700309124Sdim/// \headerfile <x86intrin.h> 701309124Sdim/// 702314564Sdim/// This intrinsic corresponds to the <c> VCMPNEQSS / CMPNEQSS </c> 703314564Sdim/// instructions. 704309124Sdim/// 705309124Sdim/// \param __a 706309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 707309124Sdim/// 32 bits of this operand are used in the comparison. 708309124Sdim/// \param __b 709309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 710309124Sdim/// 32 bits of this operand are used in the comparison. 711309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 712309124Sdim/// in the low-order bits. 713288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 714249423Sdim_mm_cmpneq_ss(__m128 __a, __m128 __b) 715193326Sed{ 716309124Sdim return (__m128)__builtin_ia32_cmpneqss((__v4sf)__a, (__v4sf)__b); 717193326Sed} 718193326Sed 719309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 720309124Sdim/// 128-bit vectors of [4 x float] for inequality. 721309124Sdim/// 722309124Sdim/// \headerfile <x86intrin.h> 723309124Sdim/// 724314564Sdim/// This intrinsic corresponds to the <c> VCMPNEQPS / CMPNEQPS </c> 725314564Sdim/// instructions. 726309124Sdim/// 727309124Sdim/// \param __a 728309124Sdim/// A 128-bit vector of [4 x float]. 729309124Sdim/// \param __b 730309124Sdim/// A 128-bit vector of [4 x float]. 731309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 732288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 733249423Sdim_mm_cmpneq_ps(__m128 __a, __m128 __b) 734193326Sed{ 735309124Sdim return (__m128)__builtin_ia32_cmpneqps((__v4sf)__a, (__v4sf)__b); 736193326Sed} 737193326Sed 738309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 739309124Sdim/// operands to determine if the value in the first operand is not less than 740309124Sdim/// the corresponding value in the second operand and returns the result of 741309124Sdim/// the comparison in the low-order bits of a vector of [4 x float]. 742309124Sdim/// 743309124Sdim/// \headerfile <x86intrin.h> 744309124Sdim/// 745314564Sdim/// This intrinsic corresponds to the <c> VCMPNLTSS / CMPNLTSS </c> 746314564Sdim/// instructions. 747309124Sdim/// 748309124Sdim/// \param __a 749309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 750309124Sdim/// 32 bits of this operand are used in the comparison. 751309124Sdim/// \param __b 752309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 753309124Sdim/// 32 bits of this operand are used in the comparison. 754309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 755309124Sdim/// in the low-order bits. 756288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 757249423Sdim_mm_cmpnlt_ss(__m128 __a, __m128 __b) 758193326Sed{ 759309124Sdim return (__m128)__builtin_ia32_cmpnltss((__v4sf)__a, (__v4sf)__b); 760193326Sed} 761193326Sed 762309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 763309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 764309124Sdim/// operand are not less than those in the second operand. 765309124Sdim/// 766309124Sdim/// \headerfile <x86intrin.h> 767309124Sdim/// 768314564Sdim/// This intrinsic corresponds to the <c> VCMPNLTPS / CMPNLTPS </c> 769314564Sdim/// instructions. 770309124Sdim/// 771309124Sdim/// \param __a 772309124Sdim/// A 128-bit vector of [4 x float]. 773309124Sdim/// \param __b 774309124Sdim/// A 128-bit vector of [4 x float]. 775309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 776288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 777249423Sdim_mm_cmpnlt_ps(__m128 __a, __m128 __b) 778193326Sed{ 779309124Sdim return (__m128)__builtin_ia32_cmpnltps((__v4sf)__a, (__v4sf)__b); 780193326Sed} 781193326Sed 782309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 783309124Sdim/// operands to determine if the value in the first operand is not less than 784309124Sdim/// or equal to the corresponding value in the second operand and returns 785309124Sdim/// the result of the comparison in the low-order bits of a vector of 786309124Sdim/// [4 x float]. 787309124Sdim/// 788309124Sdim/// \headerfile <x86intrin.h> 789309124Sdim/// 790314564Sdim/// This intrinsic corresponds to the <c> VCMPNLESS / CMPNLESS </c> 791314564Sdim/// instructions. 792309124Sdim/// 793309124Sdim/// \param __a 794309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 795309124Sdim/// 32 bits of this operand are used in the comparison. 796309124Sdim/// \param __b 797309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 798309124Sdim/// 32 bits of this operand are used in the comparison. 799309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 800309124Sdim/// in the low-order bits. 801288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 802249423Sdim_mm_cmpnle_ss(__m128 __a, __m128 __b) 803193326Sed{ 804309124Sdim return (__m128)__builtin_ia32_cmpnless((__v4sf)__a, (__v4sf)__b); 805193326Sed} 806193326Sed 807309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 808309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 809309124Sdim/// operand are not less than or equal to those in the second operand. 810309124Sdim/// 811309124Sdim/// \headerfile <x86intrin.h> 812309124Sdim/// 813314564Sdim/// This intrinsic corresponds to the <c> VCMPNLEPS / CMPNLEPS </c> 814314564Sdim/// instructions. 815309124Sdim/// 816309124Sdim/// \param __a 817309124Sdim/// A 128-bit vector of [4 x float]. 818309124Sdim/// \param __b 819309124Sdim/// A 128-bit vector of [4 x float]. 820309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 821288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 822249423Sdim_mm_cmpnle_ps(__m128 __a, __m128 __b) 823193326Sed{ 824309124Sdim return (__m128)__builtin_ia32_cmpnleps((__v4sf)__a, (__v4sf)__b); 825193326Sed} 826193326Sed 827309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 828309124Sdim/// operands to determine if the value in the first operand is not greater 829309124Sdim/// than the corresponding value in the second operand and returns the 830309124Sdim/// result of the comparison in the low-order bits of a vector of 831309124Sdim/// [4 x float]. 832309124Sdim/// 833309124Sdim/// \headerfile <x86intrin.h> 834309124Sdim/// 835314564Sdim/// This intrinsic corresponds to the <c> VCMPNLTSS / CMPNLTSS </c> 836314564Sdim/// instructions. 837309124Sdim/// 838309124Sdim/// \param __a 839309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 840309124Sdim/// 32 bits of this operand are used in the comparison. 841309124Sdim/// \param __b 842309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 843309124Sdim/// 32 bits of this operand are used in the comparison. 844309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 845309124Sdim/// in the low-order bits. 846288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 847249423Sdim_mm_cmpngt_ss(__m128 __a, __m128 __b) 848193326Sed{ 849309124Sdim return (__m128)__builtin_shufflevector((__v4sf)__a, 850309124Sdim (__v4sf)__builtin_ia32_cmpnltss((__v4sf)__b, (__v4sf)__a), 851261991Sdim 4, 1, 2, 3); 852193326Sed} 853193326Sed 854309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 855309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 856309124Sdim/// operand are not greater than those in the second operand. 857309124Sdim/// 858309124Sdim/// \headerfile <x86intrin.h> 859309124Sdim/// 860314564Sdim/// This intrinsic corresponds to the <c> VCMPNLTPS / CMPNLTPS </c> 861314564Sdim/// instructions. 862309124Sdim/// 863309124Sdim/// \param __a 864309124Sdim/// A 128-bit vector of [4 x float]. 865309124Sdim/// \param __b 866309124Sdim/// A 128-bit vector of [4 x float]. 867309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 868288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 869249423Sdim_mm_cmpngt_ps(__m128 __a, __m128 __b) 870193326Sed{ 871309124Sdim return (__m128)__builtin_ia32_cmpnltps((__v4sf)__b, (__v4sf)__a); 872193326Sed} 873193326Sed 874309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 875309124Sdim/// operands to determine if the value in the first operand is not greater 876309124Sdim/// than or equal to the corresponding value in the second operand and 877309124Sdim/// returns the result of the comparison in the low-order bits of a vector 878309124Sdim/// of [4 x float]. 879309124Sdim/// 880309124Sdim/// \headerfile <x86intrin.h> 881309124Sdim/// 882314564Sdim/// This intrinsic corresponds to the <c> VCMPNLESS / CMPNLESS </c> 883314564Sdim/// instructions. 884309124Sdim/// 885309124Sdim/// \param __a 886309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 887309124Sdim/// 32 bits of this operand are used in the comparison. 888309124Sdim/// \param __b 889309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 890309124Sdim/// 32 bits of this operand are used in the comparison. 891309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 892309124Sdim/// in the low-order bits. 893288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 894249423Sdim_mm_cmpnge_ss(__m128 __a, __m128 __b) 895193326Sed{ 896309124Sdim return (__m128)__builtin_shufflevector((__v4sf)__a, 897309124Sdim (__v4sf)__builtin_ia32_cmpnless((__v4sf)__b, (__v4sf)__a), 898261991Sdim 4, 1, 2, 3); 899193326Sed} 900193326Sed 901309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 902309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 903309124Sdim/// operand are not greater than or equal to those in the second operand. 904309124Sdim/// 905309124Sdim/// \headerfile <x86intrin.h> 906309124Sdim/// 907314564Sdim/// This intrinsic corresponds to the <c> VCMPNLEPS / CMPNLEPS </c> 908314564Sdim/// instructions. 909309124Sdim/// 910309124Sdim/// \param __a 911309124Sdim/// A 128-bit vector of [4 x float]. 912309124Sdim/// \param __b 913309124Sdim/// A 128-bit vector of [4 x float]. 914309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 915288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 916249423Sdim_mm_cmpnge_ps(__m128 __a, __m128 __b) 917193326Sed{ 918309124Sdim return (__m128)__builtin_ia32_cmpnleps((__v4sf)__b, (__v4sf)__a); 919193326Sed} 920193326Sed 921309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 922309124Sdim/// operands to determine if the value in the first operand is ordered with 923309124Sdim/// respect to the corresponding value in the second operand and returns the 924309124Sdim/// result of the comparison in the low-order bits of a vector of 925309124Sdim/// [4 x float]. 926309124Sdim/// 927309124Sdim/// \headerfile <x86intrin.h> 928309124Sdim/// 929314564Sdim/// This intrinsic corresponds to the <c> VCMPORDSS / CMPORDSS </c> 930314564Sdim/// instructions. 931309124Sdim/// 932309124Sdim/// \param __a 933309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 934309124Sdim/// 32 bits of this operand are used in the comparison. 935309124Sdim/// \param __b 936309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 937309124Sdim/// 32 bits of this operand are used in the comparison. 938309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 939309124Sdim/// in the low-order bits. 940288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 941249423Sdim_mm_cmpord_ss(__m128 __a, __m128 __b) 942193326Sed{ 943309124Sdim return (__m128)__builtin_ia32_cmpordss((__v4sf)__a, (__v4sf)__b); 944193326Sed} 945193326Sed 946309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 947309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 948309124Sdim/// operand are ordered with respect to those in the second operand. 949309124Sdim/// 950309124Sdim/// \headerfile <x86intrin.h> 951309124Sdim/// 952314564Sdim/// This intrinsic corresponds to the <c> VCMPORDPS / CMPORDPS </c> 953314564Sdim/// instructions. 954309124Sdim/// 955309124Sdim/// \param __a 956309124Sdim/// A 128-bit vector of [4 x float]. 957309124Sdim/// \param __b 958309124Sdim/// A 128-bit vector of [4 x float]. 959309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 960288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 961249423Sdim_mm_cmpord_ps(__m128 __a, __m128 __b) 962193326Sed{ 963309124Sdim return (__m128)__builtin_ia32_cmpordps((__v4sf)__a, (__v4sf)__b); 964193326Sed} 965193326Sed 966309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 967309124Sdim/// operands to determine if the value in the first operand is unordered 968309124Sdim/// with respect to the corresponding value in the second operand and 969309124Sdim/// returns the result of the comparison in the low-order bits of a vector 970309124Sdim/// of [4 x float]. 971309124Sdim/// 972309124Sdim/// \headerfile <x86intrin.h> 973309124Sdim/// 974314564Sdim/// This intrinsic corresponds to the <c> VCMPUNORDSS / CMPUNORDSS </c> 975314564Sdim/// instructions. 976309124Sdim/// 977309124Sdim/// \param __a 978309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 979309124Sdim/// 32 bits of this operand are used in the comparison. 980309124Sdim/// \param __b 981309124Sdim/// A 128-bit vector of [4 x float] containing one of the operands. The lower 982309124Sdim/// 32 bits of this operand are used in the comparison. 983309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results 984309124Sdim/// in the low-order bits. 985288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 986249423Sdim_mm_cmpunord_ss(__m128 __a, __m128 __b) 987193326Sed{ 988309124Sdim return (__m128)__builtin_ia32_cmpunordss((__v4sf)__a, (__v4sf)__b); 989193326Sed} 990193326Sed 991309124Sdim/// \brief Compares each of the corresponding 32-bit float values of the 992309124Sdim/// 128-bit vectors of [4 x float] to determine if the values in the first 993309124Sdim/// operand are unordered with respect to those in the second operand. 994309124Sdim/// 995309124Sdim/// \headerfile <x86intrin.h> 996309124Sdim/// 997314564Sdim/// This intrinsic corresponds to the <c> VCMPUNORDPS / CMPUNORDPS </c> 998314564Sdim/// instructions. 999309124Sdim/// 1000309124Sdim/// \param __a 1001309124Sdim/// A 128-bit vector of [4 x float]. 1002309124Sdim/// \param __b 1003309124Sdim/// A 128-bit vector of [4 x float]. 1004309124Sdim/// \returns A 128-bit vector of [4 x float] containing the comparison results. 1005288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1006249423Sdim_mm_cmpunord_ps(__m128 __a, __m128 __b) 1007193326Sed{ 1008309124Sdim return (__m128)__builtin_ia32_cmpunordps((__v4sf)__a, (__v4sf)__b); 1009193326Sed} 1010193326Sed 1011309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1012309124Sdim/// operands for equality and returns the result of the comparison. 1013309124Sdim/// 1014309124Sdim/// \headerfile <x86intrin.h> 1015309124Sdim/// 1016314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> 1017314564Sdim/// instructions. 1018309124Sdim/// 1019309124Sdim/// \param __a 1020309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1021309124Sdim/// used in the comparison. 1022309124Sdim/// \param __b 1023309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1024309124Sdim/// used in the comparison. 1025309124Sdim/// \returns An integer containing the comparison results. 1026288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1027249423Sdim_mm_comieq_ss(__m128 __a, __m128 __b) 1028193326Sed{ 1029309124Sdim return __builtin_ia32_comieq((__v4sf)__a, (__v4sf)__b); 1030193326Sed} 1031193326Sed 1032309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1033309124Sdim/// operands to determine if the first operand is less than the second 1034309124Sdim/// operand and returns the result of the comparison. 1035309124Sdim/// 1036309124Sdim/// \headerfile <x86intrin.h> 1037309124Sdim/// 1038314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> 1039314564Sdim/// instructions. 1040309124Sdim/// 1041309124Sdim/// \param __a 1042309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1043309124Sdim/// used in the comparison. 1044309124Sdim/// \param __b 1045309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1046309124Sdim/// used in the comparison. 1047309124Sdim/// \returns An integer containing the comparison results. 1048288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1049249423Sdim_mm_comilt_ss(__m128 __a, __m128 __b) 1050193326Sed{ 1051309124Sdim return __builtin_ia32_comilt((__v4sf)__a, (__v4sf)__b); 1052193326Sed} 1053193326Sed 1054309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1055309124Sdim/// operands to determine if the first operand is less than or equal to the 1056309124Sdim/// second operand and returns the result of the comparison. 1057309124Sdim/// 1058309124Sdim/// \headerfile <x86intrin.h> 1059309124Sdim/// 1060314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions. 1061309124Sdim/// 1062309124Sdim/// \param __a 1063309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1064309124Sdim/// used in the comparison. 1065309124Sdim/// \param __b 1066309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1067309124Sdim/// used in the comparison. 1068309124Sdim/// \returns An integer containing the comparison results. 1069288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1070249423Sdim_mm_comile_ss(__m128 __a, __m128 __b) 1071193326Sed{ 1072309124Sdim return __builtin_ia32_comile((__v4sf)__a, (__v4sf)__b); 1073193326Sed} 1074193326Sed 1075309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1076309124Sdim/// operands to determine if the first operand is greater than the second 1077309124Sdim/// operand and returns the result of the comparison. 1078309124Sdim/// 1079309124Sdim/// \headerfile <x86intrin.h> 1080309124Sdim/// 1081314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions. 1082309124Sdim/// 1083309124Sdim/// \param __a 1084309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1085309124Sdim/// used in the comparison. 1086309124Sdim/// \param __b 1087309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1088309124Sdim/// used in the comparison. 1089309124Sdim/// \returns An integer containing the comparison results. 1090288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1091249423Sdim_mm_comigt_ss(__m128 __a, __m128 __b) 1092193326Sed{ 1093309124Sdim return __builtin_ia32_comigt((__v4sf)__a, (__v4sf)__b); 1094193326Sed} 1095193326Sed 1096309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1097309124Sdim/// operands to determine if the first operand is greater than or equal to 1098309124Sdim/// the second operand and returns the result of the comparison. 1099309124Sdim/// 1100309124Sdim/// \headerfile <x86intrin.h> 1101309124Sdim/// 1102314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions. 1103309124Sdim/// 1104309124Sdim/// \param __a 1105309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1106309124Sdim/// used in the comparison. 1107309124Sdim/// \param __b 1108309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1109309124Sdim/// used in the comparison. 1110309124Sdim/// \returns An integer containing the comparison results. 1111288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1112249423Sdim_mm_comige_ss(__m128 __a, __m128 __b) 1113193326Sed{ 1114309124Sdim return __builtin_ia32_comige((__v4sf)__a, (__v4sf)__b); 1115193326Sed} 1116193326Sed 1117309124Sdim/// \brief Compares two 32-bit float values in the low-order bits of both 1118309124Sdim/// operands to determine if the first operand is not equal to the second 1119309124Sdim/// operand and returns the result of the comparison. 1120309124Sdim/// 1121309124Sdim/// \headerfile <x86intrin.h> 1122309124Sdim/// 1123314564Sdim/// This intrinsic corresponds to the <c> VCOMISS / COMISS </c> instructions. 1124309124Sdim/// 1125309124Sdim/// \param __a 1126309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1127309124Sdim/// used in the comparison. 1128309124Sdim/// \param __b 1129309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1130309124Sdim/// used in the comparison. 1131309124Sdim/// \returns An integer containing the comparison results. 1132288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1133249423Sdim_mm_comineq_ss(__m128 __a, __m128 __b) 1134193326Sed{ 1135309124Sdim return __builtin_ia32_comineq((__v4sf)__a, (__v4sf)__b); 1136193326Sed} 1137193326Sed 1138309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1139309124Sdim/// the low-order bits of both operands to determine equality and returns 1140309124Sdim/// the result of the comparison. 1141309124Sdim/// 1142309124Sdim/// \headerfile <x86intrin.h> 1143309124Sdim/// 1144314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1145309124Sdim/// 1146309124Sdim/// \param __a 1147309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1148309124Sdim/// used in the comparison. 1149309124Sdim/// \param __b 1150309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1151309124Sdim/// used in the comparison. 1152309124Sdim/// \returns An integer containing the comparison results. 1153288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1154249423Sdim_mm_ucomieq_ss(__m128 __a, __m128 __b) 1155193326Sed{ 1156309124Sdim return __builtin_ia32_ucomieq((__v4sf)__a, (__v4sf)__b); 1157193326Sed} 1158193326Sed 1159309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1160309124Sdim/// the low-order bits of both operands to determine if the first operand is 1161309124Sdim/// less than the second operand and returns the result of the comparison. 1162309124Sdim/// 1163309124Sdim/// \headerfile <x86intrin.h> 1164309124Sdim/// 1165314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1166309124Sdim/// 1167309124Sdim/// \param __a 1168309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1169309124Sdim/// used in the comparison. 1170309124Sdim/// \param __b 1171309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1172309124Sdim/// used in the comparison. 1173309124Sdim/// \returns An integer containing the comparison results. 1174288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1175249423Sdim_mm_ucomilt_ss(__m128 __a, __m128 __b) 1176193326Sed{ 1177309124Sdim return __builtin_ia32_ucomilt((__v4sf)__a, (__v4sf)__b); 1178193326Sed} 1179193326Sed 1180309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1181314564Sdim/// the low-order bits of both operands to determine if the first operand is 1182314564Sdim/// less than or equal to the second operand and returns the result of the 1183314564Sdim/// comparison. 1184309124Sdim/// 1185309124Sdim/// \headerfile <x86intrin.h> 1186309124Sdim/// 1187314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1188309124Sdim/// 1189309124Sdim/// \param __a 1190309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1191309124Sdim/// used in the comparison. 1192309124Sdim/// \param __b 1193309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1194309124Sdim/// used in the comparison. 1195309124Sdim/// \returns An integer containing the comparison results. 1196288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1197249423Sdim_mm_ucomile_ss(__m128 __a, __m128 __b) 1198193326Sed{ 1199309124Sdim return __builtin_ia32_ucomile((__v4sf)__a, (__v4sf)__b); 1200193326Sed} 1201193326Sed 1202309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1203314564Sdim/// the low-order bits of both operands to determine if the first operand is 1204314564Sdim/// greater than the second operand and returns the result of the 1205309124Sdim/// comparison. 1206309124Sdim/// 1207309124Sdim/// \headerfile <x86intrin.h> 1208309124Sdim/// 1209314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1210309124Sdim/// 1211309124Sdim/// \param __a 1212309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1213309124Sdim/// used in the comparison. 1214309124Sdim/// \param __b 1215309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1216309124Sdim/// used in the comparison. 1217309124Sdim/// \returns An integer containing the comparison results. 1218288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1219249423Sdim_mm_ucomigt_ss(__m128 __a, __m128 __b) 1220193326Sed{ 1221309124Sdim return __builtin_ia32_ucomigt((__v4sf)__a, (__v4sf)__b); 1222193326Sed} 1223193326Sed 1224309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1225309124Sdim/// the low-order bits of both operands to determine if the first operand is 1226309124Sdim/// greater than or equal to the second operand and returns the result of 1227309124Sdim/// the comparison. 1228309124Sdim/// 1229309124Sdim/// \headerfile <x86intrin.h> 1230309124Sdim/// 1231314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1232309124Sdim/// 1233309124Sdim/// \param __a 1234309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1235309124Sdim/// used in the comparison. 1236309124Sdim/// \param __b 1237309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1238309124Sdim/// used in the comparison. 1239309124Sdim/// \returns An integer containing the comparison results. 1240288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1241249423Sdim_mm_ucomige_ss(__m128 __a, __m128 __b) 1242193326Sed{ 1243309124Sdim return __builtin_ia32_ucomige((__v4sf)__a, (__v4sf)__b); 1244193326Sed} 1245193326Sed 1246309124Sdim/// \brief Performs an unordered comparison of two 32-bit float values using 1247309124Sdim/// the low-order bits of both operands to determine inequality and returns 1248309124Sdim/// the result of the comparison. 1249309124Sdim/// 1250309124Sdim/// \headerfile <x86intrin.h> 1251309124Sdim/// 1252314564Sdim/// This intrinsic corresponds to the <c> VUCOMISS / UCOMISS </c> instructions. 1253309124Sdim/// 1254309124Sdim/// \param __a 1255309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1256309124Sdim/// used in the comparison. 1257309124Sdim/// \param __b 1258309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1259309124Sdim/// used in the comparison. 1260309124Sdim/// \returns An integer containing the comparison results. 1261288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1262249423Sdim_mm_ucomineq_ss(__m128 __a, __m128 __b) 1263193326Sed{ 1264309124Sdim return __builtin_ia32_ucomineq((__v4sf)__a, (__v4sf)__b); 1265193326Sed} 1266193326Sed 1267309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1268309124Sdim/// [4 x float] into a 32-bit integer. 1269309124Sdim/// 1270309124Sdim/// \headerfile <x86intrin.h> 1271309124Sdim/// 1272314564Sdim/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c> 1273314564Sdim/// instructions. 1274309124Sdim/// 1275309124Sdim/// \param __a 1276309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1277309124Sdim/// used in the conversion. 1278309124Sdim/// \returns A 32-bit integer containing the converted value. 1279288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1280249423Sdim_mm_cvtss_si32(__m128 __a) 1281193326Sed{ 1282309124Sdim return __builtin_ia32_cvtss2si((__v4sf)__a); 1283193326Sed} 1284193326Sed 1285309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1286309124Sdim/// [4 x float] into a 32-bit integer. 1287309124Sdim/// 1288309124Sdim/// \headerfile <x86intrin.h> 1289309124Sdim/// 1290314564Sdim/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c> 1291314564Sdim/// instructions. 1292309124Sdim/// 1293309124Sdim/// \param __a 1294309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1295309124Sdim/// used in the conversion. 1296309124Sdim/// \returns A 32-bit integer containing the converted value. 1297288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1298249423Sdim_mm_cvt_ss2si(__m128 __a) 1299204643Srdivacky{ 1300249423Sdim return _mm_cvtss_si32(__a); 1301204643Srdivacky} 1302204643Srdivacky 1303193576Sed#ifdef __x86_64__ 1304193576Sed 1305309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1306309124Sdim/// [4 x float] into a 64-bit integer. 1307309124Sdim/// 1308309124Sdim/// \headerfile <x86intrin.h> 1309309124Sdim/// 1310314564Sdim/// This intrinsic corresponds to the <c> VCVTSS2SI / CVTSS2SI </c> 1311314564Sdim/// instructions. 1312309124Sdim/// 1313309124Sdim/// \param __a 1314309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1315309124Sdim/// used in the conversion. 1316309124Sdim/// \returns A 64-bit integer containing the converted value. 1317288943Sdimstatic __inline__ long long __DEFAULT_FN_ATTRS 1318249423Sdim_mm_cvtss_si64(__m128 __a) 1319193326Sed{ 1320309124Sdim return __builtin_ia32_cvtss2si64((__v4sf)__a); 1321193326Sed} 1322193326Sed 1323193576Sed#endif 1324193576Sed 1325309124Sdim/// \brief Converts two low-order float values in a 128-bit vector of 1326309124Sdim/// [4 x float] into a 64-bit vector of [2 x i32]. 1327309124Sdim/// 1328309124Sdim/// \headerfile <x86intrin.h> 1329309124Sdim/// 1330314564Sdim/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction. 1331309124Sdim/// 1332309124Sdim/// \param __a 1333309124Sdim/// A 128-bit vector of [4 x float]. 1334309124Sdim/// \returns A 64-bit integer vector containing the converted values. 1335288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 1336249423Sdim_mm_cvtps_pi32(__m128 __a) 1337193326Sed{ 1338309124Sdim return (__m64)__builtin_ia32_cvtps2pi((__v4sf)__a); 1339193326Sed} 1340193326Sed 1341309124Sdim/// \brief Converts two low-order float values in a 128-bit vector of 1342309124Sdim/// [4 x float] into a 64-bit vector of [2 x i32]. 1343309124Sdim/// 1344309124Sdim/// \headerfile <x86intrin.h> 1345309124Sdim/// 1346314564Sdim/// This intrinsic corresponds to the <c> CVTPS2PI </c> instruction. 1347309124Sdim/// 1348309124Sdim/// \param __a 1349309124Sdim/// A 128-bit vector of [4 x float]. 1350309124Sdim/// \returns A 64-bit integer vector containing the converted values. 1351288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 1352249423Sdim_mm_cvt_ps2pi(__m128 __a) 1353212904Sdim{ 1354249423Sdim return _mm_cvtps_pi32(__a); 1355212904Sdim} 1356212904Sdim 1357309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1358309124Sdim/// [4 x float] into a 32-bit integer, truncating the result when it is 1359309124Sdim/// inexact. 1360309124Sdim/// 1361309124Sdim/// \headerfile <x86intrin.h> 1362309124Sdim/// 1363314564Sdim/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c> 1364314564Sdim/// instructions. 1365309124Sdim/// 1366309124Sdim/// \param __a 1367309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1368309124Sdim/// used in the conversion. 1369309124Sdim/// \returns A 32-bit integer containing the converted value. 1370288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1371249423Sdim_mm_cvttss_si32(__m128 __a) 1372193326Sed{ 1373309124Sdim return __builtin_ia32_cvttss2si((__v4sf)__a); 1374193326Sed} 1375193326Sed 1376309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1377309124Sdim/// [4 x float] into a 32-bit integer, truncating the result when it is 1378309124Sdim/// inexact. 1379309124Sdim/// 1380309124Sdim/// \headerfile <x86intrin.h> 1381309124Sdim/// 1382314564Sdim/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c> 1383314564Sdim/// instructions. 1384309124Sdim/// 1385309124Sdim/// \param __a 1386309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1387309124Sdim/// used in the conversion. 1388309124Sdim/// \returns A 32-bit integer containing the converted value. 1389288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 1390249423Sdim_mm_cvtt_ss2si(__m128 __a) 1391204643Srdivacky{ 1392249423Sdim return _mm_cvttss_si32(__a); 1393204643Srdivacky} 1394204643Srdivacky 1395314564Sdim#ifdef __x86_64__ 1396309124Sdim/// \brief Converts a float value contained in the lower 32 bits of a vector of 1397309124Sdim/// [4 x float] into a 64-bit integer, truncating the result when it is 1398309124Sdim/// inexact. 1399309124Sdim/// 1400309124Sdim/// \headerfile <x86intrin.h> 1401309124Sdim/// 1402314564Sdim/// This intrinsic corresponds to the <c> VCVTTSS2SI / CVTTSS2SI </c> 1403314564Sdim/// instructions. 1404309124Sdim/// 1405309124Sdim/// \param __a 1406309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1407309124Sdim/// used in the conversion. 1408309124Sdim/// \returns A 64-bit integer containing the converted value. 1409288943Sdimstatic __inline__ long long __DEFAULT_FN_ATTRS 1410249423Sdim_mm_cvttss_si64(__m128 __a) 1411193326Sed{ 1412309124Sdim return __builtin_ia32_cvttss2si64((__v4sf)__a); 1413193326Sed} 1414314564Sdim#endif 1415193326Sed 1416309124Sdim/// \brief Converts two low-order float values in a 128-bit vector of 1417309124Sdim/// [4 x float] into a 64-bit vector of [2 x i32], truncating the result 1418309124Sdim/// when it is inexact. 1419309124Sdim/// 1420309124Sdim/// \headerfile <x86intrin.h> 1421309124Sdim/// 1422314564Sdim/// This intrinsic corresponds to the <c> CVTTPS2PI / VTTPS2PI </c> 1423314564Sdim/// instructions. 1424309124Sdim/// 1425309124Sdim/// \param __a 1426309124Sdim/// A 128-bit vector of [4 x float]. 1427309124Sdim/// \returns A 64-bit integer vector containing the converted values. 1428288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 1429249423Sdim_mm_cvttps_pi32(__m128 __a) 1430193326Sed{ 1431309124Sdim return (__m64)__builtin_ia32_cvttps2pi((__v4sf)__a); 1432193326Sed} 1433193326Sed 1434309124Sdim/// \brief Converts two low-order float values in a 128-bit vector of [4 x 1435309124Sdim/// float] into a 64-bit vector of [2 x i32], truncating the result when it 1436309124Sdim/// is inexact. 1437309124Sdim/// 1438309124Sdim/// \headerfile <x86intrin.h> 1439309124Sdim/// 1440314564Sdim/// This intrinsic corresponds to the <c> CVTTPS2PI </c> instruction. 1441309124Sdim/// 1442309124Sdim/// \param __a 1443309124Sdim/// A 128-bit vector of [4 x float]. 1444309124Sdim/// \returns A 64-bit integer vector containing the converted values. 1445288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 1446249423Sdim_mm_cvtt_ps2pi(__m128 __a) 1447212904Sdim{ 1448249423Sdim return _mm_cvttps_pi32(__a); 1449212904Sdim} 1450212904Sdim 1451309124Sdim/// \brief Converts a 32-bit signed integer value into a floating point value 1452309124Sdim/// and writes it to the lower 32 bits of the destination. The remaining 1453309124Sdim/// higher order elements of the destination vector are copied from the 1454309124Sdim/// corresponding elements in the first operand. 1455309124Sdim/// 1456309124Sdim/// \headerfile <x86intrin.h> 1457309124Sdim/// 1458314564Sdim/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction. 1459309124Sdim/// 1460309124Sdim/// \param __a 1461309124Sdim/// A 128-bit vector of [4 x float]. 1462309124Sdim/// \param __b 1463309124Sdim/// A 32-bit signed integer operand containing the value to be converted. 1464309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 1465309124Sdim/// converted value of the second operand. The upper 96 bits are copied from 1466309124Sdim/// the upper 96 bits of the first operand. 1467288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1468249423Sdim_mm_cvtsi32_ss(__m128 __a, int __b) 1469193326Sed{ 1470249423Sdim __a[0] = __b; 1471249423Sdim return __a; 1472193326Sed} 1473193326Sed 1474309124Sdim/// \brief Converts a 32-bit signed integer value into a floating point value 1475309124Sdim/// and writes it to the lower 32 bits of the destination. The remaining 1476309124Sdim/// higher order elements of the destination are copied from the 1477309124Sdim/// corresponding elements in the first operand. 1478309124Sdim/// 1479309124Sdim/// \headerfile <x86intrin.h> 1480309124Sdim/// 1481314564Sdim/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction. 1482309124Sdim/// 1483309124Sdim/// \param __a 1484309124Sdim/// A 128-bit vector of [4 x float]. 1485309124Sdim/// \param __b 1486309124Sdim/// A 32-bit signed integer operand containing the value to be converted. 1487309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 1488309124Sdim/// converted value of the second operand. The upper 96 bits are copied from 1489309124Sdim/// the upper 96 bits of the first operand. 1490288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1491249423Sdim_mm_cvt_si2ss(__m128 __a, int __b) 1492212904Sdim{ 1493249423Sdim return _mm_cvtsi32_ss(__a, __b); 1494212904Sdim} 1495212904Sdim 1496193326Sed#ifdef __x86_64__ 1497193326Sed 1498309124Sdim/// \brief Converts a 64-bit signed integer value into a floating point value 1499309124Sdim/// and writes it to the lower 32 bits of the destination. The remaining 1500309124Sdim/// higher order elements of the destination are copied from the 1501309124Sdim/// corresponding elements in the first operand. 1502309124Sdim/// 1503309124Sdim/// \headerfile <x86intrin.h> 1504309124Sdim/// 1505314564Sdim/// This intrinsic corresponds to the <c> VCVTSI2SS / CVTSI2SS </c> instruction. 1506309124Sdim/// 1507309124Sdim/// \param __a 1508309124Sdim/// A 128-bit vector of [4 x float]. 1509309124Sdim/// \param __b 1510309124Sdim/// A 64-bit signed integer operand containing the value to be converted. 1511309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 32 bits contain the 1512309124Sdim/// converted value of the second operand. The upper 96 bits are copied from 1513309124Sdim/// the upper 96 bits of the first operand. 1514288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1515249423Sdim_mm_cvtsi64_ss(__m128 __a, long long __b) 1516193326Sed{ 1517249423Sdim __a[0] = __b; 1518249423Sdim return __a; 1519193326Sed} 1520193326Sed 1521193326Sed#endif 1522193326Sed 1523309124Sdim/// \brief Converts two elements of a 64-bit vector of [2 x i32] into two 1524309124Sdim/// floating point values and writes them to the lower 64-bits of the 1525309124Sdim/// destination. The remaining higher order elements of the destination are 1526309124Sdim/// copied from the corresponding elements in the first operand. 1527309124Sdim/// 1528309124Sdim/// \headerfile <x86intrin.h> 1529309124Sdim/// 1530314564Sdim/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction. 1531309124Sdim/// 1532309124Sdim/// \param __a 1533309124Sdim/// A 128-bit vector of [4 x float]. 1534309124Sdim/// \param __b 1535309124Sdim/// A 64-bit vector of [2 x i32]. The elements in this vector are converted 1536309124Sdim/// and written to the corresponding low-order elements in the destination. 1537309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the 1538309124Sdim/// converted value of the second operand. The upper 64 bits are copied from 1539309124Sdim/// the upper 64 bits of the first operand. 1540288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1541249423Sdim_mm_cvtpi32_ps(__m128 __a, __m64 __b) 1542193326Sed{ 1543309124Sdim return __builtin_ia32_cvtpi2ps((__v4sf)__a, (__v2si)__b); 1544193326Sed} 1545193326Sed 1546309124Sdim/// \brief Converts two elements of a 64-bit vector of [2 x i32] into two 1547309124Sdim/// floating point values and writes them to the lower 64-bits of the 1548309124Sdim/// destination. The remaining higher order elements of the destination are 1549309124Sdim/// copied from the corresponding elements in the first operand. 1550309124Sdim/// 1551309124Sdim/// \headerfile <x86intrin.h> 1552309124Sdim/// 1553314564Sdim/// This intrinsic corresponds to the <c> CVTPI2PS </c> instruction. 1554309124Sdim/// 1555309124Sdim/// \param __a 1556309124Sdim/// A 128-bit vector of [4 x float]. 1557309124Sdim/// \param __b 1558309124Sdim/// A 64-bit vector of [2 x i32]. The elements in this vector are converted 1559309124Sdim/// and written to the corresponding low-order elements in the destination. 1560309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the 1561309124Sdim/// converted value from the second operand. The upper 64 bits are copied 1562309124Sdim/// from the upper 64 bits of the first operand. 1563288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1564249423Sdim_mm_cvt_pi2ps(__m128 __a, __m64 __b) 1565212904Sdim{ 1566249423Sdim return _mm_cvtpi32_ps(__a, __b); 1567212904Sdim} 1568212904Sdim 1569309124Sdim/// \brief Extracts a float value contained in the lower 32 bits of a vector of 1570309124Sdim/// [4 x float]. 1571309124Sdim/// 1572309124Sdim/// \headerfile <x86intrin.h> 1573309124Sdim/// 1574314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction. 1575309124Sdim/// 1576309124Sdim/// \param __a 1577309124Sdim/// A 128-bit vector of [4 x float]. The lower 32 bits of this operand are 1578309124Sdim/// used in the extraction. 1579309124Sdim/// \returns A 32-bit float containing the extracted value. 1580288943Sdimstatic __inline__ float __DEFAULT_FN_ATTRS 1581249423Sdim_mm_cvtss_f32(__m128 __a) 1582193326Sed{ 1583249423Sdim return __a[0]; 1584193326Sed} 1585193326Sed 1586314564Sdim/// \brief Loads two packed float values from the address \a __p into the 1587309124Sdim/// high-order bits of a 128-bit vector of [4 x float]. The low-order bits 1588309124Sdim/// are copied from the low-order bits of the first operand. 1589309124Sdim/// 1590309124Sdim/// \headerfile <x86intrin.h> 1591309124Sdim/// 1592314564Sdim/// This intrinsic corresponds to the <c> VMOVHPD / MOVHPD </c> instruction. 1593309124Sdim/// 1594309124Sdim/// \param __a 1595309124Sdim/// A 128-bit vector of [4 x float]. Bits [63:0] are written to bits [63:0] 1596309124Sdim/// of the destination. 1597309124Sdim/// \param __p 1598309124Sdim/// A pointer to two packed float values. Bits [63:0] are written to bits 1599309124Sdim/// [127:64] of the destination. 1600309124Sdim/// \returns A 128-bit vector of [4 x float] containing the moved values. 1601288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1602249423Sdim_mm_loadh_pi(__m128 __a, const __m64 *__p) 1603193326Sed{ 1604226633Sdim typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8))); 1605226633Sdim struct __mm_loadh_pi_struct { 1606249423Sdim __mm_loadh_pi_v2f32 __u; 1607226633Sdim } __attribute__((__packed__, __may_alias__)); 1608249423Sdim __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u; 1609249423Sdim __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); 1610249423Sdim return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5); 1611193326Sed} 1612193326Sed 1613314564Sdim/// \brief Loads two packed float values from the address \a __p into the 1614314564Sdim/// low-order bits of a 128-bit vector of [4 x float]. The high-order bits 1615314564Sdim/// are copied from the high-order bits of the first operand. 1616309124Sdim/// 1617309124Sdim/// \headerfile <x86intrin.h> 1618309124Sdim/// 1619314564Sdim/// This intrinsic corresponds to the <c> VMOVLPD / MOVLPD </c> instruction. 1620309124Sdim/// 1621309124Sdim/// \param __a 1622309124Sdim/// A 128-bit vector of [4 x float]. Bits [127:64] are written to bits 1623309124Sdim/// [127:64] of the destination. 1624309124Sdim/// \param __p 1625309124Sdim/// A pointer to two packed float values. Bits [63:0] are written to bits 1626309124Sdim/// [63:0] of the destination. 1627309124Sdim/// \returns A 128-bit vector of [4 x float] containing the moved values. 1628288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1629249423Sdim_mm_loadl_pi(__m128 __a, const __m64 *__p) 1630193326Sed{ 1631226633Sdim typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8))); 1632226633Sdim struct __mm_loadl_pi_struct { 1633249423Sdim __mm_loadl_pi_v2f32 __u; 1634226633Sdim } __attribute__((__packed__, __may_alias__)); 1635249423Sdim __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u; 1636249423Sdim __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); 1637249423Sdim return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3); 1638193326Sed} 1639193326Sed 1640309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float]. The lower 1641309124Sdim/// 32 bits of the vector are initialized with the single-precision 1642309124Sdim/// floating-point value loaded from a specified memory location. The upper 1643309124Sdim/// 96 bits are set to zero. 1644309124Sdim/// 1645309124Sdim/// \headerfile <x86intrin.h> 1646309124Sdim/// 1647314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction. 1648309124Sdim/// 1649309124Sdim/// \param __p 1650309124Sdim/// A pointer to a 32-bit memory location containing a single-precision 1651309124Sdim/// floating-point value. 1652309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. The 1653309124Sdim/// lower 32 bits contain the value loaded from the memory location. The 1654309124Sdim/// upper 96 bits are set to zero. 1655288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1656249423Sdim_mm_load_ss(const float *__p) 1657193326Sed{ 1658226633Sdim struct __mm_load_ss_struct { 1659249423Sdim float __u; 1660226633Sdim } __attribute__((__packed__, __may_alias__)); 1661249423Sdim float __u = ((struct __mm_load_ss_struct*)__p)->__u; 1662249423Sdim return (__m128){ __u, 0, 0, 0 }; 1663193326Sed} 1664193326Sed 1665309124Sdim/// \brief Loads a 32-bit float value and duplicates it to all four vector 1666309124Sdim/// elements of a 128-bit vector of [4 x float]. 1667309124Sdim/// 1668309124Sdim/// \headerfile <x86intrin.h> 1669309124Sdim/// 1670314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS + shuffling </c> 1671309124Sdim/// instruction. 1672309124Sdim/// 1673309124Sdim/// \param __p 1674309124Sdim/// A pointer to a float value to be loaded and duplicated. 1675314564Sdim/// \returns A 128-bit vector of [4 x float] containing the loaded and 1676314564Sdim/// duplicated values. 1677288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1678249423Sdim_mm_load1_ps(const float *__p) 1679193326Sed{ 1680226633Sdim struct __mm_load1_ps_struct { 1681249423Sdim float __u; 1682226633Sdim } __attribute__((__packed__, __may_alias__)); 1683249423Sdim float __u = ((struct __mm_load1_ps_struct*)__p)->__u; 1684249423Sdim return (__m128){ __u, __u, __u, __u }; 1685193326Sed} 1686193326Sed 1687193326Sed#define _mm_load_ps1(p) _mm_load1_ps(p) 1688193326Sed 1689309124Sdim/// \brief Loads a 128-bit floating-point vector of [4 x float] from an aligned 1690309124Sdim/// memory location. 1691309124Sdim/// 1692309124Sdim/// \headerfile <x86intrin.h> 1693309124Sdim/// 1694314564Sdim/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction. 1695309124Sdim/// 1696309124Sdim/// \param __p 1697309124Sdim/// A pointer to a 128-bit memory location. The address of the memory 1698309124Sdim/// location has to be 128-bit aligned. 1699309124Sdim/// \returns A 128-bit vector of [4 x float] containing the loaded valus. 1700288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1701249423Sdim_mm_load_ps(const float *__p) 1702193326Sed{ 1703249423Sdim return *(__m128*)__p; 1704193326Sed} 1705193326Sed 1706309124Sdim/// \brief Loads a 128-bit floating-point vector of [4 x float] from an 1707309124Sdim/// unaligned memory location. 1708309124Sdim/// 1709309124Sdim/// \headerfile <x86intrin.h> 1710309124Sdim/// 1711314564Sdim/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction. 1712309124Sdim/// 1713309124Sdim/// \param __p 1714309124Sdim/// A pointer to a 128-bit memory location. The address of the memory 1715309124Sdim/// location does not have to be aligned. 1716309124Sdim/// \returns A 128-bit vector of [4 x float] containing the loaded values. 1717288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1718249423Sdim_mm_loadu_ps(const float *__p) 1719193326Sed{ 1720223017Sdim struct __loadu_ps { 1721249423Sdim __m128 __v; 1722226633Sdim } __attribute__((__packed__, __may_alias__)); 1723249423Sdim return ((struct __loadu_ps*)__p)->__v; 1724193326Sed} 1725193326Sed 1726309124Sdim/// \brief Loads four packed float values, in reverse order, from an aligned 1727309124Sdim/// memory location to 32-bit elements in a 128-bit vector of [4 x float]. 1728309124Sdim/// 1729309124Sdim/// \headerfile <x86intrin.h> 1730309124Sdim/// 1731314564Sdim/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c> 1732309124Sdim/// instruction. 1733309124Sdim/// 1734309124Sdim/// \param __p 1735309124Sdim/// A pointer to a 128-bit memory location. The address of the memory 1736309124Sdim/// location has to be 128-bit aligned. 1737309124Sdim/// \returns A 128-bit vector of [4 x float] containing the moved values, loaded 1738309124Sdim/// in reverse order. 1739288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1740249423Sdim_mm_loadr_ps(const float *__p) 1741193326Sed{ 1742249423Sdim __m128 __a = _mm_load_ps(__p); 1743309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0); 1744193326Sed} 1745193326Sed 1746309124Sdim/// \brief Create a 128-bit vector of [4 x float] with undefined values. 1747309124Sdim/// 1748309124Sdim/// \headerfile <x86intrin.h> 1749309124Sdim/// 1750309124Sdim/// This intrinsic has no corresponding instruction. 1751309124Sdim/// 1752309124Sdim/// \returns A 128-bit vector of [4 x float] containing undefined values. 1753288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1754309124Sdim_mm_undefined_ps(void) 1755296417Sdim{ 1756296417Sdim return (__m128)__builtin_ia32_undef128(); 1757296417Sdim} 1758296417Sdim 1759309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float]. The lower 1760309124Sdim/// 32 bits of the vector are initialized with the specified single-precision 1761309124Sdim/// floating-point value. The upper 96 bits are set to zero. 1762309124Sdim/// 1763309124Sdim/// \headerfile <x86intrin.h> 1764309124Sdim/// 1765314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction. 1766309124Sdim/// 1767309124Sdim/// \param __w 1768309124Sdim/// A single-precision floating-point value used to initialize the lower 32 1769309124Sdim/// bits of the result. 1770309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. The 1771309124Sdim/// lower 32 bits contain the value provided in the source operand. The 1772309124Sdim/// upper 96 bits are set to zero. 1773296417Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1774249423Sdim_mm_set_ss(float __w) 1775193326Sed{ 1776249423Sdim return (__m128){ __w, 0, 0, 0 }; 1777193326Sed} 1778193326Sed 1779309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float], with each 1780309124Sdim/// of the four single-precision floating-point vector elements set to the 1781309124Sdim/// specified single-precision floating-point value. 1782309124Sdim/// 1783309124Sdim/// \headerfile <x86intrin.h> 1784309124Sdim/// 1785314564Sdim/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction. 1786309124Sdim/// 1787309124Sdim/// \param __w 1788309124Sdim/// A single-precision floating-point value used to initialize each vector 1789309124Sdim/// element of the result. 1790309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. 1791288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1792249423Sdim_mm_set1_ps(float __w) 1793193326Sed{ 1794249423Sdim return (__m128){ __w, __w, __w, __w }; 1795193326Sed} 1796193326Sed 1797276479Sdim/* Microsoft specific. */ 1798309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float], with each 1799309124Sdim/// of the four single-precision floating-point vector elements set to the 1800309124Sdim/// specified single-precision floating-point value. 1801309124Sdim/// 1802309124Sdim/// \headerfile <x86intrin.h> 1803309124Sdim/// 1804314564Sdim/// This intrinsic corresponds to the <c> VPERMILPS / PERMILPS </c> instruction. 1805309124Sdim/// 1806309124Sdim/// \param __w 1807309124Sdim/// A single-precision floating-point value used to initialize each vector 1808309124Sdim/// element of the result. 1809309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. 1810288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1811249423Sdim_mm_set_ps1(float __w) 1812193326Sed{ 1813249423Sdim return _mm_set1_ps(__w); 1814193326Sed} 1815193326Sed 1816309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float] 1817309124Sdim/// initialized with the specified single-precision floating-point values. 1818309124Sdim/// 1819309124Sdim/// \headerfile <x86intrin.h> 1820309124Sdim/// 1821309124Sdim/// This intrinsic is a utility function and does not correspond to a specific 1822309124Sdim/// instruction. 1823309124Sdim/// 1824309124Sdim/// \param __z 1825309124Sdim/// A single-precision floating-point value used to initialize bits [127:96] 1826309124Sdim/// of the result. 1827309124Sdim/// \param __y 1828309124Sdim/// A single-precision floating-point value used to initialize bits [95:64] 1829309124Sdim/// of the result. 1830309124Sdim/// \param __x 1831309124Sdim/// A single-precision floating-point value used to initialize bits [63:32] 1832309124Sdim/// of the result. 1833309124Sdim/// \param __w 1834309124Sdim/// A single-precision floating-point value used to initialize bits [31:0] 1835309124Sdim/// of the result. 1836309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. 1837288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1838249423Sdim_mm_set_ps(float __z, float __y, float __x, float __w) 1839193326Sed{ 1840249423Sdim return (__m128){ __w, __x, __y, __z }; 1841193326Sed} 1842193326Sed 1843309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float], 1844309124Sdim/// initialized in reverse order with the specified 32-bit single-precision 1845309124Sdim/// float-point values. 1846309124Sdim/// 1847309124Sdim/// \headerfile <x86intrin.h> 1848309124Sdim/// 1849309124Sdim/// This intrinsic is a utility function and does not correspond to a specific 1850309124Sdim/// instruction. 1851309124Sdim/// 1852309124Sdim/// \param __z 1853309124Sdim/// A single-precision floating-point value used to initialize bits [31:0] 1854309124Sdim/// of the result. 1855309124Sdim/// \param __y 1856309124Sdim/// A single-precision floating-point value used to initialize bits [63:32] 1857309124Sdim/// of the result. 1858309124Sdim/// \param __x 1859309124Sdim/// A single-precision floating-point value used to initialize bits [95:64] 1860309124Sdim/// of the result. 1861309124Sdim/// \param __w 1862309124Sdim/// A single-precision floating-point value used to initialize bits [127:96] 1863309124Sdim/// of the result. 1864309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float]. 1865288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1866249423Sdim_mm_setr_ps(float __z, float __y, float __x, float __w) 1867193326Sed{ 1868249423Sdim return (__m128){ __z, __y, __x, __w }; 1869193326Sed} 1870193326Sed 1871309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float] initialized 1872309124Sdim/// to zero. 1873309124Sdim/// 1874309124Sdim/// \headerfile <x86intrin.h> 1875309124Sdim/// 1876314564Sdim/// This intrinsic corresponds to the <c> VXORPS / XORPS </c> instruction. 1877309124Sdim/// 1878309124Sdim/// \returns An initialized 128-bit floating-point vector of [4 x float] with 1879309124Sdim/// all elements set to zero. 1880288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 1881193326Sed_mm_setzero_ps(void) 1882193326Sed{ 1883193326Sed return (__m128){ 0, 0, 0, 0 }; 1884193326Sed} 1885193326Sed 1886309124Sdim/// \brief Stores the upper 64 bits of a 128-bit vector of [4 x float] to a 1887309124Sdim/// memory location. 1888309124Sdim/// 1889309124Sdim/// \headerfile <x86intrin.h> 1890309124Sdim/// 1891314564Sdim/// This intrinsic corresponds to the <c> VPEXTRQ / MOVQ </c> instruction. 1892309124Sdim/// 1893309124Sdim/// \param __p 1894309124Sdim/// A pointer to a 64-bit memory location. 1895309124Sdim/// \param __a 1896309124Sdim/// A 128-bit vector of [4 x float] containing the values to be stored. 1897288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1898249423Sdim_mm_storeh_pi(__m64 *__p, __m128 __a) 1899193326Sed{ 1900309124Sdim __builtin_ia32_storehps((__v2si *)__p, (__v4sf)__a); 1901193326Sed} 1902193326Sed 1903309124Sdim/// \brief Stores the lower 64 bits of a 128-bit vector of [4 x float] to a 1904309124Sdim/// memory location. 1905309124Sdim/// 1906309124Sdim/// \headerfile <x86intrin.h> 1907309124Sdim/// 1908314564Sdim/// This intrinsic corresponds to the <c> VMOVLPS / MOVLPS </c> instruction. 1909309124Sdim/// 1910309124Sdim/// \param __p 1911309124Sdim/// A pointer to a memory location that will receive the float values. 1912309124Sdim/// \param __a 1913309124Sdim/// A 128-bit vector of [4 x float] containing the values to be stored. 1914288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1915249423Sdim_mm_storel_pi(__m64 *__p, __m128 __a) 1916193326Sed{ 1917309124Sdim __builtin_ia32_storelps((__v2si *)__p, (__v4sf)__a); 1918193326Sed} 1919193326Sed 1920309124Sdim/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] to a 1921309124Sdim/// memory location. 1922309124Sdim/// 1923309124Sdim/// \headerfile <x86intrin.h> 1924309124Sdim/// 1925314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction. 1926309124Sdim/// 1927309124Sdim/// \param __p 1928309124Sdim/// A pointer to a 32-bit memory location. 1929309124Sdim/// \param __a 1930309124Sdim/// A 128-bit vector of [4 x float] containing the value to be stored. 1931288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1932249423Sdim_mm_store_ss(float *__p, __m128 __a) 1933193326Sed{ 1934226633Sdim struct __mm_store_ss_struct { 1935249423Sdim float __u; 1936226633Sdim } __attribute__((__packed__, __may_alias__)); 1937249423Sdim ((struct __mm_store_ss_struct*)__p)->__u = __a[0]; 1938193326Sed} 1939193326Sed 1940314564Sdim/// \brief Stores a 128-bit vector of [4 x float] to an unaligned memory 1941314564Sdim/// location. 1942309124Sdim/// 1943309124Sdim/// \headerfile <x86intrin.h> 1944309124Sdim/// 1945314564Sdim/// This intrinsic corresponds to the <c> VMOVUPS / MOVUPS </c> instruction. 1946309124Sdim/// 1947309124Sdim/// \param __p 1948309124Sdim/// A pointer to a 128-bit memory location. The address of the memory 1949309124Sdim/// location does not have to be aligned. 1950309124Sdim/// \param __a 1951309124Sdim/// A 128-bit vector of [4 x float] containing the values to be stored. 1952288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1953249423Sdim_mm_storeu_ps(float *__p, __m128 __a) 1954193326Sed{ 1955309124Sdim struct __storeu_ps { 1956309124Sdim __m128 __v; 1957309124Sdim } __attribute__((__packed__, __may_alias__)); 1958309124Sdim ((struct __storeu_ps*)__p)->__v = __a; 1959193326Sed} 1960193326Sed 1961314564Sdim/// \brief Stores a 128-bit vector of [4 x float] into an aligned memory 1962314564Sdim/// location. 1963309124Sdim/// 1964309124Sdim/// \headerfile <x86intrin.h> 1965309124Sdim/// 1966314564Sdim/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS </c> instruction. 1967309124Sdim/// 1968309124Sdim/// \param __p 1969314564Sdim/// A pointer to a 128-bit memory location. The address of the memory 1970314564Sdim/// location has to be 16-byte aligned. 1971309124Sdim/// \param __a 1972314564Sdim/// A 128-bit vector of [4 x float] containing the values to be stored. 1973288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1974309124Sdim_mm_store_ps(float *__p, __m128 __a) 1975193326Sed{ 1976309124Sdim *(__m128*)__p = __a; 1977193326Sed} 1978193326Sed 1979309124Sdim/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] into 1980309124Sdim/// four contiguous elements in an aligned memory location. 1981309124Sdim/// 1982309124Sdim/// \headerfile <x86intrin.h> 1983309124Sdim/// 1984314564Sdim/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c> 1985309124Sdim/// instruction. 1986309124Sdim/// 1987309124Sdim/// \param __p 1988309124Sdim/// A pointer to a 128-bit memory location. 1989309124Sdim/// \param __a 1990309124Sdim/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each 1991314564Sdim/// of the four contiguous elements pointed by \a __p. 1992288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 1993309124Sdim_mm_store1_ps(float *__p, __m128 __a) 1994212904Sdim{ 1995309124Sdim __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0); 1996309124Sdim _mm_store_ps(__p, __a); 1997212904Sdim} 1998212904Sdim 1999314564Sdim/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] into 2000314564Sdim/// four contiguous elements in an aligned memory location. 2001309124Sdim/// 2002309124Sdim/// \headerfile <x86intrin.h> 2003309124Sdim/// 2004314564Sdim/// This intrinsic corresponds to <c> VMOVAPS / MOVAPS + shuffling </c> 2005314564Sdim/// instruction. 2006309124Sdim/// 2007309124Sdim/// \param __p 2008314564Sdim/// A pointer to a 128-bit memory location. 2009309124Sdim/// \param __a 2010314564Sdim/// A 128-bit vector of [4 x float] whose lower 32 bits are stored to each 2011314564Sdim/// of the four contiguous elements pointed by \a __p. 2012288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 2013309124Sdim_mm_store_ps1(float *__p, __m128 __a) 2014193326Sed{ 2015309124Sdim return _mm_store1_ps(__p, __a); 2016193326Sed} 2017193326Sed 2018309124Sdim/// \brief Stores float values from a 128-bit vector of [4 x float] to an 2019309124Sdim/// aligned memory location in reverse order. 2020309124Sdim/// 2021309124Sdim/// \headerfile <x86intrin.h> 2022309124Sdim/// 2023314564Sdim/// This intrinsic corresponds to the <c> VMOVAPS / MOVAPS + shuffling </c> 2024309124Sdim/// instruction. 2025309124Sdim/// 2026309124Sdim/// \param __p 2027309124Sdim/// A pointer to a 128-bit memory location. The address of the memory 2028309124Sdim/// location has to be 128-bit aligned. 2029309124Sdim/// \param __a 2030309124Sdim/// A 128-bit vector of [4 x float] containing the values to be stored. 2031288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 2032249423Sdim_mm_storer_ps(float *__p, __m128 __a) 2033193326Sed{ 2034309124Sdim __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 3, 2, 1, 0); 2035249423Sdim _mm_store_ps(__p, __a); 2036193326Sed} 2037193326Sed 2038212904Sdim#define _MM_HINT_T0 3 2039193326Sed#define _MM_HINT_T1 2 2040212904Sdim#define _MM_HINT_T2 1 2041193326Sed#define _MM_HINT_NTA 0 2042193326Sed 2043276479Sdim#ifndef _MSC_VER 2044210299Sed/* FIXME: We have to #define this because "sel" must be a constant integer, and 2045193326Sed Sema doesn't do any form of constant propagation yet. */ 2046193326Sed 2047309124Sdim/// \brief Loads one cache line of data from the specified address to a location 2048309124Sdim/// closer to the processor. 2049309124Sdim/// 2050309124Sdim/// \headerfile <x86intrin.h> 2051309124Sdim/// 2052309124Sdim/// \code 2053309124Sdim/// void _mm_prefetch(const void * a, const int sel); 2054309124Sdim/// \endcode 2055309124Sdim/// 2056314564Sdim/// This intrinsic corresponds to the <c> PREFETCHNTA </c> instruction. 2057309124Sdim/// 2058309124Sdim/// \param a 2059309124Sdim/// A pointer to a memory location containing a cache line of data. 2060309124Sdim/// \param sel 2061314564Sdim/// A predefined integer constant specifying the type of prefetch 2062314564Sdim/// operation: \n 2063314564Sdim/// _MM_HINT_NTA: Move data using the non-temporal access (NTA) hint. The 2064314564Sdim/// PREFETCHNTA instruction will be generated. \n 2065309124Sdim/// _MM_HINT_T0: Move data using the T0 hint. The PREFETCHT0 instruction will 2066314564Sdim/// be generated. \n 2067309124Sdim/// _MM_HINT_T1: Move data using the T1 hint. The PREFETCHT1 instruction will 2068314564Sdim/// be generated. \n 2069309124Sdim/// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will 2070321369Sdim/// be generated. 2071234353Sdim#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) 2072276479Sdim#endif 2073193326Sed 2074309124Sdim/// \brief Stores a 64-bit integer in the specified aligned memory location. To 2075309124Sdim/// minimize caching, the data is flagged as non-temporal (unlikely to be 2076309124Sdim/// used again soon). 2077309124Sdim/// 2078309124Sdim/// \headerfile <x86intrin.h> 2079309124Sdim/// 2080314564Sdim/// This intrinsic corresponds to the <c> MOVNTQ </c> instruction. 2081309124Sdim/// 2082309124Sdim/// \param __p 2083309124Sdim/// A pointer to an aligned memory location used to store the register value. 2084309124Sdim/// \param __a 2085309124Sdim/// A 64-bit integer containing the value to be stored. 2086288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 2087249423Sdim_mm_stream_pi(__m64 *__p, __m64 __a) 2088193326Sed{ 2089249423Sdim __builtin_ia32_movntq(__p, __a); 2090193326Sed} 2091193326Sed 2092309124Sdim/// \brief Moves packed float values from a 128-bit vector of [4 x float] to a 2093309124Sdim/// 128-bit aligned memory location. To minimize caching, the data is flagged 2094309124Sdim/// as non-temporal (unlikely to be used again soon). 2095309124Sdim/// 2096309124Sdim/// \headerfile <x86intrin.h> 2097309124Sdim/// 2098314564Sdim/// This intrinsic corresponds to the <c> VMOVNTPS / MOVNTPS </c> instruction. 2099309124Sdim/// 2100309124Sdim/// \param __p 2101309124Sdim/// A pointer to a 128-bit aligned memory location that will receive the 2102321369Sdim/// single-precision floating-point values. 2103309124Sdim/// \param __a 2104309124Sdim/// A 128-bit vector of [4 x float] containing the values to be moved. 2105288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 2106249423Sdim_mm_stream_ps(float *__p, __m128 __a) 2107193326Sed{ 2108309124Sdim __builtin_nontemporal_store((__v4sf)__a, (__v4sf*)__p); 2109193326Sed} 2110193326Sed 2111314564Sdim#if defined(__cplusplus) 2112314564Sdimextern "C" { 2113314564Sdim#endif 2114314564Sdim 2115309124Sdim/// \brief Forces strong memory ordering (serialization) between store 2116309124Sdim/// instructions preceding this instruction and store instructions following 2117309124Sdim/// this instruction, ensuring the system completes all previous stores 2118309124Sdim/// before executing subsequent stores. 2119309124Sdim/// 2120309124Sdim/// \headerfile <x86intrin.h> 2121309124Sdim/// 2122314564Sdim/// This intrinsic corresponds to the <c> SFENCE </c> instruction. 2123309124Sdim/// 2124314564Sdimvoid _mm_sfence(void); 2125193326Sed 2126314564Sdim#if defined(__cplusplus) 2127314564Sdim} // extern "C" 2128314564Sdim#endif 2129314564Sdim 2130309124Sdim/// \brief Extracts 16-bit element from a 64-bit vector of [4 x i16] and 2131309124Sdim/// returns it, as specified by the immediate integer operand. 2132309124Sdim/// 2133309124Sdim/// \headerfile <x86intrin.h> 2134309124Sdim/// 2135314564Sdim/// \code 2136321369Sdim/// int _mm_extract_pi16(__m64 a, int n); 2137314564Sdim/// \endcode 2138309124Sdim/// 2139314564Sdim/// This intrinsic corresponds to the <c> VPEXTRW / PEXTRW </c> instruction. 2140314564Sdim/// 2141314564Sdim/// \param a 2142309124Sdim/// A 64-bit vector of [4 x i16]. 2143314564Sdim/// \param n 2144314564Sdim/// An immediate integer operand that determines which bits are extracted: \n 2145314564Sdim/// 0: Bits [15:0] are copied to the destination. \n 2146314564Sdim/// 1: Bits [31:16] are copied to the destination. \n 2147314564Sdim/// 2: Bits [47:32] are copied to the destination. \n 2148309124Sdim/// 3: Bits [63:48] are copied to the destination. 2149309124Sdim/// \returns A 16-bit integer containing the extracted 16 bits of packed data. 2150309124Sdim#define _mm_extract_pi16(a, n) __extension__ ({ \ 2151309124Sdim (int)__builtin_ia32_vec_ext_v4hi((__m64)a, (int)n); }) 2152193326Sed 2153309124Sdim/// \brief Copies data from the 64-bit vector of [4 x i16] to the destination, 2154309124Sdim/// and inserts the lower 16-bits of an integer operand at the 16-bit offset 2155314564Sdim/// specified by the immediate operand \a n. 2156309124Sdim/// 2157309124Sdim/// \headerfile <x86intrin.h> 2158309124Sdim/// 2159314564Sdim/// \code 2160321369Sdim/// __m64 _mm_insert_pi16(__m64 a, int d, int n); 2161314564Sdim/// \endcode 2162309124Sdim/// 2163314564Sdim/// This intrinsic corresponds to the <c> VPINSRW / PINSRW </c> instruction. 2164314564Sdim/// 2165314564Sdim/// \param a 2166309124Sdim/// A 64-bit vector of [4 x i16]. 2167314564Sdim/// \param d 2168309124Sdim/// An integer. The lower 16-bit value from this operand is written to the 2169314564Sdim/// destination at the offset specified by operand \a n. 2170314564Sdim/// \param n 2171309124Sdim/// An immediate integer operant that determines which the bits to be used 2172314564Sdim/// in the destination. \n 2173314564Sdim/// 0: Bits [15:0] are copied to the destination. \n 2174314564Sdim/// 1: Bits [31:16] are copied to the destination. \n 2175314564Sdim/// 2: Bits [47:32] are copied to the destination. \n 2176314564Sdim/// 3: Bits [63:48] are copied to the destination. \n 2177309124Sdim/// The remaining bits in the destination are copied from the corresponding 2178314564Sdim/// bits in operand \a a. 2179309124Sdim/// \returns A 64-bit integer vector containing the copied packed data from the 2180309124Sdim/// operands. 2181309124Sdim#define _mm_insert_pi16(a, d, n) __extension__ ({ \ 2182309124Sdim (__m64)__builtin_ia32_vec_set_v4hi((__m64)a, (int)d, (int)n); }) 2183193326Sed 2184309124Sdim/// \brief Compares each of the corresponding packed 16-bit integer values of 2185309124Sdim/// the 64-bit integer vectors, and writes the greater value to the 2186309124Sdim/// corresponding bits in the destination. 2187309124Sdim/// 2188309124Sdim/// \headerfile <x86intrin.h> 2189309124Sdim/// 2190314564Sdim/// This intrinsic corresponds to the <c> PMAXSW </c> instruction. 2191309124Sdim/// 2192309124Sdim/// \param __a 2193309124Sdim/// A 64-bit integer vector containing one of the source operands. 2194309124Sdim/// \param __b 2195309124Sdim/// A 64-bit integer vector containing one of the source operands. 2196309124Sdim/// \returns A 64-bit integer vector containing the comparison results. 2197288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2198249423Sdim_mm_max_pi16(__m64 __a, __m64 __b) 2199193326Sed{ 2200249423Sdim return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b); 2201193326Sed} 2202193326Sed 2203309124Sdim/// \brief Compares each of the corresponding packed 8-bit unsigned integer 2204309124Sdim/// values of the 64-bit integer vectors, and writes the greater value to the 2205309124Sdim/// corresponding bits in the destination. 2206309124Sdim/// 2207309124Sdim/// \headerfile <x86intrin.h> 2208309124Sdim/// 2209314564Sdim/// This intrinsic corresponds to the <c> PMAXUB </c> instruction. 2210309124Sdim/// 2211309124Sdim/// \param __a 2212309124Sdim/// A 64-bit integer vector containing one of the source operands. 2213309124Sdim/// \param __b 2214309124Sdim/// A 64-bit integer vector containing one of the source operands. 2215309124Sdim/// \returns A 64-bit integer vector containing the comparison results. 2216288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2217249423Sdim_mm_max_pu8(__m64 __a, __m64 __b) 2218193326Sed{ 2219249423Sdim return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b); 2220193326Sed} 2221193326Sed 2222309124Sdim/// \brief Compares each of the corresponding packed 16-bit integer values of 2223309124Sdim/// the 64-bit integer vectors, and writes the lesser value to the 2224309124Sdim/// corresponding bits in the destination. 2225309124Sdim/// 2226309124Sdim/// \headerfile <x86intrin.h> 2227309124Sdim/// 2228314564Sdim/// This intrinsic corresponds to the <c> PMINSW </c> instruction. 2229309124Sdim/// 2230309124Sdim/// \param __a 2231309124Sdim/// A 64-bit integer vector containing one of the source operands. 2232309124Sdim/// \param __b 2233309124Sdim/// A 64-bit integer vector containing one of the source operands. 2234309124Sdim/// \returns A 64-bit integer vector containing the comparison results. 2235288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2236249423Sdim_mm_min_pi16(__m64 __a, __m64 __b) 2237193326Sed{ 2238249423Sdim return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b); 2239193326Sed} 2240193326Sed 2241309124Sdim/// \brief Compares each of the corresponding packed 8-bit unsigned integer 2242309124Sdim/// values of the 64-bit integer vectors, and writes the lesser value to the 2243309124Sdim/// corresponding bits in the destination. 2244309124Sdim/// 2245309124Sdim/// \headerfile <x86intrin.h> 2246309124Sdim/// 2247314564Sdim/// This intrinsic corresponds to the <c> PMINUB </c> instruction. 2248309124Sdim/// 2249309124Sdim/// \param __a 2250309124Sdim/// A 64-bit integer vector containing one of the source operands. 2251309124Sdim/// \param __b 2252309124Sdim/// A 64-bit integer vector containing one of the source operands. 2253309124Sdim/// \returns A 64-bit integer vector containing the comparison results. 2254288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2255249423Sdim_mm_min_pu8(__m64 __a, __m64 __b) 2256193326Sed{ 2257249423Sdim return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b); 2258193326Sed} 2259193326Sed 2260309124Sdim/// \brief Takes the most significant bit from each 8-bit element in a 64-bit 2261309124Sdim/// integer vector to create a 16-bit mask value. Zero-extends the value to 2262309124Sdim/// 32-bit integer and writes it to the destination. 2263309124Sdim/// 2264309124Sdim/// \headerfile <x86intrin.h> 2265309124Sdim/// 2266314564Sdim/// This intrinsic corresponds to the <c> PMOVMSKB </c> instruction. 2267309124Sdim/// 2268309124Sdim/// \param __a 2269309124Sdim/// A 64-bit integer vector containing the values with bits to be extracted. 2270309124Sdim/// \returns The most significant bit from each 8-bit element in the operand, 2271309124Sdim/// written to bits [15:0]. 2272288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 2273249423Sdim_mm_movemask_pi8(__m64 __a) 2274193326Sed{ 2275249423Sdim return __builtin_ia32_pmovmskb((__v8qi)__a); 2276193326Sed} 2277193326Sed 2278309124Sdim/// \brief Multiplies packed 16-bit unsigned integer values and writes the 2279309124Sdim/// high-order 16 bits of each 32-bit product to the corresponding bits in 2280309124Sdim/// the destination. 2281309124Sdim/// 2282309124Sdim/// \headerfile <x86intrin.h> 2283309124Sdim/// 2284314564Sdim/// This intrinsic corresponds to the <c> PMULHUW </c> instruction. 2285309124Sdim/// 2286309124Sdim/// \param __a 2287309124Sdim/// A 64-bit integer vector containing one of the source operands. 2288309124Sdim/// \param __b 2289309124Sdim/// A 64-bit integer vector containing one of the source operands. 2290309124Sdim/// \returns A 64-bit integer vector containing the products of both operands. 2291288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2292249423Sdim_mm_mulhi_pu16(__m64 __a, __m64 __b) 2293193326Sed{ 2294249423Sdim return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b); 2295193326Sed} 2296193326Sed 2297309124Sdim/// \brief Shuffles the 4 16-bit integers from a 64-bit integer vector to the 2298309124Sdim/// destination, as specified by the immediate value operand. 2299309124Sdim/// 2300309124Sdim/// \headerfile <x86intrin.h> 2301309124Sdim/// 2302309124Sdim/// \code 2303309124Sdim/// __m64 _mm_shuffle_pi16(__m64 a, const int n); 2304309124Sdim/// \endcode 2305309124Sdim/// 2306314564Sdim/// This intrinsic corresponds to the <c> PSHUFW </c> instruction. 2307314564Sdim/// 2308309124Sdim/// \param a 2309309124Sdim/// A 64-bit integer vector containing the values to be shuffled. 2310309124Sdim/// \param n 2311309124Sdim/// An immediate value containing an 8-bit value specifying which elements to 2312314564Sdim/// copy from \a a. The destinations within the 64-bit destination are 2313314564Sdim/// assigned values as follows: \n 2314314564Sdim/// Bits [1:0] are used to assign values to bits [15:0] in the 2315314564Sdim/// destination. \n 2316314564Sdim/// Bits [3:2] are used to assign values to bits [31:16] in the 2317314564Sdim/// destination. \n 2318314564Sdim/// Bits [5:4] are used to assign values to bits [47:32] in the 2319314564Sdim/// destination. \n 2320314564Sdim/// Bits [7:6] are used to assign values to bits [63:48] in the 2321314564Sdim/// destination. \n 2322314564Sdim/// Bit value assignments: \n 2323314564Sdim/// 00: assigned from bits [15:0] of \a a. \n 2324314564Sdim/// 01: assigned from bits [31:16] of \a a. \n 2325314564Sdim/// 10: assigned from bits [47:32] of \a a. \n 2326314564Sdim/// 11: assigned from bits [63:48] of \a a. 2327309124Sdim/// \returns A 64-bit integer vector containing the shuffled values. 2328234353Sdim#define _mm_shuffle_pi16(a, n) __extension__ ({ \ 2329296417Sdim (__m64)__builtin_ia32_pshufw((__v4hi)(__m64)(a), (n)); }) 2330193326Sed 2331309124Sdim/// \brief Conditionally copies the values from each 8-bit element in the first 2332309124Sdim/// 64-bit integer vector operand to the specified memory location, as 2333309124Sdim/// specified by the most significant bit in the corresponding element in the 2334321369Sdim/// second 64-bit integer vector operand. 2335309124Sdim/// 2336321369Sdim/// To minimize caching, the data is flagged as non-temporal 2337321369Sdim/// (unlikely to be used again soon). 2338321369Sdim/// 2339309124Sdim/// \headerfile <x86intrin.h> 2340309124Sdim/// 2341314564Sdim/// This intrinsic corresponds to the <c> MASKMOVQ </c> instruction. 2342309124Sdim/// 2343309124Sdim/// \param __d 2344309124Sdim/// A 64-bit integer vector containing the values with elements to be copied. 2345309124Sdim/// \param __n 2346309124Sdim/// A 64-bit integer vector operand. The most significant bit from each 8-bit 2347314564Sdim/// element determines whether the corresponding element in operand \a __d 2348314564Sdim/// is copied. If the most significant bit of a given element is 1, the 2349314564Sdim/// corresponding element in operand \a __d is copied. 2350309124Sdim/// \param __p 2351309124Sdim/// A pointer to a 64-bit memory location that will receive the conditionally 2352309124Sdim/// copied integer values. The address of the memory location does not have 2353309124Sdim/// to be aligned. 2354288943Sdimstatic __inline__ void __DEFAULT_FN_ATTRS 2355249423Sdim_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p) 2356193326Sed{ 2357249423Sdim __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p); 2358193326Sed} 2359193326Sed 2360309124Sdim/// \brief Computes the rounded averages of the packed unsigned 8-bit integer 2361309124Sdim/// values and writes the averages to the corresponding bits in the 2362309124Sdim/// destination. 2363309124Sdim/// 2364309124Sdim/// \headerfile <x86intrin.h> 2365309124Sdim/// 2366314564Sdim/// This intrinsic corresponds to the <c> PAVGB </c> instruction. 2367309124Sdim/// 2368309124Sdim/// \param __a 2369309124Sdim/// A 64-bit integer vector containing one of the source operands. 2370309124Sdim/// \param __b 2371309124Sdim/// A 64-bit integer vector containing one of the source operands. 2372309124Sdim/// \returns A 64-bit integer vector containing the averages of both operands. 2373288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2374249423Sdim_mm_avg_pu8(__m64 __a, __m64 __b) 2375193326Sed{ 2376249423Sdim return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b); 2377193326Sed} 2378193326Sed 2379309124Sdim/// \brief Computes the rounded averages of the packed unsigned 16-bit integer 2380309124Sdim/// values and writes the averages to the corresponding bits in the 2381309124Sdim/// destination. 2382309124Sdim/// 2383309124Sdim/// \headerfile <x86intrin.h> 2384309124Sdim/// 2385314564Sdim/// This intrinsic corresponds to the <c> PAVGW </c> instruction. 2386309124Sdim/// 2387309124Sdim/// \param __a 2388309124Sdim/// A 64-bit integer vector containing one of the source operands. 2389309124Sdim/// \param __b 2390309124Sdim/// A 64-bit integer vector containing one of the source operands. 2391309124Sdim/// \returns A 64-bit integer vector containing the averages of both operands. 2392288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2393249423Sdim_mm_avg_pu16(__m64 __a, __m64 __b) 2394193326Sed{ 2395249423Sdim return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b); 2396193326Sed} 2397193326Sed 2398309124Sdim/// \brief Subtracts the corresponding 8-bit unsigned integer values of the two 2399309124Sdim/// 64-bit vector operands and computes the absolute value for each of the 2400309124Sdim/// difference. Then sum of the 8 absolute differences is written to the 2401309124Sdim/// bits [15:0] of the destination; the remaining bits [63:16] are cleared. 2402309124Sdim/// 2403309124Sdim/// \headerfile <x86intrin.h> 2404309124Sdim/// 2405314564Sdim/// This intrinsic corresponds to the <c> PSADBW </c> instruction. 2406309124Sdim/// 2407309124Sdim/// \param __a 2408309124Sdim/// A 64-bit integer vector containing one of the source operands. 2409309124Sdim/// \param __b 2410309124Sdim/// A 64-bit integer vector containing one of the source operands. 2411309124Sdim/// \returns A 64-bit integer vector whose lower 16 bits contain the sums of the 2412309124Sdim/// sets of absolute differences between both operands. The upper bits are 2413309124Sdim/// cleared. 2414288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2415249423Sdim_mm_sad_pu8(__m64 __a, __m64 __b) 2416193326Sed{ 2417249423Sdim return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b); 2418193326Sed} 2419193326Sed 2420314564Sdim#if defined(__cplusplus) 2421314564Sdimextern "C" { 2422314564Sdim#endif 2423314564Sdim 2424309124Sdim/// \brief Returns the contents of the MXCSR register as a 32-bit unsigned 2425314564Sdim/// integer value. 2426314564Sdim/// 2427314564Sdim/// There are several groups of macros associated with this 2428309124Sdim/// intrinsic, including: 2429314564Sdim/// <ul> 2430314564Sdim/// <li> 2431314564Sdim/// For checking exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO, 2432309124Sdim/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW, 2433309124Sdim/// _MM_EXCEPT_INEXACT. There is a convenience wrapper 2434309124Sdim/// _MM_GET_EXCEPTION_STATE(). 2435314564Sdim/// </li> 2436314564Sdim/// <li> 2437314564Sdim/// For checking exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW, 2438309124Sdim/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT. 2439309124Sdim/// There is a convenience wrapper _MM_GET_EXCEPTION_MASK(). 2440321369Sdim/// </li> 2441314564Sdim/// <li> 2442314564Sdim/// For checking rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN, 2443309124Sdim/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper 2444309124Sdim/// _MM_GET_ROUNDING_MODE(x) where x is one of these macros. 2445314564Sdim/// </li> 2446321369Sdim/// <li> 2447314564Sdim/// For checking flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF. 2448309124Sdim/// There is a convenience wrapper _MM_GET_FLUSH_ZERO_MODE(). 2449314564Sdim/// </li> 2450321369Sdim/// <li> 2451314564Sdim/// For checking denormals-are-zero mode: _MM_DENORMALS_ZERO_ON, 2452309124Sdim/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper 2453309124Sdim/// _MM_GET_DENORMALS_ZERO_MODE(). 2454314564Sdim/// </li> 2455314564Sdim/// </ul> 2456309124Sdim/// 2457309124Sdim/// For example, the expression below checks if an overflow exception has 2458309124Sdim/// occurred: 2459309124Sdim/// ( _mm_getcsr() & _MM_EXCEPT_OVERFLOW ) 2460309124Sdim/// 2461309124Sdim/// The following example gets the current rounding mode: 2462309124Sdim/// _MM_GET_ROUNDING_MODE() 2463309124Sdim/// 2464309124Sdim/// \headerfile <x86intrin.h> 2465309124Sdim/// 2466314564Sdim/// This intrinsic corresponds to the <c> VSTMXCSR / STMXCSR </c> instruction. 2467309124Sdim/// 2468309124Sdim/// \returns A 32-bit unsigned integer containing the contents of the MXCSR 2469309124Sdim/// register. 2470314564Sdimunsigned int _mm_getcsr(void); 2471193326Sed 2472314564Sdim/// \brief Sets the MXCSR register with the 32-bit unsigned integer value. 2473321369Sdim/// 2474314564Sdim/// There are several groups of macros associated with this intrinsic, 2475314564Sdim/// including: 2476314564Sdim/// <ul> 2477321369Sdim/// <li> 2478314564Sdim/// For setting exception states: _MM_EXCEPT_INVALID, _MM_EXCEPT_DIV_ZERO, 2479309124Sdim/// _MM_EXCEPT_DENORM, _MM_EXCEPT_OVERFLOW, _MM_EXCEPT_UNDERFLOW, 2480309124Sdim/// _MM_EXCEPT_INEXACT. There is a convenience wrapper 2481309124Sdim/// _MM_SET_EXCEPTION_STATE(x) where x is one of these macros. 2482314564Sdim/// </li> 2483314564Sdim/// <li> 2484314564Sdim/// For setting exception masks: _MM_MASK_UNDERFLOW, _MM_MASK_OVERFLOW, 2485309124Sdim/// _MM_MASK_INVALID, _MM_MASK_DENORM, _MM_MASK_DIV_ZERO, _MM_MASK_INEXACT. 2486309124Sdim/// There is a convenience wrapper _MM_SET_EXCEPTION_MASK(x) where x is one 2487309124Sdim/// of these macros. 2488314564Sdim/// </li> 2489314564Sdim/// <li> 2490314564Sdim/// For setting rounding modes: _MM_ROUND_NEAREST, _MM_ROUND_DOWN, 2491309124Sdim/// _MM_ROUND_UP, _MM_ROUND_TOWARD_ZERO. There is a convenience wrapper 2492309124Sdim/// _MM_SET_ROUNDING_MODE(x) where x is one of these macros. 2493314564Sdim/// </li> 2494314564Sdim/// <li> 2495314564Sdim/// For setting flush-to-zero mode: _MM_FLUSH_ZERO_ON, _MM_FLUSH_ZERO_OFF. 2496309124Sdim/// There is a convenience wrapper _MM_SET_FLUSH_ZERO_MODE(x) where x is 2497309124Sdim/// one of these macros. 2498314564Sdim/// </li> 2499314564Sdim/// <li> 2500314564Sdim/// For setting denormals-are-zero mode: _MM_DENORMALS_ZERO_ON, 2501309124Sdim/// _MM_DENORMALS_ZERO_OFF. There is a convenience wrapper 2502309124Sdim/// _MM_SET_DENORMALS_ZERO_MODE(x) where x is one of these macros. 2503314564Sdim/// </li> 2504314564Sdim/// </ul> 2505309124Sdim/// 2506309124Sdim/// For example, the following expression causes subsequent floating-point 2507309124Sdim/// operations to round up: 2508309124Sdim/// _mm_setcsr(_mm_getcsr() | _MM_ROUND_UP) 2509309124Sdim/// 2510309124Sdim/// The following example sets the DAZ and FTZ flags: 2511309124Sdim/// void setFlags() { 2512309124Sdim/// _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON) 2513309124Sdim/// _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON) 2514309124Sdim/// } 2515309124Sdim/// 2516309124Sdim/// \headerfile <x86intrin.h> 2517309124Sdim/// 2518314564Sdim/// This intrinsic corresponds to the <c> VLDMXCSR / LDMXCSR </c> instruction. 2519309124Sdim/// 2520309124Sdim/// \param __i 2521309124Sdim/// A 32-bit unsigned integer value to be written to the MXCSR register. 2522321369Sdimvoid _mm_setcsr(unsigned int __i); 2523193326Sed 2524314564Sdim#if defined(__cplusplus) 2525314564Sdim} // extern "C" 2526314564Sdim#endif 2527314564Sdim 2528309124Sdim/// \brief Selects 4 float values from the 128-bit operands of [4 x float], as 2529309124Sdim/// specified by the immediate value operand. 2530309124Sdim/// 2531309124Sdim/// \headerfile <x86intrin.h> 2532309124Sdim/// 2533309124Sdim/// \code 2534309124Sdim/// __m128 _mm_shuffle_ps(__m128 a, __m128 b, const int mask); 2535309124Sdim/// \endcode 2536309124Sdim/// 2537314564Sdim/// This intrinsic corresponds to the <c> VSHUFPS / SHUFPS </c> instruction. 2538309124Sdim/// 2539309124Sdim/// \param a 2540309124Sdim/// A 128-bit vector of [4 x float]. 2541309124Sdim/// \param b 2542309124Sdim/// A 128-bit vector of [4 x float]. 2543309124Sdim/// \param mask 2544309124Sdim/// An immediate value containing an 8-bit value specifying which elements to 2545321369Sdim/// copy from \a a and \a b. \n 2546314564Sdim/// Bits [3:0] specify the values copied from operand \a a. \n 2547314564Sdim/// Bits [7:4] specify the values copied from operand \a b. \n 2548314564Sdim/// The destinations within the 128-bit destination are assigned values as 2549314564Sdim/// follows: \n 2550314564Sdim/// Bits [1:0] are used to assign values to bits [31:0] in the 2551314564Sdim/// destination. \n 2552314564Sdim/// Bits [3:2] are used to assign values to bits [63:32] in the 2553314564Sdim/// destination. \n 2554314564Sdim/// Bits [5:4] are used to assign values to bits [95:64] in the 2555314564Sdim/// destination. \n 2556314564Sdim/// Bits [7:6] are used to assign values to bits [127:96] in the 2557314564Sdim/// destination. \n 2558314564Sdim/// Bit value assignments: \n 2559314564Sdim/// 00: Bits [31:0] copied from the specified operand. \n 2560314564Sdim/// 01: Bits [63:32] copied from the specified operand. \n 2561314564Sdim/// 10: Bits [95:64] copied from the specified operand. \n 2562309124Sdim/// 11: Bits [127:96] copied from the specified operand. 2563309124Sdim/// \returns A 128-bit vector of [4 x float] containing the shuffled values. 2564234353Sdim#define _mm_shuffle_ps(a, b, mask) __extension__ ({ \ 2565296417Sdim (__m128)__builtin_shufflevector((__v4sf)(__m128)(a), (__v4sf)(__m128)(b), \ 2566309124Sdim 0 + (((mask) >> 0) & 0x3), \ 2567309124Sdim 0 + (((mask) >> 2) & 0x3), \ 2568309124Sdim 4 + (((mask) >> 4) & 0x3), \ 2569309124Sdim 4 + (((mask) >> 6) & 0x3)); }) 2570193326Sed 2571309124Sdim/// \brief Unpacks the high-order (index 2,3) values from two 128-bit vectors of 2572314564Sdim/// [4 x float] and interleaves them into a 128-bit vector of [4 x float]. 2573309124Sdim/// 2574309124Sdim/// \headerfile <x86intrin.h> 2575309124Sdim/// 2576314564Sdim/// This intrinsic corresponds to the <c> VUNPCKHPS / UNPCKHPS </c> instruction. 2577309124Sdim/// 2578309124Sdim/// \param __a 2579314564Sdim/// A 128-bit vector of [4 x float]. \n 2580314564Sdim/// Bits [95:64] are written to bits [31:0] of the destination. \n 2581309124Sdim/// Bits [127:96] are written to bits [95:64] of the destination. 2582309124Sdim/// \param __b 2583309124Sdim/// A 128-bit vector of [4 x float]. 2584314564Sdim/// Bits [95:64] are written to bits [63:32] of the destination. \n 2585309124Sdim/// Bits [127:96] are written to bits [127:96] of the destination. 2586309124Sdim/// \returns A 128-bit vector of [4 x float] containing the interleaved values. 2587288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2588249423Sdim_mm_unpackhi_ps(__m128 __a, __m128 __b) 2589193326Sed{ 2590309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 2, 6, 3, 7); 2591193326Sed} 2592193326Sed 2593309124Sdim/// \brief Unpacks the low-order (index 0,1) values from two 128-bit vectors of 2594314564Sdim/// [4 x float] and interleaves them into a 128-bit vector of [4 x float]. 2595309124Sdim/// 2596309124Sdim/// \headerfile <x86intrin.h> 2597309124Sdim/// 2598314564Sdim/// This intrinsic corresponds to the <c> VUNPCKLPS / UNPCKLPS </c> instruction. 2599309124Sdim/// 2600309124Sdim/// \param __a 2601314564Sdim/// A 128-bit vector of [4 x float]. \n 2602314564Sdim/// Bits [31:0] are written to bits [31:0] of the destination. \n 2603309124Sdim/// Bits [63:32] are written to bits [95:64] of the destination. 2604309124Sdim/// \param __b 2605314564Sdim/// A 128-bit vector of [4 x float]. \n 2606314564Sdim/// Bits [31:0] are written to bits [63:32] of the destination. \n 2607309124Sdim/// Bits [63:32] are written to bits [127:96] of the destination. 2608309124Sdim/// \returns A 128-bit vector of [4 x float] containing the interleaved values. 2609288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2610249423Sdim_mm_unpacklo_ps(__m128 __a, __m128 __b) 2611193326Sed{ 2612309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 4, 1, 5); 2613193326Sed} 2614193326Sed 2615309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float]. The lower 2616309124Sdim/// 32 bits are set to the lower 32 bits of the second parameter. The upper 2617309124Sdim/// 96 bits are set to the upper 96 bits of the first parameter. 2618309124Sdim/// 2619309124Sdim/// \headerfile <x86intrin.h> 2620309124Sdim/// 2621314564Sdim/// This intrinsic corresponds to the <c> VMOVSS / MOVSS </c> instruction. 2622309124Sdim/// 2623309124Sdim/// \param __a 2624309124Sdim/// A 128-bit floating-point vector of [4 x float]. The upper 96 bits are 2625309124Sdim/// written to the upper 96 bits of the result. 2626309124Sdim/// \param __b 2627309124Sdim/// A 128-bit floating-point vector of [4 x float]. The lower 32 bits are 2628309124Sdim/// written to the lower 32 bits of the result. 2629309124Sdim/// \returns A 128-bit floating-point vector of [4 x float]. 2630288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2631249423Sdim_mm_move_ss(__m128 __a, __m128 __b) 2632193326Sed{ 2633309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 4, 1, 2, 3); 2634193326Sed} 2635193326Sed 2636309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float]. The lower 2637309124Sdim/// 64 bits are set to the upper 64 bits of the second parameter. The upper 2638309124Sdim/// 64 bits are set to the upper 64 bits of the first parameter. 2639309124Sdim/// 2640309124Sdim/// \headerfile <x86intrin.h> 2641309124Sdim/// 2642314564Sdim/// This intrinsic corresponds to the <c> VUNPCKHPD / UNPCKHPD </c> instruction. 2643309124Sdim/// 2644309124Sdim/// \param __a 2645309124Sdim/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are 2646309124Sdim/// written to the upper 64 bits of the result. 2647309124Sdim/// \param __b 2648309124Sdim/// A 128-bit floating-point vector of [4 x float]. The upper 64 bits are 2649309124Sdim/// written to the lower 64 bits of the result. 2650309124Sdim/// \returns A 128-bit floating-point vector of [4 x float]. 2651288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2652249423Sdim_mm_movehl_ps(__m128 __a, __m128 __b) 2653193326Sed{ 2654309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 6, 7, 2, 3); 2655193326Sed} 2656193326Sed 2657309124Sdim/// \brief Constructs a 128-bit floating-point vector of [4 x float]. The lower 2658309124Sdim/// 64 bits are set to the lower 64 bits of the first parameter. The upper 2659309124Sdim/// 64 bits are set to the lower 64 bits of the second parameter. 2660309124Sdim/// 2661309124Sdim/// \headerfile <x86intrin.h> 2662309124Sdim/// 2663314564Sdim/// This intrinsic corresponds to the <c> VUNPCKLPD / UNPCKLPD </c> instruction. 2664309124Sdim/// 2665309124Sdim/// \param __a 2666309124Sdim/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are 2667309124Sdim/// written to the lower 64 bits of the result. 2668309124Sdim/// \param __b 2669309124Sdim/// A 128-bit floating-point vector of [4 x float]. The lower 64 bits are 2670309124Sdim/// written to the upper 64 bits of the result. 2671309124Sdim/// \returns A 128-bit floating-point vector of [4 x float]. 2672288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2673249423Sdim_mm_movelh_ps(__m128 __a, __m128 __b) 2674193326Sed{ 2675309124Sdim return __builtin_shufflevector((__v4sf)__a, (__v4sf)__b, 0, 1, 4, 5); 2676193326Sed} 2677193326Sed 2678309124Sdim/// \brief Converts a 64-bit vector of [4 x i16] into a 128-bit vector of [4 x 2679309124Sdim/// float]. 2680309124Sdim/// 2681309124Sdim/// \headerfile <x86intrin.h> 2682309124Sdim/// 2683321369Sdim/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction. 2684309124Sdim/// 2685309124Sdim/// \param __a 2686309124Sdim/// A 64-bit vector of [4 x i16]. The elements of the destination are copied 2687309124Sdim/// from the corresponding elements in this operand. 2688309124Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and converted 2689309124Sdim/// values from the operand. 2690288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2691249423Sdim_mm_cvtpi16_ps(__m64 __a) 2692193326Sed{ 2693249423Sdim __m64 __b, __c; 2694249423Sdim __m128 __r; 2695193326Sed 2696249423Sdim __b = _mm_setzero_si64(); 2697249423Sdim __b = _mm_cmpgt_pi16(__b, __a); 2698249423Sdim __c = _mm_unpackhi_pi16(__a, __b); 2699249423Sdim __r = _mm_setzero_ps(); 2700249423Sdim __r = _mm_cvtpi32_ps(__r, __c); 2701249423Sdim __r = _mm_movelh_ps(__r, __r); 2702249423Sdim __c = _mm_unpacklo_pi16(__a, __b); 2703249423Sdim __r = _mm_cvtpi32_ps(__r, __c); 2704193326Sed 2705249423Sdim return __r; 2706193326Sed} 2707193326Sed 2708309124Sdim/// \brief Converts a 64-bit vector of 16-bit unsigned integer values into a 2709309124Sdim/// 128-bit vector of [4 x float]. 2710309124Sdim/// 2711309124Sdim/// \headerfile <x86intrin.h> 2712309124Sdim/// 2713321369Sdim/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction. 2714309124Sdim/// 2715309124Sdim/// \param __a 2716309124Sdim/// A 64-bit vector of 16-bit unsigned integer values. The elements of the 2717309124Sdim/// destination are copied from the corresponding elements in this operand. 2718309124Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and converted 2719309124Sdim/// values from the operand. 2720288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2721249423Sdim_mm_cvtpu16_ps(__m64 __a) 2722193326Sed{ 2723249423Sdim __m64 __b, __c; 2724249423Sdim __m128 __r; 2725193326Sed 2726249423Sdim __b = _mm_setzero_si64(); 2727249423Sdim __c = _mm_unpackhi_pi16(__a, __b); 2728249423Sdim __r = _mm_setzero_ps(); 2729249423Sdim __r = _mm_cvtpi32_ps(__r, __c); 2730249423Sdim __r = _mm_movelh_ps(__r, __r); 2731249423Sdim __c = _mm_unpacklo_pi16(__a, __b); 2732249423Sdim __r = _mm_cvtpi32_ps(__r, __c); 2733193326Sed 2734249423Sdim return __r; 2735193326Sed} 2736193326Sed 2737309124Sdim/// \brief Converts the lower four 8-bit values from a 64-bit vector of [8 x i8] 2738309124Sdim/// into a 128-bit vector of [4 x float]. 2739309124Sdim/// 2740309124Sdim/// \headerfile <x86intrin.h> 2741309124Sdim/// 2742321369Sdim/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction. 2743309124Sdim/// 2744309124Sdim/// \param __a 2745309124Sdim/// A 64-bit vector of [8 x i8]. The elements of the destination are copied 2746309124Sdim/// from the corresponding lower 4 elements in this operand. 2747309124Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and converted 2748309124Sdim/// values from the operand. 2749288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2750249423Sdim_mm_cvtpi8_ps(__m64 __a) 2751193326Sed{ 2752249423Sdim __m64 __b; 2753296417Sdim 2754249423Sdim __b = _mm_setzero_si64(); 2755249423Sdim __b = _mm_cmpgt_pi8(__b, __a); 2756249423Sdim __b = _mm_unpacklo_pi8(__a, __b); 2757193326Sed 2758249423Sdim return _mm_cvtpi16_ps(__b); 2759193326Sed} 2760193326Sed 2761309124Sdim/// \brief Converts the lower four unsigned 8-bit integer values from a 64-bit 2762309124Sdim/// vector of [8 x u8] into a 128-bit vector of [4 x float]. 2763309124Sdim/// 2764309124Sdim/// \headerfile <x86intrin.h> 2765309124Sdim/// 2766321369Sdim/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction. 2767309124Sdim/// 2768309124Sdim/// \param __a 2769309124Sdim/// A 64-bit vector of unsigned 8-bit integer values. The elements of the 2770309124Sdim/// destination are copied from the corresponding lower 4 elements in this 2771309124Sdim/// operand. 2772309124Sdim/// \returns A 128-bit vector of [4 x float] containing the copied and converted 2773309124Sdim/// values from the source operand. 2774288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2775249423Sdim_mm_cvtpu8_ps(__m64 __a) 2776193326Sed{ 2777249423Sdim __m64 __b; 2778296417Sdim 2779249423Sdim __b = _mm_setzero_si64(); 2780249423Sdim __b = _mm_unpacklo_pi8(__a, __b); 2781193326Sed 2782249423Sdim return _mm_cvtpi16_ps(__b); 2783193326Sed} 2784193326Sed 2785309124Sdim/// \brief Converts the two 32-bit signed integer values from each 64-bit vector 2786309124Sdim/// operand of [2 x i32] into a 128-bit vector of [4 x float]. 2787309124Sdim/// 2788309124Sdim/// \headerfile <x86intrin.h> 2789309124Sdim/// 2790321369Sdim/// This intrinsic corresponds to the <c> CVTPI2PS + COMPOSITE </c> instruction. 2791309124Sdim/// 2792309124Sdim/// \param __a 2793309124Sdim/// A 64-bit vector of [2 x i32]. The lower elements of the destination are 2794309124Sdim/// copied from the elements in this operand. 2795309124Sdim/// \param __b 2796309124Sdim/// A 64-bit vector of [2 x i32]. The upper elements of the destination are 2797309124Sdim/// copied from the elements in this operand. 2798309124Sdim/// \returns A 128-bit vector of [4 x float] whose lower 64 bits contain the 2799309124Sdim/// copied and converted values from the first operand. The upper 64 bits 2800309124Sdim/// contain the copied and converted values from the second operand. 2801288943Sdimstatic __inline__ __m128 __DEFAULT_FN_ATTRS 2802249423Sdim_mm_cvtpi32x2_ps(__m64 __a, __m64 __b) 2803193326Sed{ 2804249423Sdim __m128 __c; 2805296417Sdim 2806249423Sdim __c = _mm_setzero_ps(); 2807249423Sdim __c = _mm_cvtpi32_ps(__c, __b); 2808249423Sdim __c = _mm_movelh_ps(__c, __c); 2809193326Sed 2810249423Sdim return _mm_cvtpi32_ps(__c, __a); 2811193326Sed} 2812193326Sed 2813309124Sdim/// \brief Converts each single-precision floating-point element of a 128-bit 2814309124Sdim/// floating-point vector of [4 x float] into a 16-bit signed integer, and 2815321369Sdim/// packs the results into a 64-bit integer vector of [4 x i16]. 2816309124Sdim/// 2817321369Sdim/// If the floating-point element is NaN or infinity, or if the 2818321369Sdim/// floating-point element is greater than 0x7FFFFFFF or less than -0x8000, 2819321369Sdim/// it is converted to 0x8000. Otherwise if the floating-point element is 2820321369Sdim/// greater than 0x7FFF, it is converted to 0x7FFF. 2821321369Sdim/// 2822309124Sdim/// \headerfile <x86intrin.h> 2823309124Sdim/// 2824321369Sdim/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction. 2825309124Sdim/// 2826309124Sdim/// \param __a 2827309124Sdim/// A 128-bit floating-point vector of [4 x float]. 2828309124Sdim/// \returns A 64-bit integer vector of [4 x i16] containing the converted 2829309124Sdim/// values. 2830288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2831249423Sdim_mm_cvtps_pi16(__m128 __a) 2832193326Sed{ 2833249423Sdim __m64 __b, __c; 2834296417Sdim 2835249423Sdim __b = _mm_cvtps_pi32(__a); 2836249423Sdim __a = _mm_movehl_ps(__a, __a); 2837249423Sdim __c = _mm_cvtps_pi32(__a); 2838296417Sdim 2839266674Sdim return _mm_packs_pi32(__b, __c); 2840193326Sed} 2841193326Sed 2842309124Sdim/// \brief Converts each single-precision floating-point element of a 128-bit 2843309124Sdim/// floating-point vector of [4 x float] into an 8-bit signed integer, and 2844309124Sdim/// packs the results into the lower 32 bits of a 64-bit integer vector of 2845321369Sdim/// [8 x i8]. The upper 32 bits of the vector are set to 0. 2846309124Sdim/// 2847321369Sdim/// If the floating-point element is NaN or infinity, or if the 2848321369Sdim/// floating-point element is greater than 0x7FFFFFFF or less than -0x80, it 2849321369Sdim/// is converted to 0x80. Otherwise if the floating-point element is greater 2850321369Sdim/// than 0x7F, it is converted to 0x7F. 2851321369Sdim/// 2852309124Sdim/// \headerfile <x86intrin.h> 2853309124Sdim/// 2854321369Sdim/// This intrinsic corresponds to the <c> CVTPS2PI + COMPOSITE </c> instruction. 2855309124Sdim/// 2856309124Sdim/// \param __a 2857309124Sdim/// 128-bit floating-point vector of [4 x float]. 2858309124Sdim/// \returns A 64-bit integer vector of [8 x i8]. The lower 32 bits contain the 2859309124Sdim/// converted values and the uppper 32 bits are set to zero. 2860288943Sdimstatic __inline__ __m64 __DEFAULT_FN_ATTRS 2861249423Sdim_mm_cvtps_pi8(__m128 __a) 2862193326Sed{ 2863249423Sdim __m64 __b, __c; 2864296417Sdim 2865249423Sdim __b = _mm_cvtps_pi16(__a); 2866249423Sdim __c = _mm_setzero_si64(); 2867296417Sdim 2868249423Sdim return _mm_packs_pi16(__b, __c); 2869193326Sed} 2870193326Sed 2871309124Sdim/// \brief Extracts the sign bits from each single-precision floating-point 2872309124Sdim/// element of a 128-bit floating-point vector of [4 x float] and returns the 2873309124Sdim/// sign bits in bits [0:3] of the result. Bits [31:4] of the result are set 2874309124Sdim/// to zero. 2875309124Sdim/// 2876309124Sdim/// \headerfile <x86intrin.h> 2877309124Sdim/// 2878314564Sdim/// This intrinsic corresponds to the <c> VMOVMSKPS / MOVMSKPS </c> instruction. 2879309124Sdim/// 2880309124Sdim/// \param __a 2881309124Sdim/// A 128-bit floating-point vector of [4 x float]. 2882309124Sdim/// \returns A 32-bit integer value. Bits [3:0] contain the sign bits from each 2883309124Sdim/// single-precision floating-point element of the parameter. Bits [31:4] are 2884309124Sdim/// set to zero. 2885288943Sdimstatic __inline__ int __DEFAULT_FN_ATTRS 2886249423Sdim_mm_movemask_ps(__m128 __a) 2887193326Sed{ 2888309124Sdim return __builtin_ia32_movmskps((__v4sf)__a); 2889193326Sed} 2890193326Sed 2891296417Sdim 2892309124Sdim#define _MM_ALIGN16 __attribute__((aligned(16))) 2893296417Sdim 2894193326Sed#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) 2895193326Sed 2896193326Sed#define _MM_EXCEPT_INVALID (0x0001) 2897193326Sed#define _MM_EXCEPT_DENORM (0x0002) 2898193326Sed#define _MM_EXCEPT_DIV_ZERO (0x0004) 2899193326Sed#define _MM_EXCEPT_OVERFLOW (0x0008) 2900193326Sed#define _MM_EXCEPT_UNDERFLOW (0x0010) 2901193326Sed#define _MM_EXCEPT_INEXACT (0x0020) 2902193326Sed#define _MM_EXCEPT_MASK (0x003f) 2903193326Sed 2904193326Sed#define _MM_MASK_INVALID (0x0080) 2905193326Sed#define _MM_MASK_DENORM (0x0100) 2906193326Sed#define _MM_MASK_DIV_ZERO (0x0200) 2907193326Sed#define _MM_MASK_OVERFLOW (0x0400) 2908193326Sed#define _MM_MASK_UNDERFLOW (0x0800) 2909193326Sed#define _MM_MASK_INEXACT (0x1000) 2910193326Sed#define _MM_MASK_MASK (0x1f80) 2911193326Sed 2912193326Sed#define _MM_ROUND_NEAREST (0x0000) 2913193326Sed#define _MM_ROUND_DOWN (0x2000) 2914193326Sed#define _MM_ROUND_UP (0x4000) 2915193326Sed#define _MM_ROUND_TOWARD_ZERO (0x6000) 2916193326Sed#define _MM_ROUND_MASK (0x6000) 2917193326Sed 2918193326Sed#define _MM_FLUSH_ZERO_MASK (0x8000) 2919193326Sed#define _MM_FLUSH_ZERO_ON (0x8000) 2920234353Sdim#define _MM_FLUSH_ZERO_OFF (0x0000) 2921193326Sed 2922193326Sed#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK) 2923193326Sed#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK) 2924193326Sed#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK) 2925193326Sed#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK) 2926193326Sed 2927193326Sed#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x))) 2928193326Sed#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x))) 2929193326Sed#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x))) 2930193326Sed#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x))) 2931193326Sed 2932193326Sed#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ 2933193326Seddo { \ 2934193326Sed __m128 tmp3, tmp2, tmp1, tmp0; \ 2935193326Sed tmp0 = _mm_unpacklo_ps((row0), (row1)); \ 2936193326Sed tmp2 = _mm_unpacklo_ps((row2), (row3)); \ 2937193326Sed tmp1 = _mm_unpackhi_ps((row0), (row1)); \ 2938193326Sed tmp3 = _mm_unpackhi_ps((row2), (row3)); \ 2939193326Sed (row0) = _mm_movelh_ps(tmp0, tmp2); \ 2940193326Sed (row1) = _mm_movehl_ps(tmp2, tmp0); \ 2941193326Sed (row2) = _mm_movelh_ps(tmp1, tmp3); \ 2942203955Srdivacky (row3) = _mm_movehl_ps(tmp3, tmp1); \ 2943193326Sed} while (0) 2944193326Sed 2945212904Sdim/* Aliases for compatibility. */ 2946212904Sdim#define _m_pextrw _mm_extract_pi16 2947212904Sdim#define _m_pinsrw _mm_insert_pi16 2948212904Sdim#define _m_pmaxsw _mm_max_pi16 2949212904Sdim#define _m_pmaxub _mm_max_pu8 2950212904Sdim#define _m_pminsw _mm_min_pi16 2951212904Sdim#define _m_pminub _mm_min_pu8 2952212904Sdim#define _m_pmovmskb _mm_movemask_pi8 2953212904Sdim#define _m_pmulhuw _mm_mulhi_pu16 2954212904Sdim#define _m_pshufw _mm_shuffle_pi16 2955212904Sdim#define _m_maskmovq _mm_maskmove_si64 2956212904Sdim#define _m_pavgb _mm_avg_pu8 2957212904Sdim#define _m_pavgw _mm_avg_pu16 2958212904Sdim#define _m_psadbw _mm_sad_pu8 2959212904Sdim#define _m_ _mm_ 2960212904Sdim#define _m_ _mm_ 2961212904Sdim 2962288943Sdim#undef __DEFAULT_FN_ATTRS 2963288943Sdim 2964194179Sed/* Ugly hack for backwards-compatibility (compatible with gcc) */ 2965309124Sdim#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics) 2966193326Sed#include <emmintrin.h> 2967194179Sed#endif 2968193326Sed 2969193326Sed#endif /* __XMMINTRIN_H */ 2970