blob: d252920ccb3cb1cc71c4bd0b40d7a4a24aef67fd [file] [log] [blame]
Chris Lattnerdd173942010-04-14 03:54:58 +00001/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __ALTIVEC_H
24#define __ALTIVEC_H
25
26#ifndef __ALTIVEC__
27#error "AltiVec support not enabled"
28#endif
29
30/* constants for mapping CR6 bits to predicate result. */
31
32#define __CR6_EQ 0
33#define __CR6_EQ_REV 1
34#define __CR6_LT 2
35#define __CR6_LT_REV 3
36
37#define _ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39/* vec_abs */
40
41#define __builtin_vec_abs vec_abs
42#define __builtin_altivec_abs_v16qi vec_abs
43#define __builtin_altivec_abs_v8hi vec_abs
44#define __builtin_altivec_abs_v4si vec_abs
45
46static vector signed char _ATTRS_o_ai
47vec_abs(vector signed char a)
48{
49 return __builtin_altivec_vmaxsb(a, -a);
50}
51
52static vector signed short _ATTRS_o_ai
53vec_abs(vector signed short a)
54{
55 return __builtin_altivec_vmaxsh(a, -a);
56}
57
58static vector signed int _ATTRS_o_ai
59vec_abs(vector signed int a)
60{
61 return __builtin_altivec_vmaxsw(a, -a);
62}
63
64static vector float _ATTRS_o_ai
65vec_abs(vector float a)
66{
67 return (vector unsigned int)a &
68 (vector unsigned int)(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF);
69}
70
71/* vec_abss */
72
73#define __builtin_vec_abss vec_abss
74#define __builtin_altivec_abss_v16qi vec_abss
75#define __builtin_altivec_abss_v8hi vec_abss
76#define __builtin_altivec_abss_v4si vec_abss
77
78static vector signed char _ATTRS_o_ai
79vec_abss(vector signed char a)
80{
81 return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs(
82 (vector signed char)(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), a));
83}
84
85static vector signed short _ATTRS_o_ai
86vec_abss(vector signed short a)
87{
88 return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs(
89 (vector signed short)(0, 0, 0, 0, 0, 0, 0, 0), a));
90}
91
92static vector signed int _ATTRS_o_ai
93vec_abss(vector signed int a)
94{
95 return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws(
96 (vector signed int)(0, 0, 0, 0), a));
97}
98
99/* vec_add */
100
101#define __builtin_altivec_vaddubm vec_add
102#define __builtin_altivec_vadduhm vec_add
103#define __builtin_altivec_vadduwm vec_add
104#define __builtin_altivec_vaddfp vec_add
105#define __builtin_vec_vaddubm vec_add
106#define __builtin_vec_vadduhm vec_add
107#define __builtin_vec_vadduwm vec_add
108#define __builtin_vec_vaddfp vec_add
109#define vec_vaddubm vec_add
110#define vec_vadduhm vec_add
111#define vec_vadduwm vec_add
112#define vec_vaddfp vec_add
113
114static vector char _ATTRS_o_ai
115vec_add(vector char a, vector char b)
116{
117 return a + b;
118}
119
120static vector signed char _ATTRS_o_ai
121vec_add(vector signed char a, vector signed char b)
122{
123 return a + b;
124}
125
126static vector unsigned char _ATTRS_o_ai
127vec_add(vector unsigned char a, vector unsigned char b)
128{
129 return a + b;
130}
131
132static vector short _ATTRS_o_ai
133vec_add(vector short a, vector short b)
134{
135 return a + b;
136}
137
138static vector unsigned short _ATTRS_o_ai
139vec_add(vector unsigned short a, vector unsigned short b)
140{
141 return a + b;
142}
143
144static vector int _ATTRS_o_ai
145vec_add(vector int a, vector int b)
146{
147 return a + b;
148}
149
150static vector unsigned int _ATTRS_o_ai
151vec_add(vector unsigned int a, vector unsigned int b)
152{
153 return a + b;
154}
155
156static vector float _ATTRS_o_ai
157vec_add(vector float a, vector float b)
158{
159 return a + b;
160}
161
162/* vec_addc */
163
164#define __builtin_vec_addc __builtin_altivec_vaddcuw
165#define vec_vaddcuw __builtin_altivec_vaddcuw
166#define vec_addc __builtin_altivec_vaddcuw
167
168/* vec_adds */
169
170#define __builtin_vec_vaddsbs __builtin_altivec_vaddsbs
171#define __builtin_vec_vaddubs __builtin_altivec_vaddubs
172#define __builtin_vec_vaddshs __builtin_altivec_vaddshs
173#define __builtin_vec_vadduhs __builtin_altivec_vadduhs
174#define __builtin_vec_vaddsws __builtin_altivec_vaddsws
175#define __builtin_vec_vadduws __builtin_altivec_vadduws
176#define vec_vaddsbs __builtin_altivec_vaddsbs
177#define vec_vaddubs __builtin_altivec_vaddubs
178#define vec_vaddshs __builtin_altivec_vaddshs
179#define vec_vadduhs __builtin_altivec_vadduhs
180#define vec_vaddsws __builtin_altivec_vaddsws
181#define vec_vadduws __builtin_altivec_vadduws
182
183static vector char _ATTRS_o_ai
184vec_adds(vector char a, vector char b)
185{
186 return __builtin_altivec_vaddsbs(a, b);
187}
188
189static vector signed char _ATTRS_o_ai
190vec_adds(vector signed char a, vector signed char b)
191{
192 return __builtin_altivec_vaddsbs(a, b);
193}
194
195static vector unsigned char _ATTRS_o_ai
196vec_adds(vector unsigned char a, vector unsigned char b)
197{
198 return __builtin_altivec_vaddubs(a, b);
199}
200
201static vector short _ATTRS_o_ai
202vec_adds(vector short a, vector short b)
203{
204 return __builtin_altivec_vaddshs(a, b);
205}
206
207static vector unsigned short _ATTRS_o_ai
208vec_adds(vector unsigned short a, vector unsigned short b)
209{
210 return __builtin_altivec_vadduhs(a, b);
211}
212
213static vector int _ATTRS_o_ai
214vec_adds(vector int a, vector int b)
215{
216 return __builtin_altivec_vaddsws(a, b);
217}
218
219static vector unsigned int _ATTRS_o_ai
220vec_adds(vector unsigned int a, vector unsigned int b)
221{
222 return __builtin_altivec_vadduws(a, b);
223}
224
225/* vec_sub */
226
227#define __builtin_altivec_vsububm vec_sub
228#define __builtin_altivec_vsubuhm vec_sub
229#define __builtin_altivec_vsubuwm vec_sub
230#define __builtin_altivec_vsubfp vec_sub
231#define __builtin_vec_vsububm vec_sub
232#define __builtin_vec_vsubuhm vec_sub
233#define __builtin_vec_vsubuwm vec_sub
234#define __builtin_vec_vsubfp vec_sub
235#define vec_vsububm vec_sub
236#define vec_vsubuhm vec_sub
237#define vec_vsubuwm vec_sub
238#define vec_vsubfp vec_sub
239
240static vector char _ATTRS_o_ai
241vec_sub(vector char a, vector char b)
242{
243 return a - b;
244}
245
246static vector signed char _ATTRS_o_ai
247vec_sub(vector signed char a, vector signed char b)
248{
249 return a - b;
250}
251
252static vector unsigned char _ATTRS_o_ai
253vec_sub(vector unsigned char a, vector unsigned char b)
254{
255 return a - b;
256}
257
258static vector short _ATTRS_o_ai
259vec_sub(vector short a, vector short b)
260{
261 return a - b;
262}
263
264static vector unsigned short _ATTRS_o_ai
265vec_sub(vector unsigned short a, vector unsigned short b)
266{
267 return a - b;
268}
269
270static vector int _ATTRS_o_ai
271vec_sub(vector int a, vector int b)
272{
273 return a - b;
274}
275
276static vector unsigned int _ATTRS_o_ai
277vec_sub(vector unsigned int a, vector unsigned int b)
278{
279 return a - b;
280}
281
282static vector float _ATTRS_o_ai
283vec_sub(vector float a, vector float b)
284{
285 return a - b;
286}
287
288/* vec_subs */
289
290#define __builtin_vec_vsubsbs __builtin_altivec_vsubsbs
291#define __builtin_vec_vsububs __builtin_altivec_vsububs
292#define __builtin_vec_vsubshs __builtin_altivec_vsubshs
293#define __builtin_vec_vsubuhs __builtin_altivec_vsubuhs
294#define __builtin_vec_vsubsws __builtin_altivec_vsubsws
295#define __builtin_vec_vsubuws __builtin_altivec_vsubuws
296#define vec_vsubsbs __builtin_altivec_vsubsbs
297#define vec_vsububs __builtin_altivec_vsububs
298#define vec_vsubshs __builtin_altivec_vsubshs
299#define vec_vsubuhs __builtin_altivec_vsubuhs
300#define vec_vsubsws __builtin_altivec_vsubsws
301#define vec_vsubuws __builtin_altivec_vsubuws
302
303static vector char _ATTRS_o_ai
304vec_subs(vector char a, vector char b)
305{
306 return __builtin_altivec_vsubsbs(a, b);
307}
308
309static vector signed char _ATTRS_o_ai
310vec_subs(vector signed char a, vector signed char b)
311{
312 return __builtin_altivec_vsubsbs(a, b);
313}
314
315static vector unsigned char _ATTRS_o_ai
316vec_subs(vector unsigned char a, vector unsigned char b)
317{
318 return __builtin_altivec_vsububs(a, b);
319}
320
321static vector short _ATTRS_o_ai
322vec_subs(vector short a, vector short b)
323{
324 return __builtin_altivec_vsubshs(a, b);
325}
326
327static vector unsigned short _ATTRS_o_ai
328vec_subs(vector unsigned short a, vector unsigned short b)
329{
330 return __builtin_altivec_vsubuhs(a, b);
331}
332
333static vector int _ATTRS_o_ai
334vec_subs(vector int a, vector int b)
335{
336 return __builtin_altivec_vsubsws(a, b);
337}
338
339static vector unsigned int _ATTRS_o_ai
340vec_subs(vector unsigned int a, vector unsigned int b)
341{
342 return __builtin_altivec_vsubuws(a, b);
343}
344
345/* vec_avg */
346
347#define __builtin_vec_vavgsb __builtin_altivec_vavgsb
348#define __builtin_vec_vavgub __builtin_altivec_vavgub
349#define __builtin_vec_vavgsh __builtin_altivec_vavgsh
350#define __builtin_vec_vavguh __builtin_altivec_vavguh
351#define __builtin_vec_vavgsw __builtin_altivec_vavgsw
352#define __builtin_vec_vavguw __builtin_altivec_vavguw
353#define vec_vavgsb __builtin_altivec_vavgsb
354#define vec_vavgub __builtin_altivec_vavgub
355#define vec_vavgsh __builtin_altivec_vavgsh
356#define vec_vavguh __builtin_altivec_vavguh
357#define vec_vavgsw __builtin_altivec_vavgsw
358#define vec_vavguw __builtin_altivec_vavguw
359
360static vector char _ATTRS_o_ai
361vec_avg(vector char a, vector char b)
362{
363 return __builtin_altivec_vavgsb(a, b);
364}
365
366static vector signed char _ATTRS_o_ai
367vec_avg(vector signed char a, vector signed char b)
368{
369 return __builtin_altivec_vavgsb(a, b);
370}
371
372static vector unsigned char _ATTRS_o_ai
373vec_avg(vector unsigned char a, vector unsigned char b)
374{
375 return __builtin_altivec_vavgub(a, b);
376}
377
378static vector short _ATTRS_o_ai
379vec_avg(vector short a, vector short b)
380{
381 return __builtin_altivec_vavgsh(a, b);
382}
383
384static vector unsigned short _ATTRS_o_ai
385vec_avg(vector unsigned short a, vector unsigned short b)
386{
387 return __builtin_altivec_vavguh(a, b);
388}
389
390static vector int _ATTRS_o_ai
391vec_avg(vector int a, vector int b)
392{
393 return __builtin_altivec_vavgsw(a, b);
394}
395
396static vector unsigned int _ATTRS_o_ai
397vec_avg(vector unsigned int a, vector unsigned int b)
398{
399 return __builtin_altivec_vavguw(a, b);
400}
401
402/* vec_st */
403
404#define __builtin_vec_st vec_st
405#define vec_stvx vec_st
406
407static void _ATTRS_o_ai
408vec_st(vector char a, int b, vector char *c)
409{
410 __builtin_altivec_stvx((vector int)a, b, (void *)c);
411}
412
413static void _ATTRS_o_ai
414vec_st(vector signed char a, int b, vector signed char *c)
415{
416 __builtin_altivec_stvx((vector int)a, b, (void *)c);
417}
418
419static void _ATTRS_o_ai
420vec_st(vector unsigned char a, int b, vector unsigned char *c)
421{
422 __builtin_altivec_stvx((vector int)a, b, (void *)c);
423}
424
425static void _ATTRS_o_ai
426vec_st(vector short a, int b, vector short *c)
427{
428 __builtin_altivec_stvx((vector int)a, b, (void *)c);
429}
430
431static void _ATTRS_o_ai
432vec_st(vector unsigned short a, int b, vector unsigned short *c)
433{
434 __builtin_altivec_stvx((vector int)a, b, (void *)c);
435}
436
437static void _ATTRS_o_ai
438vec_st(vector int a, int b, vector int *c)
439{
440 __builtin_altivec_stvx(a, b, (void *)c);
441}
442
443static void _ATTRS_o_ai
444vec_st(vector unsigned int a, int b, vector unsigned int *c)
445{
446 __builtin_altivec_stvx((vector int)a, b, (void *)c);
447}
448
449static void _ATTRS_o_ai
450vec_st(vector float a, int b, vector float *c)
451{
452 __builtin_altivec_stvx((vector int)a, b, (void *)c);
453}
454
455/* vec_stl */
456
457#define __builtin_vec_stl vec_stl
458#define vec_stvxl vec_stl
459
460static void _ATTRS_o_ai
461vec_stl(vector char a, int b, vector char *c)
462{
463 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
464}
465
466static void _ATTRS_o_ai
467vec_stl(vector signed char a, int b, vector signed char *c)
468{
469 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
470}
471
472static void _ATTRS_o_ai
473vec_stl(vector unsigned char a, int b, vector unsigned char *c)
474{
475 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
476}
477
478static void _ATTRS_o_ai
479vec_stl(vector short a, int b, vector short *c)
480{
481 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
482}
483
484static void _ATTRS_o_ai
485vec_stl(vector unsigned short a, int b, vector unsigned short *c)
486{
487 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
488}
489
490static void _ATTRS_o_ai
491vec_stl(vector int a, int b, vector int *c)
492{
493 __builtin_altivec_stvxl(a, b, (void *)c);
494}
495
496static void _ATTRS_o_ai
497vec_stl(vector unsigned int a, int b, vector unsigned int *c)
498{
499 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
500}
501
502static void _ATTRS_o_ai
503vec_stl(vector float a, int b, vector float *c)
504{
505 __builtin_altivec_stvxl((vector int)a, b, (void *)c);
506}
507
508/* vec_ste */
509
510#define __builtin_vec_stvebx __builtin_altivec_stvebx
511#define __builtin_vec_stvehx __builtin_altivec_stvehx
512#define __builtin_vec_stvewx __builtin_altivec_stvewx
513#define vec_stvebx __builtin_altivec_stvebx
514#define vec_stvehx __builtin_altivec_stvehx
515#define vec_stvewx __builtin_altivec_stvewx
516
517static void _ATTRS_o_ai
518vec_ste(vector char a, int b, vector char *c)
519{
520 __builtin_altivec_stvebx((vector int)a, b, (void *)c);
521}
522
523static void _ATTRS_o_ai
524vec_ste(vector signed char a, int b, vector signed char *c)
525{
526 __builtin_altivec_stvebx((vector int)a, b, (void *)c);
527}
528
529static void _ATTRS_o_ai
530vec_ste(vector unsigned char a, int b, vector unsigned char *c)
531{
532 __builtin_altivec_stvebx((vector int)a, b, (void *)c);
533}
534
535static void _ATTRS_o_ai
536vec_ste(vector short a, int b, vector short *c)
537{
538 __builtin_altivec_stvehx((vector int)a, b, (void *)c);
539}
540
541static void _ATTRS_o_ai
542vec_ste(vector unsigned short a, int b, vector unsigned short *c)
543{
544 __builtin_altivec_stvehx((vector int)a, b, (void *)c);
545}
546
547static void _ATTRS_o_ai
548vec_ste(vector int a, int b, vector int *c)
549{
550 __builtin_altivec_stvewx(a, b, (void *)c);
551}
552
553static void _ATTRS_o_ai
554vec_ste(vector unsigned int a, int b, vector unsigned int *c)
555{
556 __builtin_altivec_stvewx((vector int)a, b, (void *)c);
557}
558
559static void _ATTRS_o_ai
560vec_ste(vector float a, int b, vector float *c)
561{
562 __builtin_altivec_stvewx((vector int)a, b, (void *)c);
563}
564
565/* vec_cmpb */
566
567#define vec_cmpb __builtin_altivec_vcmpbfp
568#define vec_vcmpbfp __builtin_altivec_vcmpbfp
569#define __builtin_vec_cmpb __builtin_altivec_vcmpbfp
570
571/* vec_cmpeq */
572
573#define __builtin_vec_cmpeq vec_cmpeq
574
575static vector char _ATTRS_o_ai
576vec_cmpeq(vector char a, vector char b)
577{
578 return __builtin_altivec_vcmpequb(a, b);
579}
580
581static vector char _ATTRS_o_ai
582vec_cmpeq(vector signed char a, vector signed char b)
583{
584 return __builtin_altivec_vcmpequb(a, b);
585}
586
587static vector char _ATTRS_o_ai
588vec_cmpeq(vector unsigned char a, vector unsigned char b)
589{
590 return __builtin_altivec_vcmpequb(a, b);
591}
592
593static vector short _ATTRS_o_ai
594vec_cmpeq(vector short a, vector short b)
595{
596 return __builtin_altivec_vcmpequh(a, b);
597}
598
599static vector short _ATTRS_o_ai
600vec_cmpeq(vector unsigned short a, vector unsigned short b)
601{
602 return __builtin_altivec_vcmpequh(a, b);
603}
604
605static vector int _ATTRS_o_ai
606vec_cmpeq(vector int a, vector int b)
607{
608 return __builtin_altivec_vcmpequw(a, b);
609}
610
611static vector int _ATTRS_o_ai
612vec_cmpeq(vector unsigned int a, vector unsigned int b)
613{
614 return __builtin_altivec_vcmpequw(a, b);
615}
616
617static vector int _ATTRS_o_ai
618vec_cmpeq(vector float a, vector float b)
619{
620 return __builtin_altivec_vcmpeqfp(a, b);
621}
622
623/* vec_cmpge */
624
625#define vec_cmpge __builtin_altivec_vcmpgefp
626#define vec_vcmpgefp __builtin_altivec_vcmpgefp
627#define __builtin_vec_cmpge __builtin_altivec_vcmpgefp
628
629/* vec_cmpgt */
630
631#define vec_vcmpgtsb __builtin_altivec_vcmpgtsb
632#define vec_vcmpgtub __builtin_altivec_vcmpgtub
633#define vec_vcmpgtsh __builtin_altivec_vcmpgtsh
634#define vec_vcmpgtuh __builtin_altivec_vcmpgtuh
635#define vec_vcmpgtsw __builtin_altivec_vcmpgtsw
636#define vec_vcmpgtuw __builtin_altivec_vcmpgtuw
637#define vec_vcmpgtfp __builtin_altivec_vcmpgtfp
638#define __builtin_vec_vcmpgtsb __builtin_altivec_vcmpgtsb
639#define __builtin_vec_vcmpgtub __builtin_altivec_vcmpgtub
640#define __builtin_vec_vcmpgtsh __builtin_altivec_vcmpgtsh
641#define __builtin_vec_vcmpgtuh __builtin_altivec_vcmpgtuh
642#define __builtin_vec_vcmpgtsw __builtin_altivec_vcmpgtsw
643#define __builtin_vec_vcmpgtuw __builtin_altivec_vcmpgtuw
644#define __builtin_vec_vcmpgtfp __builtin_altivec_vcmpgtfp
645
646static vector char _ATTRS_o_ai
647vec_cmpgt(vector char a, vector char b)
648{
649 return __builtin_altivec_vcmpgtsb(a, b);
650}
651
652static vector char _ATTRS_o_ai
653vec_cmpgt(vector signed char a, vector signed char b)
654{
655 return __builtin_altivec_vcmpgtsb(a, b);
656}
657
658static vector char _ATTRS_o_ai
659vec_cmpgt(vector unsigned char a, vector unsigned char b)
660{
661 return __builtin_altivec_vcmpgtub(a, b);
662}
663
664static vector short _ATTRS_o_ai
665vec_cmpgt(vector short a, vector short b)
666{
667 return __builtin_altivec_vcmpgtsh(a, b);
668}
669
670static vector short _ATTRS_o_ai
671vec_cmpgt(vector unsigned short a, vector unsigned short b)
672{
673 return __builtin_altivec_vcmpgtuh(a, b);
674}
675
676static vector int _ATTRS_o_ai
677vec_cmpgt(vector int a, vector int b)
678{
679 return __builtin_altivec_vcmpgtsw(a, b);
680}
681
682static vector int _ATTRS_o_ai
683vec_cmpgt(vector unsigned int a, vector unsigned int b)
684{
685 return __builtin_altivec_vcmpgtuw(a, b);
686}
687
688static vector int _ATTRS_o_ai
689vec_cmpgt(vector float a, vector float b)
690{
691 return __builtin_altivec_vcmpgtfp(a, b);
692}
693
694/* vec_cmple */
695
696#define __builtin_vec_cmple vec_cmple
697
698static vector int __attribute__((__always_inline__))
699vec_cmple(vector float a, vector float b)
700{
701 return __builtin_altivec_vcmpgefp(b, a);
702}
703
704/* vec_cmplt */
705
706#define __builtin_vec_cmplt vec_cmplt
707
708static vector char _ATTRS_o_ai
709vec_cmplt(vector char a, vector char b)
710{
711 return __builtin_altivec_vcmpgtsb(b, a);
712}
713
714static vector char _ATTRS_o_ai
715vec_cmplt(vector signed char a, vector signed char b)
716{
717 return __builtin_altivec_vcmpgtsb(b, a);
718}
719
720static vector char _ATTRS_o_ai
721vec_cmplt(vector unsigned char a, vector unsigned char b)
722{
723 return __builtin_altivec_vcmpgtub(b, a);
724}
725
726static vector short _ATTRS_o_ai
727vec_cmplt(vector short a, vector short b)
728{
729 return __builtin_altivec_vcmpgtsh(b, a);
730}
731
732static vector short _ATTRS_o_ai
733vec_cmplt(vector unsigned short a, vector unsigned short b)
734{
735 return __builtin_altivec_vcmpgtuh(b, a);
736}
737
738static vector int _ATTRS_o_ai
739vec_cmplt(vector int a, vector int b)
740{
741 return __builtin_altivec_vcmpgtsw(b, a);
742}
743
744static vector int _ATTRS_o_ai
745vec_cmplt(vector unsigned int a, vector unsigned int b)
746{
747 return __builtin_altivec_vcmpgtuw(b, a);
748}
749
750static vector int _ATTRS_o_ai
751vec_cmplt(vector float a, vector float b)
752{
753 return __builtin_altivec_vcmpgtfp(b, a);
754}
755
756/* vec_max */
757
758#define __builtin_vec_vmaxsb __builtin_altivec_vmaxsb
759#define __builtin_vec_vmaxub __builtin_altivec_vmaxub
760#define __builtin_vec_vmaxsh __builtin_altivec_vmaxsh
761#define __builtin_vec_vmaxuh __builtin_altivec_vmaxuh
762#define __builtin_vec_vmaxsw __builtin_altivec_vmaxsw
763#define __builtin_vec_vmaxuw __builtin_altivec_vmaxuw
764#define __builtin_vec_vmaxfp __builtin_altivec_vmaxfp
765#define vec_vmaxsb __builtin_altivec_vmaxsb
766#define vec_vmaxub __builtin_altivec_vmaxub
767#define vec_vmaxsh __builtin_altivec_vmaxsh
768#define vec_vmaxuh __builtin_altivec_vmaxuh
769#define vec_vmaxsw __builtin_altivec_vmaxsw
770#define vec_vmaxuw __builtin_altivec_vmaxuw
771#define vec_vmaxfp __builtin_altivec_vmaxfp
772#define __builtin_vec_max vec_max
773
774static vector char _ATTRS_o_ai
775vec_max(vector char a, vector char b)
776{
777 return __builtin_altivec_vmaxsb(a, b);
778}
779
780static vector signed char _ATTRS_o_ai
781vec_max(vector signed char a, vector signed char b)
782{
783 return __builtin_altivec_vmaxsb(a, b);
784}
785
786static vector unsigned char _ATTRS_o_ai
787vec_max(vector unsigned char a, vector unsigned char b)
788{
789 return __builtin_altivec_vmaxub(a, b);
790}
791
792static vector short _ATTRS_o_ai
793vec_max(vector short a, vector short b)
794{
795 return __builtin_altivec_vmaxsh(a, b);
796}
797
798static vector unsigned short _ATTRS_o_ai
799vec_max(vector unsigned short a, vector unsigned short b)
800{
801 return __builtin_altivec_vmaxuh(a, b);
802}
803
804static vector int _ATTRS_o_ai
805vec_max(vector int a, vector int b)
806{
807 return __builtin_altivec_vmaxsw(a, b);
808}
809
810static vector unsigned int _ATTRS_o_ai
811vec_max(vector unsigned int a, vector unsigned int b)
812{
813 return __builtin_altivec_vmaxuw(a, b);
814}
815
816static vector float _ATTRS_o_ai
817vec_max(vector float a, vector float b)
818{
819 return __builtin_altivec_vmaxfp(a, b);
820}
821
822/* vec_mfvscr */
823
824#define __builtin_vec_mfvscr __builtin_altivec_mfvscr
825#define vec_mfvscr __builtin_altivec_mfvscr
826
827/* vec_min */
828
829#define __builtin_vec_vminsb __builtin_altivec_vminsb
830#define __builtin_vec_vminub __builtin_altivec_vminub
831#define __builtin_vec_vminsh __builtin_altivec_vminsh
832#define __builtin_vec_vminuh __builtin_altivec_vminuh
833#define __builtin_vec_vminsw __builtin_altivec_vminsw
834#define __builtin_vec_vminuw __builtin_altivec_vminuw
835#define __builtin_vec_vminfp __builtin_altivec_vminfp
836#define vec_vminsb __builtin_altivec_vminsb
837#define vec_vminub __builtin_altivec_vminub
838#define vec_vminsh __builtin_altivec_vminsh
839#define vec_vminuh __builtin_altivec_vminuh
840#define vec_vminsw __builtin_altivec_vminsw
841#define vec_vminuw __builtin_altivec_vminuw
842#define vec_vminfp __builtin_altivec_vminfp
843#define __builtin_vec_min vec_min
844
845static vector char _ATTRS_o_ai
846vec_min(vector char a, vector char b)
847{
848 return __builtin_altivec_vminsb(a, b);
849}
850
851static vector signed char _ATTRS_o_ai
852vec_min(vector signed char a, vector signed char b)
853{
854 return __builtin_altivec_vminsb(a, b);
855}
856
857static vector unsigned char _ATTRS_o_ai
858vec_min(vector unsigned char a, vector unsigned char b)
859{
860 return __builtin_altivec_vminub(a, b);
861}
862
863static vector short _ATTRS_o_ai
864vec_min(vector short a, vector short b)
865{
866 return __builtin_altivec_vminsh(a, b);
867}
868
869static vector unsigned short _ATTRS_o_ai
870vec_min(vector unsigned short a, vector unsigned short b)
871{
872 return __builtin_altivec_vminuh(a, b);
873}
874
875static vector int _ATTRS_o_ai
876vec_min(vector int a, vector int b)
877{
878 return __builtin_altivec_vminsw(a, b);
879}
880
881static vector unsigned int _ATTRS_o_ai
882vec_min(vector unsigned int a, vector unsigned int b)
883{
884 return __builtin_altivec_vminuw(a, b);
885}
886
887static vector float _ATTRS_o_ai
888vec_min(vector float a, vector float b)
889{
890 return __builtin_altivec_vminfp(a, b);
891}
892
893/* vec_mtvscr */
894
895#define __builtin_vec_mtvscr __builtin_altivec_mtvscr
896#define vec_mtvscr __builtin_altivec_mtvscr
897
898/* ------------------------------ predicates ------------------------------------ */
899
900static int __attribute__((__always_inline__))
901__builtin_vec_vcmpeq_p(char CR6_param, vector float a, vector float b)
902{
903 return __builtin_altivec_vcmpeqfp_p(CR6_param, a, b);
904}
905
906static int __attribute__((__always_inline__))
907__builtin_vec_vcmpge_p(char CR6_param, vector float a, vector float b)
908{
909 return __builtin_altivec_vcmpgefp_p(CR6_param, a, b);
910}
911
912static int __attribute__((__always_inline__))
913__builtin_vec_vcmpgt_p(char CR6_param, vector float a, vector float b)
914{
915 return __builtin_altivec_vcmpgtfp_p(CR6_param, a, b);
916}
917
918/* vec_all_eq */
919
920static int _ATTRS_o_ai
921vec_all_eq(vector char a, vector char b)
922{
923 return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
924}
925
926static int _ATTRS_o_ai
927vec_all_eq(vector signed char a, vector signed char b)
928{
929 return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
930}
931
932static int _ATTRS_o_ai
933vec_all_eq(vector unsigned char a, vector unsigned char b)
934{
935 return __builtin_altivec_vcmpequb_p(__CR6_LT, a, b);
936}
937
938static int _ATTRS_o_ai
939vec_all_eq(vector short a, vector short b)
940{
941 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
942}
943
944static int _ATTRS_o_ai
945vec_all_eq(vector unsigned short a, vector unsigned short b)
946{
947 return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);
948}
949
950static int _ATTRS_o_ai
951vec_all_eq(vector int a, vector int b)
952{
953 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
954}
955
956static int _ATTRS_o_ai
957vec_all_eq(vector unsigned int a, vector unsigned int b)
958{
959 return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);
960}
961
962static int _ATTRS_o_ai
963vec_all_eq(vector float a, vector float b)
964{
965 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b);
966}
967
968/* vec_all_ge */
969
970static int _ATTRS_o_ai
971vec_all_ge(vector char a, vector char b)
972{
973 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
974}
975
976static int _ATTRS_o_ai
977vec_all_ge(vector signed char a, vector signed char b)
978{
979 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
980}
981
982static int _ATTRS_o_ai
983vec_all_ge(vector unsigned char a, vector unsigned char b)
984{
985 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);
986}
987
988static int _ATTRS_o_ai
989vec_all_ge(vector short a, vector short b)
990{
991 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);
992}
993
994static int _ATTRS_o_ai
995vec_all_ge(vector unsigned short a, vector unsigned short b)
996{
997 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);
998}
999
1000static int _ATTRS_o_ai
1001vec_all_ge(vector int a, vector int b)
1002{
1003 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);
1004}
1005
1006static int _ATTRS_o_ai
1007vec_all_ge(vector unsigned int a, vector unsigned int b)
1008{
1009 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);
1010}
1011
1012static int _ATTRS_o_ai
1013vec_all_ge(vector float a, vector float b)
1014{
1015 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);
1016}
1017
1018/* vec_all_gt */
1019
1020static int _ATTRS_o_ai
1021vec_all_gt(vector char a, vector char b)
1022{
1023 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
1024}
1025
1026static int _ATTRS_o_ai
1027vec_all_gt(vector signed char a, vector signed char b)
1028{
1029 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);
1030}
1031
1032static int _ATTRS_o_ai
1033vec_all_gt(vector unsigned char a, vector unsigned char b)
1034{
1035 return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b);
1036}
1037
1038static int _ATTRS_o_ai
1039vec_all_gt(vector short a, vector short b)
1040{
1041 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b);
1042}
1043
1044static int _ATTRS_o_ai
1045vec_all_gt(vector unsigned short a, vector unsigned short b)
1046{
1047 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b);
1048}
1049
1050static int _ATTRS_o_ai
1051vec_all_gt(vector int a, vector int b)
1052{
1053 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b);
1054}
1055
1056static int _ATTRS_o_ai
1057vec_all_gt(vector unsigned int a, vector unsigned int b)
1058{
1059 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b);
1060}
1061
1062static int _ATTRS_o_ai
1063vec_all_gt(vector float a, vector float b)
1064{
1065 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b);
1066}
1067
1068/* vec_all_in */
1069
1070static int __attribute__((__always_inline__))
1071vec_all_in(vector float a, vector float b)
1072{
1073 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b);
1074}
1075
1076/* vec_all_le */
1077
1078static int _ATTRS_o_ai
1079vec_all_le(vector char a, vector char b)
1080{
1081 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
1082}
1083
1084static int _ATTRS_o_ai
1085vec_all_le(vector signed char a, vector signed char b)
1086{
1087 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);
1088}
1089
1090static int _ATTRS_o_ai
1091vec_all_le(vector unsigned char a, vector unsigned char b)
1092{
1093 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b);
1094}
1095
1096static int _ATTRS_o_ai
1097vec_all_le(vector short a, vector short b)
1098{
1099 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b);
1100}
1101
1102static int _ATTRS_o_ai
1103vec_all_le(vector unsigned short a, vector unsigned short b)
1104{
1105 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b);
1106}
1107
1108static int _ATTRS_o_ai
1109vec_all_le(vector int a, vector int b)
1110{
1111 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b);
1112}
1113
1114static int _ATTRS_o_ai
1115vec_all_le(vector unsigned int a, vector unsigned int b)
1116{
1117 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b);
1118}
1119
1120static int _ATTRS_o_ai
1121vec_all_le(vector float a, vector float b)
1122{
1123 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);
1124}
1125
1126/* vec_all_lt */
1127
1128static int _ATTRS_o_ai
1129vec_all_lt(vector char a, vector char b)
1130{
1131 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
1132}
1133
1134static int _ATTRS_o_ai
1135vec_all_lt(vector signed char a, vector signed char b)
1136{
1137 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);
1138}
1139
1140static int _ATTRS_o_ai
1141vec_all_lt(vector unsigned char a, vector unsigned char b)
1142{
1143 return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);
1144}
1145
1146static int _ATTRS_o_ai
1147vec_all_lt(vector short a, vector short b)
1148{
1149 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);
1150}
1151
1152static int _ATTRS_o_ai
1153vec_all_lt(vector unsigned short a, vector unsigned short b)
1154{
1155 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);
1156}
1157
1158static int _ATTRS_o_ai
1159vec_all_lt(vector int a, vector int b)
1160{
1161 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);
1162}
1163
1164static int _ATTRS_o_ai
1165vec_all_lt(vector unsigned int a, vector unsigned int b)
1166{
1167 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);
1168}
1169
1170static int _ATTRS_o_ai
1171vec_all_lt(vector float a, vector float b)
1172{
1173 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);
1174}
1175
1176/* vec_all_nan */
1177
1178static int __attribute__((__always_inline__))
1179vec_all_nan(vector float a)
1180{
1181 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a);
1182}
1183
1184/* vec_all_ne */
1185
1186static int _ATTRS_o_ai
1187vec_all_ne(vector char a, vector char b)
1188{
1189 return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
1190}
1191
1192static int _ATTRS_o_ai
1193vec_all_ne(vector signed char a, vector signed char b)
1194{
1195 return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
1196}
1197
1198static int _ATTRS_o_ai
1199vec_all_ne(vector unsigned char a, vector unsigned char b)
1200{
1201 return __builtin_altivec_vcmpequb_p(__CR6_EQ, a, b);
1202}
1203
1204static int _ATTRS_o_ai
1205vec_all_ne(vector short a, vector short b)
1206{
1207 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
1208}
1209
1210static int _ATTRS_o_ai
1211vec_all_ne(vector unsigned short a, vector unsigned short b)
1212{
1213 return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);
1214}
1215
1216static int _ATTRS_o_ai
1217vec_all_ne(vector int a, vector int b)
1218{
1219 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
1220}
1221
1222static int _ATTRS_o_ai
1223vec_all_ne(vector unsigned int a, vector unsigned int b)
1224{
1225 return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);
1226}
1227
1228static int _ATTRS_o_ai
1229vec_all_ne(vector float a, vector float b)
1230{
1231 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b);
1232}
1233
1234/* vec_all_nge */
1235
1236static int __attribute__((__always_inline__))
1237vec_all_nge(vector float a, vector float b)
1238{
1239 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b);
1240}
1241
1242/* vec_all_ngt */
1243
1244static int __attribute__((__always_inline__))
1245vec_all_ngt(vector float a, vector float b)
1246{
1247 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);
1248}
1249
1250/* vec_all_nle */
1251
1252static int __attribute__((__always_inline__))
1253vec_all_nle(vector float a, vector float b)
1254{
1255 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a);
1256}
1257
1258/* vec_all_nlt */
1259
1260static int __attribute__((__always_inline__))
1261vec_all_nlt(vector float a, vector float b)
1262{
1263 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a);
1264}
1265
1266/* vec_all_numeric */
1267
1268static int __attribute__((__always_inline__))
1269vec_all_numeric(vector float a)
1270{
1271 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a);
1272}
1273
1274/* vec_any_eq */
1275
1276static int _ATTRS_o_ai
1277vec_any_eq(vector char a, vector char b)
1278{
1279 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
1280}
1281
1282static int _ATTRS_o_ai
1283vec_any_eq(vector signed char a, vector signed char b)
1284{
1285 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
1286}
1287
1288static int _ATTRS_o_ai
1289vec_any_eq(vector unsigned char a, vector unsigned char b)
1290{
1291 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, a, b);
1292}
1293
1294static int _ATTRS_o_ai
1295vec_any_eq(vector short a, vector short b)
1296{
1297 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
1298}
1299
1300static int _ATTRS_o_ai
1301vec_any_eq(vector unsigned short a, vector unsigned short b)
1302{
1303 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);
1304}
1305
1306static int _ATTRS_o_ai
1307vec_any_eq(vector int a, vector int b)
1308{
1309 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
1310}
1311
1312static int _ATTRS_o_ai
1313vec_any_eq(vector unsigned int a, vector unsigned int b)
1314{
1315 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);
1316}
1317
1318static int _ATTRS_o_ai
1319vec_any_eq(vector float a, vector float b)
1320{
1321 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b);
1322}
1323
1324/* vec_any_ge */
1325
1326static int _ATTRS_o_ai
1327vec_any_ge(vector char a, vector char b)
1328{
1329 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
1330}
1331
1332static int _ATTRS_o_ai
1333vec_any_ge(vector signed char a, vector signed char b)
1334{
1335 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);
1336}
1337
1338static int _ATTRS_o_ai
1339vec_any_ge(vector unsigned char a, vector unsigned char b)
1340{
1341 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a);
1342}
1343
1344static int _ATTRS_o_ai
1345vec_any_ge(vector short a, vector short b)
1346{
1347 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a);
1348}
1349
1350static int _ATTRS_o_ai
1351vec_any_ge(vector unsigned short a, vector unsigned short b)
1352{
1353 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a);
1354}
1355
1356static int _ATTRS_o_ai
1357vec_any_ge(vector int a, vector int b)
1358{
1359 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a);
1360}
1361
1362static int _ATTRS_o_ai
1363vec_any_ge(vector unsigned int a, vector unsigned int b)
1364{
1365 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a);
1366}
1367
1368static int _ATTRS_o_ai
1369vec_any_ge(vector float a, vector float b)
1370{
1371 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);
1372}
1373
1374/* vec_any_gt */
1375
1376static int _ATTRS_o_ai
1377vec_any_gt(vector char a, vector char b)
1378{
1379 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
1380}
1381
1382static int _ATTRS_o_ai
1383vec_any_gt(vector signed char a, vector signed char b)
1384{
1385 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);
1386}
1387
1388static int _ATTRS_o_ai
1389vec_any_gt(vector unsigned char a, vector unsigned char b)
1390{
1391 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b);
1392}
1393
1394static int _ATTRS_o_ai
1395vec_any_gt(vector short a, vector short b)
1396{
1397 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b);
1398}
1399
1400static int _ATTRS_o_ai
1401vec_any_gt(vector unsigned short a, vector unsigned short b)
1402{
1403 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b);
1404}
1405
1406static int _ATTRS_o_ai
1407vec_any_gt(vector int a, vector int b)
1408{
1409 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b);
1410}
1411
1412static int _ATTRS_o_ai
1413vec_any_gt(vector unsigned int a, vector unsigned int b)
1414{
1415 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b);
1416}
1417
1418static int _ATTRS_o_ai
1419vec_any_gt(vector float a, vector float b)
1420{
1421 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b);
1422}
1423
1424/* vec_any_le */
1425
1426static int _ATTRS_o_ai
1427vec_any_le(vector char a, vector char b)
1428{
1429 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
1430}
1431
1432static int _ATTRS_o_ai
1433vec_any_le(vector signed char a, vector signed char b)
1434{
1435 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);
1436}
1437
1438static int _ATTRS_o_ai
1439vec_any_le(vector unsigned char a, vector unsigned char b)
1440{
1441 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b);
1442}
1443
1444static int _ATTRS_o_ai
1445vec_any_le(vector short a, vector short b)
1446{
1447 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b);
1448}
1449
1450static int _ATTRS_o_ai
1451vec_any_le(vector unsigned short a, vector unsigned short b)
1452{
1453 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b);
1454}
1455
1456static int _ATTRS_o_ai
1457vec_any_le(vector int a, vector int b)
1458{
1459 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b);
1460}
1461
1462static int _ATTRS_o_ai
1463vec_any_le(vector unsigned int a, vector unsigned int b)
1464{
1465 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b);
1466}
1467
1468static int _ATTRS_o_ai
1469vec_any_le(vector float a, vector float b)
1470{
1471 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);
1472}
1473
1474/* vec_any_lt */
1475
1476static int _ATTRS_o_ai
1477vec_any_lt(vector char a, vector char b)
1478{
1479 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
1480}
1481
1482static int _ATTRS_o_ai
1483vec_any_lt(vector signed char a, vector signed char b)
1484{
1485 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);
1486}
1487
1488static int _ATTRS_o_ai
1489vec_any_lt(vector unsigned char a, vector unsigned char b)
1490{
1491 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a);
1492}
1493
1494static int _ATTRS_o_ai
1495vec_any_lt(vector short a, vector short b)
1496{
1497 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a);
1498}
1499
1500static int _ATTRS_o_ai
1501vec_any_lt(vector unsigned short a, vector unsigned short b)
1502{
1503 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a);
1504}
1505
1506static int _ATTRS_o_ai
1507vec_any_lt(vector int a, vector int b)
1508{
1509 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a);
1510}
1511
1512static int _ATTRS_o_ai
1513vec_any_lt(vector unsigned int a, vector unsigned int b)
1514{
1515 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a);
1516}
1517
1518static int _ATTRS_o_ai
1519vec_any_lt(vector float a, vector float b)
1520{
1521 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a);
1522}
1523
1524/* vec_any_nan */
1525
1526static int __attribute__((__always_inline__))
1527vec_any_nan(vector float a)
1528{
1529 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a);
1530}
1531
1532/* vec_any_ne */
1533
1534static int _ATTRS_o_ai
1535vec_any_ne(vector char a, vector char b)
1536{
1537 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
1538}
1539
1540static int _ATTRS_o_ai
1541vec_any_ne(vector signed char a, vector signed char b)
1542{
1543 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
1544}
1545
1546static int _ATTRS_o_ai
1547vec_any_ne(vector unsigned char a, vector unsigned char b)
1548{
1549 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, a, b);
1550}
1551
1552static int _ATTRS_o_ai
1553vec_any_ne(vector short a, vector short b)
1554{
1555 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
1556}
1557
1558static int _ATTRS_o_ai
1559vec_any_ne(vector unsigned short a, vector unsigned short b)
1560{
1561 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);
1562}
1563
1564static int _ATTRS_o_ai
1565vec_any_ne(vector int a, vector int b)
1566{
1567 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
1568}
1569
1570static int _ATTRS_o_ai
1571vec_any_ne(vector unsigned int a, vector unsigned int b)
1572{
1573 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);
1574}
1575
1576static int _ATTRS_o_ai
1577vec_any_ne(vector float a, vector float b)
1578{
1579 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b);
1580}
1581
1582/* vec_any_nge */
1583
1584static int __attribute__((__always_inline__))
1585vec_any_nge(vector float a, vector float b)
1586{
1587 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b);
1588}
1589
1590/* vec_any_ngt */
1591
1592static int __attribute__((__always_inline__))
1593vec_any_ngt(vector float a, vector float b)
1594{
1595 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);
1596}
1597
1598/* vec_any_nle */
1599
1600static int __attribute__((__always_inline__))
1601vec_any_nle(vector float a, vector float b)
1602{
1603 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a);
1604}
1605
1606/* vec_any_nlt */
1607
1608static int __attribute__((__always_inline__))
1609vec_any_nlt(vector float a, vector float b)
1610{
1611 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);
1612}
1613
1614/* vec_any_numeric */
1615
1616static int __attribute__((__always_inline__))
1617vec_any_numeric(vector float a)
1618{
1619 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a);
1620}
1621
1622/* vec_any_out */
1623
1624static int __attribute__((__always_inline__))
1625vec_any_out(vector float a, vector float b)
1626{
1627 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b);
1628}
1629
1630#undef _ATTRS_o_ai
1631
1632#endif /* __ALTIVEC_H */