Changelog entry:
[official-gcc.git] / gcc / config / i386 / mm3dnow.h
blobc2cc01c7f18722b799068351d5d58b66f6467753
1 /* Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
3 This file is part of GCC.
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.
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.
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.
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/>. */
24 /* Implemented from the mm3dnow.h (of supposedly AMD origin) included with
25 MSVC 7.1. */
27 #ifndef _MM3DNOW_H_INCLUDED
28 #define _MM3DNOW_H_INCLUDED
30 #ifdef __3dNOW__
32 #include <mmintrin.h>
33 #include <prfchwintrin.h>
35 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
36 _m_femms (void)
38 __builtin_ia32_femms();
41 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
42 _m_pavgusb (__m64 __A, __m64 __B)
44 return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B);
47 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
48 _m_pf2id (__m64 __A)
50 return (__m64)__builtin_ia32_pf2id ((__v2sf)__A);
53 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
54 _m_pfacc (__m64 __A, __m64 __B)
56 return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B);
59 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
60 _m_pfadd (__m64 __A, __m64 __B)
62 return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B);
65 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
66 _m_pfcmpeq (__m64 __A, __m64 __B)
68 return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B);
71 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
72 _m_pfcmpge (__m64 __A, __m64 __B)
74 return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B);
77 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
78 _m_pfcmpgt (__m64 __A, __m64 __B)
80 return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B);
83 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
84 _m_pfmax (__m64 __A, __m64 __B)
86 return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B);
89 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
90 _m_pfmin (__m64 __A, __m64 __B)
92 return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B);
95 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
96 _m_pfmul (__m64 __A, __m64 __B)
98 return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B);
101 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
102 _m_pfrcp (__m64 __A)
104 return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A);
107 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
108 _m_pfrcpit1 (__m64 __A, __m64 __B)
110 return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B);
113 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
114 _m_pfrcpit2 (__m64 __A, __m64 __B)
116 return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B);
119 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
120 _m_pfrsqrt (__m64 __A)
122 return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A);
125 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
126 _m_pfrsqit1 (__m64 __A, __m64 __B)
128 return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B);
131 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
132 _m_pfsub (__m64 __A, __m64 __B)
134 return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B);
137 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
138 _m_pfsubr (__m64 __A, __m64 __B)
140 return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B);
143 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
144 _m_pi2fd (__m64 __A)
146 return (__m64)__builtin_ia32_pi2fd ((__v2si)__A);
149 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
150 _m_pmulhrw (__m64 __A, __m64 __B)
152 return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B);
155 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
156 _m_prefetch (void *__P)
158 __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
161 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
162 _m_from_float (float __A)
164 return __extension__ (__m64)(__v2sf){ __A, 0.0f };
167 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
168 _m_to_float (__m64 __A)
170 union { __v2sf v; float a[2]; } __tmp;
171 __tmp.v = (__v2sf)__A;
172 return __tmp.a[0];
175 #ifdef __3dNOW_A__
177 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
178 _m_pf2iw (__m64 __A)
180 return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A);
183 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
184 _m_pfnacc (__m64 __A, __m64 __B)
186 return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B);
189 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
190 _m_pfpnacc (__m64 __A, __m64 __B)
192 return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B);
195 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
196 _m_pi2fw (__m64 __A)
198 return (__m64)__builtin_ia32_pi2fw ((__v2si)__A);
201 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
202 _m_pswapd (__m64 __A)
204 return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A);
207 #endif /* __3dNOW_A__ */
208 #endif /* __3dNOW__ */
210 #endif /* _MM3DNOW_H_INCLUDED */