╭ pmmintrin.h ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
.. llvm_libc_wrappers/ openmp_wrappers/ ppc_wrappers/ __clang_spirv_builtins.h __float_float.h __float_header_macro.h __float_infinity_nan.h __stdarg___gnuc_va_list.h __stdarg___va_copy.h __stdarg_header_macro.h __stdarg_va_arg.h __stdarg_va_copy.h __stdarg_va_list.h __stddef_header_macro.h __stddef_max_align_t.h __stddef_null.h __stddef_nullptr_t.h __stddef_offsetof.h __stddef_ptrdiff_t.h __stddef_rsize_t.h __stddef_size_t.h __stddef_unreachable.h __stddef_wchar_t.h __stddef_wint_t.h __wmmintrin_aes.h __wmmintrin_pclmul.h adcintrin.h adxintrin.h altivec.h ammintrin.h amo.h amxavx512intrin.h amxcomplexintrin.h amxfp16intrin.h amxfp8intrin.h amxintrin.h amxmovrsintrin.h amxtf32intrin.h andes_vector.h arm64intr.h arm_acle.h arm_bf16.h arm_cde.h arm_cmse.h arm_fp16.h arm_mve.h arm_neon.h arm_neon_sve_bridge.h arm_sme.h arm_sve.h arm_vector_types.h armintr.h avx10_2_512bf16intrin.h avx10_2_512convertintrin.h avx10_2_512minmaxintrin.h avx10_2_512niintrin.h avx10_2_512satcvtdsintrin.h avx10_2_512satcvtintrin.h avx10_2bf16intrin.h avx10_2convertintrin.h avx10_2copyintrin.h avx10_2minmaxintrin.h avx10_2niintrin.h avx10_2satcvtdsintrin.h avx10_2satcvtintrin.h avx2intrin.h avx512bf16intrin.h avx512bitalgintrin.h avx512bwintrin.h avx512cdintrin.h avx512dqintrin.h avx512fintrin.h avx512fp16intrin.h avx512ifmaintrin.h avx512ifmavlintrin.h avx512vbmi2intrin.h avx512vbmiintrin.h avx512vbmivlintrin.h avx512vlbf16intrin.h avx512vlbitalgintrin.h avx512vlbwintrin.h avx512vlcdintrin.h avx512vldqintrin.h avx512vlfp16intrin.h avx512vlintrin.h avx512vlvbmi2intrin.h avx512vlvnniintrin.h avx512vlvp2intersectintrin.h avx512vnniintrin.h avx512vp2intersectintrin.h avx512vpopcntdqintrin.h avx512vpopcntdqvlintrin.h avxifmaintrin.h avxintrin.h avxneconvertintrin.h avxvnniint16intrin.h avxvnniint8intrin.h avxvnniintrin.h bmi2intrin.h bmiintrin.h builtins.h cet.h cetintrin.h cldemoteintrin.h clflushoptintrin.h clwbintrin.h clzerointrin.h cmpccxaddintrin.h cpuid.h crc32intrin.h emmintrin.h enqcmdintrin.h f16cintrin.h float.h fma4intrin.h fmaintrin.h fxsrintrin.h gfniintrin.h hexagon_circ_brev_intrinsics.h hexagon_protos.h hexagon_types.h hresetintrin.h htmintrin.h htmxlintrin.h hvx_hexagon_protos.h ia32intrin.h immintrin.h intrin.h intrin0.h inttypes.h invpcidintrin.h iso646.h keylockerintrin.h larchintrin.h lasxintrin.h limits.h lsxintrin.h lwpintrin.h lzcntintrin.h mm3dnow.h mm_malloc.h mmintrin.h module.modulemap movdirintrin.h movrs_avx10_2_512intrin.h movrs_avx10_2intrin.h movrsintrin.h msa.h mwaitxintrin.h nmmintrin.h pconfigintrin.h pkuintrin.h ╭─────────────────────────────────╮ │pmmintrin.h │ ╰─────────────────────────────────╯ popcntintrin.h prfchiintrin.h prfchwintrin.h ptrauth.h ptwriteintrin.h raointintrin.h rdpruintrin.h rdseedintrin.h riscv_bitmanip.h riscv_corev_alu.h riscv_crypto.h riscv_mips.h riscv_nds.h riscv_ntlh.h riscv_vector.h rtmintrin.h s390intrin.h serializeintrin.h sgxintrin.h sha512intrin.h shaintrin.h sifive_vector.h sm3intrin.h sm4evexintrin.h sm4intrin.h smmintrin.h spirvintrin.h stdalign.h stdarg.h stdatomic.h stdbool.h stdckdint.h stdcountof.h stddef.h stddefer.h stdint.h stdnoreturn.h tbmintrin.h tgmath.h tmmintrin.h tsxldtrkintrin.h uintrintrin.h unwind.h usermsrintrin.h vadefs.h vaesintrin.h varargs.h vecintrin.h velintrin.h velintrin_approx.h velintrin_gen.h vpclmulqdqintrin.h waitpkgintrin.h wasm_simd128.h wbnoinvdintrin.h wmmintrin.h x86gprintrin.h x86intrin.h xmmintrin.h xopintrin.h xsavecintrin.h xsaveintrin.h xsaveoptintrin.h xsavesintrin.h xtestintrin.h yvals_core.h
1 /*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------=== 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 *===-----------------------------------------------------------------------=== 8 */ 9 10 #ifndef __PMMINTRIN_H 11 #define __PMMINTRIN_H 12 13 #if !defined(__i386__) && !defined(__x86_64__) 14 #error "This header is only meant to be used on x86 and x64 architecture" 15 #endif 16 17 #include <emmintrin.h> 18 19 /* Define the default attributes for the functions in this file. */ 20 #define __DEFAULT_FN_ATTRS \ 21 __attribute__((__always_inline__, __nodebug__, __target__("sse3"), \ 22 __min_vector_width__(128))) 23 24 #if defined(__cplusplus) && (__cplusplus >= 201103L) 25 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr 26 #else 27 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS 28 #endif 29 30 /// Loads data from an unaligned memory location to elements in a 128-bit 31 /// vector. 32 /// 33 /// If the address of the data is not 16-byte aligned, the instruction may 34 /// read two adjacent aligned blocks of memory to retrieve the requested 35 /// data. 36 /// 37 /// \headerfile <x86intrin.h> 38 /// 39 /// This intrinsic corresponds to the <c> VLDDQU </c> instruction. 40 /// 41 /// \param __p 42 /// A pointer to a 128-bit integer vector containing integer values. 43 /// \returns A 128-bit vector containing the moved values. 44 static __inline__ __m128i __DEFAULT_FN_ATTRS 45 _mm_lddqu_si128(__m128i_u const *__p) 46 { 47 return (__m128i)__builtin_ia32_lddqu((char const *)__p); 48 } 49 50 /// Adds the even-indexed values and subtracts the odd-indexed values of 51 /// two 128-bit vectors of [4 x float]. 52 /// 53 /// \headerfile <x86intrin.h> 54 /// 55 /// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction. 56 /// 57 /// \param __a 58 /// A 128-bit vector of [4 x float] containing the left source operand. 59 /// \param __b 60 /// A 128-bit vector of [4 x float] containing the right source operand. 61 /// \returns A 128-bit vector of [4 x float] containing the alternating sums and 62 /// differences of both operands. 63 static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR 64 _mm_addsub_ps(__m128 __a, __m128 __b) { 65 return __builtin_ia32_addsubps((__v4sf)__a, (__v4sf)__b); 66 } 67 68 /// Horizontally adds the adjacent pairs of values contained in two 69 /// 128-bit vectors of [4 x float]. 70 /// 71 /// \headerfile <x86intrin.h> 72 /// 73 /// This intrinsic corresponds to the <c> VHADDPS </c> instruction. 74 /// 75 /// \param __a 76 /// A 128-bit vector of [4 x float] containing one of the source operands. 77 /// The horizontal sums of the values are stored in the lower bits of the 78 /// destination. 79 /// \param __b 80 /// A 128-bit vector of [4 x float] containing one of the source operands. 81 /// The horizontal sums of the values are stored in the upper bits of the 82 /// destination. 83 /// \returns A 128-bit vector of [4 x float] containing the horizontal sums of 84 /// both operands. 85 static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hadd_ps(__m128 __a, 86 __m128 __b) { 87 return __builtin_ia32_haddps((__v4sf)__a, (__v4sf)__b); 88 } 89 90 /// Horizontally subtracts the adjacent pairs of values contained in two 91 /// 128-bit vectors of [4 x float]. 92 /// 93 /// \headerfile <x86intrin.h> 94 /// 95 /// This intrinsic corresponds to the <c> VHSUBPS </c> instruction. 96 /// 97 /// \param __a 98 /// A 128-bit vector of [4 x float] containing one of the source operands. 99 /// The horizontal differences between the values are stored in the lower 100 /// bits of the destination. 101 /// \param __b 102 /// A 128-bit vector of [4 x float] containing one of the source operands. 103 /// The horizontal differences between the values are stored in the upper 104 /// bits of the destination. 105 /// \returns A 128-bit vector of [4 x float] containing the horizontal 106 /// differences of both operands. 107 static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_hsub_ps(__m128 __a, 108 __m128 __b) { 109 return __builtin_ia32_hsubps((__v4sf)__a, (__v4sf)__b); 110 } 111 112 /// Moves and duplicates odd-indexed values from a 128-bit vector 113 /// of [4 x float] to float values stored in a 128-bit vector of 114 /// [4 x float]. 115 /// 116 /// \headerfile <x86intrin.h> 117 /// 118 /// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction. 119 /// 120 /// \param __a 121 /// A 128-bit vector of [4 x float]. \n 122 /// Bits [127:96] of the source are written to bits [127:96] and [95:64] of 123 /// the destination. \n 124 /// Bits [63:32] of the source are written to bits [63:32] and [31:0] of the 125 /// destination. 126 /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated 127 /// values. 128 static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR 129 _mm_movehdup_ps(__m128 __a) 130 { 131 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 1, 1, 3, 3); 132 } 133 134 /// Duplicates even-indexed values from a 128-bit vector of 135 /// [4 x float] to float values stored in a 128-bit vector of [4 x float]. 136 /// 137 /// \headerfile <x86intrin.h> 138 /// 139 /// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction. 140 /// 141 /// \param __a 142 /// A 128-bit vector of [4 x float] \n 143 /// Bits [95:64] of the source are written to bits [127:96] and [95:64] of 144 /// the destination. \n 145 /// Bits [31:0] of the source are written to bits [63:32] and [31:0] of the 146 /// destination. 147 /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated 148 /// values. 149 static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR 150 _mm_moveldup_ps(__m128 __a) 151 { 152 return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 2, 2); 153 } 154 155 /// Adds the even-indexed values and subtracts the odd-indexed values of 156 /// two 128-bit vectors of [2 x double]. 157 /// 158 /// \headerfile <x86intrin.h> 159 /// 160 /// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction. 161 /// 162 /// \param __a 163 /// A 128-bit vector of [2 x double] containing the left source operand. 164 /// \param __b 165 /// A 128-bit vector of [2 x double] containing the right source operand. 166 /// \returns A 128-bit vector of [2 x double] containing the alternating sums 167 /// and differences of both operands. 168 static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR 169 _mm_addsub_pd(__m128d __a, __m128d __b) { 170 return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b); 171 } 172 173 /// Horizontally adds the pairs of values contained in two 128-bit 174 /// vectors of [2 x double]. 175 /// 176 /// \headerfile <x86intrin.h> 177 /// 178 /// This intrinsic corresponds to the <c> VHADDPD </c> instruction. 179 /// 180 /// \param __a 181 /// A 128-bit vector of [2 x double] containing one of the source operands. 182 /// The horizontal sum of the values is stored in the lower bits of the 183 /// destination. 184 /// \param __b 185 /// A 128-bit vector of [2 x double] containing one of the source operands. 186 /// The horizontal sum of the values is stored in the upper bits of the 187 /// destination. 188 /// \returns A 128-bit vector of [2 x double] containing the horizontal sums of 189 /// both operands. 190 static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR 191 _mm_hadd_pd(__m128d __a, __m128d __b) { 192 return __builtin_ia32_haddpd((__v2df)__a, (__v2df)__b); 193 } 194 195 /// Horizontally subtracts the pairs of values contained in two 128-bit 196 /// vectors of [2 x double]. 197 /// 198 /// \headerfile <x86intrin.h> 199 /// 200 /// This intrinsic corresponds to the <c> VHSUBPD </c> instruction. 201 /// 202 /// \param __a 203 /// A 128-bit vector of [2 x double] containing one of the source operands. 204 /// The horizontal difference of the values is stored in the lower bits of 205 /// the destination. 206 /// \param __b 207 /// A 128-bit vector of [2 x double] containing one of the source operands. 208 /// The horizontal difference of the values is stored in the upper bits of 209 /// the destination. 210 /// \returns A 128-bit vector of [2 x double] containing the horizontal 211 /// differences of both operands. 212 static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR 213 _mm_hsub_pd(__m128d __a, __m128d __b) { 214 return __builtin_ia32_hsubpd((__v2df)__a, (__v2df)__b); 215 } 216 217 /// Moves and duplicates one double-precision value to double-precision 218 /// values stored in a 128-bit vector of [2 x double]. 219 /// 220 /// \headerfile <x86intrin.h> 221 /// 222 /// \code 223 /// __m128d _mm_loaddup_pd(double const *dp); 224 /// \endcode 225 /// 226 /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction. 227 /// 228 /// \param dp 229 /// A pointer to a double-precision value to be moved and duplicated. 230 /// \returns A 128-bit vector of [2 x double] containing the moved and 231 /// duplicated values. 232 #define _mm_loaddup_pd(dp) _mm_load1_pd(dp) 233 234 /// Moves and duplicates the double-precision value in the lower bits of 235 /// a 128-bit vector of [2 x double] to double-precision values stored in a 236 /// 128-bit vector of [2 x double]. 237 /// 238 /// \headerfile <x86intrin.h> 239 /// 240 /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction. 241 /// 242 /// \param __a 243 /// A 128-bit vector of [2 x double]. Bits [63:0] are written to bits 244 /// [127:64] and [63:0] of the destination. 245 /// \returns A 128-bit vector of [2 x double] containing the moved and 246 /// duplicated values. 247 static __inline__ __m128d __DEFAULT_FN_ATTRS_CONSTEXPR 248 _mm_movedup_pd(__m128d __a) 249 { 250 return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0); 251 } 252 253 /// Establishes a linear address memory range to be monitored and puts 254 /// the processor in the monitor event pending state. Data stored in the 255 /// monitored address range causes the processor to exit the pending state. 256 /// 257 /// The \c MONITOR instruction can be used in kernel mode, and in other modes 258 /// if MSR <c> C001_0015h[MonMwaitUserEn] </c> is set. 259 /// 260 /// \headerfile <x86intrin.h> 261 /// 262 /// This intrinsic corresponds to the \c MONITOR instruction. 263 /// 264 /// \param __p 265 /// The memory range to be monitored. The size of the range is determined by 266 /// CPUID function 0000_0005h. 267 /// \param __extensions 268 /// Optional extensions for the monitoring state. 269 /// \param __hints 270 /// Optional hints for the monitoring state. 271 static __inline__ void __DEFAULT_FN_ATTRS 272 _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints) 273 { 274 __builtin_ia32_monitor(__p, __extensions, __hints); 275 } 276 277 /// Used with the \c MONITOR instruction to wait while the processor is in 278 /// the monitor event pending state. Data stored in the monitored address 279 /// range, or an interrupt, causes the processor to exit the pending state. 280 /// 281 /// The \c MWAIT instruction can be used in kernel mode, and in other modes if 282 /// MSR <c> C001_0015h[MonMwaitUserEn] </c> is set. 283 /// 284 /// \headerfile <x86intrin.h> 285 /// 286 /// This intrinsic corresponds to the \c MWAIT instruction. 287 /// 288 /// \param __extensions 289 /// Optional extensions for the monitoring state, which can vary by 290 /// processor. 291 /// \param __hints 292 /// Optional hints for the monitoring state, which can vary by processor. 293 static __inline__ void __DEFAULT_FN_ATTRS 294 _mm_mwait(unsigned __extensions, unsigned __hints) 295 { 296 __builtin_ia32_mwait(__extensions, __hints); 297 } 298 299 #undef __DEFAULT_FN_ATTRS 300 #undef __DEFAULT_FN_ATTRS_CONSTEXPR 301 302 #endif /* __PMMINTRIN_H */ 303