Benjamin Kramer | ae8ea1f | 2010-08-20 16:47:17 +0000 | [diff] [blame] | 1 | /*===---- emmintrin.h - SSE2 intrinsics ------------------------------------=== |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 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 | */ |
Benjamin Kramer | ae8ea1f | 2010-08-20 16:47:17 +0000 | [diff] [blame] | 23 | |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 24 | #ifndef __EMMINTRIN_H |
| 25 | #define __EMMINTRIN_H |
| 26 | |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 27 | #include <xmmintrin.h> |
| 28 | |
| 29 | typedef double __m128d __attribute__((__vector_size__(16))); |
| 30 | typedef long long __m128i __attribute__((__vector_size__(16))); |
| 31 | |
Eric Christopher | 2a9898f | 2010-08-26 02:09:25 +0000 | [diff] [blame] | 32 | /* Type defines. */ |
| 33 | typedef double __v2df __attribute__ ((__vector_size__ (16))); |
| 34 | typedef long long __v2di __attribute__ ((__vector_size__ (16))); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 35 | typedef short __v8hi __attribute__((__vector_size__(16))); |
Anders Carlsson | 327c8df | 2009-09-18 19:18:19 +0000 | [diff] [blame] | 36 | typedef char __v16qi __attribute__((__vector_size__(16))); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 37 | |
Chandler Carruth | cbe6411 | 2015-10-01 23:40:12 +0000 | [diff] [blame] | 38 | /* We need an explicitly signed variant for char. Note that this shouldn't |
| 39 | * appear in the interface though. */ |
| 40 | typedef signed char __v16qs __attribute__((__vector_size__(16))); |
| 41 | |
Michael Kuperstein | a10dff9 | 2015-09-21 13:34:47 +0000 | [diff] [blame] | 42 | #include <f16cintrin.h> |
| 43 | |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 44 | /* Define the default attributes for the functions in this file. */ |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 45 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2"))) |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 46 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 47 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 48 | _mm_add_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 49 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 50 | __a[0] += __b[0]; |
| 51 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 54 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 55 | _mm_add_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 56 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 57 | return (__m128d)((__v2df)__a + (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 60 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 61 | _mm_sub_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 62 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 63 | __a[0] -= __b[0]; |
| 64 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 65 | } |
| 66 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 67 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 68 | _mm_sub_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 69 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 70 | return (__m128d)((__v2df)__a - (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 71 | } |
| 72 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 73 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 74 | _mm_mul_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 75 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 76 | __a[0] *= __b[0]; |
| 77 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 80 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 81 | _mm_mul_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 82 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 83 | return (__m128d)((__v2df)__a * (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 86 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 87 | _mm_div_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 88 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 89 | __a[0] /= __b[0]; |
| 90 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 91 | } |
| 92 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 93 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 94 | _mm_div_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 95 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 96 | return (__m128d)((__v2df)__a / (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 97 | } |
| 98 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 99 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 100 | _mm_sqrt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 101 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 102 | __m128d __c = __builtin_ia32_sqrtsd((__v2df)__b); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 103 | return (__m128d) { __c[0], __a[1] }; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 106 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 107 | _mm_sqrt_pd(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 108 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 109 | return __builtin_ia32_sqrtpd((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 112 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 113 | _mm_min_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 114 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 115 | return __builtin_ia32_minsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 116 | } |
| 117 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 118 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 119 | _mm_min_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 120 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 121 | return __builtin_ia32_minpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 122 | } |
| 123 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 124 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 125 | _mm_max_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 126 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 127 | return __builtin_ia32_maxsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 128 | } |
| 129 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 130 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 131 | _mm_max_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 132 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 133 | return __builtin_ia32_maxpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 134 | } |
| 135 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 136 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 137 | _mm_and_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 138 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 139 | return (__m128d)((__v4si)__a & (__v4si)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 142 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 143 | _mm_andnot_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 144 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 145 | return (__m128d)(~(__v4si)__a & (__v4si)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 146 | } |
| 147 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 148 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 149 | _mm_or_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 150 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 151 | return (__m128d)((__v4si)__a | (__v4si)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 154 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 155 | _mm_xor_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 156 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 157 | return (__m128d)((__v4si)__a ^ (__v4si)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 160 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 161 | _mm_cmpeq_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 162 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 163 | return (__m128d)__builtin_ia32_cmpeqpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 164 | } |
| 165 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 166 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 167 | _mm_cmplt_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 168 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 169 | return (__m128d)__builtin_ia32_cmpltpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 170 | } |
| 171 | |
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_cmple_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 174 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 175 | return (__m128d)__builtin_ia32_cmplepd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 176 | } |
| 177 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 178 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 179 | _mm_cmpgt_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 180 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 181 | return (__m128d)__builtin_ia32_cmpltpd((__v2df)__b, (__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 182 | } |
| 183 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 184 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 185 | _mm_cmpge_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 186 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 187 | return (__m128d)__builtin_ia32_cmplepd((__v2df)__b, (__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 188 | } |
| 189 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 190 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 191 | _mm_cmpord_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 192 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 193 | return (__m128d)__builtin_ia32_cmpordpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 196 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 197 | _mm_cmpunord_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 198 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 199 | return (__m128d)__builtin_ia32_cmpunordpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 202 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 203 | _mm_cmpneq_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 204 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 205 | return (__m128d)__builtin_ia32_cmpneqpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 206 | } |
| 207 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 208 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 209 | _mm_cmpnlt_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 210 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 211 | return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 214 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 215 | _mm_cmpnle_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 216 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 217 | return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 218 | } |
| 219 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 220 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 221 | _mm_cmpngt_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 222 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 223 | return (__m128d)__builtin_ia32_cmpnltpd((__v2df)__b, (__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 224 | } |
| 225 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 226 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 227 | _mm_cmpnge_pd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 228 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 229 | return (__m128d)__builtin_ia32_cmpnlepd((__v2df)__b, (__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 232 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 233 | _mm_cmpeq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 234 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 235 | return (__m128d)__builtin_ia32_cmpeqsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 236 | } |
| 237 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 238 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 239 | _mm_cmplt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 240 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 241 | return (__m128d)__builtin_ia32_cmpltsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 244 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 245 | _mm_cmple_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 246 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 247 | return (__m128d)__builtin_ia32_cmplesd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 248 | } |
| 249 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 250 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 251 | _mm_cmpgt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 252 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 253 | __m128d __c = __builtin_ia32_cmpltsd((__v2df)__b, (__v2df)__a); |
Manman Ren | 9bb34d6 | 2013-06-17 19:42:49 +0000 | [diff] [blame] | 254 | return (__m128d) { __c[0], __a[1] }; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 257 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 258 | _mm_cmpge_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 259 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 260 | __m128d __c = __builtin_ia32_cmplesd((__v2df)__b, (__v2df)__a); |
Manman Ren | 9bb34d6 | 2013-06-17 19:42:49 +0000 | [diff] [blame] | 261 | return (__m128d) { __c[0], __a[1] }; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 262 | } |
| 263 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 264 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 265 | _mm_cmpord_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 266 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 267 | return (__m128d)__builtin_ia32_cmpordsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 268 | } |
| 269 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 270 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 271 | _mm_cmpunord_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 272 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 273 | return (__m128d)__builtin_ia32_cmpunordsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 274 | } |
| 275 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 276 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 277 | _mm_cmpneq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 278 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 279 | return (__m128d)__builtin_ia32_cmpneqsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 280 | } |
| 281 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 282 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 283 | _mm_cmpnlt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 284 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 285 | return (__m128d)__builtin_ia32_cmpnltsd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 286 | } |
| 287 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 288 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 289 | _mm_cmpnle_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 290 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 291 | return (__m128d)__builtin_ia32_cmpnlesd((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 292 | } |
| 293 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 294 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 295 | _mm_cmpngt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 296 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 297 | __m128d __c = __builtin_ia32_cmpnltsd((__v2df)__b, (__v2df)__a); |
Manman Ren | 9bb34d6 | 2013-06-17 19:42:49 +0000 | [diff] [blame] | 298 | return (__m128d) { __c[0], __a[1] }; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 299 | } |
| 300 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 301 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 302 | _mm_cmpnge_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 303 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 304 | __m128d __c = __builtin_ia32_cmpnlesd((__v2df)__b, (__v2df)__a); |
Manman Ren | 9bb34d6 | 2013-06-17 19:42:49 +0000 | [diff] [blame] | 305 | return (__m128d) { __c[0], __a[1] }; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 306 | } |
| 307 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 308 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 309 | _mm_comieq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 310 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 311 | return __builtin_ia32_comisdeq((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 312 | } |
| 313 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 314 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 315 | _mm_comilt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 316 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 317 | return __builtin_ia32_comisdlt((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 320 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 321 | _mm_comile_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 322 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 323 | return __builtin_ia32_comisdle((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 324 | } |
| 325 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 326 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 327 | _mm_comigt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 328 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 329 | return __builtin_ia32_comisdgt((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 330 | } |
| 331 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 332 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 333 | _mm_comige_sd(__m128d __a, __m128d __b) |
Eli Friedman | 89c1133 | 2011-10-06 20:31:50 +0000 | [diff] [blame] | 334 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 335 | return __builtin_ia32_comisdge((__v2df)__a, (__v2df)__b); |
Eli Friedman | 89c1133 | 2011-10-06 20:31:50 +0000 | [diff] [blame] | 336 | } |
| 337 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 338 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 339 | _mm_comineq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 340 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 341 | return __builtin_ia32_comisdneq((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 344 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 345 | _mm_ucomieq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 346 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 347 | return __builtin_ia32_ucomisdeq((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 348 | } |
| 349 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 350 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 351 | _mm_ucomilt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 352 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 353 | return __builtin_ia32_ucomisdlt((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 354 | } |
| 355 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 356 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 357 | _mm_ucomile_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 358 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 359 | return __builtin_ia32_ucomisdle((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 360 | } |
| 361 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 362 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 363 | _mm_ucomigt_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 364 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 365 | return __builtin_ia32_ucomisdgt((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 366 | } |
| 367 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 368 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 369 | _mm_ucomige_sd(__m128d __a, __m128d __b) |
Eli Friedman | f8cb480 | 2011-08-29 21:26:24 +0000 | [diff] [blame] | 370 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 371 | return __builtin_ia32_ucomisdge((__v2df)__a, (__v2df)__b); |
Eli Friedman | f8cb480 | 2011-08-29 21:26:24 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 374 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 375 | _mm_ucomineq_sd(__m128d __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 376 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 377 | return __builtin_ia32_ucomisdneq((__v2df)__a, (__v2df)__b); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 378 | } |
| 379 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 380 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 381 | _mm_cvtpd_ps(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 382 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 383 | return __builtin_ia32_cvtpd2ps((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 384 | } |
| 385 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 386 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 387 | _mm_cvtps_pd(__m128 __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 388 | { |
Simon Pilgrim | 90770c7 | 2016-05-23 22:13:02 +0000 | [diff] [blame^] | 389 | return (__m128d) __builtin_convertvector( |
| 390 | __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 1), __v2df); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 391 | } |
| 392 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 393 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 394 | _mm_cvtepi32_pd(__m128i __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 395 | { |
Simon Pilgrim | 90770c7 | 2016-05-23 22:13:02 +0000 | [diff] [blame^] | 396 | return (__m128d) __builtin_convertvector( |
| 397 | __builtin_shufflevector((__v4si)__a, (__v4si)__a, 0, 1), __v2df); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 398 | } |
| 399 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 400 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 401 | _mm_cvtpd_epi32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 402 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 403 | return __builtin_ia32_cvtpd2dq((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 404 | } |
| 405 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 406 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 407 | _mm_cvtsd_si32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 408 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 409 | return __builtin_ia32_cvtsd2si((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 410 | } |
| 411 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 412 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 413 | _mm_cvtsd_ss(__m128 __a, __m128d __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 414 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 415 | __a[0] = __b[0]; |
| 416 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 417 | } |
| 418 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 419 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 420 | _mm_cvtsi32_sd(__m128d __a, int __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 421 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 422 | __a[0] = __b; |
| 423 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 424 | } |
| 425 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 426 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 427 | _mm_cvtss_sd(__m128d __a, __m128 __b) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 428 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 429 | __a[0] = __b[0]; |
| 430 | return __a; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 431 | } |
| 432 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 433 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 434 | _mm_cvttpd_epi32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 435 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 436 | return (__m128i)__builtin_ia32_cvttpd2dq((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 437 | } |
| 438 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 439 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 440 | _mm_cvttsd_si32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 441 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 442 | return __a[0]; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 443 | } |
| 444 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 445 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 446 | _mm_cvtpd_pi32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 447 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 448 | return (__m64)__builtin_ia32_cvtpd2pi((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 449 | } |
| 450 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 451 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 452 | _mm_cvttpd_pi32(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 453 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 454 | return (__m64)__builtin_ia32_cvttpd2pi((__v2df)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 455 | } |
| 456 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 457 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 458 | _mm_cvtpi32_pd(__m64 __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 459 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 460 | return __builtin_ia32_cvtpi2pd((__v2si)__a); |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 461 | } |
| 462 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 463 | static __inline__ double __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 464 | _mm_cvtsd_f64(__m128d __a) |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 465 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 466 | return __a[0]; |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 467 | } |
| 468 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 469 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 470 | _mm_load_pd(double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 471 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 472 | return *(__m128d*)__dp; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 473 | } |
| 474 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 475 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 476 | _mm_load1_pd(double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 477 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 478 | struct __mm_load1_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 479 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 480 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 481 | double __u = ((struct __mm_load1_pd_struct*)__dp)->__u; |
| 482 | return (__m128d){ __u, __u }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 483 | } |
| 484 | |
Eli Friedman | f83c258 | 2009-06-02 05:55:48 +0000 | [diff] [blame] | 485 | #define _mm_load_pd1(dp) _mm_load1_pd(dp) |
| 486 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 487 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 488 | _mm_loadr_pd(double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 489 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 490 | __m128d __u = *(__m128d*)__dp; |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 491 | return __builtin_shufflevector((__v2df)__u, (__v2df)__u, 1, 0); |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 492 | } |
| 493 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 494 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 495 | _mm_loadu_pd(double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 496 | { |
Bill Wendling | 502931f | 2011-05-13 00:11:39 +0000 | [diff] [blame] | 497 | struct __loadu_pd { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 498 | __m128d __v; |
David Majnemer | 1cf22e6 | 2015-02-04 00:26:10 +0000 | [diff] [blame] | 499 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 500 | return ((struct __loadu_pd*)__dp)->__v; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 501 | } |
| 502 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 503 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 504 | _mm_load_sd(double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 505 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 506 | struct __mm_load_sd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 507 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 508 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 509 | double __u = ((struct __mm_load_sd_struct*)__dp)->__u; |
| 510 | return (__m128d){ __u, 0 }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 513 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 514 | _mm_loadh_pd(__m128d __a, double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 515 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 516 | struct __mm_loadh_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 517 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 518 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 519 | double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u; |
| 520 | return (__m128d){ __a[0], __u }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 521 | } |
| 522 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 523 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 524 | _mm_loadl_pd(__m128d __a, double const *__dp) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 525 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 526 | struct __mm_loadl_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 527 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 528 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 529 | double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u; |
| 530 | return (__m128d){ __u, __a[1] }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 531 | } |
| 532 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 533 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
Simon Pilgrim | 5aba992 | 2015-08-26 21:17:12 +0000 | [diff] [blame] | 534 | _mm_undefined_pd() |
| 535 | { |
| 536 | return (__m128d)__builtin_ia32_undef128(); |
| 537 | } |
| 538 | |
| 539 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 540 | _mm_set_sd(double __w) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 541 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 542 | return (__m128d){ __w, 0 }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 543 | } |
| 544 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 545 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 546 | _mm_set1_pd(double __w) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 547 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 548 | return (__m128d){ __w, __w }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 549 | } |
| 550 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 551 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 552 | _mm_set_pd(double __w, double __x) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 553 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 554 | return (__m128d){ __x, __w }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 555 | } |
| 556 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 557 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 558 | _mm_setr_pd(double __w, double __x) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 559 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 560 | return (__m128d){ __w, __x }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 561 | } |
| 562 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 563 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
Mike Stump | 5b31ed3 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 564 | _mm_setzero_pd(void) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 565 | { |
| 566 | return (__m128d){ 0, 0 }; |
| 567 | } |
| 568 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 569 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 570 | _mm_move_sd(__m128d __a, __m128d __b) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 571 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 572 | return (__m128d){ __b[0], __a[1] }; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 573 | } |
| 574 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 575 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 576 | _mm_store_sd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 577 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 578 | struct __mm_store_sd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 579 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 580 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 581 | ((struct __mm_store_sd_struct*)__dp)->__u = __a[0]; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 582 | } |
| 583 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 584 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 585 | _mm_store1_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 586 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 587 | struct __mm_store1_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 588 | double __u[2]; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 589 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 590 | ((struct __mm_store1_pd_struct*)__dp)->__u[0] = __a[0]; |
| 591 | ((struct __mm_store1_pd_struct*)__dp)->__u[1] = __a[0]; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 592 | } |
| 593 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 594 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 595 | _mm_store_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 596 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 597 | *(__m128d *)__dp = __a; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 598 | } |
| 599 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 600 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 601 | _mm_storeu_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 602 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 603 | __builtin_ia32_storeupd(__dp, (__v2df)__a); |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 604 | } |
| 605 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 606 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 607 | _mm_storer_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 608 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 609 | __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 1, 0); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 610 | *(__m128d *)__dp = __a; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 611 | } |
| 612 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 613 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 614 | _mm_storeh_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 615 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 616 | struct __mm_storeh_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 617 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 618 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 619 | ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1]; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 620 | } |
| 621 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 622 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 623 | _mm_storel_pd(double *__dp, __m128d __a) |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 624 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 625 | struct __mm_storeh_pd_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 626 | double __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 627 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 628 | ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0]; |
Anders Carlsson | b08ac0b | 2008-12-24 02:11:54 +0000 | [diff] [blame] | 629 | } |
| 630 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 631 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 632 | _mm_add_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 633 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 634 | return (__m128i)((__v16qi)__a + (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 635 | } |
| 636 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 637 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 638 | _mm_add_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 639 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 640 | return (__m128i)((__v8hi)__a + (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 641 | } |
| 642 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 643 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 644 | _mm_add_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 645 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 646 | return (__m128i)((__v4si)__a + (__v4si)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 647 | } |
| 648 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 649 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 650 | _mm_add_si64(__m64 __a, __m64 __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 651 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 652 | return (__m64)__builtin_ia32_paddq((__v1di)__a, (__v1di)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 653 | } |
| 654 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 655 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 656 | _mm_add_epi64(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 657 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 658 | return (__m128i)((__v2di)__a + (__v2di)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 659 | } |
| 660 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 661 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 662 | _mm_adds_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 663 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 664 | return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 665 | } |
| 666 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 667 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 668 | _mm_adds_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 669 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 670 | return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 671 | } |
| 672 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 673 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 674 | _mm_adds_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 675 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 676 | return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 677 | } |
| 678 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 679 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 680 | _mm_adds_epu16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 681 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 682 | return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 683 | } |
| 684 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 685 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 686 | _mm_avg_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 687 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 688 | return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 689 | } |
| 690 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 691 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 692 | _mm_avg_epu16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 693 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 694 | return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 695 | } |
| 696 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 697 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 698 | _mm_madd_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 699 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 700 | return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 701 | } |
| 702 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 703 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 704 | _mm_max_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 705 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 706 | return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 707 | } |
| 708 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 709 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 710 | _mm_max_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 711 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 712 | return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 713 | } |
| 714 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 715 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 716 | _mm_min_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 717 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 718 | return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 719 | } |
| 720 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 721 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 722 | _mm_min_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 723 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 724 | return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 725 | } |
| 726 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 727 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 728 | _mm_mulhi_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 729 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 730 | return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 731 | } |
| 732 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 733 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 734 | _mm_mulhi_epu16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 735 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 736 | return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 737 | } |
| 738 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 739 | /// \brief Multiplies the corresponding elements of two [8 x short] vectors and |
| 740 | /// returns a vector containing the low-order 16 bits of each 32-bit product |
| 741 | /// in the corresponding element. |
| 742 | /// |
| 743 | /// \headerfile <x86intrin.h> |
| 744 | /// |
| 745 | /// This intrinsic corresponds to the \c VPMULLW / PMULLW instruction. |
| 746 | /// |
| 747 | /// \param __a |
| 748 | /// A 128-bit integer vector containing one of the source operands. |
| 749 | /// \param __b |
| 750 | /// A 128-bit integer vector containing one of the source operands. |
| 751 | /// \returns A 128-bit integer vector containing the products of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 752 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 753 | _mm_mullo_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 754 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 755 | return (__m128i)((__v8hi)__a * (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 756 | } |
| 757 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 758 | /// \brief Multiplies 32-bit unsigned integer values contained in the lower bits |
| 759 | /// of the two 64-bit integer vectors and returns the 64-bit unsigned |
| 760 | /// product. |
| 761 | /// |
| 762 | /// \headerfile <x86intrin.h> |
| 763 | /// |
| 764 | /// This intrinsic corresponds to the \c PMULUDQ instruction. |
| 765 | /// |
| 766 | /// \param __a |
| 767 | /// A 64-bit integer containing one of the source operands. |
| 768 | /// \param __b |
| 769 | /// A 64-bit integer containing one of the source operands. |
| 770 | /// \returns A 64-bit integer vector containing the product of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 771 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 772 | _mm_mul_su32(__m64 __a, __m64 __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 773 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 774 | return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 775 | } |
| 776 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 777 | /// \brief Multiplies 32-bit unsigned integer values contained in the lower |
| 778 | /// bits of the corresponding elements of two [2 x i64] vectors, and returns |
| 779 | /// the 64-bit products in the corresponding elements of a [2 x i64] vector. |
| 780 | /// |
| 781 | /// \headerfile <x86intrin.h> |
| 782 | /// |
| 783 | /// This intrinsic corresponds to the \c VPMULUDQ / PMULUDQ instruction. |
| 784 | /// |
| 785 | /// \param __a |
| 786 | /// A [2 x i64] vector containing one of the source operands. |
| 787 | /// \param __b |
| 788 | /// A [2 x i64] vector containing one of the source operands. |
| 789 | /// \returns A [2 x i64] vector containing the product of both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 790 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 791 | _mm_mul_epu32(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 792 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 793 | return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 794 | } |
| 795 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 796 | /// \brief Computes the absolute differences of corresponding 8-bit integer |
| 797 | /// values in two 128-bit vectors. Sums the first 8 absolute differences, and |
| 798 | /// separately sums the second 8 absolute differences. Packss these two |
| 799 | /// unsigned 16-bit integer sums into the upper and lower elements of a |
| 800 | /// [2 x i64] vector. |
| 801 | /// |
| 802 | /// \headerfile <x86intrin.h> |
| 803 | /// |
| 804 | /// This intrinsic corresponds to the \c VPSADBW / PSADBW instruction. |
| 805 | /// |
| 806 | /// \param __a |
| 807 | /// A 128-bit integer vector containing one of the source operands. |
| 808 | /// \param __b |
| 809 | /// A 128-bit integer vector containing one of the source operands. |
| 810 | /// \returns A [2 x i64] vector containing the sums of the sets of absolute |
| 811 | /// differences between both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 812 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 813 | _mm_sad_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 814 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 815 | return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 816 | } |
| 817 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 818 | /// \brief Subtracts the corresponding 8-bit integer values in the operands. |
| 819 | /// |
| 820 | /// \headerfile <x86intrin.h> |
| 821 | /// |
| 822 | /// This intrinsic corresponds to the \c VPSUBB / PSUBB instruction. |
| 823 | /// |
| 824 | /// \param __a |
| 825 | /// A 128-bit integer vector containing the minuends. |
| 826 | /// \param __b |
| 827 | /// A 128-bit integer vector containing the subtrahends. |
| 828 | /// \returns A 128-bit integer vector containing the differences of the values |
| 829 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 830 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 831 | _mm_sub_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 832 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 833 | return (__m128i)((__v16qi)__a - (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 834 | } |
| 835 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 836 | /// \brief Subtracts the corresponding 16-bit integer values in the operands. |
| 837 | /// |
| 838 | /// \headerfile <x86intrin.h> |
| 839 | /// |
| 840 | /// This intrinsic corresponds to the \c VPSUBW / PSUBW instruction. |
| 841 | /// |
| 842 | /// \param __a |
| 843 | /// A 128-bit integer vector containing the minuends. |
| 844 | /// \param __b |
| 845 | /// A 128-bit integer vector containing the subtrahends. |
| 846 | /// \returns A 128-bit integer vector containing the differences of the values |
| 847 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 848 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 849 | _mm_sub_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 850 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 851 | return (__m128i)((__v8hi)__a - (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 852 | } |
| 853 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 854 | /// \brief Subtracts the corresponding 32-bit integer values in the operands. |
| 855 | /// |
| 856 | /// \headerfile <x86intrin.h> |
| 857 | /// |
| 858 | /// This intrinsic corresponds to the \c VPSUBD / PSUBD instruction. |
| 859 | /// |
| 860 | /// \param __a |
| 861 | /// A 128-bit integer vector containing the minuends. |
| 862 | /// \param __b |
| 863 | /// A 128-bit integer vector containing the subtrahends. |
| 864 | /// \returns A 128-bit integer vector containing the differences of the values |
| 865 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 866 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 867 | _mm_sub_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 868 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 869 | return (__m128i)((__v4si)__a - (__v4si)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 870 | } |
| 871 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 872 | /// \brief Subtracts signed or unsigned 64-bit integer values and writes the |
| 873 | /// difference to the corresponding bits in the destination. |
| 874 | /// |
| 875 | /// \headerfile <x86intrin.h> |
| 876 | /// |
| 877 | /// This intrinsic corresponds to the \c PSUBQ instruction. |
| 878 | /// |
| 879 | /// \param __a |
| 880 | /// A 64-bit integer vector containing the minuend. |
| 881 | /// \param __b |
| 882 | /// A 64-bit integer vector containing the subtrahend. |
| 883 | /// \returns A 64-bit integer vector containing the difference of the values in |
| 884 | /// the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 885 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 886 | _mm_sub_si64(__m64 __a, __m64 __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 887 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 888 | return (__m64)__builtin_ia32_psubq((__v1di)__a, (__v1di)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 889 | } |
| 890 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 891 | /// \brief Subtracts the corresponding elements of two [2 x i64] vectors. |
| 892 | /// |
| 893 | /// \headerfile <x86intrin.h> |
| 894 | /// |
| 895 | /// This intrinsic corresponds to the \c VPSUBQ / PSUBQ instruction. |
| 896 | /// |
| 897 | /// \param __a |
| 898 | /// A 128-bit integer vector containing the minuends. |
| 899 | /// \param __b |
| 900 | /// A 128-bit integer vector containing the subtrahends. |
| 901 | /// \returns A 128-bit integer vector containing the differences of the values |
| 902 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 903 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 904 | _mm_sub_epi64(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 905 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 906 | return (__m128i)((__v2di)__a - (__v2di)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 907 | } |
| 908 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 909 | /// \brief Subtracts corresponding 8-bit signed integer values in the input and |
| 910 | /// returns the differences in the corresponding bytes in the destination. |
| 911 | /// Differences greater than 7Fh are saturated to 7Fh, and differences less |
| 912 | /// than 80h are saturated to 80h. |
| 913 | /// |
| 914 | /// \headerfile <x86intrin.h> |
| 915 | /// |
| 916 | /// This intrinsic corresponds to the \c VPSUBSB / PSUBSB instruction. |
| 917 | /// |
| 918 | /// \param __a |
| 919 | /// A 128-bit integer vector containing the minuends. |
| 920 | /// \param __b |
| 921 | /// A 128-bit integer vector containing the subtrahends. |
| 922 | /// \returns A 128-bit integer vector containing the differences of the values |
| 923 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 924 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 925 | _mm_subs_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 926 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 927 | return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 928 | } |
| 929 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 930 | /// \brief Subtracts corresponding 16-bit signed integer values in the input and |
| 931 | /// returns the differences in the corresponding bytes in the destination. |
| 932 | /// Differences greater than 7FFFh are saturated to 7FFFh, and values less |
| 933 | /// than 8000h are saturated to 8000h. |
| 934 | /// |
| 935 | /// \headerfile <x86intrin.h> |
| 936 | /// |
| 937 | /// This intrinsic corresponds to the \c VPSUBSW / PSUBSW instruction. |
| 938 | /// |
| 939 | /// \param __a |
| 940 | /// A 128-bit integer vector containing the minuends. |
| 941 | /// \param __b |
| 942 | /// A 128-bit integer vector containing the subtrahends. |
| 943 | /// \returns A 128-bit integer vector containing the differences of the values |
| 944 | /// in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 945 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 946 | _mm_subs_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 947 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 948 | return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 949 | } |
| 950 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 951 | /// \brief Subtracts corresponding 8-bit unsigned integer values in the input |
| 952 | /// and returns the differences in the corresponding bytes in the |
| 953 | /// destination. Differences less than 00h are saturated to 00h. |
| 954 | /// |
| 955 | /// \headerfile <x86intrin.h> |
| 956 | /// |
| 957 | /// This intrinsic corresponds to the \c VPSUBUSB / PSUBUSB instruction. |
| 958 | /// |
| 959 | /// \param __a |
| 960 | /// A 128-bit integer vector containing the minuends. |
| 961 | /// \param __b |
| 962 | /// A 128-bit integer vector containing the subtrahends. |
| 963 | /// \returns A 128-bit integer vector containing the unsigned integer |
| 964 | /// differences of the values in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 965 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 966 | _mm_subs_epu8(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 967 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 968 | return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 969 | } |
| 970 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 971 | /// \brief Subtracts corresponding 16-bit unsigned integer values in the input |
| 972 | /// and returns the differences in the corresponding bytes in the |
| 973 | /// destination. Differences less than 0000h are saturated to 0000h. |
| 974 | /// |
| 975 | /// \headerfile <x86intrin.h> |
| 976 | /// |
| 977 | /// This intrinsic corresponds to the \c VPSUBUSW / PSUBUSW instruction. |
| 978 | /// |
| 979 | /// \param __a |
| 980 | /// A 128-bit integer vector containing the minuends. |
| 981 | /// \param __b |
| 982 | /// A 128-bit integer vector containing the subtrahends. |
| 983 | /// \returns A 128-bit integer vector containing the unsigned integer |
| 984 | /// differences of the values in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 985 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 986 | _mm_subs_epu16(__m128i __a, __m128i __b) |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 987 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 988 | return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | a283f91 | 2008-12-24 02:41:00 +0000 | [diff] [blame] | 989 | } |
| 990 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 991 | /// \brief Performs a bitwise AND of two 128-bit integer vectors. |
| 992 | /// |
| 993 | /// \headerfile <x86intrin.h> |
| 994 | /// |
| 995 | /// This intrinsic corresponds to the \c VPAND / PAND instruction. |
| 996 | /// |
| 997 | /// \param __a |
| 998 | /// A 128-bit integer vector containing one of the source operands. |
| 999 | /// \param __b |
| 1000 | /// A 128-bit integer vector containing one of the source operands. |
| 1001 | /// \returns A 128-bit integer vector containing the bitwise AND of the values |
| 1002 | /// in both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1003 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1004 | _mm_and_si128(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1005 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1006 | return (__m128i)((__v2di)__a & (__v2di)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1007 | } |
| 1008 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1009 | /// \brief Performs a bitwise AND of two 128-bit integer vectors, using the |
| 1010 | /// one's complement of the values contained in the first source operand. |
| 1011 | /// |
| 1012 | /// \headerfile <x86intrin.h> |
| 1013 | /// |
| 1014 | /// This intrinsic corresponds to the \c VPANDN / PANDN instruction. |
| 1015 | /// |
| 1016 | /// \param __a |
| 1017 | /// A 128-bit vector containing the left source operand. The one's complement |
| 1018 | /// of this value is used in the bitwise AND. |
| 1019 | /// \param __b |
| 1020 | /// A 128-bit vector containing the right source operand. |
| 1021 | /// \returns A 128-bit integer vector containing the bitwise AND of the one's |
| 1022 | /// complement of the first operand and the values in the second operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1023 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1024 | _mm_andnot_si128(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1025 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1026 | return (__m128i)(~(__v2di)__a & (__v2di)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1027 | } |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1028 | /// \brief Performs a bitwise OR of two 128-bit integer vectors. |
| 1029 | /// |
| 1030 | /// \headerfile <x86intrin.h> |
| 1031 | /// |
| 1032 | /// This intrinsic corresponds to the \c VPOR / POR instruction. |
| 1033 | /// |
| 1034 | /// \param __a |
| 1035 | /// A 128-bit integer vector containing one of the source operands. |
| 1036 | /// \param __b |
| 1037 | /// A 128-bit integer vector containing one of the source operands. |
| 1038 | /// \returns A 128-bit integer vector containing the bitwise OR of the values |
| 1039 | /// in both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1040 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1041 | _mm_or_si128(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1042 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1043 | return (__m128i)((__v2di)__a | (__v2di)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1044 | } |
| 1045 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1046 | /// \brief Performs a bitwise exclusive OR of two 128-bit integer vectors. |
| 1047 | /// |
| 1048 | /// \headerfile <x86intrin.h> |
| 1049 | /// |
| 1050 | /// This intrinsic corresponds to the \c VPXOR / PXOR instruction. |
| 1051 | /// |
| 1052 | /// \param __a |
| 1053 | /// A 128-bit integer vector containing one of the source operands. |
| 1054 | /// \param __b |
| 1055 | /// A 128-bit integer vector containing one of the source operands. |
| 1056 | /// \returns A 128-bit integer vector containing the bitwise exclusive OR of the |
| 1057 | /// values in both operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1058 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1059 | _mm_xor_si128(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1060 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1061 | return (__m128i)((__v2di)__a ^ (__v2di)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1064 | /// \brief Left-shifts the 128-bit integer vector operand by the specified |
| 1065 | /// number of bytes. Low-order bits are cleared. |
| 1066 | /// |
| 1067 | /// \headerfile <x86intrin.h> |
| 1068 | /// |
| 1069 | /// \code |
| 1070 | /// __m128i _mm_slli_si128(__m128i a, const int imm); |
| 1071 | /// \endcode |
| 1072 | /// |
| 1073 | /// This intrinsic corresponds to the \c VPSLLDQ / PSLLDQ instruction. |
| 1074 | /// |
| 1075 | /// \param a |
| 1076 | /// A 128-bit integer vector containing the source operand. |
| 1077 | /// \param imm |
| 1078 | /// An immediate value specifying the number of bytes to left-shift |
| 1079 | /// operand a. |
| 1080 | /// \returns A 128-bit integer vector containing the left-shifted value. |
Craig Topper | 51e4741 | 2015-02-13 06:04:43 +0000 | [diff] [blame] | 1081 | #define _mm_slli_si128(a, imm) __extension__ ({ \ |
| 1082 | (__m128i)__builtin_shufflevector((__v16qi)_mm_setzero_si128(), \ |
| 1083 | (__v16qi)(__m128i)(a), \ |
| 1084 | ((imm)&0xF0) ? 0 : 16 - ((imm)&0xF), \ |
| 1085 | ((imm)&0xF0) ? 0 : 17 - ((imm)&0xF), \ |
| 1086 | ((imm)&0xF0) ? 0 : 18 - ((imm)&0xF), \ |
| 1087 | ((imm)&0xF0) ? 0 : 19 - ((imm)&0xF), \ |
| 1088 | ((imm)&0xF0) ? 0 : 20 - ((imm)&0xF), \ |
| 1089 | ((imm)&0xF0) ? 0 : 21 - ((imm)&0xF), \ |
| 1090 | ((imm)&0xF0) ? 0 : 22 - ((imm)&0xF), \ |
| 1091 | ((imm)&0xF0) ? 0 : 23 - ((imm)&0xF), \ |
| 1092 | ((imm)&0xF0) ? 0 : 24 - ((imm)&0xF), \ |
| 1093 | ((imm)&0xF0) ? 0 : 25 - ((imm)&0xF), \ |
| 1094 | ((imm)&0xF0) ? 0 : 26 - ((imm)&0xF), \ |
| 1095 | ((imm)&0xF0) ? 0 : 27 - ((imm)&0xF), \ |
| 1096 | ((imm)&0xF0) ? 0 : 28 - ((imm)&0xF), \ |
| 1097 | ((imm)&0xF0) ? 0 : 29 - ((imm)&0xF), \ |
| 1098 | ((imm)&0xF0) ? 0 : 30 - ((imm)&0xF), \ |
| 1099 | ((imm)&0xF0) ? 0 : 31 - ((imm)&0xF)); }) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1100 | |
Craig Topper | a462482 | 2015-02-13 06:04:45 +0000 | [diff] [blame] | 1101 | #define _mm_bslli_si128(a, imm) \ |
| 1102 | _mm_slli_si128((a), (imm)) |
| 1103 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1104 | /// \brief Left-shifts each 16-bit value in the 128-bit integer vector operand |
| 1105 | /// by the specified number of bits. Low-order bits are cleared. |
| 1106 | /// |
| 1107 | /// \headerfile <x86intrin.h> |
| 1108 | /// |
| 1109 | /// This intrinsic corresponds to the \c VPSLLW / PSLLW instruction. |
| 1110 | /// |
| 1111 | /// \param __a |
| 1112 | /// A 128-bit integer vector containing the source operand. |
| 1113 | /// \param __count |
| 1114 | /// An integer value specifying the number of bits to left-shift each value |
| 1115 | /// in operand __a. |
| 1116 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1117 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1118 | _mm_slli_epi16(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1119 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1120 | return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1121 | } |
| 1122 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1123 | /// \brief Left-shifts each 16-bit value in the 128-bit integer vector operand |
| 1124 | /// by the specified number of bits. Low-order bits are cleared. |
| 1125 | /// |
| 1126 | /// \headerfile <x86intrin.h> |
| 1127 | /// |
| 1128 | /// This intrinsic corresponds to the \c VPSLLW / PSLLW instruction. |
| 1129 | /// |
| 1130 | /// \param __a |
| 1131 | /// A 128-bit integer vector containing the source operand. |
| 1132 | /// \param __count |
| 1133 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1134 | /// to left-shift each value in operand __a. |
| 1135 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1136 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1137 | _mm_sll_epi16(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1138 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1139 | return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1140 | } |
| 1141 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1142 | /// \brief Left-shifts each 32-bit value in the 128-bit integer vector operand |
| 1143 | /// by the specified number of bits. Low-order bits are cleared. |
| 1144 | /// |
| 1145 | /// \headerfile <x86intrin.h> |
| 1146 | /// |
| 1147 | /// This intrinsic corresponds to the \c VPSLLD / PSLLD instruction. |
| 1148 | /// |
| 1149 | /// \param __a |
| 1150 | /// A 128-bit integer vector containing the source operand. |
| 1151 | /// \param __count |
| 1152 | /// An integer value specifying the number of bits to left-shift each value |
| 1153 | /// in operand __a. |
| 1154 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1155 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1156 | _mm_slli_epi32(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1157 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1158 | return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1159 | } |
| 1160 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1161 | /// \brief Left-shifts each 32-bit value in the 128-bit integer vector operand |
| 1162 | /// by the specified number of bits. Low-order bits are cleared. |
| 1163 | /// |
| 1164 | /// \headerfile <x86intrin.h> |
| 1165 | /// |
| 1166 | /// This intrinsic corresponds to the \c VPSLLD / PSLLD instruction. |
| 1167 | /// |
| 1168 | /// \param __a |
| 1169 | /// A 128-bit integer vector containing the source operand. |
| 1170 | /// \param __count |
| 1171 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1172 | /// to left-shift each value in operand __a. |
| 1173 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1174 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1175 | _mm_sll_epi32(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1176 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1177 | return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1178 | } |
| 1179 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1180 | /// \brief Left-shifts each 64-bit value in the 128-bit integer vector operand |
| 1181 | /// by the specified number of bits. Low-order bits are cleared. |
| 1182 | /// |
| 1183 | /// \headerfile <x86intrin.h> |
| 1184 | /// |
| 1185 | /// This intrinsic corresponds to the \c VPSLLQ / PSLLQ instruction. |
| 1186 | /// |
| 1187 | /// \param __a |
| 1188 | /// A 128-bit integer vector containing the source operand. |
| 1189 | /// \param __count |
| 1190 | /// An integer value specifying the number of bits to left-shift each value |
| 1191 | /// in operand __a. |
| 1192 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1193 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1194 | _mm_slli_epi64(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1195 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1196 | return __builtin_ia32_psllqi128((__v2di)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1197 | } |
| 1198 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1199 | /// \brief Left-shifts each 64-bit value in the 128-bit integer vector operand |
| 1200 | /// by the specified number of bits. Low-order bits are cleared. |
| 1201 | /// |
| 1202 | /// \headerfile <x86intrin.h> |
| 1203 | /// |
| 1204 | /// This intrinsic corresponds to the \c VPSLLQ / PSLLQ instruction. |
| 1205 | /// |
| 1206 | /// \param __a |
| 1207 | /// A 128-bit integer vector containing the source operand. |
| 1208 | /// \param __count |
| 1209 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1210 | /// to left-shift each value in operand __a. |
| 1211 | /// \returns A 128-bit integer vector containing the left-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1212 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1213 | _mm_sll_epi64(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1214 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1215 | return __builtin_ia32_psllq128((__v2di)__a, (__v2di)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1216 | } |
| 1217 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1218 | /// \brief Right-shifts each 16-bit value in the 128-bit integer vector operand |
| 1219 | /// by the specified number of bits. High-order bits are filled with the sign |
| 1220 | /// bit of the initial value. |
| 1221 | /// |
| 1222 | /// \headerfile <x86intrin.h> |
| 1223 | /// |
| 1224 | /// This intrinsic corresponds to the \c VPSRAW / PSRAW instruction. |
| 1225 | /// |
| 1226 | /// \param __a |
| 1227 | /// A 128-bit integer vector containing the source operand. |
| 1228 | /// \param __count |
| 1229 | /// An integer value specifying the number of bits to right-shift each value |
| 1230 | /// in operand __a. |
| 1231 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1232 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1233 | _mm_srai_epi16(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1234 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1235 | return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1236 | } |
| 1237 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1238 | /// \brief Right-shifts each 16-bit value in the 128-bit integer vector operand |
| 1239 | /// by the specified number of bits. High-order bits are filled with the sign |
| 1240 | /// bit of the initial value. |
| 1241 | /// |
| 1242 | /// \headerfile <x86intrin.h> |
| 1243 | /// |
| 1244 | /// This intrinsic corresponds to the \c VPSRAW / PSRAW instruction. |
| 1245 | /// |
| 1246 | /// \param __a |
| 1247 | /// A 128-bit integer vector containing the source operand. |
| 1248 | /// \param __count |
| 1249 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1250 | /// to right-shift each value in operand __a. |
| 1251 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1252 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1253 | _mm_sra_epi16(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1254 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1255 | return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1256 | } |
| 1257 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1258 | /// \brief Right-shifts each 32-bit value in the 128-bit integer vector operand |
| 1259 | /// by the specified number of bits. High-order bits are filled with the sign |
| 1260 | /// bit of the initial value. |
| 1261 | /// |
| 1262 | /// \headerfile <x86intrin.h> |
| 1263 | /// |
| 1264 | /// This intrinsic corresponds to the \c VPSRAD / PSRAD instruction. |
| 1265 | /// |
| 1266 | /// \param __a |
| 1267 | /// A 128-bit integer vector containing the source operand. |
| 1268 | /// \param __count |
| 1269 | /// An integer value specifying the number of bits to right-shift each value |
| 1270 | /// in operand __a. |
| 1271 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1272 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1273 | _mm_srai_epi32(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1274 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1275 | return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1276 | } |
| 1277 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1278 | /// \brief Right-shifts each 32-bit value in the 128-bit integer vector operand |
| 1279 | /// by the specified number of bits. High-order bits are filled with the sign |
| 1280 | /// bit of the initial value. |
| 1281 | /// |
| 1282 | /// \headerfile <x86intrin.h> |
| 1283 | /// |
| 1284 | /// This intrinsic corresponds to the \c VPSRAD / PSRAD instruction. |
| 1285 | /// |
| 1286 | /// \param __a |
| 1287 | /// A 128-bit integer vector containing the source operand. |
| 1288 | /// \param __count |
| 1289 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1290 | /// to right-shift each value in operand __a. |
| 1291 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1292 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1293 | _mm_sra_epi32(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1294 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1295 | return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1296 | } |
| 1297 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1298 | /// \brief Right-shifts the 128-bit integer vector operand by the specified |
| 1299 | /// number of bytes. High-order bits are cleared. |
| 1300 | /// |
| 1301 | /// \headerfile <x86intrin.h> |
| 1302 | /// |
| 1303 | /// \code |
| 1304 | /// __m128i _mm_srli_si128(__m128i a, const int imm); |
| 1305 | /// \endcode |
| 1306 | /// |
| 1307 | /// This intrinsic corresponds to the \c VPSRLDQ / PSRLDQ instruction. |
| 1308 | /// |
| 1309 | /// \param a |
| 1310 | /// A 128-bit integer vector containing the source operand. |
| 1311 | /// \param imm |
| 1312 | /// An immediate value specifying the number of bytes to right-shift operand |
| 1313 | /// a. |
| 1314 | /// \returns A 128-bit integer vector containing the right-shifted value. |
Craig Topper | 51e4741 | 2015-02-13 06:04:43 +0000 | [diff] [blame] | 1315 | #define _mm_srli_si128(a, imm) __extension__ ({ \ |
| 1316 | (__m128i)__builtin_shufflevector((__v16qi)(__m128i)(a), \ |
| 1317 | (__v16qi)_mm_setzero_si128(), \ |
| 1318 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 0, \ |
| 1319 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 1, \ |
| 1320 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 2, \ |
| 1321 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 3, \ |
| 1322 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 4, \ |
| 1323 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 5, \ |
| 1324 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 6, \ |
| 1325 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 7, \ |
| 1326 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 8, \ |
| 1327 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 9, \ |
| 1328 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 10, \ |
| 1329 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 11, \ |
| 1330 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 12, \ |
| 1331 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 13, \ |
| 1332 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 14, \ |
| 1333 | ((imm)&0xF0) ? 16 : ((imm)&0xF) + 15); }) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1334 | |
Craig Topper | a462482 | 2015-02-13 06:04:45 +0000 | [diff] [blame] | 1335 | #define _mm_bsrli_si128(a, imm) \ |
| 1336 | _mm_srli_si128((a), (imm)) |
| 1337 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1338 | /// \brief Right-shifts each of 16-bit values in the 128-bit integer vector |
| 1339 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1340 | /// |
| 1341 | /// \headerfile <x86intrin.h> |
| 1342 | /// |
| 1343 | /// This intrinsic corresponds to the \c VPSRLW / PSRLW instruction. |
| 1344 | /// |
| 1345 | /// \param __a |
| 1346 | /// A 128-bit integer vector containing the source operand. |
| 1347 | /// \param __count |
| 1348 | /// An integer value specifying the number of bits to right-shift each value |
| 1349 | /// in operand __a. |
| 1350 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1351 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1352 | _mm_srli_epi16(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1353 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1354 | return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1355 | } |
| 1356 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1357 | /// \brief Right-shifts each of 16-bit values in the 128-bit integer vector |
| 1358 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1359 | /// |
| 1360 | /// \headerfile <x86intrin.h> |
| 1361 | /// |
| 1362 | /// This intrinsic corresponds to the \c VPSRLW / PSRLW instruction. |
| 1363 | /// |
| 1364 | /// \param __a |
| 1365 | /// A 128-bit integer vector containing the source operand. |
| 1366 | /// \param __count |
| 1367 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1368 | /// to right-shift each value in operand __a. |
| 1369 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1370 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1371 | _mm_srl_epi16(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1372 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1373 | return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1374 | } |
| 1375 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1376 | /// \brief Right-shifts each of 32-bit values in the 128-bit integer vector |
| 1377 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1378 | /// |
| 1379 | /// \headerfile <x86intrin.h> |
| 1380 | /// |
| 1381 | /// This intrinsic corresponds to the \c VPSRLD / PSRLD instruction. |
| 1382 | /// |
| 1383 | /// \param __a |
| 1384 | /// A 128-bit integer vector containing the source operand. |
| 1385 | /// \param __count |
| 1386 | /// An integer value specifying the number of bits to right-shift each value |
| 1387 | /// in operand __a. |
| 1388 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1389 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1390 | _mm_srli_epi32(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1391 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1392 | return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1393 | } |
| 1394 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1395 | /// \brief Right-shifts each of 32-bit values in the 128-bit integer vector |
| 1396 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1397 | /// |
| 1398 | /// \headerfile <x86intrin.h> |
| 1399 | /// |
| 1400 | /// This intrinsic corresponds to the \c VPSRLD / PSRLD instruction. |
| 1401 | /// |
| 1402 | /// \param __a |
| 1403 | /// A 128-bit integer vector containing the source operand. |
| 1404 | /// \param __count |
| 1405 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1406 | /// to right-shift each value in operand __a. |
| 1407 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1408 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1409 | _mm_srl_epi32(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1410 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1411 | return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1412 | } |
| 1413 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1414 | /// \brief Right-shifts each of 64-bit values in the 128-bit integer vector |
| 1415 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1416 | /// |
| 1417 | /// \headerfile <x86intrin.h> |
| 1418 | /// |
| 1419 | /// This intrinsic corresponds to the \c VPSRLQ / PSRLQ instruction. |
| 1420 | /// |
| 1421 | /// \param __a |
| 1422 | /// A 128-bit integer vector containing the source operand. |
| 1423 | /// \param __count |
| 1424 | /// An integer value specifying the number of bits to right-shift each value |
| 1425 | /// in operand __a. |
| 1426 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1427 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1428 | _mm_srli_epi64(__m128i __a, int __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1429 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1430 | return __builtin_ia32_psrlqi128((__v2di)__a, __count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1431 | } |
| 1432 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1433 | /// \brief Right-shifts each of 64-bit values in the 128-bit integer vector |
| 1434 | /// operand by the specified number of bits. High-order bits are cleared. |
| 1435 | /// |
| 1436 | /// \headerfile <x86intrin.h> |
| 1437 | /// |
| 1438 | /// This intrinsic corresponds to the \c VPSRLQ / PSRLQ instruction. |
| 1439 | /// |
| 1440 | /// \param __a |
| 1441 | /// A 128-bit integer vector containing the source operand. |
| 1442 | /// \param __count |
| 1443 | /// A 128-bit integer vector in which bits [63:0] specify the number of bits |
| 1444 | /// to right-shift each value in operand __a. |
| 1445 | /// \returns A 128-bit integer vector containing the right-shifted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1446 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1447 | _mm_srl_epi64(__m128i __a, __m128i __count) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1448 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1449 | return __builtin_ia32_psrlq128((__v2di)__a, (__v2di)__count); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1450 | } |
| 1451 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1452 | /// \brief Compares each of the corresponding 8-bit values of the 128-bit |
| 1453 | /// integer vectors for equality. Each comparison yields 0h for false, FFh |
| 1454 | /// for true. |
| 1455 | /// |
| 1456 | /// \headerfile <x86intrin.h> |
| 1457 | /// |
| 1458 | /// This intrinsic corresponds to the \c VPCMPEQB / PCMPEQB instruction. |
| 1459 | /// |
| 1460 | /// \param __a |
| 1461 | /// A 128-bit integer vector. |
| 1462 | /// \param __b |
| 1463 | /// A 128-bit integer vector. |
| 1464 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1465 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1466 | _mm_cmpeq_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1467 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1468 | return (__m128i)((__v16qi)__a == (__v16qi)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1469 | } |
| 1470 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1471 | /// \brief Compares each of the corresponding 16-bit values of the 128-bit |
| 1472 | /// integer vectors for equality. Each comparison yields 0h for false, FFFFh |
| 1473 | /// for true. |
| 1474 | /// |
| 1475 | /// \headerfile <x86intrin.h> |
| 1476 | /// |
| 1477 | /// This intrinsic corresponds to the \c VPCMPEQW / PCMPEQW instruction. |
| 1478 | /// |
| 1479 | /// \param __a |
| 1480 | /// A 128-bit integer vector. |
| 1481 | /// \param __b |
| 1482 | /// A 128-bit integer vector. |
| 1483 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1484 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1485 | _mm_cmpeq_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1486 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1487 | return (__m128i)((__v8hi)__a == (__v8hi)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1488 | } |
| 1489 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1490 | /// \brief Compares each of the corresponding 32-bit values of the 128-bit |
| 1491 | /// integer vectors for equality. Each comparison yields 0h for false, |
| 1492 | /// FFFFFFFFh for true. |
| 1493 | /// |
| 1494 | /// \headerfile <x86intrin.h> |
| 1495 | /// |
| 1496 | /// This intrinsic corresponds to the \c VPCMPEQD / PCMPEQD instruction. |
| 1497 | /// |
| 1498 | /// \param __a |
| 1499 | /// A 128-bit integer vector. |
| 1500 | /// \param __b |
| 1501 | /// A 128-bit integer vector. |
| 1502 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1503 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1504 | _mm_cmpeq_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1505 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1506 | return (__m128i)((__v4si)__a == (__v4si)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1507 | } |
| 1508 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1509 | /// \brief Compares each of the corresponding signed 8-bit values of the 128-bit |
| 1510 | /// integer vectors to determine if the values in the first operand are |
| 1511 | /// greater than those in the second operand. Each comparison yields 0h for |
| 1512 | /// false, FFh for true. |
| 1513 | /// |
| 1514 | /// \headerfile <x86intrin.h> |
| 1515 | /// |
| 1516 | /// This intrinsic corresponds to the \c VPCMPGTB / PCMPGTB instruction. |
| 1517 | /// |
| 1518 | /// \param __a |
| 1519 | /// A 128-bit integer vector. |
| 1520 | /// \param __b |
| 1521 | /// A 128-bit integer vector. |
| 1522 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1523 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1524 | _mm_cmpgt_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1525 | { |
Nick Lewycky | d0ba379 | 2012-02-04 02:16:48 +0000 | [diff] [blame] | 1526 | /* This function always performs a signed comparison, but __v16qi is a char |
Chandler Carruth | cbe6411 | 2015-10-01 23:40:12 +0000 | [diff] [blame] | 1527 | which may be signed or unsigned, so use __v16qs. */ |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1528 | return (__m128i)((__v16qs)__a > (__v16qs)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1529 | } |
| 1530 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1531 | /// \brief Compares each of the corresponding signed 16-bit values of the |
| 1532 | /// 128-bit integer vectors to determine if the values in the first operand |
| 1533 | /// are greater than those in the second operand. Each comparison yields 0h |
| 1534 | /// for false, FFFFh for true. |
| 1535 | /// |
| 1536 | /// \headerfile <x86intrin.h> |
| 1537 | /// |
| 1538 | /// This intrinsic corresponds to the \c VPCMPGTW / PCMPGTW instruction. |
| 1539 | /// |
| 1540 | /// \param __a |
| 1541 | /// A 128-bit integer vector. |
| 1542 | /// \param __b |
| 1543 | /// A 128-bit integer vector. |
| 1544 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1545 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1546 | _mm_cmpgt_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1547 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1548 | return (__m128i)((__v8hi)__a > (__v8hi)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1549 | } |
| 1550 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1551 | /// \brief Compares each of the corresponding signed 32-bit values of the |
| 1552 | /// 128-bit integer vectors to determine if the values in the first operand |
| 1553 | /// are greater than those in the second operand. Each comparison yields 0h |
| 1554 | /// for false, FFFFFFFFh for true. |
| 1555 | /// |
| 1556 | /// \headerfile <x86intrin.h> |
| 1557 | /// |
| 1558 | /// This intrinsic corresponds to the \c VPCMPGTD / PCMPGTD instruction. |
| 1559 | /// |
| 1560 | /// \param __a |
| 1561 | /// A 128-bit integer vector. |
| 1562 | /// \param __b |
| 1563 | /// A 128-bit integer vector. |
| 1564 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1565 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1566 | _mm_cmpgt_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1567 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1568 | return (__m128i)((__v4si)__a > (__v4si)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1569 | } |
| 1570 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1571 | /// \brief Compares each of the corresponding signed 8-bit values of the 128-bit |
| 1572 | /// integer vectors to determine if the values in the first operand are less |
| 1573 | /// than those in the second operand. Each comparison yields 0h for false, |
| 1574 | /// FFh for true. |
| 1575 | /// |
| 1576 | /// \headerfile <x86intrin.h> |
| 1577 | /// |
| 1578 | /// This intrinsic corresponds to the \c VPCMPGTB / PCMPGTB instruction. |
| 1579 | /// |
| 1580 | /// \param __a |
| 1581 | /// A 128-bit integer vector. |
| 1582 | /// \param __b |
| 1583 | /// A 128-bit integer vector. |
| 1584 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1585 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1586 | _mm_cmplt_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1587 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1588 | return _mm_cmpgt_epi8(__b, __a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1589 | } |
| 1590 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1591 | /// \brief Compares each of the corresponding signed 16-bit values of the |
| 1592 | /// 128-bit integer vectors to determine if the values in the first operand |
| 1593 | /// are less than those in the second operand. Each comparison yields 0h for |
| 1594 | /// false, FFFFh for true. |
| 1595 | /// |
| 1596 | /// \headerfile <x86intrin.h> |
| 1597 | /// |
| 1598 | /// This intrinsic corresponds to the \c VPCMPGTW / PCMPGTW instruction. |
| 1599 | /// |
| 1600 | /// \param __a |
| 1601 | /// A 128-bit integer vector. |
| 1602 | /// \param __b |
| 1603 | /// A 128-bit integer vector. |
| 1604 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1605 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1606 | _mm_cmplt_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1607 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1608 | return _mm_cmpgt_epi16(__b, __a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1609 | } |
| 1610 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1611 | /// \brief Compares each of the corresponding signed 32-bit values of the |
| 1612 | /// 128-bit integer vectors to determine if the values in the first operand |
| 1613 | /// are less than those in the second operand. Each comparison yields 0h for |
| 1614 | /// false, FFFFFFFFh for true. |
| 1615 | /// |
| 1616 | /// \headerfile <x86intrin.h> |
| 1617 | /// |
| 1618 | /// This intrinsic corresponds to the \c VPCMPGTD / PCMPGTD instruction. |
| 1619 | /// |
| 1620 | /// \param __a |
| 1621 | /// A 128-bit integer vector. |
| 1622 | /// \param __b |
| 1623 | /// A 128-bit integer vector. |
| 1624 | /// \returns A 128-bit integer vector containing the comparison results. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1625 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1626 | _mm_cmplt_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1627 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1628 | return _mm_cmpgt_epi32(__b, __a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1629 | } |
| 1630 | |
| 1631 | #ifdef __x86_64__ |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1632 | /// \brief Converts a 64-bit signed integer value from the second operand into a |
| 1633 | /// double-precision value and returns it in the lower element of a [2 x |
| 1634 | /// double] vector; the upper element of the returned vector is copied from |
| 1635 | /// the upper element of the first operand. |
| 1636 | /// |
| 1637 | /// \headerfile <x86intrin.h> |
| 1638 | /// |
| 1639 | /// This intrinsic corresponds to the \c VCVTSI2SD / CVTSI2SD instruction. |
| 1640 | /// |
| 1641 | /// \param __a |
| 1642 | /// A 128-bit vector of [2 x double]. The upper 64 bits of this operand are |
| 1643 | /// copied to the upper 64 bits of the destination. |
| 1644 | /// \param __b |
| 1645 | /// A 64-bit signed integer operand containing the value to be converted. |
| 1646 | /// \returns A 128-bit vector of [2 x double] whose lower 64 bits contain the |
| 1647 | /// converted value of the second operand. The upper 64 bits are copied from |
| 1648 | /// the upper 64 bits of the first operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1649 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1650 | _mm_cvtsi64_sd(__m128d __a, long long __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1651 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1652 | __a[0] = __b; |
| 1653 | return __a; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1654 | } |
| 1655 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1656 | /// \brief Converts the first (lower) element of a vector of [2 x double] into a |
| 1657 | /// 64-bit signed integer value, according to the current rounding mode. |
| 1658 | /// |
| 1659 | /// \headerfile <x86intrin.h> |
| 1660 | /// |
| 1661 | /// This intrinsic corresponds to the \c VCVTSD2SI / CVTSD2SI instruction. |
| 1662 | /// |
| 1663 | /// \param __a |
| 1664 | /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the |
| 1665 | /// conversion. |
| 1666 | /// \returns A 64-bit signed integer containing the converted value. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1667 | static __inline__ long long __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1668 | _mm_cvtsd_si64(__m128d __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1669 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1670 | return __builtin_ia32_cvtsd2si64((__v2df)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1671 | } |
| 1672 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1673 | /// \brief Converts the first (lower) element of a vector of [2 x double] into a |
| 1674 | /// 64-bit signed integer value, truncating the result when it is inexact. |
| 1675 | /// |
| 1676 | /// \headerfile <x86intrin.h> |
| 1677 | /// |
| 1678 | /// This intrinsic corresponds to the \c VCVTTSD2SI / CVTTSD2SI instruction. |
| 1679 | /// |
| 1680 | /// \param __a |
| 1681 | /// A 128-bit vector of [2 x double]. The lower 64 bits are used in the |
| 1682 | /// conversion. |
| 1683 | /// \returns A 64-bit signed integer containing the converted value. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1684 | static __inline__ long long __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1685 | _mm_cvttsd_si64(__m128d __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1686 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1687 | return __a[0]; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1688 | } |
| 1689 | #endif |
| 1690 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1691 | /// \brief Converts a vector of [4 x i32] into a vector of [4 x float]. |
| 1692 | /// |
| 1693 | /// \headerfile <x86intrin.h> |
| 1694 | /// |
| 1695 | /// This intrinsic corresponds to the \c VCVTDQ2PS / CVTDQ2PS instruction. |
| 1696 | /// |
| 1697 | /// \param __a |
| 1698 | /// A 128-bit integer vector. |
| 1699 | /// \returns A 128-bit vector of [4 x float] containing the converted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1700 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1701 | _mm_cvtepi32_ps(__m128i __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1702 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1703 | return __builtin_ia32_cvtdq2ps((__v4si)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1704 | } |
| 1705 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1706 | /// \brief Converts a vector of [4 x float] into a vector of [4 x i32]. |
| 1707 | /// |
| 1708 | /// \headerfile <x86intrin.h> |
| 1709 | /// |
| 1710 | /// This intrinsic corresponds to the \c VCVTPS2DQ / CVTPS2DQ instruction. |
| 1711 | /// |
| 1712 | /// \param __a |
| 1713 | /// A 128-bit vector of [4 x float]. |
| 1714 | /// \returns A 128-bit integer vector of [4 x i32] containing the converted |
| 1715 | /// values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1716 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1717 | _mm_cvtps_epi32(__m128 __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1718 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1719 | return (__m128i)__builtin_ia32_cvtps2dq((__v4sf)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1720 | } |
| 1721 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1722 | /// \brief Converts a vector of [4 x float] into a vector of [4 x i32], |
| 1723 | /// truncating the result when it is inexact. |
| 1724 | /// |
| 1725 | /// \headerfile <x86intrin.h> |
| 1726 | /// |
| 1727 | /// This intrinsic corresponds to the \c VCVTTPS2DQ / CVTTPS2DQ instruction. |
| 1728 | /// |
| 1729 | /// \param __a |
| 1730 | /// A 128-bit vector of [4 x float]. |
| 1731 | /// \returns A 128-bit vector of [4 x i32] containing the converted values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1732 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1733 | _mm_cvttps_epi32(__m128 __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1734 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 1735 | return (__m128i)__builtin_ia32_cvttps2dq((__v4sf)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1736 | } |
| 1737 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1738 | /// \brief Returns a vector of [4 x i32] where the lowest element is the input |
| 1739 | /// operand and the remaining elements are zero. |
| 1740 | /// |
| 1741 | /// \headerfile <x86intrin.h> |
| 1742 | /// |
| 1743 | /// This intrinsic corresponds to the \c VMOVD / MOVD instruction. |
| 1744 | /// |
| 1745 | /// \param __a |
| 1746 | /// A 32-bit signed integer operand. |
| 1747 | /// \returns A 128-bit vector of [4 x i32]. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1748 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1749 | _mm_cvtsi32_si128(int __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1750 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1751 | return (__m128i)(__v4si){ __a, 0, 0, 0 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1752 | } |
| 1753 | |
| 1754 | #ifdef __x86_64__ |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1755 | /// \brief Returns a vector of [2 x i64] where the lower element is the input |
| 1756 | /// operand and the upper element is zero. |
| 1757 | /// |
| 1758 | /// \headerfile <x86intrin.h> |
| 1759 | /// |
| 1760 | /// This intrinsic corresponds to the \c VMOVQ / MOVQ instruction. |
| 1761 | /// |
| 1762 | /// \param __a |
| 1763 | /// A 64-bit signed integer operand containing the value to be converted. |
| 1764 | /// \returns A 128-bit vector of [2 x i64] containing the converted value. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1765 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1766 | _mm_cvtsi64_si128(long long __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1767 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1768 | return (__m128i){ __a, 0 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1769 | } |
| 1770 | #endif |
| 1771 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1772 | /// \brief Moves the least significant 32 bits of a vector of [4 x i32] to a |
| 1773 | /// 32-bit signed integer value. |
| 1774 | /// |
| 1775 | /// \headerfile <x86intrin.h> |
| 1776 | /// |
| 1777 | /// This intrinsic corresponds to the \c VMOVD / MOVD instruction. |
| 1778 | /// |
| 1779 | /// \param __a |
| 1780 | /// A vector of [4 x i32]. The least significant 32 bits are moved to the |
| 1781 | /// destination. |
| 1782 | /// \returns A 32-bit signed integer containing the moved value. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1783 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1784 | _mm_cvtsi128_si32(__m128i __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1785 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1786 | __v4si __b = (__v4si)__a; |
| 1787 | return __b[0]; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1788 | } |
| 1789 | |
| 1790 | #ifdef __x86_64__ |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1791 | /// \brief Moves the least significant 64 bits of a vector of [2 x i64] to a |
| 1792 | /// 64-bit signed integer value. |
| 1793 | /// |
| 1794 | /// \headerfile <x86intrin.h> |
| 1795 | /// |
| 1796 | /// This intrinsic corresponds to the \c VMOVQ / MOVQ instruction. |
| 1797 | /// |
| 1798 | /// \param __a |
| 1799 | /// A vector of [2 x i64]. The least significant 64 bits are moved to the |
| 1800 | /// destination. |
| 1801 | /// \returns A 64-bit signed integer containing the moved value. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1802 | static __inline__ long long __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1803 | _mm_cvtsi128_si64(__m128i __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1804 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1805 | return __a[0]; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1806 | } |
| 1807 | #endif |
| 1808 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1809 | /// \brief Moves packed integer values from an aligned 128-bit memory location |
| 1810 | /// to elements in a 128-bit integer vector. |
| 1811 | /// |
| 1812 | /// \headerfile <x86intrin.h> |
| 1813 | /// |
| 1814 | /// This intrinsic corresponds to the \c VMOVDQA / MOVDQA instruction. |
| 1815 | /// |
| 1816 | /// \param __p |
| 1817 | /// An aligned pointer to a memory location containing integer values. |
| 1818 | /// \returns A 128-bit integer vector containing the moved values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1819 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1820 | _mm_load_si128(__m128i const *__p) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1821 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1822 | return *__p; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1823 | } |
| 1824 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1825 | /// \brief Moves packed integer values from an unaligned 128-bit memory location |
| 1826 | /// to elements in a 128-bit integer vector. |
| 1827 | /// |
| 1828 | /// \headerfile <x86intrin.h> |
| 1829 | /// |
| 1830 | /// This intrinsic corresponds to the \c VMOVDQU / MOVDQU instruction. |
| 1831 | /// |
| 1832 | /// \param __p |
| 1833 | /// A pointer to a memory location containing integer values. |
| 1834 | /// \returns A 128-bit integer vector containing the moved values. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1835 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1836 | _mm_loadu_si128(__m128i const *__p) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1837 | { |
Bill Wendling | 502931f | 2011-05-13 00:11:39 +0000 | [diff] [blame] | 1838 | struct __loadu_si128 { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1839 | __m128i __v; |
David Majnemer | 1cf22e6 | 2015-02-04 00:26:10 +0000 | [diff] [blame] | 1840 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1841 | return ((struct __loadu_si128*)__p)->__v; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1842 | } |
| 1843 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1844 | /// \brief Returns a vector of [2 x i64] where the lower element is taken from |
| 1845 | /// the lower element of the operand, and the upper element is zero. |
| 1846 | /// |
| 1847 | /// \headerfile <x86intrin.h> |
| 1848 | /// |
| 1849 | /// This intrinsic corresponds to the \c VMOVQ / MOVQ instruction. |
| 1850 | /// |
| 1851 | /// \param __p |
| 1852 | /// A 128-bit vector of [2 x i64]. Bits [63:0] are written to bits [63:0] of |
| 1853 | /// the destination. |
| 1854 | /// \returns A 128-bit vector of [2 x i64]. The lower order bits contain the |
| 1855 | /// moved value. The higher order bits are cleared. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1856 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1857 | _mm_loadl_epi64(__m128i const *__p) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1858 | { |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 1859 | struct __mm_loadl_epi64_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1860 | long long __u; |
Eli Friedman | 9bb51ad | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 1861 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 1862 | return (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0}; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1863 | } |
| 1864 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1865 | /// \brief Generates a 128-bit vector of [4 x i32] with unspecified content. |
| 1866 | /// This could be used as an argument to another intrinsic function where the |
| 1867 | /// argument is required but the value is not actually used. |
| 1868 | /// |
| 1869 | /// \headerfile <x86intrin.h> |
| 1870 | /// |
| 1871 | /// This intrinsic has no corresponding instruction. |
| 1872 | /// |
| 1873 | /// \returns A 128-bit vector of [4 x i32] with unspecified content. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1874 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Simon Pilgrim | 5aba992 | 2015-08-26 21:17:12 +0000 | [diff] [blame] | 1875 | _mm_undefined_si128() |
| 1876 | { |
| 1877 | return (__m128i)__builtin_ia32_undef128(); |
| 1878 | } |
| 1879 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1880 | /// \brief Initializes both 64-bit values in a 128-bit vector of [2 x i64] with |
| 1881 | /// the specified 64-bit integer values. |
| 1882 | /// |
| 1883 | /// \headerfile <x86intrin.h> |
| 1884 | /// |
| 1885 | /// This intrinsic is a utility function and does not correspond to a specific |
| 1886 | /// instruction. |
| 1887 | /// |
| 1888 | /// \param __q1 |
| 1889 | /// A 64-bit integer value used to initialize the upper 64 bits of the |
| 1890 | /// destination vector of [2 x i64]. |
| 1891 | /// \param __q0 |
| 1892 | /// A 64-bit integer value used to initialize the lower 64 bits of the |
| 1893 | /// destination vector of [2 x i64]. |
| 1894 | /// \returns An initialized 128-bit vector of [2 x i64] containing the values |
| 1895 | /// provided in the operands. |
Simon Pilgrim | 5aba992 | 2015-08-26 21:17:12 +0000 | [diff] [blame] | 1896 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1897 | _mm_set_epi64x(long long __q1, long long __q0) |
Anders Carlsson | dfa3117 | 2009-09-18 17:03:55 +0000 | [diff] [blame] | 1898 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1899 | return (__m128i){ __q0, __q1 }; |
Anders Carlsson | dfa3117 | 2009-09-18 17:03:55 +0000 | [diff] [blame] | 1900 | } |
| 1901 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1902 | /// \brief Initializes both 64-bit values in a 128-bit vector of [2 x i64] with |
| 1903 | /// the specified 64-bit integer values. |
| 1904 | /// |
| 1905 | /// \headerfile <x86intrin.h> |
| 1906 | /// |
| 1907 | /// This intrinsic is a utility function and does not correspond to a specific |
| 1908 | /// instruction. |
| 1909 | /// |
| 1910 | /// \param __q1 |
| 1911 | /// A 64-bit integer value used to initialize the upper 64 bits of the |
| 1912 | /// destination vector of [2 x i64]. |
| 1913 | /// \param __q0 |
| 1914 | /// A 64-bit integer value used to initialize the lower 64 bits of the |
| 1915 | /// destination vector of [2 x i64]. |
| 1916 | /// \returns An initialized 128-bit vector of [2 x i64] containing the values |
| 1917 | /// provided in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1918 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1919 | _mm_set_epi64(__m64 __q1, __m64 __q0) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1920 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1921 | return (__m128i){ (long long)__q0, (long long)__q1 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1922 | } |
| 1923 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1924 | /// \brief Initializes the 32-bit values in a 128-bit vector of [4 x i32] with |
| 1925 | /// the specified 32-bit integer values. |
| 1926 | /// |
| 1927 | /// \headerfile <x86intrin.h> |
| 1928 | /// |
| 1929 | /// This intrinsic is a utility function and does not correspond to a specific |
| 1930 | /// instruction. |
| 1931 | /// |
| 1932 | /// \param __i3 |
| 1933 | /// A 32-bit integer value used to initialize bits [127:96] of the |
| 1934 | /// destination vector. |
| 1935 | /// \param __i2 |
| 1936 | /// A 32-bit integer value used to initialize bits [95:64] of the destination |
| 1937 | /// vector. |
| 1938 | /// \param __i1 |
| 1939 | /// A 32-bit integer value used to initialize bits [63:32] of the destination |
| 1940 | /// vector. |
| 1941 | /// \param __i0 |
| 1942 | /// A 32-bit integer value used to initialize bits [31:0] of the destination |
| 1943 | /// vector. |
| 1944 | /// \returns An initialized 128-bit vector of [4 x i32] containing the values |
| 1945 | /// provided in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1946 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1947 | _mm_set_epi32(int __i3, int __i2, int __i1, int __i0) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1948 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1949 | return (__m128i)(__v4si){ __i0, __i1, __i2, __i3}; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1950 | } |
| 1951 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1952 | /// \brief Initializes the 16-bit values in a 128-bit vector of [8 x i16] with |
| 1953 | /// the specified 16-bit integer values. |
| 1954 | /// |
| 1955 | /// \headerfile <x86intrin.h> |
| 1956 | /// |
| 1957 | /// This intrinsic is a utility function and does not correspond to a specific |
| 1958 | /// instruction. |
| 1959 | /// |
| 1960 | /// \param __w7 |
| 1961 | /// A 16-bit integer value used to initialize bits [127:112] of the |
| 1962 | /// destination vector. |
| 1963 | /// \param __w6 |
| 1964 | /// A 16-bit integer value used to initialize bits [111:96] of the |
| 1965 | /// destination vector. |
| 1966 | /// \param __w5 |
| 1967 | /// A 16-bit integer value used to initialize bits [95:80] of the destination |
| 1968 | /// vector. |
| 1969 | /// \param __w4 |
| 1970 | /// A 16-bit integer value used to initialize bits [79:64] of the destination |
| 1971 | /// vector. |
| 1972 | /// \param __w3 |
| 1973 | /// A 16-bit integer value used to initialize bits [63:48] of the destination |
| 1974 | /// vector. |
| 1975 | /// \param __w2 |
| 1976 | /// A 16-bit integer value used to initialize bits [47:32] of the destination |
| 1977 | /// vector. |
| 1978 | /// \param __w1 |
| 1979 | /// A 16-bit integer value used to initialize bits [31:16] of the destination |
| 1980 | /// vector. |
| 1981 | /// \param __w0 |
| 1982 | /// A 16-bit integer value used to initialize bits [15:0] of the destination |
| 1983 | /// vector. |
| 1984 | /// \returns An initialized 128-bit vector of [8 x i16] containing the values |
| 1985 | /// provided in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 1986 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1987 | _mm_set_epi16(short __w7, short __w6, short __w5, short __w4, short __w3, short __w2, short __w1, short __w0) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1988 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 1989 | return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 1990 | } |
| 1991 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 1992 | /// \brief Initializes the 8-bit values in a 128-bit vector of [16 x i8] with |
| 1993 | /// the specified 8-bit integer values. |
| 1994 | /// |
| 1995 | /// \headerfile <x86intrin.h> |
| 1996 | /// |
| 1997 | /// This intrinsic is a utility function and does not correspond to a specific |
| 1998 | /// instruction. |
| 1999 | /// |
| 2000 | /// \param __b15 |
| 2001 | /// Initializes bits [127:120] of the destination vector. |
| 2002 | /// \param __b14 |
| 2003 | /// Initializes bits [119:112] of the destination vector. |
| 2004 | /// \param __b13 |
| 2005 | /// Initializes bits [111:104] of the destination vector. |
| 2006 | /// \param __b12 |
| 2007 | /// Initializes bits [103:96] of the destination vector. |
| 2008 | /// \param __b11 |
| 2009 | /// Initializes bits [95:88] of the destination vector. |
| 2010 | /// \param __b10 |
| 2011 | /// Initializes bits [87:80] of the destination vector. |
| 2012 | /// \param __b9 |
| 2013 | /// Initializes bits [79:72] of the destination vector. |
| 2014 | /// \param __b8 |
| 2015 | /// Initializes bits [71:64] of the destination vector. |
| 2016 | /// \param __b7 |
| 2017 | /// Initializes bits [63:56] of the destination vector. |
| 2018 | /// \param __b6 |
| 2019 | /// Initializes bits [55:48] of the destination vector. |
| 2020 | /// \param __b5 |
| 2021 | /// Initializes bits [47:40] of the destination vector. |
| 2022 | /// \param __b4 |
| 2023 | /// Initializes bits [39:32] of the destination vector. |
| 2024 | /// \param __b3 |
| 2025 | /// Initializes bits [31:24] of the destination vector. |
| 2026 | /// \param __b2 |
| 2027 | /// Initializes bits [23:16] of the destination vector. |
| 2028 | /// \param __b1 |
| 2029 | /// Initializes bits [15:8] of the destination vector. |
| 2030 | /// \param __b0 |
| 2031 | /// Initializes bits [7:0] of the destination vector. |
| 2032 | /// \returns An initialized 128-bit vector of [16 x i8] containing the values |
| 2033 | /// provided in the operands. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2034 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2035 | _mm_set_epi8(char __b15, char __b14, char __b13, char __b12, char __b11, char __b10, char __b9, char __b8, char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2036 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2037 | return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2038 | } |
| 2039 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 2040 | /// \brief Initializes both values in a 128-bit integer vector with the |
| 2041 | /// specified 64-bit integer value. |
| 2042 | /// |
| 2043 | /// \headerfile <x86intrin.h> |
| 2044 | /// |
| 2045 | /// This intrinsic is a utility function and does not correspond to a specific |
| 2046 | /// instruction. |
| 2047 | /// |
| 2048 | /// \param __q |
| 2049 | /// Integer value used to initialize the elements of the destination integer |
| 2050 | /// vector. |
| 2051 | /// \returns An initialized 128-bit integer vector of [2 x i64] with both |
| 2052 | /// elements containing the value provided in the operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2053 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2054 | _mm_set1_epi64x(long long __q) |
Anders Carlsson | dfa3117 | 2009-09-18 17:03:55 +0000 | [diff] [blame] | 2055 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2056 | return (__m128i){ __q, __q }; |
Anders Carlsson | dfa3117 | 2009-09-18 17:03:55 +0000 | [diff] [blame] | 2057 | } |
| 2058 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 2059 | /// \brief Initializes both values in a 128-bit vector of [2 x i64] with the |
| 2060 | /// specified 64-bit value. |
| 2061 | /// |
| 2062 | /// \headerfile <x86intrin.h> |
| 2063 | /// |
| 2064 | /// This intrinsic is a utility function and does not correspond to a specific |
| 2065 | /// instruction. |
| 2066 | /// |
| 2067 | /// \param __q |
| 2068 | /// A 64-bit value used to initialize the elements of the destination integer |
| 2069 | /// vector. |
| 2070 | /// \returns An initialized 128-bit vector of [2 x i64] with all elements |
| 2071 | /// containing the value provided in the operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2072 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2073 | _mm_set1_epi64(__m64 __q) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2074 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2075 | return (__m128i){ (long long)__q, (long long)__q }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2076 | } |
| 2077 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 2078 | /// \brief Initializes all values in a 128-bit vector of [4 x i32] with the |
| 2079 | /// specified 32-bit value. |
| 2080 | /// |
| 2081 | /// \headerfile <x86intrin.h> |
| 2082 | /// |
| 2083 | /// This intrinsic is a utility function and does not correspond to a specific |
| 2084 | /// instruction. |
| 2085 | /// |
| 2086 | /// \param __i |
| 2087 | /// A 32-bit value used to initialize the elements of the destination integer |
| 2088 | /// vector. |
| 2089 | /// \returns An initialized 128-bit vector of [4 x i32] with all elements |
| 2090 | /// containing the value provided in the operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2091 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2092 | _mm_set1_epi32(int __i) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2093 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2094 | return (__m128i)(__v4si){ __i, __i, __i, __i }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2095 | } |
| 2096 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 2097 | /// \brief Initializes all values in a 128-bit vector of [8 x i16] with the |
| 2098 | /// specified 16-bit value. |
| 2099 | /// |
| 2100 | /// \headerfile <x86intrin.h> |
| 2101 | /// |
| 2102 | /// This intrinsic is a utility function and does not correspond to a specific |
| 2103 | /// instruction. |
| 2104 | /// |
| 2105 | /// \param __w |
| 2106 | /// A 16-bit value used to initialize the elements of the destination integer |
| 2107 | /// vector. |
| 2108 | /// \returns An initialized 128-bit vector of [8 x i16] with all elements |
| 2109 | /// containing the value provided in the operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2110 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2111 | _mm_set1_epi16(short __w) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2112 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2113 | return (__m128i)(__v8hi){ __w, __w, __w, __w, __w, __w, __w, __w }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2114 | } |
| 2115 | |
Ekaterina Romanova | f2ed620 | 2016-04-08 20:45:48 +0000 | [diff] [blame] | 2116 | /// \brief Initializes all values in a 128-bit vector of [16 x i8] with the |
| 2117 | /// specified 8-bit value. |
| 2118 | /// |
| 2119 | /// \headerfile <x86intrin.h> |
| 2120 | /// |
| 2121 | /// This intrinsic is a utility function and does not correspond to a specific |
| 2122 | /// instruction. |
| 2123 | /// |
| 2124 | /// \param __b |
| 2125 | /// An 8-bit value used to initialize the elements of the destination integer |
| 2126 | /// vector. |
| 2127 | /// \returns An initialized 128-bit vector of [16 x i8] with all elements |
| 2128 | /// containing the value provided in the operand. |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2129 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2130 | _mm_set1_epi8(char __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2131 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2132 | return (__m128i)(__v16qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2133 | } |
| 2134 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2135 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2136 | _mm_setr_epi64(__m64 __q0, __m64 __q1) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2137 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2138 | return (__m128i){ (long long)__q0, (long long)__q1 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2139 | } |
| 2140 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2141 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2142 | _mm_setr_epi32(int __i0, int __i1, int __i2, int __i3) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2143 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2144 | return (__m128i)(__v4si){ __i0, __i1, __i2, __i3}; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2145 | } |
| 2146 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2147 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2148 | _mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, short __w5, short __w6, short __w7) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2149 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2150 | return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2151 | } |
| 2152 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2153 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2154 | _mm_setr_epi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7, char __b8, char __b9, char __b10, char __b11, char __b12, char __b13, char __b14, char __b15) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2155 | { |
Michael Kuperstein | 5c2cb0e | 2015-09-21 11:45:27 +0000 | [diff] [blame] | 2156 | return (__m128i)(__v16qi){ __b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8, __b9, __b10, __b11, __b12, __b13, __b14, __b15 }; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2157 | } |
| 2158 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2159 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Mike Stump | 5b31ed3 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 2160 | _mm_setzero_si128(void) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2161 | { |
| 2162 | return (__m128i){ 0LL, 0LL }; |
| 2163 | } |
| 2164 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2165 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2166 | _mm_store_si128(__m128i *__p, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2167 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2168 | *__p = __b; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2169 | } |
| 2170 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2171 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2172 | _mm_storeu_si128(__m128i *__p, __m128i __b) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2173 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2174 | __builtin_ia32_storedqu((char *)__p, (__v16qi)__b); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2175 | } |
| 2176 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2177 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2178 | _mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2179 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2180 | __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2181 | } |
| 2182 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2183 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2184 | _mm_storel_epi64(__m128i *__p, __m128i __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2185 | { |
Chad Rosier | 87622b8 | 2012-05-01 18:11:51 +0000 | [diff] [blame] | 2186 | struct __mm_storel_epi64_struct { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2187 | long long __u; |
Chad Rosier | 87622b8 | 2012-05-01 18:11:51 +0000 | [diff] [blame] | 2188 | } __attribute__((__packed__, __may_alias__)); |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2189 | ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0]; |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2190 | } |
| 2191 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2192 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2193 | _mm_stream_pd(double *__p, __m128d __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2194 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2195 | __builtin_ia32_movntpd(__p, (__v2df)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2196 | } |
| 2197 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2198 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2199 | _mm_stream_si128(__m128i *__p, __m128i __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2200 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2201 | __builtin_ia32_movntdq(__p, (__v2di)__a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2202 | } |
| 2203 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2204 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2205 | _mm_stream_si32(int *__p, int __a) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2206 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2207 | __builtin_ia32_movnti(__p, __a); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2208 | } |
| 2209 | |
Eli Friedman | f9d8c6c | 2013-09-23 23:38:39 +0000 | [diff] [blame] | 2210 | #ifdef __x86_64__ |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2211 | static __inline__ void __DEFAULT_FN_ATTRS |
Eli Friedman | f9d8c6c | 2013-09-23 23:38:39 +0000 | [diff] [blame] | 2212 | _mm_stream_si64(long long *__p, long long __a) |
| 2213 | { |
| 2214 | __builtin_ia32_movnti64(__p, __a); |
| 2215 | } |
| 2216 | #endif |
| 2217 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2218 | static __inline__ void __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2219 | _mm_clflush(void const *__p) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2220 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2221 | __builtin_ia32_clflush(__p); |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2222 | } |
| 2223 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2224 | static __inline__ void __DEFAULT_FN_ATTRS |
Mike Stump | 5b31ed3 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 2225 | _mm_lfence(void) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2226 | { |
| 2227 | __builtin_ia32_lfence(); |
| 2228 | } |
| 2229 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2230 | static __inline__ void __DEFAULT_FN_ATTRS |
Mike Stump | 5b31ed3 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 2231 | _mm_mfence(void) |
Anders Carlsson | a0d5ca2 | 2008-12-25 23:48:58 +0000 | [diff] [blame] | 2232 | { |
| 2233 | __builtin_ia32_mfence(); |
| 2234 | } |
| 2235 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2236 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2237 | _mm_packs_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2238 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2239 | return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2240 | } |
| 2241 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2242 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2243 | _mm_packs_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2244 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2245 | return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2246 | } |
| 2247 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2248 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2249 | _mm_packus_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2250 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2251 | return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2252 | } |
| 2253 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2254 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2255 | _mm_extract_epi16(__m128i __a, int __imm) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2256 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2257 | __v8hi __b = (__v8hi)__a; |
Manman Ren | be38b9e | 2013-10-22 19:24:42 +0000 | [diff] [blame] | 2258 | return (unsigned short)__b[__imm & 7]; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2259 | } |
| 2260 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2261 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2262 | _mm_insert_epi16(__m128i __a, int __b, int __imm) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2263 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2264 | __v8hi __c = (__v8hi)__a; |
| 2265 | __c[__imm & 7] = __b; |
| 2266 | return (__m128i)__c; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2267 | } |
| 2268 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2269 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2270 | _mm_movemask_epi8(__m128i __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2271 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2272 | return __builtin_ia32_pmovmskb128((__v16qi)__a); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2273 | } |
| 2274 | |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2275 | #define _mm_shuffle_epi32(a, imm) __extension__ ({ \ |
Craig Topper | 51e4741 | 2015-02-13 06:04:43 +0000 | [diff] [blame] | 2276 | (__m128i)__builtin_shufflevector((__v4si)(__m128i)(a), \ |
Craig Topper | fd778ee | 2015-11-10 05:08:08 +0000 | [diff] [blame] | 2277 | (__v4si)_mm_setzero_si128(), \ |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2278 | (imm) & 0x3, ((imm) & 0xc) >> 2, \ |
| 2279 | ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); }) |
Chris Lattner | f03406f | 2011-04-25 20:42:40 +0000 | [diff] [blame] | 2280 | |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2281 | #define _mm_shufflelo_epi16(a, imm) __extension__ ({ \ |
Craig Topper | 51e4741 | 2015-02-13 06:04:43 +0000 | [diff] [blame] | 2282 | (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \ |
Craig Topper | fd778ee | 2015-11-10 05:08:08 +0000 | [diff] [blame] | 2283 | (__v8hi)_mm_setzero_si128(), \ |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2284 | (imm) & 0x3, ((imm) & 0xc) >> 2, \ |
| 2285 | ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \ |
| 2286 | 4, 5, 6, 7); }) |
Chris Lattner | f03406f | 2011-04-25 20:42:40 +0000 | [diff] [blame] | 2287 | |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2288 | #define _mm_shufflehi_epi16(a, imm) __extension__ ({ \ |
Craig Topper | 51e4741 | 2015-02-13 06:04:43 +0000 | [diff] [blame] | 2289 | (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \ |
Craig Topper | fd778ee | 2015-11-10 05:08:08 +0000 | [diff] [blame] | 2290 | (__v8hi)_mm_setzero_si128(), \ |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2291 | 0, 1, 2, 3, \ |
| 2292 | 4 + (((imm) & 0x03) >> 0), \ |
| 2293 | 4 + (((imm) & 0x0c) >> 2), \ |
| 2294 | 4 + (((imm) & 0x30) >> 4), \ |
| 2295 | 4 + (((imm) & 0xc0) >> 6)); }) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2296 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2297 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2298 | _mm_unpackhi_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2299 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2300 | return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2301 | } |
| 2302 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2303 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2304 | _mm_unpackhi_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2305 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2306 | return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2307 | } |
| 2308 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2309 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2310 | _mm_unpackhi_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2311 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2312 | return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2313 | } |
| 2314 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2315 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2316 | _mm_unpackhi_epi64(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2317 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2318 | return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 1, 2+1); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2319 | } |
| 2320 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2321 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2322 | _mm_unpacklo_epi8(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2323 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2324 | return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2325 | } |
| 2326 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2327 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2328 | _mm_unpacklo_epi16(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2329 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2330 | return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2331 | } |
| 2332 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2333 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2334 | _mm_unpacklo_epi32(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2335 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2336 | return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2337 | } |
| 2338 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2339 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2340 | _mm_unpacklo_epi64(__m128i __a, __m128i __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2341 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2342 | return (__m128i)__builtin_shufflevector((__v2di)__a, (__v2di)__b, 0, 2+0); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2343 | } |
| 2344 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2345 | static __inline__ __m64 __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2346 | _mm_movepi64_pi64(__m128i __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2347 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2348 | return (__m64)__a[0]; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2349 | } |
| 2350 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2351 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Alp Toker | d480b1b | 2013-11-23 22:11:57 +0000 | [diff] [blame] | 2352 | _mm_movpi64_epi64(__m64 __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2353 | { |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2354 | return (__m128i){ (long long)__a, 0 }; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2355 | } |
| 2356 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2357 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2358 | _mm_move_epi64(__m128i __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2359 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2360 | return __builtin_shufflevector((__v2di)__a, (__m128i){ 0 }, 0, 2); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2361 | } |
| 2362 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2363 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2364 | _mm_unpackhi_pd(__m128d __a, __m128d __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2365 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2366 | return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 1, 2+1); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2367 | } |
| 2368 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2369 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2370 | _mm_unpacklo_pd(__m128d __a, __m128d __b) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2371 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2372 | return __builtin_shufflevector((__v2df)__a, (__v2df)__b, 0, 2+0); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2373 | } |
| 2374 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2375 | static __inline__ int __DEFAULT_FN_ATTRS |
David Blaikie | 3302f2b | 2013-01-16 23:08:36 +0000 | [diff] [blame] | 2376 | _mm_movemask_pd(__m128d __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2377 | { |
Craig Topper | 1aa231e | 2016-05-16 06:38:42 +0000 | [diff] [blame] | 2378 | return __builtin_ia32_movmskpd((__v2df)__a); |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2379 | } |
| 2380 | |
Bob Wilson | c9b97cc | 2011-11-05 06:08:06 +0000 | [diff] [blame] | 2381 | #define _mm_shuffle_pd(a, b, i) __extension__ ({ \ |
Craig Topper | d619eaaa | 2015-11-11 03:47:10 +0000 | [diff] [blame] | 2382 | (__m128d)__builtin_shufflevector((__v2df)(__m128d)(a), (__v2df)(__m128d)(b), \ |
| 2383 | (i) & 1, (((i) & 2) >> 1) + 2); }) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2384 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2385 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2386 | _mm_castpd_ps(__m128d __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2387 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2388 | return (__m128)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2389 | } |
| 2390 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2391 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2392 | _mm_castpd_si128(__m128d __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2393 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2394 | return (__m128i)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2395 | } |
| 2396 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2397 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2398 | _mm_castps_pd(__m128 __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2399 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2400 | return (__m128d)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2401 | } |
| 2402 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2403 | static __inline__ __m128i __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2404 | _mm_castps_si128(__m128 __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2405 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2406 | return (__m128i)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2407 | } |
| 2408 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2409 | static __inline__ __m128 __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2410 | _mm_castsi128_ps(__m128i __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2411 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2412 | return (__m128)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2413 | } |
| 2414 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2415 | static __inline__ __m128d __DEFAULT_FN_ATTRS |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2416 | _mm_castsi128_pd(__m128i __a) |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2417 | { |
Reid Kleckner | 7ab75b3 | 2013-04-19 17:00:14 +0000 | [diff] [blame] | 2418 | return (__m128d)__a; |
Anders Carlsson | 85eb124 | 2008-12-26 00:45:50 +0000 | [diff] [blame] | 2419 | } |
| 2420 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2421 | static __inline__ void __DEFAULT_FN_ATTRS |
Mike Stump | 5b31ed3 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 2422 | _mm_pause(void) |
Anders Carlsson | 37c2371 | 2008-12-26 00:49:43 +0000 | [diff] [blame] | 2423 | { |
Craig Topper | fb79b5f | 2015-11-11 08:13:33 +0000 | [diff] [blame] | 2424 | __builtin_ia32_pause(); |
Anders Carlsson | 37c2371 | 2008-12-26 00:49:43 +0000 | [diff] [blame] | 2425 | } |
| 2426 | |
Michael Kuperstein | e45af54 | 2015-06-30 13:36:19 +0000 | [diff] [blame] | 2427 | #undef __DEFAULT_FN_ATTRS |
Eric Christopher | 4d185168 | 2015-06-17 07:09:20 +0000 | [diff] [blame] | 2428 | |
Anders Carlsson | 43c2bab | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 2429 | #define _MM_SHUFFLE2(x, y) (((x) << 1) | (y)) |
Anders Carlsson | 37c2371 | 2008-12-26 00:49:43 +0000 | [diff] [blame] | 2430 | |
Anders Carlsson | f15e71d | 2008-12-24 01:45:22 +0000 | [diff] [blame] | 2431 | #endif /* __EMMINTRIN_H */ |