PR preprocessor/63831
[official-gcc.git] / gcc / config / i386 / mm3dnow.h
blobbf847f939fb37d65aedd0a59581c7bb0b1aede36
1 /* Copyright (C) 2004-2014 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 #include <mmintrin.h>
31 #include <prfchwintrin.h>
33 #ifndef __3dNOW__
34 #pragma GCC push_options
35 #pragma GCC target("3dnow")
36 #define __DISABLE_3dNOW__
37 #endif /* __3dNOW__ */
39 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
40 _m_femms (void)
42 __builtin_ia32_femms();
45 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
46 _m_pavgusb (__m64 __A, __m64 __B)
48 return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B);
51 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
52 _m_pf2id (__m64 __A)
54 return (__m64)__builtin_ia32_pf2id ((__v2sf)__A);
57 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
58 _m_pfacc (__m64 __A, __m64 __B)
60 return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B);
63 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
64 _m_pfadd (__m64 __A, __m64 __B)
66 return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B);
69 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
70 _m_pfcmpeq (__m64 __A, __m64 __B)
72 return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B);
75 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
76 _m_pfcmpge (__m64 __A, __m64 __B)
78 return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B);
81 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
82 _m_pfcmpgt (__m64 __A, __m64 __B)
84 return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B);
87 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
88 _m_pfmax (__m64 __A, __m64 __B)
90 return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B);
93 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
94 _m_pfmin (__m64 __A, __m64 __B)
96 return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B);
99 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
100 _m_pfmul (__m64 __A, __m64 __B)
102 return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B);
105 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
106 _m_pfrcp (__m64 __A)
108 return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A);
111 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
112 _m_pfrcpit1 (__m64 __A, __m64 __B)
114 return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B);
117 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
118 _m_pfrcpit2 (__m64 __A, __m64 __B)
120 return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B);
123 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
124 _m_pfrsqrt (__m64 __A)
126 return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A);
129 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
130 _m_pfrsqit1 (__m64 __A, __m64 __B)
132 return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B);
135 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
136 _m_pfsub (__m64 __A, __m64 __B)
138 return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B);
141 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
142 _m_pfsubr (__m64 __A, __m64 __B)
144 return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B);
147 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
148 _m_pi2fd (__m64 __A)
150 return (__m64)__builtin_ia32_pi2fd ((__v2si)__A);
153 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
154 _m_pmulhrw (__m64 __A, __m64 __B)
156 return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B);
159 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
160 _m_prefetch (void *__P)
162 __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
165 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
166 _m_from_float (float __A)
168 return __extension__ (__m64)(__v2sf){ __A, 0.0f };
171 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
172 _m_to_float (__m64 __A)
174 union { __v2sf v; float a[2]; } __tmp;
175 __tmp.v = (__v2sf)__A;
176 return __tmp.a[0];
179 #ifdef __3dNOW_A__
181 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
182 _m_pf2iw (__m64 __A)
184 return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A);
187 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
188 _m_pfnacc (__m64 __A, __m64 __B)
190 return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B);
193 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
194 _m_pfpnacc (__m64 __A, __m64 __B)
196 return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B);
199 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
200 _m_pi2fw (__m64 __A)
202 return (__m64)__builtin_ia32_pi2fw ((__v2si)__A);
205 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
206 _m_pswapd (__m64 __A)
208 return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A);
211 #endif /* __3dNOW_A__ */
213 #ifdef __DISABLE_3dNOW__
214 #undef __DISABLE_3dNOW__
215 #pragma GCC pop_options
216 #endif /* __DISABLE_3dNOW__ */
218 #endif /* _MM3DNOW_H_INCLUDED */