2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / config / i386 / mm3dnow.h
blob96056e28e3190c94f472d3b17d250a82a58ce9ef
1 /* Copyright (C) 2004, 2007 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 2, 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 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING. If not, write to
17 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. */
20 /* As a special exception, if you include this header file into source
21 files compiled by GCC, this header file does not by itself cause
22 the resulting executable to be covered by the GNU General Public
23 License. This exception does not however invalidate any other
24 reasons why the executable file might be covered by the GNU General
25 Public License. */
27 /* Implemented from the mm3dnow.h (of supposedly AMD origin) included with
28 MSVC 7.1. */
30 #ifndef _MM3DNOW_H_INCLUDED
31 #define _MM3DNOW_H_INCLUDED
33 #ifdef __3dNOW__
35 #include <mmintrin.h>
37 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
38 _m_femms (void)
40 __builtin_ia32_femms();
43 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
44 _m_pavgusb (__m64 __A, __m64 __B)
46 return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B);
49 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
50 _m_pf2id (__m64 __A)
52 return (__m64)__builtin_ia32_pf2id ((__v2sf)__A);
55 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
56 _m_pfacc (__m64 __A, __m64 __B)
58 return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B);
61 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
62 _m_pfadd (__m64 __A, __m64 __B)
64 return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B);
67 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
68 _m_pfcmpeq (__m64 __A, __m64 __B)
70 return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B);
73 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
74 _m_pfcmpge (__m64 __A, __m64 __B)
76 return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B);
79 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
80 _m_pfcmpgt (__m64 __A, __m64 __B)
82 return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B);
85 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
86 _m_pfmax (__m64 __A, __m64 __B)
88 return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B);
91 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
92 _m_pfmin (__m64 __A, __m64 __B)
94 return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B);
97 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
98 _m_pfmul (__m64 __A, __m64 __B)
100 return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B);
103 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
104 _m_pfrcp (__m64 __A)
106 return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A);
109 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
110 _m_pfrcpit1 (__m64 __A, __m64 __B)
112 return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B);
115 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
116 _m_pfrcpit2 (__m64 __A, __m64 __B)
118 return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B);
121 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
122 _m_pfrsqrt (__m64 __A)
124 return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A);
127 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
128 _m_pfrsqit1 (__m64 __A, __m64 __B)
130 return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B);
133 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
134 _m_pfsub (__m64 __A, __m64 __B)
136 return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B);
139 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
140 _m_pfsubr (__m64 __A, __m64 __B)
142 return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B);
145 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
146 _m_pi2fd (__m64 __A)
148 return (__m64)__builtin_ia32_pi2fd ((__v2si)__A);
151 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
152 _m_pmulhrw (__m64 __A, __m64 __B)
154 return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B);
157 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
158 _m_prefetch (void *__P)
160 __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
163 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
164 _m_prefetchw (void *__P)
166 __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
169 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
170 _m_from_float (float __A)
172 return __extension__ (__m64)(__v2sf){ __A, 0.0f };
175 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
176 _m_to_float (__m64 __A)
178 union { __v2sf v; float a[2]; } __tmp;
179 __tmp.v = (__v2sf)__A;
180 return __tmp.a[0];
183 #ifdef __3dNOW_A__
185 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
186 _m_pf2iw (__m64 __A)
188 return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A);
191 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
192 _m_pfnacc (__m64 __A, __m64 __B)
194 return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B);
197 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
198 _m_pfpnacc (__m64 __A, __m64 __B)
200 return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B);
203 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
204 _m_pi2fw (__m64 __A)
206 return (__m64)__builtin_ia32_pi2fw ((__v2si)__A);
209 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
210 _m_pswapd (__m64 __A)
212 return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A);
215 #endif /* __3dNOW_A__ */
216 #endif /* __3dNOW__ */
218 #endif /* _MM3DNOW_H_INCLUDED */