Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 1 | /*===---- xmmintrin.h - SSE intrinsics -------------------------------------=== |
| 2 | * |
| 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | * of this software and associated documentation files (the "Software"), to deal |
| 5 | * in the Software without restriction, including without limitation the rights |
| 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | * copies of the Software, and to permit persons to whom the Software is |
| 8 | * furnished to do so, subject to the following conditions: |
| 9 | * |
| 10 | * The above copyright notice and this permission notice shall be included in |
| 11 | * all copies or substantial portions of the Software. |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | * THE SOFTWARE. |
| 20 | * |
| 21 | *===-----------------------------------------------------------------------=== |
| 22 | */ |
| 23 | |
| 24 | #ifndef __XMMINTRIN_H |
| 25 | #define __XMMINTRIN_H |
| 26 | |
| 27 | #ifndef __SSE__ |
Anders Carlsson | 4fd3e63 | 2008-12-26 00:57:11 +0000 | [diff] [blame] | 28 | #error "SSE instruction set not enabled" |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 29 | #else |
| 30 | |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 31 | #include <mmintrin.h> |
| 32 | |
Eric Christopher | 020f1ed | 2010-03-20 01:08:47 +0000 | [diff] [blame] | 33 | typedef int __v4si __attribute__((__vector_size__(16))); |
Anders Carlsson | 398082e | 2008-12-22 17:42:23 +0000 | [diff] [blame] | 34 | typedef float __v4sf __attribute__((__vector_size__(16))); |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 35 | typedef float __m128 __attribute__((__vector_size__(16))); |
| 36 | |
Chandler Carruth | 7acb953 | 2010-11-22 08:06:31 +0000 | [diff] [blame] | 37 | // This header should only be included in a hosted environment as it depends on |
| 38 | // a standard library to provide allocation routines. |
| 39 | #if __STDC_HOSTED__ |
Anders Carlsson | 398082e | 2008-12-22 17:42:23 +0000 | [diff] [blame] | 40 | #include <mm_malloc.h> |
Chandler Carruth | 7acb953 | 2010-11-22 08:06:31 +0000 | [diff] [blame] | 41 | #endif |
Anders Carlsson | 398082e | 2008-12-22 17:42:23 +0000 | [diff] [blame] | 42 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 43 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 44 | _mm_add_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 45 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 46 | a[0] += b[0]; |
| 47 | return a; |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 48 | } |
| 49 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 50 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 51 | _mm_add_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 52 | { |
| 53 | return a + b; |
| 54 | } |
| 55 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 56 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 57 | _mm_sub_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 58 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 59 | a[0] -= b[0]; |
| 60 | return a; |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 63 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 64 | _mm_sub_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 65 | { |
| 66 | return a - b; |
| 67 | } |
| 68 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 69 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 70 | _mm_mul_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 71 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 72 | a[0] *= b[0]; |
| 73 | return a; |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 76 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 77 | _mm_mul_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 78 | { |
| 79 | return a * b; |
| 80 | } |
| 81 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 82 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 83 | _mm_div_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 84 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 85 | a[0] /= b[0]; |
| 86 | return a; |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 89 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 90 | _mm_div_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 91 | { |
| 92 | return a / b; |
| 93 | } |
| 94 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 95 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 96 | _mm_sqrt_ss(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 97 | { |
| 98 | return __builtin_ia32_sqrtss(a); |
| 99 | } |
| 100 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 101 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 102 | _mm_sqrt_ps(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 103 | { |
| 104 | return __builtin_ia32_sqrtps(a); |
| 105 | } |
| 106 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 107 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 108 | _mm_rcp_ss(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 109 | { |
| 110 | return __builtin_ia32_rcpss(a); |
| 111 | } |
| 112 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 113 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 114 | _mm_rcp_ps(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 115 | { |
| 116 | return __builtin_ia32_rcpps(a); |
| 117 | } |
| 118 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 119 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 120 | _mm_rsqrt_ss(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 121 | { |
| 122 | return __builtin_ia32_rsqrtss(a); |
| 123 | } |
| 124 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 125 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 126 | _mm_rsqrt_ps(__m128 a) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 127 | { |
| 128 | return __builtin_ia32_rsqrtps(a); |
| 129 | } |
| 130 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 131 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 132 | _mm_min_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 133 | { |
| 134 | return __builtin_ia32_minss(a, b); |
| 135 | } |
| 136 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 137 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 138 | _mm_min_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 139 | { |
| 140 | return __builtin_ia32_minps(a, b); |
| 141 | } |
| 142 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 143 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 144 | _mm_max_ss(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 145 | { |
| 146 | return __builtin_ia32_maxss(a, b); |
| 147 | } |
| 148 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 149 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 150 | _mm_max_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 151 | { |
| 152 | return __builtin_ia32_maxps(a, b); |
| 153 | } |
| 154 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 155 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 156 | _mm_and_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 157 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 158 | return (__m128)((__v4si)a & (__v4si)b); |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 161 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 162 | _mm_andnot_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 163 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 164 | return (__m128)(~(__v4si)a & (__v4si)b); |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 165 | } |
| 166 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 167 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 168 | _mm_or_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 169 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 170 | return (__m128)((__v4si)a | (__v4si)b); |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 171 | } |
| 172 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 173 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 174 | _mm_xor_ps(__m128 a, __m128 b) |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 175 | { |
Chris Lattner | 2c48345 | 2010-01-07 00:36:41 +0000 | [diff] [blame] | 176 | return (__m128)((__v4si)a ^ (__v4si)b); |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 177 | } |
| 178 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 179 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 180 | _mm_cmpeq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 181 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 182 | return (__m128)__builtin_ia32_cmpss(a, b, 0); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 185 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 186 | _mm_cmpeq_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 187 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 188 | return (__m128)__builtin_ia32_cmpps(a, b, 0); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 191 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 192 | _mm_cmplt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 193 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 194 | return (__m128)__builtin_ia32_cmpss(a, b, 1); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 195 | } |
| 196 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 197 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 198 | _mm_cmplt_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 199 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 200 | return (__m128)__builtin_ia32_cmpps(a, b, 1); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 203 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 204 | _mm_cmple_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 205 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 206 | return (__m128)__builtin_ia32_cmpss(a, b, 2); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 207 | } |
| 208 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 209 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 210 | _mm_cmple_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 211 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 212 | return (__m128)__builtin_ia32_cmpps(a, b, 2); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 213 | } |
| 214 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 215 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 216 | _mm_cmpgt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 217 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 218 | return (__m128)__builtin_ia32_cmpss(b, a, 1); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 219 | } |
| 220 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 221 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 222 | _mm_cmpgt_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 223 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 224 | return (__m128)__builtin_ia32_cmpps(b, a, 1); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 225 | } |
| 226 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 227 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 228 | _mm_cmpge_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 229 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 230 | return (__m128)__builtin_ia32_cmpss(b, a, 2); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 231 | } |
| 232 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 233 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 234 | _mm_cmpge_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 235 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 236 | return (__m128)__builtin_ia32_cmpps(b, a, 2); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 237 | } |
| 238 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 239 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 240 | _mm_cmpneq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 241 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 242 | return (__m128)__builtin_ia32_cmpss(a, b, 4); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 243 | } |
| 244 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 245 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 246 | _mm_cmpneq_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 247 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 248 | return (__m128)__builtin_ia32_cmpps(a, b, 4); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 249 | } |
| 250 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 251 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 252 | _mm_cmpnlt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 253 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 254 | return (__m128)__builtin_ia32_cmpss(a, b, 5); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 257 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 258 | _mm_cmpnlt_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 259 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 260 | return (__m128)__builtin_ia32_cmpps(a, b, 5); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 261 | } |
| 262 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 263 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 264 | _mm_cmpnle_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 265 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 266 | return (__m128)__builtin_ia32_cmpss(a, b, 6); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 267 | } |
| 268 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 269 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 270 | _mm_cmpnle_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 271 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 272 | return (__m128)__builtin_ia32_cmpps(a, b, 6); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 273 | } |
| 274 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 275 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 276 | _mm_cmpngt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 277 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 278 | return (__m128)__builtin_ia32_cmpss(b, a, 5); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 279 | } |
| 280 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 281 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 282 | _mm_cmpngt_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 283 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 284 | return (__m128)__builtin_ia32_cmpps(b, a, 5); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 285 | } |
| 286 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 287 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 288 | _mm_cmpnge_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 289 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 290 | return (__m128)__builtin_ia32_cmpss(b, a, 6); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 291 | } |
| 292 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 293 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 294 | _mm_cmpnge_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 295 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 296 | return (__m128)__builtin_ia32_cmpps(b, a, 6); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 297 | } |
| 298 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 299 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 300 | _mm_cmpord_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 301 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 302 | return (__m128)__builtin_ia32_cmpss(a, b, 7); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 303 | } |
| 304 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 305 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 306 | _mm_cmpord_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 307 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 308 | return (__m128)__builtin_ia32_cmpps(a, b, 7); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 309 | } |
| 310 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 311 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 312 | _mm_cmpunord_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 313 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 314 | return (__m128)__builtin_ia32_cmpss(a, b, 3); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 315 | } |
| 316 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 317 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 318 | _mm_cmpunord_ps(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 319 | { |
Anders Carlsson | 79dcf5f | 2009-05-18 19:16:46 +0000 | [diff] [blame] | 320 | return (__m128)__builtin_ia32_cmpps(a, b, 3); |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 321 | } |
| 322 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 323 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 324 | _mm_comieq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 325 | { |
| 326 | return __builtin_ia32_comieq(a, b); |
| 327 | } |
| 328 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 329 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 330 | _mm_comilt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 331 | { |
| 332 | return __builtin_ia32_comilt(a, b); |
| 333 | } |
| 334 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 335 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 336 | _mm_comile_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 337 | { |
| 338 | return __builtin_ia32_comile(a, b); |
| 339 | } |
| 340 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 341 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 342 | _mm_comigt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 343 | { |
| 344 | return __builtin_ia32_comigt(a, b); |
| 345 | } |
| 346 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 347 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 348 | _mm_comige_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 349 | { |
| 350 | return __builtin_ia32_comige(a, b); |
| 351 | } |
| 352 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 353 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 354 | _mm_comineq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 355 | { |
| 356 | return __builtin_ia32_comineq(a, b); |
| 357 | } |
| 358 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 359 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 360 | _mm_ucomieq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 361 | { |
| 362 | return __builtin_ia32_ucomieq(a, b); |
| 363 | } |
| 364 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 365 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 366 | _mm_ucomilt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 367 | { |
| 368 | return __builtin_ia32_ucomilt(a, b); |
| 369 | } |
| 370 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 371 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 372 | _mm_ucomile_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 373 | { |
| 374 | return __builtin_ia32_ucomile(a, b); |
| 375 | } |
| 376 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 377 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 378 | _mm_ucomigt_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 379 | { |
| 380 | return __builtin_ia32_ucomigt(a, b); |
| 381 | } |
| 382 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 383 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 384 | _mm_ucomige_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 385 | { |
| 386 | return __builtin_ia32_ucomige(a, b); |
| 387 | } |
| 388 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 389 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 390 | _mm_ucomineq_ss(__m128 a, __m128 b) |
Anders Carlsson | f62c681 | 2008-12-22 00:28:39 +0000 | [diff] [blame] | 391 | { |
| 392 | return __builtin_ia32_ucomineq(a, b); |
| 393 | } |
| 394 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 395 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 396 | _mm_cvtss_si32(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 397 | { |
| 398 | return __builtin_ia32_cvtss2si(a); |
| 399 | } |
| 400 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 401 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | ef5ebf6 | 2010-02-16 18:21:25 +0000 | [diff] [blame] | 402 | _mm_cvt_ss2si(__m128 a) |
| 403 | { |
| 404 | return _mm_cvtss_si32(a); |
| 405 | } |
| 406 | |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 407 | #ifdef __x86_64__ |
| 408 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 409 | static __inline__ long long __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 410 | _mm_cvtss_si64(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 411 | { |
| 412 | return __builtin_ia32_cvtss2si64(a); |
| 413 | } |
| 414 | |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 415 | #endif |
| 416 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 417 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 418 | _mm_cvtps_pi32(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 419 | { |
| 420 | return (__m64)__builtin_ia32_cvtps2pi(a); |
| 421 | } |
| 422 | |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 423 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
| 424 | _mm_cvt_ps2pi(__m128 a) |
| 425 | { |
| 426 | return _mm_cvtps_pi32(a); |
| 427 | } |
| 428 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 429 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 430 | _mm_cvttss_si32(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 431 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 432 | return a[0]; |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 433 | } |
| 434 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 435 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | ef5ebf6 | 2010-02-16 18:21:25 +0000 | [diff] [blame] | 436 | _mm_cvtt_ss2si(__m128 a) |
| 437 | { |
| 438 | return _mm_cvttss_si32(a); |
| 439 | } |
| 440 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 441 | static __inline__ long long __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 442 | _mm_cvttss_si64(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 443 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 444 | return a[0]; |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 445 | } |
| 446 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 447 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 448 | _mm_cvttps_pi32(__m128 a) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 449 | { |
| 450 | return (__m64)__builtin_ia32_cvttps2pi(a); |
| 451 | } |
| 452 | |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 453 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
| 454 | _mm_cvtt_ps2pi(__m128 a) |
| 455 | { |
| 456 | return _mm_cvttps_pi32(a); |
| 457 | } |
| 458 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 459 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 460 | _mm_cvtsi32_ss(__m128 a, int b) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 461 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 462 | a[0] = b; |
| 463 | return a; |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 464 | } |
| 465 | |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 466 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chandler Carruth | d74e398 | 2010-08-08 08:30:05 +0000 | [diff] [blame] | 467 | _mm_cvt_si2ss(__m128 a, int b) |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 468 | { |
| 469 | return _mm_cvtsi32_ss(a, b); |
| 470 | } |
| 471 | |
Anders Carlsson | 1b76b80 | 2008-12-22 01:26:50 +0000 | [diff] [blame] | 472 | #ifdef __x86_64__ |
| 473 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 474 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 475 | _mm_cvtsi64_ss(__m128 a, long long b) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 476 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 477 | a[0] = b; |
| 478 | return a; |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 479 | } |
| 480 | |
Anders Carlsson | 1b76b80 | 2008-12-22 01:26:50 +0000 | [diff] [blame] | 481 | #endif |
| 482 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 483 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 484 | _mm_cvtpi32_ps(__m128 a, __m64 b) |
Anders Carlsson | 4fcc313 | 2008-12-22 00:48:30 +0000 | [diff] [blame] | 485 | { |
| 486 | return __builtin_ia32_cvtpi2ps(a, (__v2si)b); |
| 487 | } |
| 488 | |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 489 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chandler Carruth | d74e398 | 2010-08-08 08:30:05 +0000 | [diff] [blame] | 490 | _mm_cvt_pi2ps(__m128 a, __m64 b) |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 491 | { |
| 492 | return _mm_cvtpi32_ps(a, b); |
| 493 | } |
| 494 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 495 | static __inline__ float __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 496 | _mm_cvtss_f32(__m128 a) |
Anders Carlsson | 1b76b80 | 2008-12-22 01:26:50 +0000 | [diff] [blame] | 497 | { |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 498 | return a[0]; |
Anders Carlsson | 1b76b80 | 2008-12-22 01:26:50 +0000 | [diff] [blame] | 499 | } |
| 500 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 501 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 502 | _mm_loadh_pi(__m128 a, const __m64 *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 503 | { |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 504 | typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8))); |
| 505 | struct __mm_loadh_pi_struct { |
| 506 | __mm_loadh_pi_v2f32 u; |
| 507 | } __attribute__((__packed__, __may_alias__)); |
| 508 | __mm_loadh_pi_v2f32 b = ((struct __mm_loadh_pi_struct*)p)->u; |
| 509 | __m128 bb = __builtin_shufflevector(b, b, 0, 1, 0, 1); |
| 510 | return __builtin_shufflevector(a, bb, 0, 1, 4, 5); |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 513 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 514 | _mm_loadl_pi(__m128 a, const __m64 *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 515 | { |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 516 | typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8))); |
| 517 | struct __mm_loadl_pi_struct { |
| 518 | __mm_loadl_pi_v2f32 u; |
| 519 | } __attribute__((__packed__, __may_alias__)); |
| 520 | __mm_loadl_pi_v2f32 b = ((struct __mm_loadl_pi_struct*)p)->u; |
| 521 | __m128 bb = __builtin_shufflevector(b, b, 0, 1, 0, 1); |
| 522 | return __builtin_shufflevector(a, bb, 4, 5, 2, 3); |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 523 | } |
| 524 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 525 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 526 | _mm_load_ss(const float *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 527 | { |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 528 | struct __mm_load_ss_struct { |
| 529 | float u; |
| 530 | } __attribute__((__packed__, __may_alias__)); |
| 531 | float u = ((struct __mm_load_ss_struct*)p)->u; |
| 532 | return (__m128){ u, 0, 0, 0 }; |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 533 | } |
| 534 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 535 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 536 | _mm_load1_ps(const float *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 537 | { |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 538 | struct __mm_load1_ps_struct { |
| 539 | float u; |
| 540 | } __attribute__((__packed__, __may_alias__)); |
| 541 | float u = ((struct __mm_load1_ps_struct*)p)->u; |
| 542 | return (__m128){ u, u, u, u }; |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 543 | } |
| 544 | |
Eli Friedman | db7351a | 2009-06-02 05:55:48 +0000 | [diff] [blame] | 545 | #define _mm_load_ps1(p) _mm_load1_ps(p) |
| 546 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 547 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 548 | _mm_load_ps(const float *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 549 | { |
| 550 | return *(__m128*)p; |
| 551 | } |
| 552 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 553 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 554 | _mm_loadu_ps(const float *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 555 | { |
Bill Wendling | eed92a1 | 2011-05-13 00:11:39 +0000 | [diff] [blame] | 556 | struct __loadu_ps { |
| 557 | __m128 v; |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 558 | } __attribute__((__packed__, __may_alias__)); |
Bill Wendling | eed92a1 | 2011-05-13 00:11:39 +0000 | [diff] [blame] | 559 | return ((struct __loadu_ps*)p)->v; |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 560 | } |
| 561 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 562 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Chris Lattner | 21b91a3 | 2010-02-01 20:14:14 +0000 | [diff] [blame] | 563 | _mm_loadr_ps(const float *p) |
Anders Carlsson | 9770086 | 2008-12-22 02:43:30 +0000 | [diff] [blame] | 564 | { |
| 565 | __m128 a = _mm_load_ps(p); |
| 566 | return __builtin_shufflevector(a, a, 3, 2, 1, 0); |
| 567 | } |
| 568 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 569 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 570 | _mm_set_ss(float w) |
Anders Carlsson | a6ba001 | 2008-12-22 02:51:35 +0000 | [diff] [blame] | 571 | { |
| 572 | return (__m128){ w, 0, 0, 0 }; |
| 573 | } |
| 574 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 575 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 576 | _mm_set1_ps(float w) |
Anders Carlsson | a6ba001 | 2008-12-22 02:51:35 +0000 | [diff] [blame] | 577 | { |
| 578 | return (__m128){ w, w, w, w }; |
| 579 | } |
| 580 | |
Anders Carlsson | 12868cc | 2008-12-27 04:26:15 +0000 | [diff] [blame] | 581 | // Microsoft specific. |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 582 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 583 | _mm_set_ps1(float w) |
Anders Carlsson | 12868cc | 2008-12-27 04:26:15 +0000 | [diff] [blame] | 584 | { |
| 585 | return _mm_set1_ps(w); |
| 586 | } |
| 587 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 588 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 589 | _mm_set_ps(float z, float y, float x, float w) |
Anders Carlsson | a6ba001 | 2008-12-22 02:51:35 +0000 | [diff] [blame] | 590 | { |
| 591 | return (__m128){ w, x, y, z }; |
| 592 | } |
| 593 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 594 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 595 | _mm_setr_ps(float z, float y, float x, float w) |
Anders Carlsson | a6ba001 | 2008-12-22 02:51:35 +0000 | [diff] [blame] | 596 | { |
| 597 | return (__m128){ z, y, x, w }; |
| 598 | } |
| 599 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 600 | static __inline__ __m128 __attribute__((__always_inline__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 601 | _mm_setzero_ps(void) |
Anders Carlsson | a6ba001 | 2008-12-22 02:51:35 +0000 | [diff] [blame] | 602 | { |
| 603 | return (__m128){ 0, 0, 0, 0 }; |
| 604 | } |
| 605 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 606 | static __inline__ void __attribute__((__always_inline__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 607 | _mm_storeh_pi(__m64 *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 608 | { |
| 609 | __builtin_ia32_storehps((__v2si *)p, a); |
| 610 | } |
| 611 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 612 | static __inline__ void __attribute__((__always_inline__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 613 | _mm_storel_pi(__m64 *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 614 | { |
| 615 | __builtin_ia32_storelps((__v2si *)p, a); |
| 616 | } |
| 617 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 618 | static __inline__ void __attribute__((__always_inline__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 619 | _mm_store_ss(float *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 620 | { |
Eli Friedman | 7c06f6b | 2011-09-15 23:15:27 +0000 | [diff] [blame] | 621 | struct __mm_store_ss_struct { |
| 622 | float u; |
| 623 | } __attribute__((__packed__, __may_alias__)); |
| 624 | ((struct __mm_store_ss_struct*)p)->u = a[0]; |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 625 | } |
| 626 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 627 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 628 | _mm_storeu_ps(float *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 629 | { |
| 630 | __builtin_ia32_storeups(p, a); |
| 631 | } |
| 632 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 633 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 634 | _mm_store1_ps(float *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 635 | { |
| 636 | a = __builtin_shufflevector(a, a, 0, 0, 0, 0); |
| 637 | _mm_storeu_ps(p, a); |
| 638 | } |
| 639 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 640 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 641 | _mm_store_ps1(float *p, __m128 a) |
| 642 | { |
| 643 | return _mm_store1_ps(p, a); |
| 644 | } |
| 645 | |
| 646 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 647 | _mm_store_ps(float *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 648 | { |
| 649 | *(__m128 *)p = a; |
| 650 | } |
| 651 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 652 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 653 | _mm_storer_ps(float *p, __m128 a) |
Anders Carlsson | 09b9305 | 2008-12-22 03:16:40 +0000 | [diff] [blame] | 654 | { |
| 655 | a = __builtin_shufflevector(a, a, 3, 2, 1, 0); |
| 656 | _mm_store_ps(p, a); |
| 657 | } |
| 658 | |
Chris Lattner | 551f37c | 2010-08-27 20:10:06 +0000 | [diff] [blame] | 659 | #define _MM_HINT_T0 3 |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 660 | #define _MM_HINT_T1 2 |
Chris Lattner | 551f37c | 2010-08-27 20:10:06 +0000 | [diff] [blame] | 661 | #define _MM_HINT_T2 1 |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 662 | #define _MM_HINT_NTA 0 |
| 663 | |
Nick Lewycky | c2b9b36 | 2010-05-30 18:26:21 +0000 | [diff] [blame] | 664 | /* FIXME: We have to #define this because "sel" must be a constant integer, and |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 665 | Sema doesn't do any form of constant propagation yet. */ |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 666 | |
Nick Lewycky | c2b9b36 | 2010-05-30 18:26:21 +0000 | [diff] [blame] | 667 | #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, sel)) |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 668 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 669 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 670 | _mm_stream_pi(__m64 *p, __m64 a) |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 671 | { |
| 672 | __builtin_ia32_movntq(p, a); |
| 673 | } |
| 674 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 675 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 676 | _mm_stream_ps(float *p, __m128 a) |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 677 | { |
| 678 | __builtin_ia32_movntps(p, a); |
| 679 | } |
| 680 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 681 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 682 | _mm_sfence(void) |
Anders Carlsson | dedad4e | 2008-12-22 03:50:21 +0000 | [diff] [blame] | 683 | { |
| 684 | __builtin_ia32_sfence(); |
| 685 | } |
| 686 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 687 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 688 | _mm_extract_pi16(__m64 a, int n) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 689 | { |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 690 | __v4hi b = (__v4hi)a; |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 691 | return (unsigned short)b[n & 3]; |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 692 | } |
| 693 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 694 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 695 | _mm_insert_pi16(__m64 a, int d, int n) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 696 | { |
Eli Friedman | 80c8004 | 2009-06-06 02:13:04 +0000 | [diff] [blame] | 697 | __v4hi b = (__v4hi)a; |
| 698 | b[n & 3] = d; |
Eli Friedman | 17d2e3a | 2009-06-06 03:45:06 +0000 | [diff] [blame] | 699 | return (__m64)b; |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 700 | } |
| 701 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 702 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 703 | _mm_max_pi16(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 704 | { |
| 705 | return (__m64)__builtin_ia32_pmaxsw((__v4hi)a, (__v4hi)b); |
| 706 | } |
| 707 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 708 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 709 | _mm_max_pu8(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 710 | { |
| 711 | return (__m64)__builtin_ia32_pmaxub((__v8qi)a, (__v8qi)b); |
| 712 | } |
| 713 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 714 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 715 | _mm_min_pi16(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 716 | { |
| 717 | return (__m64)__builtin_ia32_pminsw((__v4hi)a, (__v4hi)b); |
| 718 | } |
| 719 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 720 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 721 | _mm_min_pu8(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 722 | { |
| 723 | return (__m64)__builtin_ia32_pminub((__v8qi)a, (__v8qi)b); |
| 724 | } |
| 725 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 726 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 727 | _mm_movemask_pi8(__m64 a) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 728 | { |
| 729 | return __builtin_ia32_pmovmskb((__v8qi)a); |
| 730 | } |
| 731 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 732 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 733 | _mm_mulhi_pu16(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 734 | { |
| 735 | return (__m64)__builtin_ia32_pmulhuw((__v4hi)a, (__v4hi)b); |
| 736 | } |
| 737 | |
Bob Wilson | 32bae37 | 2011-11-05 06:08:06 +0000 | [diff] [blame^] | 738 | #define _mm_shuffle_pi16(a, n) __extension__ ({ \ |
| 739 | __m64 __a = (a); \ |
| 740 | (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); }) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 741 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 742 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 743 | _mm_maskmove_si64(__m64 d, __m64 n, char *p) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 744 | { |
| 745 | __builtin_ia32_maskmovq((__v8qi)d, (__v8qi)n, p); |
| 746 | } |
| 747 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 748 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 749 | _mm_avg_pu8(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 750 | { |
| 751 | return (__m64)__builtin_ia32_pavgb((__v8qi)a, (__v8qi)b); |
| 752 | } |
| 753 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 754 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 755 | _mm_avg_pu16(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 756 | { |
| 757 | return (__m64)__builtin_ia32_pavgw((__v4hi)a, (__v4hi)b); |
| 758 | } |
| 759 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 760 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 761 | _mm_sad_pu8(__m64 a, __m64 b) |
Anders Carlsson | 62af71c | 2008-12-22 04:55:36 +0000 | [diff] [blame] | 762 | { |
| 763 | return (__m64)__builtin_ia32_psadbw((__v8qi)a, (__v8qi)b); |
| 764 | } |
Anders Carlsson | c1f9afd | 2008-12-22 05:00:07 +0000 | [diff] [blame] | 765 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 766 | static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 767 | _mm_getcsr(void) |
Anders Carlsson | c1f9afd | 2008-12-22 05:00:07 +0000 | [diff] [blame] | 768 | { |
| 769 | return __builtin_ia32_stmxcsr(); |
| 770 | } |
| 771 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 772 | static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 773 | _mm_setcsr(unsigned int i) |
Anders Carlsson | c1f9afd | 2008-12-22 05:00:07 +0000 | [diff] [blame] | 774 | { |
| 775 | __builtin_ia32_ldmxcsr(i); |
| 776 | } |
| 777 | |
Bob Wilson | 32bae37 | 2011-11-05 06:08:06 +0000 | [diff] [blame^] | 778 | #define _mm_shuffle_ps(a, b, mask) __extension__ ({ \ |
| 779 | __m128 __a = (a); \ |
| 780 | __m128 __b = (b); \ |
| 781 | (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \ |
| 782 | (mask) & 0x3, ((mask) & 0xc) >> 2, \ |
| 783 | (((mask) & 0x30) >> 4) + 4, \ |
| 784 | (((mask) & 0xc0) >> 6) + 4); }) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 785 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 786 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 787 | _mm_unpackhi_ps(__m128 a, __m128 b) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 788 | { |
| 789 | return __builtin_shufflevector(a, b, 2, 6, 3, 7); |
| 790 | } |
| 791 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 792 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 793 | _mm_unpacklo_ps(__m128 a, __m128 b) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 794 | { |
| 795 | return __builtin_shufflevector(a, b, 0, 4, 1, 5); |
| 796 | } |
| 797 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 798 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 799 | _mm_move_ss(__m128 a, __m128 b) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 800 | { |
| 801 | return __builtin_shufflevector(a, b, 4, 1, 2, 3); |
| 802 | } |
| 803 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 804 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 805 | _mm_movehl_ps(__m128 a, __m128 b) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 806 | { |
| 807 | return __builtin_shufflevector(a, b, 6, 7, 2, 3); |
| 808 | } |
| 809 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 810 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 811 | _mm_movelh_ps(__m128 a, __m128 b) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 812 | { |
| 813 | return __builtin_shufflevector(a, b, 0, 1, 4, 5); |
| 814 | } |
| 815 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 816 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 817 | _mm_cvtpi16_ps(__m64 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 818 | { |
| 819 | __m64 b, c; |
| 820 | __m128 r; |
| 821 | |
| 822 | b = _mm_setzero_si64(); |
| 823 | b = _mm_cmpgt_pi16(b, a); |
| 824 | c = _mm_unpackhi_pi16(a, b); |
| 825 | r = _mm_setzero_ps(); |
| 826 | r = _mm_cvtpi32_ps(r, c); |
| 827 | r = _mm_movelh_ps(r, r); |
| 828 | c = _mm_unpacklo_pi16(a, b); |
| 829 | r = _mm_cvtpi32_ps(r, c); |
| 830 | |
| 831 | return r; |
| 832 | } |
| 833 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 834 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 835 | _mm_cvtpu16_ps(__m64 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 836 | { |
| 837 | __m64 b, c; |
| 838 | __m128 r; |
| 839 | |
| 840 | b = _mm_setzero_si64(); |
| 841 | c = _mm_unpackhi_pi16(a, b); |
| 842 | r = _mm_setzero_ps(); |
| 843 | r = _mm_cvtpi32_ps(r, c); |
| 844 | r = _mm_movelh_ps(r, r); |
| 845 | c = _mm_unpacklo_pi16(a, b); |
| 846 | r = _mm_cvtpi32_ps(r, c); |
| 847 | |
| 848 | return r; |
| 849 | } |
| 850 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 851 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 852 | _mm_cvtpi8_ps(__m64 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 853 | { |
| 854 | __m64 b; |
| 855 | |
| 856 | b = _mm_setzero_si64(); |
| 857 | b = _mm_cmpgt_pi8(b, a); |
| 858 | b = _mm_unpacklo_pi8(a, b); |
| 859 | |
| 860 | return _mm_cvtpi16_ps(b); |
| 861 | } |
| 862 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 863 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 864 | _mm_cvtpu8_ps(__m64 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 865 | { |
| 866 | __m64 b; |
| 867 | |
| 868 | b = _mm_setzero_si64(); |
| 869 | b = _mm_unpacklo_pi8(a, b); |
| 870 | |
| 871 | return _mm_cvtpi16_ps(b); |
| 872 | } |
| 873 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 874 | static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 875 | _mm_cvtpi32x2_ps(__m64 a, __m64 b) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 876 | { |
| 877 | __m128 c; |
| 878 | |
| 879 | c = _mm_setzero_ps(); |
| 880 | c = _mm_cvtpi32_ps(c, b); |
| 881 | c = _mm_movelh_ps(c, c); |
| 882 | |
| 883 | return _mm_cvtpi32_ps(c, a); |
| 884 | } |
| 885 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 886 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 887 | _mm_cvtps_pi16(__m128 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 888 | { |
| 889 | __m64 b, c; |
| 890 | |
| 891 | b = _mm_cvtps_pi32(a); |
| 892 | a = _mm_movehl_ps(a, a); |
| 893 | c = _mm_cvtps_pi32(a); |
| 894 | |
| 895 | return _mm_packs_pi16(b, c); |
| 896 | } |
| 897 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 898 | static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 899 | _mm_cvtps_pi8(__m128 a) |
Anders Carlsson | a6431dc | 2008-12-22 07:08:03 +0000 | [diff] [blame] | 900 | { |
| 901 | __m64 b, c; |
| 902 | |
| 903 | b = _mm_cvtps_pi16(a); |
| 904 | c = _mm_setzero_si64(); |
| 905 | |
| 906 | return _mm_packs_pi16(b, c); |
| 907 | } |
| 908 | |
Chris Lattner | 1bddbcb | 2010-03-22 18:14:12 +0000 | [diff] [blame] | 909 | static __inline__ int __attribute__((__always_inline__, __nodebug__)) |
Mike Stump | dae4413 | 2009-02-13 14:24:50 +0000 | [diff] [blame] | 910 | _mm_movemask_ps(__m128 a) |
Anders Carlsson | 50099cb | 2008-12-22 05:20:34 +0000 | [diff] [blame] | 911 | { |
| 912 | return __builtin_ia32_movmskps(a); |
| 913 | } |
| 914 | |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 915 | #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) |
| 916 | |
Anders Carlsson | 4cc4427 | 2009-02-11 06:29:32 +0000 | [diff] [blame] | 917 | #define _MM_EXCEPT_INVALID (0x0001) |
| 918 | #define _MM_EXCEPT_DENORM (0x0002) |
| 919 | #define _MM_EXCEPT_DIV_ZERO (0x0004) |
| 920 | #define _MM_EXCEPT_OVERFLOW (0x0008) |
| 921 | #define _MM_EXCEPT_UNDERFLOW (0x0010) |
| 922 | #define _MM_EXCEPT_INEXACT (0x0020) |
Anders Carlsson | bbd1fa2 | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 923 | #define _MM_EXCEPT_MASK (0x003f) |
Anders Carlsson | 4cc4427 | 2009-02-11 06:29:32 +0000 | [diff] [blame] | 924 | |
Anders Carlsson | bbd1fa2 | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 925 | #define _MM_MASK_INVALID (0x0080) |
| 926 | #define _MM_MASK_DENORM (0x0100) |
Anders Carlsson | a837a07 | 2009-02-14 04:01:38 +0000 | [diff] [blame] | 927 | #define _MM_MASK_DIV_ZERO (0x0200) |
| 928 | #define _MM_MASK_OVERFLOW (0x0400) |
| 929 | #define _MM_MASK_UNDERFLOW (0x0800) |
| 930 | #define _MM_MASK_INEXACT (0x1000) |
Anders Carlsson | bbd1fa2 | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 931 | #define _MM_MASK_MASK (0x1f80) |
| 932 | |
Anders Carlsson | bbd1fa2 | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 933 | #define _MM_ROUND_NEAREST (0x0000) |
| 934 | #define _MM_ROUND_DOWN (0x2000) |
| 935 | #define _MM_ROUND_UP (0x4000) |
| 936 | #define _MM_ROUND_TOWARD_ZERO (0x6000) |
Anders Carlsson | 4cc4427 | 2009-02-11 06:29:32 +0000 | [diff] [blame] | 937 | #define _MM_ROUND_MASK (0x6000) |
Anders Carlsson | bbd1fa2 | 2009-01-21 01:49:39 +0000 | [diff] [blame] | 938 | |
| 939 | #define _MM_FLUSH_ZERO_MASK (0x8000) |
| 940 | #define _MM_FLUSH_ZERO_ON (0x8000) |
| 941 | #define _MM_FLUSH_ZERO_OFF (0x8000) |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 942 | |
| 943 | #define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK) |
| 944 | #define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK) |
Anders Carlsson | 62005c1 | 2009-01-20 21:51:44 +0000 | [diff] [blame] | 945 | #define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK) |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 946 | #define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK) |
| 947 | |
Anders Carlsson | 62005c1 | 2009-01-20 21:51:44 +0000 | [diff] [blame] | 948 | #define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x))) |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 949 | #define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x))) |
Anders Carlsson | 62005c1 | 2009-01-20 21:51:44 +0000 | [diff] [blame] | 950 | #define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x))) |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 951 | #define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x))) |
| 952 | |
| 953 | #define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ |
| 954 | do { \ |
| 955 | __m128 tmp3, tmp2, tmp1, tmp0; \ |
| 956 | tmp0 = _mm_unpacklo_ps((row0), (row1)); \ |
| 957 | tmp2 = _mm_unpacklo_ps((row2), (row3)); \ |
| 958 | tmp1 = _mm_unpackhi_ps((row0), (row1)); \ |
| 959 | tmp3 = _mm_unpackhi_ps((row2), (row3)); \ |
| 960 | (row0) = _mm_movelh_ps(tmp0, tmp2); \ |
| 961 | (row1) = _mm_movehl_ps(tmp2, tmp0); \ |
| 962 | (row2) = _mm_movelh_ps(tmp1, tmp3); \ |
Chris Lattner | 9afb227 | 2010-01-27 07:54:50 +0000 | [diff] [blame] | 963 | (row3) = _mm_movehl_ps(tmp3, tmp1); \ |
Anders Carlsson | b595509 | 2008-12-22 05:42:03 +0000 | [diff] [blame] | 964 | } while (0) |
| 965 | |
Chandler Carruth | fa38c81 | 2010-07-22 06:47:28 +0000 | [diff] [blame] | 966 | /* Aliases for compatibility. */ |
| 967 | #define _m_pextrw _mm_extract_pi16 |
| 968 | #define _m_pinsrw _mm_insert_pi16 |
| 969 | #define _m_pmaxsw _mm_max_pi16 |
| 970 | #define _m_pmaxub _mm_max_pu8 |
| 971 | #define _m_pminsw _mm_min_pi16 |
| 972 | #define _m_pminub _mm_min_pu8 |
| 973 | #define _m_pmovmskb _mm_movemask_pi8 |
| 974 | #define _m_pmulhuw _mm_mulhi_pu16 |
| 975 | #define _m_pshufw _mm_shuffle_pi16 |
| 976 | #define _m_maskmovq _mm_maskmove_si64 |
| 977 | #define _m_pavgb _mm_avg_pu8 |
| 978 | #define _m_pavgw _mm_avg_pu16 |
| 979 | #define _m_psadbw _mm_sad_pu8 |
| 980 | #define _m_ _mm_ |
| 981 | #define _m_ _mm_ |
| 982 | |
Eli Friedman | c7d95dc | 2009-06-11 18:50:02 +0000 | [diff] [blame] | 983 | /* Ugly hack for backwards-compatibility (compatible with gcc) */ |
| 984 | #ifdef __SSE2__ |
Daniel Dunbar | 3eef3e1 | 2009-06-07 08:33:23 +0000 | [diff] [blame] | 985 | #include <emmintrin.h> |
Eli Friedman | c7d95dc | 2009-06-11 18:50:02 +0000 | [diff] [blame] | 986 | #endif |
Daniel Dunbar | 3eef3e1 | 2009-06-07 08:33:23 +0000 | [diff] [blame] | 987 | |
Anders Carlsson | 566d8da | 2008-12-22 00:01:20 +0000 | [diff] [blame] | 988 | #endif /* __SSE__ */ |
| 989 | |
| 990 | #endif /* __XMMINTRIN_H */ |