| 1 |
/* Copyright (C) 2004-2015 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 |
#include <mmintrin.h> |
| 31 |
#include <prfchwintrin.h> |
| 32 |
|
| 33 |
#ifndef __3dNOW__ |
| 34 |
#pragma GCC push_options |
| 35 |
#pragma GCC target("3dnow") |
| 36 |
#define __DISABLE_3dNOW__ |
| 37 |
#endif /* __3dNOW__ */ |
| 38 |
|
| 39 |
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 40 |
_m_femms (void) |
| 41 |
{ |
| 42 |
__builtin_ia32_femms(); |
| 43 |
} |
| 44 |
|
| 45 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 46 |
_m_pavgusb (__m64 __A, __m64 __B) |
| 47 |
{ |
| 48 |
return (__m64)__builtin_ia32_pavgusb ((__v8qi)__A, (__v8qi)__B); |
| 49 |
} |
| 50 |
|
| 51 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 52 |
_m_pf2id (__m64 __A) |
| 53 |
{ |
| 54 |
return (__m64)__builtin_ia32_pf2id ((__v2sf)__A); |
| 55 |
} |
| 56 |
|
| 57 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 58 |
_m_pfacc (__m64 __A, __m64 __B) |
| 59 |
{ |
| 60 |
return (__m64)__builtin_ia32_pfacc ((__v2sf)__A, (__v2sf)__B); |
| 61 |
} |
| 62 |
|
| 63 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 64 |
_m_pfadd (__m64 __A, __m64 __B) |
| 65 |
{ |
| 66 |
return (__m64)__builtin_ia32_pfadd ((__v2sf)__A, (__v2sf)__B); |
| 67 |
} |
| 68 |
|
| 69 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 70 |
_m_pfcmpeq (__m64 __A, __m64 __B) |
| 71 |
{ |
| 72 |
return (__m64)__builtin_ia32_pfcmpeq ((__v2sf)__A, (__v2sf)__B); |
| 73 |
} |
| 74 |
|
| 75 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 76 |
_m_pfcmpge (__m64 __A, __m64 __B) |
| 77 |
{ |
| 78 |
return (__m64)__builtin_ia32_pfcmpge ((__v2sf)__A, (__v2sf)__B); |
| 79 |
} |
| 80 |
|
| 81 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 82 |
_m_pfcmpgt (__m64 __A, __m64 __B) |
| 83 |
{ |
| 84 |
return (__m64)__builtin_ia32_pfcmpgt ((__v2sf)__A, (__v2sf)__B); |
| 85 |
} |
| 86 |
|
| 87 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 88 |
_m_pfmax (__m64 __A, __m64 __B) |
| 89 |
{ |
| 90 |
return (__m64)__builtin_ia32_pfmax ((__v2sf)__A, (__v2sf)__B); |
| 91 |
} |
| 92 |
|
| 93 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 94 |
_m_pfmin (__m64 __A, __m64 __B) |
| 95 |
{ |
| 96 |
return (__m64)__builtin_ia32_pfmin ((__v2sf)__A, (__v2sf)__B); |
| 97 |
} |
| 98 |
|
| 99 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 100 |
_m_pfmul (__m64 __A, __m64 __B) |
| 101 |
{ |
| 102 |
return (__m64)__builtin_ia32_pfmul ((__v2sf)__A, (__v2sf)__B); |
| 103 |
} |
| 104 |
|
| 105 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 106 |
_m_pfrcp (__m64 __A) |
| 107 |
{ |
| 108 |
return (__m64)__builtin_ia32_pfrcp ((__v2sf)__A); |
| 109 |
} |
| 110 |
|
| 111 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 112 |
_m_pfrcpit1 (__m64 __A, __m64 __B) |
| 113 |
{ |
| 114 |
return (__m64)__builtin_ia32_pfrcpit1 ((__v2sf)__A, (__v2sf)__B); |
| 115 |
} |
| 116 |
|
| 117 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 118 |
_m_pfrcpit2 (__m64 __A, __m64 __B) |
| 119 |
{ |
| 120 |
return (__m64)__builtin_ia32_pfrcpit2 ((__v2sf)__A, (__v2sf)__B); |
| 121 |
} |
| 122 |
|
| 123 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 124 |
_m_pfrsqrt (__m64 __A) |
| 125 |
{ |
| 126 |
return (__m64)__builtin_ia32_pfrsqrt ((__v2sf)__A); |
| 127 |
} |
| 128 |
|
| 129 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 130 |
_m_pfrsqit1 (__m64 __A, __m64 __B) |
| 131 |
{ |
| 132 |
return (__m64)__builtin_ia32_pfrsqit1 ((__v2sf)__A, (__v2sf)__B); |
| 133 |
} |
| 134 |
|
| 135 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 136 |
_m_pfsub (__m64 __A, __m64 __B) |
| 137 |
{ |
| 138 |
return (__m64)__builtin_ia32_pfsub ((__v2sf)__A, (__v2sf)__B); |
| 139 |
} |
| 140 |
|
| 141 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 142 |
_m_pfsubr (__m64 __A, __m64 __B) |
| 143 |
{ |
| 144 |
return (__m64)__builtin_ia32_pfsubr ((__v2sf)__A, (__v2sf)__B); |
| 145 |
} |
| 146 |
|
| 147 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 148 |
_m_pi2fd (__m64 __A) |
| 149 |
{ |
| 150 |
return (__m64)__builtin_ia32_pi2fd ((__v2si)__A); |
| 151 |
} |
| 152 |
|
| 153 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 154 |
_m_pmulhrw (__m64 __A, __m64 __B) |
| 155 |
{ |
| 156 |
return (__m64)__builtin_ia32_pmulhrw ((__v4hi)__A, (__v4hi)__B); |
| 157 |
} |
| 158 |
|
| 159 |
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 160 |
_m_prefetch (void *__P) |
| 161 |
{ |
| 162 |
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); |
| 163 |
} |
| 164 |
|
| 165 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 166 |
_m_from_float (float __A) |
| 167 |
{ |
| 168 |
return __extension__ (__m64)(__v2sf){ __A, 0.0f }; |
| 169 |
} |
| 170 |
|
| 171 |
extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 172 |
_m_to_float (__m64 __A) |
| 173 |
{ |
| 174 |
union { __v2sf v; float a[2]; } __tmp; |
| 175 |
__tmp.v = (__v2sf)__A; |
| 176 |
return __tmp.a[0]; |
| 177 |
} |
| 178 |
|
| 179 |
#ifdef __3dNOW_A__ |
| 180 |
|
| 181 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 182 |
_m_pf2iw (__m64 __A) |
| 183 |
{ |
| 184 |
return (__m64)__builtin_ia32_pf2iw ((__v2sf)__A); |
| 185 |
} |
| 186 |
|
| 187 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 188 |
_m_pfnacc (__m64 __A, __m64 __B) |
| 189 |
{ |
| 190 |
return (__m64)__builtin_ia32_pfnacc ((__v2sf)__A, (__v2sf)__B); |
| 191 |
} |
| 192 |
|
| 193 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 194 |
_m_pfpnacc (__m64 __A, __m64 __B) |
| 195 |
{ |
| 196 |
return (__m64)__builtin_ia32_pfpnacc ((__v2sf)__A, (__v2sf)__B); |
| 197 |
} |
| 198 |
|
| 199 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 200 |
_m_pi2fw (__m64 __A) |
| 201 |
{ |
| 202 |
return (__m64)__builtin_ia32_pi2fw ((__v2si)__A); |
| 203 |
} |
| 204 |
|
| 205 |
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) |
| 206 |
_m_pswapd (__m64 __A) |
| 207 |
{ |
| 208 |
return (__m64)__builtin_ia32_pswapdsf ((__v2sf)__A); |
| 209 |
} |
| 210 |
|
| 211 |
#endif /* __3dNOW_A__ */ |
| 212 |
|
| 213 |
#ifdef __DISABLE_3dNOW__ |
| 214 |
#undef __DISABLE_3dNOW__ |
| 215 |
#pragma GCC pop_options |
| 216 |
#endif /* __DISABLE_3dNOW__ */ |
| 217 |
|
| 218 |
#endif /* _MM3DNOW_H_INCLUDED */ |