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