1 /* Cell SPU 2 VMX intrinsics header
2 Copyright (C) 2007 Free Software Foundation, Inc.
4 This file is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This file is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this file; see the file COPYING. If not, write to the Free
16 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19 /* As a special exception, if you include this header file into source files
20 compiled by GCC, this header file does not by itself cause the resulting
21 executable to be covered by the GNU General Public License. This exception
22 does not however invalidate any other reasons why the executable file might be
23 covered by the GNU General Public License. */
34 /* spu_absd (absolute difference)
37 static __inline vec_uchar16
spu_absd(vec_uchar16 a
, vec_uchar16 b
)
39 return ((vec_uchar16
)(si_absdb((qword
)(a
), (qword
)(b
))));
47 static __inline vec_uint4
spu_add(vec_uint4 a
, vec_uint4 b
)
49 return ((vec_uint4
)(si_a((qword
)(a
), (qword
)(b
))));
52 static __inline vec_int4
spu_add(vec_int4 a
, vec_int4 b
)
54 return ((vec_int4
)(si_a((qword
)(a
), (qword
)(b
))));
57 static __inline vec_ushort8
spu_add(vec_ushort8 a
, vec_ushort8 b
)
59 return ((vec_ushort8
)(si_ah((qword
)(a
), (qword
)(b
))));
62 static __inline vec_short8
spu_add(vec_short8 a
, vec_short8 b
)
64 return ((vec_short8
)(si_ah((qword
)(a
), (qword
)(b
))));
67 static __inline vec_uint4
spu_add(vec_uint4 a
, unsigned int b
)
69 return ((vec_uint4
)(si_ai((qword
)(a
), (int)(b
))));
72 static __inline vec_int4
spu_add(vec_int4 a
, int b
)
74 return ((vec_int4
)(si_ai((qword
)(a
), b
)));
77 static __inline vec_ushort8
spu_add(vec_ushort8 a
, unsigned short b
)
79 return ((vec_ushort8
)(si_ahi((qword
)(a
), (short)(b
))));
82 static __inline vec_short8
spu_add(vec_short8 a
, short b
)
84 return ((vec_short8
)(si_ahi((qword
)(a
), b
)));
87 static __inline vec_float4
spu_add(vec_float4 a
, vec_float4 b
)
89 return ((vec_float4
)(si_fa((qword
)(a
), (qword
)(b
))));
92 static __inline vec_double2
spu_add(vec_double2 a
, vec_double2 b
)
94 return ((vec_double2
)(si_dfa((qword
)(a
), (qword
)(b
))));
101 static __inline vec_uint4
spu_addx(vec_uint4 a
, vec_uint4 b
, vec_uint4 c
)
103 return ((vec_uint4
)(si_addx((qword
)(a
), (qword
)(b
), (qword
)(c
))));
106 static __inline vec_int4
spu_addx(vec_int4 a
, vec_int4 b
, vec_int4 c
)
108 return ((vec_int4
)(si_addx((qword
)(a
), (qword
)(b
), (qword
)(c
))));
115 static __inline vec_uchar16
spu_and(vec_uchar16 a
, vec_uchar16 b
)
117 return ((vec_uchar16
)(si_and((qword
)(a
), (qword
)(b
))));
120 static __inline vec_char16
spu_and(vec_char16 a
, vec_char16 b
)
122 return ((vec_char16
)(si_and((qword
)(a
), (qword
)(b
))));
125 static __inline vec_ushort8
spu_and(vec_ushort8 a
, vec_ushort8 b
)
127 return ((vec_ushort8
)(si_and((qword
)(a
), (qword
)(b
))));
130 static __inline vec_short8
spu_and(vec_short8 a
, vec_short8 b
)
132 return ((vec_short8
)(si_and((qword
)(a
), (qword
)(b
))));
135 static __inline vec_uint4
spu_and(vec_uint4 a
, vec_uint4 b
)
137 return ((vec_uint4
)(si_and((qword
)(a
), (qword
)(b
))));
140 static __inline vec_int4
spu_and(vec_int4 a
, vec_int4 b
)
142 return ((vec_int4
)(si_and((qword
)(a
), (qword
)(b
))));
145 static __inline vec_float4
spu_and(vec_float4 a
, vec_float4 b
)
147 return ((vec_float4
)(si_and((qword
)(a
), (qword
)(b
))));
150 static __inline vec_ullong2
spu_and(vec_ullong2 a
, vec_ullong2 b
)
152 return ((vec_ullong2
)(si_and((qword
)(a
), (qword
)(b
))));
155 static __inline vec_llong2
spu_and(vec_llong2 a
, vec_llong2 b
)
157 return ((vec_llong2
)(si_and((qword
)(a
), (qword
)(b
))));
160 static __inline vec_double2
spu_and(vec_double2 a
, vec_double2 b
)
162 return ((vec_double2
)(si_and((qword
)(a
), (qword
)(b
))));
165 static __inline vec_uchar16
spu_and(vec_uchar16 a
, unsigned char b
)
167 return ((vec_uchar16
)(si_andbi((qword
)(a
), (signed char)(b
))));
171 static __inline vec_char16
spu_and(vec_char16 a
, signed char b
)
173 return ((vec_char16
)(si_andbi((qword
)(a
), b
)));
176 static __inline vec_ushort8
spu_and(vec_ushort8 a
, unsigned short b
)
178 return ((vec_ushort8
)(si_andhi((qword
)(a
), (signed short)(b
))));
181 static __inline vec_short8
spu_and(vec_short8 a
, signed short b
)
183 return ((vec_short8
)(si_andhi((qword
)(a
), b
)));
186 static __inline vec_uint4
spu_and(vec_uint4 a
, unsigned int b
)
188 return ((vec_uint4
)(si_andi((qword
)(a
), (signed int)(b
))));
191 static __inline vec_int4
spu_and(vec_int4 a
, signed int b
)
193 return ((vec_int4
)(si_andi((qword
)(a
), b
)));
200 #define spu_andc(_a, _b) vec_andc(_a, _b)
206 #define spu_avg(_a, _b) vec_avg(_a, _b)
214 #define spu_bisled(_func) /* not mappable */
215 #define spu_bisled_d(_func) /* not mappable */
216 #define spu_bisled_e(_func) /* not mappable */
221 static __inline vec_uint4
spu_cmpabseq(vec_float4 a
, vec_float4 b
)
223 return ((vec_uint4
)(si_fcmeq((qword
)(a
), (qword
)(b
))));
227 static __inline vec_ullong2
spu_cmpabseq(vec_double2 a
, vec_double2 b
)
229 return ((vec_ullong2
)(si_dfcmeq((qword
)(a
), (qword
)(b
))));
236 static __inline vec_uint4
spu_cmpabsgt(vec_float4 a
, vec_float4 b
)
238 return ((vec_uint4
)(si_fcmgt((qword
)(a
), (qword
)(b
))));
241 static __inline vec_ullong2
spu_cmpabsgt(vec_double2 a
, vec_double2 b
)
243 return ((vec_ullong2
)(si_dfcmgt((qword
)(a
), (qword
)(b
))));
250 static __inline vec_uchar16
spu_cmpeq(vec_uchar16 a
, vec_uchar16 b
)
252 return ((vec_uchar16
)(si_ceqb((qword
)(a
), (qword
)(b
))));
255 static __inline vec_uchar16
spu_cmpeq(vec_char16 a
, vec_char16 b
)
257 return ((vec_uchar16
)(si_ceqb((qword
)(a
), (qword
)(b
))));
260 static __inline vec_ushort8
spu_cmpeq(vec_ushort8 a
, vec_ushort8 b
)
262 return ((vec_ushort8
)(si_ceqh((qword
)(a
), (qword
)(b
))));
265 static __inline vec_ushort8
spu_cmpeq(vec_short8 a
, vec_short8 b
)
267 return ((vec_ushort8
)(si_ceqh((qword
)(a
), (qword
)(b
))));
270 static __inline vec_uint4
spu_cmpeq(vec_uint4 a
, vec_uint4 b
)
272 return ((vec_uint4
)(si_ceq((qword
)(a
), (qword
)(b
))));
275 static __inline vec_uint4
spu_cmpeq(vec_int4 a
, vec_int4 b
)
277 return ((vec_uint4
)(si_ceq((qword
)(a
), (qword
)(b
))));
280 static __inline vec_uint4
spu_cmpeq(vec_float4 a
, vec_float4 b
)
282 return ((vec_uint4
)(si_fceq((qword
)(a
), (qword
)(b
))));
285 static __inline vec_uchar16
spu_cmpeq(vec_uchar16 a
, unsigned char b
)
287 return ((vec_uchar16
)(si_ceqbi((qword
)(a
), (signed char)(b
))));
290 static __inline vec_uchar16
spu_cmpeq(vec_char16 a
, signed char b
)
292 return ((vec_uchar16
)(si_ceqbi((qword
)(a
), b
)));
295 static __inline vec_ushort8
spu_cmpeq(vec_ushort8 a
, unsigned short b
)
297 return ((vec_ushort8
)(si_ceqhi((qword
)(a
), (signed short)(b
))));
300 static __inline vec_ushort8
spu_cmpeq(vec_short8 a
, signed short b
)
302 return ((vec_ushort8
)(si_ceqhi((qword
)(a
), b
)));
305 static __inline vec_uint4
spu_cmpeq(vec_uint4 a
, unsigned int b
)
307 return ((vec_uint4
)(si_ceqi((qword
)(a
), (signed int)(b
))));
310 static __inline vec_uint4
spu_cmpeq(vec_int4 a
, signed int b
)
312 return ((vec_uint4
)(si_ceqi((qword
)(a
), b
)));
315 static __inline vec_ullong2
spu_cmpeq(vec_double2 a
, vec_double2 b
)
317 return ((vec_ullong2
)(si_dfceq((qword
)(a
), (qword
)(b
))));
324 static __inline vec_uchar16
spu_cmpgt(vec_uchar16 a
, vec_uchar16 b
)
326 return ((vec_uchar16
)(si_clgtb((qword
)(a
), (qword
)(b
))));
329 static __inline vec_uchar16
spu_cmpgt(vec_char16 a
, vec_char16 b
)
331 return ((vec_uchar16
)(si_cgtb((qword
)(a
), (qword
)(b
))));
334 static __inline vec_ushort8
spu_cmpgt(vec_ushort8 a
, vec_ushort8 b
)
336 return ((vec_ushort8
)(si_clgth((qword
)(a
), (qword
)(b
))));
339 static __inline vec_ushort8
spu_cmpgt(vec_short8 a
, vec_short8 b
)
341 return ((vec_ushort8
)(si_cgth((qword
)(a
), (qword
)(b
))));
344 static __inline vec_uint4
spu_cmpgt(vec_uint4 a
, vec_uint4 b
)
346 return ((vec_uint4
)(si_clgt((qword
)(a
), (qword
)(b
))));
349 static __inline vec_uint4
spu_cmpgt(vec_int4 a
, vec_int4 b
)
351 return ((vec_uint4
)(si_cgt((qword
)(a
), (qword
)(b
))));
354 static __inline vec_uint4
spu_cmpgt(vec_float4 a
, vec_float4 b
)
356 return ((vec_uint4
)(si_fcgt((qword
)(a
), (qword
)(b
))));
359 static __inline vec_uchar16
spu_cmpgt(vec_uchar16 a
, unsigned char b
)
361 return ((vec_uchar16
)(si_clgtbi((qword
)(a
), b
)));
364 static __inline vec_uchar16
spu_cmpgt(vec_char16 a
, signed char b
)
366 return ((vec_uchar16
)(si_cgtbi((qword
)(a
), b
)));
369 static __inline vec_ushort8
spu_cmpgt(vec_ushort8 a
, unsigned short b
)
371 return ((vec_ushort8
)(si_clgthi((qword
)(a
), b
)));
374 static __inline vec_ushort8
spu_cmpgt(vec_short8 a
, signed short b
)
376 return ((vec_ushort8
)(si_cgthi((qword
)(a
), b
)));
379 static __inline vec_uint4
spu_cmpgt(vec_uint4 a
, unsigned int b
)
381 return ((vec_uint4
)(si_clgti((qword
)(a
), b
)));
384 static __inline vec_uint4
spu_cmpgt(vec_int4 a
, signed int b
)
386 return ((vec_uint4
)(si_cgti((qword
)(a
), b
)));
389 static __inline vec_ullong2
spu_cmpgt(vec_double2 a
, vec_double2 b
)
391 return ((vec_ullong2
)(si_dfcgt((qword
)(a
), (qword
)(b
))));
398 static __inline vec_uchar16
spu_cntb(vec_uchar16 a
)
400 return ((vec_uchar16
)(si_cntb((qword
)(a
))));
404 static __inline vec_uchar16
spu_cntb(vec_char16 a
)
406 return ((vec_uchar16
)(si_cntb((qword
)(a
))));
412 static __inline vec_uint4
spu_cntlz(vec_uint4 a
)
414 return ((vec_uint4
)(si_clz((qword
)(a
))));
417 static __inline vec_uint4
spu_cntlz(vec_int4 a
)
419 return ((vec_uint4
)(si_clz((qword
)(a
))));
422 static __inline vec_uint4
spu_cntlz(vec_float4 a
)
424 return ((vec_uint4
)(si_clz((qword
)(a
))));
430 static __inline vec_ullong2
spu_testsv(vec_double2 a
, char b
)
432 return ((vec_ullong2
)(si_dftsv((qword
)(a
), b
)));
438 #define spu_convtf(_a, _b) (vec_ctf(_a, _b))
443 #define spu_convts(_a, _b) (vec_cts(_a, _b))
448 #define spu_convtu(_a, _b) (vec_ctu(_a, _b))
459 static __inline vec_uchar16
spu_eqv(vec_uchar16 a
, vec_uchar16 b
)
461 return ((vec_uchar16
)(si_eqv((qword
)(a
), (qword
)(b
))));
464 static __inline vec_char16
spu_eqv(vec_char16 a
, vec_char16 b
)
466 return ((vec_char16
)(si_eqv((qword
)(a
), (qword
)(b
))));
469 static __inline vec_ushort8
spu_eqv(vec_ushort8 a
, vec_ushort8 b
)
471 return ((vec_ushort8
)(si_eqv((qword
)(a
), (qword
)(b
))));
474 static __inline vec_short8
spu_eqv(vec_short8 a
, vec_short8 b
)
476 return ((vec_short8
)(si_eqv((qword
)(a
), (qword
)(b
))));
479 static __inline vec_uint4
spu_eqv(vec_uint4 a
, vec_uint4 b
)
481 return ((vec_uint4
)(si_eqv((qword
)(a
), (qword
)(b
))));
484 static __inline vec_int4
spu_eqv(vec_int4 a
, vec_int4 b
)
486 return ((vec_int4
)(si_eqv((qword
)(a
), (qword
)(b
))));
489 static __inline vec_float4
spu_eqv(vec_float4 a
, vec_float4 b
)
491 return ((vec_float4
)(si_eqv((qword
)(a
), (qword
)(b
))));
494 static __inline vec_ullong2
spu_eqv(vec_ullong2 a
, vec_ullong2 b
)
496 return ((vec_ullong2
)(si_eqv((qword
)(a
), (qword
)(b
))));
499 static __inline vec_llong2
spu_eqv(vec_llong2 a
, vec_llong2 b
)
501 return ((vec_llong2
)(si_eqv((qword
)(a
), (qword
)(b
))));
504 static __inline vec_double2
spu_eqv(vec_double2 a
, vec_double2 b
)
506 return ((vec_double2
)(si_eqv((qword
)(a
), (qword
)(b
))));
512 static __inline vec_short8
spu_extend(vec_char16 a
)
514 return ((vec_short8
)(si_xsbh((qword
)(a
))));
518 static __inline vec_int4
spu_extend(vec_short8 a
)
520 return ((vec_int4
)(si_xshw((qword
)(a
))));
523 static __inline vec_llong2
spu_extend(vec_int4 a
)
525 return ((vec_llong2
)(si_xswd((qword
)(a
))));
529 static __inline vec_double2
spu_extend(vec_float4 a
)
531 return ((vec_double2
)(si_fesd((qword
)(a
))));
538 static __inline
unsigned char spu_extract(vec_uchar16 a
, int element
)
546 return (in
.c
[element
& 15]);
549 static __inline
signed char spu_extract(vec_char16 a
, int element
)
557 return (in
.c
[element
& 15]);
560 static __inline
unsigned short spu_extract(vec_ushort8 a
, int element
)
568 return (in
.s
[element
& 7]);
571 static __inline
signed short spu_extract(vec_short8 a
, int element
)
579 return (in
.s
[element
& 7]);
582 static __inline
unsigned int spu_extract(vec_uint4 a
, int element
)
590 return (in
.i
[element
& 3]);
593 static __inline
signed int spu_extract(vec_int4 a
, int element
)
601 return (in
.i
[element
& 3]);
604 static __inline
float spu_extract(vec_float4 a
, int element
)
612 return (in
.f
[element
& 3]);
615 static __inline
unsigned long long spu_extract(vec_ullong2 a
, int element
)
619 unsigned long long l
[2];
623 return (in
.l
[element
& 1]);
626 static __inline
signed long long spu_extract(vec_llong2 a
, int element
)
630 signed long long l
[2];
634 return (in
.l
[element
& 1]);
637 static __inline
double spu_extract(vec_double2 a
, int element
)
645 return (in
.d
[element
& 1]);
651 static __inline vec_uint4
spu_gather(vec_uchar16 a
)
653 return ((vec_uint4
)(si_gbb((qword
)(a
))));
657 static __inline vec_uint4
spu_gather(vec_char16 a
)
659 return ((vec_uint4
)(si_gbb((qword
)(a
))));
662 static __inline vec_uint4
spu_gather(vec_ushort8 a
)
664 return ((vec_uint4
)(si_gbh((qword
)(a
))));
667 static __inline vec_uint4
spu_gather(vec_short8 a
)
669 return ((vec_uint4
)(si_gbh((qword
)(a
))));
673 static __inline vec_uint4
spu_gather(vec_uint4 a
)
675 return ((vec_uint4
)(si_gb((qword
)(a
))));
678 static __inline vec_uint4
spu_gather(vec_int4 a
)
680 return ((vec_uint4
)(si_gb((qword
)(a
))));
683 static __inline vec_uint4
spu_gather(vec_float4 a
)
685 return ((vec_uint4
)(si_gb((qword
)(a
))));
691 static __inline vec_uint4
spu_genb(vec_uint4 a
, vec_uint4 b
)
693 return ((vec_uint4
)(si_bg((qword
)(b
), (qword
)(a
))));
696 static __inline vec_int4
spu_genb(vec_int4 a
, vec_int4 b
)
698 return ((vec_int4
)(si_bg((qword
)(b
), (qword
)(a
))));
704 static __inline vec_uint4
spu_genbx(vec_uint4 a
, vec_uint4 b
, vec_uint4 c
)
706 return ((vec_uint4
)(si_bgx((qword
)(b
), (qword
)(a
), (qword
)(c
))));
709 static __inline vec_int4
spu_genbx(vec_int4 a
, vec_int4 b
, vec_int4 c
)
711 return ((vec_int4
)(si_bgx((qword
)(b
), (qword
)(a
), (qword
)(c
))));
718 static __inline vec_uint4
spu_genc(vec_uint4 a
, vec_uint4 b
)
720 return ((vec_uint4
)(si_cg((qword
)(a
), (qword
)(b
))));
723 static __inline vec_int4
spu_genc(vec_int4 a
, vec_int4 b
)
725 return ((vec_int4
)(si_cg((qword
)(a
), (qword
)(b
))));
731 static __inline vec_uint4
spu_gencx(vec_uint4 a
, vec_uint4 b
, vec_uint4 c
)
733 return ((vec_uint4
)(si_cgx((qword
)(a
), (qword
)(b
), (qword
)(c
))));
736 static __inline vec_int4
spu_gencx(vec_int4 a
, vec_int4 b
, vec_int4 c
)
738 return ((vec_int4
)(si_cgx((qword
)(a
), (qword
)(b
), (qword
)(c
))));
745 #define spu_hcmpeq(_a, _b) if (_a == _b) { SPU_HALT_ACTION; };
751 #define spu_hcmpgt(_a, _b) if (_a > _b) { SPU_HALT_ACTION; };
757 #define spu_idisable() SPU_UNSUPPORTED_ACTION
763 #define spu_ienable() SPU_UNSUPPORTED_ACTION
769 static __inline vec_uchar16
spu_insert(unsigned char a
, vec_uchar16 b
, int element
)
777 in
.c
[element
& 15] = a
;
781 static __inline vec_char16
spu_insert(signed char a
, vec_char16 b
, int element
)
783 return ((vec_char16
)spu_insert((unsigned char)(a
), (vec_uchar16
)(b
), element
));
786 static __inline vec_ushort8
spu_insert(unsigned short a
, vec_ushort8 b
, int element
)
794 in
.s
[element
& 7] = a
;
798 static __inline vec_short8
spu_insert(signed short a
, vec_short8 b
, int element
)
800 return ((vec_short8
)spu_insert((unsigned short)(a
), (vec_ushort8
)(b
), element
));
803 static __inline vec_uint4
spu_insert(unsigned int a
, vec_uint4 b
, int element
)
811 in
.i
[element
& 3] = a
;
815 static __inline vec_int4
spu_insert(signed int a
, vec_int4 b
, int element
)
817 return ((vec_int4
)spu_insert((unsigned int)(a
), (vec_uint4
)(b
), element
));
820 static __inline vec_float4
spu_insert(float a
, vec_float4 b
, int element
)
828 in
.f
[element
& 3] = a
;
832 static __inline vec_ullong2
spu_insert(unsigned long long a
, vec_ullong2 b
, int element
)
836 unsigned long long l
[2];
840 in
.l
[element
& 1] = a
;
844 static __inline vec_llong2
spu_insert(signed long long a
, vec_llong2 b
, int element
)
846 return ((vec_llong2
)spu_insert((unsigned long long)(a
), (vec_ullong2
)(b
), element
));
849 static __inline vec_double2
spu_insert(double a
, vec_double2 b
, int element
)
857 in
.d
[element
& 1] = a
;
865 static __inline vec_int4
spu_madd(vec_short8 a
, vec_short8 b
, vec_int4 c
)
867 return ((vec_int4
)(si_mpya((qword
)(a
), (qword
)(b
), (qword
)(c
))));
870 static __inline vec_float4
spu_madd(vec_float4 a
, vec_float4 b
, vec_float4 c
)
872 return ((vec_float4
)(si_fma((qword
)(a
), (qword
)(b
), (qword
)(c
))));
875 static __inline vec_double2
spu_madd(vec_double2 a
, vec_double2 b
, vec_double2 c
)
877 return ((vec_double2
)(si_dfma((qword
)(a
), (qword
)(b
), (qword
)(c
))));
884 #define spu_maskb(_a) (vec_uchar16)(si_fsmb(si_from_int((int)(_a))))
889 #define spu_maskh(_a) (vec_ushort8)(si_fsmh(si_from_int((int)(_a))))
895 #define spu_maskw(_a) (vec_uint4)(si_fsm(si_from_int((int)(_a))))
901 #define spu_mfcdma32(_ls, _ea, _size, _tagid, _cmd)
907 #define spu_mfcdma64(_ls, _eahi, _ealow, _size, _tagid, _cmd)
912 #define spu_mfcstat(_type) 0xFFFFFFFF
919 #define spu_mffpscr() (vec_uint4)(si_fscrrd())
926 #define spu_mfspr(_reg) si_to_uint(si_mfspr(_reg))
933 static __inline vec_int4
spu_mhhadd(vec_short8 a
, vec_short8 b
, vec_int4 c
)
935 return ((vec_int4
)(si_mpyhha((qword
)(a
), (qword
)(b
), (qword
)(c
))));
939 static __inline vec_uint4
spu_mhhadd(vec_ushort8 a
, vec_ushort8 b
, vec_uint4 c
)
941 return ((vec_uint4
)(si_mpyhhau((qword
)(a
), (qword
)(b
), (qword
)(c
))));
948 static __inline vec_float4
spu_msub(vec_float4 a
, vec_float4 b
, vec_float4 c
)
950 return ((vec_float4
)(si_fms((qword
)(a
), (qword
)(b
), (qword
)(c
))));
953 static __inline vec_double2
spu_msub(vec_double2 a
, vec_double2 b
, vec_double2 c
)
955 return ((vec_double2
)(si_dfms((qword
)(a
), (qword
)(b
), (qword
)(c
))));
962 #define spu_mtfpscr(_a)
968 #define spu_mtspr(_reg, _a)
974 static __inline vec_float4
spu_mul(vec_float4 a
, vec_float4 b
)
976 return ((vec_float4
)(si_fm((qword
)(a
), (qword
)(b
))));
979 static __inline vec_double2
spu_mul(vec_double2 a
, vec_double2 b
)
981 return ((vec_double2
)(si_dfm((qword
)(a
), (qword
)(b
))));
988 static __inline vec_int4
spu_mulh(vec_short8 a
, vec_short8 b
)
990 return ((vec_int4
)(si_mpyh((qword
)(a
), (qword
)(b
))));
996 #define spu_mule(_a, _b) vec_mule(_a, _b)
1003 static __inline vec_int4
spu_mulo(vec_short8 a
, vec_short8 b
)
1005 return ((vec_int4
)(si_mpy((qword
)(a
), (qword
)(b
))));
1009 static __inline vec_uint4
spu_mulo(vec_ushort8 a
, vec_ushort8 b
)
1011 return ((vec_uint4
)(si_mpyu((qword
)(a
), (qword
)(b
))));
1015 static __inline vec_int4
spu_mulo(vec_short8 a
, short b
)
1017 return ((vec_int4
)(si_mpyi((qword
)(a
), b
)));
1020 static __inline vec_uint4
spu_mulo(vec_ushort8 a
, unsigned short b
)
1022 return ((vec_uint4
)(si_mpyui((qword
)(a
), b
)));
1029 static __inline vec_int4
spu_mulsr(vec_short8 a
, vec_short8 b
)
1031 return ((vec_int4
)(si_mpys((qword
)(a
), (qword
)(b
))));
1038 static __inline vec_uchar16
spu_nand(vec_uchar16 a
, vec_uchar16 b
)
1040 return ((vec_uchar16
)(si_nand((qword
)(a
), (qword
)(b
))));
1043 static __inline vec_char16
spu_nand(vec_char16 a
, vec_char16 b
)
1045 return ((vec_char16
)(si_nand((qword
)(a
), (qword
)(b
))));
1048 static __inline vec_ushort8
spu_nand(vec_ushort8 a
, vec_ushort8 b
)
1050 return ((vec_ushort8
)(si_nand((qword
)(a
), (qword
)(b
))));
1053 static __inline vec_short8
spu_nand(vec_short8 a
, vec_short8 b
)
1055 return ((vec_short8
)(si_nand((qword
)(a
), (qword
)(b
))));
1058 static __inline vec_uint4
spu_nand(vec_uint4 a
, vec_uint4 b
)
1060 return ((vec_uint4
)(si_nand((qword
)(a
), (qword
)(b
))));
1063 static __inline vec_int4
spu_nand(vec_int4 a
, vec_int4 b
)
1065 return ((vec_int4
)(si_nand((qword
)(a
), (qword
)(b
))));
1068 static __inline vec_float4
spu_nand(vec_float4 a
, vec_float4 b
)
1070 return ((vec_float4
)(si_nand((qword
)(a
), (qword
)(b
))));
1073 static __inline vec_ullong2
spu_nand(vec_ullong2 a
, vec_ullong2 b
)
1075 return ((vec_ullong2
)(si_nand((qword
)(a
), (qword
)(b
))));
1078 static __inline vec_llong2
spu_nand(vec_llong2 a
, vec_llong2 b
)
1080 return ((vec_llong2
)(si_nand((qword
)(a
), (qword
)(b
))));
1083 static __inline vec_double2
spu_nand(vec_double2 a
, vec_double2 b
)
1085 return ((vec_double2
)(si_nand((qword
)(a
), (qword
)(b
))));
1092 static __inline vec_double2
spu_nmadd(vec_double2 a
, vec_double2 b
, vec_double2 c
)
1094 return ((vec_double2
)(si_dfnma((qword
)(a
), (qword
)(b
), (qword
)(c
))));
1101 static __inline vec_float4
spu_nmsub(vec_float4 a
, vec_float4 b
, vec_float4 c
)
1103 return ((vec_float4
)(si_fnms((qword
)(a
), (qword
)(b
), (qword
)(c
))));
1106 static __inline vec_double2
spu_nmsub(vec_double2 a
, vec_double2 b
, vec_double2 c
)
1108 return ((vec_double2
)(si_dfnms((qword
)(a
), (qword
)(b
), (qword
)(c
))));
1115 #define spu_nor(_a, _b) vec_nor(_a, _b)
1121 static __inline vec_uchar16
spu_or(vec_uchar16 a
, vec_uchar16 b
)
1123 return ((vec_uchar16
)(si_or((qword
)(a
), (qword
)(b
))));
1126 static __inline vec_char16
spu_or(vec_char16 a
, vec_char16 b
)
1128 return ((vec_char16
)(si_or((qword
)(a
), (qword
)(b
))));
1131 static __inline vec_ushort8
spu_or(vec_ushort8 a
, vec_ushort8 b
)
1133 return ((vec_ushort8
)(si_or((qword
)(a
), (qword
)(b
))));
1136 static __inline vec_short8
spu_or(vec_short8 a
, vec_short8 b
)
1138 return ((vec_short8
)(si_or((qword
)(a
), (qword
)(b
))));
1141 static __inline vec_uint4
spu_or(vec_uint4 a
, vec_uint4 b
)
1143 return ((vec_uint4
)(si_or((qword
)(a
), (qword
)(b
))));
1146 static __inline vec_int4
spu_or(vec_int4 a
, vec_int4 b
)
1148 return ((vec_int4
)(si_or((qword
)(a
), (qword
)(b
))));
1151 static __inline vec_float4
spu_or(vec_float4 a
, vec_float4 b
)
1153 return ((vec_float4
)(si_or((qword
)(a
), (qword
)(b
))));
1156 static __inline vec_ullong2
spu_or(vec_ullong2 a
, vec_ullong2 b
)
1158 return ((vec_ullong2
)(si_or((qword
)(a
), (qword
)(b
))));
1161 static __inline vec_llong2
spu_or(vec_llong2 a
, vec_llong2 b
)
1163 return ((vec_llong2
)(si_or((qword
)(a
), (qword
)(b
))));
1166 static __inline vec_double2
spu_or(vec_double2 a
, vec_double2 b
)
1168 return ((vec_double2
)(si_or((qword
)(a
), (qword
)(b
))));
1172 static __inline vec_uchar16
spu_or(vec_uchar16 a
, unsigned char b
)
1174 return ((vec_uchar16
)(si_orbi((qword
)(a
), b
)));
1177 static __inline vec_char16
spu_or(vec_char16 a
, signed char b
)
1179 return ((vec_char16
)(si_orbi((qword
)(a
), (unsigned char)(b
))));
1182 static __inline vec_ushort8
spu_or(vec_ushort8 a
, unsigned short b
)
1184 return ((vec_ushort8
)(si_orhi((qword
)(a
), b
)));
1187 static __inline vec_short8
spu_or(vec_short8 a
, signed short b
)
1189 return ((vec_short8
)(si_orhi((qword
)(a
), (unsigned short)(b
))));
1192 static __inline vec_uint4
spu_or(vec_uint4 a
, unsigned int b
)
1194 return ((vec_uint4
)(si_ori((qword
)(a
), b
)));
1197 static __inline vec_int4
spu_or(vec_int4 a
, signed int b
)
1199 return ((vec_int4
)(si_ori((qword
)(a
), (unsigned int)(b
))));
1206 #define spu_orc(_a, _b) vec_or(_a, vec_nor(_b, _b))
1212 static __inline vec_uint4
spu_orx(vec_uint4 a
)
1214 return ((vec_uint4
)(si_orx((qword
)(a
))));
1217 static __inline vec_int4
spu_orx(vec_int4 a
)
1219 return ((vec_int4
)(si_orx((qword
)(a
))));
1226 static __inline vec_uchar16
spu_promote(unsigned char a
, int element
)
1230 unsigned char c
[16];
1233 in
.c
[element
& 15] = a
;
1237 static __inline vec_char16
spu_promote(signed char a
, int element
)
1244 in
.c
[element
& 15] = a
;
1248 static __inline vec_ushort8
spu_promote(unsigned short a
, int element
)
1252 unsigned short s
[8];
1255 in
.s
[element
& 7] = a
;
1259 static __inline vec_short8
spu_promote(signed short a
, int element
)
1266 in
.s
[element
& 7] = a
;
1270 static __inline vec_uint4
spu_promote(unsigned int a
, int element
)
1277 in
.i
[element
& 3] = a
;
1281 static __inline vec_int4
spu_promote(signed int a
, int element
)
1288 in
.i
[element
& 3] = a
;
1292 static __inline vec_float4
spu_promote(float a
, int element
)
1299 in
.f
[element
& 3] = a
;
1303 static __inline vec_ullong2
spu_promote(unsigned long long a
, int element
)
1307 unsigned long long l
[2];
1310 in
.l
[element
& 1] = a
;
1314 static __inline vec_llong2
spu_promote(signed long long a
, int element
)
1318 signed long long l
[2];
1321 in
.l
[element
& 1] = a
;
1325 static __inline vec_double2
spu_promote(double a
, int element
)
1332 in
.d
[element
& 1] = a
;
1339 #define spu_re(_a) vec_re(_a)
1345 #define spu_readch(_channel) 0 /* not mappable */
1351 #define spu_readchcnt(_channel) 0 /* not mappable */
1357 #define spu_readchqw(_channel) __extension__ ({ vec_uint4 result = { 0, 0, 0, 0 }; result; })
1362 static __inline vec_ushort8
spu_rl(vec_ushort8 a
, vec_short8 b
)
1364 return ((vec_ushort8
)(si_roth((qword
)(a
), (qword
)(b
))));
1367 static __inline vec_short8
spu_rl(vec_short8 a
, vec_short8 b
)
1369 return ((vec_short8
)(si_roth((qword
)(a
), (qword
)(b
))));
1372 static __inline vec_uint4
spu_rl(vec_uint4 a
, vec_int4 b
)
1374 return ((vec_uint4
)(si_rot((qword
)(a
), (qword
)(b
))));
1377 static __inline vec_int4
spu_rl(vec_int4 a
, vec_int4 b
)
1379 return ((vec_int4
)(si_rot((qword
)(a
), (qword
)(b
))));
1382 static __inline vec_ushort8
spu_rl(vec_ushort8 a
, int b
)
1384 return ((vec_ushort8
)(si_rothi((qword
)(a
), b
)));
1387 static __inline vec_short8
spu_rl(vec_short8 a
, int b
)
1389 return ((vec_short8
)(si_rothi((qword
)(a
), b
)));
1392 static __inline vec_uint4
spu_rl(vec_uint4 a
, int b
)
1394 return ((vec_uint4
)(si_roti((qword
)(a
), b
)));
1397 static __inline vec_int4
spu_rl(vec_int4 a
, int b
)
1399 return ((vec_int4
)(si_roti((qword
)(a
), b
)));
1406 static __inline vec_ushort8
spu_rlmask(vec_ushort8 a
, vec_short8 b
)
1408 return ((vec_ushort8
)(si_rothm((qword
)(a
), (qword
)(b
))));
1411 static __inline vec_short8
spu_rlmask(vec_short8 a
, vec_short8 b
)
1413 return ((vec_short8
)(si_rothm((qword
)(a
), (qword
)(b
))));
1416 static __inline vec_uint4
spu_rlmask(vec_uint4 a
, vec_int4 b
)
1418 return ((vec_uint4
)(si_rotm((qword
)(a
), (qword
)(b
))));
1421 static __inline vec_int4
spu_rlmask(vec_int4 a
, vec_int4 b
)
1423 return ((vec_int4
)(si_rotm((qword
)(a
), (qword
)(b
))));
1426 static __inline vec_ushort8
spu_rlmask(vec_ushort8 a
, int b
)
1428 return ((vec_ushort8
)(si_rothmi((qword
)(a
), b
)));
1431 static __inline vec_short8
spu_rlmask(vec_short8 a
, int b
)
1433 return ((vec_short8
)(si_rothmi((qword
)(a
), b
)));
1437 static __inline vec_uint4
spu_rlmask(vec_uint4 a
, int b
)
1439 return ((vec_uint4
)(si_rotmi((qword
)(a
), b
)));
1442 static __inline vec_int4
spu_rlmask(vec_int4 a
, int b
)
1444 return ((vec_int4
)(si_rotmi((qword
)(a
), b
)));
1450 static __inline vec_short8
spu_rlmaska(vec_short8 a
, vec_short8 b
)
1452 return ((vec_short8
)(si_rotmah((qword
)(a
), (qword
)(b
))));
1455 static __inline vec_ushort8
spu_rlmaska(vec_ushort8 a
, vec_short8 b
)
1457 return ((vec_ushort8
)(si_rotmah((qword
)(a
), (qword
)(b
))));
1461 static __inline vec_int4
spu_rlmaska(vec_int4 a
, vec_int4 b
)
1463 return ((vec_int4
)(si_rotma((qword
)(a
), (qword
)(b
))));
1466 static __inline vec_uint4
spu_rlmaska(vec_uint4 a
, vec_int4 b
)
1468 return ((vec_uint4
)(si_rotma((qword
)(a
), (qword
)(b
))));
1471 static __inline vec_ushort8
spu_rlmaska(vec_ushort8 a
, int b
)
1473 return ((vec_ushort8
)(si_rotmahi((qword
)(a
), b
)));
1476 static __inline vec_short8
spu_rlmaska(vec_short8 a
, int b
)
1478 return ((vec_short8
)(si_rotmahi((qword
)(a
), b
)));
1481 static __inline vec_uint4
spu_rlmaska(vec_uint4 a
, int b
)
1483 return ((vec_uint4
)(si_rotmai((qword
)(a
), b
)));
1486 static __inline vec_int4
spu_rlmaska(vec_int4 a
, int b
)
1488 return ((vec_int4
)(si_rotmai((qword
)(a
), b
)));
1495 static __inline vec_uchar16
spu_rlmaskqw(vec_uchar16 a
, int count
)
1497 return ((vec_uchar16
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1500 static __inline vec_char16
spu_rlmaskqw(vec_char16 a
, int count
)
1502 return ((vec_char16
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1505 static __inline vec_ushort8
spu_rlmaskqw(vec_ushort8 a
, int count
)
1507 return ((vec_ushort8
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1510 static __inline vec_short8
spu_rlmaskqw(vec_short8 a
, int count
)
1512 return ((vec_short8
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1515 static __inline vec_uint4
spu_rlmaskqw(vec_uint4 a
, int count
)
1517 return ((vec_uint4
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1520 static __inline vec_int4
spu_rlmaskqw(vec_int4 a
, int count
)
1522 return ((vec_int4
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1525 static __inline vec_float4
spu_rlmaskqw(vec_float4 a
, int count
)
1527 return ((vec_float4
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1530 static __inline vec_ullong2
spu_rlmaskqw(vec_ullong2 a
, int count
)
1532 return ((vec_ullong2
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1535 static __inline vec_llong2
spu_rlmaskqw(vec_llong2 a
, int count
)
1537 return ((vec_llong2
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1540 static __inline vec_double2
spu_rlmaskqw(vec_double2 a
, int count
)
1542 return ((vec_double2
)(si_rotqmbi((qword
)(a
), si_from_int(count
))));
1548 static __inline vec_uchar16
spu_rlmaskqwbyte(vec_uchar16 a
, int count
)
1550 return ((vec_uchar16
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1553 static __inline vec_char16
spu_rlmaskqwbyte(vec_char16 a
, int count
)
1555 return ((vec_char16
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1558 static __inline vec_ushort8
spu_rlmaskqwbyte(vec_ushort8 a
, int count
)
1560 return ((vec_ushort8
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1563 static __inline vec_short8
spu_rlmaskqwbyte(vec_short8 a
, int count
)
1565 return ((vec_short8
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1568 static __inline vec_uint4
spu_rlmaskqwbyte(vec_uint4 a
, int count
)
1570 return ((vec_uint4
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1573 static __inline vec_int4
spu_rlmaskqwbyte(vec_int4 a
, int count
)
1575 return ((vec_int4
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1578 static __inline vec_float4
spu_rlmaskqwbyte(vec_float4 a
, int count
)
1580 return ((vec_float4
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1583 static __inline vec_ullong2
spu_rlmaskqwbyte(vec_ullong2 a
, int count
)
1585 return ((vec_ullong2
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1588 static __inline vec_llong2
spu_rlmaskqwbyte(vec_llong2 a
, int count
)
1590 return ((vec_llong2
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1593 static __inline vec_double2
spu_rlmaskqwbyte(vec_double2 a
, int count
)
1595 return ((vec_double2
)(si_rotqmby((qword
)(a
), si_from_int(count
))));
1598 /* spu_rlmaskqwbytebc
1599 * ==================
1601 static __inline vec_uchar16
spu_rlmaskqwbytebc(vec_uchar16 a
, int count
)
1603 return ((vec_uchar16
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1606 static __inline vec_char16
spu_rlmaskqwbytebc(vec_char16 a
, int count
)
1608 return ((vec_char16
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1611 static __inline vec_ushort8
spu_rlmaskqwbytebc(vec_ushort8 a
, int count
)
1613 return ((vec_ushort8
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1616 static __inline vec_short8
spu_rlmaskqwbytebc(vec_short8 a
, int count
)
1618 return ((vec_short8
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1621 static __inline vec_uint4
spu_rlmaskqwbytebc(vec_uint4 a
, int count
)
1623 return ((vec_uint4
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1626 static __inline vec_int4
spu_rlmaskqwbytebc(vec_int4 a
, int count
)
1628 return ((vec_int4
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1631 static __inline vec_float4
spu_rlmaskqwbytebc(vec_float4 a
, int count
)
1633 return ((vec_float4
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1636 static __inline vec_ullong2
spu_rlmaskqwbytebc(vec_ullong2 a
, int count
)
1638 return ((vec_ullong2
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1641 static __inline vec_llong2
spu_rlmaskqwbytebc(vec_llong2 a
, int count
)
1643 return ((vec_llong2
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1646 static __inline vec_double2
spu_rlmaskqwbytebc(vec_double2 a
, int count
)
1648 return ((vec_double2
)(si_rotqmbybi((qword
)(a
), si_from_int(count
))));
1655 static __inline vec_uchar16
spu_rlqwbyte(vec_uchar16 a
, int count
)
1657 return ((vec_uchar16
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1660 static __inline vec_char16
spu_rlqwbyte(vec_char16 a
, int count
)
1662 return ((vec_char16
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1665 static __inline vec_ushort8
spu_rlqwbyte(vec_ushort8 a
, int count
)
1667 return ((vec_ushort8
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1670 static __inline vec_short8
spu_rlqwbyte(vec_short8 a
, int count
)
1672 return ((vec_short8
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1675 static __inline vec_uint4
spu_rlqwbyte(vec_uint4 a
, int count
)
1677 return ((vec_uint4
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1680 static __inline vec_int4
spu_rlqwbyte(vec_int4 a
, int count
)
1682 return ((vec_int4
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1685 static __inline vec_float4
spu_rlqwbyte(vec_float4 a
, int count
)
1687 return ((vec_float4
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1690 static __inline vec_ullong2
spu_rlqwbyte(vec_ullong2 a
, int count
)
1692 return ((vec_ullong2
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1695 static __inline vec_llong2
spu_rlqwbyte(vec_llong2 a
, int count
)
1697 return ((vec_llong2
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1700 static __inline vec_double2
spu_rlqwbyte(vec_double2 a
, int count
)
1702 return ((vec_double2
)(si_rotqby((qword
)(a
), si_from_int(count
))));
1709 static __inline vec_uchar16
spu_rlqwbytebc(vec_uchar16 a
, int count
)
1711 return ((vec_uchar16
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1714 static __inline vec_char16
spu_rlqwbytebc(vec_char16 a
, int count
)
1716 return ((vec_char16
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1719 static __inline vec_ushort8
spu_rlqwbytebc(vec_ushort8 a
, int count
)
1721 return ((vec_ushort8
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1724 static __inline vec_short8
spu_rlqwbytebc(vec_short8 a
, int count
)
1726 return ((vec_short8
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1729 static __inline vec_uint4
spu_rlqwbytebc(vec_uint4 a
, int count
)
1731 return ((vec_uint4
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1734 static __inline vec_int4
spu_rlqwbytebc(vec_int4 a
, int count
)
1736 return ((vec_int4
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1739 static __inline vec_float4
spu_rlqwbytebc(vec_float4 a
, int count
)
1741 return ((vec_float4
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1744 static __inline vec_ullong2
spu_rlqwbytebc(vec_ullong2 a
, int count
)
1746 return ((vec_ullong2
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1749 static __inline vec_llong2
spu_rlqwbytebc(vec_llong2 a
, int count
)
1751 return ((vec_llong2
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1754 static __inline vec_double2
spu_rlqwbytebc(vec_double2 a
, int count
)
1756 return ((vec_double2
)(si_rotqbybi((qword
)(a
), si_from_int(count
))));
1762 static __inline vec_uchar16
spu_rlqw(vec_uchar16 a
, int count
)
1764 return ((vec_uchar16
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1767 static __inline vec_char16
spu_rlqw(vec_char16 a
, int count
)
1769 return ((vec_char16
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1772 static __inline vec_ushort8
spu_rlqw(vec_ushort8 a
, int count
)
1774 return ((vec_ushort8
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1777 static __inline vec_short8
spu_rlqw(vec_short8 a
, int count
)
1779 return ((vec_short8
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1782 static __inline vec_uint4
spu_rlqw(vec_uint4 a
, int count
)
1784 return ((vec_uint4
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1787 static __inline vec_int4
spu_rlqw(vec_int4 a
, int count
)
1789 return ((vec_int4
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1792 static __inline vec_float4
spu_rlqw(vec_float4 a
, int count
)
1794 return ((vec_float4
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1797 static __inline vec_ullong2
spu_rlqw(vec_ullong2 a
, int count
)
1799 return ((vec_ullong2
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1802 static __inline vec_llong2
spu_rlqw(vec_llong2 a
, int count
)
1804 return ((vec_llong2
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1807 static __inline vec_double2
spu_rlqw(vec_double2 a
, int count
)
1809 return ((vec_double2
)(si_rotqbi((qword
)(a
), si_from_int(count
))));
1815 static __inline vec_float4
spu_roundtf(vec_double2 a
)
1817 return ((vec_float4
)(si_frds((qword
)(a
))));
1824 #define spu_rsqrte(_a) vec_rsqrte(_a)
1830 static __inline vec_uchar16
spu_sel(vec_uchar16 a
, vec_uchar16 b
, vec_uchar16 pattern
)
1832 return ((vec_uchar16
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1835 static __inline vec_char16
spu_sel(vec_char16 a
, vec_char16 b
, vec_uchar16 pattern
)
1837 return ((vec_char16
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1840 static __inline vec_ushort8
spu_sel(vec_ushort8 a
, vec_ushort8 b
, vec_ushort8 pattern
)
1842 return ((vec_ushort8
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1845 static __inline vec_short8
spu_sel(vec_short8 a
, vec_short8 b
, vec_ushort8 pattern
)
1847 return ((vec_short8
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1850 static __inline vec_uint4
spu_sel(vec_uint4 a
, vec_uint4 b
, vec_uint4 pattern
)
1852 return ((vec_uint4
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1855 static __inline vec_int4
spu_sel(vec_int4 a
, vec_int4 b
, vec_uint4 pattern
)
1857 return ((vec_int4
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1860 static __inline vec_float4
spu_sel(vec_float4 a
, vec_float4 b
, vec_uint4 pattern
)
1862 return ((vec_float4
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1865 static __inline vec_ullong2
spu_sel(vec_ullong2 a
, vec_ullong2 b
, vec_ullong2 pattern
)
1867 return ((vec_ullong2
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1870 static __inline vec_llong2
spu_sel(vec_llong2 a
, vec_llong2 b
, vec_ullong2 pattern
)
1872 return ((vec_llong2
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1875 static __inline vec_double2
spu_sel(vec_double2 a
, vec_double2 b
, vec_ullong2 pattern
)
1877 return ((vec_double2
)(si_selb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1885 static __inline vec_uchar16
spu_shuffle(vec_uchar16 a
, vec_uchar16 b
, vec_uchar16 pattern
)
1887 return ((vec_uchar16
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1890 static __inline vec_char16
spu_shuffle(vec_char16 a
, vec_char16 b
, vec_uchar16 pattern
)
1892 return ((vec_char16
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1895 static __inline vec_ushort8
spu_shuffle(vec_ushort8 a
, vec_ushort8 b
, vec_uchar16 pattern
)
1897 return ((vec_ushort8
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1900 static __inline vec_short8
spu_shuffle(vec_short8 a
, vec_short8 b
, vec_uchar16 pattern
)
1902 return ((vec_short8
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1905 static __inline vec_uint4
spu_shuffle(vec_uint4 a
, vec_uint4 b
, vec_uchar16 pattern
)
1907 return ((vec_uint4
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1910 static __inline vec_int4
spu_shuffle(vec_int4 a
, vec_int4 b
, vec_uchar16 pattern
)
1912 return ((vec_int4
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1915 static __inline vec_float4
spu_shuffle(vec_float4 a
, vec_float4 b
, vec_uchar16 pattern
)
1917 return ((vec_float4
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1920 static __inline vec_ullong2
spu_shuffle(vec_ullong2 a
, vec_ullong2 b
, vec_uchar16 pattern
)
1922 return ((vec_ullong2
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1925 static __inline vec_llong2
spu_shuffle(vec_llong2 a
, vec_llong2 b
, vec_uchar16 pattern
)
1927 return ((vec_llong2
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1930 static __inline vec_double2
spu_shuffle(vec_double2 a
, vec_double2 b
, vec_uchar16 pattern
)
1932 return ((vec_double2
)(si_shufb((qword
)(a
), (qword
)(b
), (qword
)(pattern
))));
1939 static __inline vec_ushort8
spu_sl(vec_ushort8 a
, vec_ushort8 b
)
1941 return ((vec_ushort8
)(si_shlh((qword
)(a
), (qword
)(b
))));
1944 static __inline vec_short8
spu_sl(vec_short8 a
, vec_ushort8 b
)
1946 return ((vec_short8
)(si_shlh((qword
)(a
), (qword
)(b
))));
1949 static __inline vec_uint4
spu_sl(vec_uint4 a
, vec_uint4 b
)
1951 return ((vec_uint4
)(si_shl((qword
)(a
), (qword
)(b
))));
1954 static __inline vec_int4
spu_sl(vec_int4 a
, vec_uint4 b
)
1956 return ((vec_int4
)(si_shl((qword
)(a
), (qword
)(b
))));
1959 static __inline vec_ushort8
spu_sl(vec_ushort8 a
, unsigned int b
)
1961 return ((vec_ushort8
)(si_shlhi((qword
)(a
), b
)));
1964 static __inline vec_short8
spu_sl(vec_short8 a
, unsigned int b
)
1966 return ((vec_short8
)(si_shlhi((qword
)(a
), b
)));
1969 static __inline vec_uint4
spu_sl(vec_uint4 a
, unsigned int b
)
1971 return ((vec_uint4
)(si_shli((qword
)(a
), b
)));
1974 static __inline vec_int4
spu_sl(vec_int4 a
, unsigned int b
)
1976 return ((vec_int4
)(si_shli((qword
)(a
), b
)));
1983 static __inline vec_uchar16
spu_slqw(vec_uchar16 a
, unsigned int count
)
1985 return ((vec_uchar16
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
1988 static __inline vec_char16
spu_slqw(vec_char16 a
, unsigned int count
)
1990 return ((vec_char16
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
1993 static __inline vec_ushort8
spu_slqw(vec_ushort8 a
, unsigned int count
)
1995 return ((vec_ushort8
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
1998 static __inline vec_short8
spu_slqw(vec_short8 a
, unsigned int count
)
2000 return ((vec_short8
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2003 static __inline vec_uint4
spu_slqw(vec_uint4 a
, unsigned int count
)
2005 return ((vec_uint4
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2008 static __inline vec_int4
spu_slqw(vec_int4 a
, unsigned int count
)
2010 return ((vec_int4
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2013 static __inline vec_float4
spu_slqw(vec_float4 a
, unsigned int count
)
2015 return ((vec_float4
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2018 static __inline vec_ullong2
spu_slqw(vec_ullong2 a
, unsigned int count
)
2020 return ((vec_ullong2
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2023 static __inline vec_llong2
spu_slqw(vec_llong2 a
, unsigned int count
)
2025 return ((vec_llong2
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2028 static __inline vec_double2
spu_slqw(vec_double2 a
, unsigned int count
)
2030 return ((vec_double2
)(si_shlqbi((qword
)(a
), si_from_uint(count
))));
2036 static __inline vec_uchar16
spu_slqwbyte(vec_uchar16 a
, unsigned int count
)
2038 return ((vec_uchar16
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2041 static __inline vec_char16
spu_slqwbyte(vec_char16 a
, unsigned int count
)
2043 return ((vec_char16
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2046 static __inline vec_ushort8
spu_slqwbyte(vec_ushort8 a
, unsigned int count
)
2048 return ((vec_ushort8
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2051 static __inline vec_short8
spu_slqwbyte(vec_short8 a
, unsigned int count
)
2053 return ((vec_short8
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2056 static __inline vec_uint4
spu_slqwbyte(vec_uint4 a
, unsigned int count
)
2058 return ((vec_uint4
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2061 static __inline vec_int4
spu_slqwbyte(vec_int4 a
, unsigned int count
)
2063 return ((vec_int4
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2066 static __inline vec_float4
spu_slqwbyte(vec_float4 a
, unsigned int count
)
2068 return ((vec_float4
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2071 static __inline vec_ullong2
spu_slqwbyte(vec_ullong2 a
, unsigned int count
)
2073 return ((vec_ullong2
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2076 static __inline vec_llong2
spu_slqwbyte(vec_llong2 a
, unsigned int count
)
2078 return ((vec_llong2
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2081 static __inline vec_double2
spu_slqwbyte(vec_double2 a
, unsigned int count
)
2083 return ((vec_double2
)(si_shlqby((qword
)(a
), si_from_uint(count
))));
2089 static __inline vec_uchar16
spu_slqwbytebc(vec_uchar16 a
, unsigned int count
)
2091 return ((vec_uchar16
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2094 static __inline vec_char16
spu_slqwbytebc(vec_char16 a
, unsigned int count
)
2096 return ((vec_char16
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2099 static __inline vec_ushort8
spu_slqwbytebc(vec_ushort8 a
, unsigned int count
)
2101 return ((vec_ushort8
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2104 static __inline vec_short8
spu_slqwbytebc(vec_short8 a
, unsigned int count
)
2106 return ((vec_short8
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2109 static __inline vec_uint4
spu_slqwbytebc(vec_uint4 a
, unsigned int count
)
2111 return ((vec_uint4
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2114 static __inline vec_int4
spu_slqwbytebc(vec_int4 a
, unsigned int count
)
2116 return ((vec_int4
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2119 static __inline vec_float4
spu_slqwbytebc(vec_float4 a
, unsigned int count
)
2121 return ((vec_float4
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2124 static __inline vec_ullong2
spu_slqwbytebc(vec_ullong2 a
, unsigned int count
)
2126 return ((vec_ullong2
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2129 static __inline vec_llong2
spu_slqwbytebc(vec_llong2 a
, unsigned int count
)
2131 return ((vec_llong2
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2134 static __inline vec_double2
spu_slqwbytebc(vec_double2 a
, unsigned int count
)
2136 return ((vec_double2
)(si_shlqbybi((qword
)(a
), si_from_uint(count
))));
2142 static __inline vec_uchar16
spu_splats(unsigned char a
)
2146 unsigned char c
[16];
2150 return (vec_splat(in
.v
, 0));
2153 static __inline vec_char16
spu_splats(signed char a
)
2155 return ((vec_char16
)spu_splats((unsigned char)(a
)));
2158 static __inline vec_ushort8
spu_splats(unsigned short a
)
2162 unsigned short s
[8];
2166 return (vec_splat(in
.v
, 0));
2169 static __inline vec_short8
spu_splats(signed short a
)
2171 return ((vec_short8
)spu_splats((unsigned short)(a
)));
2174 static __inline vec_uint4
spu_splats(unsigned int a
)
2182 return (vec_splat(in
.v
, 0));
2185 static __inline vec_int4
spu_splats(signed int a
)
2187 return ((vec_int4
)spu_splats((unsigned int)(a
)));
2190 static __inline vec_float4
spu_splats(float a
)
2198 return (vec_splat(in
.v
, 0));
2201 static __inline vec_ullong2
spu_splats(unsigned long long a
)
2205 unsigned long long l
[2];
2213 static __inline vec_llong2
spu_splats(signed long long a
)
2215 return ((vec_llong2
)spu_splats((unsigned long long)(a
)));
2218 static __inline vec_double2
spu_splats(double a
)
2234 #define spu_stop(_type) si_stop(_type)
2240 static __inline vec_ushort8
spu_sub(vec_ushort8 a
, vec_ushort8 b
)
2242 return ((vec_ushort8
)(si_sfh((qword
)(b
), (qword
)(a
))));
2245 static __inline vec_short8
spu_sub(vec_short8 a
, vec_short8 b
)
2247 return ((vec_short8
)(si_sfh((qword
)(b
), (qword
)(a
))));
2250 static __inline vec_uint4
spu_sub(vec_uint4 a
, vec_uint4 b
)
2252 return ((vec_uint4
)(si_sf((qword
)(b
), (qword
)(a
))));
2255 static __inline vec_int4
spu_sub(vec_int4 a
, vec_int4 b
)
2257 return ((vec_int4
)(si_sf((qword
)(b
), (qword
)(a
))));
2260 static __inline vec_float4
spu_sub(vec_float4 a
, vec_float4 b
)
2262 return ((vec_float4
)(si_fs((qword
)(a
), (qword
)(b
))));
2265 static __inline vec_double2
spu_sub(vec_double2 a
, vec_double2 b
)
2267 return ((vec_double2
)(si_dfs((qword
)(a
), (qword
)(b
))));
2270 static __inline vec_uint4
spu_sub(unsigned int a
, vec_uint4 b
)
2272 return ((vec_uint4
)(si_sfi((qword
)b
, (int)a
)));
2275 static __inline vec_int4
spu_sub(signed int a
, vec_int4 b
)
2277 return ((vec_int4
)(si_sfi((qword
)b
, (int)a
)));
2280 static __inline vec_ushort8
spu_sub(unsigned short a
, vec_ushort8 b
)
2282 return ((vec_ushort8
)(si_sfhi((qword
)b
, (short)a
)));
2285 static __inline vec_short8
spu_sub(signed short a
, vec_short8 b
)
2287 return ((vec_short8
)(si_sfhi((qword
)b
, (short)a
)));
2293 static __inline vec_uint4
spu_subx(vec_uint4 a
, vec_uint4 b
, vec_uint4 c
)
2295 return ((vec_uint4
)(si_sfx((qword
)(b
), (qword
)(a
), (qword
)(c
))));
2298 static __inline vec_int4
spu_subx(vec_int4 a
, vec_int4 b
, vec_int4 c
)
2300 return ((vec_int4
)(si_sfx((qword
)(b
), (qword
)(a
), (qword
)(c
))));
2306 static __inline vec_ushort8
spu_sumb(vec_uchar16 a
, vec_uchar16 b
)
2308 return ((vec_ushort8
)(si_sumb((qword
)(a
), (qword
)(b
))));
2316 #define spu_sync() /* do nothing */
2318 #define spu_sync_c() /* do nothing */
2324 #define spu_writech(_channel, _a) /* not mappable */
2329 #define spu_writechqw(_channel, _a) /* not mappable */
2335 static __inline vec_uchar16
spu_xor(vec_uchar16 a
, vec_uchar16 b
)
2337 return ((vec_uchar16
)(si_xor((qword
)(a
), (qword
)(b
))));
2340 static __inline vec_char16
spu_xor(vec_char16 a
, vec_char16 b
)
2342 return ((vec_char16
)(si_xor((qword
)(a
), (qword
)(b
))));
2345 static __inline vec_ushort8
spu_xor(vec_ushort8 a
, vec_ushort8 b
)
2347 return ((vec_ushort8
)(si_xor((qword
)(a
), (qword
)(b
))));
2350 static __inline vec_short8
spu_xor(vec_short8 a
, vec_short8 b
)
2352 return ((vec_short8
)(si_xor((qword
)(a
), (qword
)(b
))));
2355 static __inline vec_uint4
spu_xor(vec_uint4 a
, vec_uint4 b
)
2357 return ((vec_uint4
)(si_xor((qword
)(a
), (qword
)(b
))));
2360 static __inline vec_int4
spu_xor(vec_int4 a
, vec_int4 b
)
2362 return ((vec_int4
)(si_xor((qword
)(a
), (qword
)(b
))));
2365 static __inline vec_float4
spu_xor(vec_float4 a
, vec_float4 b
)
2367 return ((vec_float4
)(si_xor((qword
)(a
), (qword
)(b
))));
2370 static __inline vec_ullong2
spu_xor(vec_ullong2 a
, vec_ullong2 b
)
2372 return ((vec_ullong2
)(si_xor((qword
)(a
), (qword
)(b
))));
2375 static __inline vec_llong2
spu_xor(vec_llong2 a
, vec_llong2 b
)
2377 return ((vec_llong2
)(si_xor((qword
)(a
), (qword
)(b
))));
2380 static __inline vec_double2
spu_xor(vec_double2 a
, vec_double2 b
)
2382 return ((vec_double2
)(si_xor((qword
)(a
), (qword
)(b
))));
2385 static __inline vec_uchar16
spu_xor(vec_uchar16 a
, unsigned char b
)
2387 return ((vec_uchar16
)(si_xorbi((qword
)(a
), b
)));
2390 static __inline vec_char16
spu_xor(vec_char16 a
, signed char b
)
2392 return ((vec_char16
)(si_xorbi((qword
)(a
), (unsigned char)(b
))));
2395 static __inline vec_ushort8
spu_xor(vec_ushort8 a
, unsigned short b
)
2397 return ((vec_ushort8
)(si_xorhi((qword
)(a
), b
)));
2400 static __inline vec_short8
spu_xor(vec_short8 a
, signed short b
)
2402 return ((vec_short8
)(si_xorhi((qword
)(a
), (unsigned short)(b
))));
2405 static __inline vec_uint4
spu_xor(vec_uint4 a
, unsigned int b
)
2407 return ((vec_uint4
)(si_xori((qword
)(a
), b
)));
2410 static __inline vec_int4
spu_xor(vec_int4 a
, signed int b
)
2412 return ((vec_int4
)(si_xori((qword
)(a
), (unsigned int)(b
))));
2415 #endif /* !__SPU__ */
2416 #endif /* __cplusplus */
2417 #endif /* !_SPU2VMX_H_ */