1 /* Copyright (C) 2004-2013 Free Software Foundation, Inc.
2 
3    This file is part of GCC.
4 
5    GCC is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3, or (at your option)
8    any later version.
9 
10    GCC is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    Under Section 7 of GPL version 3, you are granted additional
16    permissions described in the GCC Runtime Library Exception, version
17    3.1, as published by the Free Software Foundation.
18 
19    You should have received a copy of the GNU General Public License and
20    a copy of the GCC Runtime Library Exception along with this program;
21    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22    <http://www.gnu.org/licenses/>.  */
23 
24 /* Implemented from the mm3dnow.h (of supposedly AMD origin) included with
25    MSVC 7.1.  */
26 
27 #ifndef _MM3DNOW_H_INCLUDED
28 #define _MM3DNOW_H_INCLUDED
29 
30 #ifdef __3dNOW__
31 
32 #include <mmintrin.h>
33 #include <prfchwintrin.h>
34 
35 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_femms(void)36 _m_femms (void)
37 {
38   __builtin_ia32_femms();
39 }
40 
41 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pavgusb(__m64 __A,__m64 __B)42 _m_pavgusb (__m64 __A, __m64 __B)
43 {
44   return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B);
45 }
46 
47 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pf2id(__m64 __A)48 _m_pf2id (__m64 __A)
49 {
50   return (__m64)__builtin_ia32_pf2id ((__v2sf)__A);
51 }
52 
53 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfacc(__m64 __A,__m64 __B)54 _m_pfacc (__m64 __A, __m64 __B)
55 {
56   return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B);
57 }
58 
59 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfadd(__m64 __A,__m64 __B)60 _m_pfadd (__m64 __A, __m64 __B)
61 {
62   return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B);
63 }
64 
65 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfcmpeq(__m64 __A,__m64 __B)66 _m_pfcmpeq (__m64 __A, __m64 __B)
67 {
68   return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B);
69 }
70 
71 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfcmpge(__m64 __A,__m64 __B)72 _m_pfcmpge (__m64 __A, __m64 __B)
73 {
74   return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B);
75 }
76 
77 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfcmpgt(__m64 __A,__m64 __B)78 _m_pfcmpgt (__m64 __A, __m64 __B)
79 {
80   return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B);
81 }
82 
83 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfmax(__m64 __A,__m64 __B)84 _m_pfmax (__m64 __A, __m64 __B)
85 {
86   return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B);
87 }
88 
89 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfmin(__m64 __A,__m64 __B)90 _m_pfmin (__m64 __A, __m64 __B)
91 {
92   return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B);
93 }
94 
95 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfmul(__m64 __A,__m64 __B)96 _m_pfmul (__m64 __A, __m64 __B)
97 {
98   return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B);
99 }
100 
101 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfrcp(__m64 __A)102 _m_pfrcp (__m64 __A)
103 {
104   return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A);
105 }
106 
107 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfrcpit1(__m64 __A,__m64 __B)108 _m_pfrcpit1 (__m64 __A, __m64 __B)
109 {
110   return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B);
111 }
112 
113 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfrcpit2(__m64 __A,__m64 __B)114 _m_pfrcpit2 (__m64 __A, __m64 __B)
115 {
116   return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B);
117 }
118 
119 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfrsqrt(__m64 __A)120 _m_pfrsqrt (__m64 __A)
121 {
122   return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A);
123 }
124 
125 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfrsqit1(__m64 __A,__m64 __B)126 _m_pfrsqit1 (__m64 __A, __m64 __B)
127 {
128   return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B);
129 }
130 
131 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfsub(__m64 __A,__m64 __B)132 _m_pfsub (__m64 __A, __m64 __B)
133 {
134   return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B);
135 }
136 
137 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfsubr(__m64 __A,__m64 __B)138 _m_pfsubr (__m64 __A, __m64 __B)
139 {
140   return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B);
141 }
142 
143 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pi2fd(__m64 __A)144 _m_pi2fd (__m64 __A)
145 {
146   return (__m64)__builtin_ia32_pi2fd ((__v2si)__A);
147 }
148 
149 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pmulhrw(__m64 __A,__m64 __B)150 _m_pmulhrw (__m64 __A, __m64 __B)
151 {
152   return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B);
153 }
154 
155 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_prefetch(void * __P)156 _m_prefetch (void *__P)
157 {
158   __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
159 }
160 
161 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_from_float(float __A)162 _m_from_float (float __A)
163 {
164   return __extension__ (__m64)(__v2sf){ __A, 0.0f };
165 }
166 
167 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_to_float(__m64 __A)168 _m_to_float (__m64 __A)
169 {
170   union { __v2sf v; float a[2]; } __tmp;
171   __tmp.v = (__v2sf)__A;
172   return __tmp.a[0];
173 }
174 
175 #ifdef __3dNOW_A__
176 
177 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pf2iw(__m64 __A)178 _m_pf2iw (__m64 __A)
179 {
180   return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A);
181 }
182 
183 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfnacc(__m64 __A,__m64 __B)184 _m_pfnacc (__m64 __A, __m64 __B)
185 {
186   return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B);
187 }
188 
189 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pfpnacc(__m64 __A,__m64 __B)190 _m_pfpnacc (__m64 __A, __m64 __B)
191 {
192   return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B);
193 }
194 
195 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pi2fw(__m64 __A)196 _m_pi2fw (__m64 __A)
197 {
198   return (__m64)__builtin_ia32_pi2fw ((__v2si)__A);
199 }
200 
201 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_m_pswapd(__m64 __A)202 _m_pswapd (__m64 __A)
203 {
204   return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A);
205 }
206 
207 #endif /* __3dNOW_A__ */
208 #endif /* __3dNOW__ */
209 
210 #endif /* _MM3DNOW_H_INCLUDED */
211