1 |
12 |
jlechner |
/* PowerPC AltiVec include file.
|
2 |
|
|
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Aldy Hernandez (aldyh@redhat.com).
|
4 |
|
|
Rewritten by Paolo Bonzini (bonzini@gnu.org).
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC is free software; you can redistribute it and/or modify it
|
9 |
|
|
under the terms of the GNU General Public License as published
|
10 |
|
|
by the Free Software Foundation; either version 2, or (at your
|
11 |
|
|
option) any later version.
|
12 |
|
|
|
13 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
14 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
15 |
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
16 |
|
|
License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GCC; see the file COPYING. If not, write to the
|
20 |
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
|
21 |
|
|
MA 02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
/* As a special exception, if you include this header file into source
|
24 |
|
|
files compiled by GCC, this header file does not by itself cause
|
25 |
|
|
the resulting executable to be covered by the GNU General Public
|
26 |
|
|
License. This exception does not however invalidate any other
|
27 |
|
|
reasons why the executable file might be covered by the GNU General
|
28 |
|
|
Public License. */
|
29 |
|
|
|
30 |
|
|
/* Implemented to conform to the specification included in the AltiVec
|
31 |
|
|
Technology Programming Interface Manual (ALTIVECPIM/D 6/1999 Rev 0). */
|
32 |
|
|
|
33 |
|
|
#ifndef _ALTIVEC_H
|
34 |
|
|
#define _ALTIVEC_H 1
|
35 |
|
|
|
36 |
|
|
#if !defined(__VEC__) || !defined(__ALTIVEC__)
|
37 |
|
|
#error Use the "-maltivec" flag to enable PowerPC AltiVec support
|
38 |
|
|
#endif
|
39 |
|
|
|
40 |
|
|
/* If __APPLE_ALTIVEC__ is defined, the compiler supports 'vector',
|
41 |
|
|
'pixel' and 'bool' as context-sensitive AltiVec keywords (in
|
42 |
|
|
non-AltiVec contexts, they revert to their original meanings,
|
43 |
|
|
if any), so we do not need to define them as macros. */
|
44 |
|
|
|
45 |
|
|
#if !defined(__APPLE_ALTIVEC__)
|
46 |
|
|
/* You are allowed to undef these for C++ compatibility. */
|
47 |
|
|
#define vector __vector
|
48 |
|
|
#define pixel __pixel
|
49 |
|
|
#define bool __bool
|
50 |
|
|
#endif
|
51 |
|
|
|
52 |
|
|
/* Condition register codes for AltiVec predicates. */
|
53 |
|
|
|
54 |
|
|
#define __CR6_EQ 0
|
55 |
|
|
#define __CR6_EQ_REV 1
|
56 |
|
|
#define __CR6_LT 2
|
57 |
|
|
#define __CR6_LT_REV 3
|
58 |
|
|
|
59 |
|
|
/* Synonyms. */
|
60 |
|
|
#define vec_vaddcuw vec_addc
|
61 |
|
|
#define vec_vand vec_and
|
62 |
|
|
#define vec_vandc vec_andc
|
63 |
|
|
#define vec_vrfip vec_ceil
|
64 |
|
|
#define vec_vcmpbfp vec_cmpb
|
65 |
|
|
#define vec_vcmpgefp vec_cmpge
|
66 |
|
|
#define vec_vctsxs vec_cts
|
67 |
|
|
#define vec_vctuxs vec_ctu
|
68 |
|
|
#define vec_vexptefp vec_expte
|
69 |
|
|
#define vec_vrfim vec_floor
|
70 |
|
|
#define vec_lvx vec_ld
|
71 |
|
|
#define vec_lvxl vec_ldl
|
72 |
|
|
#define vec_vlogefp vec_loge
|
73 |
|
|
#define vec_vmaddfp vec_madd
|
74 |
|
|
#define vec_vmhaddshs vec_madds
|
75 |
|
|
#define vec_vmladduhm vec_mladd
|
76 |
|
|
#define vec_vmhraddshs vec_mradds
|
77 |
|
|
#define vec_vnmsubfp vec_nmsub
|
78 |
|
|
#define vec_vnor vec_nor
|
79 |
|
|
#define vec_vor vec_or
|
80 |
|
|
#define vec_vpkpx vec_packpx
|
81 |
|
|
#define vec_vperm vec_perm
|
82 |
|
|
#define vec_vrefp vec_re
|
83 |
|
|
#define vec_vrfin vec_round
|
84 |
|
|
#define vec_vrsqrtefp vec_rsqrte
|
85 |
|
|
#define vec_vsel vec_sel
|
86 |
|
|
#define vec_vsldoi vec_sld
|
87 |
|
|
#define vec_vsl vec_sll
|
88 |
|
|
#define vec_vslo vec_slo
|
89 |
|
|
#define vec_vspltisb vec_splat_s8
|
90 |
|
|
#define vec_vspltish vec_splat_s16
|
91 |
|
|
#define vec_vspltisw vec_splat_s32
|
92 |
|
|
#define vec_vsr vec_srl
|
93 |
|
|
#define vec_vsro vec_sro
|
94 |
|
|
#define vec_stvx vec_st
|
95 |
|
|
#define vec_stvxl vec_stl
|
96 |
|
|
#define vec_vsubcuw vec_subc
|
97 |
|
|
#define vec_vsum2sws vec_sum2s
|
98 |
|
|
#define vec_vsumsws vec_sums
|
99 |
|
|
#define vec_vrfiz vec_trunc
|
100 |
|
|
#define vec_vxor vec_xor
|
101 |
|
|
|
102 |
|
|
/* Functions that are resolved by the backend to one of the
|
103 |
|
|
typed builtins. */
|
104 |
|
|
#define vec_vaddfp __builtin_vec_vaddfp
|
105 |
|
|
#define vec_addc __builtin_vec_addc
|
106 |
|
|
#define vec_vaddsws __builtin_vec_vaddsws
|
107 |
|
|
#define vec_vaddshs __builtin_vec_vaddshs
|
108 |
|
|
#define vec_vaddsbs __builtin_vec_vaddsbs
|
109 |
|
|
#define vec_vavgsw __builtin_vec_vavgsw
|
110 |
|
|
#define vec_vavguw __builtin_vec_vavguw
|
111 |
|
|
#define vec_vavgsh __builtin_vec_vavgsh
|
112 |
|
|
#define vec_vavguh __builtin_vec_vavguh
|
113 |
|
|
#define vec_vavgsb __builtin_vec_vavgsb
|
114 |
|
|
#define vec_vavgub __builtin_vec_vavgub
|
115 |
|
|
#define vec_ceil __builtin_vec_ceil
|
116 |
|
|
#define vec_cmpb __builtin_vec_cmpb
|
117 |
|
|
#define vec_vcmpeqfp __builtin_vec_vcmpeqfp
|
118 |
|
|
#define vec_cmpge __builtin_vec_cmpge
|
119 |
|
|
#define vec_vcmpgtfp __builtin_vec_vcmpgtfp
|
120 |
|
|
#define vec_vcmpgtsw __builtin_vec_vcmpgtsw
|
121 |
|
|
#define vec_vcmpgtuw __builtin_vec_vcmpgtuw
|
122 |
|
|
#define vec_vcmpgtsh __builtin_vec_vcmpgtsh
|
123 |
|
|
#define vec_vcmpgtuh __builtin_vec_vcmpgtuh
|
124 |
|
|
#define vec_vcmpgtsb __builtin_vec_vcmpgtsb
|
125 |
|
|
#define vec_vcmpgtub __builtin_vec_vcmpgtub
|
126 |
|
|
#define vec_vcfsx __builtin_vec_vcfsx
|
127 |
|
|
#define vec_vcfux __builtin_vec_vcfux
|
128 |
|
|
#define vec_cts __builtin_vec_cts
|
129 |
|
|
#define vec_ctu __builtin_vec_ctu
|
130 |
|
|
#define vec_expte __builtin_vec_expte
|
131 |
|
|
#define vec_floor __builtin_vec_floor
|
132 |
|
|
#define vec_loge __builtin_vec_loge
|
133 |
|
|
#define vec_madd __builtin_vec_madd
|
134 |
|
|
#define vec_madds __builtin_vec_madds
|
135 |
|
|
#define vec_mtvscr __builtin_vec_mtvscr
|
136 |
|
|
#define vec_vmaxfp __builtin_vec_vmaxfp
|
137 |
|
|
#define vec_vmaxsw __builtin_vec_vmaxsw
|
138 |
|
|
#define vec_vmaxsh __builtin_vec_vmaxsh
|
139 |
|
|
#define vec_vmaxsb __builtin_vec_vmaxsb
|
140 |
|
|
#define vec_vminfp __builtin_vec_vminfp
|
141 |
|
|
#define vec_vminsw __builtin_vec_vminsw
|
142 |
|
|
#define vec_vminsh __builtin_vec_vminsh
|
143 |
|
|
#define vec_vminsb __builtin_vec_vminsb
|
144 |
|
|
#define vec_mradds __builtin_vec_mradds
|
145 |
|
|
#define vec_vmsumshm __builtin_vec_vmsumshm
|
146 |
|
|
#define vec_vmsumuhm __builtin_vec_vmsumuhm
|
147 |
|
|
#define vec_vmsummbm __builtin_vec_vmsummbm
|
148 |
|
|
#define vec_vmsumubm __builtin_vec_vmsumubm
|
149 |
|
|
#define vec_vmsumshs __builtin_vec_vmsumshs
|
150 |
|
|
#define vec_vmsumuhs __builtin_vec_vmsumuhs
|
151 |
|
|
#define vec_vmulesb __builtin_vec_vmulesb
|
152 |
|
|
#define vec_vmulesh __builtin_vec_vmulesh
|
153 |
|
|
#define vec_vmuleuh __builtin_vec_vmuleuh
|
154 |
|
|
#define vec_vmuleub __builtin_vec_vmuleub
|
155 |
|
|
#define vec_vmulosh __builtin_vec_vmulosh
|
156 |
|
|
#define vec_vmulouh __builtin_vec_vmulouh
|
157 |
|
|
#define vec_vmulosb __builtin_vec_vmulosb
|
158 |
|
|
#define vec_vmuloub __builtin_vec_vmuloub
|
159 |
|
|
#define vec_nmsub __builtin_vec_nmsub
|
160 |
|
|
#define vec_packpx __builtin_vec_packpx
|
161 |
|
|
#define vec_vpkswss __builtin_vec_vpkswss
|
162 |
|
|
#define vec_vpkuwus __builtin_vec_vpkuwus
|
163 |
|
|
#define vec_vpkshss __builtin_vec_vpkshss
|
164 |
|
|
#define vec_vpkuhus __builtin_vec_vpkuhus
|
165 |
|
|
#define vec_vpkswus __builtin_vec_vpkswus
|
166 |
|
|
#define vec_vpkshus __builtin_vec_vpkshus
|
167 |
|
|
#define vec_re __builtin_vec_re
|
168 |
|
|
#define vec_round __builtin_vec_round
|
169 |
|
|
#define vec_rsqrte __builtin_vec_rsqrte
|
170 |
|
|
#define vec_vsubfp __builtin_vec_vsubfp
|
171 |
|
|
#define vec_subc __builtin_vec_subc
|
172 |
|
|
#define vec_vsubsws __builtin_vec_vsubsws
|
173 |
|
|
#define vec_vsubshs __builtin_vec_vsubshs
|
174 |
|
|
#define vec_vsubsbs __builtin_vec_vsubsbs
|
175 |
|
|
#define vec_sum4s __builtin_vec_sum4s
|
176 |
|
|
#define vec_vsum4shs __builtin_vec_vsum4shs
|
177 |
|
|
#define vec_vsum4sbs __builtin_vec_vsum4sbs
|
178 |
|
|
#define vec_vsum4ubs __builtin_vec_vsum4ubs
|
179 |
|
|
#define vec_sum2s __builtin_vec_sum2s
|
180 |
|
|
#define vec_sums __builtin_vec_sums
|
181 |
|
|
#define vec_trunc __builtin_vec_trunc
|
182 |
|
|
#define vec_vupkhpx __builtin_vec_vupkhpx
|
183 |
|
|
#define vec_vupkhsh __builtin_vec_vupkhsh
|
184 |
|
|
#define vec_vupkhsb __builtin_vec_vupkhsb
|
185 |
|
|
#define vec_vupklpx __builtin_vec_vupklpx
|
186 |
|
|
#define vec_vupklsh __builtin_vec_vupklsh
|
187 |
|
|
#define vec_vupklsb __builtin_vec_vupklsb
|
188 |
|
|
#define vec_abs __builtin_vec_abs
|
189 |
|
|
#define vec_abss __builtin_vec_abss
|
190 |
|
|
#define vec_add __builtin_vec_add
|
191 |
|
|
#define vec_adds __builtin_vec_adds
|
192 |
|
|
#define vec_and __builtin_vec_and
|
193 |
|
|
#define vec_andc __builtin_vec_andc
|
194 |
|
|
#define vec_avg __builtin_vec_avg
|
195 |
|
|
#define vec_cmpeq __builtin_vec_cmpeq
|
196 |
|
|
#define vec_cmpgt __builtin_vec_cmpgt
|
197 |
|
|
#define vec_ctf __builtin_vec_ctf
|
198 |
|
|
#define vec_dst __builtin_vec_dst
|
199 |
|
|
#define vec_dstst __builtin_vec_dstst
|
200 |
|
|
#define vec_dststt __builtin_vec_dststt
|
201 |
|
|
#define vec_dstt __builtin_vec_dstt
|
202 |
|
|
#define vec_ld __builtin_vec_ld
|
203 |
|
|
#define vec_lde __builtin_vec_lde
|
204 |
|
|
#define vec_ldl __builtin_vec_ldl
|
205 |
|
|
#define vec_lvebx __builtin_vec_lvebx
|
206 |
|
|
#define vec_lvehx __builtin_vec_lvehx
|
207 |
|
|
#define vec_lvewx __builtin_vec_lvewx
|
208 |
|
|
#define vec_lvsl __builtin_vec_lvsl
|
209 |
|
|
#define vec_lvsr __builtin_vec_lvsr
|
210 |
|
|
#define vec_max __builtin_vec_max
|
211 |
|
|
#define vec_mergeh __builtin_vec_mergeh
|
212 |
|
|
#define vec_mergel __builtin_vec_mergel
|
213 |
|
|
#define vec_min __builtin_vec_min
|
214 |
|
|
#define vec_mladd __builtin_vec_mladd
|
215 |
|
|
#define vec_msum __builtin_vec_msum
|
216 |
|
|
#define vec_msums __builtin_vec_msums
|
217 |
|
|
#define vec_mule __builtin_vec_mule
|
218 |
|
|
#define vec_mulo __builtin_vec_mulo
|
219 |
|
|
#define vec_nor __builtin_vec_nor
|
220 |
|
|
#define vec_or __builtin_vec_or
|
221 |
|
|
#define vec_pack __builtin_vec_pack
|
222 |
|
|
#define vec_packs __builtin_vec_packs
|
223 |
|
|
#define vec_packsu __builtin_vec_packsu
|
224 |
|
|
#define vec_perm __builtin_vec_perm
|
225 |
|
|
#define vec_rl __builtin_vec_rl
|
226 |
|
|
#define vec_sel __builtin_vec_sel
|
227 |
|
|
#define vec_sl __builtin_vec_sl
|
228 |
|
|
#define vec_sld __builtin_vec_sld
|
229 |
|
|
#define vec_sll __builtin_vec_sll
|
230 |
|
|
#define vec_slo __builtin_vec_slo
|
231 |
|
|
#define vec_splat __builtin_vec_splat
|
232 |
|
|
#define vec_sr __builtin_vec_sr
|
233 |
|
|
#define vec_sra __builtin_vec_sra
|
234 |
|
|
#define vec_srl __builtin_vec_srl
|
235 |
|
|
#define vec_sro __builtin_vec_sro
|
236 |
|
|
#define vec_st __builtin_vec_st
|
237 |
|
|
#define vec_ste __builtin_vec_ste
|
238 |
|
|
#define vec_stl __builtin_vec_stl
|
239 |
|
|
#define vec_stvebx __builtin_vec_stvebx
|
240 |
|
|
#define vec_stvehx __builtin_vec_stvehx
|
241 |
|
|
#define vec_stvewx __builtin_vec_stvewx
|
242 |
|
|
#define vec_sub __builtin_vec_sub
|
243 |
|
|
#define vec_subs __builtin_vec_subs
|
244 |
|
|
#define vec_sum __builtin_vec_sum
|
245 |
|
|
#define vec_unpackh __builtin_vec_unpackh
|
246 |
|
|
#define vec_unpackl __builtin_vec_unpackl
|
247 |
|
|
#define vec_vaddubm __builtin_vec_vaddubm
|
248 |
|
|
#define vec_vaddubs __builtin_vec_vaddubs
|
249 |
|
|
#define vec_vadduhm __builtin_vec_vadduhm
|
250 |
|
|
#define vec_vadduhs __builtin_vec_vadduhs
|
251 |
|
|
#define vec_vadduwm __builtin_vec_vadduwm
|
252 |
|
|
#define vec_vadduws __builtin_vec_vadduws
|
253 |
|
|
#define vec_vcmpequb __builtin_vec_vcmpequb
|
254 |
|
|
#define vec_vcmpequh __builtin_vec_vcmpequh
|
255 |
|
|
#define vec_vcmpequw __builtin_vec_vcmpequw
|
256 |
|
|
#define vec_vmaxub __builtin_vec_vmaxub
|
257 |
|
|
#define vec_vmaxuh __builtin_vec_vmaxuh
|
258 |
|
|
#define vec_vmaxuw __builtin_vec_vmaxuw
|
259 |
|
|
#define vec_vminub __builtin_vec_vminub
|
260 |
|
|
#define vec_vminuh __builtin_vec_vminuh
|
261 |
|
|
#define vec_vminuw __builtin_vec_vminuw
|
262 |
|
|
#define vec_vmrghb __builtin_vec_vmrghb
|
263 |
|
|
#define vec_vmrghh __builtin_vec_vmrghh
|
264 |
|
|
#define vec_vmrghw __builtin_vec_vmrghw
|
265 |
|
|
#define vec_vmrglb __builtin_vec_vmrglb
|
266 |
|
|
#define vec_vmrglh __builtin_vec_vmrglh
|
267 |
|
|
#define vec_vmrglw __builtin_vec_vmrglw
|
268 |
|
|
#define vec_vpkuhum __builtin_vec_vpkuhum
|
269 |
|
|
#define vec_vpkuwum __builtin_vec_vpkuwum
|
270 |
|
|
#define vec_vrlb __builtin_vec_vrlb
|
271 |
|
|
#define vec_vrlh __builtin_vec_vrlh
|
272 |
|
|
#define vec_vrlw __builtin_vec_vrlw
|
273 |
|
|
#define vec_vslb __builtin_vec_vslb
|
274 |
|
|
#define vec_vslh __builtin_vec_vslh
|
275 |
|
|
#define vec_vslw __builtin_vec_vslw
|
276 |
|
|
#define vec_vspltb __builtin_vec_vspltb
|
277 |
|
|
#define vec_vsplth __builtin_vec_vsplth
|
278 |
|
|
#define vec_vspltw __builtin_vec_vspltw
|
279 |
|
|
#define vec_vsrab __builtin_vec_vsrab
|
280 |
|
|
#define vec_vsrah __builtin_vec_vsrah
|
281 |
|
|
#define vec_vsraw __builtin_vec_vsraw
|
282 |
|
|
#define vec_vsrb __builtin_vec_vsrb
|
283 |
|
|
#define vec_vsrh __builtin_vec_vsrh
|
284 |
|
|
#define vec_vsrw __builtin_vec_vsrw
|
285 |
|
|
#define vec_vsububs __builtin_vec_vsububs
|
286 |
|
|
#define vec_vsububm __builtin_vec_vsububm
|
287 |
|
|
#define vec_vsubuhm __builtin_vec_vsubuhm
|
288 |
|
|
#define vec_vsubuhs __builtin_vec_vsubuhs
|
289 |
|
|
#define vec_vsubuwm __builtin_vec_vsubuwm
|
290 |
|
|
#define vec_vsubuws __builtin_vec_vsubuws
|
291 |
|
|
#define vec_xor __builtin_vec_xor
|
292 |
|
|
|
293 |
|
|
/* Predicates.
|
294 |
|
|
For C++, we use templates in order to allow non-parenthesized arguments.
|
295 |
|
|
For C, instead, we use macros since non-parenthesized arguments were
|
296 |
|
|
not allowed even in older GCC implementation of AltiVec.
|
297 |
|
|
|
298 |
|
|
In the future, we may add more magic to the back-end, so that no
|
299 |
|
|
one- or two-argument macros are used. */
|
300 |
|
|
|
301 |
|
|
#ifdef __cplusplus__
|
302 |
|
|
#define __altivec_unary_pred(NAME, CALL) \
|
303 |
|
|
template <class T> int NAME (T a1) { return CALL; }
|
304 |
|
|
|
305 |
|
|
#define __altivec_scalar_pred(NAME, CALL) \
|
306 |
|
|
template <class T, class U> int NAME (T a1, U a2) { return CALL; }
|
307 |
|
|
|
308 |
|
|
/* Given the vec_step of a type, return the corresponding bool type. */
|
309 |
|
|
template <int STEP> class __altivec_bool_ret { };
|
310 |
|
|
template <> class __altivec_bool_ret <4> {
|
311 |
|
|
typedef __vector __bool int __ret;
|
312 |
|
|
};
|
313 |
|
|
template <> class __altivec_bool_ret <8> {
|
314 |
|
|
typedef __vector __bool short __ret;
|
315 |
|
|
};
|
316 |
|
|
template <> class __altivec_bool_ret <16> {
|
317 |
|
|
typedef __vector __bool char __ret;
|
318 |
|
|
};
|
319 |
|
|
|
320 |
|
|
/* Be very liberal in the pairs we accept. Mistakes such as passing
|
321 |
|
|
a `vector char' and `vector short' will be caught by the middle-end,
|
322 |
|
|
while any attempt to detect them here would produce hard to understand
|
323 |
|
|
error messages involving the implementation details of AltiVec. */
|
324 |
|
|
#define __altivec_binary_pred(NAME, CALL) \
|
325 |
|
|
template <class T, class U> \
|
326 |
|
|
typename __altivec_bool_ret <vec_step (T)>::__ret \
|
327 |
|
|
NAME (T a1, U a2) \
|
328 |
|
|
{ \
|
329 |
|
|
return CALL; \
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
__altivec_binary_pred(vec_cmplt,
|
333 |
|
|
__builtin_vec_cmpgt (a2, a1))
|
334 |
|
|
__altivec_binary_pred(vec_cmple,
|
335 |
|
|
__builtin_altivec_cmpge (a2, a1))
|
336 |
|
|
|
337 |
|
|
__altivec_scalar_pred(vec_all_in,
|
338 |
|
|
__builtin_altivec_vcmpbfp_p (__CR6_EQ, a1, a2))
|
339 |
|
|
__altivec_scalar_pred(vec_any_out,
|
340 |
|
|
__builtin_altivec_vcmpbfp_p (__CR6_EQ_REV, a1, a2))
|
341 |
|
|
|
342 |
|
|
__altivec_unary_pred(vec_all_nan,
|
343 |
|
|
__builtin_altivec_vcmpeqfp_p (__CR6_EQ, a1, a1))
|
344 |
|
|
__altivec_unary_pred(vec_any_nan,
|
345 |
|
|
__builtin_altivec_vcmpeqfp_p (__CR6_LT_REV, a1, a1))
|
346 |
|
|
|
347 |
|
|
__altivec_unary_pred(vec_all_numeric,
|
348 |
|
|
__builtin_altivec_vcmpeqfp_p (__CR6_LT, a1, a1))
|
349 |
|
|
__altivec_unary_pred(vec_any_numeric,
|
350 |
|
|
__builtin_altivec_vcmpeqfp_p (__CR6_EQ_REV, a1, a1))
|
351 |
|
|
|
352 |
|
|
__altivec_scalar_pred(vec_all_eq,
|
353 |
|
|
__builtin_vec_vcmpeq_p (__CR6_LT, a1, a2))
|
354 |
|
|
__altivec_scalar_pred(vec_all_ne,
|
355 |
|
|
__builtin_vec_vcmpeq_p (__CR6_EQ, a1, a2))
|
356 |
|
|
__altivec_scalar_pred(vec_any_eq,
|
357 |
|
|
__builtin_vec_vcmpeq_p (__CR6_EQ_REV, a1, a2))
|
358 |
|
|
__altivec_scalar_pred(vec_any_ne,
|
359 |
|
|
__builtin_vec_vcmpeq_p (__CR6_LT_REV, a1, a2))
|
360 |
|
|
|
361 |
|
|
__altivec_scalar_pred(vec_all_gt,
|
362 |
|
|
__builtin_vec_vcmpgt_p (__CR6_LT, a1, a2))
|
363 |
|
|
__altivec_scalar_pred(vec_all_lt,
|
364 |
|
|
__builtin_vec_vcmpgt_p (__CR6_LT, a2, a1))
|
365 |
|
|
__altivec_scalar_pred(vec_any_gt,
|
366 |
|
|
__builtin_vec_vcmpgt_p (__CR6_EQ_REV, a1, a2))
|
367 |
|
|
__altivec_scalar_pred(vec_any_lt,
|
368 |
|
|
__builtin_vec_vcmpgt_p (__CR6_EQ_REV, a2, a1))
|
369 |
|
|
|
370 |
|
|
__altivec_scalar_pred(vec_all_ngt,
|
371 |
|
|
__builtin_altivec_vcmpgtfp_p (__CR6_EQ, a1, a2))
|
372 |
|
|
__altivec_scalar_pred(vec_all_nlt,
|
373 |
|
|
__builtin_altivec_vcmpgtfp_p (__CR6_EQ, a2, a1))
|
374 |
|
|
__altivec_scalar_pred(vec_any_ngt,
|
375 |
|
|
__builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, a1, a2))
|
376 |
|
|
__altivec_scalar_pred(vec_any_nlt,
|
377 |
|
|
__builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, a2, a1))
|
378 |
|
|
|
379 |
|
|
/* __builtin_vec_vcmpge_p is vcmpgefp for floating-point vector types,
|
380 |
|
|
while for integer types it is converted to __builtin_vec_vcmpgt_p,
|
381 |
|
|
with inverted args and condition code. */
|
382 |
|
|
__altivec_scalar_pred(vec_all_le,
|
383 |
|
|
__builtin_vec_vcmpge_p (__CR6_LT, a2, a1))
|
384 |
|
|
__altivec_scalar_pred(vec_all_ge,
|
385 |
|
|
__builtin_vec_vcmpge_p (__CR6_LT, a1, a2))
|
386 |
|
|
__altivec_scalar_pred(vec_any_le,
|
387 |
|
|
__builtin_vec_vcmpge_p (__CR6_EQ_REV, a2, a1))
|
388 |
|
|
__altivec_scalar_pred(vec_any_ge,
|
389 |
|
|
__builtin_vec_vcmpge_p (__CR6_EQ_REV, a1, a2))
|
390 |
|
|
|
391 |
|
|
__altivec_scalar_pred(vec_all_nge,
|
392 |
|
|
__builtin_altivec_vcmpgefp_p (__CR6_EQ, a1, a2))
|
393 |
|
|
__altivec_scalar_pred(vec_all_nle,
|
394 |
|
|
__builtin_altivec_vcmpgefp_p (__CR6_EQ, a2, a1))
|
395 |
|
|
__altivec_scalar_pred(vec_any_nge,
|
396 |
|
|
__builtin_altivec_vcmpgefp_p (__CR6_LT_REV, a1, a2))
|
397 |
|
|
__altivec_scalar_pred(vec_any_nle,
|
398 |
|
|
__builtin_altivec_vcmpgefp_p (__CR6_LT_REV, a2, a1))
|
399 |
|
|
|
400 |
|
|
#undef __altivec_scalar_pred
|
401 |
|
|
#undef __altivec_unary_pred
|
402 |
|
|
#undef __altivec_binary_pred
|
403 |
|
|
#else
|
404 |
|
|
#define vec_cmplt(a1, a2) __builtin_vec_cmpgt ((a2), (a1))
|
405 |
|
|
#define vec_cmple(a1, a2) __builtin_altivec_vcmpgefp ((a2), (a1))
|
406 |
|
|
|
407 |
|
|
#define vec_all_in(a1, a2) __builtin_altivec_vcmpbfp_p (__CR6_EQ, (a1), (a2))
|
408 |
|
|
#define vec_any_out(a1, a2) __builtin_altivec_vcmpbfp_p (__CR6_EQ_REV, (a1), (a2))
|
409 |
|
|
|
410 |
|
|
#define vec_all_nan(a1) __builtin_altivec_vcmpeqfp_p (__CR6_EQ, (a1), (a1))
|
411 |
|
|
#define vec_any_nan(a1) __builtin_altivec_vcmpeqfp_p (__CR6_LT_REV, (a1), (a1))
|
412 |
|
|
|
413 |
|
|
#define vec_all_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_LT, (a1), (a1))
|
414 |
|
|
#define vec_any_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_EQ_REV, (a1), (a1))
|
415 |
|
|
|
416 |
|
|
#define vec_all_eq(a1, a2) __builtin_vec_vcmpeq_p (__CR6_LT, (a1), (a2))
|
417 |
|
|
#define vec_all_ne(a1, a2) __builtin_vec_vcmpeq_p (__CR6_EQ, (a1), (a2))
|
418 |
|
|
#define vec_any_eq(a1, a2) __builtin_vec_vcmpeq_p (__CR6_EQ_REV, (a1), (a2))
|
419 |
|
|
#define vec_any_ne(a1, a2) __builtin_vec_vcmpeq_p (__CR6_LT_REV, (a1), (a2))
|
420 |
|
|
|
421 |
|
|
#define vec_all_gt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_LT, (a1), (a2))
|
422 |
|
|
#define vec_all_lt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_LT, (a2), (a1))
|
423 |
|
|
#define vec_any_gt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ_REV, (a1), (a2))
|
424 |
|
|
#define vec_any_lt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ_REV, (a2), (a1))
|
425 |
|
|
|
426 |
|
|
#define vec_all_ngt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_EQ, (a1), (a2))
|
427 |
|
|
#define vec_all_nlt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_EQ, (a2), (a1))
|
428 |
|
|
#define vec_any_ngt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, (a1), (a2))
|
429 |
|
|
#define vec_any_nlt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, (a2), (a1))
|
430 |
|
|
|
431 |
|
|
/* __builtin_vec_vcmpge_p is vcmpgefp for floating-point vector types,
|
432 |
|
|
while for integer types it is converted to __builtin_vec_vcmpgt_p,
|
433 |
|
|
with inverted args and condition code. */
|
434 |
|
|
#define vec_all_le(a1, a2) __builtin_vec_vcmpge_p (__CR6_LT, (a2), (a1))
|
435 |
|
|
#define vec_all_ge(a1, a2) __builtin_vec_vcmpge_p (__CR6_LT, (a1), (a2))
|
436 |
|
|
#define vec_any_le(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ_REV, (a2), (a1))
|
437 |
|
|
#define vec_any_ge(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ_REV, (a1), (a2))
|
438 |
|
|
|
439 |
|
|
#define vec_all_nge(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_EQ, (a1), (a2))
|
440 |
|
|
#define vec_all_nle(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_EQ, (a2), (a1))
|
441 |
|
|
#define vec_any_nge(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, (a1), (a2))
|
442 |
|
|
#define vec_any_nle(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, (a2), (a1))
|
443 |
|
|
#endif
|
444 |
|
|
|
445 |
|
|
/* These do not accept vectors, so they do not have a __builtin_vec_*
|
446 |
|
|
counterpart. */
|
447 |
|
|
#define vec_dss(x) __builtin_altivec_dss((x))
|
448 |
|
|
#define vec_dssall() __builtin_altivec_dssall ()
|
449 |
|
|
#define vec_mfvscr() ((__vector unsigned short) __builtin_altivec_mfvscr ())
|
450 |
|
|
#define vec_splat_s8(x) __builtin_altivec_vspltisb ((x))
|
451 |
|
|
#define vec_splat_s16(x) __builtin_altivec_vspltish ((x))
|
452 |
|
|
#define vec_splat_s32(x) __builtin_altivec_vspltisw ((x))
|
453 |
|
|
#define vec_splat_u8(x) ((__vector unsigned char) vec_splat_s8 ((x)))
|
454 |
|
|
#define vec_splat_u16(x) ((__vector unsigned short) vec_splat_s16 ((x)))
|
455 |
|
|
#define vec_splat_u32(x) ((__vector unsigned int) vec_splat_s32 ((x)))
|
456 |
|
|
|
457 |
|
|
/* This also accepts a type for its parameter, so it is not enough
|
458 |
|
|
to #define vec_step to __builtin_vec_step. */
|
459 |
|
|
#define vec_step(x) __builtin_vec_step (* (__typeof__ (x) *) 0)
|
460 |
|
|
|
461 |
|
|
#endif /* _ALTIVEC_H */
|