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