OSDN Git Service

PR target/36634
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / spu2vmx.h
1 /* Cell SPU 2 VMX intrinsics header
2    Copyright (C) 2007 Free Software Foundation, Inc.
3
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) 
7    any later version.
8
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
12    for more details.
13
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
17    02110-1301, USA.  */
18
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.  */ 
24
25 #ifndef _SPU2VMX_H_
26 #define _SPU2VMX_H_     1
27
28 #ifdef __cplusplus
29
30 #ifndef __SPU__
31
32 #include <si2vmx.h>
33
34 /* spu_absd (absolute difference)
35  * ========
36  */
37 static __inline vec_uchar16 spu_absd(vec_uchar16 a, vec_uchar16 b)
38 {
39   return ((vec_uchar16)(si_absdb((qword)(a), (qword)(b))));
40
41 }
42
43
44 /* spu_add
45  * =======
46  */
47 static __inline vec_uint4 spu_add(vec_uint4 a, vec_uint4 b)
48 {
49   return ((vec_uint4)(si_a((qword)(a), (qword)(b))));
50 }
51
52 static __inline vec_int4 spu_add(vec_int4 a, vec_int4 b)
53 {
54   return ((vec_int4)(si_a((qword)(a), (qword)(b))));
55 }
56
57 static __inline vec_ushort8 spu_add(vec_ushort8 a, vec_ushort8 b)
58 {
59   return ((vec_ushort8)(si_ah((qword)(a), (qword)(b))));
60 }
61
62 static __inline vec_short8 spu_add(vec_short8 a, vec_short8 b)
63 {
64   return ((vec_short8)(si_ah((qword)(a), (qword)(b))));
65 }
66
67 static __inline vec_uint4 spu_add(vec_uint4 a, unsigned int b)
68 {
69   return ((vec_uint4)(si_ai((qword)(a), (int)(b))));
70 }
71
72 static __inline vec_int4 spu_add(vec_int4 a, int b)
73 {
74   return ((vec_int4)(si_ai((qword)(a), b)));
75 }
76
77 static __inline vec_ushort8 spu_add(vec_ushort8 a, unsigned short b)
78 {
79   return ((vec_ushort8)(si_ahi((qword)(a), (short)(b))));
80 }
81
82 static __inline vec_short8 spu_add(vec_short8 a, short b)
83 {
84   return ((vec_short8)(si_ahi((qword)(a), b)));
85 }
86
87 static __inline vec_float4 spu_add(vec_float4 a, vec_float4 b)
88 {
89   return ((vec_float4)(si_fa((qword)(a), (qword)(b))));
90 }
91
92 static __inline vec_double2 spu_add(vec_double2 a, vec_double2 b)
93 {
94   return ((vec_double2)(si_dfa((qword)(a), (qword)(b))));
95 }
96
97
98 /* spu_addx
99  * ========
100  */
101 static __inline vec_uint4 spu_addx(vec_uint4 a, vec_uint4 b, vec_uint4 c)
102 {
103   return ((vec_uint4)(si_addx((qword)(a), (qword)(b), (qword)(c))));
104 }
105
106 static __inline vec_int4 spu_addx(vec_int4 a, vec_int4 b, vec_int4 c)
107 {
108   return ((vec_int4)(si_addx((qword)(a), (qword)(b), (qword)(c))));
109 }
110
111
112 /* spu_and
113  * =======
114  */
115 static __inline vec_uchar16 spu_and(vec_uchar16 a, vec_uchar16 b)
116 {
117   return ((vec_uchar16)(si_and((qword)(a), (qword)(b))));
118 }
119
120 static __inline vec_char16 spu_and(vec_char16 a, vec_char16 b)
121 {
122   return ((vec_char16)(si_and((qword)(a), (qword)(b))));
123 }
124
125 static __inline vec_ushort8 spu_and(vec_ushort8 a, vec_ushort8 b)
126 {
127   return ((vec_ushort8)(si_and((qword)(a), (qword)(b))));
128 }
129
130 static __inline vec_short8 spu_and(vec_short8 a, vec_short8 b)
131 {
132   return ((vec_short8)(si_and((qword)(a), (qword)(b))));
133 }
134
135 static __inline vec_uint4 spu_and(vec_uint4 a, vec_uint4 b)
136 {
137   return ((vec_uint4)(si_and((qword)(a), (qword)(b))));
138 }
139
140 static __inline vec_int4 spu_and(vec_int4 a, vec_int4 b)
141 {
142   return ((vec_int4)(si_and((qword)(a), (qword)(b))));
143 }
144
145 static __inline vec_float4 spu_and(vec_float4 a, vec_float4 b)
146 {
147   return ((vec_float4)(si_and((qword)(a), (qword)(b))));
148 }
149
150 static __inline vec_ullong2 spu_and(vec_ullong2 a, vec_ullong2 b)
151 {
152   return ((vec_ullong2)(si_and((qword)(a), (qword)(b))));
153 }
154
155 static __inline vec_llong2 spu_and(vec_llong2 a, vec_llong2 b)
156 {
157   return ((vec_llong2)(si_and((qword)(a), (qword)(b))));
158 }
159
160 static __inline vec_double2 spu_and(vec_double2 a, vec_double2 b)
161 {
162   return ((vec_double2)(si_and((qword)(a), (qword)(b))));
163 }
164
165 static __inline vec_uchar16 spu_and(vec_uchar16 a, unsigned char b)
166 {
167   return ((vec_uchar16)(si_andbi((qword)(a), (signed char)(b))));
168 }
169
170
171 static __inline vec_char16 spu_and(vec_char16 a, signed char b)
172 {
173   return ((vec_char16)(si_andbi((qword)(a), b)));
174 }
175
176 static __inline vec_ushort8 spu_and(vec_ushort8 a, unsigned short b)
177 {
178   return ((vec_ushort8)(si_andhi((qword)(a), (signed short)(b))));
179 }
180
181 static __inline vec_short8 spu_and(vec_short8 a, signed short b)
182 {
183   return ((vec_short8)(si_andhi((qword)(a), b)));
184 }
185
186 static __inline vec_uint4 spu_and(vec_uint4 a, unsigned int b)
187 {
188   return ((vec_uint4)(si_andi((qword)(a), (signed int)(b))));
189 }
190
191 static __inline vec_int4 spu_and(vec_int4 a, signed int b)
192 {
193   return ((vec_int4)(si_andi((qword)(a), b)));
194 }
195
196
197 /* spu_andc
198  * ========
199  */
200 #define spu_andc(_a, _b)        vec_andc(_a, _b)
201
202
203 /* spu_avg
204  * =======
205  */
206 #define spu_avg(_a, _b)         vec_avg(_a, _b)
207   
208
209 /* spu_bisled
210  * spu_bisled_d
211  * spu_bisled_e
212  * ============
213  */
214 #define spu_bisled(_func)       /* not mappable */
215 #define spu_bisled_d(_func)     /* not mappable */
216 #define spu_bisled_e(_func)     /* not mappable */
217
218 /* spu_cmpabseq
219  * ============
220  */
221 static __inline vec_uint4 spu_cmpabseq(vec_float4 a, vec_float4 b)
222 {
223   return ((vec_uint4)(si_fcmeq((qword)(a), (qword)(b))));
224
225 }
226
227 static __inline vec_ullong2 spu_cmpabseq(vec_double2 a, vec_double2 b)
228 {
229   return ((vec_ullong2)(si_dfcmeq((qword)(a), (qword)(b))));
230 }
231
232
233 /* spu_cmpabsgt
234  * ============
235  */
236 static __inline vec_uint4 spu_cmpabsgt(vec_float4 a, vec_float4 b)
237 {
238   return ((vec_uint4)(si_fcmgt((qword)(a), (qword)(b))));
239 }
240
241 static __inline vec_ullong2 spu_cmpabsgt(vec_double2 a, vec_double2 b)
242 {
243   return ((vec_ullong2)(si_dfcmgt((qword)(a), (qword)(b))));
244 }
245
246
247 /* spu_cmpeq
248  * ========
249  */
250 static __inline vec_uchar16 spu_cmpeq(vec_uchar16 a, vec_uchar16 b)
251 {
252   return ((vec_uchar16)(si_ceqb((qword)(a), (qword)(b))));
253 }
254
255 static __inline vec_uchar16 spu_cmpeq(vec_char16 a, vec_char16 b)
256 {
257   return ((vec_uchar16)(si_ceqb((qword)(a), (qword)(b))));
258 }
259
260 static __inline vec_ushort8 spu_cmpeq(vec_ushort8 a, vec_ushort8 b)
261 {
262   return ((vec_ushort8)(si_ceqh((qword)(a), (qword)(b))));
263 }
264
265 static __inline vec_ushort8 spu_cmpeq(vec_short8 a, vec_short8 b)
266 {
267   return ((vec_ushort8)(si_ceqh((qword)(a), (qword)(b))));
268 }
269
270 static __inline vec_uint4 spu_cmpeq(vec_uint4 a, vec_uint4 b)
271 {
272   return ((vec_uint4)(si_ceq((qword)(a), (qword)(b))));
273 }
274
275 static __inline vec_uint4 spu_cmpeq(vec_int4 a, vec_int4 b)
276 {
277   return ((vec_uint4)(si_ceq((qword)(a), (qword)(b))));
278 }
279
280 static __inline vec_uint4 spu_cmpeq(vec_float4 a, vec_float4 b)
281 {
282   return ((vec_uint4)(si_fceq((qword)(a), (qword)(b))));
283 }
284
285 static __inline vec_uchar16 spu_cmpeq(vec_uchar16 a, unsigned char b)
286 {
287   return ((vec_uchar16)(si_ceqbi((qword)(a), (signed char)(b))));
288 }
289
290 static __inline vec_uchar16 spu_cmpeq(vec_char16 a, signed char b)
291 {
292   return ((vec_uchar16)(si_ceqbi((qword)(a), b)));
293 }
294
295 static __inline vec_ushort8 spu_cmpeq(vec_ushort8 a, unsigned short b)
296 {
297   return ((vec_ushort8)(si_ceqhi((qword)(a), (signed short)(b))));
298 }
299
300 static __inline vec_ushort8 spu_cmpeq(vec_short8 a, signed short b)
301 {
302   return ((vec_ushort8)(si_ceqhi((qword)(a), b)));
303 }
304
305 static __inline vec_uint4 spu_cmpeq(vec_uint4 a, unsigned int b)
306 {
307   return ((vec_uint4)(si_ceqi((qword)(a), (signed int)(b))));
308 }
309
310 static __inline vec_uint4 spu_cmpeq(vec_int4 a, signed int b)
311 {
312   return ((vec_uint4)(si_ceqi((qword)(a), b)));
313 }
314
315 static __inline vec_ullong2 spu_cmpeq(vec_double2 a, vec_double2 b)
316 {
317   return ((vec_ullong2)(si_dfceq((qword)(a), (qword)(b))));
318 }
319
320
321 /* spu_cmpgt
322  * ========
323  */
324 static __inline vec_uchar16 spu_cmpgt(vec_uchar16 a, vec_uchar16 b)
325 {
326   return ((vec_uchar16)(si_clgtb((qword)(a), (qword)(b))));
327 }
328
329 static __inline vec_uchar16 spu_cmpgt(vec_char16 a, vec_char16 b)
330 {
331   return ((vec_uchar16)(si_cgtb((qword)(a), (qword)(b))));
332 }
333
334 static __inline vec_ushort8 spu_cmpgt(vec_ushort8 a, vec_ushort8 b)
335 {
336   return ((vec_ushort8)(si_clgth((qword)(a), (qword)(b))));
337 }
338
339 static __inline vec_ushort8 spu_cmpgt(vec_short8 a, vec_short8 b)
340 {
341   return ((vec_ushort8)(si_cgth((qword)(a), (qword)(b))));
342 }
343
344 static __inline vec_uint4 spu_cmpgt(vec_uint4 a, vec_uint4 b)
345 {
346   return ((vec_uint4)(si_clgt((qword)(a), (qword)(b))));
347 }
348
349 static __inline vec_uint4 spu_cmpgt(vec_int4 a, vec_int4 b)
350 {
351   return ((vec_uint4)(si_cgt((qword)(a), (qword)(b))));
352 }
353
354 static __inline vec_uint4 spu_cmpgt(vec_float4 a, vec_float4 b)
355 {
356   return ((vec_uint4)(si_fcgt((qword)(a), (qword)(b))));
357 }
358
359 static __inline vec_uchar16 spu_cmpgt(vec_uchar16 a, unsigned char b)
360 {
361   return ((vec_uchar16)(si_clgtbi((qword)(a), b)));
362 }
363
364 static __inline vec_uchar16 spu_cmpgt(vec_char16 a, signed char b)
365 {
366   return ((vec_uchar16)(si_cgtbi((qword)(a), b)));
367 }
368
369 static __inline vec_ushort8 spu_cmpgt(vec_ushort8 a, unsigned short b)
370 {
371   return ((vec_ushort8)(si_clgthi((qword)(a), b)));
372 }
373
374 static __inline vec_ushort8 spu_cmpgt(vec_short8 a, signed short b)
375 {
376   return ((vec_ushort8)(si_cgthi((qword)(a), b)));
377 }
378
379 static __inline vec_uint4 spu_cmpgt(vec_uint4 a, unsigned int b)
380 {
381   return ((vec_uint4)(si_clgti((qword)(a), b)));
382 }
383
384 static __inline vec_uint4 spu_cmpgt(vec_int4 a, signed int b)
385 {
386   return ((vec_uint4)(si_cgti((qword)(a), b)));
387 }
388
389 static __inline vec_ullong2 spu_cmpgt(vec_double2 a, vec_double2 b)
390 {
391   return ((vec_ullong2)(si_dfcgt((qword)(a), (qword)(b))));
392 }
393
394
395 /* spu_cntb
396  * ========
397  */
398 static __inline vec_uchar16 spu_cntb(vec_uchar16 a)
399 {
400   return ((vec_uchar16)(si_cntb((qword)(a))));
401 }
402
403
404 static __inline vec_uchar16 spu_cntb(vec_char16 a)
405 {
406   return ((vec_uchar16)(si_cntb((qword)(a))));
407 }
408
409 /* spu_cntlz
410  * =========
411  */
412 static __inline vec_uint4 spu_cntlz(vec_uint4 a)
413 {
414   return ((vec_uint4)(si_clz((qword)(a))));
415 }
416
417 static __inline vec_uint4 spu_cntlz(vec_int4 a)
418 {
419   return ((vec_uint4)(si_clz((qword)(a))));
420 }
421
422 static __inline vec_uint4 spu_cntlz(vec_float4 a)
423 {
424   return ((vec_uint4)(si_clz((qword)(a))));
425 }
426
427 /* spu_testsv
428  * ==========
429  */
430 static __inline vec_ullong2 spu_testsv(vec_double2 a, char b)
431 {
432   return ((vec_ullong2)(si_dftsv((qword)(a), b)));
433 }
434
435 /* spu_convtf
436  * ==========
437  */
438 #define spu_convtf(_a, _b)      (vec_ctf(_a, _b))
439
440 /* spu_convts
441  * ==========
442  */
443 #define spu_convts(_a, _b)      (vec_cts(_a, _b))
444
445 /* spu_convtu
446  * ==========
447  */
448 #define spu_convtu(_a, _b)      (vec_ctu(_a, _b))
449
450
451 /* spu_dsync
452  * ========
453  */
454 #define spu_dsync()
455
456 /* spu_eqv
457  * =======
458  */
459 static __inline vec_uchar16 spu_eqv(vec_uchar16 a, vec_uchar16 b)
460 {
461   return ((vec_uchar16)(si_eqv((qword)(a), (qword)(b))));
462 }
463
464 static __inline vec_char16 spu_eqv(vec_char16 a, vec_char16 b)
465 {
466   return ((vec_char16)(si_eqv((qword)(a), (qword)(b))));
467 }
468
469 static __inline vec_ushort8 spu_eqv(vec_ushort8 a, vec_ushort8 b)
470 {
471   return ((vec_ushort8)(si_eqv((qword)(a), (qword)(b))));
472 }
473
474 static __inline vec_short8 spu_eqv(vec_short8 a, vec_short8 b)
475 {
476   return ((vec_short8)(si_eqv((qword)(a), (qword)(b))));
477 }
478
479 static __inline vec_uint4 spu_eqv(vec_uint4 a, vec_uint4 b)
480 {
481   return ((vec_uint4)(si_eqv((qword)(a), (qword)(b))));
482 }
483
484 static __inline vec_int4 spu_eqv(vec_int4 a, vec_int4 b)
485 {
486   return ((vec_int4)(si_eqv((qword)(a), (qword)(b))));
487 }
488
489 static __inline vec_float4 spu_eqv(vec_float4 a, vec_float4 b)
490 {
491   return ((vec_float4)(si_eqv((qword)(a), (qword)(b))));
492 }
493
494 static __inline vec_ullong2 spu_eqv(vec_ullong2 a, vec_ullong2 b)
495 {
496   return ((vec_ullong2)(si_eqv((qword)(a), (qword)(b))));
497 }
498
499 static __inline vec_llong2 spu_eqv(vec_llong2 a, vec_llong2 b)
500 {
501   return ((vec_llong2)(si_eqv((qword)(a), (qword)(b))));
502 }
503
504 static __inline vec_double2 spu_eqv(vec_double2 a, vec_double2 b)
505 {
506   return ((vec_double2)(si_eqv((qword)(a), (qword)(b))));
507 }
508
509 /* spu_extend
510  * ========
511  */
512 static __inline vec_short8 spu_extend(vec_char16 a)
513 {
514   return ((vec_short8)(si_xsbh((qword)(a))));
515 }
516
517
518 static __inline vec_int4 spu_extend(vec_short8 a)
519 {
520   return ((vec_int4)(si_xshw((qword)(a))));
521 }
522
523 static __inline vec_llong2 spu_extend(vec_int4 a)
524 {
525   return ((vec_llong2)(si_xswd((qword)(a))));
526 }
527
528
529 static __inline vec_double2 spu_extend(vec_float4 a)
530 {
531   return ((vec_double2)(si_fesd((qword)(a))));
532 }
533
534
535 /* spu_extract
536  * ========
537  */
538 static __inline unsigned char spu_extract(vec_uchar16 a, int element)
539 {
540   union {
541     vec_uchar16 v;
542     unsigned char c[16];
543   } in;
544
545   in.v = a;
546   return (in.c[element & 15]);
547 }
548
549 static __inline signed char spu_extract(vec_char16 a, int element)
550 {
551   union {
552     vec_char16 v;
553     signed char c[16];
554   } in;
555
556   in.v = a;
557   return (in.c[element & 15]);
558 }
559
560 static __inline unsigned short spu_extract(vec_ushort8 a, int element)
561 {
562   union {
563     vec_ushort8 v;
564     unsigned short s[8];
565   } in;
566
567   in.v = a;
568   return (in.s[element & 7]);
569 }
570
571 static __inline signed short spu_extract(vec_short8 a, int element)
572 {
573   union {
574     vec_short8 v;
575     signed short s[8];
576   } in;
577
578   in.v = a;
579   return (in.s[element & 7]);
580 }
581
582 static __inline unsigned int spu_extract(vec_uint4 a, int element)
583 {
584   union {
585     vec_uint4 v;
586     unsigned int i[4];
587   } in;
588
589   in.v = a;
590   return (in.i[element & 3]);
591 }
592
593 static __inline signed int spu_extract(vec_int4 a, int element)
594 {
595   union {
596     vec_int4 v;
597     signed int i[4];
598   } in;
599
600   in.v = a;
601   return (in.i[element & 3]);
602 }
603
604 static __inline float spu_extract(vec_float4 a, int element)
605 {
606   union {
607     vec_float4 v;
608     float f[4];
609   } in;
610
611   in.v = a;
612   return (in.f[element & 3]);
613 }
614
615 static __inline unsigned long long  spu_extract(vec_ullong2 a, int element)
616 {
617   union {
618     vec_ullong2 v;
619     unsigned long long l[2];
620   } in;
621
622   in.v = a;
623   return (in.l[element & 1]);
624 }
625
626 static __inline signed long long  spu_extract(vec_llong2 a, int element)
627 {
628   union {
629     vec_llong2 v;
630     signed long long l[2];
631   } in;
632
633   in.v = a;
634   return (in.l[element & 1]);
635 }
636
637 static __inline double spu_extract(vec_double2 a, int element)
638 {
639   union {
640     vec_double2 v;
641     double d[2];
642   } in;
643
644   in.v = a;
645   return (in.d[element & 1]);
646 }
647
648 /* spu_gather
649  * ========
650  */
651 static __inline vec_uint4 spu_gather(vec_uchar16 a)
652 {
653   return ((vec_uint4)(si_gbb((qword)(a))));
654 }
655
656
657 static __inline vec_uint4 spu_gather(vec_char16 a)
658 {
659   return ((vec_uint4)(si_gbb((qword)(a))));
660 }
661
662 static __inline vec_uint4 spu_gather(vec_ushort8 a)
663 {
664   return ((vec_uint4)(si_gbh((qword)(a))));
665 }
666
667 static __inline vec_uint4 spu_gather(vec_short8 a)
668 {
669   return ((vec_uint4)(si_gbh((qword)(a))));
670 }
671
672
673 static __inline vec_uint4 spu_gather(vec_uint4 a)
674 {
675   return ((vec_uint4)(si_gb((qword)(a))));
676 }
677
678 static __inline vec_uint4 spu_gather(vec_int4 a)
679 {
680   return ((vec_uint4)(si_gb((qword)(a))));
681 }
682
683 static __inline vec_uint4 spu_gather(vec_float4 a)
684 {
685   return ((vec_uint4)(si_gb((qword)(a))));
686 }
687
688 /* spu_genb
689  * ========
690  */
691 static __inline vec_uint4 spu_genb(vec_uint4 a, vec_uint4 b)
692 {
693   return ((vec_uint4)(si_bg((qword)(b), (qword)(a))));
694 }
695
696 static __inline vec_int4 spu_genb(vec_int4 a, vec_int4 b)
697 {
698   return ((vec_int4)(si_bg((qword)(b), (qword)(a))));
699 }
700
701 /* spu_genbx
702  * =========
703  */
704 static __inline vec_uint4 spu_genbx(vec_uint4 a, vec_uint4 b, vec_uint4 c)
705 {
706   return ((vec_uint4)(si_bgx((qword)(b), (qword)(a), (qword)(c))));
707 }
708
709 static __inline vec_int4 spu_genbx(vec_int4 a, vec_int4 b, vec_int4 c)
710 {
711   return ((vec_int4)(si_bgx((qword)(b), (qword)(a), (qword)(c))));
712 }
713
714
715 /* spu_genc
716  * ========
717  */
718 static __inline vec_uint4 spu_genc(vec_uint4 a, vec_uint4 b)
719 {
720   return ((vec_uint4)(si_cg((qword)(a), (qword)(b))));
721 }
722
723 static __inline vec_int4 spu_genc(vec_int4 a, vec_int4 b)
724 {
725   return ((vec_int4)(si_cg((qword)(a), (qword)(b))));
726 }
727
728 /* spu_gencx
729  * =========
730  */
731 static __inline vec_uint4 spu_gencx(vec_uint4 a, vec_uint4 b, vec_uint4 c)
732 {
733   return ((vec_uint4)(si_cgx((qword)(a), (qword)(b), (qword)(c))));
734 }
735
736 static __inline vec_int4 spu_gencx(vec_int4 a, vec_int4 b, vec_int4 c)
737 {
738   return ((vec_int4)(si_cgx((qword)(a), (qword)(b), (qword)(c))));
739 }
740
741
742 /* spu_hcmpeq
743  * ========
744  */
745 #define spu_hcmpeq(_a, _b)      if (_a == _b) { SPU_HALT_ACTION; };
746
747
748 /* spu_hcmpgt
749  * ========
750  */
751 #define spu_hcmpgt(_a, _b)      if (_a > _b) { SPU_HALT_ACTION; };
752
753
754 /* spu_idisable
755  * ============
756  */
757 #define spu_idisable()          SPU_UNSUPPORTED_ACTION
758
759
760 /* spu_ienable
761  * ===========
762  */
763 #define spu_ienable()           SPU_UNSUPPORTED_ACTION
764
765
766 /* spu_insert
767  * ========
768  */
769 static __inline vec_uchar16 spu_insert(unsigned char a, vec_uchar16 b, int element)
770 {
771   union {
772     vec_uchar16 v;
773     unsigned char c[16];
774   } in;
775
776   in.v = b;
777   in.c[element & 15] = a;
778   return (in.v);
779 }
780
781 static __inline vec_char16 spu_insert(signed char a, vec_char16 b, int element)
782 {
783   return ((vec_char16)spu_insert((unsigned char)(a), (vec_uchar16)(b), element));
784 }
785
786 static __inline vec_ushort8 spu_insert(unsigned short a, vec_ushort8 b, int element)
787 {
788   union {
789     vec_ushort8 v;
790     unsigned short s[8];
791   } in;
792
793   in.v = b;
794   in.s[element & 7] = a;
795   return (in.v);
796 }
797
798 static __inline vec_short8 spu_insert(signed short a, vec_short8 b, int element)
799 {
800   return ((vec_short8)spu_insert((unsigned short)(a), (vec_ushort8)(b), element));
801 }
802
803 static __inline vec_uint4 spu_insert(unsigned int a, vec_uint4 b, int element)
804 {
805   union {
806     vec_uint4 v;
807     unsigned int i[4];
808   } in;
809
810   in.v = b;
811   in.i[element & 3] = a;
812   return (in.v);
813 }
814
815 static __inline vec_int4 spu_insert(signed int a, vec_int4 b, int element)
816 {
817   return ((vec_int4)spu_insert((unsigned int)(a), (vec_uint4)(b), element));
818 }
819
820 static __inline vec_float4 spu_insert(float a, vec_float4 b, int element)
821 {
822   union {
823     vec_float4 v;
824     float f[4];
825   } in;
826
827   in.v = b;
828   in.f[element & 3] = a;
829   return (in.v);
830 }
831
832 static __inline vec_ullong2 spu_insert(unsigned long long a, vec_ullong2 b, int element)
833 {
834   union {
835     vec_ullong2 v;
836     unsigned long long l[2];
837   } in;
838
839   in.v = b;
840   in.l[element & 1] = a;
841   return (in.v);
842 }
843
844 static __inline vec_llong2 spu_insert(signed long long a, vec_llong2 b, int element)
845 {
846   return ((vec_llong2)spu_insert((unsigned long long)(a), (vec_ullong2)(b), element));
847 }
848
849 static __inline vec_double2 spu_insert(double a, vec_double2 b, int element)
850 {
851   union {
852     vec_double2 v;
853     double d[2];
854   } in;
855
856   in.v = b;
857   in.d[element & 1] = a;
858   return (in.v);
859 }
860
861
862 /* spu_madd
863  * ========
864  */
865 static __inline vec_int4 spu_madd(vec_short8 a, vec_short8 b, vec_int4 c)
866 {
867   return ((vec_int4)(si_mpya((qword)(a), (qword)(b), (qword)(c))));
868 }
869
870 static __inline vec_float4 spu_madd(vec_float4 a, vec_float4 b, vec_float4 c)
871 {
872   return ((vec_float4)(si_fma((qword)(a), (qword)(b), (qword)(c))));
873 }
874
875 static __inline vec_double2 spu_madd(vec_double2 a, vec_double2 b, vec_double2 c)
876 {
877   return ((vec_double2)(si_dfma((qword)(a), (qword)(b), (qword)(c))));
878 }
879
880
881 /* spu_maskb
882  * ========
883  */
884 #define spu_maskb(_a)   (vec_uchar16)(si_fsmb(si_from_int((int)(_a))))
885
886 /* spu_maskh
887  * ========
888  */
889 #define spu_maskh(_a)   (vec_ushort8)(si_fsmh(si_from_int((int)(_a))))
890
891
892 /* spu_maskw
893  * ========
894  */
895 #define spu_maskw(_a)   (vec_uint4)(si_fsm(si_from_int((int)(_a))))
896
897
898 /* spu_mfcdma32
899  * ========
900  */
901 #define spu_mfcdma32(_ls, _ea, _size, _tagid, _cmd)
902
903
904 /* spu_mfcdma64
905  * ========
906  */
907 #define spu_mfcdma64(_ls, _eahi, _ealow,  _size, _tagid, _cmd)
908
909 /* spu_mfcstat
910  * ========
911  */
912 #define spu_mfcstat(_type)      0xFFFFFFFF
913
914
915
916 /* spu_mffpscr
917  * ===========
918  */
919 #define spu_mffpscr()           (vec_uint4)(si_fscrrd())
920
921
922 /* spu_mfspr
923  * ========
924  */
925
926 #define spu_mfspr(_reg)         si_to_uint(si_mfspr(_reg))
927
928
929
930 /* spu_mhhadd
931  * ==========
932  */
933 static __inline vec_int4 spu_mhhadd(vec_short8 a, vec_short8 b, vec_int4 c)
934 {
935   return ((vec_int4)(si_mpyhha((qword)(a), (qword)(b), (qword)(c))));
936 }
937
938
939 static __inline vec_uint4 spu_mhhadd(vec_ushort8 a, vec_ushort8 b, vec_uint4 c)
940 {
941   return ((vec_uint4)(si_mpyhhau((qword)(a), (qword)(b), (qword)(c))));
942 }
943
944
945 /* spu_msub
946  * ========
947  */
948 static __inline vec_float4 spu_msub(vec_float4 a, vec_float4 b, vec_float4 c)
949 {
950   return ((vec_float4)(si_fms((qword)(a), (qword)(b), (qword)(c))));
951 }
952
953 static __inline vec_double2 spu_msub(vec_double2 a, vec_double2 b, vec_double2 c)
954 {
955   return ((vec_double2)(si_dfms((qword)(a), (qword)(b), (qword)(c))));
956 }
957
958
959 /* spu_mtfpscr
960  * ===========
961  */
962 #define spu_mtfpscr(_a)
963
964
965 /* spu_mtspr
966  * ========
967  */
968 #define spu_mtspr(_reg, _a)
969
970
971 /* spu_mul
972  * ========
973  */
974 static __inline vec_float4 spu_mul(vec_float4 a, vec_float4 b)
975 {
976   return ((vec_float4)(si_fm((qword)(a), (qword)(b))));
977 }
978
979 static __inline vec_double2 spu_mul(vec_double2 a, vec_double2 b)
980 {
981   return ((vec_double2)(si_dfm((qword)(a), (qword)(b))));
982 }
983
984
985 /* spu_mulh
986  * ========
987  */
988 static __inline vec_int4 spu_mulh(vec_short8 a, vec_short8 b)
989 {
990   return ((vec_int4)(si_mpyh((qword)(a), (qword)(b))));
991 }
992
993 /* spu_mule
994  * =========
995  */
996 #define spu_mule(_a, _b)        vec_mule(_a, _b)
997
998
999
1000 /* spu_mulo
1001  * ========
1002  */
1003 static __inline vec_int4 spu_mulo(vec_short8 a, vec_short8 b)
1004 {
1005   return ((vec_int4)(si_mpy((qword)(a), (qword)(b))));
1006 }
1007
1008
1009 static __inline vec_uint4 spu_mulo(vec_ushort8 a, vec_ushort8 b)
1010 {
1011   return ((vec_uint4)(si_mpyu((qword)(a), (qword)(b))));
1012 }
1013
1014
1015 static __inline vec_int4 spu_mulo(vec_short8 a, short b)
1016 {
1017   return ((vec_int4)(si_mpyi((qword)(a), b)));
1018 }
1019
1020 static __inline vec_uint4 spu_mulo(vec_ushort8 a, unsigned short b)
1021 {
1022   return ((vec_uint4)(si_mpyui((qword)(a), b)));
1023 }
1024
1025
1026 /* spu_mulsr
1027  * =========
1028  */
1029 static __inline vec_int4 spu_mulsr(vec_short8 a, vec_short8 b)
1030 {
1031   return ((vec_int4)(si_mpys((qword)(a), (qword)(b))));
1032 }
1033
1034
1035 /* spu_nand
1036  * ========
1037  */
1038 static __inline vec_uchar16 spu_nand(vec_uchar16 a, vec_uchar16 b)
1039 {
1040   return ((vec_uchar16)(si_nand((qword)(a), (qword)(b))));
1041 }
1042
1043 static __inline vec_char16 spu_nand(vec_char16 a, vec_char16 b)
1044 {
1045   return ((vec_char16)(si_nand((qword)(a), (qword)(b))));
1046 }
1047
1048 static __inline vec_ushort8 spu_nand(vec_ushort8 a, vec_ushort8 b)
1049 {
1050   return ((vec_ushort8)(si_nand((qword)(a), (qword)(b))));
1051 }
1052
1053 static __inline vec_short8 spu_nand(vec_short8 a, vec_short8 b)
1054 {
1055   return ((vec_short8)(si_nand((qword)(a), (qword)(b))));
1056 }
1057
1058 static __inline vec_uint4 spu_nand(vec_uint4 a, vec_uint4 b)
1059 {
1060   return ((vec_uint4)(si_nand((qword)(a), (qword)(b))));
1061 }
1062
1063 static __inline vec_int4 spu_nand(vec_int4 a, vec_int4 b)
1064 {
1065   return ((vec_int4)(si_nand((qword)(a), (qword)(b))));
1066 }
1067
1068 static __inline vec_float4 spu_nand(vec_float4 a, vec_float4 b)
1069 {
1070   return ((vec_float4)(si_nand((qword)(a), (qword)(b))));
1071 }
1072
1073 static __inline vec_ullong2 spu_nand(vec_ullong2 a, vec_ullong2 b)
1074 {
1075   return ((vec_ullong2)(si_nand((qword)(a), (qword)(b)))); 
1076 }
1077
1078 static __inline vec_llong2 spu_nand(vec_llong2 a, vec_llong2 b)
1079 {
1080   return ((vec_llong2)(si_nand((qword)(a), (qword)(b)))); 
1081 }
1082
1083 static __inline vec_double2 spu_nand(vec_double2 a, vec_double2 b)
1084 {
1085   return ((vec_double2)(si_nand((qword)(a), (qword)(b))));
1086 }
1087
1088
1089 /* spu_nmadd
1090  * =========
1091  */
1092 static __inline vec_double2 spu_nmadd(vec_double2 a, vec_double2 b, vec_double2 c)
1093 {
1094   return ((vec_double2)(si_dfnma((qword)(a), (qword)(b), (qword)(c))));
1095 }
1096
1097
1098 /* spu_nmsub
1099  * =========
1100  */
1101 static __inline vec_float4 spu_nmsub(vec_float4 a, vec_float4 b, vec_float4 c)
1102 {
1103   return ((vec_float4)(si_fnms((qword)(a), (qword)(b), (qword)(c))));
1104 }
1105
1106 static __inline vec_double2 spu_nmsub(vec_double2 a, vec_double2 b, vec_double2 c)
1107 {
1108   return ((vec_double2)(si_dfnms((qword)(a), (qword)(b), (qword)(c))));
1109 }
1110
1111
1112 /* spu_nor
1113  * =======
1114  */
1115 #define spu_nor(_a, _b)         vec_nor(_a, _b)
1116
1117
1118 /* spu_or
1119  * ======
1120  */
1121 static __inline vec_uchar16 spu_or(vec_uchar16 a, vec_uchar16 b)
1122 {
1123   return ((vec_uchar16)(si_or((qword)(a), (qword)(b))));
1124 }
1125
1126 static __inline vec_char16 spu_or(vec_char16 a, vec_char16 b)
1127 {
1128   return ((vec_char16)(si_or((qword)(a), (qword)(b))));
1129 }
1130
1131 static __inline vec_ushort8 spu_or(vec_ushort8 a, vec_ushort8 b)
1132 {
1133   return ((vec_ushort8)(si_or((qword)(a), (qword)(b))));
1134 }
1135
1136 static __inline vec_short8 spu_or(vec_short8 a, vec_short8 b)
1137 {
1138   return ((vec_short8)(si_or((qword)(a), (qword)(b))));
1139 }
1140
1141 static __inline vec_uint4 spu_or(vec_uint4 a, vec_uint4 b)
1142 {
1143   return ((vec_uint4)(si_or((qword)(a), (qword)(b))));
1144 }
1145
1146 static __inline vec_int4 spu_or(vec_int4 a, vec_int4 b)
1147 {
1148   return ((vec_int4)(si_or((qword)(a), (qword)(b))));
1149 }
1150
1151 static __inline vec_float4 spu_or(vec_float4 a, vec_float4 b)
1152 {
1153   return ((vec_float4)(si_or((qword)(a), (qword)(b))));
1154 }
1155
1156 static __inline vec_ullong2 spu_or(vec_ullong2 a, vec_ullong2 b)
1157 {
1158   return ((vec_ullong2)(si_or((qword)(a), (qword)(b))));
1159 }
1160
1161 static __inline vec_llong2 spu_or(vec_llong2 a, vec_llong2 b)
1162 {
1163   return ((vec_llong2)(si_or((qword)(a), (qword)(b))));
1164 }
1165
1166 static __inline vec_double2 spu_or(vec_double2 a, vec_double2 b)
1167 {
1168   return ((vec_double2)(si_or((qword)(a), (qword)(b))));
1169 }
1170
1171
1172 static __inline vec_uchar16 spu_or(vec_uchar16 a, unsigned char b)
1173 {
1174   return ((vec_uchar16)(si_orbi((qword)(a), b)));
1175 }
1176
1177 static __inline vec_char16 spu_or(vec_char16 a, signed char b)
1178 {
1179   return ((vec_char16)(si_orbi((qword)(a), (unsigned char)(b))));
1180 }
1181
1182 static __inline vec_ushort8 spu_or(vec_ushort8 a, unsigned short b)
1183 {
1184   return ((vec_ushort8)(si_orhi((qword)(a), b)));
1185 }
1186
1187 static __inline vec_short8 spu_or(vec_short8 a, signed short b)
1188 {
1189   return ((vec_short8)(si_orhi((qword)(a), (unsigned short)(b))));
1190 }
1191
1192 static __inline vec_uint4 spu_or(vec_uint4 a, unsigned int b)
1193 {
1194   return ((vec_uint4)(si_ori((qword)(a), b)));
1195 }
1196
1197 static __inline vec_int4 spu_or(vec_int4 a, signed int b)
1198 {
1199   return ((vec_int4)(si_ori((qword)(a), (unsigned int)(b))));
1200 }
1201
1202
1203 /* spu_orc
1204  * =======
1205  */
1206 #define spu_orc(_a, _b)         vec_or(_a, vec_nor(_b, _b))
1207
1208
1209 /* spu_orx
1210  * =======
1211  */
1212 static __inline vec_uint4 spu_orx(vec_uint4 a)
1213 {
1214   return ((vec_uint4)(si_orx((qword)(a))));
1215 }
1216
1217 static __inline vec_int4 spu_orx(vec_int4 a)
1218 {
1219   return ((vec_int4)(si_orx((qword)(a))));
1220 }
1221
1222
1223 /* spu_promote
1224  * ===========
1225  */
1226 static __inline vec_uchar16 spu_promote(unsigned char a, int element)
1227 {
1228   union {
1229     vec_uchar16 v;
1230     unsigned char c[16];
1231   } in;
1232
1233   in.c[element & 15] = a;
1234   return (in.v);
1235 }
1236
1237 static __inline vec_char16 spu_promote(signed char a, int element)
1238 {
1239   union {
1240     vec_char16 v;
1241     signed char c[16];
1242   } in;
1243
1244   in.c[element & 15] = a;
1245   return (in.v);
1246 }
1247
1248 static __inline vec_ushort8 spu_promote(unsigned short a, int element)
1249 {
1250   union {
1251     vec_ushort8 v;
1252     unsigned short s[8];
1253   } in;
1254
1255   in.s[element & 7] = a;
1256   return (in.v);
1257 }
1258
1259 static __inline vec_short8 spu_promote(signed short a, int element)
1260 {
1261   union {
1262     vec_short8 v;
1263     signed short s[8];
1264   } in;
1265
1266   in.s[element & 7] = a;
1267   return (in.v);
1268 }
1269
1270 static __inline vec_uint4 spu_promote(unsigned int a, int element)
1271 {
1272   union {
1273     vec_uint4 v;
1274     unsigned int i[4];
1275   } in;
1276
1277   in.i[element & 3] = a;
1278   return (in.v);
1279 }
1280
1281 static __inline vec_int4 spu_promote(signed int a, int element)
1282 {
1283   union {
1284     vec_int4 v;
1285     signed int i[4];
1286   } in;
1287
1288   in.i[element & 3] = a;
1289   return (in.v);
1290 }
1291
1292 static __inline vec_float4 spu_promote(float a, int element)
1293 {
1294   union {
1295     vec_float4 v;
1296     float f[4];
1297   } in;
1298
1299   in.f[element & 3] = a;
1300   return (in.v);
1301 }
1302
1303 static __inline vec_ullong2 spu_promote(unsigned long long a, int element)
1304 {
1305   union {
1306     vec_ullong2 v;
1307     unsigned long long l[2];
1308   } in;
1309
1310   in.l[element & 1] = a;
1311   return (in.v);
1312 }
1313
1314 static __inline vec_llong2 spu_promote(signed long long a, int element)
1315 {
1316   union {
1317     vec_llong2 v;
1318     signed long long l[2];
1319   } in;
1320
1321   in.l[element & 1] = a;
1322   return (in.v);
1323 }
1324
1325 static __inline vec_double2 spu_promote(double a, int element)
1326 {
1327   union {
1328     vec_double2 v;
1329     double d[2];
1330   } in;
1331
1332   in.d[element & 1] = a;
1333   return (in.v);
1334 }
1335
1336 /* spu_re
1337  * ======
1338  */
1339 #define spu_re(_a)              vec_re(_a)
1340
1341
1342 /* spu_readch
1343  * ==========
1344  */
1345 #define spu_readch(_channel)            0       /* not mappable */
1346
1347
1348 /* spu_readchcnt
1349  * =============
1350  */
1351 #define spu_readchcnt(_channel)         0       /* not mappable */
1352
1353
1354 /* spu_readchqw
1355  * ============
1356  */
1357 #define spu_readchqw(_channel) __extension__ ({ vec_uint4 result = { 0, 0, 0, 0 }; result; })
1358
1359 /* spu_rl
1360  * ======
1361  */
1362 static __inline vec_ushort8 spu_rl(vec_ushort8 a, vec_short8 b)
1363 {
1364   return ((vec_ushort8)(si_roth((qword)(a), (qword)(b))));
1365 }
1366
1367 static __inline vec_short8 spu_rl(vec_short8 a, vec_short8 b)
1368 {
1369   return ((vec_short8)(si_roth((qword)(a), (qword)(b))));
1370 }
1371
1372 static __inline vec_uint4 spu_rl(vec_uint4 a, vec_int4 b)
1373 {
1374   return ((vec_uint4)(si_rot((qword)(a), (qword)(b))));
1375 }
1376
1377 static __inline vec_int4 spu_rl(vec_int4 a, vec_int4 b)
1378 {
1379   return ((vec_int4)(si_rot((qword)(a), (qword)(b))));
1380 }
1381
1382 static __inline vec_ushort8 spu_rl(vec_ushort8 a, int b)
1383 {
1384   return ((vec_ushort8)(si_rothi((qword)(a), b)));
1385 }
1386
1387 static __inline vec_short8 spu_rl(vec_short8 a, int b)
1388 {
1389   return ((vec_short8)(si_rothi((qword)(a), b)));
1390 }
1391
1392 static __inline vec_uint4 spu_rl(vec_uint4 a, int b)
1393 {
1394   return ((vec_uint4)(si_roti((qword)(a), b)));
1395 }
1396
1397 static __inline vec_int4 spu_rl(vec_int4 a, int b)
1398 {
1399   return ((vec_int4)(si_roti((qword)(a), b)));
1400 }
1401
1402
1403 /* spu_rlmask
1404  * ==========
1405  */
1406 static __inline vec_ushort8 spu_rlmask(vec_ushort8 a, vec_short8 b)
1407 {
1408   return ((vec_ushort8)(si_rothm((qword)(a), (qword)(b))));
1409 }
1410
1411 static __inline vec_short8 spu_rlmask(vec_short8 a, vec_short8 b)
1412 {
1413   return ((vec_short8)(si_rothm((qword)(a), (qword)(b))));
1414 }
1415
1416 static __inline vec_uint4 spu_rlmask(vec_uint4 a, vec_int4 b)
1417 {
1418   return ((vec_uint4)(si_rotm((qword)(a), (qword)(b))));
1419 }
1420
1421 static __inline vec_int4 spu_rlmask(vec_int4 a, vec_int4 b)
1422 {
1423   return ((vec_int4)(si_rotm((qword)(a), (qword)(b))));
1424 }
1425
1426 static __inline vec_ushort8 spu_rlmask(vec_ushort8 a, int b)
1427 {
1428   return ((vec_ushort8)(si_rothmi((qword)(a), b)));
1429 }
1430
1431 static __inline vec_short8 spu_rlmask(vec_short8 a, int b)
1432 {
1433   return ((vec_short8)(si_rothmi((qword)(a), b)));
1434 }
1435
1436
1437 static __inline vec_uint4 spu_rlmask(vec_uint4 a, int b)
1438 {
1439   return ((vec_uint4)(si_rotmi((qword)(a), b)));
1440 }
1441
1442 static __inline vec_int4 spu_rlmask(vec_int4 a, int b)
1443 {
1444   return ((vec_int4)(si_rotmi((qword)(a), b)));
1445 }
1446
1447 /* spu_rlmaska
1448  * ===========
1449  */
1450 static __inline vec_short8 spu_rlmaska(vec_short8 a, vec_short8 b)
1451 {
1452   return ((vec_short8)(si_rotmah((qword)(a), (qword)(b))));
1453 }
1454
1455 static __inline vec_ushort8 spu_rlmaska(vec_ushort8 a, vec_short8 b)
1456 {
1457   return ((vec_ushort8)(si_rotmah((qword)(a), (qword)(b))));
1458 }
1459
1460
1461 static __inline vec_int4 spu_rlmaska(vec_int4 a, vec_int4 b)
1462 {
1463   return ((vec_int4)(si_rotma((qword)(a), (qword)(b))));
1464 }
1465
1466 static __inline vec_uint4 spu_rlmaska(vec_uint4 a, vec_int4 b)
1467 {
1468   return ((vec_uint4)(si_rotma((qword)(a), (qword)(b))));
1469 }
1470
1471 static __inline vec_ushort8 spu_rlmaska(vec_ushort8 a, int b)
1472 {
1473   return ((vec_ushort8)(si_rotmahi((qword)(a), b)));
1474 }
1475
1476 static __inline vec_short8 spu_rlmaska(vec_short8 a, int b)
1477 {
1478   return ((vec_short8)(si_rotmahi((qword)(a), b)));
1479 }
1480
1481 static __inline vec_uint4 spu_rlmaska(vec_uint4 a, int b)
1482 {
1483   return ((vec_uint4)(si_rotmai((qword)(a), b)));
1484 }
1485
1486 static __inline vec_int4 spu_rlmaska(vec_int4 a, int b)
1487 {
1488   return ((vec_int4)(si_rotmai((qword)(a), b)));
1489 }
1490
1491
1492 /* spu_rlmaskqw
1493  * ============
1494  */
1495 static __inline vec_uchar16 spu_rlmaskqw(vec_uchar16 a, int count)
1496 {
1497   return ((vec_uchar16)(si_rotqmbi((qword)(a), si_from_int(count))));
1498 }
1499
1500 static __inline vec_char16 spu_rlmaskqw(vec_char16 a, int count)
1501 {
1502   return ((vec_char16)(si_rotqmbi((qword)(a), si_from_int(count))));
1503 }
1504
1505 static __inline vec_ushort8 spu_rlmaskqw(vec_ushort8 a, int count)
1506 {
1507   return ((vec_ushort8)(si_rotqmbi((qword)(a), si_from_int(count))));
1508 }
1509
1510 static __inline vec_short8 spu_rlmaskqw(vec_short8 a, int count)
1511 {
1512   return ((vec_short8)(si_rotqmbi((qword)(a), si_from_int(count))));
1513 }
1514
1515 static __inline vec_uint4 spu_rlmaskqw(vec_uint4 a, int count)
1516 {
1517   return ((vec_uint4)(si_rotqmbi((qword)(a), si_from_int(count))));
1518 }
1519
1520 static __inline vec_int4 spu_rlmaskqw(vec_int4 a, int count)
1521 {
1522   return ((vec_int4)(si_rotqmbi((qword)(a), si_from_int(count))));
1523 }
1524
1525 static __inline vec_float4 spu_rlmaskqw(vec_float4 a, int count)
1526 {
1527   return ((vec_float4)(si_rotqmbi((qword)(a), si_from_int(count))));
1528 }
1529
1530 static __inline vec_ullong2 spu_rlmaskqw(vec_ullong2 a, int count)
1531 {
1532   return ((vec_ullong2)(si_rotqmbi((qword)(a), si_from_int(count))));
1533 }
1534
1535 static __inline vec_llong2 spu_rlmaskqw(vec_llong2 a, int count)
1536 {
1537   return ((vec_llong2)(si_rotqmbi((qword)(a), si_from_int(count))));
1538 }
1539
1540 static __inline vec_double2 spu_rlmaskqw(vec_double2 a, int count)
1541 {
1542   return ((vec_double2)(si_rotqmbi((qword)(a), si_from_int(count))));
1543 }
1544
1545 /* spu_rlmaskqwbyte
1546  * ================
1547  */
1548 static __inline vec_uchar16 spu_rlmaskqwbyte(vec_uchar16 a, int count)
1549 {
1550   return ((vec_uchar16)(si_rotqmby((qword)(a), si_from_int(count))));
1551 }
1552
1553 static __inline vec_char16 spu_rlmaskqwbyte(vec_char16 a, int count)
1554 {
1555   return ((vec_char16)(si_rotqmby((qword)(a), si_from_int(count))));
1556 }
1557
1558 static __inline vec_ushort8 spu_rlmaskqwbyte(vec_ushort8 a, int count)
1559 {
1560   return ((vec_ushort8)(si_rotqmby((qword)(a), si_from_int(count))));
1561 }
1562
1563 static __inline vec_short8 spu_rlmaskqwbyte(vec_short8 a, int count)
1564 {
1565   return ((vec_short8)(si_rotqmby((qword)(a), si_from_int(count))));
1566 }
1567
1568 static __inline vec_uint4 spu_rlmaskqwbyte(vec_uint4 a, int count)
1569 {
1570   return ((vec_uint4)(si_rotqmby((qword)(a), si_from_int(count))));
1571 }
1572
1573 static __inline vec_int4 spu_rlmaskqwbyte(vec_int4 a, int count)
1574 {
1575   return ((vec_int4)(si_rotqmby((qword)(a), si_from_int(count))));
1576 }
1577
1578 static __inline vec_float4 spu_rlmaskqwbyte(vec_float4 a, int count)
1579 {
1580   return ((vec_float4)(si_rotqmby((qword)(a), si_from_int(count))));
1581 }
1582
1583 static __inline vec_ullong2 spu_rlmaskqwbyte(vec_ullong2 a, int count)
1584 {
1585   return ((vec_ullong2)(si_rotqmby((qword)(a), si_from_int(count))));
1586 }
1587
1588 static __inline vec_llong2 spu_rlmaskqwbyte(vec_llong2 a, int count)
1589 {
1590   return ((vec_llong2)(si_rotqmby((qword)(a), si_from_int(count))));
1591 }
1592
1593 static __inline vec_double2 spu_rlmaskqwbyte(vec_double2 a, int count)
1594 {
1595   return ((vec_double2)(si_rotqmby((qword)(a), si_from_int(count))));
1596 }
1597
1598 /* spu_rlmaskqwbytebc
1599  * ==================
1600  */
1601 static __inline vec_uchar16 spu_rlmaskqwbytebc(vec_uchar16 a, int count)
1602 {
1603   return ((vec_uchar16)(si_rotqmbybi((qword)(a), si_from_int(count))));
1604 }
1605
1606 static __inline vec_char16 spu_rlmaskqwbytebc(vec_char16 a, int count)
1607 {
1608   return ((vec_char16)(si_rotqmbybi((qword)(a), si_from_int(count))));
1609 }
1610
1611 static __inline vec_ushort8 spu_rlmaskqwbytebc(vec_ushort8 a, int count)
1612 {
1613   return ((vec_ushort8)(si_rotqmbybi((qword)(a), si_from_int(count))));
1614 }
1615
1616 static __inline vec_short8 spu_rlmaskqwbytebc(vec_short8 a, int count)
1617 {
1618   return ((vec_short8)(si_rotqmbybi((qword)(a), si_from_int(count))));
1619 }
1620
1621 static __inline vec_uint4 spu_rlmaskqwbytebc(vec_uint4 a, int count)
1622 {
1623   return ((vec_uint4)(si_rotqmbybi((qword)(a), si_from_int(count))));
1624 }
1625
1626 static __inline vec_int4 spu_rlmaskqwbytebc(vec_int4 a, int count)
1627 {
1628   return ((vec_int4)(si_rotqmbybi((qword)(a), si_from_int(count))));
1629 }
1630
1631 static __inline vec_float4 spu_rlmaskqwbytebc(vec_float4 a, int count)
1632 {
1633   return ((vec_float4)(si_rotqmbybi((qword)(a), si_from_int(count))));
1634 }
1635
1636 static __inline vec_ullong2 spu_rlmaskqwbytebc(vec_ullong2 a, int count)
1637 {
1638   return ((vec_ullong2)(si_rotqmbybi((qword)(a), si_from_int(count))));
1639 }
1640
1641 static __inline vec_llong2 spu_rlmaskqwbytebc(vec_llong2 a, int count)
1642 {
1643   return ((vec_llong2)(si_rotqmbybi((qword)(a), si_from_int(count))));
1644 }
1645
1646 static __inline vec_double2 spu_rlmaskqwbytebc(vec_double2 a, int count)
1647 {
1648   return ((vec_double2)(si_rotqmbybi((qword)(a), si_from_int(count))));
1649 }
1650
1651
1652 /* spu_rlqwbyte
1653  * ============
1654  */
1655 static __inline vec_uchar16 spu_rlqwbyte(vec_uchar16 a, int count)
1656 {
1657   return ((vec_uchar16)(si_rotqby((qword)(a), si_from_int(count))));
1658 }  
1659
1660 static __inline vec_char16 spu_rlqwbyte(vec_char16 a, int count)
1661 {
1662   return ((vec_char16)(si_rotqby((qword)(a), si_from_int(count))));
1663 }
1664
1665 static __inline vec_ushort8 spu_rlqwbyte(vec_ushort8 a, int count)
1666 {
1667   return ((vec_ushort8)(si_rotqby((qword)(a), si_from_int(count))));
1668 }  
1669
1670 static __inline vec_short8 spu_rlqwbyte(vec_short8 a, int count)
1671 {
1672   return ((vec_short8)(si_rotqby((qword)(a), si_from_int(count))));
1673 }
1674
1675 static __inline vec_uint4 spu_rlqwbyte(vec_uint4 a, int count)
1676 {
1677   return ((vec_uint4)(si_rotqby((qword)(a), si_from_int(count))));
1678 }
1679
1680 static __inline vec_int4 spu_rlqwbyte(vec_int4 a, int count)
1681 {
1682   return ((vec_int4)(si_rotqby((qword)(a), si_from_int(count))));
1683 }
1684
1685 static __inline vec_float4 spu_rlqwbyte(vec_float4 a, int count)
1686 {
1687   return ((vec_float4)(si_rotqby((qword)(a), si_from_int(count))));
1688 }
1689
1690 static __inline vec_ullong2 spu_rlqwbyte(vec_ullong2 a, int count)
1691 {
1692   return ((vec_ullong2)(si_rotqby((qword)(a), si_from_int(count))));
1693 }
1694
1695 static __inline vec_llong2 spu_rlqwbyte(vec_llong2 a, int count)
1696 {
1697   return ((vec_llong2)(si_rotqby((qword)(a), si_from_int(count))));
1698 }
1699
1700 static __inline vec_double2 spu_rlqwbyte(vec_double2 a, int count)
1701 {
1702   return ((vec_double2)(si_rotqby((qword)(a), si_from_int(count))));
1703 }
1704
1705
1706 /* spu_rlqwbytebc
1707  * ==============
1708  */
1709 static __inline vec_uchar16 spu_rlqwbytebc(vec_uchar16 a, int count)
1710 {
1711   return ((vec_uchar16)(si_rotqbybi((qword)(a), si_from_int(count))));
1712 }
1713
1714 static __inline vec_char16 spu_rlqwbytebc(vec_char16 a, int count)
1715 {
1716   return ((vec_char16)(si_rotqbybi((qword)(a), si_from_int(count))));
1717 }
1718
1719 static __inline vec_ushort8 spu_rlqwbytebc(vec_ushort8 a, int count)
1720 {
1721   return ((vec_ushort8)(si_rotqbybi((qword)(a), si_from_int(count))));
1722 }
1723
1724 static __inline vec_short8 spu_rlqwbytebc(vec_short8 a, int count)
1725 {
1726   return ((vec_short8)(si_rotqbybi((qword)(a), si_from_int(count))));
1727 }
1728
1729 static __inline vec_uint4 spu_rlqwbytebc(vec_uint4 a, int count)
1730 {
1731   return ((vec_uint4)(si_rotqbybi((qword)(a), si_from_int(count))));
1732 }
1733
1734 static __inline vec_int4 spu_rlqwbytebc(vec_int4 a, int count)
1735 {
1736   return ((vec_int4)(si_rotqbybi((qword)(a), si_from_int(count))));
1737 }
1738
1739 static __inline vec_float4 spu_rlqwbytebc(vec_float4 a, int count)
1740 {
1741   return ((vec_float4)(si_rotqbybi((qword)(a), si_from_int(count))));
1742 }
1743
1744 static __inline vec_ullong2 spu_rlqwbytebc(vec_ullong2 a, int count)
1745 {
1746   return ((vec_ullong2)(si_rotqbybi((qword)(a), si_from_int(count))));
1747 }
1748
1749 static __inline vec_llong2 spu_rlqwbytebc(vec_llong2 a, int count)
1750 {
1751   return ((vec_llong2)(si_rotqbybi((qword)(a), si_from_int(count))));
1752 }
1753
1754 static __inline vec_double2 spu_rlqwbytebc(vec_double2 a, int count)
1755 {
1756   return ((vec_double2)(si_rotqbybi((qword)(a), si_from_int(count))));
1757 }
1758
1759 /* spu_rlqw
1760  * ========
1761  */
1762 static __inline vec_uchar16 spu_rlqw(vec_uchar16 a, int count)
1763 {
1764   return ((vec_uchar16)(si_rotqbi((qword)(a), si_from_int(count))));
1765 }
1766
1767 static __inline vec_char16 spu_rlqw(vec_char16 a, int count)
1768 {
1769   return ((vec_char16)(si_rotqbi((qword)(a), si_from_int(count))));
1770 }
1771
1772 static __inline vec_ushort8 spu_rlqw(vec_ushort8 a, int count)
1773 {
1774   return ((vec_ushort8)(si_rotqbi((qword)(a), si_from_int(count))));
1775 }
1776
1777 static __inline vec_short8 spu_rlqw(vec_short8 a, int count)
1778 {
1779   return ((vec_short8)(si_rotqbi((qword)(a), si_from_int(count))));
1780 }
1781
1782 static __inline vec_uint4 spu_rlqw(vec_uint4 a, int count)
1783 {
1784   return ((vec_uint4)(si_rotqbi((qword)(a), si_from_int(count))));
1785 }
1786
1787 static __inline vec_int4 spu_rlqw(vec_int4 a, int count)
1788 {
1789   return ((vec_int4)(si_rotqbi((qword)(a), si_from_int(count))));
1790 }
1791
1792 static __inline vec_float4 spu_rlqw(vec_float4 a, int count)
1793 {
1794   return ((vec_float4)(si_rotqbi((qword)(a), si_from_int(count))));
1795 }
1796
1797 static __inline vec_ullong2 spu_rlqw(vec_ullong2 a, int count)
1798 {
1799   return ((vec_ullong2)(si_rotqbi((qword)(a), si_from_int(count))));
1800 }
1801
1802 static __inline vec_llong2 spu_rlqw(vec_llong2 a, int count)
1803 {
1804   return ((vec_llong2)(si_rotqbi((qword)(a), si_from_int(count))));
1805 }
1806
1807 static __inline vec_double2 spu_rlqw(vec_double2 a, int count)
1808 {
1809   return ((vec_double2)(si_rotqbi((qword)(a), si_from_int(count))));
1810 }
1811
1812 /* spu_roundtf
1813  * ===========
1814  */
1815 static __inline vec_float4 spu_roundtf(vec_double2 a)
1816 {
1817   return ((vec_float4)(si_frds((qword)(a))));
1818 }
1819
1820
1821 /* spu_rsqrte
1822  * ==========
1823  */
1824 #define spu_rsqrte(_a)          vec_rsqrte(_a)
1825
1826
1827 /* spu_sel
1828  * =======
1829  */
1830 static __inline vec_uchar16 spu_sel(vec_uchar16 a, vec_uchar16 b, vec_uchar16 pattern)
1831 {
1832   return ((vec_uchar16)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1833 }
1834
1835 static __inline vec_char16 spu_sel(vec_char16 a, vec_char16 b, vec_uchar16 pattern)
1836 {
1837   return ((vec_char16)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1838 }
1839
1840 static __inline vec_ushort8 spu_sel(vec_ushort8 a, vec_ushort8 b, vec_ushort8 pattern)
1841 {
1842   return ((vec_ushort8)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1843 }
1844
1845 static __inline vec_short8 spu_sel(vec_short8 a, vec_short8 b, vec_ushort8 pattern)
1846 {
1847   return ((vec_short8)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1848 }
1849
1850 static __inline vec_uint4 spu_sel(vec_uint4 a, vec_uint4 b, vec_uint4 pattern)
1851 {
1852   return ((vec_uint4)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1853 }
1854
1855 static __inline vec_int4 spu_sel(vec_int4 a, vec_int4 b, vec_uint4 pattern)
1856 {
1857   return ((vec_int4)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1858 }
1859
1860 static __inline vec_float4 spu_sel(vec_float4 a, vec_float4 b, vec_uint4 pattern)
1861 {
1862   return ((vec_float4)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1863 }
1864
1865 static __inline vec_ullong2 spu_sel(vec_ullong2 a, vec_ullong2 b, vec_ullong2 pattern)
1866 {
1867   return ((vec_ullong2)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1868 }
1869
1870 static __inline vec_llong2 spu_sel(vec_llong2 a, vec_llong2 b, vec_ullong2 pattern)
1871 {
1872   return ((vec_llong2)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1873 }
1874
1875 static __inline vec_double2 spu_sel(vec_double2 a, vec_double2 b, vec_ullong2 pattern)
1876 {
1877   return ((vec_double2)(si_selb((qword)(a), (qword)(b), (qword)(pattern))));
1878 }
1879
1880
1881
1882 /* spu_shuffle
1883  * ===========
1884  */
1885 static __inline vec_uchar16 spu_shuffle(vec_uchar16 a, vec_uchar16 b, vec_uchar16 pattern)
1886 {
1887   return ((vec_uchar16)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1888 }
1889
1890 static __inline vec_char16 spu_shuffle(vec_char16 a, vec_char16 b, vec_uchar16 pattern)
1891 {
1892   return ((vec_char16)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1893 }
1894
1895 static __inline vec_ushort8 spu_shuffle(vec_ushort8 a, vec_ushort8 b, vec_uchar16 pattern)
1896 {
1897   return ((vec_ushort8)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1898 }
1899
1900 static __inline vec_short8 spu_shuffle(vec_short8 a, vec_short8 b, vec_uchar16 pattern)
1901 {
1902   return ((vec_short8)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1903 }
1904
1905 static __inline vec_uint4 spu_shuffle(vec_uint4 a, vec_uint4 b, vec_uchar16 pattern)
1906 {
1907   return ((vec_uint4)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1908 }
1909
1910 static __inline vec_int4 spu_shuffle(vec_int4 a, vec_int4 b, vec_uchar16 pattern)
1911 {
1912   return ((vec_int4)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1913 }
1914
1915 static __inline vec_float4 spu_shuffle(vec_float4 a, vec_float4 b, vec_uchar16 pattern)
1916 {
1917   return ((vec_float4)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1918 }
1919
1920 static __inline vec_ullong2 spu_shuffle(vec_ullong2 a, vec_ullong2 b, vec_uchar16 pattern)
1921 {
1922   return ((vec_ullong2)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1923 }
1924
1925 static __inline vec_llong2 spu_shuffle(vec_llong2 a, vec_llong2 b, vec_uchar16 pattern)
1926 {
1927   return ((vec_llong2)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1928 }
1929
1930 static __inline vec_double2 spu_shuffle(vec_double2 a, vec_double2 b, vec_uchar16 pattern)
1931 {
1932   return ((vec_double2)(si_shufb((qword)(a), (qword)(b), (qword)(pattern))));
1933 }
1934
1935
1936 /* spu_sl
1937  * ======
1938  */
1939 static __inline vec_ushort8 spu_sl(vec_ushort8 a, vec_ushort8 b)
1940 {
1941   return ((vec_ushort8)(si_shlh((qword)(a), (qword)(b))));
1942 }
1943
1944 static __inline vec_short8 spu_sl(vec_short8 a, vec_ushort8 b)
1945 {
1946   return ((vec_short8)(si_shlh((qword)(a), (qword)(b))));
1947 }
1948
1949 static __inline vec_uint4 spu_sl(vec_uint4 a, vec_uint4 b)
1950 {
1951   return ((vec_uint4)(si_shl((qword)(a), (qword)(b))));
1952 }
1953
1954 static __inline vec_int4 spu_sl(vec_int4 a, vec_uint4 b)
1955 {
1956   return ((vec_int4)(si_shl((qword)(a), (qword)(b))));
1957 }
1958
1959 static __inline vec_ushort8 spu_sl(vec_ushort8 a, unsigned int b)
1960 {
1961   return ((vec_ushort8)(si_shlhi((qword)(a), b)));
1962 }
1963
1964 static __inline vec_short8 spu_sl(vec_short8 a, unsigned int b)
1965 {
1966   return ((vec_short8)(si_shlhi((qword)(a), b)));
1967 }
1968
1969 static __inline vec_uint4 spu_sl(vec_uint4 a, unsigned int b)
1970 {
1971   return ((vec_uint4)(si_shli((qword)(a), b)));
1972 }
1973
1974 static __inline vec_int4 spu_sl(vec_int4 a, unsigned int b)
1975 {
1976   return ((vec_int4)(si_shli((qword)(a), b)));
1977 }
1978
1979
1980 /* spu_slqw
1981  * ========
1982  */
1983 static __inline vec_uchar16 spu_slqw(vec_uchar16 a, unsigned int count)
1984 {
1985   return ((vec_uchar16)(si_shlqbi((qword)(a), si_from_uint(count))));
1986 }
1987
1988 static __inline vec_char16 spu_slqw(vec_char16 a, unsigned int count)
1989 {
1990   return ((vec_char16)(si_shlqbi((qword)(a), si_from_uint(count))));
1991 }
1992
1993 static __inline vec_ushort8 spu_slqw(vec_ushort8 a, unsigned int count)
1994 {
1995   return ((vec_ushort8)(si_shlqbi((qword)(a), si_from_uint(count))));
1996 }
1997
1998 static __inline vec_short8 spu_slqw(vec_short8 a, unsigned int count)
1999 {
2000   return ((vec_short8)(si_shlqbi((qword)(a), si_from_uint(count))));
2001 }
2002
2003 static __inline vec_uint4 spu_slqw(vec_uint4 a, unsigned int count)
2004 {
2005   return ((vec_uint4)(si_shlqbi((qword)(a), si_from_uint(count))));
2006 }
2007
2008 static __inline vec_int4 spu_slqw(vec_int4 a, unsigned int count)
2009 {
2010   return ((vec_int4)(si_shlqbi((qword)(a), si_from_uint(count))));
2011 }
2012
2013 static __inline vec_float4 spu_slqw(vec_float4 a, unsigned int count)
2014 {
2015   return ((vec_float4)(si_shlqbi((qword)(a), si_from_uint(count))));
2016 }
2017
2018 static __inline vec_ullong2 spu_slqw(vec_ullong2 a, unsigned int count)
2019 {
2020   return ((vec_ullong2)(si_shlqbi((qword)(a), si_from_uint(count))));
2021 }
2022
2023 static __inline vec_llong2 spu_slqw(vec_llong2 a, unsigned int count)
2024 {
2025   return ((vec_llong2)(si_shlqbi((qword)(a), si_from_uint(count))));
2026 }
2027
2028 static __inline vec_double2 spu_slqw(vec_double2 a, unsigned int count)
2029 {
2030   return ((vec_double2)(si_shlqbi((qword)(a), si_from_uint(count))));
2031 }
2032
2033 /* spu_slqwbyte
2034  * ============
2035  */
2036 static __inline vec_uchar16 spu_slqwbyte(vec_uchar16 a, unsigned int count)
2037 {
2038   return ((vec_uchar16)(si_shlqby((qword)(a), si_from_uint(count))));
2039 }
2040
2041 static __inline vec_char16 spu_slqwbyte(vec_char16 a, unsigned int count)
2042 {
2043   return ((vec_char16)(si_shlqby((qword)(a), si_from_uint(count))));
2044 }
2045
2046 static __inline vec_ushort8 spu_slqwbyte(vec_ushort8 a, unsigned int count)
2047 {
2048   return ((vec_ushort8)(si_shlqby((qword)(a), si_from_uint(count))));
2049 }
2050
2051 static __inline vec_short8 spu_slqwbyte(vec_short8 a, unsigned int count)
2052 {
2053   return ((vec_short8)(si_shlqby((qword)(a), si_from_uint(count))));
2054 }
2055
2056 static __inline vec_uint4 spu_slqwbyte(vec_uint4 a, unsigned int count)
2057 {
2058   return ((vec_uint4)(si_shlqby((qword)(a), si_from_uint(count))));
2059 }
2060
2061 static __inline vec_int4 spu_slqwbyte(vec_int4 a, unsigned int count)
2062 {
2063   return ((vec_int4)(si_shlqby((qword)(a), si_from_uint(count))));
2064 }
2065
2066 static __inline vec_float4 spu_slqwbyte(vec_float4 a, unsigned int count)
2067 {
2068   return ((vec_float4)(si_shlqby((qword)(a), si_from_uint(count))));
2069 }
2070
2071 static __inline vec_ullong2 spu_slqwbyte(vec_ullong2 a, unsigned int count)
2072 {
2073   return ((vec_ullong2)(si_shlqby((qword)(a), si_from_uint(count))));
2074 }
2075
2076 static __inline vec_llong2 spu_slqwbyte(vec_llong2 a, unsigned int count)
2077 {
2078   return ((vec_llong2)(si_shlqby((qword)(a), si_from_uint(count))));
2079 }
2080
2081 static __inline vec_double2 spu_slqwbyte(vec_double2 a, unsigned int count)
2082 {
2083   return ((vec_double2)(si_shlqby((qword)(a), si_from_uint(count))));
2084 }
2085
2086 /* spu_slqwbytebc
2087  * ==============
2088  */
2089 static __inline vec_uchar16 spu_slqwbytebc(vec_uchar16 a, unsigned int count)
2090 {
2091   return ((vec_uchar16)(si_shlqbybi((qword)(a), si_from_uint(count))));
2092 }
2093
2094 static __inline vec_char16 spu_slqwbytebc(vec_char16 a, unsigned int count)
2095 {
2096   return ((vec_char16)(si_shlqbybi((qword)(a), si_from_uint(count))));
2097 }
2098
2099 static __inline vec_ushort8 spu_slqwbytebc(vec_ushort8 a, unsigned int count)
2100 {
2101   return ((vec_ushort8)(si_shlqbybi((qword)(a), si_from_uint(count))));
2102 }
2103
2104 static __inline vec_short8 spu_slqwbytebc(vec_short8 a, unsigned int count)
2105 {
2106   return ((vec_short8)(si_shlqbybi((qword)(a), si_from_uint(count))));
2107 }
2108
2109 static __inline vec_uint4 spu_slqwbytebc(vec_uint4 a, unsigned int count)
2110 {
2111   return ((vec_uint4)(si_shlqbybi((qword)(a), si_from_uint(count))));
2112 }
2113
2114 static __inline vec_int4 spu_slqwbytebc(vec_int4 a, unsigned int count)
2115 {
2116   return ((vec_int4)(si_shlqbybi((qword)(a), si_from_uint(count))));
2117 }
2118
2119 static __inline vec_float4 spu_slqwbytebc(vec_float4 a, unsigned int count)
2120 {
2121   return ((vec_float4)(si_shlqbybi((qword)(a), si_from_uint(count))));
2122 }
2123
2124 static __inline vec_ullong2 spu_slqwbytebc(vec_ullong2 a, unsigned int count)
2125 {
2126   return ((vec_ullong2)(si_shlqbybi((qword)(a), si_from_uint(count))));
2127 }
2128
2129 static __inline vec_llong2 spu_slqwbytebc(vec_llong2 a, unsigned int count)
2130 {
2131   return ((vec_llong2)(si_shlqbybi((qword)(a), si_from_uint(count))));
2132 }
2133
2134 static __inline vec_double2 spu_slqwbytebc(vec_double2 a, unsigned int count)
2135 {
2136   return ((vec_double2)(si_shlqbybi((qword)(a), si_from_uint(count))));
2137 }
2138
2139 /* spu_splats
2140  * ==========
2141  */
2142 static __inline vec_uchar16 spu_splats(unsigned char a)
2143 {
2144   union {
2145     vec_uchar16 v;
2146     unsigned char c[16];
2147   } in;
2148
2149   in.c[0] = a;
2150   return (vec_splat(in.v, 0));
2151 }
2152
2153 static __inline vec_char16 spu_splats(signed char a)
2154 {
2155   return ((vec_char16)spu_splats((unsigned char)(a)));
2156 }
2157
2158 static __inline vec_ushort8 spu_splats(unsigned short a)
2159 {
2160   union {
2161     vec_ushort8 v;
2162     unsigned short s[8];
2163   } in;
2164
2165   in.s[0] = a;
2166   return (vec_splat(in.v, 0));
2167 }
2168
2169 static __inline vec_short8 spu_splats(signed short a)
2170 {
2171   return ((vec_short8)spu_splats((unsigned short)(a)));
2172 }
2173
2174 static __inline vec_uint4 spu_splats(unsigned int a)
2175 {
2176   union {
2177     vec_uint4 v;
2178     unsigned int i[4];
2179   } in;
2180
2181   in.i[0] = a;
2182   return (vec_splat(in.v, 0));
2183 }
2184
2185 static __inline vec_int4 spu_splats(signed int a)
2186 {
2187   return ((vec_int4)spu_splats((unsigned int)(a)));
2188 }
2189
2190 static __inline vec_float4 spu_splats(float a)
2191 {
2192   union {
2193     vec_float4 v;
2194     float f[4];
2195   } in;
2196
2197   in.f[0] = a;
2198   return (vec_splat(in.v, 0));
2199 }
2200
2201 static __inline vec_ullong2 spu_splats(unsigned long long a)
2202 {
2203   union {
2204     vec_ullong2 v;
2205     unsigned long long l[2];
2206   } in;
2207
2208   in.l[0] = a;
2209   in.l[1] = a;
2210   return (in.v);
2211 }
2212
2213 static __inline vec_llong2 spu_splats(signed long long a)
2214 {
2215   return ((vec_llong2)spu_splats((unsigned long long)(a)));
2216 }
2217
2218 static __inline vec_double2 spu_splats(double a)
2219 {
2220   union {
2221     vec_double2 v;
2222     double d[2];
2223   } in;
2224
2225   in.d[0] = a;
2226   in.d[1] = a;
2227   return (in.v);
2228 }
2229
2230
2231 /* spu_stop
2232  * ========
2233  */
2234 #define spu_stop(_type) si_stop(_type)
2235
2236
2237 /* spu_sub
2238  * =======
2239  */
2240 static __inline vec_ushort8 spu_sub(vec_ushort8 a, vec_ushort8 b)
2241 {
2242   return ((vec_ushort8)(si_sfh((qword)(b), (qword)(a))));
2243 }
2244
2245 static __inline vec_short8 spu_sub(vec_short8 a, vec_short8 b)
2246 {
2247   return ((vec_short8)(si_sfh((qword)(b), (qword)(a))));
2248 }
2249
2250 static __inline vec_uint4 spu_sub(vec_uint4 a, vec_uint4 b)
2251 {
2252   return ((vec_uint4)(si_sf((qword)(b), (qword)(a))));
2253 }
2254
2255 static __inline vec_int4 spu_sub(vec_int4 a, vec_int4 b)
2256 {
2257   return ((vec_int4)(si_sf((qword)(b), (qword)(a))));
2258 }
2259
2260 static __inline vec_float4 spu_sub(vec_float4 a, vec_float4 b)
2261 {
2262   return ((vec_float4)(si_fs((qword)(a), (qword)(b))));
2263 }
2264
2265 static __inline vec_double2 spu_sub(vec_double2 a, vec_double2 b)
2266 {
2267   return ((vec_double2)(si_dfs((qword)(a), (qword)(b))));
2268 }
2269
2270 static __inline vec_uint4 spu_sub(unsigned int a, vec_uint4 b)
2271 {
2272   return ((vec_uint4)(si_sfi((qword)b, (int)a)));
2273 }
2274
2275 static __inline vec_int4 spu_sub(signed int a, vec_int4 b)
2276 {
2277   return ((vec_int4)(si_sfi((qword)b, (int)a)));
2278 }
2279
2280 static __inline vec_ushort8 spu_sub(unsigned short a, vec_ushort8 b)
2281 {
2282   return ((vec_ushort8)(si_sfhi((qword)b, (short)a)));
2283 }
2284
2285 static __inline vec_short8 spu_sub(signed short a, vec_short8 b)
2286 {
2287   return ((vec_short8)(si_sfhi((qword)b, (short)a)));
2288 }
2289
2290 /* spu_subx
2291  * ========
2292  */
2293 static __inline vec_uint4 spu_subx(vec_uint4 a, vec_uint4 b, vec_uint4 c)
2294 {
2295   return ((vec_uint4)(si_sfx((qword)(b), (qword)(a), (qword)(c))));
2296 }
2297
2298 static __inline vec_int4 spu_subx(vec_int4 a, vec_int4 b, vec_int4 c)
2299 {
2300   return ((vec_int4)(si_sfx((qword)(b), (qword)(a), (qword)(c))));
2301 }
2302
2303 /* spu_sumb
2304  * ========
2305  */
2306 static __inline vec_ushort8 spu_sumb(vec_uchar16 a, vec_uchar16 b)
2307 {
2308   return ((vec_ushort8)(si_sumb((qword)(a), (qword)(b))));
2309 }  
2310
2311
2312 /* spu_sync
2313  * spu_sync_c
2314  * ========
2315  */
2316 #define spu_sync()      /* do nothing */
2317
2318 #define spu_sync_c()    /* do nothing */
2319
2320
2321 /* spu_writech
2322  * ===========
2323  */
2324 #define spu_writech(_channel, _a)       /* not mappable */
2325
2326 /* spu_writechqw
2327  * =============
2328  */
2329 #define spu_writechqw(_channel, _a)     /* not mappable */
2330
2331
2332 /* spu_xor
2333  * =======
2334  */
2335 static __inline vec_uchar16 spu_xor(vec_uchar16 a, vec_uchar16 b)
2336 {
2337   return ((vec_uchar16)(si_xor((qword)(a), (qword)(b))));
2338 }
2339
2340 static __inline vec_char16 spu_xor(vec_char16 a, vec_char16 b)
2341 {
2342   return ((vec_char16)(si_xor((qword)(a), (qword)(b))));
2343 }
2344
2345 static __inline vec_ushort8 spu_xor(vec_ushort8 a, vec_ushort8 b)
2346 {
2347   return ((vec_ushort8)(si_xor((qword)(a), (qword)(b))));
2348 }
2349
2350 static __inline vec_short8 spu_xor(vec_short8 a, vec_short8 b)
2351 {
2352   return ((vec_short8)(si_xor((qword)(a), (qword)(b))));
2353 }
2354
2355 static __inline vec_uint4 spu_xor(vec_uint4 a, vec_uint4 b)
2356 {
2357   return ((vec_uint4)(si_xor((qword)(a), (qword)(b))));
2358 }
2359
2360 static __inline vec_int4 spu_xor(vec_int4 a, vec_int4 b)
2361 {
2362   return ((vec_int4)(si_xor((qword)(a), (qword)(b))));
2363 }
2364
2365 static __inline vec_float4 spu_xor(vec_float4 a, vec_float4 b)
2366 {
2367   return ((vec_float4)(si_xor((qword)(a), (qword)(b))));
2368 }
2369
2370 static __inline vec_ullong2 spu_xor(vec_ullong2 a, vec_ullong2 b)
2371 {
2372   return ((vec_ullong2)(si_xor((qword)(a), (qword)(b))));
2373 }
2374
2375 static __inline vec_llong2 spu_xor(vec_llong2 a, vec_llong2 b)
2376 {
2377   return ((vec_llong2)(si_xor((qword)(a), (qword)(b))));
2378 }
2379
2380 static __inline vec_double2 spu_xor(vec_double2 a, vec_double2 b)
2381 {
2382   return ((vec_double2)(si_xor((qword)(a), (qword)(b))));
2383 }
2384
2385 static __inline vec_uchar16 spu_xor(vec_uchar16 a, unsigned char b)
2386 {
2387   return ((vec_uchar16)(si_xorbi((qword)(a), b)));
2388 }
2389
2390 static __inline vec_char16 spu_xor(vec_char16 a, signed char b)
2391 {
2392   return ((vec_char16)(si_xorbi((qword)(a), (unsigned char)(b))));
2393 }
2394
2395 static __inline vec_ushort8 spu_xor(vec_ushort8 a, unsigned short b)
2396 {
2397   return ((vec_ushort8)(si_xorhi((qword)(a), b)));
2398 }
2399
2400 static __inline vec_short8 spu_xor(vec_short8 a, signed short b)
2401 {
2402   return ((vec_short8)(si_xorhi((qword)(a), (unsigned short)(b))));
2403 }
2404
2405 static __inline vec_uint4 spu_xor(vec_uint4 a, unsigned int b)
2406 {
2407   return ((vec_uint4)(si_xori((qword)(a), b)));
2408 }
2409
2410 static __inline vec_int4 spu_xor(vec_int4 a, signed int b)
2411 {
2412   return ((vec_int4)(si_xori((qword)(a), (unsigned int)(b))));
2413 }
2414
2415 #endif /* !__SPU__ */
2416 #endif /* __cplusplus */
2417 #endif /* !_SPU2VMX_H_ */