1 /*===---- mm3dnow.h - 3DNow! 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 _MM3DNOW_H_INCLUDED 25 #define _MM3DNOW_H_INCLUDED 26 27 #include <mmintrin.h> 28 #include <prfchwintrin.h> 29 30 typedef float __v2sf __attribute__((__vector_size__(8))); 31 32 static __inline__ void __attribute__((__always_inline__, __nodebug__)) 33 _m_femms() { 34 __builtin_ia32_femms(); 35 } 36 37 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 38 _m_pavgusb(__m64 __m1, __m64 __m2) { 39 return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2); 40 } 41 42 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 43 _m_pf2id(__m64 __m) { 44 return (__m64)__builtin_ia32_pf2id((__v2sf)__m); 45 } 46 47 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 48 _m_pfacc(__m64 __m1, __m64 __m2) { 49 return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2); 50 } 51 52 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 53 _m_pfadd(__m64 __m1, __m64 __m2) { 54 return (__m64)__builtin_ia32_pfadd((__v2sf)__m1, (__v2sf)__m2); 55 } 56 57 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 58 _m_pfcmpeq(__m64 __m1, __m64 __m2) { 59 return (__m64)__builtin_ia32_pfcmpeq((__v2sf)__m1, (__v2sf)__m2); 60 } 61 62 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 63 _m_pfcmpge(__m64 __m1, __m64 __m2) { 64 return (__m64)__builtin_ia32_pfcmpge((__v2sf)__m1, (__v2sf)__m2); 65 } 66 67 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 68 _m_pfcmpgt(__m64 __m1, __m64 __m2) { 69 return (__m64)__builtin_ia32_pfcmpgt((__v2sf)__m1, (__v2sf)__m2); 70 } 71 72 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 73 _m_pfmax(__m64 __m1, __m64 __m2) { 74 return (__m64)__builtin_ia32_pfmax((__v2sf)__m1, (__v2sf)__m2); 75 } 76 77 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 78 _m_pfmin(__m64 __m1, __m64 __m2) { 79 return (__m64)__builtin_ia32_pfmin((__v2sf)__m1, (__v2sf)__m2); 80 } 81 82 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 83 _m_pfmul(__m64 __m1, __m64 __m2) { 84 return (__m64)__builtin_ia32_pfmul((__v2sf)__m1, (__v2sf)__m2); 85 } 86 87 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 88 _m_pfrcp(__m64 __m) { 89 return (__m64)__builtin_ia32_pfrcp((__v2sf)__m); 90 } 91 92 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 93 _m_pfrcpit1(__m64 __m1, __m64 __m2) { 94 return (__m64)__builtin_ia32_pfrcpit1((__v2sf)__m1, (__v2sf)__m2); 95 } 96 97 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 98 _m_pfrcpit2(__m64 __m1, __m64 __m2) { 99 return (__m64)__builtin_ia32_pfrcpit2((__v2sf)__m1, (__v2sf)__m2); 100 } 101 102 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 103 _m_pfrsqrt(__m64 __m) { 104 return (__m64)__builtin_ia32_pfrsqrt((__v2sf)__m); 105 } 106 107 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 108 _m_pfrsqrtit1(__m64 __m1, __m64 __m2) { 109 return (__m64)__builtin_ia32_pfrsqit1((__v2sf)__m1, (__v2sf)__m2); 110 } 111 112 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 113 _m_pfsub(__m64 __m1, __m64 __m2) { 114 return (__m64)__builtin_ia32_pfsub((__v2sf)__m1, (__v2sf)__m2); 115 } 116 117 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 118 _m_pfsubr(__m64 __m1, __m64 __m2) { 119 return (__m64)__builtin_ia32_pfsubr((__v2sf)__m1, (__v2sf)__m2); 120 } 121 122 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 123 _m_pi2fd(__m64 __m) { 124 return (__m64)__builtin_ia32_pi2fd((__v2si)__m); 125 } 126 127 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 128 _m_pmulhrw(__m64 __m1, __m64 __m2) { 129 return (__m64)__builtin_ia32_pmulhrw((__v4hi)__m1, (__v4hi)__m2); 130 } 131 132 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 133 _m_pf2iw(__m64 __m) { 134 return (__m64)__builtin_ia32_pf2iw((__v2sf)__m); 135 } 136 137 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 138 _m_pfnacc(__m64 __m1, __m64 __m2) { 139 return (__m64)__builtin_ia32_pfnacc((__v2sf)__m1, (__v2sf)__m2); 140 } 141 142 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 143 _m_pfpnacc(__m64 __m1, __m64 __m2) { 144 return (__m64)__builtin_ia32_pfpnacc((__v2sf)__m1, (__v2sf)__m2); 145 } 146 147 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 148 _m_pi2fw(__m64 __m) { 149 return (__m64)__builtin_ia32_pi2fw((__v2si)__m); 150 } 151 152 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 153 _m_pswapdsf(__m64 __m) { 154 return (__m64)__builtin_ia32_pswapdsf((__v2sf)__m); 155 } 156 157 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) 158 _m_pswapdsi(__m64 __m) { 159 return (__m64)__builtin_ia32_pswapdsi((__v2si)__m); 160 } 161 162 #endif 163