Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 1 | /*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------=== |
| 2 | * |
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | * of this software and associated documentation files (the "Software"), to deal |
| 5 | * in the Software without restriction, including without limitation the rights |
| 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | * copies of the Software, and to permit persons to whom the Software is |
| 8 | * furnished to do so, subject to the following conditions: |
| 9 | * |
| 10 | * The above copyright notice and this permission notice shall be included in |
| 11 | * all copies or substantial portions of the Software. |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | * THE SOFTWARE. |
| 20 | * |
| 21 | *===-----------------------------------------------------------------------=== |
| 22 | */ |
Sean Silva | e4c3760 | 2015-09-12 02:55:19 +0000 | [diff] [blame] | 23 | |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 24 | #ifndef __PMMINTRIN_H |
| 25 | #define __PMMINTRIN_H |
| 26 | |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 27 | #include <emmintrin.h> |
| 28 | |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 29 | /* Define the default attributes for the functions in this file. */ |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 30 | #define __DEFAULT_FN_ATTRS \ |
| 31 | __attribute__((__always_inline__, __nodebug__, __target__("sse3"))) |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 32 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 33 | /// \brief Loads data from an unaligned memory location to elements in a 128-bit |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 34 | /// vector. If the address of the data is not 16-byte aligned, the |
| 35 | /// instruction may read two adjacent aligned blocks of memory to retrieve |
| 36 | /// the requested data. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 37 | /// |
| 38 | /// \headerfile <x86intrin.h> |
| 39 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 40 | /// This intrinsic corresponds to the <c> VLDDQU </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 41 | /// |
| 42 | /// \param __p |
| 43 | /// A pointer to a 128-bit integer vector containing integer values. |
| 44 | /// \returns A 128-bit vector containing the moved values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 45 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 46 | _mm_lddqu_si128(__m128i const *__p) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 47 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 48 | return (__m128i)__builtin_ia32_lddqu((char const *)__p); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 49 | } |
| 50 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 51 | /// \brief Adds the even-indexed values and subtracts the odd-indexed values of |
| 52 | /// two 128-bit vectors of [4 x float]. |
| 53 | /// |
| 54 | /// \headerfile <x86intrin.h> |
| 55 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 56 | /// This intrinsic corresponds to the <c> VADDSUBPS </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 57 | /// |
| 58 | /// \param __a |
| 59 | /// A 128-bit vector of [4 x float] containing the left source operand. |
| 60 | /// \param __b |
| 61 | /// A 128-bit vector of [4 x float] containing the right source operand. |
| 62 | /// \returns A 128-bit vector of [4 x float] containing the alternating sums and |
| 63 | /// differences of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 64 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 65 | _mm_addsub_ps(__m128 __a, __m128 __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 66 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 67 | return __builtin_ia32_addsubps((__v4sf)__a, (__v4sf)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 70 | /// \brief Horizontally adds the adjacent pairs of values contained in two |
| 71 | /// 128-bit vectors of [4 x float]. |
| 72 | /// |
| 73 | /// \headerfile <x86intrin.h> |
| 74 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 75 | /// This intrinsic corresponds to the <c> VHADDPS </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 76 | /// |
| 77 | /// \param __a |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 78 | /// A 128-bit vector of [4 x float] containing one of the source operands. |
| 79 | /// The horizontal sums of the values are stored in the lower bits of the |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 80 | /// destination. |
| 81 | /// \param __b |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 82 | /// A 128-bit vector of [4 x float] containing one of the source operands. |
| 83 | /// The horizontal sums of the values are stored in the upper bits of the |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 84 | /// destination. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 85 | /// \returns A 128-bit vector of [4 x float] containing the horizontal sums of |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 86 | /// both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 87 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 88 | _mm_hadd_ps(__m128 __a, __m128 __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 89 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 90 | return __builtin_ia32_haddps((__v4sf)__a, (__v4sf)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 91 | } |
| 92 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 93 | /// \brief Horizontally subtracts the adjacent pairs of values contained in two |
| 94 | /// 128-bit vectors of [4 x float]. |
| 95 | /// |
| 96 | /// \headerfile <x86intrin.h> |
| 97 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 98 | /// This intrinsic corresponds to the <c> VHSUBPS </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 99 | /// |
| 100 | /// \param __a |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 101 | /// A 128-bit vector of [4 x float] containing one of the source operands. |
| 102 | /// The horizontal differences between the values are stored in the lower |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 103 | /// bits of the destination. |
| 104 | /// \param __b |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 105 | /// A 128-bit vector of [4 x float] containing one of the source operands. |
| 106 | /// The horizontal differences between the values are stored in the upper |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 107 | /// bits of the destination. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 108 | /// \returns A 128-bit vector of [4 x float] containing the horizontal |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 109 | /// differences of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 110 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 111 | _mm_hsub_ps(__m128 __a, __m128 __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 112 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 113 | return __builtin_ia32_hsubps((__v4sf)__a, (__v4sf)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 114 | } |
| 115 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 116 | /// \brief Moves and duplicates high-order (odd-indexed) values from a 128-bit |
| 117 | /// vector of [4 x float] to float values stored in a 128-bit vector of |
Ekaterina Romanova | 2e041c9 | 2017-01-13 01:14:08 +0000 | [diff] [blame^] | 118 | /// [4 x float]. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 119 | /// |
| 120 | /// \headerfile <x86intrin.h> |
| 121 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 122 | /// This intrinsic corresponds to the <c> VMOVSHDUP </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 123 | /// |
| 124 | /// \param __a |
Ekaterina Romanova | dffe45b | 2016-12-27 00:49:38 +0000 | [diff] [blame] | 125 | /// A 128-bit vector of [4 x float]. \n |
| 126 | /// Bits [127:96] of the source are written to bits [127:96] and [95:64] of |
| 127 | /// the destination. \n |
| 128 | /// Bits [63:32] of the source are written to bits [63:32] and [31:0] of the |
| 129 | /// destination. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 130 | /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated |
| 131 | /// values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 132 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 133 | _mm_movehdup_ps(__m128 __a) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 134 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 135 | return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 1, 1, 3, 3); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 136 | } |
| 137 | |
Ekaterina Romanova | dffe45b | 2016-12-27 00:49:38 +0000 | [diff] [blame] | 138 | /// \brief Duplicates low-order (even-indexed) values from a 128-bit vector of |
Ekaterina Romanova | 2e041c9 | 2017-01-13 01:14:08 +0000 | [diff] [blame^] | 139 | /// [4 x float] to float values stored in a 128-bit vector of [4 x float]. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 140 | /// |
| 141 | /// \headerfile <x86intrin.h> |
| 142 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 143 | /// This intrinsic corresponds to the <c> VMOVSLDUP </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 144 | /// |
| 145 | /// \param __a |
Ekaterina Romanova | dffe45b | 2016-12-27 00:49:38 +0000 | [diff] [blame] | 146 | /// A 128-bit vector of [4 x float] \n |
| 147 | /// Bits [95:64] of the source are written to bits [127:96] and [95:64] of |
| 148 | /// the destination. \n |
| 149 | /// Bits [31:0] of the source are written to bits [63:32] and [31:0] of the |
| 150 | /// destination. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 151 | /// \returns A 128-bit vector of [4 x float] containing the moved and duplicated |
| 152 | /// values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 153 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 154 | _mm_moveldup_ps(__m128 __a) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 155 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 156 | return __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 2, 2); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 159 | /// \brief Adds the even-indexed values and subtracts the odd-indexed values of |
| 160 | /// two 128-bit vectors of [2 x double]. |
| 161 | /// |
| 162 | /// \headerfile <x86intrin.h> |
| 163 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 164 | /// This intrinsic corresponds to the <c> VADDSUBPD </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 165 | /// |
| 166 | /// \param __a |
| 167 | /// A 128-bit vector of [2 x double] containing the left source operand. |
| 168 | /// \param __b |
| 169 | /// A 128-bit vector of [2 x double] containing the right source operand. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 170 | /// \returns A 128-bit vector of [2 x double] containing the alternating sums |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 171 | /// and differences of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 172 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 173 | _mm_addsub_pd(__m128d __a, __m128d __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 174 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 175 | return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 176 | } |
| 177 | |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 178 | /// \brief Horizontally adds the pairs of values contained in two 128-bit |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 179 | /// vectors of [2 x double]. |
| 180 | /// |
| 181 | /// \headerfile <x86intrin.h> |
| 182 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 183 | /// This intrinsic corresponds to the <c> VHADDPD </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 184 | /// |
| 185 | /// \param __a |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 186 | /// A 128-bit vector of [2 x double] containing one of the source operands. |
| 187 | /// The horizontal sum of the values is stored in the lower bits of the |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 188 | /// destination. |
| 189 | /// \param __b |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 190 | /// A 128-bit vector of [2 x double] containing one of the source operands. |
| 191 | /// The horizontal sum of the values is stored in the upper bits of the |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 192 | /// destination. |
| 193 | /// \returns A 128-bit vector of [2 x double] containing the horizontal sums of |
| 194 | /// both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 195 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 196 | _mm_hadd_pd(__m128d __a, __m128d __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 197 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 198 | return __builtin_ia32_haddpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 199 | } |
| 200 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 201 | /// \brief Horizontally subtracts the pairs of values contained in two 128-bit |
| 202 | /// vectors of [2 x double]. |
| 203 | /// |
| 204 | /// \headerfile <x86intrin.h> |
| 205 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 206 | /// This intrinsic corresponds to the <c> VHSUBPD </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 207 | /// |
| 208 | /// \param __a |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 209 | /// A 128-bit vector of [2 x double] containing one of the source operands. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 210 | /// The horizontal difference of the values is stored in the lower bits of |
| 211 | /// the destination. |
| 212 | /// \param __b |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 213 | /// A 128-bit vector of [2 x double] containing one of the source operands. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 214 | /// The horizontal difference of the values is stored in the upper bits of |
| 215 | /// the destination. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 216 | /// \returns A 128-bit vector of [2 x double] containing the horizontal |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 217 | /// differences of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 218 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 219 | _mm_hsub_pd(__m128d __a, __m128d __b) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 220 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 221 | return __builtin_ia32_hsubpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 224 | /// \brief Moves and duplicates one double-precision value to double-precision |
| 225 | /// values stored in a 128-bit vector of [2 x double]. |
| 226 | /// |
| 227 | /// \headerfile <x86intrin.h> |
| 228 | /// |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 229 | /// \code |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 230 | /// __m128d _mm_loaddup_pd(double const * dp); |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 231 | /// \endcode |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 232 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 233 | /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 234 | /// |
| 235 | /// \param dp |
| 236 | /// A pointer to a double-precision value to be moved and duplicated. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 237 | /// \returns A 128-bit vector of [2 x double] containing the moved and |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 238 | /// duplicated values. |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 239 | #define _mm_loaddup_pd(dp) _mm_load1_pd(dp) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 240 | |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 241 | /// \brief Moves and duplicates the double-precision value in the lower bits of |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 242 | /// a 128-bit vector of [2 x double] to double-precision values stored in a |
| 243 | /// 128-bit vector of [2 x double]. |
| 244 | /// |
| 245 | /// \headerfile <x86intrin.h> |
| 246 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 247 | /// This intrinsic corresponds to the <c> VMOVDDUP </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 248 | /// |
| 249 | /// \param __a |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 250 | /// A 128-bit vector of [2 x double]. Bits [63:0] are written to bits |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 251 | /// [127:64] and [63:0] of the destination. |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 252 | /// \returns A 128-bit vector of [2 x double] containing the moved and |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 253 | /// duplicated values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 254 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 255 | _mm_movedup_pd(__m128d __a) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 256 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 257 | return __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | #define _MM_DENORMALS_ZERO_ON (0x0040) |
| 261 | #define _MM_DENORMALS_ZERO_OFF (0x0000) |
| 262 | |
| 263 | #define _MM_DENORMALS_ZERO_MASK (0x0040) |
| 264 | |
| 265 | #define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK) |
| 266 | #define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x))) |
| 267 | |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 268 | /// \brief Establishes a linear address memory range to be monitored and puts |
| 269 | /// the processor in the monitor event pending state. Data stored in the |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 270 | /// monitored address range causes the processor to exit the pending state. |
| 271 | /// |
| 272 | /// \headerfile <x86intrin.h> |
| 273 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 274 | /// This intrinsic corresponds to the <c> MONITOR </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 275 | /// |
| 276 | /// \param __p |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 277 | /// The memory range to be monitored. The size of the range is determined by |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 278 | /// CPUID function 0000_0005h. |
| 279 | /// \param __extensions |
| 280 | /// Optional extensions for the monitoring state. |
| 281 | /// \param __hints |
| 282 | /// Optional hints for the monitoring state. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 283 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 284 | _mm_monitor(void const *__p, unsigned __extensions, unsigned __hints) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 285 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 286 | __builtin_ia32_monitor((void *)__p, __extensions, __hints); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 289 | /// \brief Used with the MONITOR instruction to wait while the processor is in |
| 290 | /// the monitor event pending state. Data stored in the monitored address |
| 291 | /// range causes the processor to exit the pending state. |
| 292 | /// |
| 293 | /// \headerfile <x86intrin.h> |
| 294 | /// |
Ekaterina Romanova | 0c1c3bb | 2016-12-09 18:35:50 +0000 | [diff] [blame] | 295 | /// This intrinsic corresponds to the <c> MWAIT </c> instruction. |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 296 | /// |
| 297 | /// \param __extensions |
Ekaterina Romanova | 5a7f09c | 2016-05-28 00:18:59 +0000 | [diff] [blame] | 298 | /// Optional extensions for the monitoring state, which may vary by |
Ekaterina Romanova | d416747 | 2016-02-08 22:35:09 +0000 | [diff] [blame] | 299 | /// processor. |
| 300 | /// \param __hints |
| 301 | /// Optional hints for the monitoring state, which may vary by processor. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 302 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 303 | _mm_mwait(unsigned __extensions, unsigned __hints) |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 304 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 305 | __builtin_ia32_mwait(__extensions, __hints); |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 306 | } |
| 307 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 308 | #undef __DEFAULT_FN_ATTRS |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 309 | |
Anders Carlsson | d0d8c54 | 2009-02-11 06:39:50 +0000 | [diff] [blame] | 310 | #endif /* __PMMINTRIN_H */ |