1/*===---- 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
39static __inline__ vector signed char __ATTRS_o_ai vec_perm(
40    vector signed char __a, vector signed char __b, vector unsigned char __c);
41
42static __inline__ vector unsigned char __ATTRS_o_ai
43vec_perm(vector unsigned char __a, vector unsigned char __b,
44         vector unsigned char __c);
45
46static __inline__ vector bool char __ATTRS_o_ai
47vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
48
49static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
50                                                     vector signed short __b,
51                                                     vector unsigned char __c);
52
53static __inline__ vector unsigned short __ATTRS_o_ai
54vec_perm(vector unsigned short __a, vector unsigned short __b,
55         vector unsigned char __c);
56
57static __inline__ vector bool short __ATTRS_o_ai vec_perm(
58    vector bool short __a, vector bool short __b, vector unsigned char __c);
59
60static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
61                                                     vector pixel __b,
62                                                     vector unsigned char __c);
63
64static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
65                                                   vector signed int __b,
66                                                   vector unsigned char __c);
67
68static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
69    vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
70
71static __inline__ vector bool int __ATTRS_o_ai
72vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
73
74static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
75                                                     vector float __b,
76                                                     vector unsigned char __c);
77
78#ifdef __VSX__
79static __inline__ vector long long __ATTRS_o_ai
80vec_perm(vector signed long long __a, vector signed long long __b,
81         vector unsigned char __c);
82
83static __inline__ vector unsigned long long __ATTRS_o_ai
84vec_perm(vector unsigned long long __a, vector unsigned long long __b,
85         vector unsigned char __c);
86
87static __inline__ vector bool long long __ATTRS_o_ai
88vec_perm(vector bool long long __a, vector bool long long __b,
89         vector unsigned char __c);
90
91static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
92                                                      vector double __b,
93                                                      vector unsigned char __c);
94#endif
95
96static __inline__ vector unsigned char __ATTRS_o_ai
97vec_xor(vector unsigned char __a, vector unsigned char __b);
98
99/* vec_abs */
100
101#define __builtin_altivec_abs_v16qi vec_abs
102#define __builtin_altivec_abs_v8hi vec_abs
103#define __builtin_altivec_abs_v4si vec_abs
104
105static __inline__ vector signed char __ATTRS_o_ai
106vec_abs(vector signed char __a) {
107  return __builtin_altivec_vmaxsb(__a, -__a);
108}
109
110static __inline__ vector signed short __ATTRS_o_ai
111vec_abs(vector signed short __a) {
112  return __builtin_altivec_vmaxsh(__a, -__a);
113}
114
115static __inline__ vector signed int __ATTRS_o_ai
116vec_abs(vector signed int __a) {
117  return __builtin_altivec_vmaxsw(__a, -__a);
118}
119
120#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
121static __inline__ vector signed long long __ATTRS_o_ai
122vec_abs(vector signed long long __a) {
123  return __builtin_altivec_vmaxsd(__a, -__a);
124}
125#endif
126
127static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
128#ifdef __VSX__
129  return __builtin_vsx_xvabssp(__a);
130#else
131  vector unsigned int __res =
132      (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
133  return (vector float)__res;
134#endif
135}
136
137#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
138static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
139  return __builtin_vsx_xvabsdp(__a);
140}
141#endif
142
143/* vec_abss */
144#define __builtin_altivec_abss_v16qi vec_abss
145#define __builtin_altivec_abss_v8hi vec_abss
146#define __builtin_altivec_abss_v4si vec_abss
147
148static __inline__ vector signed char __ATTRS_o_ai
149vec_abss(vector signed char __a) {
150  return __builtin_altivec_vmaxsb(
151      __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
152}
153
154static __inline__ vector signed short __ATTRS_o_ai
155vec_abss(vector signed short __a) {
156  return __builtin_altivec_vmaxsh(
157      __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
158}
159
160static __inline__ vector signed int __ATTRS_o_ai
161vec_abss(vector signed int __a) {
162  return __builtin_altivec_vmaxsw(
163      __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
164}
165
166/* vec_add */
167
168static __inline__ vector signed char __ATTRS_o_ai
169vec_add(vector signed char __a, vector signed char __b) {
170  return __a + __b;
171}
172
173static __inline__ vector signed char __ATTRS_o_ai
174vec_add(vector bool char __a, vector signed char __b) {
175  return (vector signed char)__a + __b;
176}
177
178static __inline__ vector signed char __ATTRS_o_ai
179vec_add(vector signed char __a, vector bool char __b) {
180  return __a + (vector signed char)__b;
181}
182
183static __inline__ vector unsigned char __ATTRS_o_ai
184vec_add(vector unsigned char __a, vector unsigned char __b) {
185  return __a + __b;
186}
187
188static __inline__ vector unsigned char __ATTRS_o_ai
189vec_add(vector bool char __a, vector unsigned char __b) {
190  return (vector unsigned char)__a + __b;
191}
192
193static __inline__ vector unsigned char __ATTRS_o_ai
194vec_add(vector unsigned char __a, vector bool char __b) {
195  return __a + (vector unsigned char)__b;
196}
197
198static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
199                                                    vector short __b) {
200  return __a + __b;
201}
202
203static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
204                                                    vector short __b) {
205  return (vector short)__a + __b;
206}
207
208static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
209                                                    vector bool short __b) {
210  return __a + (vector short)__b;
211}
212
213static __inline__ vector unsigned short __ATTRS_o_ai
214vec_add(vector unsigned short __a, vector unsigned short __b) {
215  return __a + __b;
216}
217
218static __inline__ vector unsigned short __ATTRS_o_ai
219vec_add(vector bool short __a, vector unsigned short __b) {
220  return (vector unsigned short)__a + __b;
221}
222
223static __inline__ vector unsigned short __ATTRS_o_ai
224vec_add(vector unsigned short __a, vector bool short __b) {
225  return __a + (vector unsigned short)__b;
226}
227
228static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
229                                                  vector int __b) {
230  return __a + __b;
231}
232
233static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
234                                                  vector int __b) {
235  return (vector int)__a + __b;
236}
237
238static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
239                                                  vector bool int __b) {
240  return __a + (vector int)__b;
241}
242
243static __inline__ vector unsigned int __ATTRS_o_ai
244vec_add(vector unsigned int __a, vector unsigned int __b) {
245  return __a + __b;
246}
247
248static __inline__ vector unsigned int __ATTRS_o_ai
249vec_add(vector bool int __a, vector unsigned int __b) {
250  return (vector unsigned int)__a + __b;
251}
252
253static __inline__ vector unsigned int __ATTRS_o_ai
254vec_add(vector unsigned int __a, vector bool int __b) {
255  return __a + (vector unsigned int)__b;
256}
257
258#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
259static __inline__ vector signed long long __ATTRS_o_ai
260vec_add(vector signed long long __a, vector signed long long __b) {
261  return __a + __b;
262}
263
264static __inline__ vector unsigned long long __ATTRS_o_ai
265vec_add(vector unsigned long long __a, vector unsigned long long __b) {
266  return __a + __b;
267}
268
269static __inline__ vector signed __int128 __ATTRS_o_ai
270vec_add(vector signed __int128 __a, vector signed __int128 __b) {
271  return __a + __b;
272}
273
274static __inline__ vector unsigned __int128 __ATTRS_o_ai
275vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
276  return __a + __b;
277}
278#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
279
280static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
281                                                    vector float __b) {
282  return __a + __b;
283}
284
285#ifdef __VSX__
286static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
287                                                     vector double __b) {
288  return __a + __b;
289}
290#endif // __VSX__
291
292/* vec_adde */
293
294#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
295static __inline__ vector signed __int128 __ATTRS_o_ai
296vec_adde(vector signed __int128 __a, vector signed __int128 __b,
297         vector signed __int128 __c) {
298  return __builtin_altivec_vaddeuqm(__a, __b, __c);
299}
300
301static __inline__ vector unsigned __int128 __ATTRS_o_ai
302vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
303         vector unsigned __int128 __c) {
304  return __builtin_altivec_vaddeuqm(__a, __b, __c);
305}
306#endif
307
308/* vec_addec */
309
310#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
311static __inline__ vector signed __int128 __ATTRS_o_ai
312vec_addec(vector signed __int128 __a, vector signed __int128 __b,
313          vector signed __int128 __c) {
314  return __builtin_altivec_vaddecuq(__a, __b, __c);
315}
316
317static __inline__ vector unsigned __int128 __ATTRS_o_ai
318vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
319          vector unsigned __int128 __c) {
320  return __builtin_altivec_vaddecuq(__a, __b, __c);
321}
322#endif
323
324/* vec_vaddubm */
325
326#define __builtin_altivec_vaddubm vec_vaddubm
327
328static __inline__ vector signed char __ATTRS_o_ai
329vec_vaddubm(vector signed char __a, vector signed char __b) {
330  return __a + __b;
331}
332
333static __inline__ vector signed char __ATTRS_o_ai
334vec_vaddubm(vector bool char __a, vector signed char __b) {
335  return (vector signed char)__a + __b;
336}
337
338static __inline__ vector signed char __ATTRS_o_ai
339vec_vaddubm(vector signed char __a, vector bool char __b) {
340  return __a + (vector signed char)__b;
341}
342
343static __inline__ vector unsigned char __ATTRS_o_ai
344vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
345  return __a + __b;
346}
347
348static __inline__ vector unsigned char __ATTRS_o_ai
349vec_vaddubm(vector bool char __a, vector unsigned char __b) {
350  return (vector unsigned char)__a + __b;
351}
352
353static __inline__ vector unsigned char __ATTRS_o_ai
354vec_vaddubm(vector unsigned char __a, vector bool char __b) {
355  return __a + (vector unsigned char)__b;
356}
357
358/* vec_vadduhm */
359
360#define __builtin_altivec_vadduhm vec_vadduhm
361
362static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
363                                                        vector short __b) {
364  return __a + __b;
365}
366
367static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
368                                                        vector short __b) {
369  return (vector short)__a + __b;
370}
371
372static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
373                                                        vector bool short __b) {
374  return __a + (vector short)__b;
375}
376
377static __inline__ vector unsigned short __ATTRS_o_ai
378vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
379  return __a + __b;
380}
381
382static __inline__ vector unsigned short __ATTRS_o_ai
383vec_vadduhm(vector bool short __a, vector unsigned short __b) {
384  return (vector unsigned short)__a + __b;
385}
386
387static __inline__ vector unsigned short __ATTRS_o_ai
388vec_vadduhm(vector unsigned short __a, vector bool short __b) {
389  return __a + (vector unsigned short)__b;
390}
391
392/* vec_vadduwm */
393
394#define __builtin_altivec_vadduwm vec_vadduwm
395
396static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
397                                                      vector int __b) {
398  return __a + __b;
399}
400
401static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
402                                                      vector int __b) {
403  return (vector int)__a + __b;
404}
405
406static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
407                                                      vector bool int __b) {
408  return __a + (vector int)__b;
409}
410
411static __inline__ vector unsigned int __ATTRS_o_ai
412vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
413  return __a + __b;
414}
415
416static __inline__ vector unsigned int __ATTRS_o_ai
417vec_vadduwm(vector bool int __a, vector unsigned int __b) {
418  return (vector unsigned int)__a + __b;
419}
420
421static __inline__ vector unsigned int __ATTRS_o_ai
422vec_vadduwm(vector unsigned int __a, vector bool int __b) {
423  return __a + (vector unsigned int)__b;
424}
425
426/* vec_vaddfp */
427
428#define __builtin_altivec_vaddfp vec_vaddfp
429
430static __inline__ vector float __attribute__((__always_inline__))
431vec_vaddfp(vector float __a, vector float __b) {
432  return __a + __b;
433}
434
435/* vec_addc */
436
437static __inline__ vector signed int __ATTRS_o_ai
438vec_addc(vector signed int __a, vector signed int __b) {
439  return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
440                                                      (vector unsigned int)__b);
441}
442
443static __inline__ vector unsigned int __ATTRS_o_ai
444vec_addc(vector unsigned int __a, vector unsigned int __b) {
445  return __builtin_altivec_vaddcuw(__a, __b);
446}
447
448#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
449static __inline__ vector signed __int128 __ATTRS_o_ai
450vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
451  return (vector signed __int128)__builtin_altivec_vaddcuq(
452      (vector unsigned __int128)__a, (vector unsigned __int128)__b);
453}
454
455static __inline__ vector unsigned __int128 __ATTRS_o_ai
456vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
457  return __builtin_altivec_vaddcuq(__a, __b);
458}
459#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
460
461/* vec_vaddcuw */
462
463static __inline__ vector unsigned int __attribute__((__always_inline__))
464vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
465  return __builtin_altivec_vaddcuw(__a, __b);
466}
467
468/* vec_adds */
469
470static __inline__ vector signed char __ATTRS_o_ai
471vec_adds(vector signed char __a, vector signed char __b) {
472  return __builtin_altivec_vaddsbs(__a, __b);
473}
474
475static __inline__ vector signed char __ATTRS_o_ai
476vec_adds(vector bool char __a, vector signed char __b) {
477  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
478}
479
480static __inline__ vector signed char __ATTRS_o_ai
481vec_adds(vector signed char __a, vector bool char __b) {
482  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
483}
484
485static __inline__ vector unsigned char __ATTRS_o_ai
486vec_adds(vector unsigned char __a, vector unsigned char __b) {
487  return __builtin_altivec_vaddubs(__a, __b);
488}
489
490static __inline__ vector unsigned char __ATTRS_o_ai
491vec_adds(vector bool char __a, vector unsigned char __b) {
492  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
493}
494
495static __inline__ vector unsigned char __ATTRS_o_ai
496vec_adds(vector unsigned char __a, vector bool char __b) {
497  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
498}
499
500static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
501                                                     vector short __b) {
502  return __builtin_altivec_vaddshs(__a, __b);
503}
504
505static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
506                                                     vector short __b) {
507  return __builtin_altivec_vaddshs((vector short)__a, __b);
508}
509
510static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
511                                                     vector bool short __b) {
512  return __builtin_altivec_vaddshs(__a, (vector short)__b);
513}
514
515static __inline__ vector unsigned short __ATTRS_o_ai
516vec_adds(vector unsigned short __a, vector unsigned short __b) {
517  return __builtin_altivec_vadduhs(__a, __b);
518}
519
520static __inline__ vector unsigned short __ATTRS_o_ai
521vec_adds(vector bool short __a, vector unsigned short __b) {
522  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
523}
524
525static __inline__ vector unsigned short __ATTRS_o_ai
526vec_adds(vector unsigned short __a, vector bool short __b) {
527  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
528}
529
530static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
531                                                   vector int __b) {
532  return __builtin_altivec_vaddsws(__a, __b);
533}
534
535static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
536                                                   vector int __b) {
537  return __builtin_altivec_vaddsws((vector int)__a, __b);
538}
539
540static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
541                                                   vector bool int __b) {
542  return __builtin_altivec_vaddsws(__a, (vector int)__b);
543}
544
545static __inline__ vector unsigned int __ATTRS_o_ai
546vec_adds(vector unsigned int __a, vector unsigned int __b) {
547  return __builtin_altivec_vadduws(__a, __b);
548}
549
550static __inline__ vector unsigned int __ATTRS_o_ai
551vec_adds(vector bool int __a, vector unsigned int __b) {
552  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
553}
554
555static __inline__ vector unsigned int __ATTRS_o_ai
556vec_adds(vector unsigned int __a, vector bool int __b) {
557  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
558}
559
560/* vec_vaddsbs */
561
562static __inline__ vector signed char __ATTRS_o_ai
563vec_vaddsbs(vector signed char __a, vector signed char __b) {
564  return __builtin_altivec_vaddsbs(__a, __b);
565}
566
567static __inline__ vector signed char __ATTRS_o_ai
568vec_vaddsbs(vector bool char __a, vector signed char __b) {
569  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
570}
571
572static __inline__ vector signed char __ATTRS_o_ai
573vec_vaddsbs(vector signed char __a, vector bool char __b) {
574  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
575}
576
577/* vec_vaddubs */
578
579static __inline__ vector unsigned char __ATTRS_o_ai
580vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
581  return __builtin_altivec_vaddubs(__a, __b);
582}
583
584static __inline__ vector unsigned char __ATTRS_o_ai
585vec_vaddubs(vector bool char __a, vector unsigned char __b) {
586  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
587}
588
589static __inline__ vector unsigned char __ATTRS_o_ai
590vec_vaddubs(vector unsigned char __a, vector bool char __b) {
591  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
592}
593
594/* vec_vaddshs */
595
596static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
597                                                        vector short __b) {
598  return __builtin_altivec_vaddshs(__a, __b);
599}
600
601static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
602                                                        vector short __b) {
603  return __builtin_altivec_vaddshs((vector short)__a, __b);
604}
605
606static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
607                                                        vector bool short __b) {
608  return __builtin_altivec_vaddshs(__a, (vector short)__b);
609}
610
611/* vec_vadduhs */
612
613static __inline__ vector unsigned short __ATTRS_o_ai
614vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
615  return __builtin_altivec_vadduhs(__a, __b);
616}
617
618static __inline__ vector unsigned short __ATTRS_o_ai
619vec_vadduhs(vector bool short __a, vector unsigned short __b) {
620  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
621}
622
623static __inline__ vector unsigned short __ATTRS_o_ai
624vec_vadduhs(vector unsigned short __a, vector bool short __b) {
625  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
626}
627
628/* vec_vaddsws */
629
630static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
631                                                      vector int __b) {
632  return __builtin_altivec_vaddsws(__a, __b);
633}
634
635static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
636                                                      vector int __b) {
637  return __builtin_altivec_vaddsws((vector int)__a, __b);
638}
639
640static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
641                                                      vector bool int __b) {
642  return __builtin_altivec_vaddsws(__a, (vector int)__b);
643}
644
645/* vec_vadduws */
646
647static __inline__ vector unsigned int __ATTRS_o_ai
648vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
649  return __builtin_altivec_vadduws(__a, __b);
650}
651
652static __inline__ vector unsigned int __ATTRS_o_ai
653vec_vadduws(vector bool int __a, vector unsigned int __b) {
654  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
655}
656
657static __inline__ vector unsigned int __ATTRS_o_ai
658vec_vadduws(vector unsigned int __a, vector bool int __b) {
659  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
660}
661
662#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
663/* vec_vadduqm */
664
665static __inline__ vector signed __int128 __ATTRS_o_ai
666vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
667  return __a + __b;
668}
669
670static __inline__ vector unsigned __int128 __ATTRS_o_ai
671vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
672  return __a + __b;
673}
674
675/* vec_vaddeuqm */
676
677static __inline__ vector signed __int128 __ATTRS_o_ai
678vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
679             vector signed __int128 __c) {
680  return __builtin_altivec_vaddeuqm(__a, __b, __c);
681}
682
683static __inline__ vector unsigned __int128 __ATTRS_o_ai
684vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
685             vector unsigned __int128 __c) {
686  return __builtin_altivec_vaddeuqm(__a, __b, __c);
687}
688
689/* vec_vaddcuq */
690
691static __inline__ vector signed __int128 __ATTRS_o_ai
692vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
693  return __builtin_altivec_vaddcuq(__a, __b);
694}
695
696static __inline__ vector unsigned __int128 __ATTRS_o_ai
697vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
698  return __builtin_altivec_vaddcuq(__a, __b);
699}
700
701/* vec_vaddecuq */
702
703static __inline__ vector signed __int128 __ATTRS_o_ai
704vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
705             vector signed __int128 __c) {
706  return __builtin_altivec_vaddecuq(__a, __b, __c);
707}
708
709static __inline__ vector unsigned __int128 __ATTRS_o_ai
710vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
711             vector unsigned __int128 __c) {
712  return __builtin_altivec_vaddecuq(__a, __b, __c);
713}
714#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
715
716/* vec_and */
717
718#define __builtin_altivec_vand vec_and
719
720static __inline__ vector signed char __ATTRS_o_ai
721vec_and(vector signed char __a, vector signed char __b) {
722  return __a & __b;
723}
724
725static __inline__ vector signed char __ATTRS_o_ai
726vec_and(vector bool char __a, vector signed char __b) {
727  return (vector signed char)__a & __b;
728}
729
730static __inline__ vector signed char __ATTRS_o_ai
731vec_and(vector signed char __a, vector bool char __b) {
732  return __a & (vector signed char)__b;
733}
734
735static __inline__ vector unsigned char __ATTRS_o_ai
736vec_and(vector unsigned char __a, vector unsigned char __b) {
737  return __a & __b;
738}
739
740static __inline__ vector unsigned char __ATTRS_o_ai
741vec_and(vector bool char __a, vector unsigned char __b) {
742  return (vector unsigned char)__a & __b;
743}
744
745static __inline__ vector unsigned char __ATTRS_o_ai
746vec_and(vector unsigned char __a, vector bool char __b) {
747  return __a & (vector unsigned char)__b;
748}
749
750static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
751                                                        vector bool char __b) {
752  return __a & __b;
753}
754
755static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
756                                                    vector short __b) {
757  return __a & __b;
758}
759
760static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
761                                                    vector short __b) {
762  return (vector short)__a & __b;
763}
764
765static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
766                                                    vector bool short __b) {
767  return __a & (vector short)__b;
768}
769
770static __inline__ vector unsigned short __ATTRS_o_ai
771vec_and(vector unsigned short __a, vector unsigned short __b) {
772  return __a & __b;
773}
774
775static __inline__ vector unsigned short __ATTRS_o_ai
776vec_and(vector bool short __a, vector unsigned short __b) {
777  return (vector unsigned short)__a & __b;
778}
779
780static __inline__ vector unsigned short __ATTRS_o_ai
781vec_and(vector unsigned short __a, vector bool short __b) {
782  return __a & (vector unsigned short)__b;
783}
784
785static __inline__ vector bool short __ATTRS_o_ai
786vec_and(vector bool short __a, vector bool short __b) {
787  return __a & __b;
788}
789
790static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
791                                                  vector int __b) {
792  return __a & __b;
793}
794
795static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
796                                                  vector int __b) {
797  return (vector int)__a & __b;
798}
799
800static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
801                                                  vector bool int __b) {
802  return __a & (vector int)__b;
803}
804
805static __inline__ vector unsigned int __ATTRS_o_ai
806vec_and(vector unsigned int __a, vector unsigned int __b) {
807  return __a & __b;
808}
809
810static __inline__ vector unsigned int __ATTRS_o_ai
811vec_and(vector bool int __a, vector unsigned int __b) {
812  return (vector unsigned int)__a & __b;
813}
814
815static __inline__ vector unsigned int __ATTRS_o_ai
816vec_and(vector unsigned int __a, vector bool int __b) {
817  return __a & (vector unsigned int)__b;
818}
819
820static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
821                                                       vector bool int __b) {
822  return __a & __b;
823}
824
825static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
826                                                    vector float __b) {
827  vector unsigned int __res =
828      (vector unsigned int)__a & (vector unsigned int)__b;
829  return (vector float)__res;
830}
831
832static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
833                                                    vector float __b) {
834  vector unsigned int __res =
835      (vector unsigned int)__a & (vector unsigned int)__b;
836  return (vector float)__res;
837}
838
839static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
840                                                    vector bool int __b) {
841  vector unsigned int __res =
842      (vector unsigned int)__a & (vector unsigned int)__b;
843  return (vector float)__res;
844}
845
846#ifdef __VSX__
847static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
848                                                     vector double __b) {
849  vector unsigned long long __res =
850      (vector unsigned long long)__a & (vector unsigned long long)__b;
851  return (vector double)__res;
852}
853
854static __inline__ vector double __ATTRS_o_ai
855vec_and(vector double __a, vector bool long long __b) {
856  vector unsigned long long __res =
857      (vector unsigned long long)__a & (vector unsigned long long)__b;
858  return (vector double)__res;
859}
860
861static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
862                                                     vector double __b) {
863  vector unsigned long long __res =
864      (vector unsigned long long)__a & (vector unsigned long long)__b;
865  return (vector double)__res;
866}
867
868static __inline__ vector signed long long __ATTRS_o_ai
869vec_and(vector signed long long __a, vector signed long long __b) {
870  return __a & __b;
871}
872
873static __inline__ vector signed long long __ATTRS_o_ai
874vec_and(vector bool long long __a, vector signed long long __b) {
875  return (vector signed long long)__a & __b;
876}
877
878static __inline__ vector signed long long __ATTRS_o_ai
879vec_and(vector signed long long __a, vector bool long long __b) {
880  return __a & (vector signed long long)__b;
881}
882
883static __inline__ vector unsigned long long __ATTRS_o_ai
884vec_and(vector unsigned long long __a, vector unsigned long long __b) {
885  return __a & __b;
886}
887
888static __inline__ vector unsigned long long __ATTRS_o_ai
889vec_and(vector bool long long __a, vector unsigned long long __b) {
890  return (vector unsigned long long)__a & __b;
891}
892
893static __inline__ vector unsigned long long __ATTRS_o_ai
894vec_and(vector unsigned long long __a, vector bool long long __b) {
895  return __a & (vector unsigned long long)__b;
896}
897
898static __inline__ vector bool long long __ATTRS_o_ai
899vec_and(vector bool long long __a, vector bool long long __b) {
900  return __a & __b;
901}
902#endif
903
904/* vec_vand */
905
906static __inline__ vector signed char __ATTRS_o_ai
907vec_vand(vector signed char __a, vector signed char __b) {
908  return __a & __b;
909}
910
911static __inline__ vector signed char __ATTRS_o_ai
912vec_vand(vector bool char __a, vector signed char __b) {
913  return (vector signed char)__a & __b;
914}
915
916static __inline__ vector signed char __ATTRS_o_ai
917vec_vand(vector signed char __a, vector bool char __b) {
918  return __a & (vector signed char)__b;
919}
920
921static __inline__ vector unsigned char __ATTRS_o_ai
922vec_vand(vector unsigned char __a, vector unsigned char __b) {
923  return __a & __b;
924}
925
926static __inline__ vector unsigned char __ATTRS_o_ai
927vec_vand(vector bool char __a, vector unsigned char __b) {
928  return (vector unsigned char)__a & __b;
929}
930
931static __inline__ vector unsigned char __ATTRS_o_ai
932vec_vand(vector unsigned char __a, vector bool char __b) {
933  return __a & (vector unsigned char)__b;
934}
935
936static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
937                                                         vector bool char __b) {
938  return __a & __b;
939}
940
941static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
942                                                     vector short __b) {
943  return __a & __b;
944}
945
946static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
947                                                     vector short __b) {
948  return (vector short)__a & __b;
949}
950
951static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
952                                                     vector bool short __b) {
953  return __a & (vector short)__b;
954}
955
956static __inline__ vector unsigned short __ATTRS_o_ai
957vec_vand(vector unsigned short __a, vector unsigned short __b) {
958  return __a & __b;
959}
960
961static __inline__ vector unsigned short __ATTRS_o_ai
962vec_vand(vector bool short __a, vector unsigned short __b) {
963  return (vector unsigned short)__a & __b;
964}
965
966static __inline__ vector unsigned short __ATTRS_o_ai
967vec_vand(vector unsigned short __a, vector bool short __b) {
968  return __a & (vector unsigned short)__b;
969}
970
971static __inline__ vector bool short __ATTRS_o_ai
972vec_vand(vector bool short __a, vector bool short __b) {
973  return __a & __b;
974}
975
976static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
977                                                   vector int __b) {
978  return __a & __b;
979}
980
981static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
982                                                   vector int __b) {
983  return (vector int)__a & __b;
984}
985
986static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
987                                                   vector bool int __b) {
988  return __a & (vector int)__b;
989}
990
991static __inline__ vector unsigned int __ATTRS_o_ai
992vec_vand(vector unsigned int __a, vector unsigned int __b) {
993  return __a & __b;
994}
995
996static __inline__ vector unsigned int __ATTRS_o_ai
997vec_vand(vector bool int __a, vector unsigned int __b) {
998  return (vector unsigned int)__a & __b;
999}
1000
1001static __inline__ vector unsigned int __ATTRS_o_ai
1002vec_vand(vector unsigned int __a, vector bool int __b) {
1003  return __a & (vector unsigned int)__b;
1004}
1005
1006static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1007                                                        vector bool int __b) {
1008  return __a & __b;
1009}
1010
1011static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1012                                                     vector float __b) {
1013  vector unsigned int __res =
1014      (vector unsigned int)__a & (vector unsigned int)__b;
1015  return (vector float)__res;
1016}
1017
1018static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1019                                                     vector float __b) {
1020  vector unsigned int __res =
1021      (vector unsigned int)__a & (vector unsigned int)__b;
1022  return (vector float)__res;
1023}
1024
1025static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1026                                                     vector bool int __b) {
1027  vector unsigned int __res =
1028      (vector unsigned int)__a & (vector unsigned int)__b;
1029  return (vector float)__res;
1030}
1031
1032#ifdef __VSX__
1033static __inline__ vector signed long long __ATTRS_o_ai
1034vec_vand(vector signed long long __a, vector signed long long __b) {
1035  return __a & __b;
1036}
1037
1038static __inline__ vector signed long long __ATTRS_o_ai
1039vec_vand(vector bool long long __a, vector signed long long __b) {
1040  return (vector signed long long)__a & __b;
1041}
1042
1043static __inline__ vector signed long long __ATTRS_o_ai
1044vec_vand(vector signed long long __a, vector bool long long __b) {
1045  return __a & (vector signed long long)__b;
1046}
1047
1048static __inline__ vector unsigned long long __ATTRS_o_ai
1049vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1050  return __a & __b;
1051}
1052
1053static __inline__ vector unsigned long long __ATTRS_o_ai
1054vec_vand(vector bool long long __a, vector unsigned long long __b) {
1055  return (vector unsigned long long)__a & __b;
1056}
1057
1058static __inline__ vector unsigned long long __ATTRS_o_ai
1059vec_vand(vector unsigned long long __a, vector bool long long __b) {
1060  return __a & (vector unsigned long long)__b;
1061}
1062
1063static __inline__ vector bool long long __ATTRS_o_ai
1064vec_vand(vector bool long long __a, vector bool long long __b) {
1065  return __a & __b;
1066}
1067#endif
1068
1069/* vec_andc */
1070
1071#define __builtin_altivec_vandc vec_andc
1072
1073static __inline__ vector signed char __ATTRS_o_ai
1074vec_andc(vector signed char __a, vector signed char __b) {
1075  return __a & ~__b;
1076}
1077
1078static __inline__ vector signed char __ATTRS_o_ai
1079vec_andc(vector bool char __a, vector signed char __b) {
1080  return (vector signed char)__a & ~__b;
1081}
1082
1083static __inline__ vector signed char __ATTRS_o_ai
1084vec_andc(vector signed char __a, vector bool char __b) {
1085  return __a & ~(vector signed char)__b;
1086}
1087
1088static __inline__ vector unsigned char __ATTRS_o_ai
1089vec_andc(vector unsigned char __a, vector unsigned char __b) {
1090  return __a & ~__b;
1091}
1092
1093static __inline__ vector unsigned char __ATTRS_o_ai
1094vec_andc(vector bool char __a, vector unsigned char __b) {
1095  return (vector unsigned char)__a & ~__b;
1096}
1097
1098static __inline__ vector unsigned char __ATTRS_o_ai
1099vec_andc(vector unsigned char __a, vector bool char __b) {
1100  return __a & ~(vector unsigned char)__b;
1101}
1102
1103static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1104                                                         vector bool char __b) {
1105  return __a & ~__b;
1106}
1107
1108static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1109                                                     vector short __b) {
1110  return __a & ~__b;
1111}
1112
1113static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1114                                                     vector short __b) {
1115  return (vector short)__a & ~__b;
1116}
1117
1118static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1119                                                     vector bool short __b) {
1120  return __a & ~(vector short)__b;
1121}
1122
1123static __inline__ vector unsigned short __ATTRS_o_ai
1124vec_andc(vector unsigned short __a, vector unsigned short __b) {
1125  return __a & ~__b;
1126}
1127
1128static __inline__ vector unsigned short __ATTRS_o_ai
1129vec_andc(vector bool short __a, vector unsigned short __b) {
1130  return (vector unsigned short)__a & ~__b;
1131}
1132
1133static __inline__ vector unsigned short __ATTRS_o_ai
1134vec_andc(vector unsigned short __a, vector bool short __b) {
1135  return __a & ~(vector unsigned short)__b;
1136}
1137
1138static __inline__ vector bool short __ATTRS_o_ai
1139vec_andc(vector bool short __a, vector bool short __b) {
1140  return __a & ~__b;
1141}
1142
1143static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1144                                                   vector int __b) {
1145  return __a & ~__b;
1146}
1147
1148static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1149                                                   vector int __b) {
1150  return (vector int)__a & ~__b;
1151}
1152
1153static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1154                                                   vector bool int __b) {
1155  return __a & ~(vector int)__b;
1156}
1157
1158static __inline__ vector unsigned int __ATTRS_o_ai
1159vec_andc(vector unsigned int __a, vector unsigned int __b) {
1160  return __a & ~__b;
1161}
1162
1163static __inline__ vector unsigned int __ATTRS_o_ai
1164vec_andc(vector bool int __a, vector unsigned int __b) {
1165  return (vector unsigned int)__a & ~__b;
1166}
1167
1168static __inline__ vector unsigned int __ATTRS_o_ai
1169vec_andc(vector unsigned int __a, vector bool int __b) {
1170  return __a & ~(vector unsigned int)__b;
1171}
1172
1173static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1174                                                        vector bool int __b) {
1175  return __a & ~__b;
1176}
1177
1178static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1179                                                     vector float __b) {
1180  vector unsigned int __res =
1181      (vector unsigned int)__a & ~(vector unsigned int)__b;
1182  return (vector float)__res;
1183}
1184
1185static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1186                                                     vector float __b) {
1187  vector unsigned int __res =
1188      (vector unsigned int)__a & ~(vector unsigned int)__b;
1189  return (vector float)__res;
1190}
1191
1192static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1193                                                     vector bool int __b) {
1194  vector unsigned int __res =
1195      (vector unsigned int)__a & ~(vector unsigned int)__b;
1196  return (vector float)__res;
1197}
1198
1199#ifdef __VSX__
1200static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1201                                                      vector double __b) {
1202  vector unsigned long long __res =
1203      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1204  return (vector double)__res;
1205}
1206
1207static __inline__ vector double __ATTRS_o_ai
1208vec_andc(vector double __a, vector bool long long __b) {
1209  vector unsigned long long __res =
1210      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1211  return (vector double)__res;
1212}
1213
1214static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1215                                                      vector double __b) {
1216  vector unsigned long long __res =
1217      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1218  return (vector double)__res;
1219}
1220
1221static __inline__ vector signed long long __ATTRS_o_ai
1222vec_andc(vector signed long long __a, vector signed long long __b) {
1223  return __a & ~__b;
1224}
1225
1226static __inline__ vector signed long long __ATTRS_o_ai
1227vec_andc(vector bool long long __a, vector signed long long __b) {
1228  return (vector signed long long)__a & ~__b;
1229}
1230
1231static __inline__ vector signed long long __ATTRS_o_ai
1232vec_andc(vector signed long long __a, vector bool long long __b) {
1233  return __a & ~(vector signed long long)__b;
1234}
1235
1236static __inline__ vector unsigned long long __ATTRS_o_ai
1237vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1238  return __a & ~__b;
1239}
1240
1241static __inline__ vector unsigned long long __ATTRS_o_ai
1242vec_andc(vector bool long long __a, vector unsigned long long __b) {
1243  return (vector unsigned long long)__a & ~__b;
1244}
1245
1246static __inline__ vector unsigned long long __ATTRS_o_ai
1247vec_andc(vector unsigned long long __a, vector bool long long __b) {
1248  return __a & ~(vector unsigned long long)__b;
1249}
1250
1251static __inline__ vector bool long long __ATTRS_o_ai
1252vec_andc(vector bool long long __a, vector bool long long __b) {
1253  return __a & ~__b;
1254}
1255#endif
1256
1257/* vec_vandc */
1258
1259static __inline__ vector signed char __ATTRS_o_ai
1260vec_vandc(vector signed char __a, vector signed char __b) {
1261  return __a & ~__b;
1262}
1263
1264static __inline__ vector signed char __ATTRS_o_ai
1265vec_vandc(vector bool char __a, vector signed char __b) {
1266  return (vector signed char)__a & ~__b;
1267}
1268
1269static __inline__ vector signed char __ATTRS_o_ai
1270vec_vandc(vector signed char __a, vector bool char __b) {
1271  return __a & ~(vector signed char)__b;
1272}
1273
1274static __inline__ vector unsigned char __ATTRS_o_ai
1275vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1276  return __a & ~__b;
1277}
1278
1279static __inline__ vector unsigned char __ATTRS_o_ai
1280vec_vandc(vector bool char __a, vector unsigned char __b) {
1281  return (vector unsigned char)__a & ~__b;
1282}
1283
1284static __inline__ vector unsigned char __ATTRS_o_ai
1285vec_vandc(vector unsigned char __a, vector bool char __b) {
1286  return __a & ~(vector unsigned char)__b;
1287}
1288
1289static __inline__ vector bool char __ATTRS_o_ai
1290vec_vandc(vector bool char __a, vector bool char __b) {
1291  return __a & ~__b;
1292}
1293
1294static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1295                                                      vector short __b) {
1296  return __a & ~__b;
1297}
1298
1299static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1300                                                      vector short __b) {
1301  return (vector short)__a & ~__b;
1302}
1303
1304static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1305                                                      vector bool short __b) {
1306  return __a & ~(vector short)__b;
1307}
1308
1309static __inline__ vector unsigned short __ATTRS_o_ai
1310vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1311  return __a & ~__b;
1312}
1313
1314static __inline__ vector unsigned short __ATTRS_o_ai
1315vec_vandc(vector bool short __a, vector unsigned short __b) {
1316  return (vector unsigned short)__a & ~__b;
1317}
1318
1319static __inline__ vector unsigned short __ATTRS_o_ai
1320vec_vandc(vector unsigned short __a, vector bool short __b) {
1321  return __a & ~(vector unsigned short)__b;
1322}
1323
1324static __inline__ vector bool short __ATTRS_o_ai
1325vec_vandc(vector bool short __a, vector bool short __b) {
1326  return __a & ~__b;
1327}
1328
1329static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1330                                                    vector int __b) {
1331  return __a & ~__b;
1332}
1333
1334static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1335                                                    vector int __b) {
1336  return (vector int)__a & ~__b;
1337}
1338
1339static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1340                                                    vector bool int __b) {
1341  return __a & ~(vector int)__b;
1342}
1343
1344static __inline__ vector unsigned int __ATTRS_o_ai
1345vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1346  return __a & ~__b;
1347}
1348
1349static __inline__ vector unsigned int __ATTRS_o_ai
1350vec_vandc(vector bool int __a, vector unsigned int __b) {
1351  return (vector unsigned int)__a & ~__b;
1352}
1353
1354static __inline__ vector unsigned int __ATTRS_o_ai
1355vec_vandc(vector unsigned int __a, vector bool int __b) {
1356  return __a & ~(vector unsigned int)__b;
1357}
1358
1359static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1360                                                         vector bool int __b) {
1361  return __a & ~__b;
1362}
1363
1364static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1365                                                      vector float __b) {
1366  vector unsigned int __res =
1367      (vector unsigned int)__a & ~(vector unsigned int)__b;
1368  return (vector float)__res;
1369}
1370
1371static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1372                                                      vector float __b) {
1373  vector unsigned int __res =
1374      (vector unsigned int)__a & ~(vector unsigned int)__b;
1375  return (vector float)__res;
1376}
1377
1378static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1379                                                      vector bool int __b) {
1380  vector unsigned int __res =
1381      (vector unsigned int)__a & ~(vector unsigned int)__b;
1382  return (vector float)__res;
1383}
1384
1385#ifdef __VSX__
1386static __inline__ vector signed long long __ATTRS_o_ai
1387vec_vandc(vector signed long long __a, vector signed long long __b) {
1388  return __a & ~__b;
1389}
1390
1391static __inline__ vector signed long long __ATTRS_o_ai
1392vec_vandc(vector bool long long __a, vector signed long long __b) {
1393  return (vector signed long long)__a & ~__b;
1394}
1395
1396static __inline__ vector signed long long __ATTRS_o_ai
1397vec_vandc(vector signed long long __a, vector bool long long __b) {
1398  return __a & ~(vector signed long long)__b;
1399}
1400
1401static __inline__ vector unsigned long long __ATTRS_o_ai
1402vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1403  return __a & ~__b;
1404}
1405
1406static __inline__ vector unsigned long long __ATTRS_o_ai
1407vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1408  return (vector unsigned long long)__a & ~__b;
1409}
1410
1411static __inline__ vector unsigned long long __ATTRS_o_ai
1412vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1413  return __a & ~(vector unsigned long long)__b;
1414}
1415
1416static __inline__ vector bool long long __ATTRS_o_ai
1417vec_vandc(vector bool long long __a, vector bool long long __b) {
1418  return __a & ~__b;
1419}
1420#endif
1421
1422/* vec_avg */
1423
1424static __inline__ vector signed char __ATTRS_o_ai
1425vec_avg(vector signed char __a, vector signed char __b) {
1426  return __builtin_altivec_vavgsb(__a, __b);
1427}
1428
1429static __inline__ vector unsigned char __ATTRS_o_ai
1430vec_avg(vector unsigned char __a, vector unsigned char __b) {
1431  return __builtin_altivec_vavgub(__a, __b);
1432}
1433
1434static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1435                                                    vector short __b) {
1436  return __builtin_altivec_vavgsh(__a, __b);
1437}
1438
1439static __inline__ vector unsigned short __ATTRS_o_ai
1440vec_avg(vector unsigned short __a, vector unsigned short __b) {
1441  return __builtin_altivec_vavguh(__a, __b);
1442}
1443
1444static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1445                                                  vector int __b) {
1446  return __builtin_altivec_vavgsw(__a, __b);
1447}
1448
1449static __inline__ vector unsigned int __ATTRS_o_ai
1450vec_avg(vector unsigned int __a, vector unsigned int __b) {
1451  return __builtin_altivec_vavguw(__a, __b);
1452}
1453
1454/* vec_vavgsb */
1455
1456static __inline__ vector signed char __attribute__((__always_inline__))
1457vec_vavgsb(vector signed char __a, vector signed char __b) {
1458  return __builtin_altivec_vavgsb(__a, __b);
1459}
1460
1461/* vec_vavgub */
1462
1463static __inline__ vector unsigned char __attribute__((__always_inline__))
1464vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1465  return __builtin_altivec_vavgub(__a, __b);
1466}
1467
1468/* vec_vavgsh */
1469
1470static __inline__ vector short __attribute__((__always_inline__))
1471vec_vavgsh(vector short __a, vector short __b) {
1472  return __builtin_altivec_vavgsh(__a, __b);
1473}
1474
1475/* vec_vavguh */
1476
1477static __inline__ vector unsigned short __attribute__((__always_inline__))
1478vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1479  return __builtin_altivec_vavguh(__a, __b);
1480}
1481
1482/* vec_vavgsw */
1483
1484static __inline__ vector int __attribute__((__always_inline__))
1485vec_vavgsw(vector int __a, vector int __b) {
1486  return __builtin_altivec_vavgsw(__a, __b);
1487}
1488
1489/* vec_vavguw */
1490
1491static __inline__ vector unsigned int __attribute__((__always_inline__))
1492vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1493  return __builtin_altivec_vavguw(__a, __b);
1494}
1495
1496/* vec_ceil */
1497
1498static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1499#ifdef __VSX__
1500  return __builtin_vsx_xvrspip(__a);
1501#else
1502  return __builtin_altivec_vrfip(__a);
1503#endif
1504}
1505
1506#ifdef __VSX__
1507static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1508  return __builtin_vsx_xvrdpip(__a);
1509}
1510#endif
1511
1512/* vec_vrfip */
1513
1514static __inline__ vector float __attribute__((__always_inline__))
1515vec_vrfip(vector float __a) {
1516  return __builtin_altivec_vrfip(__a);
1517}
1518
1519/* vec_cmpb */
1520
1521static __inline__ vector int __attribute__((__always_inline__))
1522vec_cmpb(vector float __a, vector float __b) {
1523  return __builtin_altivec_vcmpbfp(__a, __b);
1524}
1525
1526/* vec_vcmpbfp */
1527
1528static __inline__ vector int __attribute__((__always_inline__))
1529vec_vcmpbfp(vector float __a, vector float __b) {
1530  return __builtin_altivec_vcmpbfp(__a, __b);
1531}
1532
1533/* vec_cmpeq */
1534
1535static __inline__ vector bool char __ATTRS_o_ai
1536vec_cmpeq(vector signed char __a, vector signed char __b) {
1537  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1538                                                      (vector char)__b);
1539}
1540
1541static __inline__ vector bool char __ATTRS_o_ai
1542vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1543  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1544                                                      (vector char)__b);
1545}
1546
1547static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1548                                                           vector short __b) {
1549  return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1550}
1551
1552static __inline__ vector bool short __ATTRS_o_ai
1553vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1554  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1555                                                       (vector short)__b);
1556}
1557
1558static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1559                                                         vector int __b) {
1560  return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1561}
1562
1563static __inline__ vector bool int __ATTRS_o_ai
1564vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1565  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1566                                                     (vector int)__b);
1567}
1568
1569#ifdef __POWER8_VECTOR__
1570static __inline__ vector bool long long __ATTRS_o_ai
1571vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1572  return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1573}
1574
1575static __inline__ vector bool long long __ATTRS_o_ai
1576vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1577  return (vector bool long long)__builtin_altivec_vcmpequd(
1578      (vector long long)__a, (vector long long)__b);
1579}
1580#endif
1581
1582static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1583                                                         vector float __b) {
1584#ifdef __VSX__
1585  return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1586#else
1587  return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1588#endif
1589}
1590
1591#ifdef __VSX__
1592static __inline__ vector bool long long __ATTRS_o_ai
1593vec_cmpeq(vector double __a, vector double __b) {
1594  return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1595}
1596#endif
1597
1598/* vec_cmpgt */
1599
1600static __inline__ vector bool char __ATTRS_o_ai
1601vec_cmpgt(vector signed char __a, vector signed char __b) {
1602  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1603}
1604
1605static __inline__ vector bool char __ATTRS_o_ai
1606vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1607  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1608}
1609
1610static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1611                                                           vector short __b) {
1612  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1613}
1614
1615static __inline__ vector bool short __ATTRS_o_ai
1616vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1617  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1618}
1619
1620static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1621                                                         vector int __b) {
1622  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1623}
1624
1625static __inline__ vector bool int __ATTRS_o_ai
1626vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1627  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1628}
1629
1630#ifdef __POWER8_VECTOR__
1631static __inline__ vector bool long long __ATTRS_o_ai
1632vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1633  return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1634}
1635
1636static __inline__ vector bool long long __ATTRS_o_ai
1637vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1638  return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1639}
1640#endif
1641
1642static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1643                                                         vector float __b) {
1644#ifdef __VSX__
1645  return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1646#else
1647  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1648#endif
1649}
1650
1651#ifdef __VSX__
1652static __inline__ vector bool long long __ATTRS_o_ai
1653vec_cmpgt(vector double __a, vector double __b) {
1654  return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1655}
1656#endif
1657
1658/* vec_cmpge */
1659
1660static __inline__ vector bool char __ATTRS_o_ai
1661vec_cmpge(vector signed char __a, vector signed char __b) {
1662  return ~(vec_cmpgt(__b, __a));
1663}
1664
1665static __inline__ vector bool char __ATTRS_o_ai
1666vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1667  return ~(vec_cmpgt(__b, __a));
1668}
1669
1670static __inline__ vector bool short __ATTRS_o_ai
1671vec_cmpge(vector signed short __a, vector signed short __b) {
1672  return ~(vec_cmpgt(__b, __a));
1673}
1674
1675static __inline__ vector bool short __ATTRS_o_ai
1676vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1677  return ~(vec_cmpgt(__b, __a));
1678}
1679
1680static __inline__ vector bool int __ATTRS_o_ai
1681vec_cmpge(vector signed int __a, vector signed int __b) {
1682  return ~(vec_cmpgt(__b, __a));
1683}
1684
1685static __inline__ vector bool int __ATTRS_o_ai
1686vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1687  return ~(vec_cmpgt(__b, __a));
1688}
1689
1690static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
1691                                                         vector float __b) {
1692#ifdef __VSX__
1693  return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
1694#else
1695  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1696#endif
1697}
1698
1699#ifdef __VSX__
1700static __inline__ vector bool long long __ATTRS_o_ai
1701vec_cmpge(vector double __a, vector double __b) {
1702  return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
1703}
1704#endif
1705
1706#ifdef __POWER8_VECTOR__
1707static __inline__ vector bool long long __ATTRS_o_ai
1708vec_cmpge(vector signed long long __a, vector signed long long __b) {
1709  return ~(vec_cmpgt(__b, __a));
1710}
1711
1712static __inline__ vector bool long long __ATTRS_o_ai
1713vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1714  return ~(vec_cmpgt(__b, __a));
1715}
1716#endif
1717
1718/* vec_vcmpgefp */
1719
1720static __inline__ vector bool int __attribute__((__always_inline__))
1721vec_vcmpgefp(vector float __a, vector float __b) {
1722  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1723}
1724
1725/* vec_vcmpgtsb */
1726
1727static __inline__ vector bool char __attribute__((__always_inline__))
1728vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
1729  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1730}
1731
1732/* vec_vcmpgtub */
1733
1734static __inline__ vector bool char __attribute__((__always_inline__))
1735vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
1736  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1737}
1738
1739/* vec_vcmpgtsh */
1740
1741static __inline__ vector bool short __attribute__((__always_inline__))
1742vec_vcmpgtsh(vector short __a, vector short __b) {
1743  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1744}
1745
1746/* vec_vcmpgtuh */
1747
1748static __inline__ vector bool short __attribute__((__always_inline__))
1749vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
1750  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1751}
1752
1753/* vec_vcmpgtsw */
1754
1755static __inline__ vector bool int __attribute__((__always_inline__))
1756vec_vcmpgtsw(vector int __a, vector int __b) {
1757  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1758}
1759
1760/* vec_vcmpgtuw */
1761
1762static __inline__ vector bool int __attribute__((__always_inline__))
1763vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
1764  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1765}
1766
1767/* vec_vcmpgtfp */
1768
1769static __inline__ vector bool int __attribute__((__always_inline__))
1770vec_vcmpgtfp(vector float __a, vector float __b) {
1771  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1772}
1773
1774/* vec_cmple */
1775
1776static __inline__ vector bool char __ATTRS_o_ai
1777vec_cmple(vector signed char __a, vector signed char __b) {
1778  return vec_cmpge(__b, __a);
1779}
1780
1781static __inline__ vector bool char __ATTRS_o_ai
1782vec_cmple(vector unsigned char __a, vector unsigned char __b) {
1783  return vec_cmpge(__b, __a);
1784}
1785
1786static __inline__ vector bool short __ATTRS_o_ai
1787vec_cmple(vector signed short __a, vector signed short __b) {
1788  return vec_cmpge(__b, __a);
1789}
1790
1791static __inline__ vector bool short __ATTRS_o_ai
1792vec_cmple(vector unsigned short __a, vector unsigned short __b) {
1793  return vec_cmpge(__b, __a);
1794}
1795
1796static __inline__ vector bool int __ATTRS_o_ai
1797vec_cmple(vector signed int __a, vector signed int __b) {
1798  return vec_cmpge(__b, __a);
1799}
1800
1801static __inline__ vector bool int __ATTRS_o_ai
1802vec_cmple(vector unsigned int __a, vector unsigned int __b) {
1803  return vec_cmpge(__b, __a);
1804}
1805
1806static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
1807                                                         vector float __b) {
1808  return vec_cmpge(__b, __a);
1809}
1810
1811#ifdef __VSX__
1812static __inline__ vector bool long long __ATTRS_o_ai
1813vec_cmple(vector double __a, vector double __b) {
1814  return vec_cmpge(__b, __a);
1815}
1816#endif
1817
1818#ifdef __POWER8_VECTOR__
1819static __inline__ vector bool long long __ATTRS_o_ai
1820vec_cmple(vector signed long long __a, vector signed long long __b) {
1821  return vec_cmpge(__b, __a);
1822}
1823
1824static __inline__ vector bool long long __ATTRS_o_ai
1825vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
1826  return vec_cmpge(__b, __a);
1827}
1828#endif
1829
1830/* vec_cmplt */
1831
1832static __inline__ vector bool char __ATTRS_o_ai
1833vec_cmplt(vector signed char __a, vector signed char __b) {
1834  return vec_cmpgt(__b, __a);
1835}
1836
1837static __inline__ vector bool char __ATTRS_o_ai
1838vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
1839  return vec_cmpgt(__b, __a);
1840}
1841
1842static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
1843                                                           vector short __b) {
1844  return vec_cmpgt(__b, __a);
1845}
1846
1847static __inline__ vector bool short __ATTRS_o_ai
1848vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
1849  return vec_cmpgt(__b, __a);
1850}
1851
1852static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
1853                                                         vector int __b) {
1854  return vec_cmpgt(__b, __a);
1855}
1856
1857static __inline__ vector bool int __ATTRS_o_ai
1858vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
1859  return vec_cmpgt(__b, __a);
1860}
1861
1862static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
1863                                                         vector float __b) {
1864  return vec_cmpgt(__b, __a);
1865}
1866
1867#ifdef __VSX__
1868static __inline__ vector bool long long __ATTRS_o_ai
1869vec_cmplt(vector double __a, vector double __b) {
1870  return vec_cmpgt(__b, __a);
1871}
1872#endif
1873
1874#ifdef __POWER8_VECTOR__
1875static __inline__ vector bool long long __ATTRS_o_ai
1876vec_cmplt(vector signed long long __a, vector signed long long __b) {
1877  return vec_cmpgt(__b, __a);
1878}
1879
1880static __inline__ vector bool long long __ATTRS_o_ai
1881vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
1882  return vec_cmpgt(__b, __a);
1883}
1884
1885/* vec_cntlz */
1886
1887static __inline__ vector signed char __ATTRS_o_ai
1888vec_cntlz(vector signed char __a) {
1889  return __builtin_altivec_vclzb(__a);
1890}
1891static __inline__ vector unsigned char __ATTRS_o_ai
1892vec_cntlz(vector unsigned char __a) {
1893  return __builtin_altivec_vclzb(__a);
1894}
1895static __inline__ vector signed short __ATTRS_o_ai
1896vec_cntlz(vector signed short __a) {
1897  return __builtin_altivec_vclzh(__a);
1898}
1899static __inline__ vector unsigned short __ATTRS_o_ai
1900vec_cntlz(vector unsigned short __a) {
1901  return __builtin_altivec_vclzh(__a);
1902}
1903static __inline__ vector signed int __ATTRS_o_ai
1904vec_cntlz(vector signed int __a) {
1905  return __builtin_altivec_vclzw(__a);
1906}
1907static __inline__ vector unsigned int __ATTRS_o_ai
1908vec_cntlz(vector unsigned int __a) {
1909  return __builtin_altivec_vclzw(__a);
1910}
1911static __inline__ vector signed long long __ATTRS_o_ai
1912vec_cntlz(vector signed long long __a) {
1913  return __builtin_altivec_vclzd(__a);
1914}
1915static __inline__ vector unsigned long long __ATTRS_o_ai
1916vec_cntlz(vector unsigned long long __a) {
1917  return __builtin_altivec_vclzd(__a);
1918}
1919#endif
1920
1921/* vec_cpsgn */
1922
1923#ifdef __VSX__
1924static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
1925                                                      vector float __b) {
1926  return __builtin_vsx_xvcpsgnsp(__a, __b);
1927}
1928
1929static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
1930                                                       vector double __b) {
1931  return __builtin_vsx_xvcpsgndp(__a, __b);
1932}
1933#endif
1934
1935/* vec_ctf */
1936
1937static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
1938  return __builtin_altivec_vcfsx(__a, __b);
1939}
1940
1941static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a,
1942                                                    int __b) {
1943  return __builtin_altivec_vcfux((vector int)__a, __b);
1944}
1945
1946#ifdef __VSX__
1947static __inline__ vector double __ATTRS_o_ai
1948vec_ctf(vector unsigned long long __a, int __b) {
1949  vector double __ret = __builtin_convertvector(__a, vector double);
1950  __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1951  return __ret;
1952}
1953
1954static __inline__ vector double __ATTRS_o_ai
1955vec_ctf(vector signed long long __a, int __b) {
1956  vector double __ret = __builtin_convertvector(__a, vector double);
1957  __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1958  return __ret;
1959}
1960#endif
1961
1962/* vec_vcfsx */
1963
1964static __inline__ vector float __attribute__((__always_inline__))
1965vec_vcfsx(vector int __a, int __b) {
1966  return __builtin_altivec_vcfsx(__a, __b);
1967}
1968
1969/* vec_vcfux */
1970
1971static __inline__ vector float __attribute__((__always_inline__))
1972vec_vcfux(vector unsigned int __a, int __b) {
1973  return __builtin_altivec_vcfux((vector int)__a, __b);
1974}
1975
1976/* vec_cts */
1977
1978static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) {
1979  return __builtin_altivec_vctsxs(__a, __b);
1980}
1981
1982#ifdef __VSX__
1983static __inline__ vector signed long long __ATTRS_o_ai
1984vec_cts(vector double __a, int __b) {
1985  __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
1986  return __builtin_convertvector(__a, vector signed long long);
1987}
1988#endif
1989
1990/* vec_vctsxs */
1991
1992static __inline__ vector int __attribute__((__always_inline__))
1993vec_vctsxs(vector float __a, int __b) {
1994  return __builtin_altivec_vctsxs(__a, __b);
1995}
1996
1997/* vec_ctu */
1998
1999static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a,
2000                                                           int __b) {
2001  return __builtin_altivec_vctuxs(__a, __b);
2002}
2003
2004#ifdef __VSX__
2005static __inline__ vector unsigned long long __ATTRS_o_ai
2006vec_ctu(vector double __a, int __b) {
2007  __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2008  return __builtin_convertvector(__a, vector unsigned long long);
2009}
2010#endif
2011
2012/* vec_vctuxs */
2013
2014static __inline__ vector unsigned int __attribute__((__always_inline__))
2015vec_vctuxs(vector float __a, int __b) {
2016  return __builtin_altivec_vctuxs(__a, __b);
2017}
2018
2019/* vec_double */
2020
2021#ifdef __VSX__
2022static __inline__ vector double __ATTRS_o_ai
2023vec_double(vector signed long long __a) {
2024  vector double __ret = {__a[0], __a[1]};
2025  return __ret;
2026}
2027
2028static __inline__ vector double __ATTRS_o_ai
2029vec_double(vector unsigned long long __a) {
2030  vector double __ret = {__a[0], __a[1]};
2031  return __ret;
2032}
2033#endif
2034
2035/* vec_div */
2036
2037/* Integer vector divides (vectors are scalarized, elements divided
2038   and the vectors reassembled).
2039*/
2040static __inline__ vector signed char __ATTRS_o_ai
2041vec_div(vector signed char __a, vector signed char __b) {
2042  return __a / __b;
2043}
2044
2045static __inline__ vector unsigned char __ATTRS_o_ai
2046vec_div(vector unsigned char __a, vector unsigned char __b) {
2047  return __a / __b;
2048}
2049
2050static __inline__ vector signed short __ATTRS_o_ai
2051vec_div(vector signed short __a, vector signed short __b) {
2052  return __a / __b;
2053}
2054
2055static __inline__ vector unsigned short __ATTRS_o_ai
2056vec_div(vector unsigned short __a, vector unsigned short __b) {
2057  return __a / __b;
2058}
2059
2060static __inline__ vector signed int __ATTRS_o_ai
2061vec_div(vector signed int __a, vector signed int __b) {
2062  return __a / __b;
2063}
2064
2065static __inline__ vector unsigned int __ATTRS_o_ai
2066vec_div(vector unsigned int __a, vector unsigned int __b) {
2067  return __a / __b;
2068}
2069
2070#ifdef __VSX__
2071static __inline__ vector signed long long __ATTRS_o_ai
2072vec_div(vector signed long long __a, vector signed long long __b) {
2073  return __a / __b;
2074}
2075
2076static __inline__ vector unsigned long long __ATTRS_o_ai
2077vec_div(vector unsigned long long __a, vector unsigned long long __b) {
2078  return __a / __b;
2079}
2080
2081static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
2082                                                    vector float __b) {
2083  return __a / __b;
2084}
2085
2086static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
2087                                                     vector double __b) {
2088  return __a / __b;
2089}
2090#endif
2091
2092/* vec_dss */
2093
2094static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
2095  __builtin_altivec_dss(__a);
2096}
2097
2098/* vec_dssall */
2099
2100static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
2101  __builtin_altivec_dssall();
2102}
2103
2104/* vec_dst */
2105#define vec_dst(__PTR, __CW, __STR) \
2106  __extension__(                    \
2107      { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
2108
2109/* vec_dstst */
2110#define vec_dstst(__PTR, __CW, __STR) \
2111  __extension__(                      \
2112      { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
2113
2114/* vec_dststt */
2115#define vec_dststt(__PTR, __CW, __STR) \
2116  __extension__(                       \
2117      { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
2118
2119/* vec_dstt */
2120#define vec_dstt(__PTR, __CW, __STR) \
2121  __extension__(                     \
2122      { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
2123
2124/* vec_eqv */
2125
2126#ifdef __POWER8_VECTOR__
2127static __inline__ vector signed char __ATTRS_o_ai
2128vec_eqv(vector signed char __a, vector signed char __b) {
2129  return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2130                                                  (vector unsigned int)__b);
2131}
2132
2133static __inline__ vector unsigned char __ATTRS_o_ai
2134vec_eqv(vector unsigned char __a, vector unsigned char __b) {
2135  return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2136                                                    (vector unsigned int)__b);
2137}
2138
2139static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
2140                                                        vector bool char __b) {
2141  return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2142                                                (vector unsigned int)__b);
2143}
2144
2145static __inline__ vector signed short __ATTRS_o_ai
2146vec_eqv(vector signed short __a, vector signed short __b) {
2147  return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2148                                                   (vector unsigned int)__b);
2149}
2150
2151static __inline__ vector unsigned short __ATTRS_o_ai
2152vec_eqv(vector unsigned short __a, vector unsigned short __b) {
2153  return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2154                                                     (vector unsigned int)__b);
2155}
2156
2157static __inline__ vector bool short __ATTRS_o_ai
2158vec_eqv(vector bool short __a, vector bool short __b) {
2159  return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2160                                                 (vector unsigned int)__b);
2161}
2162
2163static __inline__ vector signed int __ATTRS_o_ai
2164vec_eqv(vector signed int __a, vector signed int __b) {
2165  return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2166                                                 (vector unsigned int)__b);
2167}
2168
2169static __inline__ vector unsigned int __ATTRS_o_ai
2170vec_eqv(vector unsigned int __a, vector unsigned int __b) {
2171  return __builtin_vsx_xxleqv(__a, __b);
2172}
2173
2174static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
2175                                                       vector bool int __b) {
2176  return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2177                                               (vector unsigned int)__b);
2178}
2179
2180static __inline__ vector signed long long __ATTRS_o_ai
2181vec_eqv(vector signed long long __a, vector signed long long __b) {
2182  return (vector signed long long)__builtin_vsx_xxleqv(
2183      (vector unsigned int)__a, (vector unsigned int)__b);
2184}
2185
2186static __inline__ vector unsigned long long __ATTRS_o_ai
2187vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
2188  return (vector unsigned long long)__builtin_vsx_xxleqv(
2189      (vector unsigned int)__a, (vector unsigned int)__b);
2190}
2191
2192static __inline__ vector bool long long __ATTRS_o_ai
2193vec_eqv(vector bool long long __a, vector bool long long __b) {
2194  return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
2195                                                     (vector unsigned int)__b);
2196}
2197
2198static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
2199                                                    vector float __b) {
2200  return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
2201                                            (vector unsigned int)__b);
2202}
2203
2204static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
2205                                                     vector double __b) {
2206  return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
2207                                             (vector unsigned int)__b);
2208}
2209#endif
2210
2211/* vec_expte */
2212
2213static __inline__ vector float __attribute__((__always_inline__))
2214vec_expte(vector float __a) {
2215  return __builtin_altivec_vexptefp(__a);
2216}
2217
2218/* vec_vexptefp */
2219
2220static __inline__ vector float __attribute__((__always_inline__))
2221vec_vexptefp(vector float __a) {
2222  return __builtin_altivec_vexptefp(__a);
2223}
2224
2225/* vec_floor */
2226
2227static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
2228#ifdef __VSX__
2229  return __builtin_vsx_xvrspim(__a);
2230#else
2231  return __builtin_altivec_vrfim(__a);
2232#endif
2233}
2234
2235#ifdef __VSX__
2236static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
2237  return __builtin_vsx_xvrdpim(__a);
2238}
2239#endif
2240
2241/* vec_vrfim */
2242
2243static __inline__ vector float __attribute__((__always_inline__))
2244vec_vrfim(vector float __a) {
2245  return __builtin_altivec_vrfim(__a);
2246}
2247
2248/* vec_ld */
2249
2250static __inline__ vector signed char __ATTRS_o_ai
2251vec_ld(int __a, const vector signed char *__b) {
2252  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2253}
2254
2255static __inline__ vector signed char __ATTRS_o_ai
2256vec_ld(int __a, const signed char *__b) {
2257  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2258}
2259
2260static __inline__ vector unsigned char __ATTRS_o_ai
2261vec_ld(int __a, const vector unsigned char *__b) {
2262  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2263}
2264
2265static __inline__ vector unsigned char __ATTRS_o_ai
2266vec_ld(int __a, const unsigned char *__b) {
2267  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2268}
2269
2270static __inline__ vector bool char __ATTRS_o_ai
2271vec_ld(int __a, const vector bool char *__b) {
2272  return (vector bool char)__builtin_altivec_lvx(__a, __b);
2273}
2274
2275static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
2276                                                   const vector short *__b) {
2277  return (vector short)__builtin_altivec_lvx(__a, __b);
2278}
2279
2280static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
2281  return (vector short)__builtin_altivec_lvx(__a, __b);
2282}
2283
2284static __inline__ vector unsigned short __ATTRS_o_ai
2285vec_ld(int __a, const vector unsigned short *__b) {
2286  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2287}
2288
2289static __inline__ vector unsigned short __ATTRS_o_ai
2290vec_ld(int __a, const unsigned short *__b) {
2291  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2292}
2293
2294static __inline__ vector bool short __ATTRS_o_ai
2295vec_ld(int __a, const vector bool short *__b) {
2296  return (vector bool short)__builtin_altivec_lvx(__a, __b);
2297}
2298
2299static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
2300                                                   const vector pixel *__b) {
2301  return (vector pixel)__builtin_altivec_lvx(__a, __b);
2302}
2303
2304static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
2305                                                 const vector int *__b) {
2306  return (vector int)__builtin_altivec_lvx(__a, __b);
2307}
2308
2309static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
2310  return (vector int)__builtin_altivec_lvx(__a, __b);
2311}
2312
2313static __inline__ vector unsigned int __ATTRS_o_ai
2314vec_ld(int __a, const vector unsigned int *__b) {
2315  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2316}
2317
2318static __inline__ vector unsigned int __ATTRS_o_ai
2319vec_ld(int __a, const unsigned int *__b) {
2320  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2321}
2322
2323static __inline__ vector bool int __ATTRS_o_ai
2324vec_ld(int __a, const vector bool int *__b) {
2325  return (vector bool int)__builtin_altivec_lvx(__a, __b);
2326}
2327
2328static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
2329                                                   const vector float *__b) {
2330  return (vector float)__builtin_altivec_lvx(__a, __b);
2331}
2332
2333static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
2334  return (vector float)__builtin_altivec_lvx(__a, __b);
2335}
2336
2337/* vec_lvx */
2338
2339static __inline__ vector signed char __ATTRS_o_ai
2340vec_lvx(int __a, const vector signed char *__b) {
2341  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2342}
2343
2344static __inline__ vector signed char __ATTRS_o_ai
2345vec_lvx(int __a, const signed char *__b) {
2346  return (vector signed char)__builtin_altivec_lvx(__a, __b);
2347}
2348
2349static __inline__ vector unsigned char __ATTRS_o_ai
2350vec_lvx(int __a, const vector unsigned char *__b) {
2351  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2352}
2353
2354static __inline__ vector unsigned char __ATTRS_o_ai
2355vec_lvx(int __a, const unsigned char *__b) {
2356  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2357}
2358
2359static __inline__ vector bool char __ATTRS_o_ai
2360vec_lvx(int __a, const vector bool char *__b) {
2361  return (vector bool char)__builtin_altivec_lvx(__a, __b);
2362}
2363
2364static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
2365                                                    const vector short *__b) {
2366  return (vector short)__builtin_altivec_lvx(__a, __b);
2367}
2368
2369static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
2370  return (vector short)__builtin_altivec_lvx(__a, __b);
2371}
2372
2373static __inline__ vector unsigned short __ATTRS_o_ai
2374vec_lvx(int __a, const vector unsigned short *__b) {
2375  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2376}
2377
2378static __inline__ vector unsigned short __ATTRS_o_ai
2379vec_lvx(int __a, const unsigned short *__b) {
2380  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2381}
2382
2383static __inline__ vector bool short __ATTRS_o_ai
2384vec_lvx(int __a, const vector bool short *__b) {
2385  return (vector bool short)__builtin_altivec_lvx(__a, __b);
2386}
2387
2388static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
2389                                                    const vector pixel *__b) {
2390  return (vector pixel)__builtin_altivec_lvx(__a, __b);
2391}
2392
2393static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
2394                                                  const vector int *__b) {
2395  return (vector int)__builtin_altivec_lvx(__a, __b);
2396}
2397
2398static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
2399  return (vector int)__builtin_altivec_lvx(__a, __b);
2400}
2401
2402static __inline__ vector unsigned int __ATTRS_o_ai
2403vec_lvx(int __a, const vector unsigned int *__b) {
2404  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2405}
2406
2407static __inline__ vector unsigned int __ATTRS_o_ai
2408vec_lvx(int __a, const unsigned int *__b) {
2409  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2410}
2411
2412static __inline__ vector bool int __ATTRS_o_ai
2413vec_lvx(int __a, const vector bool int *__b) {
2414  return (vector bool int)__builtin_altivec_lvx(__a, __b);
2415}
2416
2417static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
2418                                                    const vector float *__b) {
2419  return (vector float)__builtin_altivec_lvx(__a, __b);
2420}
2421
2422static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
2423  return (vector float)__builtin_altivec_lvx(__a, __b);
2424}
2425
2426/* vec_lde */
2427
2428static __inline__ vector signed char __ATTRS_o_ai
2429vec_lde(int __a, const signed char *__b) {
2430  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2431}
2432
2433static __inline__ vector unsigned char __ATTRS_o_ai
2434vec_lde(int __a, const unsigned char *__b) {
2435  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2436}
2437
2438static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
2439  return (vector short)__builtin_altivec_lvehx(__a, __b);
2440}
2441
2442static __inline__ vector unsigned short __ATTRS_o_ai
2443vec_lde(int __a, const unsigned short *__b) {
2444  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2445}
2446
2447static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
2448  return (vector int)__builtin_altivec_lvewx(__a, __b);
2449}
2450
2451static __inline__ vector unsigned int __ATTRS_o_ai
2452vec_lde(int __a, const unsigned int *__b) {
2453  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2454}
2455
2456static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
2457  return (vector float)__builtin_altivec_lvewx(__a, __b);
2458}
2459
2460/* vec_lvebx */
2461
2462static __inline__ vector signed char __ATTRS_o_ai
2463vec_lvebx(int __a, const signed char *__b) {
2464  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2465}
2466
2467static __inline__ vector unsigned char __ATTRS_o_ai
2468vec_lvebx(int __a, const unsigned char *__b) {
2469  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2470}
2471
2472/* vec_lvehx */
2473
2474static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
2475                                                      const short *__b) {
2476  return (vector short)__builtin_altivec_lvehx(__a, __b);
2477}
2478
2479static __inline__ vector unsigned short __ATTRS_o_ai
2480vec_lvehx(int __a, const unsigned short *__b) {
2481  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2482}
2483
2484/* vec_lvewx */
2485
2486static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
2487  return (vector int)__builtin_altivec_lvewx(__a, __b);
2488}
2489
2490static __inline__ vector unsigned int __ATTRS_o_ai
2491vec_lvewx(int __a, const unsigned int *__b) {
2492  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2493}
2494
2495static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
2496                                                      const float *__b) {
2497  return (vector float)__builtin_altivec_lvewx(__a, __b);
2498}
2499
2500/* vec_ldl */
2501
2502static __inline__ vector signed char __ATTRS_o_ai
2503vec_ldl(int __a, const vector signed char *__b) {
2504  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2505}
2506
2507static __inline__ vector signed char __ATTRS_o_ai
2508vec_ldl(int __a, const signed char *__b) {
2509  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2510}
2511
2512static __inline__ vector unsigned char __ATTRS_o_ai
2513vec_ldl(int __a, const vector unsigned char *__b) {
2514  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2515}
2516
2517static __inline__ vector unsigned char __ATTRS_o_ai
2518vec_ldl(int __a, const unsigned char *__b) {
2519  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2520}
2521
2522static __inline__ vector bool char __ATTRS_o_ai
2523vec_ldl(int __a, const vector bool char *__b) {
2524  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2525}
2526
2527static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
2528                                                    const vector short *__b) {
2529  return (vector short)__builtin_altivec_lvxl(__a, __b);
2530}
2531
2532static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
2533  return (vector short)__builtin_altivec_lvxl(__a, __b);
2534}
2535
2536static __inline__ vector unsigned short __ATTRS_o_ai
2537vec_ldl(int __a, const vector unsigned short *__b) {
2538  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2539}
2540
2541static __inline__ vector unsigned short __ATTRS_o_ai
2542vec_ldl(int __a, const unsigned short *__b) {
2543  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2544}
2545
2546static __inline__ vector bool short __ATTRS_o_ai
2547vec_ldl(int __a, const vector bool short *__b) {
2548  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2549}
2550
2551static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
2552                                                    const vector pixel *__b) {
2553  return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
2554}
2555
2556static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
2557                                                  const vector int *__b) {
2558  return (vector int)__builtin_altivec_lvxl(__a, __b);
2559}
2560
2561static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
2562  return (vector int)__builtin_altivec_lvxl(__a, __b);
2563}
2564
2565static __inline__ vector unsigned int __ATTRS_o_ai
2566vec_ldl(int __a, const vector unsigned int *__b) {
2567  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2568}
2569
2570static __inline__ vector unsigned int __ATTRS_o_ai
2571vec_ldl(int __a, const unsigned int *__b) {
2572  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2573}
2574
2575static __inline__ vector bool int __ATTRS_o_ai
2576vec_ldl(int __a, const vector bool int *__b) {
2577  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2578}
2579
2580static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
2581                                                    const vector float *__b) {
2582  return (vector float)__builtin_altivec_lvxl(__a, __b);
2583}
2584
2585static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
2586  return (vector float)__builtin_altivec_lvxl(__a, __b);
2587}
2588
2589/* vec_lvxl */
2590
2591static __inline__ vector signed char __ATTRS_o_ai
2592vec_lvxl(int __a, const vector signed char *__b) {
2593  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2594}
2595
2596static __inline__ vector signed char __ATTRS_o_ai
2597vec_lvxl(int __a, const signed char *__b) {
2598  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2599}
2600
2601static __inline__ vector unsigned char __ATTRS_o_ai
2602vec_lvxl(int __a, const vector unsigned char *__b) {
2603  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2604}
2605
2606static __inline__ vector unsigned char __ATTRS_o_ai
2607vec_lvxl(int __a, const unsigned char *__b) {
2608  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2609}
2610
2611static __inline__ vector bool char __ATTRS_o_ai
2612vec_lvxl(int __a, const vector bool char *__b) {
2613  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2614}
2615
2616static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
2617                                                     const vector short *__b) {
2618  return (vector short)__builtin_altivec_lvxl(__a, __b);
2619}
2620
2621static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
2622                                                     const short *__b) {
2623  return (vector short)__builtin_altivec_lvxl(__a, __b);
2624}
2625
2626static __inline__ vector unsigned short __ATTRS_o_ai
2627vec_lvxl(int __a, const vector unsigned short *__b) {
2628  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2629}
2630
2631static __inline__ vector unsigned short __ATTRS_o_ai
2632vec_lvxl(int __a, const unsigned short *__b) {
2633  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2634}
2635
2636static __inline__ vector bool short __ATTRS_o_ai
2637vec_lvxl(int __a, const vector bool short *__b) {
2638  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2639}
2640
2641static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
2642                                                     const vector pixel *__b) {
2643  return (vector pixel)__builtin_altivec_lvxl(__a, __b);
2644}
2645
2646static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
2647                                                   const vector int *__b) {
2648  return (vector int)__builtin_altivec_lvxl(__a, __b);
2649}
2650
2651static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
2652  return (vector int)__builtin_altivec_lvxl(__a, __b);
2653}
2654
2655static __inline__ vector unsigned int __ATTRS_o_ai
2656vec_lvxl(int __a, const vector unsigned int *__b) {
2657  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2658}
2659
2660static __inline__ vector unsigned int __ATTRS_o_ai
2661vec_lvxl(int __a, const unsigned int *__b) {
2662  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2663}
2664
2665static __inline__ vector bool int __ATTRS_o_ai
2666vec_lvxl(int __a, const vector bool int *__b) {
2667  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2668}
2669
2670static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
2671                                                     const vector float *__b) {
2672  return (vector float)__builtin_altivec_lvxl(__a, __b);
2673}
2674
2675static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
2676                                                     const float *__b) {
2677  return (vector float)__builtin_altivec_lvxl(__a, __b);
2678}
2679
2680/* vec_loge */
2681
2682static __inline__ vector float __attribute__((__always_inline__))
2683vec_loge(vector float __a) {
2684  return __builtin_altivec_vlogefp(__a);
2685}
2686
2687/* vec_vlogefp */
2688
2689static __inline__ vector float __attribute__((__always_inline__))
2690vec_vlogefp(vector float __a) {
2691  return __builtin_altivec_vlogefp(__a);
2692}
2693
2694/* vec_lvsl */
2695
2696#ifdef __LITTLE_ENDIAN__
2697static __inline__ vector unsigned char __ATTRS_o_ai
2698    __attribute__((__deprecated__("use assignment for unaligned little endian \
2699loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2700  vector unsigned char mask =
2701      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2702  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2703                                  7,  6,  5,  4,  3,  2,  1, 0};
2704  return vec_perm(mask, mask, reverse);
2705}
2706#else
2707static __inline__ vector unsigned char __ATTRS_o_ai
2708vec_lvsl(int __a, const signed char *__b) {
2709  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2710}
2711#endif
2712
2713#ifdef __LITTLE_ENDIAN__
2714static __inline__ vector unsigned char __ATTRS_o_ai
2715    __attribute__((__deprecated__("use assignment for unaligned little endian \
2716loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
2717  vector unsigned char mask =
2718      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2719  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2720                                  7,  6,  5,  4,  3,  2,  1, 0};
2721  return vec_perm(mask, mask, reverse);
2722}
2723#else
2724static __inline__ vector unsigned char __ATTRS_o_ai
2725vec_lvsl(int __a, const unsigned char *__b) {
2726  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2727}
2728#endif
2729
2730#ifdef __LITTLE_ENDIAN__
2731static __inline__ vector unsigned char __ATTRS_o_ai
2732    __attribute__((__deprecated__("use assignment for unaligned little endian \
2733loads/stores"))) vec_lvsl(int __a, const short *__b) {
2734  vector unsigned char mask =
2735      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2736  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2737                                  7,  6,  5,  4,  3,  2,  1, 0};
2738  return vec_perm(mask, mask, reverse);
2739}
2740#else
2741static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2742                                                             const short *__b) {
2743  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2744}
2745#endif
2746
2747#ifdef __LITTLE_ENDIAN__
2748static __inline__ vector unsigned char __ATTRS_o_ai
2749    __attribute__((__deprecated__("use assignment for unaligned little endian \
2750loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
2751  vector unsigned char mask =
2752      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2753  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2754                                  7,  6,  5,  4,  3,  2,  1, 0};
2755  return vec_perm(mask, mask, reverse);
2756}
2757#else
2758static __inline__ vector unsigned char __ATTRS_o_ai
2759vec_lvsl(int __a, const unsigned short *__b) {
2760  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2761}
2762#endif
2763
2764#ifdef __LITTLE_ENDIAN__
2765static __inline__ vector unsigned char __ATTRS_o_ai
2766    __attribute__((__deprecated__("use assignment for unaligned little endian \
2767loads/stores"))) vec_lvsl(int __a, const int *__b) {
2768  vector unsigned char mask =
2769      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2770  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2771                                  7,  6,  5,  4,  3,  2,  1, 0};
2772  return vec_perm(mask, mask, reverse);
2773}
2774#else
2775static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2776                                                             const int *__b) {
2777  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2778}
2779#endif
2780
2781#ifdef __LITTLE_ENDIAN__
2782static __inline__ vector unsigned char __ATTRS_o_ai
2783    __attribute__((__deprecated__("use assignment for unaligned little endian \
2784loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
2785  vector unsigned char mask =
2786      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2787  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2788                                  7,  6,  5,  4,  3,  2,  1, 0};
2789  return vec_perm(mask, mask, reverse);
2790}
2791#else
2792static __inline__ vector unsigned char __ATTRS_o_ai
2793vec_lvsl(int __a, const unsigned int *__b) {
2794  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2795}
2796#endif
2797
2798#ifdef __LITTLE_ENDIAN__
2799static __inline__ vector unsigned char __ATTRS_o_ai
2800    __attribute__((__deprecated__("use assignment for unaligned little endian \
2801loads/stores"))) vec_lvsl(int __a, const float *__b) {
2802  vector unsigned char mask =
2803      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2804  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2805                                  7,  6,  5,  4,  3,  2,  1, 0};
2806  return vec_perm(mask, mask, reverse);
2807}
2808#else
2809static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2810                                                             const float *__b) {
2811  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2812}
2813#endif
2814
2815/* vec_lvsr */
2816
2817#ifdef __LITTLE_ENDIAN__
2818static __inline__ vector unsigned char __ATTRS_o_ai
2819    __attribute__((__deprecated__("use assignment for unaligned little endian \
2820loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
2821  vector unsigned char mask =
2822      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2823  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2824                                  7,  6,  5,  4,  3,  2,  1, 0};
2825  return vec_perm(mask, mask, reverse);
2826}
2827#else
2828static __inline__ vector unsigned char __ATTRS_o_ai
2829vec_lvsr(int __a, const signed char *__b) {
2830  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2831}
2832#endif
2833
2834#ifdef __LITTLE_ENDIAN__
2835static __inline__ vector unsigned char __ATTRS_o_ai
2836    __attribute__((__deprecated__("use assignment for unaligned little endian \
2837loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
2838  vector unsigned char mask =
2839      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2840  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2841                                  7,  6,  5,  4,  3,  2,  1, 0};
2842  return vec_perm(mask, mask, reverse);
2843}
2844#else
2845static __inline__ vector unsigned char __ATTRS_o_ai
2846vec_lvsr(int __a, const unsigned char *__b) {
2847  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2848}
2849#endif
2850
2851#ifdef __LITTLE_ENDIAN__
2852static __inline__ vector unsigned char __ATTRS_o_ai
2853    __attribute__((__deprecated__("use assignment for unaligned little endian \
2854loads/stores"))) vec_lvsr(int __a, const short *__b) {
2855  vector unsigned char mask =
2856      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2857  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2858                                  7,  6,  5,  4,  3,  2,  1, 0};
2859  return vec_perm(mask, mask, reverse);
2860}
2861#else
2862static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2863                                                             const short *__b) {
2864  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2865}
2866#endif
2867
2868#ifdef __LITTLE_ENDIAN__
2869static __inline__ vector unsigned char __ATTRS_o_ai
2870    __attribute__((__deprecated__("use assignment for unaligned little endian \
2871loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
2872  vector unsigned char mask =
2873      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2874  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2875                                  7,  6,  5,  4,  3,  2,  1, 0};
2876  return vec_perm(mask, mask, reverse);
2877}
2878#else
2879static __inline__ vector unsigned char __ATTRS_o_ai
2880vec_lvsr(int __a, const unsigned short *__b) {
2881  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2882}
2883#endif
2884
2885#ifdef __LITTLE_ENDIAN__
2886static __inline__ vector unsigned char __ATTRS_o_ai
2887    __attribute__((__deprecated__("use assignment for unaligned little endian \
2888loads/stores"))) vec_lvsr(int __a, const int *__b) {
2889  vector unsigned char mask =
2890      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2891  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2892                                  7,  6,  5,  4,  3,  2,  1, 0};
2893  return vec_perm(mask, mask, reverse);
2894}
2895#else
2896static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2897                                                             const int *__b) {
2898  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2899}
2900#endif
2901
2902#ifdef __LITTLE_ENDIAN__
2903static __inline__ vector unsigned char __ATTRS_o_ai
2904    __attribute__((__deprecated__("use assignment for unaligned little endian \
2905loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
2906  vector unsigned char mask =
2907      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2908  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2909                                  7,  6,  5,  4,  3,  2,  1, 0};
2910  return vec_perm(mask, mask, reverse);
2911}
2912#else
2913static __inline__ vector unsigned char __ATTRS_o_ai
2914vec_lvsr(int __a, const unsigned int *__b) {
2915  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2916}
2917#endif
2918
2919#ifdef __LITTLE_ENDIAN__
2920static __inline__ vector unsigned char __ATTRS_o_ai
2921    __attribute__((__deprecated__("use assignment for unaligned little endian \
2922loads/stores"))) vec_lvsr(int __a, const float *__b) {
2923  vector unsigned char mask =
2924      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2925  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2926                                  7,  6,  5,  4,  3,  2,  1, 0};
2927  return vec_perm(mask, mask, reverse);
2928}
2929#else
2930static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2931                                                             const float *__b) {
2932  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2933}
2934#endif
2935
2936/* vec_madd */
2937static __inline__ vector signed short __ATTRS_o_ai
2938vec_mladd(vector signed short, vector signed short, vector signed short);
2939static __inline__ vector signed short __ATTRS_o_ai
2940vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
2941static __inline__ vector signed short __ATTRS_o_ai
2942vec_mladd(vector unsigned short, vector signed short, vector signed short);
2943static __inline__ vector unsigned short __ATTRS_o_ai
2944vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
2945
2946static __inline__ vector signed short __ATTRS_o_ai vec_madd(
2947    vector signed short __a, vector signed short __b, vector signed short __c) {
2948  return vec_mladd(__a, __b, __c);
2949}
2950
2951static __inline__ vector signed short __ATTRS_o_ai
2952vec_madd(vector signed short __a, vector unsigned short __b,
2953         vector unsigned short __c) {
2954  return vec_mladd(__a, __b, __c);
2955}
2956
2957static __inline__ vector signed short __ATTRS_o_ai
2958vec_madd(vector unsigned short __a, vector signed short __b,
2959         vector signed short __c) {
2960  return vec_mladd(__a, __b, __c);
2961}
2962
2963static __inline__ vector unsigned short __ATTRS_o_ai
2964vec_madd(vector unsigned short __a, vector unsigned short __b,
2965         vector unsigned short __c) {
2966  return vec_mladd(__a, __b, __c);
2967}
2968
2969static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
2970                                                     vector float __b,
2971                                                     vector float __c) {
2972#ifdef __VSX__
2973  return __builtin_vsx_xvmaddasp(__a, __b, __c);
2974#else
2975  return __builtin_altivec_vmaddfp(__a, __b, __c);
2976#endif
2977}
2978
2979#ifdef __VSX__
2980static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
2981                                                      vector double __b,
2982                                                      vector double __c) {
2983  return __builtin_vsx_xvmaddadp(__a, __b, __c);
2984}
2985#endif
2986
2987/* vec_vmaddfp */
2988
2989static __inline__ vector float __attribute__((__always_inline__))
2990vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
2991  return __builtin_altivec_vmaddfp(__a, __b, __c);
2992}
2993
2994/* vec_madds */
2995
2996static __inline__ vector signed short __attribute__((__always_inline__))
2997vec_madds(vector signed short __a, vector signed short __b,
2998          vector signed short __c) {
2999  return __builtin_altivec_vmhaddshs(__a, __b, __c);
3000}
3001
3002/* vec_vmhaddshs */
3003static __inline__ vector signed short __attribute__((__always_inline__))
3004vec_vmhaddshs(vector signed short __a, vector signed short __b,
3005              vector signed short __c) {
3006  return __builtin_altivec_vmhaddshs(__a, __b, __c);
3007}
3008
3009/* vec_msub */
3010
3011#ifdef __VSX__
3012static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
3013                                                     vector float __b,
3014                                                     vector float __c) {
3015  return __builtin_vsx_xvmsubasp(__a, __b, __c);
3016}
3017
3018static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
3019                                                      vector double __b,
3020                                                      vector double __c) {
3021  return __builtin_vsx_xvmsubadp(__a, __b, __c);
3022}
3023#endif
3024
3025/* vec_max */
3026
3027static __inline__ vector signed char __ATTRS_o_ai
3028vec_max(vector signed char __a, vector signed char __b) {
3029  return __builtin_altivec_vmaxsb(__a, __b);
3030}
3031
3032static __inline__ vector signed char __ATTRS_o_ai
3033vec_max(vector bool char __a, vector signed char __b) {
3034  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3035}
3036
3037static __inline__ vector signed char __ATTRS_o_ai
3038vec_max(vector signed char __a, vector bool char __b) {
3039  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3040}
3041
3042static __inline__ vector unsigned char __ATTRS_o_ai
3043vec_max(vector unsigned char __a, vector unsigned char __b) {
3044  return __builtin_altivec_vmaxub(__a, __b);
3045}
3046
3047static __inline__ vector unsigned char __ATTRS_o_ai
3048vec_max(vector bool char __a, vector unsigned char __b) {
3049  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3050}
3051
3052static __inline__ vector unsigned char __ATTRS_o_ai
3053vec_max(vector unsigned char __a, vector bool char __b) {
3054  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3055}
3056
3057static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3058                                                    vector short __b) {
3059  return __builtin_altivec_vmaxsh(__a, __b);
3060}
3061
3062static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
3063                                                    vector short __b) {
3064  return __builtin_altivec_vmaxsh((vector short)__a, __b);
3065}
3066
3067static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3068                                                    vector bool short __b) {
3069  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3070}
3071
3072static __inline__ vector unsigned short __ATTRS_o_ai
3073vec_max(vector unsigned short __a, vector unsigned short __b) {
3074  return __builtin_altivec_vmaxuh(__a, __b);
3075}
3076
3077static __inline__ vector unsigned short __ATTRS_o_ai
3078vec_max(vector bool short __a, vector unsigned short __b) {
3079  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3080}
3081
3082static __inline__ vector unsigned short __ATTRS_o_ai
3083vec_max(vector unsigned short __a, vector bool short __b) {
3084  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3085}
3086
3087static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3088                                                  vector int __b) {
3089  return __builtin_altivec_vmaxsw(__a, __b);
3090}
3091
3092static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
3093                                                  vector int __b) {
3094  return __builtin_altivec_vmaxsw((vector int)__a, __b);
3095}
3096
3097static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3098                                                  vector bool int __b) {
3099  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3100}
3101
3102static __inline__ vector unsigned int __ATTRS_o_ai
3103vec_max(vector unsigned int __a, vector unsigned int __b) {
3104  return __builtin_altivec_vmaxuw(__a, __b);
3105}
3106
3107static __inline__ vector unsigned int __ATTRS_o_ai
3108vec_max(vector bool int __a, vector unsigned int __b) {
3109  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3110}
3111
3112static __inline__ vector unsigned int __ATTRS_o_ai
3113vec_max(vector unsigned int __a, vector bool int __b) {
3114  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3115}
3116
3117#ifdef __POWER8_VECTOR__
3118static __inline__ vector signed long long __ATTRS_o_ai
3119vec_max(vector signed long long __a, vector signed long long __b) {
3120  return __builtin_altivec_vmaxsd(__a, __b);
3121}
3122
3123static __inline__ vector signed long long __ATTRS_o_ai
3124vec_max(vector bool long long __a, vector signed long long __b) {
3125  return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
3126}
3127
3128static __inline__ vector signed long long __ATTRS_o_ai
3129vec_max(vector signed long long __a, vector bool long long __b) {
3130  return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
3131}
3132
3133static __inline__ vector unsigned long long __ATTRS_o_ai
3134vec_max(vector unsigned long long __a, vector unsigned long long __b) {
3135  return __builtin_altivec_vmaxud(__a, __b);
3136}
3137
3138static __inline__ vector unsigned long long __ATTRS_o_ai
3139vec_max(vector bool long long __a, vector unsigned long long __b) {
3140  return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
3141}
3142
3143static __inline__ vector unsigned long long __ATTRS_o_ai
3144vec_max(vector unsigned long long __a, vector bool long long __b) {
3145  return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
3146}
3147#endif
3148
3149static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
3150                                                    vector float __b) {
3151#ifdef __VSX__
3152  return __builtin_vsx_xvmaxsp(__a, __b);
3153#else
3154  return __builtin_altivec_vmaxfp(__a, __b);
3155#endif
3156}
3157
3158#ifdef __VSX__
3159static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
3160                                                     vector double __b) {
3161  return __builtin_vsx_xvmaxdp(__a, __b);
3162}
3163#endif
3164
3165/* vec_vmaxsb */
3166
3167static __inline__ vector signed char __ATTRS_o_ai
3168vec_vmaxsb(vector signed char __a, vector signed char __b) {
3169  return __builtin_altivec_vmaxsb(__a, __b);
3170}
3171
3172static __inline__ vector signed char __ATTRS_o_ai
3173vec_vmaxsb(vector bool char __a, vector signed char __b) {
3174  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3175}
3176
3177static __inline__ vector signed char __ATTRS_o_ai
3178vec_vmaxsb(vector signed char __a, vector bool char __b) {
3179  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3180}
3181
3182/* vec_vmaxub */
3183
3184static __inline__ vector unsigned char __ATTRS_o_ai
3185vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
3186  return __builtin_altivec_vmaxub(__a, __b);
3187}
3188
3189static __inline__ vector unsigned char __ATTRS_o_ai
3190vec_vmaxub(vector bool char __a, vector unsigned char __b) {
3191  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3192}
3193
3194static __inline__ vector unsigned char __ATTRS_o_ai
3195vec_vmaxub(vector unsigned char __a, vector bool char __b) {
3196  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3197}
3198
3199/* vec_vmaxsh */
3200
3201static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3202                                                       vector short __b) {
3203  return __builtin_altivec_vmaxsh(__a, __b);
3204}
3205
3206static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
3207                                                       vector short __b) {
3208  return __builtin_altivec_vmaxsh((vector short)__a, __b);
3209}
3210
3211static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3212                                                       vector bool short __b) {
3213  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3214}
3215
3216/* vec_vmaxuh */
3217
3218static __inline__ vector unsigned short __ATTRS_o_ai
3219vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
3220  return __builtin_altivec_vmaxuh(__a, __b);
3221}
3222
3223static __inline__ vector unsigned short __ATTRS_o_ai
3224vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
3225  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3226}
3227
3228static __inline__ vector unsigned short __ATTRS_o_ai
3229vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
3230  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3231}
3232
3233/* vec_vmaxsw */
3234
3235static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3236                                                     vector int __b) {
3237  return __builtin_altivec_vmaxsw(__a, __b);
3238}
3239
3240static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
3241                                                     vector int __b) {
3242  return __builtin_altivec_vmaxsw((vector int)__a, __b);
3243}
3244
3245static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3246                                                     vector bool int __b) {
3247  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3248}
3249
3250/* vec_vmaxuw */
3251
3252static __inline__ vector unsigned int __ATTRS_o_ai
3253vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
3254  return __builtin_altivec_vmaxuw(__a, __b);
3255}
3256
3257static __inline__ vector unsigned int __ATTRS_o_ai
3258vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
3259  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3260}
3261
3262static __inline__ vector unsigned int __ATTRS_o_ai
3263vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
3264  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3265}
3266
3267/* vec_vmaxfp */
3268
3269static __inline__ vector float __attribute__((__always_inline__))
3270vec_vmaxfp(vector float __a, vector float __b) {
3271#ifdef __VSX__
3272  return __builtin_vsx_xvmaxsp(__a, __b);
3273#else
3274  return __builtin_altivec_vmaxfp(__a, __b);
3275#endif
3276}
3277
3278/* vec_mergeh */
3279
3280static __inline__ vector signed char __ATTRS_o_ai
3281vec_mergeh(vector signed char __a, vector signed char __b) {
3282  return vec_perm(__a, __b,
3283                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3284                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3285                                         0x06, 0x16, 0x07, 0x17));
3286}
3287
3288static __inline__ vector unsigned char __ATTRS_o_ai
3289vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
3290  return vec_perm(__a, __b,
3291                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3292                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3293                                         0x06, 0x16, 0x07, 0x17));
3294}
3295
3296static __inline__ vector bool char __ATTRS_o_ai
3297vec_mergeh(vector bool char __a, vector bool char __b) {
3298  return vec_perm(__a, __b,
3299                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3300                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3301                                         0x06, 0x16, 0x07, 0x17));
3302}
3303
3304static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
3305                                                       vector short __b) {
3306  return vec_perm(__a, __b,
3307                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3308                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3309                                         0x06, 0x07, 0x16, 0x17));
3310}
3311
3312static __inline__ vector unsigned short __ATTRS_o_ai
3313vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
3314  return vec_perm(__a, __b,
3315                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3316                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3317                                         0x06, 0x07, 0x16, 0x17));
3318}
3319
3320static __inline__ vector bool short __ATTRS_o_ai
3321vec_mergeh(vector bool short __a, vector bool short __b) {
3322  return vec_perm(__a, __b,
3323                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3324                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3325                                         0x06, 0x07, 0x16, 0x17));
3326}
3327
3328static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
3329                                                       vector pixel __b) {
3330  return vec_perm(__a, __b,
3331                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3332                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3333                                         0x06, 0x07, 0x16, 0x17));
3334}
3335
3336static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
3337                                                     vector int __b) {
3338  return vec_perm(__a, __b,
3339                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3340                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3341                                         0x14, 0x15, 0x16, 0x17));
3342}
3343
3344static __inline__ vector unsigned int __ATTRS_o_ai
3345vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
3346  return vec_perm(__a, __b,
3347                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3348                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3349                                         0x14, 0x15, 0x16, 0x17));
3350}
3351
3352static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
3353                                                          vector bool int __b) {
3354  return vec_perm(__a, __b,
3355                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3356                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3357                                         0x14, 0x15, 0x16, 0x17));
3358}
3359
3360static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
3361                                                       vector float __b) {
3362  return vec_perm(__a, __b,
3363                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3364                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3365                                         0x14, 0x15, 0x16, 0x17));
3366}
3367
3368#ifdef __VSX__
3369static __inline__ vector signed long long __ATTRS_o_ai
3370vec_mergeh(vector signed long long __a, vector signed long long __b) {
3371  return vec_perm(__a, __b,
3372                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3373                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3374                                         0x14, 0x15, 0x16, 0x17));
3375}
3376
3377static __inline__ vector signed long long __ATTRS_o_ai
3378vec_mergeh(vector signed long long __a, vector bool long long __b) {
3379  return vec_perm(__a, (vector signed long long)__b,
3380                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3381                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3382                                         0x14, 0x15, 0x16, 0x17));
3383}
3384
3385static __inline__ vector signed long long __ATTRS_o_ai
3386vec_mergeh(vector bool long long __a, vector signed long long __b) {
3387  return vec_perm((vector signed long long)__a, __b,
3388                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3389                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3390                                         0x14, 0x15, 0x16, 0x17));
3391}
3392
3393static __inline__ vector unsigned long long __ATTRS_o_ai
3394vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
3395  return vec_perm(__a, __b,
3396                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3397                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3398                                         0x14, 0x15, 0x16, 0x17));
3399}
3400
3401static __inline__ vector unsigned long long __ATTRS_o_ai
3402vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
3403  return vec_perm(__a, (vector unsigned long long)__b,
3404                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3405                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3406                                         0x14, 0x15, 0x16, 0x17));
3407}
3408
3409static __inline__ vector unsigned long long __ATTRS_o_ai
3410vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
3411  return vec_perm((vector unsigned long long)__a, __b,
3412                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3413                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3414                                         0x14, 0x15, 0x16, 0x17));
3415}
3416
3417static __inline__ vector bool long long __ATTRS_o_ai
3418vec_mergeh(vector bool long long __a, vector bool long long __b) {
3419  return vec_perm(__a, __b,
3420                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3421                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3422                                         0x14, 0x15, 0x16, 0x17));
3423}
3424
3425static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3426                                                        vector double __b) {
3427  return vec_perm(__a, __b,
3428                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3429                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3430                                         0x14, 0x15, 0x16, 0x17));
3431}
3432static __inline__ vector double __ATTRS_o_ai
3433vec_mergeh(vector double __a, vector bool long long __b) {
3434  return vec_perm(__a, (vector double)__b,
3435                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3436                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3437                                         0x14, 0x15, 0x16, 0x17));
3438}
3439static __inline__ vector double __ATTRS_o_ai
3440vec_mergeh(vector bool long long __a, vector double __b) {
3441  return vec_perm((vector double)__a, __b,
3442                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3443                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3444                                         0x14, 0x15, 0x16, 0x17));
3445}
3446#endif
3447
3448/* vec_vmrghb */
3449
3450#define __builtin_altivec_vmrghb vec_vmrghb
3451
3452static __inline__ vector signed char __ATTRS_o_ai
3453vec_vmrghb(vector signed char __a, vector signed char __b) {
3454  return vec_perm(__a, __b,
3455                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3456                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3457                                         0x06, 0x16, 0x07, 0x17));
3458}
3459
3460static __inline__ vector unsigned char __ATTRS_o_ai
3461vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
3462  return vec_perm(__a, __b,
3463                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3464                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3465                                         0x06, 0x16, 0x07, 0x17));
3466}
3467
3468static __inline__ vector bool char __ATTRS_o_ai
3469vec_vmrghb(vector bool char __a, vector bool char __b) {
3470  return vec_perm(__a, __b,
3471                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3472                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3473                                         0x06, 0x16, 0x07, 0x17));
3474}
3475
3476/* vec_vmrghh */
3477
3478#define __builtin_altivec_vmrghh vec_vmrghh
3479
3480static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
3481                                                       vector short __b) {
3482  return vec_perm(__a, __b,
3483                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3484                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3485                                         0x06, 0x07, 0x16, 0x17));
3486}
3487
3488static __inline__ vector unsigned short __ATTRS_o_ai
3489vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
3490  return vec_perm(__a, __b,
3491                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3492                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3493                                         0x06, 0x07, 0x16, 0x17));
3494}
3495
3496static __inline__ vector bool short __ATTRS_o_ai
3497vec_vmrghh(vector bool short __a, vector bool short __b) {
3498  return vec_perm(__a, __b,
3499                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3500                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3501                                         0x06, 0x07, 0x16, 0x17));
3502}
3503
3504static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
3505                                                       vector pixel __b) {
3506  return vec_perm(__a, __b,
3507                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3508                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3509                                         0x06, 0x07, 0x16, 0x17));
3510}
3511
3512/* vec_vmrghw */
3513
3514#define __builtin_altivec_vmrghw vec_vmrghw
3515
3516static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
3517                                                     vector int __b) {
3518  return vec_perm(__a, __b,
3519                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3520                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3521                                         0x14, 0x15, 0x16, 0x17));
3522}
3523
3524static __inline__ vector unsigned int __ATTRS_o_ai
3525vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
3526  return vec_perm(__a, __b,
3527                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3528                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3529                                         0x14, 0x15, 0x16, 0x17));
3530}
3531
3532static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
3533                                                          vector bool int __b) {
3534  return vec_perm(__a, __b,
3535                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3536                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3537                                         0x14, 0x15, 0x16, 0x17));
3538}
3539
3540static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
3541                                                       vector float __b) {
3542  return vec_perm(__a, __b,
3543                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3544                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3545                                         0x14, 0x15, 0x16, 0x17));
3546}
3547
3548/* vec_mergel */
3549
3550static __inline__ vector signed char __ATTRS_o_ai
3551vec_mergel(vector signed char __a, vector signed char __b) {
3552  return vec_perm(__a, __b,
3553                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3554                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3555                                         0x0E, 0x1E, 0x0F, 0x1F));
3556}
3557
3558static __inline__ vector unsigned char __ATTRS_o_ai
3559vec_mergel(vector unsigned char __a, vector unsigned char __b) {
3560  return vec_perm(__a, __b,
3561                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3562                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3563                                         0x0E, 0x1E, 0x0F, 0x1F));
3564}
3565
3566static __inline__ vector bool char __ATTRS_o_ai
3567vec_mergel(vector bool char __a, vector bool char __b) {
3568  return vec_perm(__a, __b,
3569                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3570                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3571                                         0x0E, 0x1E, 0x0F, 0x1F));
3572}
3573
3574static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
3575                                                       vector short __b) {
3576  return vec_perm(__a, __b,
3577                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3578                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3579                                         0x0E, 0x0F, 0x1E, 0x1F));
3580}
3581
3582static __inline__ vector unsigned short __ATTRS_o_ai
3583vec_mergel(vector unsigned short __a, vector unsigned short __b) {
3584  return vec_perm(__a, __b,
3585                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3586                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3587                                         0x0E, 0x0F, 0x1E, 0x1F));
3588}
3589
3590static __inline__ vector bool short __ATTRS_o_ai
3591vec_mergel(vector bool short __a, vector bool short __b) {
3592  return vec_perm(__a, __b,
3593                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3594                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3595                                         0x0E, 0x0F, 0x1E, 0x1F));
3596}
3597
3598static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
3599                                                       vector pixel __b) {
3600  return vec_perm(__a, __b,
3601                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3602                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3603                                         0x0E, 0x0F, 0x1E, 0x1F));
3604}
3605
3606static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
3607                                                     vector int __b) {
3608  return vec_perm(__a, __b,
3609                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3610                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3611                                         0x1C, 0x1D, 0x1E, 0x1F));
3612}
3613
3614static __inline__ vector unsigned int __ATTRS_o_ai
3615vec_mergel(vector unsigned int __a, vector unsigned int __b) {
3616  return vec_perm(__a, __b,
3617                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3618                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3619                                         0x1C, 0x1D, 0x1E, 0x1F));
3620}
3621
3622static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
3623                                                          vector bool int __b) {
3624  return vec_perm(__a, __b,
3625                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3626                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3627                                         0x1C, 0x1D, 0x1E, 0x1F));
3628}
3629
3630static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
3631                                                       vector float __b) {
3632  return vec_perm(__a, __b,
3633                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3634                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3635                                         0x1C, 0x1D, 0x1E, 0x1F));
3636}
3637
3638#ifdef __VSX__
3639static __inline__ vector signed long long __ATTRS_o_ai
3640vec_mergel(vector signed long long __a, vector signed long long __b) {
3641  return vec_perm(__a, __b,
3642                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3643                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3644                                         0x1C, 0x1D, 0x1E, 0x1F));
3645}
3646static __inline__ vector signed long long __ATTRS_o_ai
3647vec_mergel(vector signed long long __a, vector bool long long __b) {
3648  return vec_perm(__a, (vector signed long long)__b,
3649                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3650                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3651                                         0x1C, 0x1D, 0x1E, 0x1F));
3652}
3653static __inline__ vector signed long long __ATTRS_o_ai
3654vec_mergel(vector bool long long __a, vector signed long long __b) {
3655  return vec_perm((vector signed long long)__a, __b,
3656                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3657                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3658                                         0x1C, 0x1D, 0x1E, 0x1F));
3659}
3660static __inline__ vector unsigned long long __ATTRS_o_ai
3661vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
3662  return vec_perm(__a, __b,
3663                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3664                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3665                                         0x1C, 0x1D, 0x1E, 0x1F));
3666}
3667static __inline__ vector unsigned long long __ATTRS_o_ai
3668vec_mergel(vector unsigned long long __a, vector bool long long __b) {
3669  return vec_perm(__a, (vector unsigned long long)__b,
3670                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3671                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3672                                         0x1C, 0x1D, 0x1E, 0x1F));
3673}
3674static __inline__ vector unsigned long long __ATTRS_o_ai
3675vec_mergel(vector bool long long __a, vector unsigned long long __b) {
3676  return vec_perm((vector unsigned long long)__a, __b,
3677                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3678                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3679                                         0x1C, 0x1D, 0x1E, 0x1F));
3680}
3681static __inline__ vector bool long long __ATTRS_o_ai
3682vec_mergel(vector bool long long __a, vector bool long long __b) {
3683  return vec_perm(__a, __b,
3684                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3685                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3686                                         0x1C, 0x1D, 0x1E, 0x1F));
3687}
3688static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
3689                                                        vector double __b) {
3690  return vec_perm(__a, __b,
3691                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3692                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3693                                         0x1C, 0x1D, 0x1E, 0x1F));
3694}
3695static __inline__ vector double __ATTRS_o_ai
3696vec_mergel(vector double __a, vector bool long long __b) {
3697  return vec_perm(__a, (vector double)__b,
3698                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3699                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3700                                         0x1C, 0x1D, 0x1E, 0x1F));
3701}
3702static __inline__ vector double __ATTRS_o_ai
3703vec_mergel(vector bool long long __a, vector double __b) {
3704  return vec_perm((vector double)__a, __b,
3705                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3706                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3707                                         0x1C, 0x1D, 0x1E, 0x1F));
3708}
3709#endif
3710
3711/* vec_vmrglb */
3712
3713#define __builtin_altivec_vmrglb vec_vmrglb
3714
3715static __inline__ vector signed char __ATTRS_o_ai
3716vec_vmrglb(vector signed char __a, vector signed char __b) {
3717  return vec_perm(__a, __b,
3718                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3719                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3720                                         0x0E, 0x1E, 0x0F, 0x1F));
3721}
3722
3723static __inline__ vector unsigned char __ATTRS_o_ai
3724vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
3725  return vec_perm(__a, __b,
3726                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3727                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3728                                         0x0E, 0x1E, 0x0F, 0x1F));
3729}
3730
3731static __inline__ vector bool char __ATTRS_o_ai
3732vec_vmrglb(vector bool char __a, vector bool char __b) {
3733  return vec_perm(__a, __b,
3734                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3735                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3736                                         0x0E, 0x1E, 0x0F, 0x1F));
3737}
3738
3739/* vec_vmrglh */
3740
3741#define __builtin_altivec_vmrglh vec_vmrglh
3742
3743static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
3744                                                       vector short __b) {
3745  return vec_perm(__a, __b,
3746                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3747                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3748                                         0x0E, 0x0F, 0x1E, 0x1F));
3749}
3750
3751static __inline__ vector unsigned short __ATTRS_o_ai
3752vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
3753  return vec_perm(__a, __b,
3754                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3755                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3756                                         0x0E, 0x0F, 0x1E, 0x1F));
3757}
3758
3759static __inline__ vector bool short __ATTRS_o_ai
3760vec_vmrglh(vector bool short __a, vector bool short __b) {
3761  return vec_perm(__a, __b,
3762                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3763                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3764                                         0x0E, 0x0F, 0x1E, 0x1F));
3765}
3766
3767static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
3768                                                       vector pixel __b) {
3769  return vec_perm(__a, __b,
3770                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3771                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3772                                         0x0E, 0x0F, 0x1E, 0x1F));
3773}
3774
3775/* vec_vmrglw */
3776
3777#define __builtin_altivec_vmrglw vec_vmrglw
3778
3779static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
3780                                                     vector int __b) {
3781  return vec_perm(__a, __b,
3782                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3783                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3784                                         0x1C, 0x1D, 0x1E, 0x1F));
3785}
3786
3787static __inline__ vector unsigned int __ATTRS_o_ai
3788vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
3789  return vec_perm(__a, __b,
3790                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3791                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3792                                         0x1C, 0x1D, 0x1E, 0x1F));
3793}
3794
3795static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3796                                                          vector bool int __b) {
3797  return vec_perm(__a, __b,
3798                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3799                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3800                                         0x1C, 0x1D, 0x1E, 0x1F));
3801}
3802
3803static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3804                                                       vector float __b) {
3805  return vec_perm(__a, __b,
3806                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3807                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3808                                         0x1C, 0x1D, 0x1E, 0x1F));
3809}
3810
3811#ifdef __POWER8_VECTOR__
3812/* vec_mergee */
3813
3814static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
3815                                                          vector bool int __b) {
3816  return vec_perm(__a, __b,
3817                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3818                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3819                                         0x18, 0x19, 0x1A, 0x1B));
3820}
3821
3822static __inline__ vector signed int __ATTRS_o_ai
3823vec_mergee(vector signed int __a, vector signed int __b) {
3824  return vec_perm(__a, __b,
3825                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3826                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3827                                         0x18, 0x19, 0x1A, 0x1B));
3828}
3829
3830static __inline__ vector unsigned int __ATTRS_o_ai
3831vec_mergee(vector unsigned int __a, vector unsigned int __b) {
3832  return vec_perm(__a, __b,
3833                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3834                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3835                                         0x18, 0x19, 0x1A, 0x1B));
3836}
3837
3838/* vec_mergeo */
3839
3840static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
3841                                                          vector bool int __b) {
3842  return vec_perm(__a, __b,
3843                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3844                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3845                                         0x1C, 0x1D, 0x1E, 0x1F));
3846}
3847
3848static __inline__ vector signed int __ATTRS_o_ai
3849vec_mergeo(vector signed int __a, vector signed int __b) {
3850  return vec_perm(__a, __b,
3851                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3852                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3853                                         0x1C, 0x1D, 0x1E, 0x1F));
3854}
3855
3856static __inline__ vector unsigned int __ATTRS_o_ai
3857vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
3858  return vec_perm(__a, __b,
3859                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3860                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3861                                         0x1C, 0x1D, 0x1E, 0x1F));
3862}
3863
3864#endif
3865
3866/* vec_mfvscr */
3867
3868static __inline__ vector unsigned short __attribute__((__always_inline__))
3869vec_mfvscr(void) {
3870  return __builtin_altivec_mfvscr();
3871}
3872
3873/* vec_min */
3874
3875static __inline__ vector signed char __ATTRS_o_ai
3876vec_min(vector signed char __a, vector signed char __b) {
3877  return __builtin_altivec_vminsb(__a, __b);
3878}
3879
3880static __inline__ vector signed char __ATTRS_o_ai
3881vec_min(vector bool char __a, vector signed char __b) {
3882  return __builtin_altivec_vminsb((vector signed char)__a, __b);
3883}
3884
3885static __inline__ vector signed char __ATTRS_o_ai
3886vec_min(vector signed char __a, vector bool char __b) {
3887  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3888}
3889
3890static __inline__ vector unsigned char __ATTRS_o_ai
3891vec_min(vector unsigned char __a, vector unsigned char __b) {
3892  return __builtin_altivec_vminub(__a, __b);
3893}
3894
3895static __inline__ vector unsigned char __ATTRS_o_ai
3896vec_min(vector bool char __a, vector unsigned char __b) {
3897  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3898}
3899
3900static __inline__ vector unsigned char __ATTRS_o_ai
3901vec_min(vector unsigned char __a, vector bool char __b) {
3902  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3903}
3904
3905static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
3906                                                    vector short __b) {
3907  return __builtin_altivec_vminsh(__a, __b);
3908}
3909
3910static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
3911                                                    vector short __b) {
3912  return __builtin_altivec_vminsh((vector short)__a, __b);
3913}
3914
3915static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
3916                                                    vector bool short __b) {
3917  return __builtin_altivec_vminsh(__a, (vector short)__b);
3918}
3919
3920static __inline__ vector unsigned short __ATTRS_o_ai
3921vec_min(vector unsigned short __a, vector unsigned short __b) {
3922  return __builtin_altivec_vminuh(__a, __b);
3923}
3924
3925static __inline__ vector unsigned short __ATTRS_o_ai
3926vec_min(vector bool short __a, vector unsigned short __b) {
3927  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3928}
3929
3930static __inline__ vector unsigned short __ATTRS_o_ai
3931vec_min(vector unsigned short __a, vector bool short __b) {
3932  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3933}
3934
3935static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
3936                                                  vector int __b) {
3937  return __builtin_altivec_vminsw(__a, __b);
3938}
3939
3940static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
3941                                                  vector int __b) {
3942  return __builtin_altivec_vminsw((vector int)__a, __b);
3943}
3944
3945static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
3946                                                  vector bool int __b) {
3947  return __builtin_altivec_vminsw(__a, (vector int)__b);
3948}
3949
3950static __inline__ vector unsigned int __ATTRS_o_ai
3951vec_min(vector unsigned int __a, vector unsigned int __b) {
3952  return __builtin_altivec_vminuw(__a, __b);
3953}
3954
3955static __inline__ vector unsigned int __ATTRS_o_ai
3956vec_min(vector bool int __a, vector unsigned int __b) {
3957  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
3958}
3959
3960static __inline__ vector unsigned int __ATTRS_o_ai
3961vec_min(vector unsigned int __a, vector bool int __b) {
3962  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
3963}
3964
3965#ifdef __POWER8_VECTOR__
3966static __inline__ vector signed long long __ATTRS_o_ai
3967vec_min(vector signed long long __a, vector signed long long __b) {
3968  return __builtin_altivec_vminsd(__a, __b);
3969}
3970
3971static __inline__ vector signed long long __ATTRS_o_ai
3972vec_min(vector bool long long __a, vector signed long long __b) {
3973  return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3974}
3975
3976static __inline__ vector signed long long __ATTRS_o_ai
3977vec_min(vector signed long long __a, vector bool long long __b) {
3978  return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3979}
3980
3981static __inline__ vector unsigned long long __ATTRS_o_ai
3982vec_min(vector unsigned long long __a, vector unsigned long long __b) {
3983  return __builtin_altivec_vminud(__a, __b);
3984}
3985
3986static __inline__ vector unsigned long long __ATTRS_o_ai
3987vec_min(vector bool long long __a, vector unsigned long long __b) {
3988  return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3989}
3990
3991static __inline__ vector unsigned long long __ATTRS_o_ai
3992vec_min(vector unsigned long long __a, vector bool long long __b) {
3993  return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3994}
3995#endif
3996
3997static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
3998                                                    vector float __b) {
3999#ifdef __VSX__
4000  return __builtin_vsx_xvminsp(__a, __b);
4001#else
4002  return __builtin_altivec_vminfp(__a, __b);
4003#endif
4004}
4005
4006#ifdef __VSX__
4007static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
4008                                                     vector double __b) {
4009  return __builtin_vsx_xvmindp(__a, __b);
4010}
4011#endif
4012
4013/* vec_vminsb */
4014
4015static __inline__ vector signed char __ATTRS_o_ai
4016vec_vminsb(vector signed char __a, vector signed char __b) {
4017  return __builtin_altivec_vminsb(__a, __b);
4018}
4019
4020static __inline__ vector signed char __ATTRS_o_ai
4021vec_vminsb(vector bool char __a, vector signed char __b) {
4022  return __builtin_altivec_vminsb((vector signed char)__a, __b);
4023}
4024
4025static __inline__ vector signed char __ATTRS_o_ai
4026vec_vminsb(vector signed char __a, vector bool char __b) {
4027  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
4028}
4029
4030/* vec_vminub */
4031
4032static __inline__ vector unsigned char __ATTRS_o_ai
4033vec_vminub(vector unsigned char __a, vector unsigned char __b) {
4034  return __builtin_altivec_vminub(__a, __b);
4035}
4036
4037static __inline__ vector unsigned char __ATTRS_o_ai
4038vec_vminub(vector bool char __a, vector unsigned char __b) {
4039  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
4040}
4041
4042static __inline__ vector unsigned char __ATTRS_o_ai
4043vec_vminub(vector unsigned char __a, vector bool char __b) {
4044  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
4045}
4046
4047/* vec_vminsh */
4048
4049static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4050                                                       vector short __b) {
4051  return __builtin_altivec_vminsh(__a, __b);
4052}
4053
4054static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
4055                                                       vector short __b) {
4056  return __builtin_altivec_vminsh((vector short)__a, __b);
4057}
4058
4059static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4060                                                       vector bool short __b) {
4061  return __builtin_altivec_vminsh(__a, (vector short)__b);
4062}
4063
4064/* vec_vminuh */
4065
4066static __inline__ vector unsigned short __ATTRS_o_ai
4067vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
4068  return __builtin_altivec_vminuh(__a, __b);
4069}
4070
4071static __inline__ vector unsigned short __ATTRS_o_ai
4072vec_vminuh(vector bool short __a, vector unsigned short __b) {
4073  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
4074}
4075
4076static __inline__ vector unsigned short __ATTRS_o_ai
4077vec_vminuh(vector unsigned short __a, vector bool short __b) {
4078  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
4079}
4080
4081/* vec_vminsw */
4082
4083static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4084                                                     vector int __b) {
4085  return __builtin_altivec_vminsw(__a, __b);
4086}
4087
4088static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
4089                                                     vector int __b) {
4090  return __builtin_altivec_vminsw((vector int)__a, __b);
4091}
4092
4093static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4094                                                     vector bool int __b) {
4095  return __builtin_altivec_vminsw(__a, (vector int)__b);
4096}
4097
4098/* vec_vminuw */
4099
4100static __inline__ vector unsigned int __ATTRS_o_ai
4101vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
4102  return __builtin_altivec_vminuw(__a, __b);
4103}
4104
4105static __inline__ vector unsigned int __ATTRS_o_ai
4106vec_vminuw(vector bool int __a, vector unsigned int __b) {
4107  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
4108}
4109
4110static __inline__ vector unsigned int __ATTRS_o_ai
4111vec_vminuw(vector unsigned int __a, vector bool int __b) {
4112  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
4113}
4114
4115/* vec_vminfp */
4116
4117static __inline__ vector float __attribute__((__always_inline__))
4118vec_vminfp(vector float __a, vector float __b) {
4119#ifdef __VSX__
4120  return __builtin_vsx_xvminsp(__a, __b);
4121#else
4122  return __builtin_altivec_vminfp(__a, __b);
4123#endif
4124}
4125
4126/* vec_mladd */
4127
4128#define __builtin_altivec_vmladduhm vec_mladd
4129
4130static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
4131                                                      vector short __b,
4132                                                      vector short __c) {
4133  return __a * __b + __c;
4134}
4135
4136static __inline__ vector short __ATTRS_o_ai vec_mladd(
4137    vector short __a, vector unsigned short __b, vector unsigned short __c) {
4138  return __a * (vector short)__b + (vector short)__c;
4139}
4140
4141static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4142                                                      vector short __b,
4143                                                      vector short __c) {
4144  return (vector short)__a * __b + __c;
4145}
4146
4147static __inline__ vector unsigned short __ATTRS_o_ai
4148vec_mladd(vector unsigned short __a, vector unsigned short __b,
4149          vector unsigned short __c) {
4150  return __a * __b + __c;
4151}
4152
4153/* vec_vmladduhm */
4154
4155static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4156                                                          vector short __b,
4157                                                          vector short __c) {
4158  return __a * __b + __c;
4159}
4160
4161static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
4162    vector short __a, vector unsigned short __b, vector unsigned short __c) {
4163  return __a * (vector short)__b + (vector short)__c;
4164}
4165
4166static __inline__ vector short __ATTRS_o_ai
4167vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
4168  return (vector short)__a * __b + __c;
4169}
4170
4171static __inline__ vector unsigned short __ATTRS_o_ai
4172vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
4173              vector unsigned short __c) {
4174  return __a * __b + __c;
4175}
4176
4177/* vec_mradds */
4178
4179static __inline__ vector short __attribute__((__always_inline__))
4180vec_mradds(vector short __a, vector short __b, vector short __c) {
4181  return __builtin_altivec_vmhraddshs(__a, __b, __c);
4182}
4183
4184/* vec_vmhraddshs */
4185
4186static __inline__ vector short __attribute__((__always_inline__))
4187vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
4188  return __builtin_altivec_vmhraddshs(__a, __b, __c);
4189}
4190
4191/* vec_msum */
4192
4193static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
4194                                                   vector unsigned char __b,
4195                                                   vector int __c) {
4196  return __builtin_altivec_vmsummbm(__a, __b, __c);
4197}
4198
4199static __inline__ vector unsigned int __ATTRS_o_ai
4200vec_msum(vector unsigned char __a, vector unsigned char __b,
4201         vector unsigned int __c) {
4202  return __builtin_altivec_vmsumubm(__a, __b, __c);
4203}
4204
4205static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
4206                                                   vector short __b,
4207                                                   vector int __c) {
4208  return __builtin_altivec_vmsumshm(__a, __b, __c);
4209}
4210
4211static __inline__ vector unsigned int __ATTRS_o_ai
4212vec_msum(vector unsigned short __a, vector unsigned short __b,
4213         vector unsigned int __c) {
4214  return __builtin_altivec_vmsumuhm(__a, __b, __c);
4215}
4216
4217/* vec_vmsummbm */
4218
4219static __inline__ vector int __attribute__((__always_inline__))
4220vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
4221  return __builtin_altivec_vmsummbm(__a, __b, __c);
4222}
4223
4224/* vec_vmsumubm */
4225
4226static __inline__ vector unsigned int __attribute__((__always_inline__))
4227vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
4228             vector unsigned int __c) {
4229  return __builtin_altivec_vmsumubm(__a, __b, __c);
4230}
4231
4232/* vec_vmsumshm */
4233
4234static __inline__ vector int __attribute__((__always_inline__))
4235vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
4236  return __builtin_altivec_vmsumshm(__a, __b, __c);
4237}
4238
4239/* vec_vmsumuhm */
4240
4241static __inline__ vector unsigned int __attribute__((__always_inline__))
4242vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
4243             vector unsigned int __c) {
4244  return __builtin_altivec_vmsumuhm(__a, __b, __c);
4245}
4246
4247/* vec_msums */
4248
4249static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
4250                                                    vector short __b,
4251                                                    vector int __c) {
4252  return __builtin_altivec_vmsumshs(__a, __b, __c);
4253}
4254
4255static __inline__ vector unsigned int __ATTRS_o_ai
4256vec_msums(vector unsigned short __a, vector unsigned short __b,
4257          vector unsigned int __c) {
4258  return __builtin_altivec_vmsumuhs(__a, __b, __c);
4259}
4260
4261/* vec_vmsumshs */
4262
4263static __inline__ vector int __attribute__((__always_inline__))
4264vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
4265  return __builtin_altivec_vmsumshs(__a, __b, __c);
4266}
4267
4268/* vec_vmsumuhs */
4269
4270static __inline__ vector unsigned int __attribute__((__always_inline__))
4271vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
4272             vector unsigned int __c) {
4273  return __builtin_altivec_vmsumuhs(__a, __b, __c);
4274}
4275
4276/* vec_mtvscr */
4277
4278static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
4279  __builtin_altivec_mtvscr((vector int)__a);
4280}
4281
4282static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
4283  __builtin_altivec_mtvscr((vector int)__a);
4284}
4285
4286static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
4287  __builtin_altivec_mtvscr((vector int)__a);
4288}
4289
4290static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
4291  __builtin_altivec_mtvscr((vector int)__a);
4292}
4293
4294static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
4295  __builtin_altivec_mtvscr((vector int)__a);
4296}
4297
4298static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
4299  __builtin_altivec_mtvscr((vector int)__a);
4300}
4301
4302static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
4303  __builtin_altivec_mtvscr((vector int)__a);
4304}
4305
4306static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
4307  __builtin_altivec_mtvscr((vector int)__a);
4308}
4309
4310static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
4311  __builtin_altivec_mtvscr((vector int)__a);
4312}
4313
4314static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
4315  __builtin_altivec_mtvscr((vector int)__a);
4316}
4317
4318static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
4319  __builtin_altivec_mtvscr((vector int)__a);
4320}
4321
4322/* vec_mul */
4323
4324/* Integer vector multiplication will involve multiplication of the odd/even
4325   elements separately, then truncating the results and moving to the
4326   result vector.
4327*/
4328static __inline__ vector signed char __ATTRS_o_ai
4329vec_mul(vector signed char __a, vector signed char __b) {
4330  return __a * __b;
4331}
4332
4333static __inline__ vector unsigned char __ATTRS_o_ai
4334vec_mul(vector unsigned char __a, vector unsigned char __b) {
4335  return __a * __b;
4336}
4337
4338static __inline__ vector signed short __ATTRS_o_ai
4339vec_mul(vector signed short __a, vector signed short __b) {
4340  return __a * __b;
4341}
4342
4343static __inline__ vector unsigned short __ATTRS_o_ai
4344vec_mul(vector unsigned short __a, vector unsigned short __b) {
4345  return __a * __b;
4346}
4347
4348static __inline__ vector signed int __ATTRS_o_ai
4349vec_mul(vector signed int __a, vector signed int __b) {
4350  return __a * __b;
4351}
4352
4353static __inline__ vector unsigned int __ATTRS_o_ai
4354vec_mul(vector unsigned int __a, vector unsigned int __b) {
4355  return __a * __b;
4356}
4357
4358#ifdef __VSX__
4359static __inline__ vector signed long long __ATTRS_o_ai
4360vec_mul(vector signed long long __a, vector signed long long __b) {
4361  return __a * __b;
4362}
4363
4364static __inline__ vector unsigned long long __ATTRS_o_ai
4365vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
4366  return __a * __b;
4367}
4368#endif
4369
4370static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
4371                                                    vector float __b) {
4372  return __a * __b;
4373}
4374
4375#ifdef __VSX__
4376static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
4377                                                     vector double __b) {
4378  return __a * __b;
4379}
4380#endif
4381
4382/* The vmulos* and vmules* instructions have a big endian bias, so
4383   we must reverse the meaning of "even" and "odd" for little endian.  */
4384
4385/* vec_mule */
4386
4387static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
4388                                                     vector signed char __b) {
4389#ifdef __LITTLE_ENDIAN__
4390  return __builtin_altivec_vmulosb(__a, __b);
4391#else
4392  return __builtin_altivec_vmulesb(__a, __b);
4393#endif
4394}
4395
4396static __inline__ vector unsigned short __ATTRS_o_ai
4397vec_mule(vector unsigned char __a, vector unsigned char __b) {
4398#ifdef __LITTLE_ENDIAN__
4399  return __builtin_altivec_vmuloub(__a, __b);
4400#else
4401  return __builtin_altivec_vmuleub(__a, __b);
4402#endif
4403}
4404
4405static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
4406                                                   vector short __b) {
4407#ifdef __LITTLE_ENDIAN__
4408  return __builtin_altivec_vmulosh(__a, __b);
4409#else
4410  return __builtin_altivec_vmulesh(__a, __b);
4411#endif
4412}
4413
4414static __inline__ vector unsigned int __ATTRS_o_ai
4415vec_mule(vector unsigned short __a, vector unsigned short __b) {
4416#ifdef __LITTLE_ENDIAN__
4417  return __builtin_altivec_vmulouh(__a, __b);
4418#else
4419  return __builtin_altivec_vmuleuh(__a, __b);
4420#endif
4421}
4422
4423#ifdef __POWER8_VECTOR__
4424static __inline__ vector signed long long __ATTRS_o_ai
4425vec_mule(vector signed int __a, vector signed int __b) {
4426#ifdef __LITTLE_ENDIAN__
4427  return __builtin_altivec_vmulosw(__a, __b);
4428#else
4429  return __builtin_altivec_vmulesw(__a, __b);
4430#endif
4431}
4432
4433static __inline__ vector unsigned long long __ATTRS_o_ai
4434vec_mule(vector unsigned int __a, vector unsigned int __b) {
4435#ifdef __LITTLE_ENDIAN__
4436  return __builtin_altivec_vmulouw(__a, __b);
4437#else
4438  return __builtin_altivec_vmuleuw(__a, __b);
4439#endif
4440}
4441#endif
4442
4443/* vec_vmulesb */
4444
4445static __inline__ vector short __attribute__((__always_inline__))
4446vec_vmulesb(vector signed char __a, vector signed char __b) {
4447#ifdef __LITTLE_ENDIAN__
4448  return __builtin_altivec_vmulosb(__a, __b);
4449#else
4450  return __builtin_altivec_vmulesb(__a, __b);
4451#endif
4452}
4453
4454/* vec_vmuleub */
4455
4456static __inline__ vector unsigned short __attribute__((__always_inline__))
4457vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
4458#ifdef __LITTLE_ENDIAN__
4459  return __builtin_altivec_vmuloub(__a, __b);
4460#else
4461  return __builtin_altivec_vmuleub(__a, __b);
4462#endif
4463}
4464
4465/* vec_vmulesh */
4466
4467static __inline__ vector int __attribute__((__always_inline__))
4468vec_vmulesh(vector short __a, vector short __b) {
4469#ifdef __LITTLE_ENDIAN__
4470  return __builtin_altivec_vmulosh(__a, __b);
4471#else
4472  return __builtin_altivec_vmulesh(__a, __b);
4473#endif
4474}
4475
4476/* vec_vmuleuh */
4477
4478static __inline__ vector unsigned int __attribute__((__always_inline__))
4479vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
4480#ifdef __LITTLE_ENDIAN__
4481  return __builtin_altivec_vmulouh(__a, __b);
4482#else
4483  return __builtin_altivec_vmuleuh(__a, __b);
4484#endif
4485}
4486
4487/* vec_mulo */
4488
4489static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
4490                                                     vector signed char __b) {
4491#ifdef __LITTLE_ENDIAN__
4492  return __builtin_altivec_vmulesb(__a, __b);
4493#else
4494  return __builtin_altivec_vmulosb(__a, __b);
4495#endif
4496}
4497
4498static __inline__ vector unsigned short __ATTRS_o_ai
4499vec_mulo(vector unsigned char __a, vector unsigned char __b) {
4500#ifdef __LITTLE_ENDIAN__
4501  return __builtin_altivec_vmuleub(__a, __b);
4502#else
4503  return __builtin_altivec_vmuloub(__a, __b);
4504#endif
4505}
4506
4507static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
4508                                                   vector short __b) {
4509#ifdef __LITTLE_ENDIAN__
4510  return __builtin_altivec_vmulesh(__a, __b);
4511#else
4512  return __builtin_altivec_vmulosh(__a, __b);
4513#endif
4514}
4515
4516static __inline__ vector unsigned int __ATTRS_o_ai
4517vec_mulo(vector unsigned short __a, vector unsigned short __b) {
4518#ifdef __LITTLE_ENDIAN__
4519  return __builtin_altivec_vmuleuh(__a, __b);
4520#else
4521  return __builtin_altivec_vmulouh(__a, __b);
4522#endif
4523}
4524
4525#ifdef __POWER8_VECTOR__
4526static __inline__ vector signed long long __ATTRS_o_ai
4527vec_mulo(vector signed int __a, vector signed int __b) {
4528#ifdef __LITTLE_ENDIAN__
4529  return __builtin_altivec_vmulesw(__a, __b);
4530#else
4531  return __builtin_altivec_vmulosw(__a, __b);
4532#endif
4533}
4534
4535static __inline__ vector unsigned long long __ATTRS_o_ai
4536vec_mulo(vector unsigned int __a, vector unsigned int __b) {
4537#ifdef __LITTLE_ENDIAN__
4538  return __builtin_altivec_vmuleuw(__a, __b);
4539#else
4540  return __builtin_altivec_vmulouw(__a, __b);
4541#endif
4542}
4543#endif
4544
4545/* vec_vmulosb */
4546
4547static __inline__ vector short __attribute__((__always_inline__))
4548vec_vmulosb(vector signed char __a, vector signed char __b) {
4549#ifdef __LITTLE_ENDIAN__
4550  return __builtin_altivec_vmulesb(__a, __b);
4551#else
4552  return __builtin_altivec_vmulosb(__a, __b);
4553#endif
4554}
4555
4556/* vec_vmuloub */
4557
4558static __inline__ vector unsigned short __attribute__((__always_inline__))
4559vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
4560#ifdef __LITTLE_ENDIAN__
4561  return __builtin_altivec_vmuleub(__a, __b);
4562#else
4563  return __builtin_altivec_vmuloub(__a, __b);
4564#endif
4565}
4566
4567/* vec_vmulosh */
4568
4569static __inline__ vector int __attribute__((__always_inline__))
4570vec_vmulosh(vector short __a, vector short __b) {
4571#ifdef __LITTLE_ENDIAN__
4572  return __builtin_altivec_vmulesh(__a, __b);
4573#else
4574  return __builtin_altivec_vmulosh(__a, __b);
4575#endif
4576}
4577
4578/* vec_vmulouh */
4579
4580static __inline__ vector unsigned int __attribute__((__always_inline__))
4581vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
4582#ifdef __LITTLE_ENDIAN__
4583  return __builtin_altivec_vmuleuh(__a, __b);
4584#else
4585  return __builtin_altivec_vmulouh(__a, __b);
4586#endif
4587}
4588
4589/*  vec_nand */
4590
4591#ifdef __POWER8_VECTOR__
4592static __inline__ vector signed char __ATTRS_o_ai
4593vec_nand(vector signed char __a, vector signed char __b) {
4594  return ~(__a & __b);
4595}
4596
4597static __inline__ vector signed char __ATTRS_o_ai
4598vec_nand(vector signed char __a, vector bool char __b) {
4599  return ~(__a & __b);
4600}
4601
4602static __inline__ vector signed char __ATTRS_o_ai
4603vec_nand(vector bool char __a, vector signed char __b) {
4604  return ~(__a & __b);
4605}
4606
4607static __inline__ vector unsigned char __ATTRS_o_ai
4608vec_nand(vector unsigned char __a, vector unsigned char __b) {
4609  return ~(__a & __b);
4610}
4611
4612static __inline__ vector unsigned char __ATTRS_o_ai
4613vec_nand(vector unsigned char __a, vector bool char __b) {
4614  return ~(__a & __b);
4615}
4616
4617static __inline__ vector unsigned char __ATTRS_o_ai
4618vec_nand(vector bool char __a, vector unsigned char __b) {
4619  return ~(__a & __b);
4620}
4621
4622static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
4623                                                         vector bool char __b) {
4624  return ~(__a & __b);
4625}
4626
4627static __inline__ vector signed short __ATTRS_o_ai
4628vec_nand(vector signed short __a, vector signed short __b) {
4629  return ~(__a & __b);
4630}
4631
4632static __inline__ vector signed short __ATTRS_o_ai
4633vec_nand(vector signed short __a, vector bool short __b) {
4634  return ~(__a & __b);
4635}
4636
4637static __inline__ vector signed short __ATTRS_o_ai
4638vec_nand(vector bool short __a, vector signed short __b) {
4639  return ~(__a & __b);
4640}
4641
4642static __inline__ vector unsigned short __ATTRS_o_ai
4643vec_nand(vector unsigned short __a, vector unsigned short __b) {
4644  return ~(__a & __b);
4645}
4646
4647static __inline__ vector unsigned short __ATTRS_o_ai
4648vec_nand(vector unsigned short __a, vector bool short __b) {
4649  return ~(__a & __b);
4650}
4651
4652static __inline__ vector bool short __ATTRS_o_ai
4653vec_nand(vector bool short __a, vector bool short __b) {
4654  return ~(__a & __b);
4655}
4656
4657static __inline__ vector signed int __ATTRS_o_ai
4658vec_nand(vector signed int __a, vector signed int __b) {
4659  return ~(__a & __b);
4660}
4661
4662static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4663                                                          vector bool int __b) {
4664  return ~(__a & __b);
4665}
4666
4667static __inline__ vector signed int __ATTRS_o_ai
4668vec_nand(vector bool int __a, vector signed int __b) {
4669  return ~(__a & __b);
4670}
4671
4672static __inline__ vector unsigned int __ATTRS_o_ai
4673vec_nand(vector unsigned int __a, vector unsigned int __b) {
4674  return ~(__a & __b);
4675}
4676
4677static __inline__ vector unsigned int __ATTRS_o_ai
4678vec_nand(vector unsigned int __a, vector bool int __b) {
4679  return ~(__a & __b);
4680}
4681
4682static __inline__ vector unsigned int __ATTRS_o_ai
4683vec_nand(vector bool int __a, vector unsigned int __b) {
4684  return ~(__a & __b);
4685}
4686
4687static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
4688                                                        vector bool int __b) {
4689  return ~(__a & __b);
4690}
4691
4692static __inline__ vector signed long long __ATTRS_o_ai
4693vec_nand(vector signed long long __a, vector signed long long __b) {
4694  return ~(__a & __b);
4695}
4696
4697static __inline__ vector signed long long __ATTRS_o_ai
4698vec_nand(vector signed long long __a, vector bool long long __b) {
4699  return ~(__a & __b);
4700}
4701
4702static __inline__ vector signed long long __ATTRS_o_ai
4703vec_nand(vector bool long long __a, vector signed long long __b) {
4704  return ~(__a & __b);
4705}
4706
4707static __inline__ vector unsigned long long __ATTRS_o_ai
4708vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
4709  return ~(__a & __b);
4710}
4711
4712static __inline__ vector unsigned long long __ATTRS_o_ai
4713vec_nand(vector unsigned long long __a, vector bool long long __b) {
4714  return ~(__a & __b);
4715}
4716
4717static __inline__ vector unsigned long long __ATTRS_o_ai
4718vec_nand(vector bool long long __a, vector unsigned long long __b) {
4719  return ~(__a & __b);
4720}
4721
4722static __inline__ vector bool long long __ATTRS_o_ai
4723vec_nand(vector bool long long __a, vector bool long long __b) {
4724  return ~(__a & __b);
4725}
4726
4727#endif
4728
4729/* vec_nmadd */
4730
4731#ifdef __VSX__
4732static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
4733                                                      vector float __b,
4734                                                      vector float __c) {
4735  return __builtin_vsx_xvnmaddasp(__a, __b, __c);
4736}
4737
4738static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
4739                                                       vector double __b,
4740                                                       vector double __c) {
4741  return __builtin_vsx_xvnmaddadp(__a, __b, __c);
4742}
4743#endif
4744
4745/* vec_nmsub */
4746
4747static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
4748                                                      vector float __b,
4749                                                      vector float __c) {
4750#ifdef __VSX__
4751  return __builtin_vsx_xvnmsubasp(__a, __b, __c);
4752#else
4753  return __builtin_altivec_vnmsubfp(__a, __b, __c);
4754#endif
4755}
4756
4757#ifdef __VSX__
4758static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
4759                                                       vector double __b,
4760                                                       vector double __c) {
4761  return __builtin_vsx_xvnmsubadp(__a, __b, __c);
4762}
4763#endif
4764
4765/* vec_vnmsubfp */
4766
4767static __inline__ vector float __attribute__((__always_inline__))
4768vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
4769  return __builtin_altivec_vnmsubfp(__a, __b, __c);
4770}
4771
4772/* vec_nor */
4773
4774#define __builtin_altivec_vnor vec_nor
4775
4776static __inline__ vector signed char __ATTRS_o_ai
4777vec_nor(vector signed char __a, vector signed char __b) {
4778  return ~(__a | __b);
4779}
4780
4781static __inline__ vector unsigned char __ATTRS_o_ai
4782vec_nor(vector unsigned char __a, vector unsigned char __b) {
4783  return ~(__a | __b);
4784}
4785
4786static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
4787                                                        vector bool char __b) {
4788  return ~(__a | __b);
4789}
4790
4791static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
4792                                                    vector short __b) {
4793  return ~(__a | __b);
4794}
4795
4796static __inline__ vector unsigned short __ATTRS_o_ai
4797vec_nor(vector unsigned short __a, vector unsigned short __b) {
4798  return ~(__a | __b);
4799}
4800
4801static __inline__ vector bool short __ATTRS_o_ai
4802vec_nor(vector bool short __a, vector bool short __b) {
4803  return ~(__a | __b);
4804}
4805
4806static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
4807                                                  vector int __b) {
4808  return ~(__a | __b);
4809}
4810
4811static __inline__ vector unsigned int __ATTRS_o_ai
4812vec_nor(vector unsigned int __a, vector unsigned int __b) {
4813  return ~(__a | __b);
4814}
4815
4816static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
4817                                                       vector bool int __b) {
4818  return ~(__a | __b);
4819}
4820
4821static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
4822                                                    vector float __b) {
4823  vector unsigned int __res =
4824      ~((vector unsigned int)__a | (vector unsigned int)__b);
4825  return (vector float)__res;
4826}
4827
4828#ifdef __VSX__
4829static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
4830                                                     vector double __b) {
4831  vector unsigned long long __res =
4832      ~((vector unsigned long long)__a | (vector unsigned long long)__b);
4833  return (vector double)__res;
4834}
4835#endif
4836
4837/* vec_vnor */
4838
4839static __inline__ vector signed char __ATTRS_o_ai
4840vec_vnor(vector signed char __a, vector signed char __b) {
4841  return ~(__a | __b);
4842}
4843
4844static __inline__ vector unsigned char __ATTRS_o_ai
4845vec_vnor(vector unsigned char __a, vector unsigned char __b) {
4846  return ~(__a | __b);
4847}
4848
4849static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
4850                                                         vector bool char __b) {
4851  return ~(__a | __b);
4852}
4853
4854static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
4855                                                     vector short __b) {
4856  return ~(__a | __b);
4857}
4858
4859static __inline__ vector unsigned short __ATTRS_o_ai
4860vec_vnor(vector unsigned short __a, vector unsigned short __b) {
4861  return ~(__a | __b);
4862}
4863
4864static __inline__ vector bool short __ATTRS_o_ai
4865vec_vnor(vector bool short __a, vector bool short __b) {
4866  return ~(__a | __b);
4867}
4868
4869static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
4870                                                   vector int __b) {
4871  return ~(__a | __b);
4872}
4873
4874static __inline__ vector unsigned int __ATTRS_o_ai
4875vec_vnor(vector unsigned int __a, vector unsigned int __b) {
4876  return ~(__a | __b);
4877}
4878
4879static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
4880                                                        vector bool int __b) {
4881  return ~(__a | __b);
4882}
4883
4884static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
4885                                                     vector float __b) {
4886  vector unsigned int __res =
4887      ~((vector unsigned int)__a | (vector unsigned int)__b);
4888  return (vector float)__res;
4889}
4890
4891#ifdef __VSX__
4892static __inline__ vector signed long long __ATTRS_o_ai
4893vec_nor(vector signed long long __a, vector signed long long __b) {
4894  return ~(__a | __b);
4895}
4896
4897static __inline__ vector unsigned long long __ATTRS_o_ai
4898vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
4899  return ~(__a | __b);
4900}
4901
4902static __inline__ vector bool long long __ATTRS_o_ai
4903vec_nor(vector bool long long __a, vector bool long long __b) {
4904  return ~(__a | __b);
4905}
4906#endif
4907
4908/* vec_or */
4909
4910#define __builtin_altivec_vor vec_or
4911
4912static __inline__ vector signed char __ATTRS_o_ai
4913vec_or(vector signed char __a, vector signed char __b) {
4914  return __a | __b;
4915}
4916
4917static __inline__ vector signed char __ATTRS_o_ai
4918vec_or(vector bool char __a, vector signed char __b) {
4919  return (vector signed char)__a | __b;
4920}
4921
4922static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4923                                                         vector bool char __b) {
4924  return __a | (vector signed char)__b;
4925}
4926
4927static __inline__ vector unsigned char __ATTRS_o_ai
4928vec_or(vector unsigned char __a, vector unsigned char __b) {
4929  return __a | __b;
4930}
4931
4932static __inline__ vector unsigned char __ATTRS_o_ai
4933vec_or(vector bool char __a, vector unsigned char __b) {
4934  return (vector unsigned char)__a | __b;
4935}
4936
4937static __inline__ vector unsigned char __ATTRS_o_ai
4938vec_or(vector unsigned char __a, vector bool char __b) {
4939  return __a | (vector unsigned char)__b;
4940}
4941
4942static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4943                                                       vector bool char __b) {
4944  return __a | __b;
4945}
4946
4947static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
4948                                                   vector short __b) {
4949  return __a | __b;
4950}
4951
4952static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
4953                                                   vector short __b) {
4954  return (vector short)__a | __b;
4955}
4956
4957static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
4958                                                   vector bool short __b) {
4959  return __a | (vector short)__b;
4960}
4961
4962static __inline__ vector unsigned short __ATTRS_o_ai
4963vec_or(vector unsigned short __a, vector unsigned short __b) {
4964  return __a | __b;
4965}
4966
4967static __inline__ vector unsigned short __ATTRS_o_ai
4968vec_or(vector bool short __a, vector unsigned short __b) {
4969  return (vector unsigned short)__a | __b;
4970}
4971
4972static __inline__ vector unsigned short __ATTRS_o_ai
4973vec_or(vector unsigned short __a, vector bool short __b) {
4974  return __a | (vector unsigned short)__b;
4975}
4976
4977static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4978                                                        vector bool short __b) {
4979  return __a | __b;
4980}
4981
4982static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
4983                                                 vector int __b) {
4984  return __a | __b;
4985}
4986
4987static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
4988                                                 vector int __b) {
4989  return (vector int)__a | __b;
4990}
4991
4992static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
4993                                                 vector bool int __b) {
4994  return __a | (vector int)__b;
4995}
4996
4997static __inline__ vector unsigned int __ATTRS_o_ai
4998vec_or(vector unsigned int __a, vector unsigned int __b) {
4999  return __a | __b;
5000}
5001
5002static __inline__ vector unsigned int __ATTRS_o_ai
5003vec_or(vector bool int __a, vector unsigned int __b) {
5004  return (vector unsigned int)__a | __b;
5005}
5006
5007static __inline__ vector unsigned int __ATTRS_o_ai
5008vec_or(vector unsigned int __a, vector bool int __b) {
5009  return __a | (vector unsigned int)__b;
5010}
5011
5012static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
5013                                                      vector bool int __b) {
5014  return __a | __b;
5015}
5016
5017static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5018                                                   vector float __b) {
5019  vector unsigned int __res =
5020      (vector unsigned int)__a | (vector unsigned int)__b;
5021  return (vector float)__res;
5022}
5023
5024static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
5025                                                   vector float __b) {
5026  vector unsigned int __res =
5027      (vector unsigned int)__a | (vector unsigned int)__b;
5028  return (vector float)__res;
5029}
5030
5031static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5032                                                   vector bool int __b) {
5033  vector unsigned int __res =
5034      (vector unsigned int)__a | (vector unsigned int)__b;
5035  return (vector float)__res;
5036}
5037
5038#ifdef __VSX__
5039static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
5040                                                    vector double __b) {
5041  return (vector unsigned long long)__a | (vector unsigned long long)__b;
5042}
5043
5044static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5045                                                    vector bool long long __b) {
5046  return (vector unsigned long long)__a | (vector unsigned long long)__b;
5047}
5048
5049static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5050                                                    vector double __b) {
5051  vector unsigned long long __res =
5052      (vector unsigned long long)__a | (vector unsigned long long)__b;
5053  return (vector double)__res;
5054}
5055
5056static __inline__ vector signed long long __ATTRS_o_ai
5057vec_or(vector signed long long __a, vector signed long long __b) {
5058  return __a | __b;
5059}
5060
5061static __inline__ vector signed long long __ATTRS_o_ai
5062vec_or(vector bool long long __a, vector signed long long __b) {
5063  return (vector signed long long)__a | __b;
5064}
5065
5066static __inline__ vector signed long long __ATTRS_o_ai
5067vec_or(vector signed long long __a, vector bool long long __b) {
5068  return __a | (vector signed long long)__b;
5069}
5070
5071static __inline__ vector unsigned long long __ATTRS_o_ai
5072vec_or(vector unsigned long long __a, vector unsigned long long __b) {
5073  return __a | __b;
5074}
5075
5076static __inline__ vector unsigned long long __ATTRS_o_ai
5077vec_or(vector bool long long __a, vector unsigned long long __b) {
5078  return (vector unsigned long long)__a | __b;
5079}
5080
5081static __inline__ vector unsigned long long __ATTRS_o_ai
5082vec_or(vector unsigned long long __a, vector bool long long __b) {
5083  return __a | (vector unsigned long long)__b;
5084}
5085
5086static __inline__ vector bool long long __ATTRS_o_ai
5087vec_or(vector bool long long __a, vector bool long long __b) {
5088  return __a | __b;
5089}
5090#endif
5091
5092#ifdef __POWER8_VECTOR__
5093static __inline__ vector signed char __ATTRS_o_ai
5094vec_orc(vector signed char __a, vector signed char __b) {
5095  return __a | ~__b;
5096}
5097
5098static __inline__ vector signed char __ATTRS_o_ai
5099vec_orc(vector signed char __a, vector bool char __b) {
5100  return __a | ~__b;
5101}
5102
5103static __inline__ vector signed char __ATTRS_o_ai
5104vec_orc(vector bool char __a, vector signed char __b) {
5105  return __a | ~__b;
5106}
5107
5108static __inline__ vector unsigned char __ATTRS_o_ai
5109vec_orc(vector unsigned char __a, vector unsigned char __b) {
5110  return __a | ~__b;
5111}
5112
5113static __inline__ vector unsigned char __ATTRS_o_ai
5114vec_orc(vector unsigned char __a, vector bool char __b) {
5115  return __a | ~__b;
5116}
5117
5118static __inline__ vector unsigned char __ATTRS_o_ai
5119vec_orc(vector bool char __a, vector unsigned char __b) {
5120  return __a | ~__b;
5121}
5122
5123static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
5124                                                        vector bool char __b) {
5125  return __a | ~__b;
5126}
5127
5128static __inline__ vector signed short __ATTRS_o_ai
5129vec_orc(vector signed short __a, vector signed short __b) {
5130  return __a | ~__b;
5131}
5132
5133static __inline__ vector signed short __ATTRS_o_ai
5134vec_orc(vector signed short __a, vector bool short __b) {
5135  return __a | ~__b;
5136}
5137
5138static __inline__ vector signed short __ATTRS_o_ai
5139vec_orc(vector bool short __a, vector signed short __b) {
5140  return __a | ~__b;
5141}
5142
5143static __inline__ vector unsigned short __ATTRS_o_ai
5144vec_orc(vector unsigned short __a, vector unsigned short __b) {
5145  return __a | ~__b;
5146}
5147
5148static __inline__ vector unsigned short __ATTRS_o_ai
5149vec_orc(vector unsigned short __a, vector bool short __b) {
5150  return __a | ~__b;
5151}
5152
5153static __inline__ vector unsigned short __ATTRS_o_ai
5154vec_orc(vector bool short __a, vector unsigned short __b) {
5155  return __a | ~__b;
5156}
5157
5158static __inline__ vector bool short __ATTRS_o_ai
5159vec_orc(vector bool short __a, vector bool short __b) {
5160  return __a | ~__b;
5161}
5162
5163static __inline__ vector signed int __ATTRS_o_ai
5164vec_orc(vector signed int __a, vector signed int __b) {
5165  return __a | ~__b;
5166}
5167
5168static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5169                                                         vector bool int __b) {
5170  return __a | ~__b;
5171}
5172
5173static __inline__ vector signed int __ATTRS_o_ai
5174vec_orc(vector bool int __a, vector signed int __b) {
5175  return __a | ~__b;
5176}
5177
5178static __inline__ vector unsigned int __ATTRS_o_ai
5179vec_orc(vector unsigned int __a, vector unsigned int __b) {
5180  return __a | ~__b;
5181}
5182
5183static __inline__ vector unsigned int __ATTRS_o_ai
5184vec_orc(vector unsigned int __a, vector bool int __b) {
5185  return __a | ~__b;
5186}
5187
5188static __inline__ vector unsigned int __ATTRS_o_ai
5189vec_orc(vector bool int __a, vector unsigned int __b) {
5190  return __a | ~__b;
5191}
5192
5193static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
5194                                                       vector bool int __b) {
5195  return __a | ~__b;
5196}
5197
5198static __inline__ vector signed long long __ATTRS_o_ai
5199vec_orc(vector signed long long __a, vector signed long long __b) {
5200  return __a | ~__b;
5201}
5202
5203static __inline__ vector signed long long __ATTRS_o_ai
5204vec_orc(vector signed long long __a, vector bool long long __b) {
5205  return __a | ~__b;
5206}
5207
5208static __inline__ vector signed long long __ATTRS_o_ai
5209vec_orc(vector bool long long __a, vector signed long long __b) {
5210  return __a | ~__b;
5211}
5212
5213static __inline__ vector unsigned long long __ATTRS_o_ai
5214vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
5215  return __a | ~__b;
5216}
5217
5218static __inline__ vector unsigned long long __ATTRS_o_ai
5219vec_orc(vector unsigned long long __a, vector bool long long __b) {
5220  return __a | ~__b;
5221}
5222
5223static __inline__ vector unsigned long long __ATTRS_o_ai
5224vec_orc(vector bool long long __a, vector unsigned long long __b) {
5225  return __a | ~__b;
5226}
5227
5228static __inline__ vector bool long long __ATTRS_o_ai
5229vec_orc(vector bool long long __a, vector bool long long __b) {
5230  return __a | ~__b;
5231}
5232#endif
5233
5234/* vec_vor */
5235
5236static __inline__ vector signed char __ATTRS_o_ai
5237vec_vor(vector signed char __a, vector signed char __b) {
5238  return __a | __b;
5239}
5240
5241static __inline__ vector signed char __ATTRS_o_ai
5242vec_vor(vector bool char __a, vector signed char __b) {
5243  return (vector signed char)__a | __b;
5244}
5245
5246static __inline__ vector signed char __ATTRS_o_ai
5247vec_vor(vector signed char __a, vector bool char __b) {
5248  return __a | (vector signed char)__b;
5249}
5250
5251static __inline__ vector unsigned char __ATTRS_o_ai
5252vec_vor(vector unsigned char __a, vector unsigned char __b) {
5253  return __a | __b;
5254}
5255
5256static __inline__ vector unsigned char __ATTRS_o_ai
5257vec_vor(vector bool char __a, vector unsigned char __b) {
5258  return (vector unsigned char)__a | __b;
5259}
5260
5261static __inline__ vector unsigned char __ATTRS_o_ai
5262vec_vor(vector unsigned char __a, vector bool char __b) {
5263  return __a | (vector unsigned char)__b;
5264}
5265
5266static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
5267                                                        vector bool char __b) {
5268  return __a | __b;
5269}
5270
5271static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
5272                                                    vector short __b) {
5273  return __a | __b;
5274}
5275
5276static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
5277                                                    vector short __b) {
5278  return (vector short)__a | __b;
5279}
5280
5281static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
5282                                                    vector bool short __b) {
5283  return __a | (vector short)__b;
5284}
5285
5286static __inline__ vector unsigned short __ATTRS_o_ai
5287vec_vor(vector unsigned short __a, vector unsigned short __b) {
5288  return __a | __b;
5289}
5290
5291static __inline__ vector unsigned short __ATTRS_o_ai
5292vec_vor(vector bool short __a, vector unsigned short __b) {
5293  return (vector unsigned short)__a | __b;
5294}
5295
5296static __inline__ vector unsigned short __ATTRS_o_ai
5297vec_vor(vector unsigned short __a, vector bool short __b) {
5298  return __a | (vector unsigned short)__b;
5299}
5300
5301static __inline__ vector bool short __ATTRS_o_ai
5302vec_vor(vector bool short __a, vector bool short __b) {
5303  return __a | __b;
5304}
5305
5306static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
5307                                                  vector int __b) {
5308  return __a | __b;
5309}
5310
5311static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
5312                                                  vector int __b) {
5313  return (vector int)__a | __b;
5314}
5315
5316static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
5317                                                  vector bool int __b) {
5318  return __a | (vector int)__b;
5319}
5320
5321static __inline__ vector unsigned int __ATTRS_o_ai
5322vec_vor(vector unsigned int __a, vector unsigned int __b) {
5323  return __a | __b;
5324}
5325
5326static __inline__ vector unsigned int __ATTRS_o_ai
5327vec_vor(vector bool int __a, vector unsigned int __b) {
5328  return (vector unsigned int)__a | __b;
5329}
5330
5331static __inline__ vector unsigned int __ATTRS_o_ai
5332vec_vor(vector unsigned int __a, vector bool int __b) {
5333  return __a | (vector unsigned int)__b;
5334}
5335
5336static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
5337                                                       vector bool int __b) {
5338  return __a | __b;
5339}
5340
5341static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
5342                                                    vector float __b) {
5343  vector unsigned int __res =
5344      (vector unsigned int)__a | (vector unsigned int)__b;
5345  return (vector float)__res;
5346}
5347
5348static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
5349                                                    vector float __b) {
5350  vector unsigned int __res =
5351      (vector unsigned int)__a | (vector unsigned int)__b;
5352  return (vector float)__res;
5353}
5354
5355static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
5356                                                    vector bool int __b) {
5357  vector unsigned int __res =
5358      (vector unsigned int)__a | (vector unsigned int)__b;
5359  return (vector float)__res;
5360}
5361
5362#ifdef __VSX__
5363static __inline__ vector signed long long __ATTRS_o_ai
5364vec_vor(vector signed long long __a, vector signed long long __b) {
5365  return __a | __b;
5366}
5367
5368static __inline__ vector signed long long __ATTRS_o_ai
5369vec_vor(vector bool long long __a, vector signed long long __b) {
5370  return (vector signed long long)__a | __b;
5371}
5372
5373static __inline__ vector signed long long __ATTRS_o_ai
5374vec_vor(vector signed long long __a, vector bool long long __b) {
5375  return __a | (vector signed long long)__b;
5376}
5377
5378static __inline__ vector unsigned long long __ATTRS_o_ai
5379vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
5380  return __a | __b;
5381}
5382
5383static __inline__ vector unsigned long long __ATTRS_o_ai
5384vec_vor(vector bool long long __a, vector unsigned long long __b) {
5385  return (vector unsigned long long)__a | __b;
5386}
5387
5388static __inline__ vector unsigned long long __ATTRS_o_ai
5389vec_vor(vector unsigned long long __a, vector bool long long __b) {
5390  return __a | (vector unsigned long long)__b;
5391}
5392
5393static __inline__ vector bool long long __ATTRS_o_ai
5394vec_vor(vector bool long long __a, vector bool long long __b) {
5395  return __a | __b;
5396}
5397#endif
5398
5399/* vec_pack */
5400
5401/* The various vector pack instructions have a big-endian bias, so for
5402   little endian we must handle reversed element numbering.  */
5403
5404static __inline__ vector signed char __ATTRS_o_ai
5405vec_pack(vector signed short __a, vector signed short __b) {
5406#ifdef __LITTLE_ENDIAN__
5407  return (vector signed char)vec_perm(
5408      __a, __b,
5409      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5410                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5411#else
5412  return (vector signed char)vec_perm(
5413      __a, __b,
5414      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5415                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5416#endif
5417}
5418
5419static __inline__ vector unsigned char __ATTRS_o_ai
5420vec_pack(vector unsigned short __a, vector unsigned short __b) {
5421#ifdef __LITTLE_ENDIAN__
5422  return (vector unsigned char)vec_perm(
5423      __a, __b,
5424      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5425                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5426#else
5427  return (vector unsigned char)vec_perm(
5428      __a, __b,
5429      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5430                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5431#endif
5432}
5433
5434static __inline__ vector bool char __ATTRS_o_ai
5435vec_pack(vector bool short __a, vector bool short __b) {
5436#ifdef __LITTLE_ENDIAN__
5437  return (vector bool char)vec_perm(
5438      __a, __b,
5439      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5440                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5441#else
5442  return (vector bool char)vec_perm(
5443      __a, __b,
5444      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5445                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5446#endif
5447}
5448
5449static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
5450                                                     vector int __b) {
5451#ifdef __LITTLE_ENDIAN__
5452  return (vector short)vec_perm(
5453      __a, __b,
5454      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5455                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5456#else
5457  return (vector short)vec_perm(
5458      __a, __b,
5459      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5460                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5461#endif
5462}
5463
5464static __inline__ vector unsigned short __ATTRS_o_ai
5465vec_pack(vector unsigned int __a, vector unsigned int __b) {
5466#ifdef __LITTLE_ENDIAN__
5467  return (vector unsigned short)vec_perm(
5468      __a, __b,
5469      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5470                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5471#else
5472  return (vector unsigned short)vec_perm(
5473      __a, __b,
5474      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5475                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5476#endif
5477}
5478
5479static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
5480                                                          vector bool int __b) {
5481#ifdef __LITTLE_ENDIAN__
5482  return (vector bool short)vec_perm(
5483      __a, __b,
5484      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5485                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5486#else
5487  return (vector bool short)vec_perm(
5488      __a, __b,
5489      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5490                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5491#endif
5492}
5493
5494#ifdef __VSX__
5495static __inline__ vector signed int __ATTRS_o_ai
5496vec_pack(vector signed long long __a, vector signed long long __b) {
5497#ifdef __LITTLE_ENDIAN__
5498  return (vector signed int)vec_perm(
5499      __a, __b,
5500      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5501                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5502#else
5503  return (vector signed int)vec_perm(
5504      __a, __b,
5505      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5506                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5507#endif
5508}
5509static __inline__ vector unsigned int __ATTRS_o_ai
5510vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
5511#ifdef __LITTLE_ENDIAN__
5512  return (vector unsigned int)vec_perm(
5513      __a, __b,
5514      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5515                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5516#else
5517  return (vector unsigned int)vec_perm(
5518      __a, __b,
5519      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5520                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5521#endif
5522}
5523
5524static __inline__ vector bool int __ATTRS_o_ai
5525vec_pack(vector bool long long __a, vector bool long long __b) {
5526#ifdef __LITTLE_ENDIAN__
5527  return (vector bool int)vec_perm(
5528      __a, __b,
5529      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5530                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5531#else
5532  return (vector bool int)vec_perm(
5533      __a, __b,
5534      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5535                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5536#endif
5537}
5538
5539#endif
5540
5541/* vec_vpkuhum */
5542
5543#define __builtin_altivec_vpkuhum vec_vpkuhum
5544
5545static __inline__ vector signed char __ATTRS_o_ai
5546vec_vpkuhum(vector signed short __a, vector signed short __b) {
5547#ifdef __LITTLE_ENDIAN__
5548  return (vector signed char)vec_perm(
5549      __a, __b,
5550      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5551                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5552#else
5553  return (vector signed char)vec_perm(
5554      __a, __b,
5555      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5556                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5557#endif
5558}
5559
5560static __inline__ vector unsigned char __ATTRS_o_ai
5561vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
5562#ifdef __LITTLE_ENDIAN__
5563  return (vector unsigned char)vec_perm(
5564      __a, __b,
5565      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5566                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5567#else
5568  return (vector unsigned char)vec_perm(
5569      __a, __b,
5570      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5571                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5572#endif
5573}
5574
5575static __inline__ vector bool char __ATTRS_o_ai
5576vec_vpkuhum(vector bool short __a, vector bool short __b) {
5577#ifdef __LITTLE_ENDIAN__
5578  return (vector bool char)vec_perm(
5579      __a, __b,
5580      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5581                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5582#else
5583  return (vector bool char)vec_perm(
5584      __a, __b,
5585      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5586                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5587#endif
5588}
5589
5590/* vec_vpkuwum */
5591
5592#define __builtin_altivec_vpkuwum vec_vpkuwum
5593
5594static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
5595                                                        vector int __b) {
5596#ifdef __LITTLE_ENDIAN__
5597  return (vector short)vec_perm(
5598      __a, __b,
5599      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5600                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5601#else
5602  return (vector short)vec_perm(
5603      __a, __b,
5604      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5605                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5606#endif
5607}
5608
5609static __inline__ vector unsigned short __ATTRS_o_ai
5610vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
5611#ifdef __LITTLE_ENDIAN__
5612  return (vector unsigned short)vec_perm(
5613      __a, __b,
5614      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5615                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5616#else
5617  return (vector unsigned short)vec_perm(
5618      __a, __b,
5619      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5620                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5621#endif
5622}
5623
5624static __inline__ vector bool short __ATTRS_o_ai
5625vec_vpkuwum(vector bool int __a, vector bool int __b) {
5626#ifdef __LITTLE_ENDIAN__
5627  return (vector bool short)vec_perm(
5628      __a, __b,
5629      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5630                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5631#else
5632  return (vector bool short)vec_perm(
5633      __a, __b,
5634      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5635                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5636#endif
5637}
5638
5639/* vec_vpkudum */
5640
5641#ifdef __POWER8_VECTOR__
5642#define __builtin_altivec_vpkudum vec_vpkudum
5643
5644static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
5645                                                      vector long long __b) {
5646#ifdef __LITTLE_ENDIAN__
5647  return (vector int)vec_perm(
5648      __a, __b,
5649      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5650                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5651#else
5652  return (vector int)vec_perm(
5653      __a, __b,
5654      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5655                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5656#endif
5657}
5658
5659static __inline__ vector unsigned int __ATTRS_o_ai
5660vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
5661#ifdef __LITTLE_ENDIAN__
5662  return (vector unsigned int)vec_perm(
5663      __a, __b,
5664      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5665                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5666#else
5667  return (vector unsigned int)vec_perm(
5668      __a, __b,
5669      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5670                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5671#endif
5672}
5673
5674static __inline__ vector bool int __ATTRS_o_ai
5675vec_vpkudum(vector bool long long __a, vector bool long long __b) {
5676#ifdef __LITTLE_ENDIAN__
5677  return (vector bool int)vec_perm(
5678      (vector long long)__a, (vector long long)__b,
5679      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5680                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5681#else
5682  return (vector bool int)vec_perm(
5683      (vector long long)__a, (vector long long)__b,
5684      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5685                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5686#endif
5687}
5688#endif
5689
5690/* vec_packpx */
5691
5692static __inline__ vector pixel __attribute__((__always_inline__))
5693vec_packpx(vector unsigned int __a, vector unsigned int __b) {
5694#ifdef __LITTLE_ENDIAN__
5695  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5696#else
5697  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5698#endif
5699}
5700
5701/* vec_vpkpx */
5702
5703static __inline__ vector pixel __attribute__((__always_inline__))
5704vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
5705#ifdef __LITTLE_ENDIAN__
5706  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5707#else
5708  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5709#endif
5710}
5711
5712/* vec_packs */
5713
5714static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
5715                                                            vector short __b) {
5716#ifdef __LITTLE_ENDIAN__
5717  return __builtin_altivec_vpkshss(__b, __a);
5718#else
5719  return __builtin_altivec_vpkshss(__a, __b);
5720#endif
5721}
5722
5723static __inline__ vector unsigned char __ATTRS_o_ai
5724vec_packs(vector unsigned short __a, vector unsigned short __b) {
5725#ifdef __LITTLE_ENDIAN__
5726  return __builtin_altivec_vpkuhus(__b, __a);
5727#else
5728  return __builtin_altivec_vpkuhus(__a, __b);
5729#endif
5730}
5731
5732static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
5733                                                             vector int __b) {
5734#ifdef __LITTLE_ENDIAN__
5735  return __builtin_altivec_vpkswss(__b, __a);
5736#else
5737  return __builtin_altivec_vpkswss(__a, __b);
5738#endif
5739}
5740
5741static __inline__ vector unsigned short __ATTRS_o_ai
5742vec_packs(vector unsigned int __a, vector unsigned int __b) {
5743#ifdef __LITTLE_ENDIAN__
5744  return __builtin_altivec_vpkuwus(__b, __a);
5745#else
5746  return __builtin_altivec_vpkuwus(__a, __b);
5747#endif
5748}
5749
5750#ifdef __POWER8_VECTOR__
5751static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
5752                                                    vector long long __b) {
5753#ifdef __LITTLE_ENDIAN__
5754  return __builtin_altivec_vpksdss(__b, __a);
5755#else
5756  return __builtin_altivec_vpksdss(__a, __b);
5757#endif
5758}
5759
5760static __inline__ vector unsigned int __ATTRS_o_ai
5761vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
5762#ifdef __LITTLE_ENDIAN__
5763  return __builtin_altivec_vpkudus(__b, __a);
5764#else
5765  return __builtin_altivec_vpkudus(__a, __b);
5766#endif
5767}
5768#endif
5769
5770/* vec_vpkshss */
5771
5772static __inline__ vector signed char __attribute__((__always_inline__))
5773vec_vpkshss(vector short __a, vector short __b) {
5774#ifdef __LITTLE_ENDIAN__
5775  return __builtin_altivec_vpkshss(__b, __a);
5776#else
5777  return __builtin_altivec_vpkshss(__a, __b);
5778#endif
5779}
5780
5781/* vec_vpksdss */
5782
5783#ifdef __POWER8_VECTOR__
5784static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
5785                                                      vector long long __b) {
5786#ifdef __LITTLE_ENDIAN__
5787  return __builtin_altivec_vpksdss(__b, __a);
5788#else
5789  return __builtin_altivec_vpksdss(__a, __b);
5790#endif
5791}
5792#endif
5793
5794/* vec_vpkuhus */
5795
5796static __inline__ vector unsigned char __attribute__((__always_inline__))
5797vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
5798#ifdef __LITTLE_ENDIAN__
5799  return __builtin_altivec_vpkuhus(__b, __a);
5800#else
5801  return __builtin_altivec_vpkuhus(__a, __b);
5802#endif
5803}
5804
5805/* vec_vpkudus */
5806
5807#ifdef __POWER8_VECTOR__
5808static __inline__ vector unsigned int __attribute__((__always_inline__))
5809vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
5810#ifdef __LITTLE_ENDIAN__
5811  return __builtin_altivec_vpkudus(__b, __a);
5812#else
5813  return __builtin_altivec_vpkudus(__a, __b);
5814#endif
5815}
5816#endif
5817
5818/* vec_vpkswss */
5819
5820static __inline__ vector signed short __attribute__((__always_inline__))
5821vec_vpkswss(vector int __a, vector int __b) {
5822#ifdef __LITTLE_ENDIAN__
5823  return __builtin_altivec_vpkswss(__b, __a);
5824#else
5825  return __builtin_altivec_vpkswss(__a, __b);
5826#endif
5827}
5828
5829/* vec_vpkuwus */
5830
5831static __inline__ vector unsigned short __attribute__((__always_inline__))
5832vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
5833#ifdef __LITTLE_ENDIAN__
5834  return __builtin_altivec_vpkuwus(__b, __a);
5835#else
5836  return __builtin_altivec_vpkuwus(__a, __b);
5837#endif
5838}
5839
5840/* vec_packsu */
5841
5842static __inline__ vector unsigned char __ATTRS_o_ai
5843vec_packsu(vector short __a, vector short __b) {
5844#ifdef __LITTLE_ENDIAN__
5845  return __builtin_altivec_vpkshus(__b, __a);
5846#else
5847  return __builtin_altivec_vpkshus(__a, __b);
5848#endif
5849}
5850
5851static __inline__ vector unsigned char __ATTRS_o_ai
5852vec_packsu(vector unsigned short __a, vector unsigned short __b) {
5853#ifdef __LITTLE_ENDIAN__
5854  return __builtin_altivec_vpkuhus(__b, __a);
5855#else
5856  return __builtin_altivec_vpkuhus(__a, __b);
5857#endif
5858}
5859
5860static __inline__ vector unsigned short __ATTRS_o_ai
5861vec_packsu(vector int __a, vector int __b) {
5862#ifdef __LITTLE_ENDIAN__
5863  return __builtin_altivec_vpkswus(__b, __a);
5864#else
5865  return __builtin_altivec_vpkswus(__a, __b);
5866#endif
5867}
5868
5869static __inline__ vector unsigned short __ATTRS_o_ai
5870vec_packsu(vector unsigned int __a, vector unsigned int __b) {
5871#ifdef __LITTLE_ENDIAN__
5872  return __builtin_altivec_vpkuwus(__b, __a);
5873#else
5874  return __builtin_altivec_vpkuwus(__a, __b);
5875#endif
5876}
5877
5878#ifdef __POWER8_VECTOR__
5879static __inline__ vector unsigned int __ATTRS_o_ai
5880vec_packsu(vector long long __a, vector long long __b) {
5881#ifdef __LITTLE_ENDIAN__
5882  return __builtin_altivec_vpksdus(__b, __a);
5883#else
5884  return __builtin_altivec_vpksdus(__a, __b);
5885#endif
5886}
5887
5888static __inline__ vector unsigned int __ATTRS_o_ai
5889vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
5890#ifdef __LITTLE_ENDIAN__
5891  return __builtin_altivec_vpkudus(__b, __a);
5892#else
5893  return __builtin_altivec_vpkudus(__a, __b);
5894#endif
5895}
5896#endif
5897
5898/* vec_vpkshus */
5899
5900static __inline__ vector unsigned char __ATTRS_o_ai
5901vec_vpkshus(vector short __a, vector short __b) {
5902#ifdef __LITTLE_ENDIAN__
5903  return __builtin_altivec_vpkshus(__b, __a);
5904#else
5905  return __builtin_altivec_vpkshus(__a, __b);
5906#endif
5907}
5908
5909static __inline__ vector unsigned char __ATTRS_o_ai
5910vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
5911#ifdef __LITTLE_ENDIAN__
5912  return __builtin_altivec_vpkuhus(__b, __a);
5913#else
5914  return __builtin_altivec_vpkuhus(__a, __b);
5915#endif
5916}
5917
5918/* vec_vpkswus */
5919
5920static __inline__ vector unsigned short __ATTRS_o_ai
5921vec_vpkswus(vector int __a, vector int __b) {
5922#ifdef __LITTLE_ENDIAN__
5923  return __builtin_altivec_vpkswus(__b, __a);
5924#else
5925  return __builtin_altivec_vpkswus(__a, __b);
5926#endif
5927}
5928
5929static __inline__ vector unsigned short __ATTRS_o_ai
5930vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
5931#ifdef __LITTLE_ENDIAN__
5932  return __builtin_altivec_vpkuwus(__b, __a);
5933#else
5934  return __builtin_altivec_vpkuwus(__a, __b);
5935#endif
5936}
5937
5938/* vec_vpksdus */
5939
5940#ifdef __POWER8_VECTOR__
5941static __inline__ vector unsigned int __ATTRS_o_ai
5942vec_vpksdus(vector long long __a, vector long long __b) {
5943#ifdef __LITTLE_ENDIAN__
5944  return __builtin_altivec_vpksdus(__b, __a);
5945#else
5946  return __builtin_altivec_vpksdus(__a, __b);
5947#endif
5948}
5949#endif
5950
5951/* vec_perm */
5952
5953// The vperm instruction is defined architecturally with a big-endian bias.
5954// For little endian, we swap the input operands and invert the permute
5955// control vector.  Only the rightmost 5 bits matter, so we could use
5956// a vector of all 31s instead of all 255s to perform the inversion.
5957// However, when the PCV is not a constant, using 255 has an advantage
5958// in that the vec_xor can be recognized as a vec_nor (and for P8 and
5959// later, possibly a vec_nand).
5960
5961static __inline__ vector signed char __ATTRS_o_ai vec_perm(
5962    vector signed char __a, vector signed char __b, vector unsigned char __c) {
5963#ifdef __LITTLE_ENDIAN__
5964  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5965                              255, 255, 255, 255, 255, 255, 255, 255};
5966  __d = vec_xor(__c, __d);
5967  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
5968                                                         (vector int)__a, __d);
5969#else
5970  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
5971                                                         (vector int)__b, __c);
5972#endif
5973}
5974
5975static __inline__ vector unsigned char __ATTRS_o_ai
5976vec_perm(vector unsigned char __a, vector unsigned char __b,
5977         vector unsigned char __c) {
5978#ifdef __LITTLE_ENDIAN__
5979  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5980                              255, 255, 255, 255, 255, 255, 255, 255};
5981  __d = vec_xor(__c, __d);
5982  return (vector unsigned char)__builtin_altivec_vperm_4si(
5983      (vector int)__b, (vector int)__a, __d);
5984#else
5985  return (vector unsigned char)__builtin_altivec_vperm_4si(
5986      (vector int)__a, (vector int)__b, __c);
5987#endif
5988}
5989
5990static __inline__ vector bool char __ATTRS_o_ai
5991vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
5992#ifdef __LITTLE_ENDIAN__
5993  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5994                              255, 255, 255, 255, 255, 255, 255, 255};
5995  __d = vec_xor(__c, __d);
5996  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
5997                                                       (vector int)__a, __d);
5998#else
5999  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
6000                                                       (vector int)__b, __c);
6001#endif
6002}
6003
6004static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
6005                                                     vector signed short __b,
6006                                                     vector unsigned char __c) {
6007#ifdef __LITTLE_ENDIAN__
6008  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6009                              255, 255, 255, 255, 255, 255, 255, 255};
6010  __d = vec_xor(__c, __d);
6011  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
6012                                                          (vector int)__a, __d);
6013#else
6014  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
6015                                                          (vector int)__b, __c);
6016#endif
6017}
6018
6019static __inline__ vector unsigned short __ATTRS_o_ai
6020vec_perm(vector unsigned short __a, vector unsigned short __b,
6021         vector unsigned char __c) {
6022#ifdef __LITTLE_ENDIAN__
6023  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6024                              255, 255, 255, 255, 255, 255, 255, 255};
6025  __d = vec_xor(__c, __d);
6026  return (vector unsigned short)__builtin_altivec_vperm_4si(
6027      (vector int)__b, (vector int)__a, __d);
6028#else
6029  return (vector unsigned short)__builtin_altivec_vperm_4si(
6030      (vector int)__a, (vector int)__b, __c);
6031#endif
6032}
6033
6034static __inline__ vector bool short __ATTRS_o_ai vec_perm(
6035    vector bool short __a, vector bool short __b, vector unsigned char __c) {
6036#ifdef __LITTLE_ENDIAN__
6037  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6038                              255, 255, 255, 255, 255, 255, 255, 255};
6039  __d = vec_xor(__c, __d);
6040  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
6041                                                        (vector int)__a, __d);
6042#else
6043  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
6044                                                        (vector int)__b, __c);
6045#endif
6046}
6047
6048static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
6049                                                     vector pixel __b,
6050                                                     vector unsigned char __c) {
6051#ifdef __LITTLE_ENDIAN__
6052  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6053                              255, 255, 255, 255, 255, 255, 255, 255};
6054  __d = vec_xor(__c, __d);
6055  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
6056                                                   (vector int)__a, __d);
6057#else
6058  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
6059                                                   (vector int)__b, __c);
6060#endif
6061}
6062
6063static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
6064                                                   vector signed int __b,
6065                                                   vector unsigned char __c) {
6066#ifdef __LITTLE_ENDIAN__
6067  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6068                              255, 255, 255, 255, 255, 255, 255, 255};
6069  __d = vec_xor(__c, __d);
6070  return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
6071#else
6072  return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
6073#endif
6074}
6075
6076static __inline__ vector unsigned int __ATTRS_o_ai
6077vec_perm(vector unsigned int __a, vector unsigned int __b,
6078         vector unsigned char __c) {
6079#ifdef __LITTLE_ENDIAN__
6080  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6081                              255, 255, 255, 255, 255, 255, 255, 255};
6082  __d = vec_xor(__c, __d);
6083  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
6084                                                          (vector int)__a, __d);
6085#else
6086  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
6087                                                          (vector int)__b, __c);
6088#endif
6089}
6090
6091static __inline__ vector bool int __ATTRS_o_ai
6092vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6093#ifdef __LITTLE_ENDIAN__
6094  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6095                              255, 255, 255, 255, 255, 255, 255, 255};
6096  __d = vec_xor(__c, __d);
6097  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
6098                                                      (vector int)__a, __d);
6099#else
6100  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
6101                                                      (vector int)__b, __c);
6102#endif
6103}
6104
6105static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
6106                                                     vector float __b,
6107                                                     vector unsigned char __c) {
6108#ifdef __LITTLE_ENDIAN__
6109  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6110                              255, 255, 255, 255, 255, 255, 255, 255};
6111  __d = vec_xor(__c, __d);
6112  return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
6113                                                   (vector int)__a, __d);
6114#else
6115  return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
6116                                                   (vector int)__b, __c);
6117#endif
6118}
6119
6120#ifdef __VSX__
6121static __inline__ vector long long __ATTRS_o_ai
6122vec_perm(vector signed long long __a, vector signed long long __b,
6123         vector unsigned char __c) {
6124#ifdef __LITTLE_ENDIAN__
6125  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6126                              255, 255, 255, 255, 255, 255, 255, 255};
6127  __d = vec_xor(__c, __d);
6128  return (vector signed long long)__builtin_altivec_vperm_4si(
6129      (vector int)__b, (vector int)__a, __d);
6130#else
6131  return (vector signed long long)__builtin_altivec_vperm_4si(
6132      (vector int)__a, (vector int)__b, __c);
6133#endif
6134}
6135
6136static __inline__ vector unsigned long long __ATTRS_o_ai
6137vec_perm(vector unsigned long long __a, vector unsigned long long __b,
6138         vector unsigned char __c) {
6139#ifdef __LITTLE_ENDIAN__
6140  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6141                              255, 255, 255, 255, 255, 255, 255, 255};
6142  __d = vec_xor(__c, __d);
6143  return (vector unsigned long long)__builtin_altivec_vperm_4si(
6144      (vector int)__b, (vector int)__a, __d);
6145#else
6146  return (vector unsigned long long)__builtin_altivec_vperm_4si(
6147      (vector int)__a, (vector int)__b, __c);
6148#endif
6149}
6150
6151static __inline__ vector bool long long __ATTRS_o_ai
6152vec_perm(vector bool long long __a, vector bool long long __b,
6153         vector unsigned char __c) {
6154#ifdef __LITTLE_ENDIAN__
6155  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6156                              255, 255, 255, 255, 255, 255, 255, 255};
6157  __d = vec_xor(__c, __d);
6158  return (vector bool long long)__builtin_altivec_vperm_4si(
6159      (vector int)__b, (vector int)__a, __d);
6160#else
6161  return (vector bool long long)__builtin_altivec_vperm_4si(
6162      (vector int)__a, (vector int)__b, __c);
6163#endif
6164}
6165
6166static __inline__ vector double __ATTRS_o_ai
6167vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
6168#ifdef __LITTLE_ENDIAN__
6169  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6170                              255, 255, 255, 255, 255, 255, 255, 255};
6171  __d = vec_xor(__c, __d);
6172  return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
6173                                                    (vector int)__a, __d);
6174#else
6175  return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
6176                                                    (vector int)__b, __c);
6177#endif
6178}
6179#endif
6180
6181/* vec_vperm */
6182
6183static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
6184    vector signed char __a, vector signed char __b, vector unsigned char __c) {
6185  return vec_perm(__a, __b, __c);
6186}
6187
6188static __inline__ vector unsigned char __ATTRS_o_ai
6189vec_vperm(vector unsigned char __a, vector unsigned char __b,
6190          vector unsigned char __c) {
6191  return vec_perm(__a, __b, __c);
6192}
6193
6194static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
6195    vector bool char __a, vector bool char __b, vector unsigned char __c) {
6196  return vec_perm(__a, __b, __c);
6197}
6198
6199static __inline__ vector short __ATTRS_o_ai
6200vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
6201  return vec_perm(__a, __b, __c);
6202}
6203
6204static __inline__ vector unsigned short __ATTRS_o_ai
6205vec_vperm(vector unsigned short __a, vector unsigned short __b,
6206          vector unsigned char __c) {
6207  return vec_perm(__a, __b, __c);
6208}
6209
6210static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
6211    vector bool short __a, vector bool short __b, vector unsigned char __c) {
6212  return vec_perm(__a, __b, __c);
6213}
6214
6215static __inline__ vector pixel __ATTRS_o_ai
6216vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
6217  return vec_perm(__a, __b, __c);
6218}
6219
6220static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
6221                                                    vector int __b,
6222                                                    vector unsigned char __c) {
6223  return vec_perm(__a, __b, __c);
6224}
6225
6226static __inline__ vector unsigned int __ATTRS_o_ai
6227vec_vperm(vector unsigned int __a, vector unsigned int __b,
6228          vector unsigned char __c) {
6229  return vec_perm(__a, __b, __c);
6230}
6231
6232static __inline__ vector bool int __ATTRS_o_ai
6233vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6234  return vec_perm(__a, __b, __c);
6235}
6236
6237static __inline__ vector float __ATTRS_o_ai
6238vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
6239  return vec_perm(__a, __b, __c);
6240}
6241
6242#ifdef __VSX__
6243static __inline__ vector long long __ATTRS_o_ai vec_vperm(
6244    vector long long __a, vector long long __b, vector unsigned char __c) {
6245  return vec_perm(__a, __b, __c);
6246}
6247
6248static __inline__ vector unsigned long long __ATTRS_o_ai
6249vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
6250          vector unsigned char __c) {
6251  return vec_perm(__a, __b, __c);
6252}
6253
6254static __inline__ vector double __ATTRS_o_ai
6255vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
6256  return vec_perm(__a, __b, __c);
6257}
6258#endif
6259
6260/* vec_re */
6261
6262static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
6263#ifdef __VSX__
6264  return __builtin_vsx_xvresp(__a);
6265#else
6266  return __builtin_altivec_vrefp(__a);
6267#endif
6268}
6269
6270#ifdef __VSX__
6271static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
6272  return __builtin_vsx_xvredp(__a);
6273}
6274#endif
6275
6276/* vec_vrefp */
6277
6278static __inline__ vector float __attribute__((__always_inline__))
6279vec_vrefp(vector float __a) {
6280  return __builtin_altivec_vrefp(__a);
6281}
6282
6283/* vec_rl */
6284
6285static __inline__ vector signed char __ATTRS_o_ai
6286vec_rl(vector signed char __a, vector unsigned char __b) {
6287  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6288}
6289
6290static __inline__ vector unsigned char __ATTRS_o_ai
6291vec_rl(vector unsigned char __a, vector unsigned char __b) {
6292  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6293}
6294
6295static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
6296                                                   vector unsigned short __b) {
6297  return __builtin_altivec_vrlh(__a, __b);
6298}
6299
6300static __inline__ vector unsigned short __ATTRS_o_ai
6301vec_rl(vector unsigned short __a, vector unsigned short __b) {
6302  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6303}
6304
6305static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
6306                                                 vector unsigned int __b) {
6307  return __builtin_altivec_vrlw(__a, __b);
6308}
6309
6310static __inline__ vector unsigned int __ATTRS_o_ai
6311vec_rl(vector unsigned int __a, vector unsigned int __b) {
6312  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6313}
6314
6315#ifdef __POWER8_VECTOR__
6316static __inline__ vector signed long long __ATTRS_o_ai
6317vec_rl(vector signed long long __a, vector unsigned long long __b) {
6318  return __builtin_altivec_vrld(__a, __b);
6319}
6320
6321static __inline__ vector unsigned long long __ATTRS_o_ai
6322vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
6323  return __builtin_altivec_vrld(__a, __b);
6324}
6325#endif
6326
6327/* vec_vrlb */
6328
6329static __inline__ vector signed char __ATTRS_o_ai
6330vec_vrlb(vector signed char __a, vector unsigned char __b) {
6331  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6332}
6333
6334static __inline__ vector unsigned char __ATTRS_o_ai
6335vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
6336  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6337}
6338
6339/* vec_vrlh */
6340
6341static __inline__ vector short __ATTRS_o_ai
6342vec_vrlh(vector short __a, vector unsigned short __b) {
6343  return __builtin_altivec_vrlh(__a, __b);
6344}
6345
6346static __inline__ vector unsigned short __ATTRS_o_ai
6347vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
6348  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6349}
6350
6351/* vec_vrlw */
6352
6353static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
6354                                                   vector unsigned int __b) {
6355  return __builtin_altivec_vrlw(__a, __b);
6356}
6357
6358static __inline__ vector unsigned int __ATTRS_o_ai
6359vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
6360  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6361}
6362
6363/* vec_round */
6364
6365static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
6366#ifdef __VSX__
6367  return __builtin_vsx_xvrspi(__a);
6368#else
6369  return __builtin_altivec_vrfin(__a);
6370#endif
6371}
6372
6373#ifdef __VSX__
6374static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
6375  return __builtin_vsx_xvrdpi(__a);
6376}
6377
6378/* vec_rint */
6379
6380static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
6381  return __builtin_vsx_xvrspic(__a);
6382}
6383
6384static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
6385  return __builtin_vsx_xvrdpic(__a);
6386}
6387
6388/* vec_nearbyint */
6389
6390static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
6391  return __builtin_vsx_xvrspi(__a);
6392}
6393
6394static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
6395  return __builtin_vsx_xvrdpi(__a);
6396}
6397#endif
6398
6399/* vec_vrfin */
6400
6401static __inline__ vector float __attribute__((__always_inline__))
6402vec_vrfin(vector float __a) {
6403  return __builtin_altivec_vrfin(__a);
6404}
6405
6406/* vec_sqrt */
6407
6408#ifdef __VSX__
6409static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
6410  return __builtin_vsx_xvsqrtsp(__a);
6411}
6412
6413static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
6414  return __builtin_vsx_xvsqrtdp(__a);
6415}
6416#endif
6417
6418/* vec_rsqrte */
6419
6420static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
6421#ifdef __VSX__
6422  return __builtin_vsx_xvrsqrtesp(__a);
6423#else
6424  return __builtin_altivec_vrsqrtefp(__a);
6425#endif
6426}
6427
6428#ifdef __VSX__
6429static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
6430  return __builtin_vsx_xvrsqrtedp(__a);
6431}
6432#endif
6433
6434/* vec_vrsqrtefp */
6435
6436static __inline__ __vector float __attribute__((__always_inline__))
6437vec_vrsqrtefp(vector float __a) {
6438  return __builtin_altivec_vrsqrtefp(__a);
6439}
6440
6441/* vec_sel */
6442
6443#define __builtin_altivec_vsel_4si vec_sel
6444
6445static __inline__ vector signed char __ATTRS_o_ai vec_sel(
6446    vector signed char __a, vector signed char __b, vector unsigned char __c) {
6447  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6448}
6449
6450static __inline__ vector signed char __ATTRS_o_ai
6451vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
6452  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6453}
6454
6455static __inline__ vector unsigned char __ATTRS_o_ai
6456vec_sel(vector unsigned char __a, vector unsigned char __b,
6457        vector unsigned char __c) {
6458  return (__a & ~__c) | (__b & __c);
6459}
6460
6461static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
6462    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
6463  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6464}
6465
6466static __inline__ vector bool char __ATTRS_o_ai
6467vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
6468  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6469}
6470
6471static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6472                                                        vector bool char __b,
6473                                                        vector bool char __c) {
6474  return (__a & ~__c) | (__b & __c);
6475}
6476
6477static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
6478                                                    vector short __b,
6479                                                    vector unsigned short __c) {
6480  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6481}
6482
6483static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
6484                                                    vector short __b,
6485                                                    vector bool short __c) {
6486  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6487}
6488
6489static __inline__ vector unsigned short __ATTRS_o_ai
6490vec_sel(vector unsigned short __a, vector unsigned short __b,
6491        vector unsigned short __c) {
6492  return (__a & ~__c) | (__b & __c);
6493}
6494
6495static __inline__ vector unsigned short __ATTRS_o_ai
6496vec_sel(vector unsigned short __a, vector unsigned short __b,
6497        vector bool short __c) {
6498  return (__a & ~(vector unsigned short)__c) |
6499         (__b & (vector unsigned short)__c);
6500}
6501
6502static __inline__ vector bool short __ATTRS_o_ai vec_sel(
6503    vector bool short __a, vector bool short __b, vector unsigned short __c) {
6504  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6505}
6506
6507static __inline__ vector bool short __ATTRS_o_ai
6508vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
6509  return (__a & ~__c) | (__b & __c);
6510}
6511
6512static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
6513                                                  vector int __b,
6514                                                  vector unsigned int __c) {
6515  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6516}
6517
6518static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
6519                                                  vector int __b,
6520                                                  vector bool int __c) {
6521  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6522}
6523
6524static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
6525    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
6526  return (__a & ~__c) | (__b & __c);
6527}
6528
6529static __inline__ vector unsigned int __ATTRS_o_ai
6530vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
6531  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6532}
6533
6534static __inline__ vector bool int __ATTRS_o_ai
6535vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
6536  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6537}
6538
6539static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6540                                                       vector bool int __b,
6541                                                       vector bool int __c) {
6542  return (__a & ~__c) | (__b & __c);
6543}
6544
6545static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
6546                                                    vector float __b,
6547                                                    vector unsigned int __c) {
6548  vector int __res = ((vector int)__a & ~(vector int)__c) |
6549                     ((vector int)__b & (vector int)__c);
6550  return (vector float)__res;
6551}
6552
6553static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
6554                                                    vector float __b,
6555                                                    vector bool int __c) {
6556  vector int __res = ((vector int)__a & ~(vector int)__c) |
6557                     ((vector int)__b & (vector int)__c);
6558  return (vector float)__res;
6559}
6560
6561#ifdef __VSX__
6562static __inline__ vector double __ATTRS_o_ai
6563vec_sel(vector double __a, vector double __b, vector bool long long __c) {
6564  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6565                           ((vector long long)__b & (vector long long)__c);
6566  return (vector double)__res;
6567}
6568
6569static __inline__ vector double __ATTRS_o_ai
6570vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
6571  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6572                           ((vector long long)__b & (vector long long)__c);
6573  return (vector double)__res;
6574}
6575#endif
6576
6577/* vec_vsel */
6578
6579static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
6580    vector signed char __a, vector signed char __b, vector unsigned char __c) {
6581  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6582}
6583
6584static __inline__ vector signed char __ATTRS_o_ai
6585vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
6586  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6587}
6588
6589static __inline__ vector unsigned char __ATTRS_o_ai
6590vec_vsel(vector unsigned char __a, vector unsigned char __b,
6591         vector unsigned char __c) {
6592  return (__a & ~__c) | (__b & __c);
6593}
6594
6595static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
6596    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
6597  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6598}
6599
6600static __inline__ vector bool char __ATTRS_o_ai
6601vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
6602  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6603}
6604
6605static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6606                                                         vector bool char __b,
6607                                                         vector bool char __c) {
6608  return (__a & ~__c) | (__b & __c);
6609}
6610
6611static __inline__ vector short __ATTRS_o_ai
6612vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
6613  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6614}
6615
6616static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
6617                                                     vector short __b,
6618                                                     vector bool short __c) {
6619  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6620}
6621
6622static __inline__ vector unsigned short __ATTRS_o_ai
6623vec_vsel(vector unsigned short __a, vector unsigned short __b,
6624         vector unsigned short __c) {
6625  return (__a & ~__c) | (__b & __c);
6626}
6627
6628static __inline__ vector unsigned short __ATTRS_o_ai
6629vec_vsel(vector unsigned short __a, vector unsigned short __b,
6630         vector bool short __c) {
6631  return (__a & ~(vector unsigned short)__c) |
6632         (__b & (vector unsigned short)__c);
6633}
6634
6635static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
6636    vector bool short __a, vector bool short __b, vector unsigned short __c) {
6637  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6638}
6639
6640static __inline__ vector bool short __ATTRS_o_ai
6641vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
6642  return (__a & ~__c) | (__b & __c);
6643}
6644
6645static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
6646                                                   vector int __b,
6647                                                   vector unsigned int __c) {
6648  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6649}
6650
6651static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
6652                                                   vector int __b,
6653                                                   vector bool int __c) {
6654  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6655}
6656
6657static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
6658    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
6659  return (__a & ~__c) | (__b & __c);
6660}
6661
6662static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
6663    vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
6664  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6665}
6666
6667static __inline__ vector bool int __ATTRS_o_ai
6668vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
6669  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6670}
6671
6672static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6673                                                        vector bool int __b,
6674                                                        vector bool int __c) {
6675  return (__a & ~__c) | (__b & __c);
6676}
6677
6678static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
6679                                                     vector float __b,
6680                                                     vector unsigned int __c) {
6681  vector int __res = ((vector int)__a & ~(vector int)__c) |
6682                     ((vector int)__b & (vector int)__c);
6683  return (vector float)__res;
6684}
6685
6686static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
6687                                                     vector float __b,
6688                                                     vector bool int __c) {
6689  vector int __res = ((vector int)__a & ~(vector int)__c) |
6690                     ((vector int)__b & (vector int)__c);
6691  return (vector float)__res;
6692}
6693
6694/* vec_sl */
6695
6696static __inline__ vector signed char __ATTRS_o_ai
6697vec_sl(vector signed char __a, vector unsigned char __b) {
6698  return __a << (vector signed char)__b;
6699}
6700
6701static __inline__ vector unsigned char __ATTRS_o_ai
6702vec_sl(vector unsigned char __a, vector unsigned char __b) {
6703  return __a << __b;
6704}
6705
6706static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
6707                                                   vector unsigned short __b) {
6708  return __a << (vector short)__b;
6709}
6710
6711static __inline__ vector unsigned short __ATTRS_o_ai
6712vec_sl(vector unsigned short __a, vector unsigned short __b) {
6713  return __a << __b;
6714}
6715
6716static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
6717                                                 vector unsigned int __b) {
6718  return __a << (vector int)__b;
6719}
6720
6721static __inline__ vector unsigned int __ATTRS_o_ai
6722vec_sl(vector unsigned int __a, vector unsigned int __b) {
6723  return __a << __b;
6724}
6725
6726#ifdef __POWER8_VECTOR__
6727static __inline__ vector signed long long __ATTRS_o_ai
6728vec_sl(vector signed long long __a, vector unsigned long long __b) {
6729  return __a << (vector long long)__b;
6730}
6731
6732static __inline__ vector unsigned long long __ATTRS_o_ai
6733vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
6734  return __a << __b;
6735}
6736#endif
6737
6738/* vec_vslb */
6739
6740#define __builtin_altivec_vslb vec_vslb
6741
6742static __inline__ vector signed char __ATTRS_o_ai
6743vec_vslb(vector signed char __a, vector unsigned char __b) {
6744  return vec_sl(__a, __b);
6745}
6746
6747static __inline__ vector unsigned char __ATTRS_o_ai
6748vec_vslb(vector unsigned char __a, vector unsigned char __b) {
6749  return vec_sl(__a, __b);
6750}
6751
6752/* vec_vslh */
6753
6754#define __builtin_altivec_vslh vec_vslh
6755
6756static __inline__ vector short __ATTRS_o_ai
6757vec_vslh(vector short __a, vector unsigned short __b) {
6758  return vec_sl(__a, __b);
6759}
6760
6761static __inline__ vector unsigned short __ATTRS_o_ai
6762vec_vslh(vector unsigned short __a, vector unsigned short __b) {
6763  return vec_sl(__a, __b);
6764}
6765
6766/* vec_vslw */
6767
6768#define __builtin_altivec_vslw vec_vslw
6769
6770static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
6771                                                   vector unsigned int __b) {
6772  return vec_sl(__a, __b);
6773}
6774
6775static __inline__ vector unsigned int __ATTRS_o_ai
6776vec_vslw(vector unsigned int __a, vector unsigned int __b) {
6777  return vec_sl(__a, __b);
6778}
6779
6780/* vec_sld */
6781
6782#define __builtin_altivec_vsldoi_4si vec_sld
6783
6784static __inline__ vector signed char __ATTRS_o_ai vec_sld(
6785    vector signed char __a, vector signed char __b, unsigned const int __c) {
6786  unsigned char __d = __c & 0x0F;
6787#ifdef __LITTLE_ENDIAN__
6788  return vec_perm(
6789      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6790                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6791                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6792                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6793#else
6794  return vec_perm(
6795      __a, __b,
6796      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6797                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6798                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6799#endif
6800}
6801
6802static __inline__ vector unsigned char __ATTRS_o_ai
6803vec_sld(vector unsigned char __a, vector unsigned char __b,
6804        unsigned const int __c) {
6805  unsigned char __d = __c & 0x0F;
6806#ifdef __LITTLE_ENDIAN__
6807  return vec_perm(
6808      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6809                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6810                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6811                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6812#else
6813  return vec_perm(
6814      __a, __b,
6815      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6816                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6817                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6818#endif
6819}
6820
6821static __inline__ vector bool char __ATTRS_o_ai
6822vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
6823  unsigned char __d = __c & 0x0F;
6824#ifdef __LITTLE_ENDIAN__
6825  return vec_perm(
6826      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6827                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6828                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6829                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6830#else
6831  return vec_perm(
6832      __a, __b,
6833      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6834                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6835                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6836#endif
6837}
6838
6839static __inline__ vector signed short __ATTRS_o_ai vec_sld(
6840    vector signed short __a, vector signed short __b, unsigned const int __c) {
6841  unsigned char __d = __c & 0x0F;
6842#ifdef __LITTLE_ENDIAN__
6843  return vec_perm(
6844      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6845                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6846                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6847                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6848#else
6849  return vec_perm(
6850      __a, __b,
6851      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6852                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6853                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6854#endif
6855}
6856
6857static __inline__ vector unsigned short __ATTRS_o_ai
6858vec_sld(vector unsigned short __a, vector unsigned short __b,
6859        unsigned const int __c) {
6860  unsigned char __d = __c & 0x0F;
6861#ifdef __LITTLE_ENDIAN__
6862  return vec_perm(
6863      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6864                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6865                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6866                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6867#else
6868  return vec_perm(
6869      __a, __b,
6870      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6871                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6872                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6873#endif
6874}
6875
6876static __inline__ vector bool short __ATTRS_o_ai
6877vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
6878  unsigned char __d = __c & 0x0F;
6879#ifdef __LITTLE_ENDIAN__
6880  return vec_perm(
6881      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6882                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6883                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6884                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6885#else
6886  return vec_perm(
6887      __a, __b,
6888      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6889                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6890                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6891#endif
6892}
6893
6894static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
6895                                                    vector pixel __b,
6896                                                    unsigned const int __c) {
6897  unsigned char __d = __c & 0x0F;
6898#ifdef __LITTLE_ENDIAN__
6899  return vec_perm(
6900      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6901                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6902                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6903                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6904#else
6905  return vec_perm(
6906      __a, __b,
6907      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6908                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6909                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6910#endif
6911}
6912
6913static __inline__ vector signed int __ATTRS_o_ai
6914vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
6915  unsigned char __d = __c & 0x0F;
6916#ifdef __LITTLE_ENDIAN__
6917  return vec_perm(
6918      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6919                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6920                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6921                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6922#else
6923  return vec_perm(
6924      __a, __b,
6925      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6926                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6927                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6928#endif
6929}
6930
6931static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
6932    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
6933  unsigned char __d = __c & 0x0F;
6934#ifdef __LITTLE_ENDIAN__
6935  return vec_perm(
6936      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6937                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6938                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6939                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6940#else
6941  return vec_perm(
6942      __a, __b,
6943      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6944                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6945                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6946#endif
6947}
6948
6949static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
6950                                                       vector bool int __b,
6951                                                       unsigned const int __c) {
6952  unsigned char __d = __c & 0x0F;
6953#ifdef __LITTLE_ENDIAN__
6954  return vec_perm(
6955      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6956                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6957                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6958                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6959#else
6960  return vec_perm(
6961      __a, __b,
6962      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6963                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6964                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6965#endif
6966}
6967
6968static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
6969                                                    vector float __b,
6970                                                    unsigned const int __c) {
6971  unsigned char __d = __c & 0x0F;
6972#ifdef __LITTLE_ENDIAN__
6973  return vec_perm(
6974      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6975                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6976                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6977                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6978#else
6979  return vec_perm(
6980      __a, __b,
6981      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6982                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6983                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6984#endif
6985}
6986
6987/* vec_vsldoi */
6988
6989static __inline__ vector signed char __ATTRS_o_ai
6990vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
6991  unsigned char __d = __c & 0x0F;
6992#ifdef __LITTLE_ENDIAN__
6993  return vec_perm(
6994      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6995                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
6996                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
6997                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
6998#else
6999  return vec_perm(
7000      __a, __b,
7001      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7002                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7003                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7004#endif
7005}
7006
7007static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
7008    vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
7009  unsigned char __d = __c & 0x0F;
7010#ifdef __LITTLE_ENDIAN__
7011  return vec_perm(
7012      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7013                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7014                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7015                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7016#else
7017  return vec_perm(
7018      __a, __b,
7019      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7020                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7021                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7022#endif
7023}
7024
7025static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
7026                                                       vector short __b,
7027                                                       unsigned char __c) {
7028  unsigned char __d = __c & 0x0F;
7029#ifdef __LITTLE_ENDIAN__
7030  return vec_perm(
7031      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7032                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7033                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7034                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7035#else
7036  return vec_perm(
7037      __a, __b,
7038      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7039                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7040                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7041#endif
7042}
7043
7044static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
7045    vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
7046  unsigned char __d = __c & 0x0F;
7047#ifdef __LITTLE_ENDIAN__
7048  return vec_perm(
7049      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7050                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7051                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7052                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7053#else
7054  return vec_perm(
7055      __a, __b,
7056      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7057                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7058                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7059#endif
7060}
7061
7062static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
7063                                                       vector pixel __b,
7064                                                       unsigned char __c) {
7065  unsigned char __d = __c & 0x0F;
7066#ifdef __LITTLE_ENDIAN__
7067  return vec_perm(
7068      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7069                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7070                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7071                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7072#else
7073  return vec_perm(
7074      __a, __b,
7075      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7076                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7077                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7078#endif
7079}
7080
7081static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
7082                                                     vector int __b,
7083                                                     unsigned char __c) {
7084  unsigned char __d = __c & 0x0F;
7085#ifdef __LITTLE_ENDIAN__
7086  return vec_perm(
7087      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7088                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7089                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7090                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7091#else
7092  return vec_perm(
7093      __a, __b,
7094      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7095                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7096                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7097#endif
7098}
7099
7100static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
7101    vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
7102  unsigned char __d = __c & 0x0F;
7103#ifdef __LITTLE_ENDIAN__
7104  return vec_perm(
7105      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7106                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7107                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7108                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7109#else
7110  return vec_perm(
7111      __a, __b,
7112      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7113                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7114                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7115#endif
7116}
7117
7118static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
7119                                                       vector float __b,
7120                                                       unsigned char __c) {
7121  unsigned char __d = __c & 0x0F;
7122#ifdef __LITTLE_ENDIAN__
7123  return vec_perm(
7124      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7125                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
7126                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
7127                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
7128#else
7129  return vec_perm(
7130      __a, __b,
7131      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7132                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7133                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7134#endif
7135}
7136
7137/* vec_sll */
7138
7139static __inline__ vector signed char __ATTRS_o_ai
7140vec_sll(vector signed char __a, vector unsigned char __b) {
7141  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7142                                                   (vector int)__b);
7143}
7144
7145static __inline__ vector signed char __ATTRS_o_ai
7146vec_sll(vector signed char __a, vector unsigned short __b) {
7147  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7148                                                   (vector int)__b);
7149}
7150
7151static __inline__ vector signed char __ATTRS_o_ai
7152vec_sll(vector signed char __a, vector unsigned int __b) {
7153  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7154                                                   (vector int)__b);
7155}
7156
7157static __inline__ vector unsigned char __ATTRS_o_ai
7158vec_sll(vector unsigned char __a, vector unsigned char __b) {
7159  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7160                                                     (vector int)__b);
7161}
7162
7163static __inline__ vector unsigned char __ATTRS_o_ai
7164vec_sll(vector unsigned char __a, vector unsigned short __b) {
7165  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7166                                                     (vector int)__b);
7167}
7168
7169static __inline__ vector unsigned char __ATTRS_o_ai
7170vec_sll(vector unsigned char __a, vector unsigned int __b) {
7171  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7172                                                     (vector int)__b);
7173}
7174
7175static __inline__ vector bool char __ATTRS_o_ai
7176vec_sll(vector bool char __a, vector unsigned char __b) {
7177  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7178                                                 (vector int)__b);
7179}
7180
7181static __inline__ vector bool char __ATTRS_o_ai
7182vec_sll(vector bool char __a, vector unsigned short __b) {
7183  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7184                                                 (vector int)__b);
7185}
7186
7187static __inline__ vector bool char __ATTRS_o_ai
7188vec_sll(vector bool char __a, vector unsigned int __b) {
7189  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7190                                                 (vector int)__b);
7191}
7192
7193static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7194                                                    vector unsigned char __b) {
7195  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7196}
7197
7198static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7199                                                    vector unsigned short __b) {
7200  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7201}
7202
7203static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7204                                                    vector unsigned int __b) {
7205  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7206}
7207
7208static __inline__ vector unsigned short __ATTRS_o_ai
7209vec_sll(vector unsigned short __a, vector unsigned char __b) {
7210  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7211                                                      (vector int)__b);
7212}
7213
7214static __inline__ vector unsigned short __ATTRS_o_ai
7215vec_sll(vector unsigned short __a, vector unsigned short __b) {
7216  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7217                                                      (vector int)__b);
7218}
7219
7220static __inline__ vector unsigned short __ATTRS_o_ai
7221vec_sll(vector unsigned short __a, vector unsigned int __b) {
7222  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7223                                                      (vector int)__b);
7224}
7225
7226static __inline__ vector bool short __ATTRS_o_ai
7227vec_sll(vector bool short __a, vector unsigned char __b) {
7228  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7229                                                  (vector int)__b);
7230}
7231
7232static __inline__ vector bool short __ATTRS_o_ai
7233vec_sll(vector bool short __a, vector unsigned short __b) {
7234  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7235                                                  (vector int)__b);
7236}
7237
7238static __inline__ vector bool short __ATTRS_o_ai
7239vec_sll(vector bool short __a, vector unsigned int __b) {
7240  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7241                                                  (vector int)__b);
7242}
7243
7244static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7245                                                    vector unsigned char __b) {
7246  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7247}
7248
7249static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7250                                                    vector unsigned short __b) {
7251  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7252}
7253
7254static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7255                                                    vector unsigned int __b) {
7256  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7257}
7258
7259static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7260                                                  vector unsigned char __b) {
7261  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7262}
7263
7264static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7265                                                  vector unsigned short __b) {
7266  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7267}
7268
7269static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7270                                                  vector unsigned int __b) {
7271  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7272}
7273
7274static __inline__ vector unsigned int __ATTRS_o_ai
7275vec_sll(vector unsigned int __a, vector unsigned char __b) {
7276  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7277                                                    (vector int)__b);
7278}
7279
7280static __inline__ vector unsigned int __ATTRS_o_ai
7281vec_sll(vector unsigned int __a, vector unsigned short __b) {
7282  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7283                                                    (vector int)__b);
7284}
7285
7286static __inline__ vector unsigned int __ATTRS_o_ai
7287vec_sll(vector unsigned int __a, vector unsigned int __b) {
7288  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7289                                                    (vector int)__b);
7290}
7291
7292static __inline__ vector bool int __ATTRS_o_ai
7293vec_sll(vector bool int __a, vector unsigned char __b) {
7294  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7295                                                (vector int)__b);
7296}
7297
7298static __inline__ vector bool int __ATTRS_o_ai
7299vec_sll(vector bool int __a, vector unsigned short __b) {
7300  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7301                                                (vector int)__b);
7302}
7303
7304static __inline__ vector bool int __ATTRS_o_ai
7305vec_sll(vector bool int __a, vector unsigned int __b) {
7306  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7307                                                (vector int)__b);
7308}
7309
7310/* vec_vsl */
7311
7312static __inline__ vector signed char __ATTRS_o_ai
7313vec_vsl(vector signed char __a, vector unsigned char __b) {
7314  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7315                                                   (vector int)__b);
7316}
7317
7318static __inline__ vector signed char __ATTRS_o_ai
7319vec_vsl(vector signed char __a, vector unsigned short __b) {
7320  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7321                                                   (vector int)__b);
7322}
7323
7324static __inline__ vector signed char __ATTRS_o_ai
7325vec_vsl(vector signed char __a, vector unsigned int __b) {
7326  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7327                                                   (vector int)__b);
7328}
7329
7330static __inline__ vector unsigned char __ATTRS_o_ai
7331vec_vsl(vector unsigned char __a, vector unsigned char __b) {
7332  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7333                                                     (vector int)__b);
7334}
7335
7336static __inline__ vector unsigned char __ATTRS_o_ai
7337vec_vsl(vector unsigned char __a, vector unsigned short __b) {
7338  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7339                                                     (vector int)__b);
7340}
7341
7342static __inline__ vector unsigned char __ATTRS_o_ai
7343vec_vsl(vector unsigned char __a, vector unsigned int __b) {
7344  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7345                                                     (vector int)__b);
7346}
7347
7348static __inline__ vector bool char __ATTRS_o_ai
7349vec_vsl(vector bool char __a, vector unsigned char __b) {
7350  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7351                                                 (vector int)__b);
7352}
7353
7354static __inline__ vector bool char __ATTRS_o_ai
7355vec_vsl(vector bool char __a, vector unsigned short __b) {
7356  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7357                                                 (vector int)__b);
7358}
7359
7360static __inline__ vector bool char __ATTRS_o_ai
7361vec_vsl(vector bool char __a, vector unsigned int __b) {
7362  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7363                                                 (vector int)__b);
7364}
7365
7366static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7367                                                    vector unsigned char __b) {
7368  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7369}
7370
7371static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7372                                                    vector unsigned short __b) {
7373  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7374}
7375
7376static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7377                                                    vector unsigned int __b) {
7378  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7379}
7380
7381static __inline__ vector unsigned short __ATTRS_o_ai
7382vec_vsl(vector unsigned short __a, vector unsigned char __b) {
7383  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7384                                                      (vector int)__b);
7385}
7386
7387static __inline__ vector unsigned short __ATTRS_o_ai
7388vec_vsl(vector unsigned short __a, vector unsigned short __b) {
7389  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7390                                                      (vector int)__b);
7391}
7392
7393static __inline__ vector unsigned short __ATTRS_o_ai
7394vec_vsl(vector unsigned short __a, vector unsigned int __b) {
7395  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7396                                                      (vector int)__b);
7397}
7398
7399static __inline__ vector bool short __ATTRS_o_ai
7400vec_vsl(vector bool short __a, vector unsigned char __b) {
7401  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7402                                                  (vector int)__b);
7403}
7404
7405static __inline__ vector bool short __ATTRS_o_ai
7406vec_vsl(vector bool short __a, vector unsigned short __b) {
7407  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7408                                                  (vector int)__b);
7409}
7410
7411static __inline__ vector bool short __ATTRS_o_ai
7412vec_vsl(vector bool short __a, vector unsigned int __b) {
7413  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7414                                                  (vector int)__b);
7415}
7416
7417static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7418                                                    vector unsigned char __b) {
7419  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7420}
7421
7422static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7423                                                    vector unsigned short __b) {
7424  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7425}
7426
7427static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7428                                                    vector unsigned int __b) {
7429  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7430}
7431
7432static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7433                                                  vector unsigned char __b) {
7434  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7435}
7436
7437static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7438                                                  vector unsigned short __b) {
7439  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7440}
7441
7442static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7443                                                  vector unsigned int __b) {
7444  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7445}
7446
7447static __inline__ vector unsigned int __ATTRS_o_ai
7448vec_vsl(vector unsigned int __a, vector unsigned char __b) {
7449  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7450                                                    (vector int)__b);
7451}
7452
7453static __inline__ vector unsigned int __ATTRS_o_ai
7454vec_vsl(vector unsigned int __a, vector unsigned short __b) {
7455  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7456                                                    (vector int)__b);
7457}
7458
7459static __inline__ vector unsigned int __ATTRS_o_ai
7460vec_vsl(vector unsigned int __a, vector unsigned int __b) {
7461  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7462                                                    (vector int)__b);
7463}
7464
7465static __inline__ vector bool int __ATTRS_o_ai
7466vec_vsl(vector bool int __a, vector unsigned char __b) {
7467  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7468                                                (vector int)__b);
7469}
7470
7471static __inline__ vector bool int __ATTRS_o_ai
7472vec_vsl(vector bool int __a, vector unsigned short __b) {
7473  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7474                                                (vector int)__b);
7475}
7476
7477static __inline__ vector bool int __ATTRS_o_ai
7478vec_vsl(vector bool int __a, vector unsigned int __b) {
7479  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7480                                                (vector int)__b);
7481}
7482
7483/* vec_slo */
7484
7485static __inline__ vector signed char __ATTRS_o_ai
7486vec_slo(vector signed char __a, vector signed char __b) {
7487  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7488                                                    (vector int)__b);
7489}
7490
7491static __inline__ vector signed char __ATTRS_o_ai
7492vec_slo(vector signed char __a, vector unsigned char __b) {
7493  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7494                                                    (vector int)__b);
7495}
7496
7497static __inline__ vector unsigned char __ATTRS_o_ai
7498vec_slo(vector unsigned char __a, vector signed char __b) {
7499  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7500                                                      (vector int)__b);
7501}
7502
7503static __inline__ vector unsigned char __ATTRS_o_ai
7504vec_slo(vector unsigned char __a, vector unsigned char __b) {
7505  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7506                                                      (vector int)__b);
7507}
7508
7509static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
7510                                                    vector signed char __b) {
7511  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7512}
7513
7514static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
7515                                                    vector unsigned char __b) {
7516  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7517}
7518
7519static __inline__ vector unsigned short __ATTRS_o_ai
7520vec_slo(vector unsigned short __a, vector signed char __b) {
7521  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7522                                                       (vector int)__b);
7523}
7524
7525static __inline__ vector unsigned short __ATTRS_o_ai
7526vec_slo(vector unsigned short __a, vector unsigned char __b) {
7527  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7528                                                       (vector int)__b);
7529}
7530
7531static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7532                                                    vector signed char __b) {
7533  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7534}
7535
7536static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7537                                                    vector unsigned char __b) {
7538  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7539}
7540
7541static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
7542                                                  vector signed char __b) {
7543  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7544}
7545
7546static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
7547                                                  vector unsigned char __b) {
7548  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7549}
7550
7551static __inline__ vector unsigned int __ATTRS_o_ai
7552vec_slo(vector unsigned int __a, vector signed char __b) {
7553  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7554                                                     (vector int)__b);
7555}
7556
7557static __inline__ vector unsigned int __ATTRS_o_ai
7558vec_slo(vector unsigned int __a, vector unsigned char __b) {
7559  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7560                                                     (vector int)__b);
7561}
7562
7563static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
7564                                                    vector signed char __b) {
7565  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7566}
7567
7568static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
7569                                                    vector unsigned char __b) {
7570  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7571}
7572
7573/* vec_vslo */
7574
7575static __inline__ vector signed char __ATTRS_o_ai
7576vec_vslo(vector signed char __a, vector signed char __b) {
7577  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7578                                                    (vector int)__b);
7579}
7580
7581static __inline__ vector signed char __ATTRS_o_ai
7582vec_vslo(vector signed char __a, vector unsigned char __b) {
7583  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7584                                                    (vector int)__b);
7585}
7586
7587static __inline__ vector unsigned char __ATTRS_o_ai
7588vec_vslo(vector unsigned char __a, vector signed char __b) {
7589  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7590                                                      (vector int)__b);
7591}
7592
7593static __inline__ vector unsigned char __ATTRS_o_ai
7594vec_vslo(vector unsigned char __a, vector unsigned char __b) {
7595  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7596                                                      (vector int)__b);
7597}
7598
7599static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
7600                                                     vector signed char __b) {
7601  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7602}
7603
7604static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
7605                                                     vector unsigned char __b) {
7606  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7607}
7608
7609static __inline__ vector unsigned short __ATTRS_o_ai
7610vec_vslo(vector unsigned short __a, vector signed char __b) {
7611  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7612                                                       (vector int)__b);
7613}
7614
7615static __inline__ vector unsigned short __ATTRS_o_ai
7616vec_vslo(vector unsigned short __a, vector unsigned char __b) {
7617  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7618                                                       (vector int)__b);
7619}
7620
7621static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7622                                                     vector signed char __b) {
7623  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7624}
7625
7626static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7627                                                     vector unsigned char __b) {
7628  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7629}
7630
7631static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
7632                                                   vector signed char __b) {
7633  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7634}
7635
7636static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
7637                                                   vector unsigned char __b) {
7638  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7639}
7640
7641static __inline__ vector unsigned int __ATTRS_o_ai
7642vec_vslo(vector unsigned int __a, vector signed char __b) {
7643  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7644                                                     (vector int)__b);
7645}
7646
7647static __inline__ vector unsigned int __ATTRS_o_ai
7648vec_vslo(vector unsigned int __a, vector unsigned char __b) {
7649  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7650                                                     (vector int)__b);
7651}
7652
7653static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
7654                                                     vector signed char __b) {
7655  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7656}
7657
7658static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
7659                                                     vector unsigned char __b) {
7660  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7661}
7662
7663/* vec_splat */
7664
7665static __inline__ vector signed char __ATTRS_o_ai
7666vec_splat(vector signed char __a, unsigned const int __b) {
7667  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7668}
7669
7670static __inline__ vector unsigned char __ATTRS_o_ai
7671vec_splat(vector unsigned char __a, unsigned const int __b) {
7672  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7673}
7674
7675static __inline__ vector bool char __ATTRS_o_ai
7676vec_splat(vector bool char __a, unsigned const int __b) {
7677  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7678}
7679
7680static __inline__ vector signed short __ATTRS_o_ai
7681vec_splat(vector signed short __a, unsigned const int __b) {
7682  unsigned char b0 = (__b & 0x07) * 2;
7683  unsigned char b1 = b0 + 1;
7684  return vec_perm(__a, __a,
7685                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7686                                         b0, b1, b0, b1, b0, b1));
7687}
7688
7689static __inline__ vector unsigned short __ATTRS_o_ai
7690vec_splat(vector unsigned short __a, unsigned const int __b) {
7691  unsigned char b0 = (__b & 0x07) * 2;
7692  unsigned char b1 = b0 + 1;
7693  return vec_perm(__a, __a,
7694                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7695                                         b0, b1, b0, b1, b0, b1));
7696}
7697
7698static __inline__ vector bool short __ATTRS_o_ai
7699vec_splat(vector bool short __a, unsigned const int __b) {
7700  unsigned char b0 = (__b & 0x07) * 2;
7701  unsigned char b1 = b0 + 1;
7702  return vec_perm(__a, __a,
7703                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7704                                         b0, b1, b0, b1, b0, b1));
7705}
7706
7707static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
7708                                                      unsigned const int __b) {
7709  unsigned char b0 = (__b & 0x07) * 2;
7710  unsigned char b1 = b0 + 1;
7711  return vec_perm(__a, __a,
7712                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7713                                         b0, b1, b0, b1, b0, b1));
7714}
7715
7716static __inline__ vector signed int __ATTRS_o_ai
7717vec_splat(vector signed int __a, unsigned const int __b) {
7718  unsigned char b0 = (__b & 0x03) * 4;
7719  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7720  return vec_perm(__a, __a,
7721                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7722                                         b2, b3, b0, b1, b2, b3));
7723}
7724
7725static __inline__ vector unsigned int __ATTRS_o_ai
7726vec_splat(vector unsigned int __a, unsigned const int __b) {
7727  unsigned char b0 = (__b & 0x03) * 4;
7728  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7729  return vec_perm(__a, __a,
7730                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7731                                         b2, b3, b0, b1, b2, b3));
7732}
7733
7734static __inline__ vector bool int __ATTRS_o_ai
7735vec_splat(vector bool int __a, unsigned const int __b) {
7736  unsigned char b0 = (__b & 0x03) * 4;
7737  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7738  return vec_perm(__a, __a,
7739                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7740                                         b2, b3, b0, b1, b2, b3));
7741}
7742
7743static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
7744                                                      unsigned const int __b) {
7745  unsigned char b0 = (__b & 0x03) * 4;
7746  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7747  return vec_perm(__a, __a,
7748                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7749                                         b2, b3, b0, b1, b2, b3));
7750}
7751
7752#ifdef __VSX__
7753static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
7754                                                       unsigned const int __b) {
7755  unsigned char b0 = (__b & 0x01) * 8;
7756  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7757                b6 = b0 + 6, b7 = b0 + 7;
7758  return vec_perm(__a, __a,
7759                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7760                                         b2, b3, b4, b5, b6, b7));
7761}
7762static __inline__ vector bool long long __ATTRS_o_ai
7763vec_splat(vector bool long long __a, unsigned const int __b) {
7764  unsigned char b0 = (__b & 0x01) * 8;
7765  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7766                b6 = b0 + 6, b7 = b0 + 7;
7767  return vec_perm(__a, __a,
7768                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7769                                         b2, b3, b4, b5, b6, b7));
7770}
7771static __inline__ vector signed long long __ATTRS_o_ai
7772vec_splat(vector signed long long __a, unsigned const int __b) {
7773  unsigned char b0 = (__b & 0x01) * 8;
7774  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7775                b6 = b0 + 6, b7 = b0 + 7;
7776  return vec_perm(__a, __a,
7777                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7778                                         b2, b3, b4, b5, b6, b7));
7779}
7780static __inline__ vector unsigned long long __ATTRS_o_ai
7781vec_splat(vector unsigned long long __a, unsigned const int __b) {
7782  unsigned char b0 = (__b & 0x01) * 8;
7783  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7784                b6 = b0 + 6, b7 = b0 + 7;
7785  return vec_perm(__a, __a,
7786                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7787                                         b2, b3, b4, b5, b6, b7));
7788}
7789#endif
7790
7791/* vec_vspltb */
7792
7793#define __builtin_altivec_vspltb vec_vspltb
7794
7795static __inline__ vector signed char __ATTRS_o_ai
7796vec_vspltb(vector signed char __a, unsigned char __b) {
7797  return vec_perm(__a, __a, (vector unsigned char)(__b));
7798}
7799
7800static __inline__ vector unsigned char __ATTRS_o_ai
7801vec_vspltb(vector unsigned char __a, unsigned char __b) {
7802  return vec_perm(__a, __a, (vector unsigned char)(__b));
7803}
7804
7805static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
7806                                                           unsigned char __b) {
7807  return vec_perm(__a, __a, (vector unsigned char)(__b));
7808}
7809
7810/* vec_vsplth */
7811
7812#define __builtin_altivec_vsplth vec_vsplth
7813
7814static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
7815                                                       unsigned char __b) {
7816  __b *= 2;
7817  unsigned char b1 = __b + 1;
7818  return vec_perm(__a, __a,
7819                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7820                                         __b, b1, __b, b1, __b, b1, __b, b1));
7821}
7822
7823static __inline__ vector unsigned short __ATTRS_o_ai
7824vec_vsplth(vector unsigned short __a, unsigned char __b) {
7825  __b *= 2;
7826  unsigned char b1 = __b + 1;
7827  return vec_perm(__a, __a,
7828                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7829                                         __b, b1, __b, b1, __b, b1, __b, b1));
7830}
7831
7832static __inline__ vector bool short __ATTRS_o_ai
7833vec_vsplth(vector bool short __a, unsigned char __b) {
7834  __b *= 2;
7835  unsigned char b1 = __b + 1;
7836  return vec_perm(__a, __a,
7837                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7838                                         __b, b1, __b, b1, __b, b1, __b, b1));
7839}
7840
7841static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
7842                                                       unsigned char __b) {
7843  __b *= 2;
7844  unsigned char b1 = __b + 1;
7845  return vec_perm(__a, __a,
7846                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7847                                         __b, b1, __b, b1, __b, b1, __b, b1));
7848}
7849
7850/* vec_vspltw */
7851
7852#define __builtin_altivec_vspltw vec_vspltw
7853
7854static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
7855                                                     unsigned char __b) {
7856  __b *= 4;
7857  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7858  return vec_perm(__a, __a,
7859                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7860                                         b1, b2, b3, __b, b1, b2, b3));
7861}
7862
7863static __inline__ vector unsigned int __ATTRS_o_ai
7864vec_vspltw(vector unsigned int __a, unsigned char __b) {
7865  __b *= 4;
7866  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7867  return vec_perm(__a, __a,
7868                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7869                                         b1, b2, b3, __b, b1, b2, b3));
7870}
7871
7872static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
7873                                                          unsigned char __b) {
7874  __b *= 4;
7875  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7876  return vec_perm(__a, __a,
7877                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7878                                         b1, b2, b3, __b, b1, b2, b3));
7879}
7880
7881static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
7882                                                       unsigned char __b) {
7883  __b *= 4;
7884  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7885  return vec_perm(__a, __a,
7886                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7887                                         b1, b2, b3, __b, b1, b2, b3));
7888}
7889
7890/* vec_splat_s8 */
7891
7892#define __builtin_altivec_vspltisb vec_splat_s8
7893
7894// FIXME: parameter should be treated as 5-bit signed literal
7895static __inline__ vector signed char __ATTRS_o_ai
7896vec_splat_s8(signed char __a) {
7897  return (vector signed char)(__a);
7898}
7899
7900/* vec_vspltisb */
7901
7902// FIXME: parameter should be treated as 5-bit signed literal
7903static __inline__ vector signed char __ATTRS_o_ai
7904vec_vspltisb(signed char __a) {
7905  return (vector signed char)(__a);
7906}
7907
7908/* vec_splat_s16 */
7909
7910#define __builtin_altivec_vspltish vec_splat_s16
7911
7912// FIXME: parameter should be treated as 5-bit signed literal
7913static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
7914  return (vector short)(__a);
7915}
7916
7917/* vec_vspltish */
7918
7919// FIXME: parameter should be treated as 5-bit signed literal
7920static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
7921  return (vector short)(__a);
7922}
7923
7924/* vec_splat_s32 */
7925
7926#define __builtin_altivec_vspltisw vec_splat_s32
7927
7928// FIXME: parameter should be treated as 5-bit signed literal
7929static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
7930  return (vector int)(__a);
7931}
7932
7933/* vec_vspltisw */
7934
7935// FIXME: parameter should be treated as 5-bit signed literal
7936static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
7937  return (vector int)(__a);
7938}
7939
7940/* vec_splat_u8 */
7941
7942// FIXME: parameter should be treated as 5-bit signed literal
7943static __inline__ vector unsigned char __ATTRS_o_ai
7944vec_splat_u8(unsigned char __a) {
7945  return (vector unsigned char)(__a);
7946}
7947
7948/* vec_splat_u16 */
7949
7950// FIXME: parameter should be treated as 5-bit signed literal
7951static __inline__ vector unsigned short __ATTRS_o_ai
7952vec_splat_u16(signed char __a) {
7953  return (vector unsigned short)(__a);
7954}
7955
7956/* vec_splat_u32 */
7957
7958// FIXME: parameter should be treated as 5-bit signed literal
7959static __inline__ vector unsigned int __ATTRS_o_ai
7960vec_splat_u32(signed char __a) {
7961  return (vector unsigned int)(__a);
7962}
7963
7964/* vec_sr */
7965
7966static __inline__ vector signed char __ATTRS_o_ai
7967vec_sr(vector signed char __a, vector unsigned char __b) {
7968  vector unsigned char __res = (vector unsigned char)__a >> __b;
7969  return (vector signed char)__res;
7970}
7971
7972static __inline__ vector unsigned char __ATTRS_o_ai
7973vec_sr(vector unsigned char __a, vector unsigned char __b) {
7974  return __a >> __b;
7975}
7976
7977static __inline__ vector signed short __ATTRS_o_ai
7978vec_sr(vector signed short __a, vector unsigned short __b) {
7979  vector unsigned short __res = (vector unsigned short)__a >> __b;
7980  return (vector signed short)__res;
7981}
7982
7983static __inline__ vector unsigned short __ATTRS_o_ai
7984vec_sr(vector unsigned short __a, vector unsigned short __b) {
7985  return __a >> __b;
7986}
7987
7988static __inline__ vector signed int __ATTRS_o_ai
7989vec_sr(vector signed int __a, vector unsigned int __b) {
7990  vector unsigned int __res = (vector unsigned int)__a >> __b;
7991  return (vector signed int)__res;
7992}
7993
7994static __inline__ vector unsigned int __ATTRS_o_ai
7995vec_sr(vector unsigned int __a, vector unsigned int __b) {
7996  return __a >> __b;
7997}
7998
7999#ifdef __POWER8_VECTOR__
8000static __inline__ vector signed long long __ATTRS_o_ai
8001vec_sr(vector signed long long __a, vector unsigned long long __b) {
8002  vector unsigned long long __res = (vector unsigned long long)__a >> __b;
8003  return (vector signed long long)__res;
8004}
8005
8006static __inline__ vector unsigned long long __ATTRS_o_ai
8007vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
8008  return __a >> __b;
8009}
8010#endif
8011
8012/* vec_vsrb */
8013
8014#define __builtin_altivec_vsrb vec_vsrb
8015
8016static __inline__ vector signed char __ATTRS_o_ai
8017vec_vsrb(vector signed char __a, vector unsigned char __b) {
8018  return __a >> (vector signed char)__b;
8019}
8020
8021static __inline__ vector unsigned char __ATTRS_o_ai
8022vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
8023  return __a >> __b;
8024}
8025
8026/* vec_vsrh */
8027
8028#define __builtin_altivec_vsrh vec_vsrh
8029
8030static __inline__ vector short __ATTRS_o_ai
8031vec_vsrh(vector short __a, vector unsigned short __b) {
8032  return __a >> (vector short)__b;
8033}
8034
8035static __inline__ vector unsigned short __ATTRS_o_ai
8036vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
8037  return __a >> __b;
8038}
8039
8040/* vec_vsrw */
8041
8042#define __builtin_altivec_vsrw vec_vsrw
8043
8044static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
8045                                                   vector unsigned int __b) {
8046  return __a >> (vector int)__b;
8047}
8048
8049static __inline__ vector unsigned int __ATTRS_o_ai
8050vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
8051  return __a >> __b;
8052}
8053
8054/* vec_sra */
8055
8056static __inline__ vector signed char __ATTRS_o_ai
8057vec_sra(vector signed char __a, vector unsigned char __b) {
8058  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8059}
8060
8061static __inline__ vector unsigned char __ATTRS_o_ai
8062vec_sra(vector unsigned char __a, vector unsigned char __b) {
8063  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8064}
8065
8066static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
8067                                                    vector unsigned short __b) {
8068  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8069}
8070
8071static __inline__ vector unsigned short __ATTRS_o_ai
8072vec_sra(vector unsigned short __a, vector unsigned short __b) {
8073  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8074}
8075
8076static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
8077                                                  vector unsigned int __b) {
8078  return __builtin_altivec_vsraw(__a, __b);
8079}
8080
8081static __inline__ vector unsigned int __ATTRS_o_ai
8082vec_sra(vector unsigned int __a, vector unsigned int __b) {
8083  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8084}
8085
8086#ifdef __POWER8_VECTOR__
8087static __inline__ vector signed long long __ATTRS_o_ai
8088vec_sra(vector signed long long __a, vector unsigned long long __b) {
8089  return __a >> __b;
8090}
8091
8092static __inline__ vector unsigned long long __ATTRS_o_ai
8093vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
8094  return (vector unsigned long long)((vector signed long long)__a >> __b);
8095}
8096#endif
8097
8098/* vec_vsrab */
8099
8100static __inline__ vector signed char __ATTRS_o_ai
8101vec_vsrab(vector signed char __a, vector unsigned char __b) {
8102  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8103}
8104
8105static __inline__ vector unsigned char __ATTRS_o_ai
8106vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
8107  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8108}
8109
8110/* vec_vsrah */
8111
8112static __inline__ vector short __ATTRS_o_ai
8113vec_vsrah(vector short __a, vector unsigned short __b) {
8114  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8115}
8116
8117static __inline__ vector unsigned short __ATTRS_o_ai
8118vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
8119  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8120}
8121
8122/* vec_vsraw */
8123
8124static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
8125                                                    vector unsigned int __b) {
8126  return __builtin_altivec_vsraw(__a, __b);
8127}
8128
8129static __inline__ vector unsigned int __ATTRS_o_ai
8130vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
8131  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8132}
8133
8134/* vec_srl */
8135
8136static __inline__ vector signed char __ATTRS_o_ai
8137vec_srl(vector signed char __a, vector unsigned char __b) {
8138  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8139                                                   (vector int)__b);
8140}
8141
8142static __inline__ vector signed char __ATTRS_o_ai
8143vec_srl(vector signed char __a, vector unsigned short __b) {
8144  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8145                                                   (vector int)__b);
8146}
8147
8148static __inline__ vector signed char __ATTRS_o_ai
8149vec_srl(vector signed char __a, vector unsigned int __b) {
8150  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8151                                                   (vector int)__b);
8152}
8153
8154static __inline__ vector unsigned char __ATTRS_o_ai
8155vec_srl(vector unsigned char __a, vector unsigned char __b) {
8156  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8157                                                     (vector int)__b);
8158}
8159
8160static __inline__ vector unsigned char __ATTRS_o_ai
8161vec_srl(vector unsigned char __a, vector unsigned short __b) {
8162  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8163                                                     (vector int)__b);
8164}
8165
8166static __inline__ vector unsigned char __ATTRS_o_ai
8167vec_srl(vector unsigned char __a, vector unsigned int __b) {
8168  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8169                                                     (vector int)__b);
8170}
8171
8172static __inline__ vector bool char __ATTRS_o_ai
8173vec_srl(vector bool char __a, vector unsigned char __b) {
8174  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8175                                                 (vector int)__b);
8176}
8177
8178static __inline__ vector bool char __ATTRS_o_ai
8179vec_srl(vector bool char __a, vector unsigned short __b) {
8180  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8181                                                 (vector int)__b);
8182}
8183
8184static __inline__ vector bool char __ATTRS_o_ai
8185vec_srl(vector bool char __a, vector unsigned int __b) {
8186  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8187                                                 (vector int)__b);
8188}
8189
8190static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8191                                                    vector unsigned char __b) {
8192  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8193}
8194
8195static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8196                                                    vector unsigned short __b) {
8197  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8198}
8199
8200static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8201                                                    vector unsigned int __b) {
8202  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8203}
8204
8205static __inline__ vector unsigned short __ATTRS_o_ai
8206vec_srl(vector unsigned short __a, vector unsigned char __b) {
8207  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8208                                                      (vector int)__b);
8209}
8210
8211static __inline__ vector unsigned short __ATTRS_o_ai
8212vec_srl(vector unsigned short __a, vector unsigned short __b) {
8213  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8214                                                      (vector int)__b);
8215}
8216
8217static __inline__ vector unsigned short __ATTRS_o_ai
8218vec_srl(vector unsigned short __a, vector unsigned int __b) {
8219  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8220                                                      (vector int)__b);
8221}
8222
8223static __inline__ vector bool short __ATTRS_o_ai
8224vec_srl(vector bool short __a, vector unsigned char __b) {
8225  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8226                                                  (vector int)__b);
8227}
8228
8229static __inline__ vector bool short __ATTRS_o_ai
8230vec_srl(vector bool short __a, vector unsigned short __b) {
8231  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8232                                                  (vector int)__b);
8233}
8234
8235static __inline__ vector bool short __ATTRS_o_ai
8236vec_srl(vector bool short __a, vector unsigned int __b) {
8237  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8238                                                  (vector int)__b);
8239}
8240
8241static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8242                                                    vector unsigned char __b) {
8243  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8244}
8245
8246static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8247                                                    vector unsigned short __b) {
8248  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8249}
8250
8251static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8252                                                    vector unsigned int __b) {
8253  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8254}
8255
8256static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8257                                                  vector unsigned char __b) {
8258  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8259}
8260
8261static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8262                                                  vector unsigned short __b) {
8263  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8264}
8265
8266static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8267                                                  vector unsigned int __b) {
8268  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8269}
8270
8271static __inline__ vector unsigned int __ATTRS_o_ai
8272vec_srl(vector unsigned int __a, vector unsigned char __b) {
8273  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8274                                                    (vector int)__b);
8275}
8276
8277static __inline__ vector unsigned int __ATTRS_o_ai
8278vec_srl(vector unsigned int __a, vector unsigned short __b) {
8279  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8280                                                    (vector int)__b);
8281}
8282
8283static __inline__ vector unsigned int __ATTRS_o_ai
8284vec_srl(vector unsigned int __a, vector unsigned int __b) {
8285  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8286                                                    (vector int)__b);
8287}
8288
8289static __inline__ vector bool int __ATTRS_o_ai
8290vec_srl(vector bool int __a, vector unsigned char __b) {
8291  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8292                                                (vector int)__b);
8293}
8294
8295static __inline__ vector bool int __ATTRS_o_ai
8296vec_srl(vector bool int __a, vector unsigned short __b) {
8297  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8298                                                (vector int)__b);
8299}
8300
8301static __inline__ vector bool int __ATTRS_o_ai
8302vec_srl(vector bool int __a, vector unsigned int __b) {
8303  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8304                                                (vector int)__b);
8305}
8306
8307/* vec_vsr */
8308
8309static __inline__ vector signed char __ATTRS_o_ai
8310vec_vsr(vector signed char __a, vector unsigned char __b) {
8311  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8312                                                   (vector int)__b);
8313}
8314
8315static __inline__ vector signed char __ATTRS_o_ai
8316vec_vsr(vector signed char __a, vector unsigned short __b) {
8317  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8318                                                   (vector int)__b);
8319}
8320
8321static __inline__ vector signed char __ATTRS_o_ai
8322vec_vsr(vector signed char __a, vector unsigned int __b) {
8323  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8324                                                   (vector int)__b);
8325}
8326
8327static __inline__ vector unsigned char __ATTRS_o_ai
8328vec_vsr(vector unsigned char __a, vector unsigned char __b) {
8329  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8330                                                     (vector int)__b);
8331}
8332
8333static __inline__ vector unsigned char __ATTRS_o_ai
8334vec_vsr(vector unsigned char __a, vector unsigned short __b) {
8335  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8336                                                     (vector int)__b);
8337}
8338
8339static __inline__ vector unsigned char __ATTRS_o_ai
8340vec_vsr(vector unsigned char __a, vector unsigned int __b) {
8341  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8342                                                     (vector int)__b);
8343}
8344
8345static __inline__ vector bool char __ATTRS_o_ai
8346vec_vsr(vector bool char __a, vector unsigned char __b) {
8347  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8348                                                 (vector int)__b);
8349}
8350
8351static __inline__ vector bool char __ATTRS_o_ai
8352vec_vsr(vector bool char __a, vector unsigned short __b) {
8353  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8354                                                 (vector int)__b);
8355}
8356
8357static __inline__ vector bool char __ATTRS_o_ai
8358vec_vsr(vector bool char __a, vector unsigned int __b) {
8359  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8360                                                 (vector int)__b);
8361}
8362
8363static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8364                                                    vector unsigned char __b) {
8365  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8366}
8367
8368static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8369                                                    vector unsigned short __b) {
8370  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8371}
8372
8373static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8374                                                    vector unsigned int __b) {
8375  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8376}
8377
8378static __inline__ vector unsigned short __ATTRS_o_ai
8379vec_vsr(vector unsigned short __a, vector unsigned char __b) {
8380  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8381                                                      (vector int)__b);
8382}
8383
8384static __inline__ vector unsigned short __ATTRS_o_ai
8385vec_vsr(vector unsigned short __a, vector unsigned short __b) {
8386  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8387                                                      (vector int)__b);
8388}
8389
8390static __inline__ vector unsigned short __ATTRS_o_ai
8391vec_vsr(vector unsigned short __a, vector unsigned int __b) {
8392  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8393                                                      (vector int)__b);
8394}
8395
8396static __inline__ vector bool short __ATTRS_o_ai
8397vec_vsr(vector bool short __a, vector unsigned char __b) {
8398  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8399                                                  (vector int)__b);
8400}
8401
8402static __inline__ vector bool short __ATTRS_o_ai
8403vec_vsr(vector bool short __a, vector unsigned short __b) {
8404  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8405                                                  (vector int)__b);
8406}
8407
8408static __inline__ vector bool short __ATTRS_o_ai
8409vec_vsr(vector bool short __a, vector unsigned int __b) {
8410  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8411                                                  (vector int)__b);
8412}
8413
8414static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8415                                                    vector unsigned char __b) {
8416  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8417}
8418
8419static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8420                                                    vector unsigned short __b) {
8421  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8422}
8423
8424static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8425                                                    vector unsigned int __b) {
8426  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8427}
8428
8429static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8430                                                  vector unsigned char __b) {
8431  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8432}
8433
8434static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8435                                                  vector unsigned short __b) {
8436  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8437}
8438
8439static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8440                                                  vector unsigned int __b) {
8441  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8442}
8443
8444static __inline__ vector unsigned int __ATTRS_o_ai
8445vec_vsr(vector unsigned int __a, vector unsigned char __b) {
8446  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8447                                                    (vector int)__b);
8448}
8449
8450static __inline__ vector unsigned int __ATTRS_o_ai
8451vec_vsr(vector unsigned int __a, vector unsigned short __b) {
8452  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8453                                                    (vector int)__b);
8454}
8455
8456static __inline__ vector unsigned int __ATTRS_o_ai
8457vec_vsr(vector unsigned int __a, vector unsigned int __b) {
8458  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8459                                                    (vector int)__b);
8460}
8461
8462static __inline__ vector bool int __ATTRS_o_ai
8463vec_vsr(vector bool int __a, vector unsigned char __b) {
8464  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8465                                                (vector int)__b);
8466}
8467
8468static __inline__ vector bool int __ATTRS_o_ai
8469vec_vsr(vector bool int __a, vector unsigned short __b) {
8470  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8471                                                (vector int)__b);
8472}
8473
8474static __inline__ vector bool int __ATTRS_o_ai
8475vec_vsr(vector bool int __a, vector unsigned int __b) {
8476  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8477                                                (vector int)__b);
8478}
8479
8480/* vec_sro */
8481
8482static __inline__ vector signed char __ATTRS_o_ai
8483vec_sro(vector signed char __a, vector signed char __b) {
8484  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8485                                                    (vector int)__b);
8486}
8487
8488static __inline__ vector signed char __ATTRS_o_ai
8489vec_sro(vector signed char __a, vector unsigned char __b) {
8490  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8491                                                    (vector int)__b);
8492}
8493
8494static __inline__ vector unsigned char __ATTRS_o_ai
8495vec_sro(vector unsigned char __a, vector signed char __b) {
8496  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8497                                                      (vector int)__b);
8498}
8499
8500static __inline__ vector unsigned char __ATTRS_o_ai
8501vec_sro(vector unsigned char __a, vector unsigned char __b) {
8502  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8503                                                      (vector int)__b);
8504}
8505
8506static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
8507                                                    vector signed char __b) {
8508  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8509}
8510
8511static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
8512                                                    vector unsigned char __b) {
8513  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8514}
8515
8516static __inline__ vector unsigned short __ATTRS_o_ai
8517vec_sro(vector unsigned short __a, vector signed char __b) {
8518  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8519                                                       (vector int)__b);
8520}
8521
8522static __inline__ vector unsigned short __ATTRS_o_ai
8523vec_sro(vector unsigned short __a, vector unsigned char __b) {
8524  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8525                                                       (vector int)__b);
8526}
8527
8528static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8529                                                    vector signed char __b) {
8530  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8531}
8532
8533static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8534                                                    vector unsigned char __b) {
8535  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8536}
8537
8538static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
8539                                                  vector signed char __b) {
8540  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8541}
8542
8543static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
8544                                                  vector unsigned char __b) {
8545  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8546}
8547
8548static __inline__ vector unsigned int __ATTRS_o_ai
8549vec_sro(vector unsigned int __a, vector signed char __b) {
8550  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8551                                                     (vector int)__b);
8552}
8553
8554static __inline__ vector unsigned int __ATTRS_o_ai
8555vec_sro(vector unsigned int __a, vector unsigned char __b) {
8556  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8557                                                     (vector int)__b);
8558}
8559
8560static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
8561                                                    vector signed char __b) {
8562  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8563}
8564
8565static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
8566                                                    vector unsigned char __b) {
8567  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8568}
8569
8570/* vec_vsro */
8571
8572static __inline__ vector signed char __ATTRS_o_ai
8573vec_vsro(vector signed char __a, vector signed char __b) {
8574  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8575                                                    (vector int)__b);
8576}
8577
8578static __inline__ vector signed char __ATTRS_o_ai
8579vec_vsro(vector signed char __a, vector unsigned char __b) {
8580  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8581                                                    (vector int)__b);
8582}
8583
8584static __inline__ vector unsigned char __ATTRS_o_ai
8585vec_vsro(vector unsigned char __a, vector signed char __b) {
8586  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8587                                                      (vector int)__b);
8588}
8589
8590static __inline__ vector unsigned char __ATTRS_o_ai
8591vec_vsro(vector unsigned char __a, vector unsigned char __b) {
8592  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8593                                                      (vector int)__b);
8594}
8595
8596static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
8597                                                     vector signed char __b) {
8598  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8599}
8600
8601static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
8602                                                     vector unsigned char __b) {
8603  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8604}
8605
8606static __inline__ vector unsigned short __ATTRS_o_ai
8607vec_vsro(vector unsigned short __a, vector signed char __b) {
8608  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8609                                                       (vector int)__b);
8610}
8611
8612static __inline__ vector unsigned short __ATTRS_o_ai
8613vec_vsro(vector unsigned short __a, vector unsigned char __b) {
8614  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8615                                                       (vector int)__b);
8616}
8617
8618static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8619                                                     vector signed char __b) {
8620  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8621}
8622
8623static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8624                                                     vector unsigned char __b) {
8625  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8626}
8627
8628static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
8629                                                   vector signed char __b) {
8630  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8631}
8632
8633static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
8634                                                   vector unsigned char __b) {
8635  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8636}
8637
8638static __inline__ vector unsigned int __ATTRS_o_ai
8639vec_vsro(vector unsigned int __a, vector signed char __b) {
8640  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8641                                                     (vector int)__b);
8642}
8643
8644static __inline__ vector unsigned int __ATTRS_o_ai
8645vec_vsro(vector unsigned int __a, vector unsigned char __b) {
8646  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8647                                                     (vector int)__b);
8648}
8649
8650static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
8651                                                     vector signed char __b) {
8652  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8653}
8654
8655static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
8656                                                     vector unsigned char __b) {
8657  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8658}
8659
8660/* vec_st */
8661
8662static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8663                                           vector signed char *__c) {
8664  __builtin_altivec_stvx((vector int)__a, __b, __c);
8665}
8666
8667static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8668                                           signed char *__c) {
8669  __builtin_altivec_stvx((vector int)__a, __b, __c);
8670}
8671
8672static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8673                                           vector unsigned char *__c) {
8674  __builtin_altivec_stvx((vector int)__a, __b, __c);
8675}
8676
8677static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8678                                           unsigned char *__c) {
8679  __builtin_altivec_stvx((vector int)__a, __b, __c);
8680}
8681
8682static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8683                                           signed char *__c) {
8684  __builtin_altivec_stvx((vector int)__a, __b, __c);
8685}
8686
8687static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8688                                           unsigned char *__c) {
8689  __builtin_altivec_stvx((vector int)__a, __b, __c);
8690}
8691
8692static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8693                                           vector bool char *__c) {
8694  __builtin_altivec_stvx((vector int)__a, __b, __c);
8695}
8696
8697static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
8698                                           vector short *__c) {
8699  __builtin_altivec_stvx((vector int)__a, __b, __c);
8700}
8701
8702static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
8703                                           short *__c) {
8704  __builtin_altivec_stvx((vector int)__a, __b, __c);
8705}
8706
8707static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8708                                           vector unsigned short *__c) {
8709  __builtin_altivec_stvx((vector int)__a, __b, __c);
8710}
8711
8712static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8713                                           unsigned short *__c) {
8714  __builtin_altivec_stvx((vector int)__a, __b, __c);
8715}
8716
8717static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8718                                           short *__c) {
8719  __builtin_altivec_stvx((vector int)__a, __b, __c);
8720}
8721
8722static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8723                                           unsigned short *__c) {
8724  __builtin_altivec_stvx((vector int)__a, __b, __c);
8725}
8726
8727static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8728                                           vector bool short *__c) {
8729  __builtin_altivec_stvx((vector int)__a, __b, __c);
8730}
8731
8732static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8733                                           short *__c) {
8734  __builtin_altivec_stvx((vector int)__a, __b, __c);
8735}
8736
8737static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8738                                           unsigned short *__c) {
8739  __builtin_altivec_stvx((vector int)__a, __b, __c);
8740}
8741
8742static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8743                                           vector pixel *__c) {
8744  __builtin_altivec_stvx((vector int)__a, __b, __c);
8745}
8746
8747static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
8748                                           vector int *__c) {
8749  __builtin_altivec_stvx(__a, __b, __c);
8750}
8751
8752static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
8753  __builtin_altivec_stvx(__a, __b, __c);
8754}
8755
8756static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8757                                           vector unsigned int *__c) {
8758  __builtin_altivec_stvx((vector int)__a, __b, __c);
8759}
8760
8761static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8762                                           unsigned int *__c) {
8763  __builtin_altivec_stvx((vector int)__a, __b, __c);
8764}
8765
8766static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8767                                           int *__c) {
8768  __builtin_altivec_stvx((vector int)__a, __b, __c);
8769}
8770
8771static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8772                                           unsigned int *__c) {
8773  __builtin_altivec_stvx((vector int)__a, __b, __c);
8774}
8775
8776static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8777                                           vector bool int *__c) {
8778  __builtin_altivec_stvx((vector int)__a, __b, __c);
8779}
8780
8781static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
8782                                           vector float *__c) {
8783  __builtin_altivec_stvx((vector int)__a, __b, __c);
8784}
8785
8786static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
8787                                           float *__c) {
8788  __builtin_altivec_stvx((vector int)__a, __b, __c);
8789}
8790
8791/* vec_stvx */
8792
8793static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8794                                             vector signed char *__c) {
8795  __builtin_altivec_stvx((vector int)__a, __b, __c);
8796}
8797
8798static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8799                                             signed char *__c) {
8800  __builtin_altivec_stvx((vector int)__a, __b, __c);
8801}
8802
8803static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8804                                             vector unsigned char *__c) {
8805  __builtin_altivec_stvx((vector int)__a, __b, __c);
8806}
8807
8808static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8809                                             unsigned char *__c) {
8810  __builtin_altivec_stvx((vector int)__a, __b, __c);
8811}
8812
8813static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8814                                             signed char *__c) {
8815  __builtin_altivec_stvx((vector int)__a, __b, __c);
8816}
8817
8818static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8819                                             unsigned char *__c) {
8820  __builtin_altivec_stvx((vector int)__a, __b, __c);
8821}
8822
8823static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8824                                             vector bool char *__c) {
8825  __builtin_altivec_stvx((vector int)__a, __b, __c);
8826}
8827
8828static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8829                                             vector short *__c) {
8830  __builtin_altivec_stvx((vector int)__a, __b, __c);
8831}
8832
8833static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8834                                             short *__c) {
8835  __builtin_altivec_stvx((vector int)__a, __b, __c);
8836}
8837
8838static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8839                                             vector unsigned short *__c) {
8840  __builtin_altivec_stvx((vector int)__a, __b, __c);
8841}
8842
8843static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8844                                             unsigned short *__c) {
8845  __builtin_altivec_stvx((vector int)__a, __b, __c);
8846}
8847
8848static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8849                                             short *__c) {
8850  __builtin_altivec_stvx((vector int)__a, __b, __c);
8851}
8852
8853static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8854                                             unsigned short *__c) {
8855  __builtin_altivec_stvx((vector int)__a, __b, __c);
8856}
8857
8858static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8859                                             vector bool short *__c) {
8860  __builtin_altivec_stvx((vector int)__a, __b, __c);
8861}
8862
8863static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8864                                             short *__c) {
8865  __builtin_altivec_stvx((vector int)__a, __b, __c);
8866}
8867
8868static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8869                                             unsigned short *__c) {
8870  __builtin_altivec_stvx((vector int)__a, __b, __c);
8871}
8872
8873static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8874                                             vector pixel *__c) {
8875  __builtin_altivec_stvx((vector int)__a, __b, __c);
8876}
8877
8878static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
8879                                             vector int *__c) {
8880  __builtin_altivec_stvx(__a, __b, __c);
8881}
8882
8883static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
8884                                             int *__c) {
8885  __builtin_altivec_stvx(__a, __b, __c);
8886}
8887
8888static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8889                                             vector unsigned int *__c) {
8890  __builtin_altivec_stvx((vector int)__a, __b, __c);
8891}
8892
8893static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8894                                             unsigned int *__c) {
8895  __builtin_altivec_stvx((vector int)__a, __b, __c);
8896}
8897
8898static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8899                                             int *__c) {
8900  __builtin_altivec_stvx((vector int)__a, __b, __c);
8901}
8902
8903static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8904                                             unsigned int *__c) {
8905  __builtin_altivec_stvx((vector int)__a, __b, __c);
8906}
8907
8908static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8909                                             vector bool int *__c) {
8910  __builtin_altivec_stvx((vector int)__a, __b, __c);
8911}
8912
8913static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8914                                             vector float *__c) {
8915  __builtin_altivec_stvx((vector int)__a, __b, __c);
8916}
8917
8918static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8919                                             float *__c) {
8920  __builtin_altivec_stvx((vector int)__a, __b, __c);
8921}
8922
8923/* vec_ste */
8924
8925static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
8926                                            signed char *__c) {
8927  __builtin_altivec_stvebx((vector char)__a, __b, __c);
8928}
8929
8930static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
8931                                            unsigned char *__c) {
8932  __builtin_altivec_stvebx((vector char)__a, __b, __c);
8933}
8934
8935static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8936                                            signed char *__c) {
8937  __builtin_altivec_stvebx((vector char)__a, __b, __c);
8938}
8939
8940static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8941                                            unsigned char *__c) {
8942  __builtin_altivec_stvebx((vector char)__a, __b, __c);
8943}
8944
8945static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
8946                                            short *__c) {
8947  __builtin_altivec_stvehx(__a, __b, __c);
8948}
8949
8950static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
8951                                            unsigned short *__c) {
8952  __builtin_altivec_stvehx((vector short)__a, __b, __c);
8953}
8954
8955static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8956                                            short *__c) {
8957  __builtin_altivec_stvehx((vector short)__a, __b, __c);
8958}
8959
8960static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8961                                            unsigned short *__c) {
8962  __builtin_altivec_stvehx((vector short)__a, __b, __c);
8963}
8964
8965static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8966                                            short *__c) {
8967  __builtin_altivec_stvehx((vector short)__a, __b, __c);
8968}
8969
8970static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8971                                            unsigned short *__c) {
8972  __builtin_altivec_stvehx((vector short)__a, __b, __c);
8973}
8974
8975static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
8976  __builtin_altivec_stvewx(__a, __b, __c);
8977}
8978
8979static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
8980                                            unsigned int *__c) {
8981  __builtin_altivec_stvewx((vector int)__a, __b, __c);
8982}
8983
8984static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8985                                            int *__c) {
8986  __builtin_altivec_stvewx((vector int)__a, __b, __c);
8987}
8988
8989static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8990                                            unsigned int *__c) {
8991  __builtin_altivec_stvewx((vector int)__a, __b, __c);
8992}
8993
8994static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
8995                                            float *__c) {
8996  __builtin_altivec_stvewx((vector int)__a, __b, __c);
8997}
8998
8999/* vec_stvebx */
9000
9001static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
9002                                               signed char *__c) {
9003  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9004}
9005
9006static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
9007                                               int __b, unsigned char *__c) {
9008  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9009}
9010
9011static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9012                                               signed char *__c) {
9013  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9014}
9015
9016static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9017                                               unsigned char *__c) {
9018  __builtin_altivec_stvebx((vector char)__a, __b, __c);
9019}
9020
9021/* vec_stvehx */
9022
9023static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
9024                                               short *__c) {
9025  __builtin_altivec_stvehx(__a, __b, __c);
9026}
9027
9028static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
9029                                               int __b, unsigned short *__c) {
9030  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9031}
9032
9033static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9034                                               short *__c) {
9035  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9036}
9037
9038static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9039                                               unsigned short *__c) {
9040  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9041}
9042
9043static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9044                                               short *__c) {
9045  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9046}
9047
9048static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9049                                               unsigned short *__c) {
9050  __builtin_altivec_stvehx((vector short)__a, __b, __c);
9051}
9052
9053/* vec_stvewx */
9054
9055static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
9056                                               int *__c) {
9057  __builtin_altivec_stvewx(__a, __b, __c);
9058}
9059
9060static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
9061                                               unsigned int *__c) {
9062  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9063}
9064
9065static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
9066                                               int *__c) {
9067  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9068}
9069
9070static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
9071                                               unsigned int *__c) {
9072  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9073}
9074
9075static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
9076                                               float *__c) {
9077  __builtin_altivec_stvewx((vector int)__a, __b, __c);
9078}
9079
9080/* vec_stl */
9081
9082static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
9083                                            vector signed char *__c) {
9084  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9085}
9086
9087static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
9088                                            signed char *__c) {
9089  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9090}
9091
9092static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
9093                                            vector unsigned char *__c) {
9094  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9095}
9096
9097static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
9098                                            unsigned char *__c) {
9099  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9100}
9101
9102static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9103                                            signed char *__c) {
9104  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9105}
9106
9107static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9108                                            unsigned char *__c) {
9109  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9110}
9111
9112static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9113                                            vector bool char *__c) {
9114  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9115}
9116
9117static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
9118                                            vector short *__c) {
9119  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9120}
9121
9122static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
9123                                            short *__c) {
9124  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9125}
9126
9127static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9128                                            vector unsigned short *__c) {
9129  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9130}
9131
9132static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9133                                            unsigned short *__c) {
9134  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9135}
9136
9137static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9138                                            short *__c) {
9139  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9140}
9141
9142static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9143                                            unsigned short *__c) {
9144  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9145}
9146
9147static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9148                                            vector bool short *__c) {
9149  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9150}
9151
9152static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9153                                            short *__c) {
9154  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9155}
9156
9157static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9158                                            unsigned short *__c) {
9159  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9160}
9161
9162static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9163                                            vector pixel *__c) {
9164  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9165}
9166
9167static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
9168                                            vector int *__c) {
9169  __builtin_altivec_stvxl(__a, __b, __c);
9170}
9171
9172static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
9173  __builtin_altivec_stvxl(__a, __b, __c);
9174}
9175
9176static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9177                                            vector unsigned int *__c) {
9178  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9179}
9180
9181static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9182                                            unsigned int *__c) {
9183  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9184}
9185
9186static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9187                                            int *__c) {
9188  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9189}
9190
9191static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9192                                            unsigned int *__c) {
9193  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9194}
9195
9196static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9197                                            vector bool int *__c) {
9198  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9199}
9200
9201static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
9202                                            vector float *__c) {
9203  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9204}
9205
9206static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
9207                                            float *__c) {
9208  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9209}
9210
9211/* vec_stvxl */
9212
9213static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9214                                              vector signed char *__c) {
9215  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9216}
9217
9218static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9219                                              signed char *__c) {
9220  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9221}
9222
9223static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9224                                              vector unsigned char *__c) {
9225  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9226}
9227
9228static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9229                                              unsigned char *__c) {
9230  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9231}
9232
9233static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9234                                              signed char *__c) {
9235  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9236}
9237
9238static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9239                                              unsigned char *__c) {
9240  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9241}
9242
9243static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9244                                              vector bool char *__c) {
9245  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9246}
9247
9248static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9249                                              vector short *__c) {
9250  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9251}
9252
9253static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9254                                              short *__c) {
9255  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9256}
9257
9258static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
9259                                              int __b,
9260                                              vector unsigned short *__c) {
9261  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9262}
9263
9264static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
9265                                              int __b, unsigned short *__c) {
9266  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9267}
9268
9269static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9270                                              short *__c) {
9271  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9272}
9273
9274static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9275                                              unsigned short *__c) {
9276  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9277}
9278
9279static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9280                                              vector bool short *__c) {
9281  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9282}
9283
9284static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9285                                              short *__c) {
9286  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9287}
9288
9289static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9290                                              unsigned short *__c) {
9291  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9292}
9293
9294static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9295                                              vector pixel *__c) {
9296  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9297}
9298
9299static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
9300                                              vector int *__c) {
9301  __builtin_altivec_stvxl(__a, __b, __c);
9302}
9303
9304static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
9305                                              int *__c) {
9306  __builtin_altivec_stvxl(__a, __b, __c);
9307}
9308
9309static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9310                                              vector unsigned int *__c) {
9311  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9312}
9313
9314static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9315                                              unsigned int *__c) {
9316  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9317}
9318
9319static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9320                                              int *__c) {
9321  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9322}
9323
9324static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9325                                              unsigned int *__c) {
9326  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9327}
9328
9329static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9330                                              vector bool int *__c) {
9331  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9332}
9333
9334static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9335                                              vector float *__c) {
9336  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9337}
9338
9339static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9340                                              float *__c) {
9341  __builtin_altivec_stvxl((vector int)__a, __b, __c);
9342}
9343
9344/* vec_sub */
9345
9346static __inline__ vector signed char __ATTRS_o_ai
9347vec_sub(vector signed char __a, vector signed char __b) {
9348  return __a - __b;
9349}
9350
9351static __inline__ vector signed char __ATTRS_o_ai
9352vec_sub(vector bool char __a, vector signed char __b) {
9353  return (vector signed char)__a - __b;
9354}
9355
9356static __inline__ vector signed char __ATTRS_o_ai
9357vec_sub(vector signed char __a, vector bool char __b) {
9358  return __a - (vector signed char)__b;
9359}
9360
9361static __inline__ vector unsigned char __ATTRS_o_ai
9362vec_sub(vector unsigned char __a, vector unsigned char __b) {
9363  return __a - __b;
9364}
9365
9366static __inline__ vector unsigned char __ATTRS_o_ai
9367vec_sub(vector bool char __a, vector unsigned char __b) {
9368  return (vector unsigned char)__a - __b;
9369}
9370
9371static __inline__ vector unsigned char __ATTRS_o_ai
9372vec_sub(vector unsigned char __a, vector bool char __b) {
9373  return __a - (vector unsigned char)__b;
9374}
9375
9376static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
9377                                                    vector short __b) {
9378  return __a - __b;
9379}
9380
9381static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
9382                                                    vector short __b) {
9383  return (vector short)__a - __b;
9384}
9385
9386static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
9387                                                    vector bool short __b) {
9388  return __a - (vector short)__b;
9389}
9390
9391static __inline__ vector unsigned short __ATTRS_o_ai
9392vec_sub(vector unsigned short __a, vector unsigned short __b) {
9393  return __a - __b;
9394}
9395
9396static __inline__ vector unsigned short __ATTRS_o_ai
9397vec_sub(vector bool short __a, vector unsigned short __b) {
9398  return (vector unsigned short)__a - __b;
9399}
9400
9401static __inline__ vector unsigned short __ATTRS_o_ai
9402vec_sub(vector unsigned short __a, vector bool short __b) {
9403  return __a - (vector unsigned short)__b;
9404}
9405
9406static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
9407                                                  vector int __b) {
9408  return __a - __b;
9409}
9410
9411static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
9412                                                  vector int __b) {
9413  return (vector int)__a - __b;
9414}
9415
9416static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
9417                                                  vector bool int __b) {
9418  return __a - (vector int)__b;
9419}
9420
9421static __inline__ vector unsigned int __ATTRS_o_ai
9422vec_sub(vector unsigned int __a, vector unsigned int __b) {
9423  return __a - __b;
9424}
9425
9426static __inline__ vector unsigned int __ATTRS_o_ai
9427vec_sub(vector bool int __a, vector unsigned int __b) {
9428  return (vector unsigned int)__a - __b;
9429}
9430
9431static __inline__ vector unsigned int __ATTRS_o_ai
9432vec_sub(vector unsigned int __a, vector bool int __b) {
9433  return __a - (vector unsigned int)__b;
9434}
9435
9436#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9437static __inline__ vector signed __int128 __ATTRS_o_ai
9438vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
9439  return __a - __b;
9440}
9441
9442static __inline__ vector unsigned __int128 __ATTRS_o_ai
9443vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9444  return __a - __b;
9445}
9446#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9447
9448#ifdef __VSX__
9449static __inline__ vector signed long long __ATTRS_o_ai
9450vec_sub(vector signed long long __a, vector signed long long __b) {
9451  return __a - __b;
9452}
9453
9454static __inline__ vector unsigned long long __ATTRS_o_ai
9455vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
9456  return __a - __b;
9457}
9458
9459static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
9460                                                     vector double __b) {
9461  return __a - __b;
9462}
9463#endif
9464
9465static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
9466                                                    vector float __b) {
9467  return __a - __b;
9468}
9469
9470/* vec_vsububm */
9471
9472#define __builtin_altivec_vsububm vec_vsububm
9473
9474static __inline__ vector signed char __ATTRS_o_ai
9475vec_vsububm(vector signed char __a, vector signed char __b) {
9476  return __a - __b;
9477}
9478
9479static __inline__ vector signed char __ATTRS_o_ai
9480vec_vsububm(vector bool char __a, vector signed char __b) {
9481  return (vector signed char)__a - __b;
9482}
9483
9484static __inline__ vector signed char __ATTRS_o_ai
9485vec_vsububm(vector signed char __a, vector bool char __b) {
9486  return __a - (vector signed char)__b;
9487}
9488
9489static __inline__ vector unsigned char __ATTRS_o_ai
9490vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
9491  return __a - __b;
9492}
9493
9494static __inline__ vector unsigned char __ATTRS_o_ai
9495vec_vsububm(vector bool char __a, vector unsigned char __b) {
9496  return (vector unsigned char)__a - __b;
9497}
9498
9499static __inline__ vector unsigned char __ATTRS_o_ai
9500vec_vsububm(vector unsigned char __a, vector bool char __b) {
9501  return __a - (vector unsigned char)__b;
9502}
9503
9504/* vec_vsubuhm */
9505
9506#define __builtin_altivec_vsubuhm vec_vsubuhm
9507
9508static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9509                                                        vector short __b) {
9510  return __a - __b;
9511}
9512
9513static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
9514                                                        vector short __b) {
9515  return (vector short)__a - __b;
9516}
9517
9518static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9519                                                        vector bool short __b) {
9520  return __a - (vector short)__b;
9521}
9522
9523static __inline__ vector unsigned short __ATTRS_o_ai
9524vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
9525  return __a - __b;
9526}
9527
9528static __inline__ vector unsigned short __ATTRS_o_ai
9529vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
9530  return (vector unsigned short)__a - __b;
9531}
9532
9533static __inline__ vector unsigned short __ATTRS_o_ai
9534vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
9535  return __a - (vector unsigned short)__b;
9536}
9537
9538/* vec_vsubuwm */
9539
9540#define __builtin_altivec_vsubuwm vec_vsubuwm
9541
9542static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9543                                                      vector int __b) {
9544  return __a - __b;
9545}
9546
9547static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9548                                                      vector int __b) {
9549  return (vector int)__a - __b;
9550}
9551
9552static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9553                                                      vector bool int __b) {
9554  return __a - (vector int)__b;
9555}
9556
9557static __inline__ vector unsigned int __ATTRS_o_ai
9558vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
9559  return __a - __b;
9560}
9561
9562static __inline__ vector unsigned int __ATTRS_o_ai
9563vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
9564  return (vector unsigned int)__a - __b;
9565}
9566
9567static __inline__ vector unsigned int __ATTRS_o_ai
9568vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
9569  return __a - (vector unsigned int)__b;
9570}
9571
9572/* vec_vsubfp */
9573
9574#define __builtin_altivec_vsubfp vec_vsubfp
9575
9576static __inline__ vector float __attribute__((__always_inline__))
9577vec_vsubfp(vector float __a, vector float __b) {
9578  return __a - __b;
9579}
9580
9581/* vec_subc */
9582
9583static __inline__ vector unsigned int __ATTRS_o_ai
9584vec_subc(vector unsigned int __a, vector unsigned int __b) {
9585  return __builtin_altivec_vsubcuw(__a, __b);
9586}
9587
9588#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9589static __inline__ vector unsigned __int128 __ATTRS_o_ai
9590vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9591  return __builtin_altivec_vsubcuq(__a, __b);
9592}
9593
9594static __inline__ vector signed __int128 __ATTRS_o_ai
9595vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
9596  return __builtin_altivec_vsubcuq(__a, __b);
9597}
9598#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9599
9600/* vec_vsubcuw */
9601
9602static __inline__ vector unsigned int __attribute__((__always_inline__))
9603vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
9604  return __builtin_altivec_vsubcuw(__a, __b);
9605}
9606
9607/* vec_subs */
9608
9609static __inline__ vector signed char __ATTRS_o_ai
9610vec_subs(vector signed char __a, vector signed char __b) {
9611  return __builtin_altivec_vsubsbs(__a, __b);
9612}
9613
9614static __inline__ vector signed char __ATTRS_o_ai
9615vec_subs(vector bool char __a, vector signed char __b) {
9616  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9617}
9618
9619static __inline__ vector signed char __ATTRS_o_ai
9620vec_subs(vector signed char __a, vector bool char __b) {
9621  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9622}
9623
9624static __inline__ vector unsigned char __ATTRS_o_ai
9625vec_subs(vector unsigned char __a, vector unsigned char __b) {
9626  return __builtin_altivec_vsububs(__a, __b);
9627}
9628
9629static __inline__ vector unsigned char __ATTRS_o_ai
9630vec_subs(vector bool char __a, vector unsigned char __b) {
9631  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9632}
9633
9634static __inline__ vector unsigned char __ATTRS_o_ai
9635vec_subs(vector unsigned char __a, vector bool char __b) {
9636  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9637}
9638
9639static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
9640                                                     vector short __b) {
9641  return __builtin_altivec_vsubshs(__a, __b);
9642}
9643
9644static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
9645                                                     vector short __b) {
9646  return __builtin_altivec_vsubshs((vector short)__a, __b);
9647}
9648
9649static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
9650                                                     vector bool short __b) {
9651  return __builtin_altivec_vsubshs(__a, (vector short)__b);
9652}
9653
9654static __inline__ vector unsigned short __ATTRS_o_ai
9655vec_subs(vector unsigned short __a, vector unsigned short __b) {
9656  return __builtin_altivec_vsubuhs(__a, __b);
9657}
9658
9659static __inline__ vector unsigned short __ATTRS_o_ai
9660vec_subs(vector bool short __a, vector unsigned short __b) {
9661  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9662}
9663
9664static __inline__ vector unsigned short __ATTRS_o_ai
9665vec_subs(vector unsigned short __a, vector bool short __b) {
9666  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9667}
9668
9669static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
9670                                                   vector int __b) {
9671  return __builtin_altivec_vsubsws(__a, __b);
9672}
9673
9674static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
9675                                                   vector int __b) {
9676  return __builtin_altivec_vsubsws((vector int)__a, __b);
9677}
9678
9679static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
9680                                                   vector bool int __b) {
9681  return __builtin_altivec_vsubsws(__a, (vector int)__b);
9682}
9683
9684static __inline__ vector unsigned int __ATTRS_o_ai
9685vec_subs(vector unsigned int __a, vector unsigned int __b) {
9686  return __builtin_altivec_vsubuws(__a, __b);
9687}
9688
9689static __inline__ vector unsigned int __ATTRS_o_ai
9690vec_subs(vector bool int __a, vector unsigned int __b) {
9691  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9692}
9693
9694static __inline__ vector unsigned int __ATTRS_o_ai
9695vec_subs(vector unsigned int __a, vector bool int __b) {
9696  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9697}
9698
9699/* vec_vsubsbs */
9700
9701static __inline__ vector signed char __ATTRS_o_ai
9702vec_vsubsbs(vector signed char __a, vector signed char __b) {
9703  return __builtin_altivec_vsubsbs(__a, __b);
9704}
9705
9706static __inline__ vector signed char __ATTRS_o_ai
9707vec_vsubsbs(vector bool char __a, vector signed char __b) {
9708  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9709}
9710
9711static __inline__ vector signed char __ATTRS_o_ai
9712vec_vsubsbs(vector signed char __a, vector bool char __b) {
9713  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9714}
9715
9716/* vec_vsububs */
9717
9718static __inline__ vector unsigned char __ATTRS_o_ai
9719vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
9720  return __builtin_altivec_vsububs(__a, __b);
9721}
9722
9723static __inline__ vector unsigned char __ATTRS_o_ai
9724vec_vsububs(vector bool char __a, vector unsigned char __b) {
9725  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9726}
9727
9728static __inline__ vector unsigned char __ATTRS_o_ai
9729vec_vsububs(vector unsigned char __a, vector bool char __b) {
9730  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9731}
9732
9733/* vec_vsubshs */
9734
9735static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9736                                                        vector short __b) {
9737  return __builtin_altivec_vsubshs(__a, __b);
9738}
9739
9740static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
9741                                                        vector short __b) {
9742  return __builtin_altivec_vsubshs((vector short)__a, __b);
9743}
9744
9745static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9746                                                        vector bool short __b) {
9747  return __builtin_altivec_vsubshs(__a, (vector short)__b);
9748}
9749
9750/* vec_vsubuhs */
9751
9752static __inline__ vector unsigned short __ATTRS_o_ai
9753vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
9754  return __builtin_altivec_vsubuhs(__a, __b);
9755}
9756
9757static __inline__ vector unsigned short __ATTRS_o_ai
9758vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
9759  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9760}
9761
9762static __inline__ vector unsigned short __ATTRS_o_ai
9763vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
9764  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9765}
9766
9767/* vec_vsubsws */
9768
9769static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9770                                                      vector int __b) {
9771  return __builtin_altivec_vsubsws(__a, __b);
9772}
9773
9774static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
9775                                                      vector int __b) {
9776  return __builtin_altivec_vsubsws((vector int)__a, __b);
9777}
9778
9779static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9780                                                      vector bool int __b) {
9781  return __builtin_altivec_vsubsws(__a, (vector int)__b);
9782}
9783
9784/* vec_vsubuws */
9785
9786static __inline__ vector unsigned int __ATTRS_o_ai
9787vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
9788  return __builtin_altivec_vsubuws(__a, __b);
9789}
9790
9791static __inline__ vector unsigned int __ATTRS_o_ai
9792vec_vsubuws(vector bool int __a, vector unsigned int __b) {
9793  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9794}
9795
9796static __inline__ vector unsigned int __ATTRS_o_ai
9797vec_vsubuws(vector unsigned int __a, vector bool int __b) {
9798  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9799}
9800
9801#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9802/* vec_vsubuqm */
9803
9804static __inline__ vector signed __int128 __ATTRS_o_ai
9805vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
9806  return __a - __b;
9807}
9808
9809static __inline__ vector unsigned __int128 __ATTRS_o_ai
9810vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9811  return __a - __b;
9812}
9813
9814/* vec_vsubeuqm */
9815
9816static __inline__ vector signed __int128 __ATTRS_o_ai
9817vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9818             vector signed __int128 __c) {
9819  return __builtin_altivec_vsubeuqm(__a, __b, __c);
9820}
9821
9822static __inline__ vector unsigned __int128 __ATTRS_o_ai
9823vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9824             vector unsigned __int128 __c) {
9825  return __builtin_altivec_vsubeuqm(__a, __b, __c);
9826}
9827
9828/* vec_vsubcuq */
9829
9830static __inline__ vector signed __int128 __ATTRS_o_ai
9831vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
9832  return __builtin_altivec_vsubcuq(__a, __b);
9833}
9834
9835static __inline__ vector unsigned __int128 __ATTRS_o_ai
9836vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9837  return __builtin_altivec_vsubcuq(__a, __b);
9838}
9839
9840/* vec_vsubecuq */
9841
9842static __inline__ vector signed __int128 __ATTRS_o_ai
9843vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9844             vector signed __int128 __c) {
9845  return __builtin_altivec_vsubecuq(__a, __b, __c);
9846}
9847
9848static __inline__ vector unsigned __int128 __ATTRS_o_ai
9849vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9850             vector unsigned __int128 __c) {
9851  return __builtin_altivec_vsubecuq(__a, __b, __c);
9852}
9853#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9854
9855/* vec_sum4s */
9856
9857static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
9858                                                    vector int __b) {
9859  return __builtin_altivec_vsum4sbs(__a, __b);
9860}
9861
9862static __inline__ vector unsigned int __ATTRS_o_ai
9863vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
9864  return __builtin_altivec_vsum4ubs(__a, __b);
9865}
9866
9867static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
9868                                                    vector int __b) {
9869  return __builtin_altivec_vsum4shs(__a, __b);
9870}
9871
9872/* vec_vsum4sbs */
9873
9874static __inline__ vector int __attribute__((__always_inline__))
9875vec_vsum4sbs(vector signed char __a, vector int __b) {
9876  return __builtin_altivec_vsum4sbs(__a, __b);
9877}
9878
9879/* vec_vsum4ubs */
9880
9881static __inline__ vector unsigned int __attribute__((__always_inline__))
9882vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
9883  return __builtin_altivec_vsum4ubs(__a, __b);
9884}
9885
9886/* vec_vsum4shs */
9887
9888static __inline__ vector int __attribute__((__always_inline__))
9889vec_vsum4shs(vector signed short __a, vector int __b) {
9890  return __builtin_altivec_vsum4shs(__a, __b);
9891}
9892
9893/* vec_sum2s */
9894
9895/* The vsum2sws instruction has a big-endian bias, so that the second
9896   input vector and the result always reference big-endian elements
9897   1 and 3 (little-endian element 0 and 2).  For ease of porting the
9898   programmer wants elements 1 and 3 in both cases, so for little
9899   endian we must perform some permutes.  */
9900
9901static __inline__ vector signed int __attribute__((__always_inline__))
9902vec_sum2s(vector int __a, vector int __b) {
9903#ifdef __LITTLE_ENDIAN__
9904  vector int __c = (vector signed int)vec_perm(
9905      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9906                                       8, 9, 10, 11));
9907  __c = __builtin_altivec_vsum2sws(__a, __c);
9908  return (vector signed int)vec_perm(
9909      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9910                                       8, 9, 10, 11));
9911#else
9912  return __builtin_altivec_vsum2sws(__a, __b);
9913#endif
9914}
9915
9916/* vec_vsum2sws */
9917
9918static __inline__ vector signed int __attribute__((__always_inline__))
9919vec_vsum2sws(vector int __a, vector int __b) {
9920#ifdef __LITTLE_ENDIAN__
9921  vector int __c = (vector signed int)vec_perm(
9922      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9923                                       8, 9, 10, 11));
9924  __c = __builtin_altivec_vsum2sws(__a, __c);
9925  return (vector signed int)vec_perm(
9926      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9927                                       8, 9, 10, 11));
9928#else
9929  return __builtin_altivec_vsum2sws(__a, __b);
9930#endif
9931}
9932
9933/* vec_sums */
9934
9935/* The vsumsws instruction has a big-endian bias, so that the second
9936   input vector and the result always reference big-endian element 3
9937   (little-endian element 0).  For ease of porting the programmer
9938   wants element 3 in both cases, so for little endian we must perform
9939   some permutes.  */
9940
9941static __inline__ vector signed int __attribute__((__always_inline__))
9942vec_sums(vector signed int __a, vector signed int __b) {
9943#ifdef __LITTLE_ENDIAN__
9944  __b = (vector signed int)vec_splat(__b, 3);
9945  __b = __builtin_altivec_vsumsws(__a, __b);
9946  return (vector signed int)(0, 0, 0, __b[0]);
9947#else
9948  return __builtin_altivec_vsumsws(__a, __b);
9949#endif
9950}
9951
9952/* vec_vsumsws */
9953
9954static __inline__ vector signed int __attribute__((__always_inline__))
9955vec_vsumsws(vector signed int __a, vector signed int __b) {
9956#ifdef __LITTLE_ENDIAN__
9957  __b = (vector signed int)vec_splat(__b, 3);
9958  __b = __builtin_altivec_vsumsws(__a, __b);
9959  return (vector signed int)(0, 0, 0, __b[0]);
9960#else
9961  return __builtin_altivec_vsumsws(__a, __b);
9962#endif
9963}
9964
9965/* vec_trunc */
9966
9967static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
9968#ifdef __VSX__
9969  return __builtin_vsx_xvrspiz(__a);
9970#else
9971  return __builtin_altivec_vrfiz(__a);
9972#endif
9973}
9974
9975#ifdef __VSX__
9976static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
9977  return __builtin_vsx_xvrdpiz(__a);
9978}
9979#endif
9980
9981/* vec_vrfiz */
9982
9983static __inline__ vector float __attribute__((__always_inline__))
9984vec_vrfiz(vector float __a) {
9985  return __builtin_altivec_vrfiz(__a);
9986}
9987
9988/* vec_unpackh */
9989
9990/* The vector unpack instructions all have a big-endian bias, so for
9991   little endian we must reverse the meanings of "high" and "low."  */
9992
9993static __inline__ vector short __ATTRS_o_ai
9994vec_unpackh(vector signed char __a) {
9995#ifdef __LITTLE_ENDIAN__
9996  return __builtin_altivec_vupklsb((vector char)__a);
9997#else
9998  return __builtin_altivec_vupkhsb((vector char)__a);
9999#endif
10000}
10001
10002static __inline__ vector bool short __ATTRS_o_ai
10003vec_unpackh(vector bool char __a) {
10004#ifdef __LITTLE_ENDIAN__
10005  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10006#else
10007  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10008#endif
10009}
10010
10011static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
10012#ifdef __LITTLE_ENDIAN__
10013  return __builtin_altivec_vupklsh(__a);
10014#else
10015  return __builtin_altivec_vupkhsh(__a);
10016#endif
10017}
10018
10019static __inline__ vector bool int __ATTRS_o_ai
10020vec_unpackh(vector bool short __a) {
10021#ifdef __LITTLE_ENDIAN__
10022  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10023#else
10024  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10025#endif
10026}
10027
10028static __inline__ vector unsigned int __ATTRS_o_ai
10029vec_unpackh(vector pixel __a) {
10030#ifdef __LITTLE_ENDIAN__
10031  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10032#else
10033  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10034#endif
10035}
10036
10037#ifdef __POWER8_VECTOR__
10038static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
10039#ifdef __LITTLE_ENDIAN__
10040  return __builtin_altivec_vupklsw(__a);
10041#else
10042  return __builtin_altivec_vupkhsw(__a);
10043#endif
10044}
10045
10046static __inline__ vector bool long long __ATTRS_o_ai
10047vec_unpackh(vector bool int __a) {
10048#ifdef __LITTLE_ENDIAN__
10049  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10050#else
10051  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10052#endif
10053}
10054#endif
10055
10056/* vec_vupkhsb */
10057
10058static __inline__ vector short __ATTRS_o_ai
10059vec_vupkhsb(vector signed char __a) {
10060#ifdef __LITTLE_ENDIAN__
10061  return __builtin_altivec_vupklsb((vector char)__a);
10062#else
10063  return __builtin_altivec_vupkhsb((vector char)__a);
10064#endif
10065}
10066
10067static __inline__ vector bool short __ATTRS_o_ai
10068vec_vupkhsb(vector bool char __a) {
10069#ifdef __LITTLE_ENDIAN__
10070  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10071#else
10072  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10073#endif
10074}
10075
10076/* vec_vupkhsh */
10077
10078static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
10079#ifdef __LITTLE_ENDIAN__
10080  return __builtin_altivec_vupklsh(__a);
10081#else
10082  return __builtin_altivec_vupkhsh(__a);
10083#endif
10084}
10085
10086static __inline__ vector bool int __ATTRS_o_ai
10087vec_vupkhsh(vector bool short __a) {
10088#ifdef __LITTLE_ENDIAN__
10089  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10090#else
10091  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10092#endif
10093}
10094
10095static __inline__ vector unsigned int __ATTRS_o_ai
10096vec_vupkhsh(vector pixel __a) {
10097#ifdef __LITTLE_ENDIAN__
10098  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10099#else
10100  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10101#endif
10102}
10103
10104/* vec_vupkhsw */
10105
10106#ifdef __POWER8_VECTOR__
10107static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
10108#ifdef __LITTLE_ENDIAN__
10109  return __builtin_altivec_vupklsw(__a);
10110#else
10111  return __builtin_altivec_vupkhsw(__a);
10112#endif
10113}
10114
10115static __inline__ vector bool long long __ATTRS_o_ai
10116vec_vupkhsw(vector bool int __a) {
10117#ifdef __LITTLE_ENDIAN__
10118  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10119#else
10120  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10121#endif
10122}
10123#endif
10124
10125/* vec_unpackl */
10126
10127static __inline__ vector short __ATTRS_o_ai
10128vec_unpackl(vector signed char __a) {
10129#ifdef __LITTLE_ENDIAN__
10130  return __builtin_altivec_vupkhsb((vector char)__a);
10131#else
10132  return __builtin_altivec_vupklsb((vector char)__a);
10133#endif
10134}
10135
10136static __inline__ vector bool short __ATTRS_o_ai
10137vec_unpackl(vector bool char __a) {
10138#ifdef __LITTLE_ENDIAN__
10139  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10140#else
10141  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10142#endif
10143}
10144
10145static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
10146#ifdef __LITTLE_ENDIAN__
10147  return __builtin_altivec_vupkhsh(__a);
10148#else
10149  return __builtin_altivec_vupklsh(__a);
10150#endif
10151}
10152
10153static __inline__ vector bool int __ATTRS_o_ai
10154vec_unpackl(vector bool short __a) {
10155#ifdef __LITTLE_ENDIAN__
10156  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10157#else
10158  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10159#endif
10160}
10161
10162static __inline__ vector unsigned int __ATTRS_o_ai
10163vec_unpackl(vector pixel __a) {
10164#ifdef __LITTLE_ENDIAN__
10165  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10166#else
10167  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10168#endif
10169}
10170
10171#ifdef __POWER8_VECTOR__
10172static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
10173#ifdef __LITTLE_ENDIAN__
10174  return __builtin_altivec_vupkhsw(__a);
10175#else
10176  return __builtin_altivec_vupklsw(__a);
10177#endif
10178}
10179
10180static __inline__ vector bool long long __ATTRS_o_ai
10181vec_unpackl(vector bool int __a) {
10182#ifdef __LITTLE_ENDIAN__
10183  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10184#else
10185  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10186#endif
10187}
10188#endif
10189
10190/* vec_vupklsb */
10191
10192static __inline__ vector short __ATTRS_o_ai
10193vec_vupklsb(vector signed char __a) {
10194#ifdef __LITTLE_ENDIAN__
10195  return __builtin_altivec_vupkhsb((vector char)__a);
10196#else
10197  return __builtin_altivec_vupklsb((vector char)__a);
10198#endif
10199}
10200
10201static __inline__ vector bool short __ATTRS_o_ai
10202vec_vupklsb(vector bool char __a) {
10203#ifdef __LITTLE_ENDIAN__
10204  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10205#else
10206  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10207#endif
10208}
10209
10210/* vec_vupklsh */
10211
10212static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
10213#ifdef __LITTLE_ENDIAN__
10214  return __builtin_altivec_vupkhsh(__a);
10215#else
10216  return __builtin_altivec_vupklsh(__a);
10217#endif
10218}
10219
10220static __inline__ vector bool int __ATTRS_o_ai
10221vec_vupklsh(vector bool short __a) {
10222#ifdef __LITTLE_ENDIAN__
10223  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10224#else
10225  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10226#endif
10227}
10228
10229static __inline__ vector unsigned int __ATTRS_o_ai
10230vec_vupklsh(vector pixel __a) {
10231#ifdef __LITTLE_ENDIAN__
10232  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10233#else
10234  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10235#endif
10236}
10237
10238/* vec_vupklsw */
10239
10240#ifdef __POWER8_VECTOR__
10241static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
10242#ifdef __LITTLE_ENDIAN__
10243  return __builtin_altivec_vupkhsw(__a);
10244#else
10245  return __builtin_altivec_vupklsw(__a);
10246#endif
10247}
10248
10249static __inline__ vector bool long long __ATTRS_o_ai
10250vec_vupklsw(vector bool int __a) {
10251#ifdef __LITTLE_ENDIAN__
10252  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10253#else
10254  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10255#endif
10256}
10257#endif
10258
10259/* vec_vsx_ld */
10260
10261#ifdef __VSX__
10262
10263static __inline__ vector bool int __ATTRS_o_ai
10264vec_vsx_ld(int __a, const vector bool int *__b) {
10265  return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
10266}
10267
10268static __inline__ vector signed int __ATTRS_o_ai
10269vec_vsx_ld(int __a, const vector signed int *__b) {
10270  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10271}
10272
10273static __inline__ vector signed int __ATTRS_o_ai
10274vec_vsx_ld(int __a, const signed int *__b) {
10275  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10276}
10277
10278static __inline__ vector unsigned int __ATTRS_o_ai
10279vec_vsx_ld(int __a, const vector unsigned int *__b) {
10280  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10281}
10282
10283static __inline__ vector unsigned int __ATTRS_o_ai
10284vec_vsx_ld(int __a, const unsigned int *__b) {
10285  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10286}
10287
10288static __inline__ vector float __ATTRS_o_ai
10289vec_vsx_ld(int __a, const vector float *__b) {
10290  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10291}
10292
10293static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
10294                                                       const float *__b) {
10295  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10296}
10297
10298static __inline__ vector signed long long __ATTRS_o_ai
10299vec_vsx_ld(int __a, const vector signed long long *__b) {
10300  return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
10301}
10302
10303static __inline__ vector unsigned long long __ATTRS_o_ai
10304vec_vsx_ld(int __a, const vector unsigned long long *__b) {
10305  return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
10306}
10307
10308static __inline__ vector double __ATTRS_o_ai
10309vec_vsx_ld(int __a, const vector double *__b) {
10310  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10311}
10312
10313static __inline__ vector double __ATTRS_o_ai
10314vec_vsx_ld(int __a, const double *__b) {
10315  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10316}
10317
10318static __inline__ vector bool short __ATTRS_o_ai
10319vec_vsx_ld(int __a, const vector bool short *__b) {
10320  return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
10321}
10322
10323static __inline__ vector signed short __ATTRS_o_ai
10324vec_vsx_ld(int __a, const vector signed short *__b) {
10325  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
10326}
10327
10328static __inline__ vector signed short __ATTRS_o_ai
10329vec_vsx_ld(int __a, const signed short *__b) {
10330  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
10331}
10332
10333static __inline__ vector unsigned short __ATTRS_o_ai
10334vec_vsx_ld(int __a, const vector unsigned short *__b) {
10335  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
10336}
10337
10338static __inline__ vector unsigned short __ATTRS_o_ai
10339vec_vsx_ld(int __a, const unsigned short *__b) {
10340  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
10341}
10342
10343static __inline__ vector bool char __ATTRS_o_ai
10344vec_vsx_ld(int __a, const vector bool char *__b) {
10345  return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
10346}
10347
10348static __inline__ vector signed char __ATTRS_o_ai
10349vec_vsx_ld(int __a, const vector signed char *__b) {
10350  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
10351}
10352
10353static __inline__ vector signed char __ATTRS_o_ai
10354vec_vsx_ld(int __a, const signed char *__b) {
10355  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
10356}
10357
10358static __inline__ vector unsigned char __ATTRS_o_ai
10359vec_vsx_ld(int __a, const vector unsigned char *__b) {
10360  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
10361}
10362
10363static __inline__ vector unsigned char __ATTRS_o_ai
10364vec_vsx_ld(int __a, const unsigned char *__b) {
10365  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
10366}
10367
10368#endif
10369
10370/* vec_vsx_st */
10371
10372#ifdef __VSX__
10373
10374static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10375                                               vector bool int *__c) {
10376  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10377}
10378
10379static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10380                                               signed int *__c) {
10381  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10382}
10383
10384static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10385                                               unsigned int *__c) {
10386  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10387}
10388
10389static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10390                                               vector signed int *__c) {
10391  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10392}
10393
10394static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10395                                               signed int *__c) {
10396  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10397}
10398
10399static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10400                                               vector unsigned int *__c) {
10401  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10402}
10403
10404static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10405                                               unsigned int *__c) {
10406  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10407}
10408
10409static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10410                                               vector float *__c) {
10411  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10412}
10413
10414static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10415                                               float *__c) {
10416  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10417}
10418
10419static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
10420                                               int __b,
10421                                               vector signed long long *__c) {
10422  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10423}
10424
10425static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
10426                                               int __b,
10427                                               vector unsigned long long *__c) {
10428  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10429}
10430
10431static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10432                                               vector double *__c) {
10433  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10434}
10435
10436static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10437                                               double *__c) {
10438  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10439}
10440
10441static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10442                                               vector bool short *__c) {
10443  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10444}
10445
10446static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10447                                               signed short *__c) {
10448  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10449}
10450
10451static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10452                                               unsigned short *__c) {
10453  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10454}
10455static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
10456                                               vector signed short *__c) {
10457  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10458}
10459
10460static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
10461                                               signed short *__c) {
10462  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10463}
10464
10465static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
10466                                               int __b,
10467                                               vector unsigned short *__c) {
10468  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10469}
10470
10471static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
10472                                               int __b, unsigned short *__c) {
10473  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10474}
10475
10476static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10477                                               vector bool char *__c) {
10478  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10479}
10480
10481static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10482                                               signed char *__c) {
10483  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10484}
10485
10486static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10487                                               unsigned char *__c) {
10488  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10489}
10490
10491static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
10492                                               vector signed char *__c) {
10493  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10494}
10495
10496static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
10497                                               signed char *__c) {
10498  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10499}
10500
10501static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
10502                                               int __b,
10503                                               vector unsigned char *__c) {
10504  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10505}
10506
10507static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
10508                                               int __b, unsigned char *__c) {
10509  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10510}
10511
10512#endif
10513
10514/* vec_xor */
10515
10516#define __builtin_altivec_vxor vec_xor
10517
10518static __inline__ vector signed char __ATTRS_o_ai
10519vec_xor(vector signed char __a, vector signed char __b) {
10520  return __a ^ __b;
10521}
10522
10523static __inline__ vector signed char __ATTRS_o_ai
10524vec_xor(vector bool char __a, vector signed char __b) {
10525  return (vector signed char)__a ^ __b;
10526}
10527
10528static __inline__ vector signed char __ATTRS_o_ai
10529vec_xor(vector signed char __a, vector bool char __b) {
10530  return __a ^ (vector signed char)__b;
10531}
10532
10533static __inline__ vector unsigned char __ATTRS_o_ai
10534vec_xor(vector unsigned char __a, vector unsigned char __b) {
10535  return __a ^ __b;
10536}
10537
10538static __inline__ vector unsigned char __ATTRS_o_ai
10539vec_xor(vector bool char __a, vector unsigned char __b) {
10540  return (vector unsigned char)__a ^ __b;
10541}
10542
10543static __inline__ vector unsigned char __ATTRS_o_ai
10544vec_xor(vector unsigned char __a, vector bool char __b) {
10545  return __a ^ (vector unsigned char)__b;
10546}
10547
10548static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
10549                                                        vector bool char __b) {
10550  return __a ^ __b;
10551}
10552
10553static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
10554                                                    vector short __b) {
10555  return __a ^ __b;
10556}
10557
10558static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
10559                                                    vector short __b) {
10560  return (vector short)__a ^ __b;
10561}
10562
10563static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
10564                                                    vector bool short __b) {
10565  return __a ^ (vector short)__b;
10566}
10567
10568static __inline__ vector unsigned short __ATTRS_o_ai
10569vec_xor(vector unsigned short __a, vector unsigned short __b) {
10570  return __a ^ __b;
10571}
10572
10573static __inline__ vector unsigned short __ATTRS_o_ai
10574vec_xor(vector bool short __a, vector unsigned short __b) {
10575  return (vector unsigned short)__a ^ __b;
10576}
10577
10578static __inline__ vector unsigned short __ATTRS_o_ai
10579vec_xor(vector unsigned short __a, vector bool short __b) {
10580  return __a ^ (vector unsigned short)__b;
10581}
10582
10583static __inline__ vector bool short __ATTRS_o_ai
10584vec_xor(vector bool short __a, vector bool short __b) {
10585  return __a ^ __b;
10586}
10587
10588static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
10589                                                  vector int __b) {
10590  return __a ^ __b;
10591}
10592
10593static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
10594                                                  vector int __b) {
10595  return (vector int)__a ^ __b;
10596}
10597
10598static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
10599                                                  vector bool int __b) {
10600  return __a ^ (vector int)__b;
10601}
10602
10603static __inline__ vector unsigned int __ATTRS_o_ai
10604vec_xor(vector unsigned int __a, vector unsigned int __b) {
10605  return __a ^ __b;
10606}
10607
10608static __inline__ vector unsigned int __ATTRS_o_ai
10609vec_xor(vector bool int __a, vector unsigned int __b) {
10610  return (vector unsigned int)__a ^ __b;
10611}
10612
10613static __inline__ vector unsigned int __ATTRS_o_ai
10614vec_xor(vector unsigned int __a, vector bool int __b) {
10615  return __a ^ (vector unsigned int)__b;
10616}
10617
10618static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
10619                                                       vector bool int __b) {
10620  return __a ^ __b;
10621}
10622
10623static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
10624                                                    vector float __b) {
10625  vector unsigned int __res =
10626      (vector unsigned int)__a ^ (vector unsigned int)__b;
10627  return (vector float)__res;
10628}
10629
10630static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
10631                                                    vector float __b) {
10632  vector unsigned int __res =
10633      (vector unsigned int)__a ^ (vector unsigned int)__b;
10634  return (vector float)__res;
10635}
10636
10637static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
10638                                                    vector bool int __b) {
10639  vector unsigned int __res =
10640      (vector unsigned int)__a ^ (vector unsigned int)__b;
10641  return (vector float)__res;
10642}
10643
10644#ifdef __VSX__
10645static __inline__ vector signed long long __ATTRS_o_ai
10646vec_xor(vector signed long long __a, vector signed long long __b) {
10647  return __a ^ __b;
10648}
10649
10650static __inline__ vector signed long long __ATTRS_o_ai
10651vec_xor(vector bool long long __a, vector signed long long __b) {
10652  return (vector signed long long)__a ^ __b;
10653}
10654
10655static __inline__ vector signed long long __ATTRS_o_ai
10656vec_xor(vector signed long long __a, vector bool long long __b) {
10657  return __a ^ (vector signed long long)__b;
10658}
10659
10660static __inline__ vector unsigned long long __ATTRS_o_ai
10661vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
10662  return __a ^ __b;
10663}
10664
10665static __inline__ vector unsigned long long __ATTRS_o_ai
10666vec_xor(vector bool long long __a, vector unsigned long long __b) {
10667  return (vector unsigned long long)__a ^ __b;
10668}
10669
10670static __inline__ vector unsigned long long __ATTRS_o_ai
10671vec_xor(vector unsigned long long __a, vector bool long long __b) {
10672  return __a ^ (vector unsigned long long)__b;
10673}
10674
10675static __inline__ vector bool long long __ATTRS_o_ai
10676vec_xor(vector bool long long __a, vector bool long long __b) {
10677  return __a ^ __b;
10678}
10679
10680static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
10681                                                     vector double __b) {
10682  return (vector double)((vector unsigned long long)__a ^
10683                         (vector unsigned long long)__b);
10684}
10685
10686static __inline__ vector double __ATTRS_o_ai
10687vec_xor(vector double __a, vector bool long long __b) {
10688  return (vector double)((vector unsigned long long)__a ^
10689                         (vector unsigned long long)__b);
10690}
10691
10692static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
10693                                                     vector double __b) {
10694  return (vector double)((vector unsigned long long)__a ^
10695                         (vector unsigned long long)__b);
10696}
10697#endif
10698
10699/* vec_vxor */
10700
10701static __inline__ vector signed char __ATTRS_o_ai
10702vec_vxor(vector signed char __a, vector signed char __b) {
10703  return __a ^ __b;
10704}
10705
10706static __inline__ vector signed char __ATTRS_o_ai
10707vec_vxor(vector bool char __a, vector signed char __b) {
10708  return (vector signed char)__a ^ __b;
10709}
10710
10711static __inline__ vector signed char __ATTRS_o_ai
10712vec_vxor(vector signed char __a, vector bool char __b) {
10713  return __a ^ (vector signed char)__b;
10714}
10715
10716static __inline__ vector unsigned char __ATTRS_o_ai
10717vec_vxor(vector unsigned char __a, vector unsigned char __b) {
10718  return __a ^ __b;
10719}
10720
10721static __inline__ vector unsigned char __ATTRS_o_ai
10722vec_vxor(vector bool char __a, vector unsigned char __b) {
10723  return (vector unsigned char)__a ^ __b;
10724}
10725
10726static __inline__ vector unsigned char __ATTRS_o_ai
10727vec_vxor(vector unsigned char __a, vector bool char __b) {
10728  return __a ^ (vector unsigned char)__b;
10729}
10730
10731static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
10732                                                         vector bool char __b) {
10733  return __a ^ __b;
10734}
10735
10736static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
10737                                                     vector short __b) {
10738  return __a ^ __b;
10739}
10740
10741static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
10742                                                     vector short __b) {
10743  return (vector short)__a ^ __b;
10744}
10745
10746static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
10747                                                     vector bool short __b) {
10748  return __a ^ (vector short)__b;
10749}
10750
10751static __inline__ vector unsigned short __ATTRS_o_ai
10752vec_vxor(vector unsigned short __a, vector unsigned short __b) {
10753  return __a ^ __b;
10754}
10755
10756static __inline__ vector unsigned short __ATTRS_o_ai
10757vec_vxor(vector bool short __a, vector unsigned short __b) {
10758  return (vector unsigned short)__a ^ __b;
10759}
10760
10761static __inline__ vector unsigned short __ATTRS_o_ai
10762vec_vxor(vector unsigned short __a, vector bool short __b) {
10763  return __a ^ (vector unsigned short)__b;
10764}
10765
10766static __inline__ vector bool short __ATTRS_o_ai
10767vec_vxor(vector bool short __a, vector bool short __b) {
10768  return __a ^ __b;
10769}
10770
10771static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
10772                                                   vector int __b) {
10773  return __a ^ __b;
10774}
10775
10776static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
10777                                                   vector int __b) {
10778  return (vector int)__a ^ __b;
10779}
10780
10781static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
10782                                                   vector bool int __b) {
10783  return __a ^ (vector int)__b;
10784}
10785
10786static __inline__ vector unsigned int __ATTRS_o_ai
10787vec_vxor(vector unsigned int __a, vector unsigned int __b) {
10788  return __a ^ __b;
10789}
10790
10791static __inline__ vector unsigned int __ATTRS_o_ai
10792vec_vxor(vector bool int __a, vector unsigned int __b) {
10793  return (vector unsigned int)__a ^ __b;
10794}
10795
10796static __inline__ vector unsigned int __ATTRS_o_ai
10797vec_vxor(vector unsigned int __a, vector bool int __b) {
10798  return __a ^ (vector unsigned int)__b;
10799}
10800
10801static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
10802                                                        vector bool int __b) {
10803  return __a ^ __b;
10804}
10805
10806static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
10807                                                     vector float __b) {
10808  vector unsigned int __res =
10809      (vector unsigned int)__a ^ (vector unsigned int)__b;
10810  return (vector float)__res;
10811}
10812
10813static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
10814                                                     vector float __b) {
10815  vector unsigned int __res =
10816      (vector unsigned int)__a ^ (vector unsigned int)__b;
10817  return (vector float)__res;
10818}
10819
10820static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
10821                                                     vector bool int __b) {
10822  vector unsigned int __res =
10823      (vector unsigned int)__a ^ (vector unsigned int)__b;
10824  return (vector float)__res;
10825}
10826
10827#ifdef __VSX__
10828static __inline__ vector signed long long __ATTRS_o_ai
10829vec_vxor(vector signed long long __a, vector signed long long __b) {
10830  return __a ^ __b;
10831}
10832
10833static __inline__ vector signed long long __ATTRS_o_ai
10834vec_vxor(vector bool long long __a, vector signed long long __b) {
10835  return (vector signed long long)__a ^ __b;
10836}
10837
10838static __inline__ vector signed long long __ATTRS_o_ai
10839vec_vxor(vector signed long long __a, vector bool long long __b) {
10840  return __a ^ (vector signed long long)__b;
10841}
10842
10843static __inline__ vector unsigned long long __ATTRS_o_ai
10844vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
10845  return __a ^ __b;
10846}
10847
10848static __inline__ vector unsigned long long __ATTRS_o_ai
10849vec_vxor(vector bool long long __a, vector unsigned long long __b) {
10850  return (vector unsigned long long)__a ^ __b;
10851}
10852
10853static __inline__ vector unsigned long long __ATTRS_o_ai
10854vec_vxor(vector unsigned long long __a, vector bool long long __b) {
10855  return __a ^ (vector unsigned long long)__b;
10856}
10857
10858static __inline__ vector bool long long __ATTRS_o_ai
10859vec_vxor(vector bool long long __a, vector bool long long __b) {
10860  return __a ^ __b;
10861}
10862#endif
10863
10864/* ------------------------ extensions for CBEA ----------------------------- */
10865
10866/* vec_extract */
10867
10868static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
10869                                                       int __b) {
10870  return __a[__b];
10871}
10872
10873static __inline__ unsigned char __ATTRS_o_ai
10874vec_extract(vector unsigned char __a, int __b) {
10875  return __a[__b];
10876}
10877
10878static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
10879                                                         int __b) {
10880  return __a[__b];
10881}
10882
10883static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
10884                                                        int __b) {
10885  return __a[__b];
10886}
10887
10888static __inline__ unsigned short __ATTRS_o_ai
10889vec_extract(vector unsigned short __a, int __b) {
10890  return __a[__b];
10891}
10892
10893static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
10894                                                          int __b) {
10895  return __a[__b];
10896}
10897
10898static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
10899                                                      int __b) {
10900  return __a[__b];
10901}
10902
10903static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
10904                                                        int __b) {
10905  return __a[__b];
10906}
10907
10908static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
10909                                                        int __b) {
10910  return __a[__b];
10911}
10912
10913#ifdef __VSX__
10914static __inline__ signed long long __ATTRS_o_ai
10915vec_extract(vector signed long long __a, int __b) {
10916  return __a[__b];
10917}
10918
10919static __inline__ unsigned long long __ATTRS_o_ai
10920vec_extract(vector unsigned long long __a, int __b) {
10921  return __a[__b];
10922}
10923
10924static __inline__ unsigned long long __ATTRS_o_ai
10925vec_extract(vector bool long long __a, int __b) {
10926  return __a[__b];
10927}
10928
10929static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
10930  return __a[__b];
10931}
10932#endif
10933
10934static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
10935  return __a[__b];
10936}
10937
10938/* vec_insert */
10939
10940static __inline__ vector signed char __ATTRS_o_ai
10941vec_insert(signed char __a, vector signed char __b, int __c) {
10942  __b[__c] = __a;
10943  return __b;
10944}
10945
10946static __inline__ vector unsigned char __ATTRS_o_ai
10947vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
10948  __b[__c] = __a;
10949  return __b;
10950}
10951
10952static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
10953                                                           vector bool char __b,
10954                                                           int __c) {
10955  __b[__c] = __a;
10956  return __b;
10957}
10958
10959static __inline__ vector signed short __ATTRS_o_ai
10960vec_insert(signed short __a, vector signed short __b, int __c) {
10961  __b[__c] = __a;
10962  return __b;
10963}
10964
10965static __inline__ vector unsigned short __ATTRS_o_ai
10966vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
10967  __b[__c] = __a;
10968  return __b;
10969}
10970
10971static __inline__ vector bool short __ATTRS_o_ai
10972vec_insert(unsigned short __a, vector bool short __b, int __c) {
10973  __b[__c] = __a;
10974  return __b;
10975}
10976
10977static __inline__ vector signed int __ATTRS_o_ai
10978vec_insert(signed int __a, vector signed int __b, int __c) {
10979  __b[__c] = __a;
10980  return __b;
10981}
10982
10983static __inline__ vector unsigned int __ATTRS_o_ai
10984vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
10985  __b[__c] = __a;
10986  return __b;
10987}
10988
10989static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
10990                                                          vector bool int __b,
10991                                                          int __c) {
10992  __b[__c] = __a;
10993  return __b;
10994}
10995
10996#ifdef __VSX__
10997static __inline__ vector signed long long __ATTRS_o_ai
10998vec_insert(signed long long __a, vector signed long long __b, int __c) {
10999  __b[__c] = __a;
11000  return __b;
11001}
11002
11003static __inline__ vector unsigned long long __ATTRS_o_ai
11004vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
11005  __b[__c] = __a;
11006  return __b;
11007}
11008
11009static __inline__ vector bool long long __ATTRS_o_ai
11010vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
11011  __b[__c] = __a;
11012  return __b;
11013}
11014static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
11015                                                        vector double __b,
11016                                                        int __c) {
11017  __b[__c] = __a;
11018  return __b;
11019}
11020#endif
11021
11022static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
11023                                                       vector float __b,
11024                                                       int __c) {
11025  __b[__c] = __a;
11026  return __b;
11027}
11028
11029/* vec_lvlx */
11030
11031static __inline__ vector signed char __ATTRS_o_ai
11032vec_lvlx(int __a, const signed char *__b) {
11033  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11034                  vec_lvsl(__a, __b));
11035}
11036
11037static __inline__ vector signed char __ATTRS_o_ai
11038vec_lvlx(int __a, const vector signed char *__b) {
11039  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11040                  vec_lvsl(__a, (unsigned char *)__b));
11041}
11042
11043static __inline__ vector unsigned char __ATTRS_o_ai
11044vec_lvlx(int __a, const unsigned char *__b) {
11045  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11046                  vec_lvsl(__a, __b));
11047}
11048
11049static __inline__ vector unsigned char __ATTRS_o_ai
11050vec_lvlx(int __a, const vector unsigned char *__b) {
11051  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11052                  vec_lvsl(__a, (unsigned char *)__b));
11053}
11054
11055static __inline__ vector bool char __ATTRS_o_ai
11056vec_lvlx(int __a, const vector bool char *__b) {
11057  return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
11058                  vec_lvsl(__a, (unsigned char *)__b));
11059}
11060
11061static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
11062                                                     const short *__b) {
11063  return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
11064}
11065
11066static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
11067                                                     const vector short *__b) {
11068  return vec_perm(vec_ld(__a, __b), (vector short)(0),
11069                  vec_lvsl(__a, (unsigned char *)__b));
11070}
11071
11072static __inline__ vector unsigned short __ATTRS_o_ai
11073vec_lvlx(int __a, const unsigned short *__b) {
11074  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
11075                  vec_lvsl(__a, __b));
11076}
11077
11078static __inline__ vector unsigned short __ATTRS_o_ai
11079vec_lvlx(int __a, const vector unsigned short *__b) {
11080  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
11081                  vec_lvsl(__a, (unsigned char *)__b));
11082}
11083
11084static __inline__ vector bool short __ATTRS_o_ai
11085vec_lvlx(int __a, const vector bool short *__b) {
11086  return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
11087                  vec_lvsl(__a, (unsigned char *)__b));
11088}
11089
11090static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
11091                                                     const vector pixel *__b) {
11092  return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
11093                  vec_lvsl(__a, (unsigned char *)__b));
11094}
11095
11096static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
11097  return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
11098}
11099
11100static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
11101                                                   const vector int *__b) {
11102  return vec_perm(vec_ld(__a, __b), (vector int)(0),
11103                  vec_lvsl(__a, (unsigned char *)__b));
11104}
11105
11106static __inline__ vector unsigned int __ATTRS_o_ai
11107vec_lvlx(int __a, const unsigned int *__b) {
11108  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
11109                  vec_lvsl(__a, __b));
11110}
11111
11112static __inline__ vector unsigned int __ATTRS_o_ai
11113vec_lvlx(int __a, const vector unsigned int *__b) {
11114  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
11115                  vec_lvsl(__a, (unsigned char *)__b));
11116}
11117
11118static __inline__ vector bool int __ATTRS_o_ai
11119vec_lvlx(int __a, const vector bool int *__b) {
11120  return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
11121                  vec_lvsl(__a, (unsigned char *)__b));
11122}
11123
11124static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
11125                                                     const float *__b) {
11126  return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
11127}
11128
11129static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
11130                                                     const vector float *__b) {
11131  return vec_perm(vec_ld(__a, __b), (vector float)(0),
11132                  vec_lvsl(__a, (unsigned char *)__b));
11133}
11134
11135/* vec_lvlxl */
11136
11137static __inline__ vector signed char __ATTRS_o_ai
11138vec_lvlxl(int __a, const signed char *__b) {
11139  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
11140                  vec_lvsl(__a, __b));
11141}
11142
11143static __inline__ vector signed char __ATTRS_o_ai
11144vec_lvlxl(int __a, const vector signed char *__b) {
11145  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
11146                  vec_lvsl(__a, (unsigned char *)__b));
11147}
11148
11149static __inline__ vector unsigned char __ATTRS_o_ai
11150vec_lvlxl(int __a, const unsigned char *__b) {
11151  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
11152                  vec_lvsl(__a, __b));
11153}
11154
11155static __inline__ vector unsigned char __ATTRS_o_ai
11156vec_lvlxl(int __a, const vector unsigned char *__b) {
11157  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
11158                  vec_lvsl(__a, (unsigned char *)__b));
11159}
11160
11161static __inline__ vector bool char __ATTRS_o_ai
11162vec_lvlxl(int __a, const vector bool char *__b) {
11163  return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
11164                  vec_lvsl(__a, (unsigned char *)__b));
11165}
11166
11167static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
11168                                                      const short *__b) {
11169  return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
11170}
11171
11172static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
11173                                                      const vector short *__b) {
11174  return vec_perm(vec_ldl(__a, __b), (vector short)(0),
11175                  vec_lvsl(__a, (unsigned char *)__b));
11176}
11177
11178static __inline__ vector unsigned short __ATTRS_o_ai
11179vec_lvlxl(int __a, const unsigned short *__b) {
11180  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
11181                  vec_lvsl(__a, __b));
11182}
11183
11184static __inline__ vector unsigned short __ATTRS_o_ai
11185vec_lvlxl(int __a, const vector unsigned short *__b) {
11186  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
11187                  vec_lvsl(__a, (unsigned char *)__b));
11188}
11189
11190static __inline__ vector bool short __ATTRS_o_ai
11191vec_lvlxl(int __a, const vector bool short *__b) {
11192  return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
11193                  vec_lvsl(__a, (unsigned char *)__b));
11194}
11195
11196static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
11197                                                      const vector pixel *__b) {
11198  return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
11199                  vec_lvsl(__a, (unsigned char *)__b));
11200}
11201
11202static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
11203  return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
11204}
11205
11206static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
11207                                                    const vector int *__b) {
11208  return vec_perm(vec_ldl(__a, __b), (vector int)(0),
11209                  vec_lvsl(__a, (unsigned char *)__b));
11210}
11211
11212static __inline__ vector unsigned int __ATTRS_o_ai
11213vec_lvlxl(int __a, const unsigned int *__b) {
11214  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
11215                  vec_lvsl(__a, __b));
11216}
11217
11218static __inline__ vector unsigned int __ATTRS_o_ai
11219vec_lvlxl(int __a, const vector unsigned int *__b) {
11220  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
11221                  vec_lvsl(__a, (unsigned char *)__b));
11222}
11223
11224static __inline__ vector bool int __ATTRS_o_ai
11225vec_lvlxl(int __a, const vector bool int *__b) {
11226  return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
11227                  vec_lvsl(__a, (unsigned char *)__b));
11228}
11229
11230static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
11231                                                      const float *__b) {
11232  return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
11233}
11234
11235static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
11236                                                      vector float *__b) {
11237  return vec_perm(vec_ldl(__a, __b), (vector float)(0),
11238                  vec_lvsl(__a, (unsigned char *)__b));
11239}
11240
11241/* vec_lvrx */
11242
11243static __inline__ vector signed char __ATTRS_o_ai
11244vec_lvrx(int __a, const signed char *__b) {
11245  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
11246                  vec_lvsl(__a, __b));
11247}
11248
11249static __inline__ vector signed char __ATTRS_o_ai
11250vec_lvrx(int __a, const vector signed char *__b) {
11251  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
11252                  vec_lvsl(__a, (unsigned char *)__b));
11253}
11254
11255static __inline__ vector unsigned char __ATTRS_o_ai
11256vec_lvrx(int __a, const unsigned char *__b) {
11257  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
11258                  vec_lvsl(__a, __b));
11259}
11260
11261static __inline__ vector unsigned char __ATTRS_o_ai
11262vec_lvrx(int __a, const vector unsigned char *__b) {
11263  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
11264                  vec_lvsl(__a, (unsigned char *)__b));
11265}
11266
11267static __inline__ vector bool char __ATTRS_o_ai
11268vec_lvrx(int __a, const vector bool char *__b) {
11269  return vec_perm((vector bool char)(0), vec_ld(__a, __b),
11270                  vec_lvsl(__a, (unsigned char *)__b));
11271}
11272
11273static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
11274                                                     const short *__b) {
11275  return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11276}
11277
11278static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
11279                                                     const vector short *__b) {
11280  return vec_perm((vector short)(0), vec_ld(__a, __b),
11281                  vec_lvsl(__a, (unsigned char *)__b));
11282}
11283
11284static __inline__ vector unsigned short __ATTRS_o_ai
11285vec_lvrx(int __a, const unsigned short *__b) {
11286  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
11287                  vec_lvsl(__a, __b));
11288}
11289
11290static __inline__ vector unsigned short __ATTRS_o_ai
11291vec_lvrx(int __a, const vector unsigned short *__b) {
11292  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
11293                  vec_lvsl(__a, (unsigned char *)__b));
11294}
11295
11296static __inline__ vector bool short __ATTRS_o_ai
11297vec_lvrx(int __a, const vector bool short *__b) {
11298  return vec_perm((vector bool short)(0), vec_ld(__a, __b),
11299                  vec_lvsl(__a, (unsigned char *)__b));
11300}
11301
11302static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
11303                                                     const vector pixel *__b) {
11304  return vec_perm((vector pixel)(0), vec_ld(__a, __b),
11305                  vec_lvsl(__a, (unsigned char *)__b));
11306}
11307
11308static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
11309  return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11310}
11311
11312static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
11313                                                   const vector int *__b) {
11314  return vec_perm((vector int)(0), vec_ld(__a, __b),
11315                  vec_lvsl(__a, (unsigned char *)__b));
11316}
11317
11318static __inline__ vector unsigned int __ATTRS_o_ai
11319vec_lvrx(int __a, const unsigned int *__b) {
11320  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
11321                  vec_lvsl(__a, __b));
11322}
11323
11324static __inline__ vector unsigned int __ATTRS_o_ai
11325vec_lvrx(int __a, const vector unsigned int *__b) {
11326  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
11327                  vec_lvsl(__a, (unsigned char *)__b));
11328}
11329
11330static __inline__ vector bool int __ATTRS_o_ai
11331vec_lvrx(int __a, const vector bool int *__b) {
11332  return vec_perm((vector bool int)(0), vec_ld(__a, __b),
11333                  vec_lvsl(__a, (unsigned char *)__b));
11334}
11335
11336static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
11337                                                     const float *__b) {
11338  return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11339}
11340
11341static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
11342                                                     const vector float *__b) {
11343  return vec_perm((vector float)(0), vec_ld(__a, __b),
11344                  vec_lvsl(__a, (unsigned char *)__b));
11345}
11346
11347/* vec_lvrxl */
11348
11349static __inline__ vector signed char __ATTRS_o_ai
11350vec_lvrxl(int __a, const signed char *__b) {
11351  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
11352                  vec_lvsl(__a, __b));
11353}
11354
11355static __inline__ vector signed char __ATTRS_o_ai
11356vec_lvrxl(int __a, const vector signed char *__b) {
11357  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
11358                  vec_lvsl(__a, (unsigned char *)__b));
11359}
11360
11361static __inline__ vector unsigned char __ATTRS_o_ai
11362vec_lvrxl(int __a, const unsigned char *__b) {
11363  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11364                  vec_lvsl(__a, __b));
11365}
11366
11367static __inline__ vector unsigned char __ATTRS_o_ai
11368vec_lvrxl(int __a, const vector unsigned char *__b) {
11369  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11370                  vec_lvsl(__a, (unsigned char *)__b));
11371}
11372
11373static __inline__ vector bool char __ATTRS_o_ai
11374vec_lvrxl(int __a, const vector bool char *__b) {
11375  return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
11376                  vec_lvsl(__a, (unsigned char *)__b));
11377}
11378
11379static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
11380                                                      const short *__b) {
11381  return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11382}
11383
11384static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
11385                                                      const vector short *__b) {
11386  return vec_perm((vector short)(0), vec_ldl(__a, __b),
11387                  vec_lvsl(__a, (unsigned char *)__b));
11388}
11389
11390static __inline__ vector unsigned short __ATTRS_o_ai
11391vec_lvrxl(int __a, const unsigned short *__b) {
11392  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11393                  vec_lvsl(__a, __b));
11394}
11395
11396static __inline__ vector unsigned short __ATTRS_o_ai
11397vec_lvrxl(int __a, const vector unsigned short *__b) {
11398  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11399                  vec_lvsl(__a, (unsigned char *)__b));
11400}
11401
11402static __inline__ vector bool short __ATTRS_o_ai
11403vec_lvrxl(int __a, const vector bool short *__b) {
11404  return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
11405                  vec_lvsl(__a, (unsigned char *)__b));
11406}
11407
11408static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
11409                                                      const vector pixel *__b) {
11410  return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
11411                  vec_lvsl(__a, (unsigned char *)__b));
11412}
11413
11414static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
11415  return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11416}
11417
11418static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
11419                                                    const vector int *__b) {
11420  return vec_perm((vector int)(0), vec_ldl(__a, __b),
11421                  vec_lvsl(__a, (unsigned char *)__b));
11422}
11423
11424static __inline__ vector unsigned int __ATTRS_o_ai
11425vec_lvrxl(int __a, const unsigned int *__b) {
11426  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11427                  vec_lvsl(__a, __b));
11428}
11429
11430static __inline__ vector unsigned int __ATTRS_o_ai
11431vec_lvrxl(int __a, const vector unsigned int *__b) {
11432  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11433                  vec_lvsl(__a, (unsigned char *)__b));
11434}
11435
11436static __inline__ vector bool int __ATTRS_o_ai
11437vec_lvrxl(int __a, const vector bool int *__b) {
11438  return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
11439                  vec_lvsl(__a, (unsigned char *)__b));
11440}
11441
11442static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
11443                                                      const float *__b) {
11444  return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11445}
11446
11447static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
11448                                                      const vector float *__b) {
11449  return vec_perm((vector float)(0), vec_ldl(__a, __b),
11450                  vec_lvsl(__a, (unsigned char *)__b));
11451}
11452
11453/* vec_stvlx */
11454
11455static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11456                                              signed char *__c) {
11457  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11458                __c);
11459}
11460
11461static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11462                                              vector signed char *__c) {
11463  return vec_st(
11464      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11465      __b, __c);
11466}
11467
11468static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11469                                              unsigned char *__c) {
11470  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11471                __c);
11472}
11473
11474static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11475                                              vector unsigned char *__c) {
11476  return vec_st(
11477      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11478      __b, __c);
11479}
11480
11481static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
11482                                              vector bool char *__c) {
11483  return vec_st(
11484      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11485      __b, __c);
11486}
11487
11488static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11489                                              short *__c) {
11490  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11491                __c);
11492}
11493
11494static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11495                                              vector short *__c) {
11496  return vec_st(
11497      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11498      __b, __c);
11499}
11500
11501static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
11502                                              int __b, unsigned short *__c) {
11503  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11504                __c);
11505}
11506
11507static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
11508                                              int __b,
11509                                              vector unsigned short *__c) {
11510  return vec_st(
11511      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11512      __b, __c);
11513}
11514
11515static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
11516                                              vector bool short *__c) {
11517  return vec_st(
11518      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11519      __b, __c);
11520}
11521
11522static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
11523                                              vector pixel *__c) {
11524  return vec_st(
11525      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11526      __b, __c);
11527}
11528
11529static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
11530                                              int *__c) {
11531  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11532                __c);
11533}
11534
11535static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
11536                                              vector int *__c) {
11537  return vec_st(
11538      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11539      __b, __c);
11540}
11541
11542static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11543                                              unsigned int *__c) {
11544  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11545                __c);
11546}
11547
11548static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11549                                              vector unsigned int *__c) {
11550  return vec_st(
11551      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11552      __b, __c);
11553}
11554
11555static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
11556                                              vector bool int *__c) {
11557  return vec_st(
11558      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11559      __b, __c);
11560}
11561
11562static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
11563                                              vector float *__c) {
11564  return vec_st(
11565      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11566      __b, __c);
11567}
11568
11569/* vec_stvlxl */
11570
11571static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11572                                               signed char *__c) {
11573  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11574                 __c);
11575}
11576
11577static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11578                                               vector signed char *__c) {
11579  return vec_stl(
11580      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11581      __b, __c);
11582}
11583
11584static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
11585                                               int __b, unsigned char *__c) {
11586  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11587                 __c);
11588}
11589
11590static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
11591                                               int __b,
11592                                               vector unsigned char *__c) {
11593  return vec_stl(
11594      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11595      __b, __c);
11596}
11597
11598static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
11599                                               vector bool char *__c) {
11600  return vec_stl(
11601      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11602      __b, __c);
11603}
11604
11605static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11606                                               short *__c) {
11607  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11608                 __c);
11609}
11610
11611static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11612                                               vector short *__c) {
11613  return vec_stl(
11614      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11615      __b, __c);
11616}
11617
11618static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
11619                                               int __b, unsigned short *__c) {
11620  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11621                 __c);
11622}
11623
11624static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
11625                                               int __b,
11626                                               vector unsigned short *__c) {
11627  return vec_stl(
11628      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11629      __b, __c);
11630}
11631
11632static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
11633                                               vector bool short *__c) {
11634  return vec_stl(
11635      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11636      __b, __c);
11637}
11638
11639static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
11640                                               vector pixel *__c) {
11641  return vec_stl(
11642      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11643      __b, __c);
11644}
11645
11646static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
11647                                               int *__c) {
11648  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11649                 __c);
11650}
11651
11652static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
11653                                               vector int *__c) {
11654  return vec_stl(
11655      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11656      __b, __c);
11657}
11658
11659static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11660                                               unsigned int *__c) {
11661  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11662                 __c);
11663}
11664
11665static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11666                                               vector unsigned int *__c) {
11667  return vec_stl(
11668      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11669      __b, __c);
11670}
11671
11672static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
11673                                               vector bool int *__c) {
11674  return vec_stl(
11675      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11676      __b, __c);
11677}
11678
11679static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
11680                                               vector float *__c) {
11681  return vec_stl(
11682      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11683      __b, __c);
11684}
11685
11686/* vec_stvrx */
11687
11688static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11689                                              signed char *__c) {
11690  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11691                __c);
11692}
11693
11694static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11695                                              vector signed char *__c) {
11696  return vec_st(
11697      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11698      __b, __c);
11699}
11700
11701static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11702                                              unsigned char *__c) {
11703  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11704                __c);
11705}
11706
11707static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11708                                              vector unsigned char *__c) {
11709  return vec_st(
11710      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11711      __b, __c);
11712}
11713
11714static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
11715                                              vector bool char *__c) {
11716  return vec_st(
11717      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11718      __b, __c);
11719}
11720
11721static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11722                                              short *__c) {
11723  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11724                __c);
11725}
11726
11727static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11728                                              vector short *__c) {
11729  return vec_st(
11730      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11731      __b, __c);
11732}
11733
11734static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
11735                                              int __b, unsigned short *__c) {
11736  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11737                __c);
11738}
11739
11740static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
11741                                              int __b,
11742                                              vector unsigned short *__c) {
11743  return vec_st(
11744      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11745      __b, __c);
11746}
11747
11748static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
11749                                              vector bool short *__c) {
11750  return vec_st(
11751      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11752      __b, __c);
11753}
11754
11755static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
11756                                              vector pixel *__c) {
11757  return vec_st(
11758      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11759      __b, __c);
11760}
11761
11762static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
11763                                              int *__c) {
11764  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11765                __c);
11766}
11767
11768static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
11769                                              vector int *__c) {
11770  return vec_st(
11771      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11772      __b, __c);
11773}
11774
11775static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11776                                              unsigned int *__c) {
11777  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11778                __c);
11779}
11780
11781static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11782                                              vector unsigned int *__c) {
11783  return vec_st(
11784      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11785      __b, __c);
11786}
11787
11788static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
11789                                              vector bool int *__c) {
11790  return vec_st(
11791      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11792      __b, __c);
11793}
11794
11795static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
11796                                              vector float *__c) {
11797  return vec_st(
11798      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11799      __b, __c);
11800}
11801
11802/* vec_stvrxl */
11803
11804static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11805                                               signed char *__c) {
11806  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11807                 __c);
11808}
11809
11810static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11811                                               vector signed char *__c) {
11812  return vec_stl(
11813      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11814      __b, __c);
11815}
11816
11817static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
11818                                               int __b, unsigned char *__c) {
11819  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11820                 __c);
11821}
11822
11823static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
11824                                               int __b,
11825                                               vector unsigned char *__c) {
11826  return vec_stl(
11827      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11828      __b, __c);
11829}
11830
11831static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
11832                                               vector bool char *__c) {
11833  return vec_stl(
11834      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11835      __b, __c);
11836}
11837
11838static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11839                                               short *__c) {
11840  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11841                 __c);
11842}
11843
11844static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11845                                               vector short *__c) {
11846  return vec_stl(
11847      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11848      __b, __c);
11849}
11850
11851static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
11852                                               int __b, unsigned short *__c) {
11853  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11854                 __c);
11855}
11856
11857static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
11858                                               int __b,
11859                                               vector unsigned short *__c) {
11860  return vec_stl(
11861      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11862      __b, __c);
11863}
11864
11865static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
11866                                               vector bool short *__c) {
11867  return vec_stl(
11868      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11869      __b, __c);
11870}
11871
11872static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
11873                                               vector pixel *__c) {
11874  return vec_stl(
11875      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11876      __b, __c);
11877}
11878
11879static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
11880                                               int *__c) {
11881  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11882                 __c);
11883}
11884
11885static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
11886                                               vector int *__c) {
11887  return vec_stl(
11888      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11889      __b, __c);
11890}
11891
11892static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11893                                               unsigned int *__c) {
11894  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11895                 __c);
11896}
11897
11898static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11899                                               vector unsigned int *__c) {
11900  return vec_stl(
11901      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11902      __b, __c);
11903}
11904
11905static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
11906                                               vector bool int *__c) {
11907  return vec_stl(
11908      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11909      __b, __c);
11910}
11911
11912static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
11913                                               vector float *__c) {
11914  return vec_stl(
11915      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11916      __b, __c);
11917}
11918
11919/* vec_promote */
11920
11921static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
11922                                                              int __b) {
11923  vector signed char __res = (vector signed char)(0);
11924  __res[__b] = __a;
11925  return __res;
11926}
11927
11928static __inline__ vector unsigned char __ATTRS_o_ai
11929vec_promote(unsigned char __a, int __b) {
11930  vector unsigned char __res = (vector unsigned char)(0);
11931  __res[__b] = __a;
11932  return __res;
11933}
11934
11935static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
11936  vector short __res = (vector short)(0);
11937  __res[__b] = __a;
11938  return __res;
11939}
11940
11941static __inline__ vector unsigned short __ATTRS_o_ai
11942vec_promote(unsigned short __a, int __b) {
11943  vector unsigned short __res = (vector unsigned short)(0);
11944  __res[__b] = __a;
11945  return __res;
11946}
11947
11948static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
11949  vector int __res = (vector int)(0);
11950  __res[__b] = __a;
11951  return __res;
11952}
11953
11954static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
11955                                                               int __b) {
11956  vector unsigned int __res = (vector unsigned int)(0);
11957  __res[__b] = __a;
11958  return __res;
11959}
11960
11961static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
11962  vector float __res = (vector float)(0);
11963  __res[__b] = __a;
11964  return __res;
11965}
11966
11967/* vec_splats */
11968
11969static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
11970  return (vector signed char)(__a);
11971}
11972
11973static __inline__ vector unsigned char __ATTRS_o_ai
11974vec_splats(unsigned char __a) {
11975  return (vector unsigned char)(__a);
11976}
11977
11978static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
11979  return (vector short)(__a);
11980}
11981
11982static __inline__ vector unsigned short __ATTRS_o_ai
11983vec_splats(unsigned short __a) {
11984  return (vector unsigned short)(__a);
11985}
11986
11987static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
11988  return (vector int)(__a);
11989}
11990
11991static __inline__ vector unsigned int __ATTRS_o_ai
11992vec_splats(unsigned int __a) {
11993  return (vector unsigned int)(__a);
11994}
11995
11996#ifdef __VSX__
11997static __inline__ vector signed long long __ATTRS_o_ai
11998vec_splats(signed long long __a) {
11999  return (vector signed long long)(__a);
12000}
12001
12002static __inline__ vector unsigned long long __ATTRS_o_ai
12003vec_splats(unsigned long long __a) {
12004  return (vector unsigned long long)(__a);
12005}
12006
12007#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
12008static __inline__ vector signed __int128 __ATTRS_o_ai
12009vec_splats(signed __int128 __a) {
12010  return (vector signed __int128)(__a);
12011}
12012
12013static __inline__ vector unsigned __int128 __ATTRS_o_ai
12014vec_splats(unsigned __int128 __a) {
12015  return (vector unsigned __int128)(__a);
12016}
12017
12018#endif
12019
12020static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
12021  return (vector double)(__a);
12022}
12023#endif
12024
12025static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
12026  return (vector float)(__a);
12027}
12028
12029/* ----------------------------- predicates --------------------------------- */
12030
12031/* vec_all_eq */
12032
12033static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12034                                              vector signed char __b) {
12035  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12036                                      (vector char)__b);
12037}
12038
12039static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12040                                              vector bool char __b) {
12041  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12042                                      (vector char)__b);
12043}
12044
12045static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12046                                              vector unsigned char __b) {
12047  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12048                                      (vector char)__b);
12049}
12050
12051static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12052                                              vector bool char __b) {
12053  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12054                                      (vector char)__b);
12055}
12056
12057static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12058                                              vector signed char __b) {
12059  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12060                                      (vector char)__b);
12061}
12062
12063static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12064                                              vector unsigned char __b) {
12065  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12066                                      (vector char)__b);
12067}
12068
12069static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12070                                              vector bool char __b) {
12071  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12072                                      (vector char)__b);
12073}
12074
12075static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
12076                                              vector short __b) {
12077  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
12078}
12079
12080static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
12081                                              vector bool short __b) {
12082  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
12083}
12084
12085static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
12086                                              vector unsigned short __b) {
12087  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12088                                      (vector short)__b);
12089}
12090
12091static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
12092                                              vector bool short __b) {
12093  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12094                                      (vector short)__b);
12095}
12096
12097static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12098                                              vector short __b) {
12099  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12100                                      (vector short)__b);
12101}
12102
12103static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12104                                              vector unsigned short __b) {
12105  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12106                                      (vector short)__b);
12107}
12108
12109static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12110                                              vector bool short __b) {
12111  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12112                                      (vector short)__b);
12113}
12114
12115static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
12116                                              vector pixel __b) {
12117  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12118                                      (vector short)__b);
12119}
12120
12121static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
12122  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
12123}
12124
12125static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
12126                                              vector bool int __b) {
12127  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
12128}
12129
12130static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
12131                                              vector unsigned int __b) {
12132  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12133                                      (vector int)__b);
12134}
12135
12136static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
12137                                              vector bool int __b) {
12138  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12139                                      (vector int)__b);
12140}
12141
12142static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12143                                              vector int __b) {
12144  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12145                                      (vector int)__b);
12146}
12147
12148static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12149                                              vector unsigned int __b) {
12150  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12151                                      (vector int)__b);
12152}
12153
12154static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12155                                              vector bool int __b) {
12156  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12157                                      (vector int)__b);
12158}
12159
12160#ifdef __POWER8_VECTOR__
12161static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
12162                                              vector signed long long __b) {
12163  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
12164}
12165
12166static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
12167                                              vector bool long long __b) {
12168  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
12169}
12170
12171static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
12172                                              vector unsigned long long __b) {
12173  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12174                                      (vector long long)__b);
12175}
12176
12177static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
12178                                              vector bool long long __b) {
12179  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12180                                      (vector long long)__b);
12181}
12182
12183static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12184                                              vector long long __b) {
12185  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12186                                      (vector long long)__b);
12187}
12188
12189static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12190                                              vector unsigned long long __b) {
12191  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12192                                      (vector long long)__b);
12193}
12194
12195static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12196                                              vector bool long long __b) {
12197  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12198                                      (vector long long)__b);
12199}
12200#endif
12201
12202static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
12203                                              vector float __b) {
12204#ifdef __VSX__
12205  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
12206#else
12207  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
12208#endif
12209}
12210
12211#ifdef __VSX__
12212static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
12213                                              vector double __b) {
12214  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
12215}
12216#endif
12217
12218/* vec_all_ge */
12219
12220static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
12221                                              vector signed char __b) {
12222  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
12223}
12224
12225static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
12226                                              vector bool char __b) {
12227  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
12228}
12229
12230static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
12231                                              vector unsigned char __b) {
12232  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
12233}
12234
12235static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
12236                                              vector bool char __b) {
12237  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
12238}
12239
12240static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12241                                              vector signed char __b) {
12242  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
12243                                      (vector unsigned char)__a);
12244}
12245
12246static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12247                                              vector unsigned char __b) {
12248  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
12249}
12250
12251static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12252                                              vector bool char __b) {
12253  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
12254                                      (vector unsigned char)__a);
12255}
12256
12257static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
12258                                              vector short __b) {
12259  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
12260}
12261
12262static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
12263                                              vector bool short __b) {
12264  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
12265}
12266
12267static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
12268                                              vector unsigned short __b) {
12269  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
12270}
12271
12272static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
12273                                              vector bool short __b) {
12274  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12275                                      __a);
12276}
12277
12278static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12279                                              vector short __b) {
12280  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12281                                      (vector unsigned short)__a);
12282}
12283
12284static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12285                                              vector unsigned short __b) {
12286  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
12287                                      (vector unsigned short)__a);
12288}
12289
12290static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12291                                              vector bool short __b) {
12292  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12293                                      (vector unsigned short)__a);
12294}
12295
12296static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
12297  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
12298}
12299
12300static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
12301                                              vector bool int __b) {
12302  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
12303}
12304
12305static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
12306                                              vector unsigned int __b) {
12307  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
12308}
12309
12310static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
12311                                              vector bool int __b) {
12312  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
12313}
12314
12315static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12316                                              vector int __b) {
12317  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
12318                                      (vector unsigned int)__a);
12319}
12320
12321static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12322                                              vector unsigned int __b) {
12323  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
12324}
12325
12326static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12327                                              vector bool int __b) {
12328  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
12329                                      (vector unsigned int)__a);
12330}
12331
12332#ifdef __POWER8_VECTOR__
12333static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
12334                                              vector signed long long __b) {
12335  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
12336}
12337static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
12338                                              vector bool long long __b) {
12339  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
12340                                      __a);
12341}
12342
12343static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
12344                                              vector unsigned long long __b) {
12345  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
12346}
12347
12348static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
12349                                              vector bool long long __b) {
12350  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12351                                      __a);
12352}
12353
12354static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12355                                              vector signed long long __b) {
12356  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12357                                      (vector unsigned long long)__a);
12358}
12359
12360static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12361                                              vector unsigned long long __b) {
12362  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
12363                                      (vector unsigned long long)__a);
12364}
12365
12366static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12367                                              vector bool long long __b) {
12368  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12369                                      (vector unsigned long long)__a);
12370}
12371#endif
12372
12373static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
12374                                              vector float __b) {
12375#ifdef __VSX__
12376  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
12377#else
12378  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
12379#endif
12380}
12381
12382#ifdef __VSX__
12383static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
12384                                              vector double __b) {
12385  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
12386}
12387#endif
12388
12389/* vec_all_gt */
12390
12391static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
12392                                              vector signed char __b) {
12393  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
12394}
12395
12396static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
12397                                              vector bool char __b) {
12398  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
12399}
12400
12401static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
12402                                              vector unsigned char __b) {
12403  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
12404}
12405
12406static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
12407                                              vector bool char __b) {
12408  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
12409}
12410
12411static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12412                                              vector signed char __b) {
12413  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
12414                                      (vector unsigned char)__b);
12415}
12416
12417static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12418                                              vector unsigned char __b) {
12419  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
12420}
12421
12422static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12423                                              vector bool char __b) {
12424  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
12425                                      (vector unsigned char)__b);
12426}
12427
12428static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
12429                                              vector short __b) {
12430  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
12431}
12432
12433static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
12434                                              vector bool short __b) {
12435  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
12436}
12437
12438static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12439                                              vector unsigned short __b) {
12440  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
12441}
12442
12443static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12444                                              vector bool short __b) {
12445  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
12446                                      (vector unsigned short)__b);
12447}
12448
12449static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12450                                              vector short __b) {
12451  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12452                                      (vector unsigned short)__b);
12453}
12454
12455static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12456                                              vector unsigned short __b) {
12457  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12458                                      __b);
12459}
12460
12461static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12462                                              vector bool short __b) {
12463  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12464                                      (vector unsigned short)__b);
12465}
12466
12467static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
12468  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
12469}
12470
12471static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
12472                                              vector bool int __b) {
12473  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
12474}
12475
12476static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12477                                              vector unsigned int __b) {
12478  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
12479}
12480
12481static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12482                                              vector bool int __b) {
12483  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
12484}
12485
12486static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12487                                              vector int __b) {
12488  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12489                                      (vector unsigned int)__b);
12490}
12491
12492static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12493                                              vector unsigned int __b) {
12494  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
12495}
12496
12497static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12498                                              vector bool int __b) {
12499  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12500                                      (vector unsigned int)__b);
12501}
12502
12503#ifdef __POWER8_VECTOR__
12504static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12505                                              vector signed long long __b) {
12506  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
12507}
12508static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12509                                              vector bool long long __b) {
12510  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
12511                                      (vector signed long long)__b);
12512}
12513
12514static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12515                                              vector unsigned long long __b) {
12516  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
12517}
12518
12519static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12520                                              vector bool long long __b) {
12521  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
12522                                      (vector unsigned long long)__b);
12523}
12524
12525static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12526                                              vector signed long long __b) {
12527  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12528                                      (vector unsigned long long)__b);
12529}
12530
12531static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12532                                              vector unsigned long long __b) {
12533  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12534                                      __b);
12535}
12536
12537static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12538                                              vector bool long long __b) {
12539  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12540                                      (vector unsigned long long)__b);
12541}
12542#endif
12543
12544static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
12545                                              vector float __b) {
12546#ifdef __VSX__
12547  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
12548#else
12549  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
12550#endif
12551}
12552
12553#ifdef __VSX__
12554static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
12555                                              vector double __b) {
12556  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
12557}
12558#endif
12559
12560/* vec_all_in */
12561
12562static __inline__ int __attribute__((__always_inline__))
12563vec_all_in(vector float __a, vector float __b) {
12564  return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
12565}
12566
12567/* vec_all_le */
12568
12569static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
12570                                              vector signed char __b) {
12571  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
12572}
12573
12574static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
12575                                              vector bool char __b) {
12576  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
12577}
12578
12579static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12580                                              vector unsigned char __b) {
12581  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
12582}
12583
12584static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12585                                              vector bool char __b) {
12586  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
12587}
12588
12589static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12590                                              vector signed char __b) {
12591  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12592                                      (vector unsigned char)__b);
12593}
12594
12595static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12596                                              vector unsigned char __b) {
12597  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
12598}
12599
12600static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12601                                              vector bool char __b) {
12602  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12603                                      (vector unsigned char)__b);
12604}
12605
12606static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
12607                                              vector short __b) {
12608  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
12609}
12610
12611static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
12612                                              vector bool short __b) {
12613  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
12614}
12615
12616static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12617                                              vector unsigned short __b) {
12618  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
12619}
12620
12621static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12622                                              vector bool short __b) {
12623  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
12624                                      (vector unsigned short)__b);
12625}
12626
12627static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12628                                              vector short __b) {
12629  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12630                                      (vector unsigned short)__b);
12631}
12632
12633static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12634                                              vector unsigned short __b) {
12635  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12636                                      __b);
12637}
12638
12639static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12640                                              vector bool short __b) {
12641  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12642                                      (vector unsigned short)__b);
12643}
12644
12645static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
12646  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
12647}
12648
12649static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
12650                                              vector bool int __b) {
12651  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
12652}
12653
12654static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12655                                              vector unsigned int __b) {
12656  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
12657}
12658
12659static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12660                                              vector bool int __b) {
12661  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
12662}
12663
12664static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12665                                              vector int __b) {
12666  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12667                                      (vector unsigned int)__b);
12668}
12669
12670static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12671                                              vector unsigned int __b) {
12672  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
12673}
12674
12675static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12676                                              vector bool int __b) {
12677  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12678                                      (vector unsigned int)__b);
12679}
12680
12681#ifdef __POWER8_VECTOR__
12682static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12683                                              vector signed long long __b) {
12684  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
12685}
12686
12687static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12688                                              vector unsigned long long __b) {
12689  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
12690}
12691
12692static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12693                                              vector bool long long __b) {
12694  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
12695                                      (vector signed long long)__b);
12696}
12697
12698static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12699                                              vector bool long long __b) {
12700  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
12701                                      (vector unsigned long long)__b);
12702}
12703
12704static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12705                                              vector signed long long __b) {
12706  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12707                                      (vector unsigned long long)__b);
12708}
12709
12710static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12711                                              vector unsigned long long __b) {
12712  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12713                                      __b);
12714}
12715
12716static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12717                                              vector bool long long __b) {
12718  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12719                                      (vector unsigned long long)__b);
12720}
12721#endif
12722
12723static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
12724                                              vector float __b) {
12725#ifdef __VSX__
12726  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
12727#else
12728  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
12729#endif
12730}
12731
12732#ifdef __VSX__
12733static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
12734                                              vector double __b) {
12735  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
12736}
12737#endif
12738
12739/* vec_all_lt */
12740
12741static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12742                                              vector signed char __b) {
12743  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
12744}
12745
12746static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12747                                              vector bool char __b) {
12748  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
12749}
12750
12751static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12752                                              vector unsigned char __b) {
12753  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
12754}
12755
12756static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12757                                              vector bool char __b) {
12758  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
12759}
12760
12761static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12762                                              vector signed char __b) {
12763  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12764                                      (vector unsigned char)__a);
12765}
12766
12767static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12768                                              vector unsigned char __b) {
12769  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
12770}
12771
12772static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12773                                              vector bool char __b) {
12774  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12775                                      (vector unsigned char)__a);
12776}
12777
12778static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
12779                                              vector short __b) {
12780  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
12781}
12782
12783static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
12784                                              vector bool short __b) {
12785  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
12786}
12787
12788static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12789                                              vector unsigned short __b) {
12790  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
12791}
12792
12793static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12794                                              vector bool short __b) {
12795  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12796                                      __a);
12797}
12798
12799static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12800                                              vector short __b) {
12801  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12802                                      (vector unsigned short)__a);
12803}
12804
12805static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12806                                              vector unsigned short __b) {
12807  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
12808                                      (vector unsigned short)__a);
12809}
12810
12811static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12812                                              vector bool short __b) {
12813  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12814                                      (vector unsigned short)__a);
12815}
12816
12817static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
12818  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
12819}
12820
12821static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
12822                                              vector bool int __b) {
12823  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
12824}
12825
12826static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12827                                              vector unsigned int __b) {
12828  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
12829}
12830
12831static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12832                                              vector bool int __b) {
12833  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
12834}
12835
12836static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12837                                              vector int __b) {
12838  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12839                                      (vector unsigned int)__a);
12840}
12841
12842static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12843                                              vector unsigned int __b) {
12844  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
12845}
12846
12847static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12848                                              vector bool int __b) {
12849  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12850                                      (vector unsigned int)__a);
12851}
12852
12853#ifdef __POWER8_VECTOR__
12854static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12855                                              vector signed long long __b) {
12856  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12857}
12858
12859static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12860                                              vector unsigned long long __b) {
12861  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12862}
12863
12864static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12865                                              vector bool long long __b) {
12866  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12867                                      __a);
12868}
12869
12870static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12871                                              vector bool long long __b) {
12872  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12873                                      __a);
12874}
12875
12876static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12877                                              vector signed long long __b) {
12878  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12879                                      (vector unsigned long long)__a);
12880}
12881
12882static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12883                                              vector unsigned long long __b) {
12884  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12885                                      (vector unsigned long long)__a);
12886}
12887
12888static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12889                                              vector bool long long __b) {
12890  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12891                                      (vector unsigned long long)__a);
12892}
12893#endif
12894
12895static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
12896                                              vector float __b) {
12897#ifdef __VSX__
12898  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
12899#else
12900  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
12901#endif
12902}
12903
12904#ifdef __VSX__
12905static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
12906                                              vector double __b) {
12907  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
12908}
12909#endif
12910
12911/* vec_all_nan */
12912
12913static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
12914#ifdef __VSX__
12915  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
12916#else
12917  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
12918#endif
12919}
12920
12921#ifdef __VSX__
12922static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
12923  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
12924}
12925#endif
12926
12927/* vec_all_ne */
12928
12929static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12930                                              vector signed char __b) {
12931  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12932                                      (vector char)__b);
12933}
12934
12935static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12936                                              vector bool char __b) {
12937  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12938                                      (vector char)__b);
12939}
12940
12941static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12942                                              vector unsigned char __b) {
12943  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12944                                      (vector char)__b);
12945}
12946
12947static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12948                                              vector bool char __b) {
12949  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12950                                      (vector char)__b);
12951}
12952
12953static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12954                                              vector signed char __b) {
12955  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12956                                      (vector char)__b);
12957}
12958
12959static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12960                                              vector unsigned char __b) {
12961  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12962                                      (vector char)__b);
12963}
12964
12965static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12966                                              vector bool char __b) {
12967  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12968                                      (vector char)__b);
12969}
12970
12971static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
12972                                              vector short __b) {
12973  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
12974}
12975
12976static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
12977                                              vector bool short __b) {
12978  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
12979}
12980
12981static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12982                                              vector unsigned short __b) {
12983  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12984                                      (vector short)__b);
12985}
12986
12987static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12988                                              vector bool short __b) {
12989  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12990                                      (vector short)__b);
12991}
12992
12993static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12994                                              vector short __b) {
12995  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12996                                      (vector short)__b);
12997}
12998
12999static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13000                                              vector unsigned short __b) {
13001  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13002                                      (vector short)__b);
13003}
13004
13005static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13006                                              vector bool short __b) {
13007  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13008                                      (vector short)__b);
13009}
13010
13011static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
13012                                              vector pixel __b) {
13013  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13014                                      (vector short)__b);
13015}
13016
13017static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
13018  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
13019}
13020
13021static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
13022                                              vector bool int __b) {
13023  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
13024}
13025
13026static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13027                                              vector unsigned int __b) {
13028  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13029                                      (vector int)__b);
13030}
13031
13032static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13033                                              vector bool int __b) {
13034  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13035                                      (vector int)__b);
13036}
13037
13038static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13039                                              vector int __b) {
13040  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13041                                      (vector int)__b);
13042}
13043
13044static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13045                                              vector unsigned int __b) {
13046  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13047                                      (vector int)__b);
13048}
13049
13050static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13051                                              vector bool int __b) {
13052  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13053                                      (vector int)__b);
13054}
13055
13056#ifdef __POWER8_VECTOR__
13057static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
13058                                              vector signed long long __b) {
13059  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
13060}
13061
13062static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
13063                                              vector unsigned long long __b) {
13064  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
13065                                      (vector long long)__b);
13066}
13067
13068static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
13069                                              vector bool long long __b) {
13070  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
13071                                      (vector signed long long)__b);
13072}
13073
13074static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
13075                                              vector bool long long __b) {
13076  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13077                                      (vector signed long long)__b);
13078}
13079
13080static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13081                                              vector signed long long __b) {
13082  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13083                                      (vector signed long long)__b);
13084}
13085
13086static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13087                                              vector unsigned long long __b) {
13088  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13089                                      (vector signed long long)__b);
13090}
13091
13092static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13093                                              vector bool long long __b) {
13094  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13095                                      (vector signed long long)__b);
13096}
13097#endif
13098
13099static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
13100                                              vector float __b) {
13101#ifdef __VSX__
13102  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
13103#else
13104  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
13105#endif
13106}
13107
13108#ifdef __VSX__
13109static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
13110                                              vector double __b) {
13111  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
13112}
13113#endif
13114
13115/* vec_all_nge */
13116
13117static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
13118                                               vector float __b) {
13119#ifdef __VSX__
13120  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
13121#else
13122  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
13123#endif
13124}
13125
13126#ifdef __VSX__
13127static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
13128                                               vector double __b) {
13129  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
13130}
13131#endif
13132
13133/* vec_all_ngt */
13134
13135static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
13136                                               vector float __b) {
13137#ifdef __VSX__
13138  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
13139#else
13140  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
13141#endif
13142}
13143
13144#ifdef __VSX__
13145static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
13146                                               vector double __b) {
13147  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
13148}
13149#endif
13150
13151/* vec_all_nle */
13152
13153static __inline__ int __attribute__((__always_inline__))
13154vec_all_nle(vector float __a, vector float __b) {
13155  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
13156}
13157
13158/* vec_all_nlt */
13159
13160static __inline__ int __attribute__((__always_inline__))
13161vec_all_nlt(vector float __a, vector float __b) {
13162  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
13163}
13164
13165/* vec_all_numeric */
13166
13167static __inline__ int __attribute__((__always_inline__))
13168vec_all_numeric(vector float __a) {
13169  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
13170}
13171
13172/* vec_any_eq */
13173
13174static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
13175                                              vector signed char __b) {
13176  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13177                                      (vector char)__b);
13178}
13179
13180static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
13181                                              vector bool char __b) {
13182  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13183                                      (vector char)__b);
13184}
13185
13186static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
13187                                              vector unsigned char __b) {
13188  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13189                                      (vector char)__b);
13190}
13191
13192static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
13193                                              vector bool char __b) {
13194  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13195                                      (vector char)__b);
13196}
13197
13198static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13199                                              vector signed char __b) {
13200  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13201                                      (vector char)__b);
13202}
13203
13204static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13205                                              vector unsigned char __b) {
13206  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13207                                      (vector char)__b);
13208}
13209
13210static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13211                                              vector bool char __b) {
13212  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13213                                      (vector char)__b);
13214}
13215
13216static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
13217                                              vector short __b) {
13218  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
13219}
13220
13221static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
13222                                              vector bool short __b) {
13223  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
13224}
13225
13226static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
13227                                              vector unsigned short __b) {
13228  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13229                                      (vector short)__b);
13230}
13231
13232static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
13233                                              vector bool short __b) {
13234  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13235                                      (vector short)__b);
13236}
13237
13238static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13239                                              vector short __b) {
13240  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13241                                      (vector short)__b);
13242}
13243
13244static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13245                                              vector unsigned short __b) {
13246  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13247                                      (vector short)__b);
13248}
13249
13250static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13251                                              vector bool short __b) {
13252  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13253                                      (vector short)__b);
13254}
13255
13256static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
13257                                              vector pixel __b) {
13258  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13259                                      (vector short)__b);
13260}
13261
13262static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
13263  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
13264}
13265
13266static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
13267                                              vector bool int __b) {
13268  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
13269}
13270
13271static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
13272                                              vector unsigned int __b) {
13273  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13274                                      (vector int)__b);
13275}
13276
13277static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
13278                                              vector bool int __b) {
13279  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13280                                      (vector int)__b);
13281}
13282
13283static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13284                                              vector int __b) {
13285  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13286                                      (vector int)__b);
13287}
13288
13289static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13290                                              vector unsigned int __b) {
13291  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13292                                      (vector int)__b);
13293}
13294
13295static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13296                                              vector bool int __b) {
13297  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13298                                      (vector int)__b);
13299}
13300
13301#ifdef __POWER8_VECTOR__
13302static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
13303                                              vector signed long long __b) {
13304  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
13305}
13306
13307static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
13308                                              vector unsigned long long __b) {
13309  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
13310                                      (vector long long)__b);
13311}
13312
13313static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
13314                                              vector bool long long __b) {
13315  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
13316                                      (vector signed long long)__b);
13317}
13318
13319static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
13320                                              vector bool long long __b) {
13321  return __builtin_altivec_vcmpequd_p(
13322      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13323}
13324
13325static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13326                                              vector signed long long __b) {
13327  return __builtin_altivec_vcmpequd_p(
13328      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13329}
13330
13331static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13332                                              vector unsigned long long __b) {
13333  return __builtin_altivec_vcmpequd_p(
13334      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13335}
13336
13337static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13338                                              vector bool long long __b) {
13339  return __builtin_altivec_vcmpequd_p(
13340      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13341}
13342#endif
13343
13344static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
13345                                              vector float __b) {
13346#ifdef __VSX__
13347  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
13348#else
13349  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
13350#endif
13351}
13352
13353#ifdef __VSX__
13354static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
13355                                              vector double __b) {
13356  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
13357}
13358#endif
13359
13360/* vec_any_ge */
13361
13362static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
13363                                              vector signed char __b) {
13364  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
13365}
13366
13367static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
13368                                              vector bool char __b) {
13369  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
13370                                      __a);
13371}
13372
13373static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
13374                                              vector unsigned char __b) {
13375  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
13376}
13377
13378static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
13379                                              vector bool char __b) {
13380  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13381                                      __a);
13382}
13383
13384static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13385                                              vector signed char __b) {
13386  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13387                                      (vector unsigned char)__a);
13388}
13389
13390static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13391                                              vector unsigned char __b) {
13392  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
13393                                      (vector unsigned char)__a);
13394}
13395
13396static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13397                                              vector bool char __b) {
13398  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13399                                      (vector unsigned char)__a);
13400}
13401
13402static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
13403                                              vector short __b) {
13404  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
13405}
13406
13407static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
13408                                              vector bool short __b) {
13409  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
13410}
13411
13412static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
13413                                              vector unsigned short __b) {
13414  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
13415}
13416
13417static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
13418                                              vector bool short __b) {
13419  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13420                                      __a);
13421}
13422
13423static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13424                                              vector short __b) {
13425  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13426                                      (vector unsigned short)__a);
13427}
13428
13429static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13430                                              vector unsigned short __b) {
13431  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
13432                                      (vector unsigned short)__a);
13433}
13434
13435static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13436                                              vector bool short __b) {
13437  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13438                                      (vector unsigned short)__a);
13439}
13440
13441static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
13442  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
13443}
13444
13445static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
13446                                              vector bool int __b) {
13447  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
13448}
13449
13450static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
13451                                              vector unsigned int __b) {
13452  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
13453}
13454
13455static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
13456                                              vector bool int __b) {
13457  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13458                                      __a);
13459}
13460
13461static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13462                                              vector int __b) {
13463  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13464                                      (vector unsigned int)__a);
13465}
13466
13467static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13468                                              vector unsigned int __b) {
13469  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
13470                                      (vector unsigned int)__a);
13471}
13472
13473static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13474                                              vector bool int __b) {
13475  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13476                                      (vector unsigned int)__a);
13477}
13478
13479#ifdef __POWER8_VECTOR__
13480static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13481                                              vector signed long long __b) {
13482  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
13483}
13484
13485static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13486                                              vector unsigned long long __b) {
13487  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
13488}
13489
13490static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13491                                              vector bool long long __b) {
13492  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
13493                                      (vector signed long long)__b, __a);
13494}
13495
13496static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13497                                              vector bool long long __b) {
13498  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13499                                      (vector unsigned long long)__b, __a);
13500}
13501
13502static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13503                                              vector signed long long __b) {
13504  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13505                                      (vector unsigned long long)__b,
13506                                      (vector unsigned long long)__a);
13507}
13508
13509static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13510                                              vector unsigned long long __b) {
13511  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
13512                                      (vector unsigned long long)__a);
13513}
13514
13515static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13516                                              vector bool long long __b) {
13517  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13518                                      (vector unsigned long long)__b,
13519                                      (vector unsigned long long)__a);
13520}
13521#endif
13522
13523static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
13524                                              vector float __b) {
13525#ifdef __VSX__
13526  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
13527#else
13528  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
13529#endif
13530}
13531
13532#ifdef __VSX__
13533static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
13534                                              vector double __b) {
13535  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
13536}
13537#endif
13538
13539/* vec_any_gt */
13540
13541static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13542                                              vector signed char __b) {
13543  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
13544}
13545
13546static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13547                                              vector bool char __b) {
13548  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
13549                                      (vector signed char)__b);
13550}
13551
13552static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13553                                              vector unsigned char __b) {
13554  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
13555}
13556
13557static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13558                                              vector bool char __b) {
13559  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
13560                                      (vector unsigned char)__b);
13561}
13562
13563static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13564                                              vector signed char __b) {
13565  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13566                                      (vector unsigned char)__b);
13567}
13568
13569static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13570                                              vector unsigned char __b) {
13571  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13572                                      __b);
13573}
13574
13575static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13576                                              vector bool char __b) {
13577  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13578                                      (vector unsigned char)__b);
13579}
13580
13581static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
13582                                              vector short __b) {
13583  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
13584}
13585
13586static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
13587                                              vector bool short __b) {
13588  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
13589}
13590
13591static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13592                                              vector unsigned short __b) {
13593  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
13594}
13595
13596static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13597                                              vector bool short __b) {
13598  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
13599                                      (vector unsigned short)__b);
13600}
13601
13602static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13603                                              vector short __b) {
13604  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13605                                      (vector unsigned short)__b);
13606}
13607
13608static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13609                                              vector unsigned short __b) {
13610  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13611                                      __b);
13612}
13613
13614static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13615                                              vector bool short __b) {
13616  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13617                                      (vector unsigned short)__b);
13618}
13619
13620static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
13621  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
13622}
13623
13624static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
13625                                              vector bool int __b) {
13626  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
13627}
13628
13629static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13630                                              vector unsigned int __b) {
13631  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
13632}
13633
13634static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13635                                              vector bool int __b) {
13636  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
13637                                      (vector unsigned int)__b);
13638}
13639
13640static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13641                                              vector int __b) {
13642  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13643                                      (vector unsigned int)__b);
13644}
13645
13646static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13647                                              vector unsigned int __b) {
13648  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13649                                      __b);
13650}
13651
13652static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13653                                              vector bool int __b) {
13654  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13655                                      (vector unsigned int)__b);
13656}
13657
13658#ifdef __POWER8_VECTOR__
13659static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13660                                              vector signed long long __b) {
13661  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
13662}
13663
13664static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13665                                              vector unsigned long long __b) {
13666  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
13667}
13668
13669static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13670                                              vector bool long long __b) {
13671  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
13672                                      (vector signed long long)__b);
13673}
13674
13675static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13676                                              vector bool long long __b) {
13677  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
13678                                      (vector unsigned long long)__b);
13679}
13680
13681static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13682                                              vector signed long long __b) {
13683  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13684                                      (vector unsigned long long)__a,
13685                                      (vector unsigned long long)__b);
13686}
13687
13688static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13689                                              vector unsigned long long __b) {
13690  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13691                                      (vector unsigned long long)__a, __b);
13692}
13693
13694static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13695                                              vector bool long long __b) {
13696  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13697                                      (vector unsigned long long)__a,
13698                                      (vector unsigned long long)__b);
13699}
13700#endif
13701
13702static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
13703                                              vector float __b) {
13704#ifdef __VSX__
13705  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
13706#else
13707  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
13708#endif
13709}
13710
13711#ifdef __VSX__
13712static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
13713                                              vector double __b) {
13714  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
13715}
13716#endif
13717
13718/* vec_any_le */
13719
13720static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
13721                                              vector signed char __b) {
13722  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
13723}
13724
13725static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
13726                                              vector bool char __b) {
13727  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
13728                                      (vector signed char)__b);
13729}
13730
13731static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13732                                              vector unsigned char __b) {
13733  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
13734}
13735
13736static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13737                                              vector bool char __b) {
13738  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
13739                                      (vector unsigned char)__b);
13740}
13741
13742static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13743                                              vector signed char __b) {
13744  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13745                                      (vector unsigned char)__b);
13746}
13747
13748static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13749                                              vector unsigned char __b) {
13750  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13751                                      __b);
13752}
13753
13754static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13755                                              vector bool char __b) {
13756  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13757                                      (vector unsigned char)__b);
13758}
13759
13760static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
13761                                              vector short __b) {
13762  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
13763}
13764
13765static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
13766                                              vector bool short __b) {
13767  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
13768}
13769
13770static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13771                                              vector unsigned short __b) {
13772  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
13773}
13774
13775static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13776                                              vector bool short __b) {
13777  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
13778                                      (vector unsigned short)__b);
13779}
13780
13781static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13782                                              vector short __b) {
13783  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13784                                      (vector unsigned short)__b);
13785}
13786
13787static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13788                                              vector unsigned short __b) {
13789  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13790                                      __b);
13791}
13792
13793static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13794                                              vector bool short __b) {
13795  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13796                                      (vector unsigned short)__b);
13797}
13798
13799static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
13800  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
13801}
13802
13803static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
13804                                              vector bool int __b) {
13805  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
13806}
13807
13808static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13809                                              vector unsigned int __b) {
13810  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
13811}
13812
13813static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13814                                              vector bool int __b) {
13815  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
13816                                      (vector unsigned int)__b);
13817}
13818
13819static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13820                                              vector int __b) {
13821  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13822                                      (vector unsigned int)__b);
13823}
13824
13825static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13826                                              vector unsigned int __b) {
13827  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13828                                      __b);
13829}
13830
13831static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13832                                              vector bool int __b) {
13833  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13834                                      (vector unsigned int)__b);
13835}
13836
13837#ifdef __POWER8_VECTOR__
13838static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13839                                              vector signed long long __b) {
13840  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13841}
13842
13843static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13844                                              vector unsigned long long __b) {
13845  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13846}
13847
13848static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13849                                              vector bool long long __b) {
13850  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13851                                      (vector signed long long)__b);
13852}
13853
13854static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13855                                              vector bool long long __b) {
13856  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13857                                      (vector unsigned long long)__b);
13858}
13859
13860static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13861                                              vector signed long long __b) {
13862  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13863                                      (vector unsigned long long)__a,
13864                                      (vector unsigned long long)__b);
13865}
13866
13867static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13868                                              vector unsigned long long __b) {
13869  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13870                                      (vector unsigned long long)__a, __b);
13871}
13872
13873static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13874                                              vector bool long long __b) {
13875  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13876                                      (vector unsigned long long)__a,
13877                                      (vector unsigned long long)__b);
13878}
13879#endif
13880
13881static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
13882                                              vector float __b) {
13883#ifdef __VSX__
13884  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
13885#else
13886  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
13887#endif
13888}
13889
13890#ifdef __VSX__
13891static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
13892                                              vector double __b) {
13893  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
13894}
13895#endif
13896
13897/* vec_any_lt */
13898
13899static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13900                                              vector signed char __b) {
13901  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
13902}
13903
13904static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13905                                              vector bool char __b) {
13906  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
13907                                      __a);
13908}
13909
13910static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13911                                              vector unsigned char __b) {
13912  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
13913}
13914
13915static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13916                                              vector bool char __b) {
13917  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13918                                      __a);
13919}
13920
13921static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13922                                              vector signed char __b) {
13923  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13924                                      (vector unsigned char)__a);
13925}
13926
13927static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13928                                              vector unsigned char __b) {
13929  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
13930                                      (vector unsigned char)__a);
13931}
13932
13933static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13934                                              vector bool char __b) {
13935  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13936                                      (vector unsigned char)__a);
13937}
13938
13939static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
13940                                              vector short __b) {
13941  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
13942}
13943
13944static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
13945                                              vector bool short __b) {
13946  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
13947}
13948
13949static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13950                                              vector unsigned short __b) {
13951  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
13952}
13953
13954static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13955                                              vector bool short __b) {
13956  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13957                                      __a);
13958}
13959
13960static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13961                                              vector short __b) {
13962  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13963                                      (vector unsigned short)__a);
13964}
13965
13966static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13967                                              vector unsigned short __b) {
13968  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
13969                                      (vector unsigned short)__a);
13970}
13971
13972static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13973                                              vector bool short __b) {
13974  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13975                                      (vector unsigned short)__a);
13976}
13977
13978static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
13979  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
13980}
13981
13982static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
13983                                              vector bool int __b) {
13984  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
13985}
13986
13987static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13988                                              vector unsigned int __b) {
13989  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
13990}
13991
13992static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13993                                              vector bool int __b) {
13994  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13995                                      __a);
13996}
13997
13998static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
13999                                              vector int __b) {
14000  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14001                                      (vector unsigned int)__a);
14002}
14003
14004static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14005                                              vector unsigned int __b) {
14006  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
14007                                      (vector unsigned int)__a);
14008}
14009
14010static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14011                                              vector bool int __b) {
14012  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14013                                      (vector unsigned int)__a);
14014}
14015
14016#ifdef __POWER8_VECTOR__
14017static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14018                                              vector signed long long __b) {
14019  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
14020}
14021
14022static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14023                                              vector unsigned long long __b) {
14024  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
14025}
14026
14027static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14028                                              vector bool long long __b) {
14029  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
14030                                      (vector signed long long)__b, __a);
14031}
14032
14033static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14034                                              vector bool long long __b) {
14035  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14036                                      (vector unsigned long long)__b, __a);
14037}
14038
14039static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14040                                              vector signed long long __b) {
14041  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14042                                      (vector unsigned long long)__b,
14043                                      (vector unsigned long long)__a);
14044}
14045
14046static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14047                                              vector unsigned long long __b) {
14048  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
14049                                      (vector unsigned long long)__a);
14050}
14051
14052static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14053                                              vector bool long long __b) {
14054  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14055                                      (vector unsigned long long)__b,
14056                                      (vector unsigned long long)__a);
14057}
14058#endif
14059
14060static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
14061                                              vector float __b) {
14062#ifdef __VSX__
14063  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
14064#else
14065  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
14066#endif
14067}
14068
14069#ifdef __VSX__
14070static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
14071                                              vector double __b) {
14072  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
14073}
14074#endif
14075
14076/* vec_any_nan */
14077
14078static __inline__ int __attribute__((__always_inline__))
14079vec_any_nan(vector float __a) {
14080  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
14081}
14082
14083/* vec_any_ne */
14084
14085static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
14086                                              vector signed char __b) {
14087  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14088                                      (vector char)__b);
14089}
14090
14091static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
14092                                              vector bool char __b) {
14093  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14094                                      (vector char)__b);
14095}
14096
14097static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
14098                                              vector unsigned char __b) {
14099  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14100                                      (vector char)__b);
14101}
14102
14103static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
14104                                              vector bool char __b) {
14105  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14106                                      (vector char)__b);
14107}
14108
14109static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14110                                              vector signed char __b) {
14111  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14112                                      (vector char)__b);
14113}
14114
14115static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14116                                              vector unsigned char __b) {
14117  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14118                                      (vector char)__b);
14119}
14120
14121static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14122                                              vector bool char __b) {
14123  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14124                                      (vector char)__b);
14125}
14126
14127static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
14128                                              vector short __b) {
14129  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
14130}
14131
14132static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
14133                                              vector bool short __b) {
14134  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
14135}
14136
14137static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
14138                                              vector unsigned short __b) {
14139  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14140                                      (vector short)__b);
14141}
14142
14143static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
14144                                              vector bool short __b) {
14145  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14146                                      (vector short)__b);
14147}
14148
14149static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14150                                              vector short __b) {
14151  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14152                                      (vector short)__b);
14153}
14154
14155static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14156                                              vector unsigned short __b) {
14157  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14158                                      (vector short)__b);
14159}
14160
14161static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14162                                              vector bool short __b) {
14163  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14164                                      (vector short)__b);
14165}
14166
14167static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
14168                                              vector pixel __b) {
14169  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14170                                      (vector short)__b);
14171}
14172
14173static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
14174  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
14175}
14176
14177static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
14178                                              vector bool int __b) {
14179  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
14180}
14181
14182static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
14183                                              vector unsigned int __b) {
14184  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14185                                      (vector int)__b);
14186}
14187
14188static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
14189                                              vector bool int __b) {
14190  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14191                                      (vector int)__b);
14192}
14193
14194static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14195                                              vector int __b) {
14196  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14197                                      (vector int)__b);
14198}
14199
14200static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14201                                              vector unsigned int __b) {
14202  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14203                                      (vector int)__b);
14204}
14205
14206static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14207                                              vector bool int __b) {
14208  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14209                                      (vector int)__b);
14210}
14211
14212#ifdef __POWER8_VECTOR__
14213static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
14214                                              vector signed long long __b) {
14215  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
14216}
14217
14218static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
14219                                              vector unsigned long long __b) {
14220  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
14221                                      (vector long long)__b);
14222}
14223
14224static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
14225                                              vector bool long long __b) {
14226  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
14227                                      (vector signed long long)__b);
14228}
14229
14230static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
14231                                              vector bool long long __b) {
14232  return __builtin_altivec_vcmpequd_p(
14233      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14234}
14235
14236static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14237                                              vector signed long long __b) {
14238  return __builtin_altivec_vcmpequd_p(
14239      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14240}
14241
14242static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14243                                              vector unsigned long long __b) {
14244  return __builtin_altivec_vcmpequd_p(
14245      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14246}
14247
14248static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14249                                              vector bool long long __b) {
14250  return __builtin_altivec_vcmpequd_p(
14251      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14252}
14253#endif
14254
14255static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
14256                                              vector float __b) {
14257#ifdef __VSX__
14258  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
14259#else
14260  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
14261#endif
14262}
14263
14264#ifdef __VSX__
14265static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
14266                                              vector double __b) {
14267  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
14268}
14269#endif
14270
14271/* vec_any_nge */
14272
14273static __inline__ int __attribute__((__always_inline__))
14274vec_any_nge(vector float __a, vector float __b) {
14275  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
14276}
14277
14278/* vec_any_ngt */
14279
14280static __inline__ int __attribute__((__always_inline__))
14281vec_any_ngt(vector float __a, vector float __b) {
14282  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
14283}
14284
14285/* vec_any_nle */
14286
14287static __inline__ int __attribute__((__always_inline__))
14288vec_any_nle(vector float __a, vector float __b) {
14289  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
14290}
14291
14292/* vec_any_nlt */
14293
14294static __inline__ int __attribute__((__always_inline__))
14295vec_any_nlt(vector float __a, vector float __b) {
14296  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
14297}
14298
14299/* vec_any_numeric */
14300
14301static __inline__ int __attribute__((__always_inline__))
14302vec_any_numeric(vector float __a) {
14303  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
14304}
14305
14306/* vec_any_out */
14307
14308static __inline__ int __attribute__((__always_inline__))
14309vec_any_out(vector float __a, vector float __b) {
14310  return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
14311}
14312
14313/* Power 8 Crypto functions
14314Note: We diverge from the current GCC implementation with regard
14315to cryptography and related functions as follows:
14316- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
14317- The remaining ones are only available on Power8 and up so
14318  require -mpower8-vector
14319The justification for this is that export requirements require that
14320Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
14321support). As a result, we need to be able to turn off support for those.
14322The remaining ones (currently controlled by -mcrypto for GCC) still
14323need to be provided on compliant hardware even if Vector.Crypto is not
14324provided.
14325*/
14326#ifdef __CRYPTO__
14327#define vec_sbox_be __builtin_altivec_crypto_vsbox
14328#define vec_cipher_be __builtin_altivec_crypto_vcipher
14329#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
14330#define vec_ncipher_be __builtin_altivec_crypto_vncipher
14331#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
14332
14333static __inline__ vector unsigned long long __attribute__((__always_inline__))
14334__builtin_crypto_vsbox(vector unsigned long long __a) {
14335  return __builtin_altivec_crypto_vsbox(__a);
14336}
14337
14338static __inline__ vector unsigned long long __attribute__((__always_inline__))
14339__builtin_crypto_vcipher(vector unsigned long long __a,
14340                         vector unsigned long long __b) {
14341  return __builtin_altivec_crypto_vcipher(__a, __b);
14342}
14343
14344static __inline__ vector unsigned long long __attribute__((__always_inline__))
14345__builtin_crypto_vcipherlast(vector unsigned long long __a,
14346                             vector unsigned long long __b) {
14347  return __builtin_altivec_crypto_vcipherlast(__a, __b);
14348}
14349
14350static __inline__ vector unsigned long long __attribute__((__always_inline__))
14351__builtin_crypto_vncipher(vector unsigned long long __a,
14352                          vector unsigned long long __b) {
14353  return __builtin_altivec_crypto_vncipher(__a, __b);
14354}
14355
14356static __inline__ vector unsigned long long __attribute__((__always_inline__))
14357__builtin_crypto_vncipherlast(vector unsigned long long __a,
14358                              vector unsigned long long __b) {
14359  return __builtin_altivec_crypto_vncipherlast(__a, __b);
14360}
14361
14362#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
14363#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
14364
14365#define vec_shasigma_be(X, Y, Z)                                               \
14366  _Generic((X), vector unsigned int                                            \
14367           : __builtin_crypto_vshasigmaw, vector unsigned long long            \
14368           : __builtin_crypto_vshasigmad)((X), (Y), (Z))
14369#endif
14370
14371#ifdef __POWER8_VECTOR__
14372static __inline__ vector unsigned char __ATTRS_o_ai
14373__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
14374                          vector unsigned char __c) {
14375  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
14376}
14377
14378static __inline__ vector unsigned short __ATTRS_o_ai
14379__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
14380                          vector unsigned short __c) {
14381  return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
14382      (vector unsigned char)__a, (vector unsigned char)__b,
14383      (vector unsigned char)__c);
14384}
14385
14386static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
14387    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
14388  return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
14389      (vector unsigned char)__a, (vector unsigned char)__b,
14390      (vector unsigned char)__c);
14391}
14392
14393static __inline__ vector unsigned long long __ATTRS_o_ai
14394__builtin_crypto_vpermxor(vector unsigned long long __a,
14395                          vector unsigned long long __b,
14396                          vector unsigned long long __c) {
14397  return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
14398      (vector unsigned char)__a, (vector unsigned char)__b,
14399      (vector unsigned char)__c);
14400}
14401
14402static __inline__ vector unsigned char __ATTRS_o_ai
14403__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
14404  return __builtin_altivec_crypto_vpmsumb(__a, __b);
14405}
14406
14407static __inline__ vector unsigned short __ATTRS_o_ai
14408__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
14409  return __builtin_altivec_crypto_vpmsumh(__a, __b);
14410}
14411
14412static __inline__ vector unsigned int __ATTRS_o_ai
14413__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
14414  return __builtin_altivec_crypto_vpmsumw(__a, __b);
14415}
14416
14417static __inline__ vector unsigned long long __ATTRS_o_ai
14418__builtin_crypto_vpmsumb(vector unsigned long long __a,
14419                         vector unsigned long long __b) {
14420  return __builtin_altivec_crypto_vpmsumd(__a, __b);
14421}
14422
14423static __inline__ vector signed char __ATTRS_o_ai
14424vec_vgbbd(vector signed char __a) {
14425  return __builtin_altivec_vgbbd((vector unsigned char)__a);
14426}
14427
14428#define vec_pmsum_be __builtin_crypto_vpmsumb
14429#define vec_gb __builtin_altivec_vgbbd
14430
14431static __inline__ vector unsigned char __ATTRS_o_ai
14432vec_vgbbd(vector unsigned char __a) {
14433  return __builtin_altivec_vgbbd(__a);
14434}
14435
14436static __inline__ vector long long __ATTRS_o_ai
14437vec_vbpermq(vector signed char __a, vector signed char __b) {
14438  return __builtin_altivec_vbpermq((vector unsigned char)__a,
14439                                   (vector unsigned char)__b);
14440}
14441
14442static __inline__ vector long long __ATTRS_o_ai
14443vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
14444  return __builtin_altivec_vbpermq(__a, __b);
14445}
14446
14447#ifdef __powerpc64__
14448static __inline__ vector unsigned long long __attribute__((__always_inline__))
14449vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
14450  return __builtin_altivec_vbpermq((vector unsigned char)__a,
14451                                   (vector unsigned char)__b);
14452}
14453#endif
14454#endif
14455
14456#undef __ATTRS_o_ai
14457
14458#endif /* __ALTIVEC_H */
14459