Clang Project

clang_source_code/lib/Headers/altivec.h
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/* Constants for vec_test_data_class */
38#define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
39#define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
40#define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
41                                  __VEC_CLASS_FP_SUBNORMAL_N)
42#define __VEC_CLASS_FP_ZERO_N (1<<2)
43#define __VEC_CLASS_FP_ZERO_P (1<<3)
44#define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P           | \
45                             __VEC_CLASS_FP_ZERO_N)
46#define __VEC_CLASS_FP_INFINITY_N (1<<4)
47#define __VEC_CLASS_FP_INFINITY_P (1<<5)
48#define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P   | \
49                                 __VEC_CLASS_FP_INFINITY_N)
50#define __VEC_CLASS_FP_NAN (1<<6)
51#define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN        | \
52                                   __VEC_CLASS_FP_SUBNORMAL  | \
53                                   __VEC_CLASS_FP_ZERO       | \
54                                   __VEC_CLASS_FP_INFINITY)
55
56#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
57
58#ifdef __POWER9_VECTOR__
59#include <stddef.h>
60#endif
61
62static __inline__ vector signed char __ATTRS_o_ai vec_perm(
63    vector signed char __a, vector signed char __b, vector unsigned char __c);
64
65static __inline__ vector unsigned char __ATTRS_o_ai
66vec_perm(vector unsigned char __a, vector unsigned char __b,
67         vector unsigned char __c);
68
69static __inline__ vector bool char __ATTRS_o_ai
70vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
71
72static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
73                                                     vector signed short __b,
74                                                     vector unsigned char __c);
75
76static __inline__ vector unsigned short __ATTRS_o_ai
77vec_perm(vector unsigned short __a, vector unsigned short __b,
78         vector unsigned char __c);
79
80static __inline__ vector bool short __ATTRS_o_ai vec_perm(
81    vector bool short __a, vector bool short __b, vector unsigned char __c);
82
83static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
84                                                     vector pixel __b,
85                                                     vector unsigned char __c);
86
87static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
88                                                   vector signed int __b,
89                                                   vector unsigned char __c);
90
91static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
92    vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
93
94static __inline__ vector bool int __ATTRS_o_ai
95vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
96
97static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
98                                                     vector float __b,
99                                                     vector unsigned char __c);
100
101#ifdef __VSX__
102static __inline__ vector long long __ATTRS_o_ai
103vec_perm(vector signed long long __a, vector signed long long __b,
104         vector unsigned char __c);
105
106static __inline__ vector unsigned long long __ATTRS_o_ai
107vec_perm(vector unsigned long long __a, vector unsigned long long __b,
108         vector unsigned char __c);
109
110static __inline__ vector bool long long __ATTRS_o_ai
111vec_perm(vector bool long long __a, vector bool long long __b,
112         vector unsigned char __c);
113
114static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
115                                                      vector double __b,
116                                                      vector unsigned char __c);
117#endif
118
119static __inline__ vector unsigned char __ATTRS_o_ai
120vec_xor(vector unsigned char __a, vector unsigned char __b);
121
122/* vec_abs */
123
124#define __builtin_altivec_abs_v16qi vec_abs
125#define __builtin_altivec_abs_v8hi vec_abs
126#define __builtin_altivec_abs_v4si vec_abs
127
128static __inline__ vector signed char __ATTRS_o_ai
129vec_abs(vector signed char __a) {
130  return __builtin_altivec_vmaxsb(__a, -__a);
131}
132
133static __inline__ vector signed short __ATTRS_o_ai
134vec_abs(vector signed short __a) {
135  return __builtin_altivec_vmaxsh(__a, -__a);
136}
137
138static __inline__ vector signed int __ATTRS_o_ai
139vec_abs(vector signed int __a) {
140  return __builtin_altivec_vmaxsw(__a, -__a);
141}
142
143#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
144static __inline__ vector signed long long __ATTRS_o_ai
145vec_abs(vector signed long long __a) {
146  return __builtin_altivec_vmaxsd(__a, -__a);
147}
148#endif
149
150static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
151#ifdef __VSX__
152  return __builtin_vsx_xvabssp(__a);
153#else
154  vector unsigned int __res =
155      (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
156  return (vector float)__res;
157#endif
158}
159
160#ifdef __VSX__
161static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
162  return __builtin_vsx_xvabsdp(__a);
163}
164#endif
165
166/* vec_abss */
167#define __builtin_altivec_abss_v16qi vec_abss
168#define __builtin_altivec_abss_v8hi vec_abss
169#define __builtin_altivec_abss_v4si vec_abss
170
171static __inline__ vector signed char __ATTRS_o_ai
172vec_abss(vector signed char __a) {
173  return __builtin_altivec_vmaxsb(
174      __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
175}
176
177static __inline__ vector signed short __ATTRS_o_ai
178vec_abss(vector signed short __a) {
179  return __builtin_altivec_vmaxsh(
180      __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
181}
182
183static __inline__ vector signed int __ATTRS_o_ai
184vec_abss(vector signed int __a) {
185  return __builtin_altivec_vmaxsw(
186      __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
187}
188
189/* vec_absd */
190#if defined(__POWER9_VECTOR__)
191
192static __inline__ vector unsigned char __ATTRS_o_ai
193vec_absd(vector unsigned char __a, vector unsigned char __b) {
194  return __builtin_altivec_vabsdub(__a, __b);
195}
196
197static __inline__ vector unsigned short __ATTRS_o_ai
198vec_absd(vector unsigned short __a, vector unsigned short __b) {
199  return __builtin_altivec_vabsduh(__a, __b);
200}
201
202static __inline__ vector unsigned int __ATTRS_o_ai
203vec_absd(vector unsigned int __a,  vector unsigned int __b) {
204  return __builtin_altivec_vabsduw(__a, __b);
205}
206
207#endif /* End __POWER9_VECTOR__ */
208
209/* vec_add */
210
211static __inline__ vector signed char __ATTRS_o_ai
212vec_add(vector signed char __a, vector signed char __b) {
213  return __a + __b;
214}
215
216static __inline__ vector signed char __ATTRS_o_ai
217vec_add(vector bool char __a, vector signed char __b) {
218  return (vector signed char)__a + __b;
219}
220
221static __inline__ vector signed char __ATTRS_o_ai
222vec_add(vector signed char __a, vector bool char __b) {
223  return __a + (vector signed char)__b;
224}
225
226static __inline__ vector unsigned char __ATTRS_o_ai
227vec_add(vector unsigned char __a, vector unsigned char __b) {
228  return __a + __b;
229}
230
231static __inline__ vector unsigned char __ATTRS_o_ai
232vec_add(vector bool char __a, vector unsigned char __b) {
233  return (vector unsigned char)__a + __b;
234}
235
236static __inline__ vector unsigned char __ATTRS_o_ai
237vec_add(vector unsigned char __a, vector bool char __b) {
238  return __a + (vector unsigned char)__b;
239}
240
241static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
242                                                    vector short __b) {
243  return __a + __b;
244}
245
246static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
247                                                    vector short __b) {
248  return (vector short)__a + __b;
249}
250
251static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
252                                                    vector bool short __b) {
253  return __a + (vector short)__b;
254}
255
256static __inline__ vector unsigned short __ATTRS_o_ai
257vec_add(vector unsigned short __a, vector unsigned short __b) {
258  return __a + __b;
259}
260
261static __inline__ vector unsigned short __ATTRS_o_ai
262vec_add(vector bool short __a, vector unsigned short __b) {
263  return (vector unsigned short)__a + __b;
264}
265
266static __inline__ vector unsigned short __ATTRS_o_ai
267vec_add(vector unsigned short __a, vector bool short __b) {
268  return __a + (vector unsigned short)__b;
269}
270
271static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
272                                                  vector int __b) {
273  return __a + __b;
274}
275
276static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
277                                                  vector int __b) {
278  return (vector int)__a + __b;
279}
280
281static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
282                                                  vector bool int __b) {
283  return __a + (vector int)__b;
284}
285
286static __inline__ vector unsigned int __ATTRS_o_ai
287vec_add(vector unsigned int __a, vector unsigned int __b) {
288  return __a + __b;
289}
290
291static __inline__ vector unsigned int __ATTRS_o_ai
292vec_add(vector bool int __a, vector unsigned int __b) {
293  return (vector unsigned int)__a + __b;
294}
295
296static __inline__ vector unsigned int __ATTRS_o_ai
297vec_add(vector unsigned int __a, vector bool int __b) {
298  return __a + (vector unsigned int)__b;
299}
300
301#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
302static __inline__ vector signed long long __ATTRS_o_ai
303vec_add(vector signed long long __a, vector signed long long __b) {
304  return __a + __b;
305}
306
307static __inline__ vector unsigned long long __ATTRS_o_ai
308vec_add(vector unsigned long long __a, vector unsigned long long __b) {
309  return __a + __b;
310}
311
312static __inline__ vector signed __int128 __ATTRS_o_ai
313vec_add(vector signed __int128 __a, vector signed __int128 __b) {
314  return __a + __b;
315}
316
317static __inline__ vector unsigned __int128 __ATTRS_o_ai
318vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
319  return __a + __b;
320}
321#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
322
323static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
324                                                    vector float __b) {
325  return __a + __b;
326}
327
328#ifdef __VSX__
329static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
330                                                     vector double __b) {
331  return __a + __b;
332}
333#endif // __VSX__
334
335/* vec_adde */
336
337#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
338static __inline__ vector signed __int128 __ATTRS_o_ai
339vec_adde(vector signed __int128 __a, vector signed __int128 __b,
340         vector signed __int128 __c) {
341  return __builtin_altivec_vaddeuqm(__a, __b, __c);
342}
343
344static __inline__ vector unsigned __int128 __ATTRS_o_ai
345vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
346         vector unsigned __int128 __c) {
347  return __builtin_altivec_vaddeuqm(__a, __b, __c);
348}
349#endif
350
351static __inline__ vector signed int __ATTRS_o_ai
352vec_adde(vector signed int __a, vector signed int __b,
353         vector signed int __c) {
354  vector signed int __mask = {1111};
355  vector signed int __carry = __c & __mask;
356  return vec_add(vec_add(__a, __b), __carry);
357}
358
359static __inline__ vector unsigned int __ATTRS_o_ai
360vec_adde(vector unsigned int __a, vector unsigned int __b,
361         vector unsigned int __c) {
362  vector unsigned int __mask = {1111};
363  vector unsigned int __carry = __c & __mask;
364  return vec_add(vec_add(__a, __b), __carry);
365}
366
367/* vec_addec */
368
369#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
370static __inline__ vector signed __int128 __ATTRS_o_ai
371vec_addec(vector signed __int128 __a, vector signed __int128 __b,
372          vector signed __int128 __c) {
373  return __builtin_altivec_vaddecuq(__a, __b, __c);
374}
375
376static __inline__ vector unsigned __int128 __ATTRS_o_ai
377vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
378          vector unsigned __int128 __c) {
379  return __builtin_altivec_vaddecuq(__a, __b, __c);
380}
381
382static __inline__ vector signed int __ATTRS_o_ai
383vec_addec(vector signed int __a, vector signed int __b,
384          vector signed int __c) {
385
386  signed int __result[4];
387  for (int i = 0; i < 4; i++) {
388    unsigned int __tempa = (unsigned int) __a[i];
389    unsigned int __tempb = (unsigned int) __b[i];
390    unsigned int __tempc = (unsigned int) __c[i];
391    __tempc = __tempc & 0x00000001;
392    unsigned long long __longa = (unsigned long long) __tempa;
393    unsigned long long __longb = (unsigned long long) __tempb;
394    unsigned long long __longc = (unsigned long long) __tempc;
395    unsigned long long __sum = __longa + __longb + __longc;
396    unsigned long long __res = (__sum >> 32) & 0x01;
397    unsigned long long __tempres = (unsigned int) __res;
398    __result[i] = (signed int) __tempres;
399  }
400
401  vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
402  return ret;
403}
404
405static __inline__ vector unsigned int __ATTRS_o_ai
406vec_addec(vector unsigned int __a, vector unsigned int __b,
407          vector unsigned int __c) {
408
409  unsigned int __result[4];
410  for (int i = 0; i < 4; i++) {
411    unsigned int __tempc = __c[i] & 1;
412    unsigned long long __longa = (unsigned long long) __a[i];
413    unsigned long long __longb = (unsigned long long) __b[i];
414    unsigned long long __longc = (unsigned long long) __tempc;
415    unsigned long long __sum = __longa + __longb + __longc;
416    unsigned long long __res = (__sum >> 32) & 0x01;
417    unsigned long long __tempres = (unsigned int) __res;
418    __result[i] = (signed int) __tempres;
419  }
420
421  vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
422  return ret;
423}
424
425#endif
426
427/* vec_vaddubm */
428
429#define __builtin_altivec_vaddubm vec_vaddubm
430
431static __inline__ vector signed char __ATTRS_o_ai
432vec_vaddubm(vector signed char __a, vector signed char __b) {
433  return __a + __b;
434}
435
436static __inline__ vector signed char __ATTRS_o_ai
437vec_vaddubm(vector bool char __a, vector signed char __b) {
438  return (vector signed char)__a + __b;
439}
440
441static __inline__ vector signed char __ATTRS_o_ai
442vec_vaddubm(vector signed char __a, vector bool char __b) {
443  return __a + (vector signed char)__b;
444}
445
446static __inline__ vector unsigned char __ATTRS_o_ai
447vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
448  return __a + __b;
449}
450
451static __inline__ vector unsigned char __ATTRS_o_ai
452vec_vaddubm(vector bool char __a, vector unsigned char __b) {
453  return (vector unsigned char)__a + __b;
454}
455
456static __inline__ vector unsigned char __ATTRS_o_ai
457vec_vaddubm(vector unsigned char __a, vector bool char __b) {
458  return __a + (vector unsigned char)__b;
459}
460
461/* vec_vadduhm */
462
463#define __builtin_altivec_vadduhm vec_vadduhm
464
465static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
466                                                        vector short __b) {
467  return __a + __b;
468}
469
470static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
471                                                        vector short __b) {
472  return (vector short)__a + __b;
473}
474
475static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
476                                                        vector bool short __b) {
477  return __a + (vector short)__b;
478}
479
480static __inline__ vector unsigned short __ATTRS_o_ai
481vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
482  return __a + __b;
483}
484
485static __inline__ vector unsigned short __ATTRS_o_ai
486vec_vadduhm(vector bool short __a, vector unsigned short __b) {
487  return (vector unsigned short)__a + __b;
488}
489
490static __inline__ vector unsigned short __ATTRS_o_ai
491vec_vadduhm(vector unsigned short __a, vector bool short __b) {
492  return __a + (vector unsigned short)__b;
493}
494
495/* vec_vadduwm */
496
497#define __builtin_altivec_vadduwm vec_vadduwm
498
499static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
500                                                      vector int __b) {
501  return __a + __b;
502}
503
504static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
505                                                      vector int __b) {
506  return (vector int)__a + __b;
507}
508
509static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
510                                                      vector bool int __b) {
511  return __a + (vector int)__b;
512}
513
514static __inline__ vector unsigned int __ATTRS_o_ai
515vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
516  return __a + __b;
517}
518
519static __inline__ vector unsigned int __ATTRS_o_ai
520vec_vadduwm(vector bool int __a, vector unsigned int __b) {
521  return (vector unsigned int)__a + __b;
522}
523
524static __inline__ vector unsigned int __ATTRS_o_ai
525vec_vadduwm(vector unsigned int __a, vector bool int __b) {
526  return __a + (vector unsigned int)__b;
527}
528
529/* vec_vaddfp */
530
531#define __builtin_altivec_vaddfp vec_vaddfp
532
533static __inline__ vector float __attribute__((__always_inline__))
534vec_vaddfp(vector float __a, vector float __b) {
535  return __a + __b;
536}
537
538/* vec_addc */
539
540static __inline__ vector signed int __ATTRS_o_ai
541vec_addc(vector signed int __a, vector signed int __b) {
542  return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
543                                                      (vector unsigned int)__b);
544}
545
546static __inline__ vector unsigned int __ATTRS_o_ai
547vec_addc(vector unsigned int __a, vector unsigned int __b) {
548  return __builtin_altivec_vaddcuw(__a, __b);
549}
550
551#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
552static __inline__ vector signed __int128 __ATTRS_o_ai
553vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
554  return (vector signed __int128)__builtin_altivec_vaddcuq(
555      (vector unsigned __int128)__a, (vector unsigned __int128)__b);
556}
557
558static __inline__ vector unsigned __int128 __ATTRS_o_ai
559vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
560  return __builtin_altivec_vaddcuq(__a, __b);
561}
562#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
563
564/* vec_vaddcuw */
565
566static __inline__ vector unsigned int __attribute__((__always_inline__))
567vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
568  return __builtin_altivec_vaddcuw(__a, __b);
569}
570
571/* vec_adds */
572
573static __inline__ vector signed char __ATTRS_o_ai
574vec_adds(vector signed char __a, vector signed char __b) {
575  return __builtin_altivec_vaddsbs(__a, __b);
576}
577
578static __inline__ vector signed char __ATTRS_o_ai
579vec_adds(vector bool char __a, vector signed char __b) {
580  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
581}
582
583static __inline__ vector signed char __ATTRS_o_ai
584vec_adds(vector signed char __a, vector bool char __b) {
585  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
586}
587
588static __inline__ vector unsigned char __ATTRS_o_ai
589vec_adds(vector unsigned char __a, vector unsigned char __b) {
590  return __builtin_altivec_vaddubs(__a, __b);
591}
592
593static __inline__ vector unsigned char __ATTRS_o_ai
594vec_adds(vector bool char __a, vector unsigned char __b) {
595  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
596}
597
598static __inline__ vector unsigned char __ATTRS_o_ai
599vec_adds(vector unsigned char __a, vector bool char __b) {
600  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
601}
602
603static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
604                                                     vector short __b) {
605  return __builtin_altivec_vaddshs(__a, __b);
606}
607
608static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
609                                                     vector short __b) {
610  return __builtin_altivec_vaddshs((vector short)__a, __b);
611}
612
613static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
614                                                     vector bool short __b) {
615  return __builtin_altivec_vaddshs(__a, (vector short)__b);
616}
617
618static __inline__ vector unsigned short __ATTRS_o_ai
619vec_adds(vector unsigned short __a, vector unsigned short __b) {
620  return __builtin_altivec_vadduhs(__a, __b);
621}
622
623static __inline__ vector unsigned short __ATTRS_o_ai
624vec_adds(vector bool short __a, vector unsigned short __b) {
625  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
626}
627
628static __inline__ vector unsigned short __ATTRS_o_ai
629vec_adds(vector unsigned short __a, vector bool short __b) {
630  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
631}
632
633static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
634                                                   vector int __b) {
635  return __builtin_altivec_vaddsws(__a, __b);
636}
637
638static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
639                                                   vector int __b) {
640  return __builtin_altivec_vaddsws((vector int)__a, __b);
641}
642
643static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
644                                                   vector bool int __b) {
645  return __builtin_altivec_vaddsws(__a, (vector int)__b);
646}
647
648static __inline__ vector unsigned int __ATTRS_o_ai
649vec_adds(vector unsigned int __a, vector unsigned int __b) {
650  return __builtin_altivec_vadduws(__a, __b);
651}
652
653static __inline__ vector unsigned int __ATTRS_o_ai
654vec_adds(vector bool int __a, vector unsigned int __b) {
655  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
656}
657
658static __inline__ vector unsigned int __ATTRS_o_ai
659vec_adds(vector unsigned int __a, vector bool int __b) {
660  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
661}
662
663/* vec_vaddsbs */
664
665static __inline__ vector signed char __ATTRS_o_ai
666vec_vaddsbs(vector signed char __a, vector signed char __b) {
667  return __builtin_altivec_vaddsbs(__a, __b);
668}
669
670static __inline__ vector signed char __ATTRS_o_ai
671vec_vaddsbs(vector bool char __a, vector signed char __b) {
672  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
673}
674
675static __inline__ vector signed char __ATTRS_o_ai
676vec_vaddsbs(vector signed char __a, vector bool char __b) {
677  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
678}
679
680/* vec_vaddubs */
681
682static __inline__ vector unsigned char __ATTRS_o_ai
683vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
684  return __builtin_altivec_vaddubs(__a, __b);
685}
686
687static __inline__ vector unsigned char __ATTRS_o_ai
688vec_vaddubs(vector bool char __a, vector unsigned char __b) {
689  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
690}
691
692static __inline__ vector unsigned char __ATTRS_o_ai
693vec_vaddubs(vector unsigned char __a, vector bool char __b) {
694  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
695}
696
697/* vec_vaddshs */
698
699static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
700                                                        vector short __b) {
701  return __builtin_altivec_vaddshs(__a, __b);
702}
703
704static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
705                                                        vector short __b) {
706  return __builtin_altivec_vaddshs((vector short)__a, __b);
707}
708
709static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
710                                                        vector bool short __b) {
711  return __builtin_altivec_vaddshs(__a, (vector short)__b);
712}
713
714/* vec_vadduhs */
715
716static __inline__ vector unsigned short __ATTRS_o_ai
717vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
718  return __builtin_altivec_vadduhs(__a, __b);
719}
720
721static __inline__ vector unsigned short __ATTRS_o_ai
722vec_vadduhs(vector bool short __a, vector unsigned short __b) {
723  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
724}
725
726static __inline__ vector unsigned short __ATTRS_o_ai
727vec_vadduhs(vector unsigned short __a, vector bool short __b) {
728  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
729}
730
731/* vec_vaddsws */
732
733static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
734                                                      vector int __b) {
735  return __builtin_altivec_vaddsws(__a, __b);
736}
737
738static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
739                                                      vector int __b) {
740  return __builtin_altivec_vaddsws((vector int)__a, __b);
741}
742
743static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
744                                                      vector bool int __b) {
745  return __builtin_altivec_vaddsws(__a, (vector int)__b);
746}
747
748/* vec_vadduws */
749
750static __inline__ vector unsigned int __ATTRS_o_ai
751vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
752  return __builtin_altivec_vadduws(__a, __b);
753}
754
755static __inline__ vector unsigned int __ATTRS_o_ai
756vec_vadduws(vector bool int __a, vector unsigned int __b) {
757  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
758}
759
760static __inline__ vector unsigned int __ATTRS_o_ai
761vec_vadduws(vector unsigned int __a, vector bool int __b) {
762  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
763}
764
765#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
766/* vec_vadduqm */
767
768static __inline__ vector signed __int128 __ATTRS_o_ai
769vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
770  return __a + __b;
771}
772
773static __inline__ vector unsigned __int128 __ATTRS_o_ai
774vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
775  return __a + __b;
776}
777
778/* vec_vaddeuqm */
779
780static __inline__ vector signed __int128 __ATTRS_o_ai
781vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
782             vector signed __int128 __c) {
783  return __builtin_altivec_vaddeuqm(__a, __b, __c);
784}
785
786static __inline__ vector unsigned __int128 __ATTRS_o_ai
787vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
788             vector unsigned __int128 __c) {
789  return __builtin_altivec_vaddeuqm(__a, __b, __c);
790}
791
792/* vec_vaddcuq */
793
794static __inline__ vector signed __int128 __ATTRS_o_ai
795vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
796  return __builtin_altivec_vaddcuq(__a, __b);
797}
798
799static __inline__ vector unsigned __int128 __ATTRS_o_ai
800vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
801  return __builtin_altivec_vaddcuq(__a, __b);
802}
803
804/* vec_vaddecuq */
805
806static __inline__ vector signed __int128 __ATTRS_o_ai
807vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
808             vector signed __int128 __c) {
809  return __builtin_altivec_vaddecuq(__a, __b, __c);
810}
811
812static __inline__ vector unsigned __int128 __ATTRS_o_ai
813vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
814             vector unsigned __int128 __c) {
815  return __builtin_altivec_vaddecuq(__a, __b, __c);
816}
817#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
818
819/* vec_and */
820
821#define __builtin_altivec_vand vec_and
822
823static __inline__ vector signed char __ATTRS_o_ai
824vec_and(vector signed char __a, vector signed char __b) {
825  return __a & __b;
826}
827
828static __inline__ vector signed char __ATTRS_o_ai
829vec_and(vector bool char __a, vector signed char __b) {
830  return (vector signed char)__a & __b;
831}
832
833static __inline__ vector signed char __ATTRS_o_ai
834vec_and(vector signed char __a, vector bool char __b) {
835  return __a & (vector signed char)__b;
836}
837
838static __inline__ vector unsigned char __ATTRS_o_ai
839vec_and(vector unsigned char __a, vector unsigned char __b) {
840  return __a & __b;
841}
842
843static __inline__ vector unsigned char __ATTRS_o_ai
844vec_and(vector bool char __a, vector unsigned char __b) {
845  return (vector unsigned char)__a & __b;
846}
847
848static __inline__ vector unsigned char __ATTRS_o_ai
849vec_and(vector unsigned char __a, vector bool char __b) {
850  return __a & (vector unsigned char)__b;
851}
852
853static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
854                                                        vector bool char __b) {
855  return __a & __b;
856}
857
858static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
859                                                    vector short __b) {
860  return __a & __b;
861}
862
863static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
864                                                    vector short __b) {
865  return (vector short)__a & __b;
866}
867
868static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
869                                                    vector bool short __b) {
870  return __a & (vector short)__b;
871}
872
873static __inline__ vector unsigned short __ATTRS_o_ai
874vec_and(vector unsigned short __a, vector unsigned short __b) {
875  return __a & __b;
876}
877
878static __inline__ vector unsigned short __ATTRS_o_ai
879vec_and(vector bool short __a, vector unsigned short __b) {
880  return (vector unsigned short)__a & __b;
881}
882
883static __inline__ vector unsigned short __ATTRS_o_ai
884vec_and(vector unsigned short __a, vector bool short __b) {
885  return __a & (vector unsigned short)__b;
886}
887
888static __inline__ vector bool short __ATTRS_o_ai
889vec_and(vector bool short __a, vector bool short __b) {
890  return __a & __b;
891}
892
893static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
894                                                  vector int __b) {
895  return __a & __b;
896}
897
898static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
899                                                  vector int __b) {
900  return (vector int)__a & __b;
901}
902
903static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
904                                                  vector bool int __b) {
905  return __a & (vector int)__b;
906}
907
908static __inline__ vector unsigned int __ATTRS_o_ai
909vec_and(vector unsigned int __a, vector unsigned int __b) {
910  return __a & __b;
911}
912
913static __inline__ vector unsigned int __ATTRS_o_ai
914vec_and(vector bool int __a, vector unsigned int __b) {
915  return (vector unsigned int)__a & __b;
916}
917
918static __inline__ vector unsigned int __ATTRS_o_ai
919vec_and(vector unsigned int __a, vector bool int __b) {
920  return __a & (vector unsigned int)__b;
921}
922
923static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
924                                                       vector bool int __b) {
925  return __a & __b;
926}
927
928static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
929                                                    vector float __b) {
930  vector unsigned int __res =
931      (vector unsigned int)__a & (vector unsigned int)__b;
932  return (vector float)__res;
933}
934
935static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
936                                                    vector float __b) {
937  vector unsigned int __res =
938      (vector unsigned int)__a & (vector unsigned int)__b;
939  return (vector float)__res;
940}
941
942static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
943                                                    vector bool int __b) {
944  vector unsigned int __res =
945      (vector unsigned int)__a & (vector unsigned int)__b;
946  return (vector float)__res;
947}
948
949#ifdef __VSX__
950static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
951                                                     vector double __b) {
952  vector unsigned long long __res =
953      (vector unsigned long long)__a & (vector unsigned long long)__b;
954  return (vector double)__res;
955}
956
957static __inline__ vector double __ATTRS_o_ai
958vec_and(vector double __a, vector bool long long __b) {
959  vector unsigned long long __res =
960      (vector unsigned long long)__a & (vector unsigned long long)__b;
961  return (vector double)__res;
962}
963
964static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
965                                                     vector double __b) {
966  vector unsigned long long __res =
967      (vector unsigned long long)__a & (vector unsigned long long)__b;
968  return (vector double)__res;
969}
970
971static __inline__ vector signed long long __ATTRS_o_ai
972vec_and(vector signed long long __a, vector signed long long __b) {
973  return __a & __b;
974}
975
976static __inline__ vector signed long long __ATTRS_o_ai
977vec_and(vector bool long long __a, vector signed long long __b) {
978  return (vector signed long long)__a & __b;
979}
980
981static __inline__ vector signed long long __ATTRS_o_ai
982vec_and(vector signed long long __a, vector bool long long __b) {
983  return __a & (vector signed long long)__b;
984}
985
986static __inline__ vector unsigned long long __ATTRS_o_ai
987vec_and(vector unsigned long long __a, vector unsigned long long __b) {
988  return __a & __b;
989}
990
991static __inline__ vector unsigned long long __ATTRS_o_ai
992vec_and(vector bool long long __a, vector unsigned long long __b) {
993  return (vector unsigned long long)__a & __b;
994}
995
996static __inline__ vector unsigned long long __ATTRS_o_ai
997vec_and(vector unsigned long long __a, vector bool long long __b) {
998  return __a & (vector unsigned long long)__b;
999}
1000
1001static __inline__ vector bool long long __ATTRS_o_ai
1002vec_and(vector bool long long __a, vector bool long long __b) {
1003  return __a & __b;
1004}
1005#endif
1006
1007/* vec_vand */
1008
1009static __inline__ vector signed char __ATTRS_o_ai
1010vec_vand(vector signed char __a, vector signed char __b) {
1011  return __a & __b;
1012}
1013
1014static __inline__ vector signed char __ATTRS_o_ai
1015vec_vand(vector bool char __a, vector signed char __b) {
1016  return (vector signed char)__a & __b;
1017}
1018
1019static __inline__ vector signed char __ATTRS_o_ai
1020vec_vand(vector signed char __a, vector bool char __b) {
1021  return __a & (vector signed char)__b;
1022}
1023
1024static __inline__ vector unsigned char __ATTRS_o_ai
1025vec_vand(vector unsigned char __a, vector unsigned char __b) {
1026  return __a & __b;
1027}
1028
1029static __inline__ vector unsigned char __ATTRS_o_ai
1030vec_vand(vector bool char __a, vector unsigned char __b) {
1031  return (vector unsigned char)__a & __b;
1032}
1033
1034static __inline__ vector unsigned char __ATTRS_o_ai
1035vec_vand(vector unsigned char __a, vector bool char __b) {
1036  return __a & (vector unsigned char)__b;
1037}
1038
1039static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1040                                                         vector bool char __b) {
1041  return __a & __b;
1042}
1043
1044static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1045                                                     vector short __b) {
1046  return __a & __b;
1047}
1048
1049static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1050                                                     vector short __b) {
1051  return (vector short)__a & __b;
1052}
1053
1054static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1055                                                     vector bool short __b) {
1056  return __a & (vector short)__b;
1057}
1058
1059static __inline__ vector unsigned short __ATTRS_o_ai
1060vec_vand(vector unsigned short __a, vector unsigned short __b) {
1061  return __a & __b;
1062}
1063
1064static __inline__ vector unsigned short __ATTRS_o_ai
1065vec_vand(vector bool short __a, vector unsigned short __b) {
1066  return (vector unsigned short)__a & __b;
1067}
1068
1069static __inline__ vector unsigned short __ATTRS_o_ai
1070vec_vand(vector unsigned short __a, vector bool short __b) {
1071  return __a & (vector unsigned short)__b;
1072}
1073
1074static __inline__ vector bool short __ATTRS_o_ai
1075vec_vand(vector bool short __a, vector bool short __b) {
1076  return __a & __b;
1077}
1078
1079static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1080                                                   vector int __b) {
1081  return __a & __b;
1082}
1083
1084static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1085                                                   vector int __b) {
1086  return (vector int)__a & __b;
1087}
1088
1089static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1090                                                   vector bool int __b) {
1091  return __a & (vector int)__b;
1092}
1093
1094static __inline__ vector unsigned int __ATTRS_o_ai
1095vec_vand(vector unsigned int __a, vector unsigned int __b) {
1096  return __a & __b;
1097}
1098
1099static __inline__ vector unsigned int __ATTRS_o_ai
1100vec_vand(vector bool int __a, vector unsigned int __b) {
1101  return (vector unsigned int)__a & __b;
1102}
1103
1104static __inline__ vector unsigned int __ATTRS_o_ai
1105vec_vand(vector unsigned int __a, vector bool int __b) {
1106  return __a & (vector unsigned int)__b;
1107}
1108
1109static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1110                                                        vector bool int __b) {
1111  return __a & __b;
1112}
1113
1114static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1115                                                     vector float __b) {
1116  vector unsigned int __res =
1117      (vector unsigned int)__a & (vector unsigned int)__b;
1118  return (vector float)__res;
1119}
1120
1121static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1122                                                     vector float __b) {
1123  vector unsigned int __res =
1124      (vector unsigned int)__a & (vector unsigned int)__b;
1125  return (vector float)__res;
1126}
1127
1128static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1129                                                     vector bool int __b) {
1130  vector unsigned int __res =
1131      (vector unsigned int)__a & (vector unsigned int)__b;
1132  return (vector float)__res;
1133}
1134
1135#ifdef __VSX__
1136static __inline__ vector signed long long __ATTRS_o_ai
1137vec_vand(vector signed long long __a, vector signed long long __b) {
1138  return __a & __b;
1139}
1140
1141static __inline__ vector signed long long __ATTRS_o_ai
1142vec_vand(vector bool long long __a, vector signed long long __b) {
1143  return (vector signed long long)__a & __b;
1144}
1145
1146static __inline__ vector signed long long __ATTRS_o_ai
1147vec_vand(vector signed long long __a, vector bool long long __b) {
1148  return __a & (vector signed long long)__b;
1149}
1150
1151static __inline__ vector unsigned long long __ATTRS_o_ai
1152vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1153  return __a & __b;
1154}
1155
1156static __inline__ vector unsigned long long __ATTRS_o_ai
1157vec_vand(vector bool long long __a, vector unsigned long long __b) {
1158  return (vector unsigned long long)__a & __b;
1159}
1160
1161static __inline__ vector unsigned long long __ATTRS_o_ai
1162vec_vand(vector unsigned long long __a, vector bool long long __b) {
1163  return __a & (vector unsigned long long)__b;
1164}
1165
1166static __inline__ vector bool long long __ATTRS_o_ai
1167vec_vand(vector bool long long __a, vector bool long long __b) {
1168  return __a & __b;
1169}
1170#endif
1171
1172/* vec_andc */
1173
1174#define __builtin_altivec_vandc vec_andc
1175
1176static __inline__ vector signed char __ATTRS_o_ai
1177vec_andc(vector signed char __a, vector signed char __b) {
1178  return __a & ~__b;
1179}
1180
1181static __inline__ vector signed char __ATTRS_o_ai
1182vec_andc(vector bool char __a, vector signed char __b) {
1183  return (vector signed char)__a & ~__b;
1184}
1185
1186static __inline__ vector signed char __ATTRS_o_ai
1187vec_andc(vector signed char __a, vector bool char __b) {
1188  return __a & ~(vector signed char)__b;
1189}
1190
1191static __inline__ vector unsigned char __ATTRS_o_ai
1192vec_andc(vector unsigned char __a, vector unsigned char __b) {
1193  return __a & ~__b;
1194}
1195
1196static __inline__ vector unsigned char __ATTRS_o_ai
1197vec_andc(vector bool char __a, vector unsigned char __b) {
1198  return (vector unsigned char)__a & ~__b;
1199}
1200
1201static __inline__ vector unsigned char __ATTRS_o_ai
1202vec_andc(vector unsigned char __a, vector bool char __b) {
1203  return __a & ~(vector unsigned char)__b;
1204}
1205
1206static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1207                                                         vector bool char __b) {
1208  return __a & ~__b;
1209}
1210
1211static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1212                                                     vector short __b) {
1213  return __a & ~__b;
1214}
1215
1216static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1217                                                     vector short __b) {
1218  return (vector short)__a & ~__b;
1219}
1220
1221static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1222                                                     vector bool short __b) {
1223  return __a & ~(vector short)__b;
1224}
1225
1226static __inline__ vector unsigned short __ATTRS_o_ai
1227vec_andc(vector unsigned short __a, vector unsigned short __b) {
1228  return __a & ~__b;
1229}
1230
1231static __inline__ vector unsigned short __ATTRS_o_ai
1232vec_andc(vector bool short __a, vector unsigned short __b) {
1233  return (vector unsigned short)__a & ~__b;
1234}
1235
1236static __inline__ vector unsigned short __ATTRS_o_ai
1237vec_andc(vector unsigned short __a, vector bool short __b) {
1238  return __a & ~(vector unsigned short)__b;
1239}
1240
1241static __inline__ vector bool short __ATTRS_o_ai
1242vec_andc(vector bool short __a, vector bool short __b) {
1243  return __a & ~__b;
1244}
1245
1246static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1247                                                   vector int __b) {
1248  return __a & ~__b;
1249}
1250
1251static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1252                                                   vector int __b) {
1253  return (vector int)__a & ~__b;
1254}
1255
1256static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1257                                                   vector bool int __b) {
1258  return __a & ~(vector int)__b;
1259}
1260
1261static __inline__ vector unsigned int __ATTRS_o_ai
1262vec_andc(vector unsigned int __a, vector unsigned int __b) {
1263  return __a & ~__b;
1264}
1265
1266static __inline__ vector unsigned int __ATTRS_o_ai
1267vec_andc(vector bool int __a, vector unsigned int __b) {
1268  return (vector unsigned int)__a & ~__b;
1269}
1270
1271static __inline__ vector unsigned int __ATTRS_o_ai
1272vec_andc(vector unsigned int __a, vector bool int __b) {
1273  return __a & ~(vector unsigned int)__b;
1274}
1275
1276static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1277                                                        vector bool int __b) {
1278  return __a & ~__b;
1279}
1280
1281static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1282                                                     vector float __b) {
1283  vector unsigned int __res =
1284      (vector unsigned int)__a & ~(vector unsigned int)__b;
1285  return (vector float)__res;
1286}
1287
1288static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1289                                                     vector float __b) {
1290  vector unsigned int __res =
1291      (vector unsigned int)__a & ~(vector unsigned int)__b;
1292  return (vector float)__res;
1293}
1294
1295static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1296                                                     vector bool int __b) {
1297  vector unsigned int __res =
1298      (vector unsigned int)__a & ~(vector unsigned int)__b;
1299  return (vector float)__res;
1300}
1301
1302#ifdef __VSX__
1303static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1304                                                      vector double __b) {
1305  vector unsigned long long __res =
1306      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1307  return (vector double)__res;
1308}
1309
1310static __inline__ vector double __ATTRS_o_ai
1311vec_andc(vector double __a, vector bool long long __b) {
1312  vector unsigned long long __res =
1313      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1314  return (vector double)__res;
1315}
1316
1317static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1318                                                      vector double __b) {
1319  vector unsigned long long __res =
1320      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1321  return (vector double)__res;
1322}
1323
1324static __inline__ vector signed long long __ATTRS_o_ai
1325vec_andc(vector signed long long __a, vector signed long long __b) {
1326  return __a & ~__b;
1327}
1328
1329static __inline__ vector signed long long __ATTRS_o_ai
1330vec_andc(vector bool long long __a, vector signed long long __b) {
1331  return (vector signed long long)__a & ~__b;
1332}
1333
1334static __inline__ vector signed long long __ATTRS_o_ai
1335vec_andc(vector signed long long __a, vector bool long long __b) {
1336  return __a & ~(vector signed long long)__b;
1337}
1338
1339static __inline__ vector unsigned long long __ATTRS_o_ai
1340vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1341  return __a & ~__b;
1342}
1343
1344static __inline__ vector unsigned long long __ATTRS_o_ai
1345vec_andc(vector bool long long __a, vector unsigned long long __b) {
1346  return (vector unsigned long long)__a & ~__b;
1347}
1348
1349static __inline__ vector unsigned long long __ATTRS_o_ai
1350vec_andc(vector unsigned long long __a, vector bool long long __b) {
1351  return __a & ~(vector unsigned long long)__b;
1352}
1353
1354static __inline__ vector bool long long __ATTRS_o_ai
1355vec_andc(vector bool long long __a, vector bool long long __b) {
1356  return __a & ~__b;
1357}
1358#endif
1359
1360/* vec_vandc */
1361
1362static __inline__ vector signed char __ATTRS_o_ai
1363vec_vandc(vector signed char __a, vector signed char __b) {
1364  return __a & ~__b;
1365}
1366
1367static __inline__ vector signed char __ATTRS_o_ai
1368vec_vandc(vector bool char __a, vector signed char __b) {
1369  return (vector signed char)__a & ~__b;
1370}
1371
1372static __inline__ vector signed char __ATTRS_o_ai
1373vec_vandc(vector signed char __a, vector bool char __b) {
1374  return __a & ~(vector signed char)__b;
1375}
1376
1377static __inline__ vector unsigned char __ATTRS_o_ai
1378vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1379  return __a & ~__b;
1380}
1381
1382static __inline__ vector unsigned char __ATTRS_o_ai
1383vec_vandc(vector bool char __a, vector unsigned char __b) {
1384  return (vector unsigned char)__a & ~__b;
1385}
1386
1387static __inline__ vector unsigned char __ATTRS_o_ai
1388vec_vandc(vector unsigned char __a, vector bool char __b) {
1389  return __a & ~(vector unsigned char)__b;
1390}
1391
1392static __inline__ vector bool char __ATTRS_o_ai
1393vec_vandc(vector bool char __a, vector bool char __b) {
1394  return __a & ~__b;
1395}
1396
1397static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1398                                                      vector short __b) {
1399  return __a & ~__b;
1400}
1401
1402static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1403                                                      vector short __b) {
1404  return (vector short)__a & ~__b;
1405}
1406
1407static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1408                                                      vector bool short __b) {
1409  return __a & ~(vector short)__b;
1410}
1411
1412static __inline__ vector unsigned short __ATTRS_o_ai
1413vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1414  return __a & ~__b;
1415}
1416
1417static __inline__ vector unsigned short __ATTRS_o_ai
1418vec_vandc(vector bool short __a, vector unsigned short __b) {
1419  return (vector unsigned short)__a & ~__b;
1420}
1421
1422static __inline__ vector unsigned short __ATTRS_o_ai
1423vec_vandc(vector unsigned short __a, vector bool short __b) {
1424  return __a & ~(vector unsigned short)__b;
1425}
1426
1427static __inline__ vector bool short __ATTRS_o_ai
1428vec_vandc(vector bool short __a, vector bool short __b) {
1429  return __a & ~__b;
1430}
1431
1432static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1433                                                    vector int __b) {
1434  return __a & ~__b;
1435}
1436
1437static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1438                                                    vector int __b) {
1439  return (vector int)__a & ~__b;
1440}
1441
1442static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1443                                                    vector bool int __b) {
1444  return __a & ~(vector int)__b;
1445}
1446
1447static __inline__ vector unsigned int __ATTRS_o_ai
1448vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1449  return __a & ~__b;
1450}
1451
1452static __inline__ vector unsigned int __ATTRS_o_ai
1453vec_vandc(vector bool int __a, vector unsigned int __b) {
1454  return (vector unsigned int)__a & ~__b;
1455}
1456
1457static __inline__ vector unsigned int __ATTRS_o_ai
1458vec_vandc(vector unsigned int __a, vector bool int __b) {
1459  return __a & ~(vector unsigned int)__b;
1460}
1461
1462static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1463                                                         vector bool int __b) {
1464  return __a & ~__b;
1465}
1466
1467static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1468                                                      vector float __b) {
1469  vector unsigned int __res =
1470      (vector unsigned int)__a & ~(vector unsigned int)__b;
1471  return (vector float)__res;
1472}
1473
1474static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1475                                                      vector float __b) {
1476  vector unsigned int __res =
1477      (vector unsigned int)__a & ~(vector unsigned int)__b;
1478  return (vector float)__res;
1479}
1480
1481static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1482                                                      vector bool int __b) {
1483  vector unsigned int __res =
1484      (vector unsigned int)__a & ~(vector unsigned int)__b;
1485  return (vector float)__res;
1486}
1487
1488#ifdef __VSX__
1489static __inline__ vector signed long long __ATTRS_o_ai
1490vec_vandc(vector signed long long __a, vector signed long long __b) {
1491  return __a & ~__b;
1492}
1493
1494static __inline__ vector signed long long __ATTRS_o_ai
1495vec_vandc(vector bool long long __a, vector signed long long __b) {
1496  return (vector signed long long)__a & ~__b;
1497}
1498
1499static __inline__ vector signed long long __ATTRS_o_ai
1500vec_vandc(vector signed long long __a, vector bool long long __b) {
1501  return __a & ~(vector signed long long)__b;
1502}
1503
1504static __inline__ vector unsigned long long __ATTRS_o_ai
1505vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1506  return __a & ~__b;
1507}
1508
1509static __inline__ vector unsigned long long __ATTRS_o_ai
1510vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1511  return (vector unsigned long long)__a & ~__b;
1512}
1513
1514static __inline__ vector unsigned long long __ATTRS_o_ai
1515vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1516  return __a & ~(vector unsigned long long)__b;
1517}
1518
1519static __inline__ vector bool long long __ATTRS_o_ai
1520vec_vandc(vector bool long long __a, vector bool long long __b) {
1521  return __a & ~__b;
1522}
1523#endif
1524
1525/* vec_avg */
1526
1527static __inline__ vector signed char __ATTRS_o_ai
1528vec_avg(vector signed char __a, vector signed char __b) {
1529  return __builtin_altivec_vavgsb(__a, __b);
1530}
1531
1532static __inline__ vector unsigned char __ATTRS_o_ai
1533vec_avg(vector unsigned char __a, vector unsigned char __b) {
1534  return __builtin_altivec_vavgub(__a, __b);
1535}
1536
1537static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1538                                                    vector short __b) {
1539  return __builtin_altivec_vavgsh(__a, __b);
1540}
1541
1542static __inline__ vector unsigned short __ATTRS_o_ai
1543vec_avg(vector unsigned short __a, vector unsigned short __b) {
1544  return __builtin_altivec_vavguh(__a, __b);
1545}
1546
1547static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1548                                                  vector int __b) {
1549  return __builtin_altivec_vavgsw(__a, __b);
1550}
1551
1552static __inline__ vector unsigned int __ATTRS_o_ai
1553vec_avg(vector unsigned int __a, vector unsigned int __b) {
1554  return __builtin_altivec_vavguw(__a, __b);
1555}
1556
1557/* vec_vavgsb */
1558
1559static __inline__ vector signed char __attribute__((__always_inline__))
1560vec_vavgsb(vector signed char __a, vector signed char __b) {
1561  return __builtin_altivec_vavgsb(__a, __b);
1562}
1563
1564/* vec_vavgub */
1565
1566static __inline__ vector unsigned char __attribute__((__always_inline__))
1567vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1568  return __builtin_altivec_vavgub(__a, __b);
1569}
1570
1571/* vec_vavgsh */
1572
1573static __inline__ vector short __attribute__((__always_inline__))
1574vec_vavgsh(vector short __a, vector short __b) {
1575  return __builtin_altivec_vavgsh(__a, __b);
1576}
1577
1578/* vec_vavguh */
1579
1580static __inline__ vector unsigned short __attribute__((__always_inline__))
1581vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1582  return __builtin_altivec_vavguh(__a, __b);
1583}
1584
1585/* vec_vavgsw */
1586
1587static __inline__ vector int __attribute__((__always_inline__))
1588vec_vavgsw(vector int __a, vector int __b) {
1589  return __builtin_altivec_vavgsw(__a, __b);
1590}
1591
1592/* vec_vavguw */
1593
1594static __inline__ vector unsigned int __attribute__((__always_inline__))
1595vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1596  return __builtin_altivec_vavguw(__a, __b);
1597}
1598
1599/* vec_ceil */
1600
1601static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1602#ifdef __VSX__
1603  return __builtin_vsx_xvrspip(__a);
1604#else
1605  return __builtin_altivec_vrfip(__a);
1606#endif
1607}
1608
1609#ifdef __VSX__
1610static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1611  return __builtin_vsx_xvrdpip(__a);
1612}
1613#endif
1614
1615/* vec_vrfip */
1616
1617static __inline__ vector float __attribute__((__always_inline__))
1618vec_vrfip(vector float __a) {
1619  return __builtin_altivec_vrfip(__a);
1620}
1621
1622/* vec_cmpb */
1623
1624static __inline__ vector int __attribute__((__always_inline__))
1625vec_cmpb(vector float __a, vector float __b) {
1626  return __builtin_altivec_vcmpbfp(__a, __b);
1627}
1628
1629/* vec_vcmpbfp */
1630
1631static __inline__ vector int __attribute__((__always_inline__))
1632vec_vcmpbfp(vector float __a, vector float __b) {
1633  return __builtin_altivec_vcmpbfp(__a, __b);
1634}
1635
1636/* vec_cmpeq */
1637
1638static __inline__ vector bool char __ATTRS_o_ai
1639vec_cmpeq(vector signed char __a, vector signed char __b) {
1640  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1641                                                      (vector char)__b);
1642}
1643
1644static __inline__ vector bool char __ATTRS_o_ai
1645vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1646  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1647                                                      (vector char)__b);
1648}
1649
1650static __inline__ vector bool char __ATTRS_o_ai
1651vec_cmpeq(vector bool char __a, vector bool char __b) {
1652  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1653                                                      (vector char)__b);
1654}
1655
1656static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1657                                                           vector short __b) {
1658  return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1659}
1660
1661static __inline__ vector bool short __ATTRS_o_ai
1662vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1663  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1664                                                       (vector short)__b);
1665}
1666
1667static __inline__ vector bool short __ATTRS_o_ai
1668vec_cmpeq(vector bool short __a, vector bool short __b) {
1669  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1670                                                       (vector short)__b);
1671}
1672
1673static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1674                                                         vector int __b) {
1675  return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1676}
1677
1678static __inline__ vector bool int __ATTRS_o_ai
1679vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1680  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1681                                                     (vector int)__b);
1682}
1683
1684static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1685                                                         vector bool int __b) {
1686  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1687                                                     (vector int)__b);
1688}
1689
1690#ifdef __POWER8_VECTOR__
1691static __inline__ vector bool long long __ATTRS_o_ai
1692vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1693  return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1694}
1695
1696static __inline__ vector bool long long __ATTRS_o_ai
1697vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1698  return (vector bool long long)__builtin_altivec_vcmpequd(
1699      (vector long long)__a, (vector long long)__b);
1700}
1701
1702static __inline__ vector bool long long __ATTRS_o_ai
1703vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1704  return (vector bool long long)__builtin_altivec_vcmpequd(
1705      (vector long long)__a, (vector long long)__b);
1706}
1707
1708#endif
1709
1710static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1711                                                         vector float __b) {
1712#ifdef __VSX__
1713  return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1714#else
1715  return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1716#endif
1717}
1718
1719#ifdef __VSX__
1720static __inline__ vector bool long long __ATTRS_o_ai
1721vec_cmpeq(vector double __a, vector double __b) {
1722  return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1723}
1724#endif
1725
1726#ifdef __POWER9_VECTOR__
1727/* vec_cmpne */
1728
1729static __inline__ vector bool char __ATTRS_o_ai
1730vec_cmpne(vector bool char __a, vector bool char __b) {
1731  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1732                                                     (vector char)__b);
1733}
1734
1735static __inline__ vector bool char __ATTRS_o_ai
1736vec_cmpne(vector signed char __a, vector signed char __b) {
1737  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1738                                                     (vector char)__b);
1739}
1740
1741static __inline__ vector bool char __ATTRS_o_ai
1742vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1743  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1744                                                     (vector char)__b);
1745}
1746
1747static __inline__ vector bool short __ATTRS_o_ai
1748vec_cmpne(vector bool short __a, vector bool short __b) {
1749  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1750                                                      (vector short)__b);
1751}
1752
1753static __inline__ vector bool short __ATTRS_o_ai
1754vec_cmpne(vector signed short __a, vector signed short __b) {
1755  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1756                                                      (vector short)__b);
1757}
1758
1759static __inline__ vector bool short __ATTRS_o_ai
1760vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1761  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1762                                                      (vector short)__b);
1763}
1764
1765static __inline__ vector bool int __ATTRS_o_ai
1766vec_cmpne(vector bool int __a, vector bool int __b) {
1767  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1768                                                    (vector int)__b);
1769}
1770
1771static __inline__ vector bool int __ATTRS_o_ai
1772vec_cmpne(vector signed int __a, vector signed int __b) {
1773  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1774                                                    (vector int)__b);
1775}
1776
1777static __inline__ vector bool int __ATTRS_o_ai
1778vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1779  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1780                                                    (vector int)__b);
1781}
1782
1783static __inline__ vector bool long long __ATTRS_o_ai
1784vec_cmpne(vector bool long long __a, vector bool long long __b) {
1785  return (vector bool long long)
1786    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1787}
1788
1789static __inline__ vector bool long long __ATTRS_o_ai
1790vec_cmpne(vector signed long long __a, vector signed long long __b) {
1791  return (vector bool long long)
1792    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1793}
1794
1795static __inline__ vector bool long long __ATTRS_o_ai
1796vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
1797  return (vector bool long long)
1798    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1799}
1800
1801static __inline__ vector bool int __ATTRS_o_ai
1802vec_cmpne(vector float __a, vector float __b) {
1803  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1804                                                    (vector int)__b);
1805}
1806
1807static __inline__ vector bool long long __ATTRS_o_ai
1808vec_cmpne(vector double __a, vector double __b) {
1809  return (vector bool long long)
1810    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1811}
1812
1813/* vec_cmpnez */
1814
1815static __inline__ vector bool char __ATTRS_o_ai
1816vec_cmpnez(vector signed char __a, vector signed char __b) {
1817  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1818                                                      (vector char)__b);
1819}
1820
1821static __inline__ vector bool char __ATTRS_o_ai
1822vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1823  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1824                                                      (vector char)__b);
1825}
1826
1827static __inline__ vector bool short __ATTRS_o_ai
1828vec_cmpnez(vector signed short __a, vector signed short __b) {
1829  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1830                                                       (vector short)__b);
1831}
1832
1833static __inline__ vector bool short __ATTRS_o_ai
1834vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1835  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1836                                                       (vector short)__b);
1837}
1838
1839static __inline__ vector bool int __ATTRS_o_ai
1840vec_cmpnez(vector signed int __a, vector signed int __b) {
1841  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1842                                                     (vector int)__b);
1843}
1844
1845static __inline__ vector bool int __ATTRS_o_ai
1846vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1847  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1848                                                     (vector int)__b);
1849}
1850
1851static __inline__ signed int __ATTRS_o_ai
1852vec_cntlz_lsbb(vector signed char __a) {
1853#ifdef __LITTLE_ENDIAN__
1854  return __builtin_altivec_vctzlsbb(__a);
1855#else
1856  return __builtin_altivec_vclzlsbb(__a);
1857#endif
1858}
1859
1860static __inline__ signed int __ATTRS_o_ai
1861vec_cntlz_lsbb(vector unsigned char __a) {
1862#ifdef __LITTLE_ENDIAN__
1863  return __builtin_altivec_vctzlsbb(__a);
1864#else
1865  return __builtin_altivec_vclzlsbb(__a);
1866#endif
1867}
1868
1869static __inline__ signed int __ATTRS_o_ai
1870vec_cnttz_lsbb(vector signed char __a) {
1871#ifdef __LITTLE_ENDIAN__
1872  return __builtin_altivec_vclzlsbb(__a);
1873#else
1874  return __builtin_altivec_vctzlsbb(__a);
1875#endif
1876}
1877
1878static __inline__ signed int __ATTRS_o_ai
1879vec_cnttz_lsbb(vector unsigned char __a) {
1880#ifdef __LITTLE_ENDIAN__
1881  return __builtin_altivec_vclzlsbb(__a);
1882#else
1883  return __builtin_altivec_vctzlsbb(__a);
1884#endif
1885}
1886
1887static __inline__ vector unsigned int __ATTRS_o_ai
1888vec_parity_lsbb(vector unsigned int __a) {
1889  return __builtin_altivec_vprtybw(__a);
1890}
1891
1892static __inline__ vector unsigned int __ATTRS_o_ai
1893vec_parity_lsbb(vector signed int __a) {
1894  return __builtin_altivec_vprtybw(__a);
1895}
1896
1897static __inline__ vector unsigned __int128 __ATTRS_o_ai
1898vec_parity_lsbb(vector unsigned __int128 __a) {
1899  return __builtin_altivec_vprtybq(__a);
1900}
1901
1902static __inline__ vector unsigned __int128 __ATTRS_o_ai
1903vec_parity_lsbb(vector signed __int128 __a) {
1904  return __builtin_altivec_vprtybq(__a);
1905}
1906
1907static __inline__ vector unsigned long long __ATTRS_o_ai
1908vec_parity_lsbb(vector unsigned long long __a) {
1909  return __builtin_altivec_vprtybd(__a);
1910}
1911
1912static __inline__ vector unsigned long long __ATTRS_o_ai
1913vec_parity_lsbb(vector signed long long __a) {
1914  return __builtin_altivec_vprtybd(__a);
1915}
1916
1917#endif
1918
1919/* vec_cmpgt */
1920
1921static __inline__ vector bool char __ATTRS_o_ai
1922vec_cmpgt(vector signed char __a, vector signed char __b) {
1923  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1924}
1925
1926static __inline__ vector bool char __ATTRS_o_ai
1927vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1928  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1929}
1930
1931static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1932                                                           vector short __b) {
1933  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1934}
1935
1936static __inline__ vector bool short __ATTRS_o_ai
1937vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1938  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1939}
1940
1941static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1942                                                         vector int __b) {
1943  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1944}
1945
1946static __inline__ vector bool int __ATTRS_o_ai
1947vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1948  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1949}
1950
1951#ifdef __POWER8_VECTOR__
1952static __inline__ vector bool long long __ATTRS_o_ai
1953vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1954  return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1955}
1956
1957static __inline__ vector bool long long __ATTRS_o_ai
1958vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1959  return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1960}
1961#endif
1962
1963static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1964                                                         vector float __b) {
1965#ifdef __VSX__
1966  return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1967#else
1968  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1969#endif
1970}
1971
1972#ifdef __VSX__
1973static __inline__ vector bool long long __ATTRS_o_ai
1974vec_cmpgt(vector double __a, vector double __b) {
1975  return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1976}
1977#endif
1978
1979/* vec_cmpge */
1980
1981static __inline__ vector bool char __ATTRS_o_ai
1982vec_cmpge(vector signed char __a, vector signed char __b) {
1983  return ~(vec_cmpgt(__b, __a));
1984}
1985
1986static __inline__ vector bool char __ATTRS_o_ai
1987vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1988  return ~(vec_cmpgt(__b, __a));
1989}
1990
1991static __inline__ vector bool short __ATTRS_o_ai
1992vec_cmpge(vector signed short __a, vector signed short __b) {
1993  return ~(vec_cmpgt(__b, __a));
1994}
1995
1996static __inline__ vector bool short __ATTRS_o_ai
1997vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1998  return ~(vec_cmpgt(__b, __a));
1999}
2000
2001static __inline__ vector bool int __ATTRS_o_ai
2002vec_cmpge(vector signed int __a, vector signed int __b) {
2003  return ~(vec_cmpgt(__b, __a));
2004}
2005
2006static __inline__ vector bool int __ATTRS_o_ai
2007vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2008  return ~(vec_cmpgt(__b, __a));
2009}
2010
2011static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
2012                                                         vector float __b) {
2013#ifdef __VSX__
2014  return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2015#else
2016  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2017#endif
2018}
2019
2020#ifdef __VSX__
2021static __inline__ vector bool long long __ATTRS_o_ai
2022vec_cmpge(vector double __a, vector double __b) {
2023  return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2024}
2025#endif
2026
2027#ifdef __POWER8_VECTOR__
2028static __inline__ vector bool long long __ATTRS_o_ai
2029vec_cmpge(vector signed long long __a, vector signed long long __b) {
2030  return ~(vec_cmpgt(__b, __a));
2031}
2032
2033static __inline__ vector bool long long __ATTRS_o_ai
2034vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2035  return ~(vec_cmpgt(__b, __a));
2036}
2037#endif
2038
2039/* vec_vcmpgefp */
2040
2041static __inline__ vector bool int __attribute__((__always_inline__))
2042vec_vcmpgefp(vector float __a, vector float __b) {
2043  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2044}
2045
2046/* vec_vcmpgtsb */
2047
2048static __inline__ vector bool char __attribute__((__always_inline__))
2049vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2050  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2051}
2052
2053/* vec_vcmpgtub */
2054
2055static __inline__ vector bool char __attribute__((__always_inline__))
2056vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2057  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2058}
2059
2060/* vec_vcmpgtsh */
2061
2062static __inline__ vector bool short __attribute__((__always_inline__))
2063vec_vcmpgtsh(vector short __a, vector short __b) {
2064  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2065}
2066
2067/* vec_vcmpgtuh */
2068
2069static __inline__ vector bool short __attribute__((__always_inline__))
2070vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2071  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2072}
2073
2074/* vec_vcmpgtsw */
2075
2076static __inline__ vector bool int __attribute__((__always_inline__))
2077vec_vcmpgtsw(vector int __a, vector int __b) {
2078  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2079}
2080
2081/* vec_vcmpgtuw */
2082
2083static __inline__ vector bool int __attribute__((__always_inline__))
2084vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2085  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2086}
2087
2088/* vec_vcmpgtfp */
2089
2090static __inline__ vector bool int __attribute__((__always_inline__))
2091vec_vcmpgtfp(vector float __a, vector float __b) {
2092  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2093}
2094
2095/* vec_cmple */
2096
2097static __inline__ vector bool char __ATTRS_o_ai
2098vec_cmple(vector signed char __a, vector signed char __b) {
2099  return vec_cmpge(__b, __a);
2100}
2101
2102static __inline__ vector bool char __ATTRS_o_ai
2103vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2104  return vec_cmpge(__b, __a);
2105}
2106
2107static __inline__ vector bool short __ATTRS_o_ai
2108vec_cmple(vector signed short __a, vector signed short __b) {
2109  return vec_cmpge(__b, __a);
2110}
2111
2112static __inline__ vector bool short __ATTRS_o_ai
2113vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2114  return vec_cmpge(__b, __a);
2115}
2116
2117static __inline__ vector bool int __ATTRS_o_ai
2118vec_cmple(vector signed int __a, vector signed int __b) {
2119  return vec_cmpge(__b, __a);
2120}
2121
2122static __inline__ vector bool int __ATTRS_o_ai
2123vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2124  return vec_cmpge(__b, __a);
2125}
2126
2127static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2128                                                         vector float __b) {
2129  return vec_cmpge(__b, __a);
2130}
2131
2132#ifdef __VSX__
2133static __inline__ vector bool long long __ATTRS_o_ai
2134vec_cmple(vector double __a, vector double __b) {
2135  return vec_cmpge(__b, __a);
2136}
2137#endif
2138
2139#ifdef __POWER8_VECTOR__
2140static __inline__ vector bool long long __ATTRS_o_ai
2141vec_cmple(vector signed long long __a, vector signed long long __b) {
2142  return vec_cmpge(__b, __a);
2143}
2144
2145static __inline__ vector bool long long __ATTRS_o_ai
2146vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2147  return vec_cmpge(__b, __a);
2148}
2149#endif
2150
2151/* vec_cmplt */
2152
2153static __inline__ vector bool char __ATTRS_o_ai
2154vec_cmplt(vector signed char __a, vector signed char __b) {
2155  return vec_cmpgt(__b, __a);
2156}
2157
2158static __inline__ vector bool char __ATTRS_o_ai
2159vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2160  return vec_cmpgt(__b, __a);
2161}
2162
2163static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2164                                                           vector short __b) {
2165  return vec_cmpgt(__b, __a);
2166}
2167
2168static __inline__ vector bool short __ATTRS_o_ai
2169vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2170  return vec_cmpgt(__b, __a);
2171}
2172
2173static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2174                                                         vector int __b) {
2175  return vec_cmpgt(__b, __a);
2176}
2177
2178static __inline__ vector bool int __ATTRS_o_ai
2179vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2180  return vec_cmpgt(__b, __a);
2181}
2182
2183static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2184                                                         vector float __b) {
2185  return vec_cmpgt(__b, __a);
2186}
2187
2188#ifdef __VSX__
2189static __inline__ vector bool long long __ATTRS_o_ai
2190vec_cmplt(vector double __a, vector double __b) {
2191  return vec_cmpgt(__b, __a);
2192}
2193#endif
2194
2195#ifdef __POWER8_VECTOR__
2196static __inline__ vector bool long long __ATTRS_o_ai
2197vec_cmplt(vector signed long long __a, vector signed long long __b) {
2198  return vec_cmpgt(__b, __a);
2199}
2200
2201static __inline__ vector bool long long __ATTRS_o_ai
2202vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2203  return vec_cmpgt(__b, __a);
2204}
2205
2206/* vec_popcnt */
2207
2208static __inline__ vector signed char __ATTRS_o_ai
2209vec_popcnt(vector signed char __a) {
2210  return __builtin_altivec_vpopcntb(__a);
2211}
2212static __inline__ vector unsigned char __ATTRS_o_ai
2213vec_popcnt(vector unsigned char __a) {
2214  return __builtin_altivec_vpopcntb(__a);
2215}
2216static __inline__ vector signed short __ATTRS_o_ai
2217vec_popcnt(vector signed short __a) {
2218  return __builtin_altivec_vpopcnth(__a);
2219}
2220static __inline__ vector unsigned short __ATTRS_o_ai
2221vec_popcnt(vector unsigned short __a) {
2222  return __builtin_altivec_vpopcnth(__a);
2223}
2224static __inline__ vector signed int __ATTRS_o_ai
2225vec_popcnt(vector signed int __a) {
2226  return __builtin_altivec_vpopcntw(__a);
2227}
2228static __inline__ vector unsigned int __ATTRS_o_ai
2229vec_popcnt(vector unsigned int __a) {
2230  return __builtin_altivec_vpopcntw(__a);
2231}
2232static __inline__ vector signed long long __ATTRS_o_ai
2233vec_popcnt(vector signed long long __a) {
2234  return __builtin_altivec_vpopcntd(__a);
2235}
2236static __inline__ vector unsigned long long __ATTRS_o_ai
2237vec_popcnt(vector unsigned long long __a) {
2238  return __builtin_altivec_vpopcntd(__a);
2239}
2240
2241/* vec_cntlz */
2242
2243static __inline__ vector signed char __ATTRS_o_ai
2244vec_cntlz(vector signed char __a) {
2245  return __builtin_altivec_vclzb(__a);
2246}
2247static __inline__ vector unsigned char __ATTRS_o_ai
2248vec_cntlz(vector unsigned char __a) {
2249  return __builtin_altivec_vclzb(__a);
2250}
2251static __inline__ vector signed short __ATTRS_o_ai
2252vec_cntlz(vector signed short __a) {
2253  return __builtin_altivec_vclzh(__a);
2254}
2255static __inline__ vector unsigned short __ATTRS_o_ai
2256vec_cntlz(vector unsigned short __a) {
2257  return __builtin_altivec_vclzh(__a);
2258}
2259static __inline__ vector signed int __ATTRS_o_ai
2260vec_cntlz(vector signed int __a) {
2261  return __builtin_altivec_vclzw(__a);
2262}
2263static __inline__ vector unsigned int __ATTRS_o_ai
2264vec_cntlz(vector unsigned int __a) {
2265  return __builtin_altivec_vclzw(__a);
2266}
2267static __inline__ vector signed long long __ATTRS_o_ai
2268vec_cntlz(vector signed long long __a) {
2269  return __builtin_altivec_vclzd(__a);
2270}
2271static __inline__ vector unsigned long long __ATTRS_o_ai
2272vec_cntlz(vector unsigned long long __a) {
2273  return __builtin_altivec_vclzd(__a);
2274}
2275#endif
2276
2277#ifdef __POWER9_VECTOR__
2278
2279/* vec_cnttz */
2280
2281static __inline__ vector signed char __ATTRS_o_ai
2282vec_cnttz(vector signed char __a) {
2283  return __builtin_altivec_vctzb(__a);
2284}
2285static __inline__ vector unsigned char __ATTRS_o_ai
2286vec_cnttz(vector unsigned char __a) {
2287  return __builtin_altivec_vctzb(__a);
2288}
2289static __inline__ vector signed short __ATTRS_o_ai
2290vec_cnttz(vector signed short __a) {
2291  return __builtin_altivec_vctzh(__a);
2292}
2293static __inline__ vector unsigned short __ATTRS_o_ai
2294vec_cnttz(vector unsigned short __a) {
2295  return __builtin_altivec_vctzh(__a);
2296}
2297static __inline__ vector signed int __ATTRS_o_ai
2298vec_cnttz(vector signed int __a) {
2299  return __builtin_altivec_vctzw(__a);
2300}
2301static __inline__ vector unsigned int __ATTRS_o_ai
2302vec_cnttz(vector unsigned int __a) {
2303  return __builtin_altivec_vctzw(__a);
2304}
2305static __inline__ vector signed long long __ATTRS_o_ai
2306vec_cnttz(vector signed long long __a) {
2307  return __builtin_altivec_vctzd(__a);
2308}
2309static __inline__ vector unsigned long long __ATTRS_o_ai
2310vec_cnttz(vector unsigned long long __a) {
2311  return __builtin_altivec_vctzd(__a);
2312}
2313
2314/* vec_first_match_index */
2315
2316static __inline__ unsigned __ATTRS_o_ai
2317vec_first_match_index(vector signed char __a, vector signed char __b) {
2318  vector unsigned long long __res =
2319#ifdef __LITTLE_ENDIAN__
2320    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2321#else
2322    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2323#endif
2324  if (__res[0] == 64) {
2325    return (__res[1] + 64) >> 3;
2326  }
2327  return __res[0] >> 3;
2328}
2329
2330static __inline__ unsigned __ATTRS_o_ai
2331vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2332  vector unsigned long long __res =
2333#ifdef __LITTLE_ENDIAN__
2334    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2335#else
2336    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2337#endif
2338  if (__res[0] == 64) {
2339    return (__res[1] + 64) >> 3;
2340  }
2341  return __res[0] >> 3;
2342}
2343
2344static __inline__ unsigned __ATTRS_o_ai
2345vec_first_match_index(vector signed short __a, vector signed short __b) {
2346  vector unsigned long long __res =
2347#ifdef __LITTLE_ENDIAN__
2348    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2349#else
2350    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2351#endif
2352  if (__res[0] == 64) {
2353    return (__res[1] + 64) >> 4;
2354  }
2355  return __res[0] >> 4;
2356}
2357
2358static __inline__ unsigned __ATTRS_o_ai
2359vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2360  vector unsigned long long __res =
2361#ifdef __LITTLE_ENDIAN__
2362    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2363#else
2364    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2365#endif
2366  if (__res[0] == 64) {
2367    return (__res[1] + 64) >> 4;
2368  }
2369  return __res[0] >> 4;
2370}
2371
2372static __inline__ unsigned __ATTRS_o_ai
2373vec_first_match_index(vector signed int __a, vector signed int __b) {
2374  vector unsigned long long __res =
2375#ifdef __LITTLE_ENDIAN__
2376    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2377#else
2378    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2379#endif
2380  if (__res[0] == 64) {
2381    return (__res[1] + 64) >> 5;
2382  }
2383  return __res[0] >> 5;
2384}
2385
2386static __inline__ unsigned __ATTRS_o_ai
2387vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2388  vector unsigned long long __res =
2389#ifdef __LITTLE_ENDIAN__
2390    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2391#else
2392    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2393#endif
2394  if (__res[0] == 64) {
2395    return (__res[1] + 64) >> 5;
2396  }
2397  return __res[0] >> 5;
2398}
2399
2400/* vec_first_match_or_eos_index */
2401
2402static __inline__ unsigned __ATTRS_o_ai
2403vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2404  /* Compare the result of the comparison of two vectors with either and OR the
2405     result. Either the elements are equal or one will equal the comparison
2406     result if either is zero.
2407  */
2408  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2409  vector bool char __tmp2 = __tmp1 |
2410                            vec_cmpeq((vector signed char)__tmp1, __a) |
2411                            vec_cmpeq((vector signed char)__tmp1, __b);
2412
2413  vector unsigned long long __res =
2414#ifdef __LITTLE_ENDIAN__
2415      vec_cnttz((vector unsigned long long)__tmp2);
2416#else
2417      vec_cntlz((vector unsigned long long)__tmp2);
2418#endif
2419  if (__res[0] == 64) {
2420    return (__res[1] + 64) >> 3;
2421  }
2422  return __res[0] >> 3;
2423}
2424
2425static __inline__ unsigned __ATTRS_o_ai
2426vec_first_match_or_eos_index(vector unsigned char __a,
2427                             vector unsigned char __b) {
2428  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2429  vector bool char __tmp2 = __tmp1 |
2430                            vec_cmpeq((vector unsigned char)__tmp1, __a) |
2431                            vec_cmpeq((vector unsigned char)__tmp1, __b);
2432
2433  vector unsigned long long __res =
2434#ifdef __LITTLE_ENDIAN__
2435      vec_cnttz((vector unsigned long long)__tmp2);
2436#else
2437      vec_cntlz((vector unsigned long long)__tmp2);
2438#endif
2439  if (__res[0] == 64) {
2440    return (__res[1] + 64) >> 3;
2441  }
2442  return __res[0] >> 3;
2443}
2444
2445static __inline__ unsigned __ATTRS_o_ai
2446vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2447  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2448  vector bool short __tmp2 = __tmp1 |
2449                             vec_cmpeq((vector signed short)__tmp1, __a) |
2450                             vec_cmpeq((vector signed short)__tmp1, __b);
2451
2452  vector unsigned long long __res =
2453#ifdef __LITTLE_ENDIAN__
2454      vec_cnttz((vector unsigned long long)__tmp2);
2455#else
2456      vec_cntlz((vector unsigned long long)__tmp2);
2457#endif
2458  if (__res[0] == 64) {
2459    return (__res[1] + 64) >> 4;
2460  }
2461  return __res[0] >> 4;
2462}
2463
2464static __inline__ unsigned __ATTRS_o_ai
2465vec_first_match_or_eos_index(vector unsigned short __a,
2466                             vector unsigned short __b) {
2467  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2468  vector bool short __tmp2 = __tmp1 |
2469                             vec_cmpeq((vector unsigned short)__tmp1, __a) |
2470                             vec_cmpeq((vector unsigned short)__tmp1, __b);
2471
2472  vector unsigned long long __res =
2473#ifdef __LITTLE_ENDIAN__
2474      vec_cnttz((vector unsigned long long)__tmp2);
2475#else
2476      vec_cntlz((vector unsigned long long)__tmp2);
2477#endif
2478  if (__res[0] == 64) {
2479    return (__res[1] + 64) >> 4;
2480  }
2481  return __res[0] >> 4;
2482}
2483
2484static __inline__ unsigned __ATTRS_o_ai
2485vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2486  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2487  vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2488                           vec_cmpeq((vector signed int)__tmp1, __b);
2489
2490  vector unsigned long long __res =
2491#ifdef __LITTLE_ENDIAN__
2492      vec_cnttz((vector unsigned long long)__tmp2);
2493#else
2494      vec_cntlz((vector unsigned long long)__tmp2);
2495#endif
2496  if (__res[0] == 64) {
2497    return (__res[1] + 64) >> 5;
2498  }
2499  return __res[0] >> 5;
2500}
2501
2502static __inline__ unsigned __ATTRS_o_ai
2503vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2504  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2505  vector bool int __tmp2 = __tmp1 |
2506                           vec_cmpeq((vector unsigned int)__tmp1, __a) |
2507                           vec_cmpeq((vector unsigned int)__tmp1, __b);
2508
2509  vector unsigned long long __res =
2510#ifdef __LITTLE_ENDIAN__
2511    vec_cnttz((vector unsigned long long)__tmp2);
2512#else
2513    vec_cntlz((vector unsigned long long)__tmp2);
2514#endif
2515  if (__res[0] == 64) {
2516    return (__res[1] + 64) >> 5;
2517  }
2518  return __res[0] >> 5;
2519}
2520
2521/* vec_first_mismatch_index */
2522
2523static __inline__ unsigned __ATTRS_o_ai
2524vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2525  vector unsigned long long __res =
2526#ifdef __LITTLE_ENDIAN__
2527    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2528#else
2529    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2530#endif
2531  if (__res[0] == 64) {
2532    return (__res[1] + 64) >> 3;
2533  }
2534  return __res[0] >> 3;
2535}
2536
2537static __inline__ unsigned __ATTRS_o_ai
2538vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2539  vector unsigned long long __res =
2540#ifdef __LITTLE_ENDIAN__
2541    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2542#else
2543    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2544#endif
2545  if (__res[0] == 64) {
2546    return (__res[1] + 64) >> 3;
2547  }
2548  return __res[0] >> 3;
2549}
2550
2551static __inline__ unsigned __ATTRS_o_ai
2552vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2553  vector unsigned long long __res =
2554#ifdef __LITTLE_ENDIAN__
2555    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2556#else
2557    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2558#endif
2559  if (__res[0] == 64) {
2560    return (__res[1] + 64) >> 4;
2561  }
2562  return __res[0] >> 4;
2563}
2564
2565static __inline__ unsigned __ATTRS_o_ai
2566vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2567  vector unsigned long long __res =
2568#ifdef __LITTLE_ENDIAN__
2569    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2570#else
2571    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2572#endif
2573  if (__res[0] == 64) {
2574    return (__res[1] + 64) >> 4;
2575  }
2576  return __res[0] >> 4;
2577}
2578
2579static __inline__ unsigned __ATTRS_o_ai
2580vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2581  vector unsigned long long __res =
2582#ifdef __LITTLE_ENDIAN__
2583    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2584#else
2585    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2586#endif
2587  if (__res[0] == 64) {
2588    return (__res[1] + 64) >> 5;
2589  }
2590  return __res[0] >> 5;
2591}
2592
2593static __inline__ unsigned __ATTRS_o_ai
2594vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2595  vector unsigned long long __res =
2596#ifdef __LITTLE_ENDIAN__
2597    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2598#else
2599    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2600#endif
2601  if (__res[0] == 64) {
2602    return (__res[1] + 64) >> 5;
2603  }
2604  return __res[0] >> 5;
2605}
2606
2607/* vec_first_mismatch_or_eos_index */
2608
2609static __inline__ unsigned __ATTRS_o_ai
2610vec_first_mismatch_or_eos_index(vector signed char __a,
2611                                vector signed char __b) {
2612  vector unsigned long long __res =
2613#ifdef __LITTLE_ENDIAN__
2614    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2615#else
2616    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2617#endif
2618  if (__res[0] == 64) {
2619    return (__res[1] + 64) >> 3;
2620  }
2621  return __res[0] >> 3;
2622}
2623
2624static __inline__ unsigned __ATTRS_o_ai
2625vec_first_mismatch_or_eos_index(vector unsigned char __a,
2626                                vector unsigned char __b) {
2627  vector unsigned long long __res =
2628#ifdef __LITTLE_ENDIAN__
2629    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2630#else
2631    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2632#endif
2633  if (__res[0] == 64) {
2634    return (__res[1] + 64) >> 3;
2635  }
2636  return __res[0] >> 3;
2637}
2638
2639static __inline__ unsigned __ATTRS_o_ai
2640vec_first_mismatch_or_eos_index(vector signed short __a,
2641                                vector signed short __b) {
2642  vector unsigned long long __res =
2643#ifdef __LITTLE_ENDIAN__
2644    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2645#else
2646    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2647#endif
2648  if (__res[0] == 64) {
2649    return (__res[1] + 64) >> 4;
2650  }
2651  return __res[0] >> 4;
2652}
2653
2654static __inline__ unsigned __ATTRS_o_ai
2655vec_first_mismatch_or_eos_index(vector unsigned short __a,
2656                                vector unsigned short __b) {
2657  vector unsigned long long __res =
2658#ifdef __LITTLE_ENDIAN__
2659    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2660#else
2661    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2662#endif
2663  if (__res[0] == 64) {
2664    return (__res[1] + 64) >> 4;
2665  }
2666  return __res[0] >> 4;
2667}
2668
2669static __inline__ unsigned __ATTRS_o_ai
2670vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2671  vector unsigned long long __res =
2672#ifdef __LITTLE_ENDIAN__
2673    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2674#else
2675    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2676#endif
2677  if (__res[0] == 64) {
2678    return (__res[1] + 64) >> 5;
2679  }
2680  return __res[0] >> 5;
2681}
2682
2683static __inline__ unsigned __ATTRS_o_ai
2684vec_first_mismatch_or_eos_index(vector unsigned int __a,
2685                                vector unsigned int __b) {
2686  vector unsigned long long __res =
2687#ifdef __LITTLE_ENDIAN__
2688    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2689#else
2690    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2691#endif
2692  if (__res[0] == 64) {
2693    return (__res[1] + 64) >> 5;
2694  }
2695  return __res[0] >> 5;
2696}
2697
2698static __inline__ vector double  __ATTRS_o_ai
2699vec_insert_exp(vector double __a, vector unsigned long long __b) {
2700  return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2701}
2702
2703static __inline__ vector double  __ATTRS_o_ai
2704vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2705  return __builtin_vsx_xviexpdp(__a,__b);
2706}
2707
2708static __inline__ vector float  __ATTRS_o_ai
2709vec_insert_exp(vector float __a, vector unsigned int __b) {
2710  return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2711}
2712
2713static __inline__ vector float  __ATTRS_o_ai
2714vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2715  return __builtin_vsx_xviexpsp(__a,__b);
2716}
2717
2718#if defined(__powerpc64__)
2719static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(signed char *__a,
2720                                                             size_t __b) {
2721  return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
2722}
2723
2724static __inline__ vector unsigned char __ATTRS_o_ai
2725vec_xl_len(unsigned char *__a, size_t __b) {
2726  return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
2727}
2728
2729static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(signed short *__a,
2730                                                              size_t __b) {
2731  return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
2732}
2733
2734static __inline__ vector unsigned short __ATTRS_o_ai
2735vec_xl_len(unsigned short *__a, size_t __b) {
2736  return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
2737}
2738
2739static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(signed int *__a,
2740                                                            size_t __b) {
2741  return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
2742}
2743
2744static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(unsigned int *__a,
2745                                                              size_t __b) {
2746  return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
2747}
2748
2749static __inline__ vector float __ATTRS_o_ai vec_xl_len(float *__a, size_t __b) {
2750  return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
2751}
2752
2753static __inline__ vector signed __int128 __ATTRS_o_ai
2754vec_xl_len(signed __int128 *__a, size_t __b) {
2755  return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2756}
2757
2758static __inline__ vector unsigned __int128 __ATTRS_o_ai
2759vec_xl_len(unsigned __int128 *__a, size_t __b) {
2760  return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2761}
2762
2763static __inline__ vector signed long long __ATTRS_o_ai
2764vec_xl_len(signed long long *__a, size_t __b) {
2765  return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
2766}
2767
2768static __inline__ vector unsigned long long __ATTRS_o_ai
2769vec_xl_len(unsigned long long *__a, size_t __b) {
2770  return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
2771}
2772
2773static __inline__ vector double __ATTRS_o_ai vec_xl_len(double *__a,
2774                                                        size_t __b) {
2775  return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
2776}
2777
2778static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
2779                                                          size_t __b) {
2780  vector unsigned char __res =
2781      (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
2782#ifdef __LITTLE_ENDIAN__
2783  vector unsigned char __mask =
2784      (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
2785  __res = (vector unsigned char)__builtin_altivec_vperm_4si(
2786      (vector int)__res, (vector int)__res, __mask);
2787#endif
2788  return __res;
2789}
2790
2791// vec_xst_len
2792static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
2793                                                unsigned char *__b,
2794                                                size_t __c) {
2795  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2796}
2797
2798static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
2799                                                signed char *__b, size_t __c) {
2800  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2801}
2802
2803static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
2804                                                signed short *__b, size_t __c) {
2805  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2806}
2807
2808static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
2809                                                unsigned short *__b,
2810                                                size_t __c) {
2811  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2812}
2813
2814static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
2815                                                signed int *__b, size_t __c) {
2816  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2817}
2818
2819static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
2820                                                unsigned int *__b, size_t __c) {
2821  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2822}
2823
2824static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
2825                                                size_t __c) {
2826  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2827}
2828
2829static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
2830                                                signed __int128 *__b,
2831                                                size_t __c) {
2832  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2833}
2834
2835static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
2836                                                unsigned __int128 *__b,
2837                                                size_t __c) {
2838  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2839}
2840
2841static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
2842                                                signed long long *__b,
2843                                                size_t __c) {
2844  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2845}
2846
2847static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
2848                                                unsigned long long *__b,
2849                                                size_t __c) {
2850  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2851}
2852
2853static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
2854                                                size_t __c) {
2855  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2856}
2857
2858static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
2859                                                  unsigned char *__b,
2860                                                  size_t __c) {
2861#ifdef __LITTLE_ENDIAN__
2862  vector unsigned char __mask =
2863      (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
2864  vector unsigned char __res =
2865      __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask);
2866  return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
2867#else
2868  return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56));
2869#endif
2870}
2871#endif
2872#endif
2873
2874/* vec_cpsgn */
2875
2876#ifdef __VSX__
2877static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2878                                                      vector float __b) {
2879  return __builtin_vsx_xvcpsgnsp(__a, __b);
2880}
2881
2882static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
2883                                                       vector double __b) {
2884  return __builtin_vsx_xvcpsgndp(__a, __b);
2885}
2886#endif
2887
2888/* vec_ctf */
2889
2890#ifdef __VSX__
2891#define vec_ctf(__a, __b)                                                      \
2892  _Generic((__a), vector int                                                   \
2893           : (vector float)__builtin_altivec_vcfsx((__a), (__b)),              \
2894             vector unsigned int                                               \
2895           : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)),  \
2896             vector unsigned long long                                         \
2897           : (__builtin_convertvector((vector unsigned long long)(__a),        \
2898                                      vector double) *                         \
2899              (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2900                                                         << 52)),              \
2901             vector signed long long                                           \
2902           : (__builtin_convertvector((vector signed long long)(__a),          \
2903                                      vector double) *                         \
2904              (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2905                                                         << 52)))
2906#else
2907#define vec_ctf(__a, __b)                                                      \
2908  _Generic((__a), vector int                                                   \
2909           : (vector float)__builtin_altivec_vcfsx((__a), (__b)),              \
2910             vector unsigned int                                               \
2911           : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)))
2912#endif
2913
2914/* vec_vcfsx */
2915
2916#define vec_vcfux __builtin_altivec_vcfux
2917
2918/* vec_vcfux */
2919
2920#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
2921
2922/* vec_cts */
2923
2924#ifdef __VSX__
2925#define vec_cts(__a, __b)                                                      \
2926  _Generic((__a), vector float                                                 \
2927           : __builtin_altivec_vctsxs((__a), (__b)), vector double             \
2928           : __extension__({                                                   \
2929             vector double __ret =                                             \
2930                 (__a) *                                                       \
2931                 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
2932                                                            << 52);            \
2933             __builtin_convertvector(__ret, vector signed long long);          \
2934           }))
2935#else
2936#define vec_cts __builtin_altivec_vctsxs
2937#endif
2938
2939/* vec_vctsxs */
2940
2941#define vec_vctsxs __builtin_altivec_vctsxs
2942
2943/* vec_ctu */
2944
2945#ifdef __VSX__
2946#define vec_ctu(__a, __b)                                                      \
2947  _Generic((__a), vector float                                                 \
2948           : __builtin_altivec_vctuxs((__a), (__b)), vector double             \
2949           : __extension__({                                                   \
2950             vector double __ret =                                             \
2951                 (__a) *                                                       \
2952                 (vector double)(vector unsigned long long)((0x3ffULL + __b)   \
2953                                                            << 52);            \
2954             __builtin_convertvector(__ret, vector unsigned long long);        \
2955           }))
2956#else
2957#define vec_ctu __builtin_altivec_vctuxs
2958#endif
2959
2960/* vec_vctuxs */
2961
2962#define vec_vctuxs __builtin_altivec_vctuxs
2963
2964/* vec_signed */
2965
2966static __inline__ vector signed int __ATTRS_o_ai
2967vec_sld(vector signed int, vector signed intunsigned const int __c);
2968
2969static __inline__ vector signed int __ATTRS_o_ai
2970vec_signed(vector float __a) {
2971  return __builtin_convertvector(__a, vector signed int);
2972}
2973
2974#ifdef __VSX__
2975static __inline__ vector signed long long __ATTRS_o_ai
2976vec_signed(vector double __a) {
2977  return __builtin_convertvector(__a, vector signed long long);
2978}
2979
2980static __inline__ vector signed int __attribute__((__always_inline__))
2981vec_signed2(vector double __a, vector double __b) {
2982  return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
2983}
2984
2985static __inline__ vector signed int __ATTRS_o_ai
2986vec_signede(vector double __a) {
2987#ifdef __LITTLE_ENDIAN__
2988  vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2989  return vec_sld(__ret, __ret, 12);
2990#else
2991  return __builtin_vsx_xvcvdpsxws(__a);
2992#endif
2993}
2994
2995static __inline__ vector signed int __ATTRS_o_ai
2996vec_signedo(vector double __a) {
2997#ifdef __LITTLE_ENDIAN__
2998  return __builtin_vsx_xvcvdpsxws(__a);
2999#else
3000  vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3001  return vec_sld(__ret, __ret, 12);
3002#endif
3003}
3004#endif
3005
3006/* vec_unsigned */
3007
3008static __inline__ vector unsigned int __ATTRS_o_ai
3009vec_sld(vector unsigned int, vector unsigned intunsigned const int __c);
3010
3011static __inline__ vector unsigned int __ATTRS_o_ai
3012vec_unsigned(vector float __a) {
3013  return __builtin_convertvector(__a, vector unsigned int);
3014}
3015
3016#ifdef __VSX__
3017static __inline__ vector unsigned long long __ATTRS_o_ai
3018vec_unsigned(vector double __a) {
3019  return __builtin_convertvector(__a, vector unsigned long long);
3020}
3021
3022static __inline__ vector unsigned int __attribute__((__always_inline__))
3023vec_unsigned2(vector double __a, vector double __b) {
3024  return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3025}
3026
3027static __inline__ vector unsigned int __ATTRS_o_ai
3028vec_unsignede(vector double __a) {
3029#ifdef __LITTLE_ENDIAN__
3030  vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3031  return vec_sld(__ret, __ret, 12);
3032#else
3033  return __builtin_vsx_xvcvdpuxws(__a);
3034#endif
3035}
3036
3037static __inline__ vector unsigned int __ATTRS_o_ai
3038vec_unsignedo(vector double __a) {
3039#ifdef __LITTLE_ENDIAN__
3040  return __builtin_vsx_xvcvdpuxws(__a);
3041#else
3042  vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3043  return vec_sld(__ret, __ret, 12);
3044#endif
3045}
3046#endif
3047
3048/* vec_float */
3049
3050static __inline__ vector float __ATTRS_o_ai
3051vec_sld(vector float, vector floatunsigned const int __c);
3052
3053static __inline__ vector float __ATTRS_o_ai
3054vec_float(vector signed int __a) {
3055  return __builtin_convertvector(__a, vector float);
3056}
3057
3058static __inline__ vector float __ATTRS_o_ai
3059vec_float(vector unsigned int __a) {
3060  return __builtin_convertvector(__a, vector float);
3061}
3062
3063#ifdef __VSX__
3064static __inline__ vector float __ATTRS_o_ai
3065vec_float2(vector signed long long __a, vector signed long long __b) {
3066  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3067}
3068
3069static __inline__ vector float __ATTRS_o_ai
3070vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3071  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3072}
3073
3074static __inline__ vector float __ATTRS_o_ai
3075vec_float2(vector double __a, vector double __b) {
3076  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3077}
3078
3079static __inline__ vector float __ATTRS_o_ai
3080vec_floate(vector signed long long __a) {
3081#ifdef __LITTLE_ENDIAN__
3082  vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3083  return vec_sld(__ret, __ret, 12);
3084#else
3085  return __builtin_vsx_xvcvsxdsp(__a);
3086#endif
3087}
3088
3089static __inline__ vector float __ATTRS_o_ai
3090vec_floate(vector unsigned long long __a) {
3091#ifdef __LITTLE_ENDIAN__
3092  vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3093  return vec_sld(__ret, __ret, 12);
3094#else
3095  return __builtin_vsx_xvcvuxdsp(__a);
3096#endif
3097}
3098
3099static __inline__ vector float __ATTRS_o_ai
3100vec_floate(vector double __a) {
3101#ifdef __LITTLE_ENDIAN__
3102  vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3103  return vec_sld(__ret, __ret, 12);
3104#else
3105  return __builtin_vsx_xvcvdpsp(__a);
3106#endif
3107}
3108
3109static __inline__ vector float __ATTRS_o_ai
3110vec_floato(vector signed long long __a) {
3111#ifdef __LITTLE_ENDIAN__
3112  return __builtin_vsx_xvcvsxdsp(__a);
3113#else
3114  vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3115  return vec_sld(__ret, __ret, 12);
3116#endif
3117}
3118
3119static __inline__ vector float __ATTRS_o_ai
3120vec_floato(vector unsigned long long __a) {
3121#ifdef __LITTLE_ENDIAN__
3122  return __builtin_vsx_xvcvuxdsp(__a);
3123#else
3124  vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3125  return vec_sld(__ret, __ret, 12);
3126#endif
3127}
3128
3129static __inline__ vector float __ATTRS_o_ai
3130vec_floato(vector double __a) {
3131#ifdef __LITTLE_ENDIAN__
3132  return __builtin_vsx_xvcvdpsp(__a);
3133#else
3134  vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3135  return vec_sld(__ret, __ret, 12);
3136#endif
3137}
3138#endif
3139
3140/* vec_double */
3141
3142#ifdef __VSX__
3143static __inline__ vector double __ATTRS_o_ai
3144vec_double(vector signed long long __a) {
3145  return __builtin_convertvector(__a, vector double);
3146}
3147
3148static __inline__ vector double __ATTRS_o_ai
3149vec_double(vector unsigned long long __a) {
3150  return __builtin_convertvector(__a, vector double);
3151}
3152
3153static __inline__ vector double __ATTRS_o_ai
3154vec_doublee(vector signed int __a) {
3155#ifdef __LITTLE_ENDIAN__
3156  return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3157#else
3158  return __builtin_vsx_xvcvsxwdp(__a);
3159#endif
3160}
3161
3162static __inline__ vector double __ATTRS_o_ai
3163vec_doublee(vector unsigned int __a) {
3164#ifdef __LITTLE_ENDIAN__
3165  return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3166#else
3167  return __builtin_vsx_xvcvuxwdp(__a);
3168#endif
3169}
3170
3171static __inline__ vector double __ATTRS_o_ai
3172vec_doublee(vector float __a) {
3173#ifdef __LITTLE_ENDIAN__
3174  return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3175#else
3176  return __builtin_vsx_xvcvspdp(__a);
3177#endif
3178}
3179
3180static __inline__ vector double __ATTRS_o_ai
3181vec_doubleh(vector signed int __a) {
3182  vector double __ret = {__a[0], __a[1]};
3183  return __ret;
3184}
3185
3186static __inline__ vector double __ATTRS_o_ai
3187vec_doubleh(vector unsigned int __a) {
3188  vector double __ret = {__a[0], __a[1]};
3189  return __ret;
3190}
3191
3192static __inline__ vector double __ATTRS_o_ai
3193vec_doubleh(vector float __a) {
3194  vector double __ret = {__a[0], __a[1]};
3195  return __ret;
3196}
3197
3198static __inline__ vector double __ATTRS_o_ai
3199vec_doublel(vector signed int __a) {
3200  vector double __ret = {__a[2], __a[3]};
3201  return __ret;
3202}
3203
3204static __inline__ vector double __ATTRS_o_ai
3205vec_doublel(vector unsigned int __a) {
3206  vector double __ret = {__a[2], __a[3]};
3207  return __ret;
3208}
3209
3210static __inline__ vector double __ATTRS_o_ai
3211vec_doublel(vector float __a) {
3212  vector double __ret = {__a[2], __a[3]};
3213  return __ret;
3214}
3215
3216static __inline__ vector double __ATTRS_o_ai
3217vec_doubleo(vector signed int __a) {
3218#ifdef __LITTLE_ENDIAN__
3219  return __builtin_vsx_xvcvsxwdp(__a);
3220#else
3221  return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3222#endif
3223}
3224
3225static __inline__ vector double __ATTRS_o_ai
3226vec_doubleo(vector unsigned int __a) {
3227#ifdef __LITTLE_ENDIAN__
3228  return __builtin_vsx_xvcvuxwdp(__a);
3229#else
3230  return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3231#endif
3232}
3233
3234static __inline__ vector double __ATTRS_o_ai
3235vec_doubleo(vector float __a) {
3236#ifdef __LITTLE_ENDIAN__
3237  return __builtin_vsx_xvcvspdp(__a);
3238#else
3239  return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3240#endif
3241}
3242#endif
3243
3244/* vec_div */
3245
3246/* Integer vector divides (vectors are scalarized, elements divided
3247   and the vectors reassembled).
3248*/
3249static __inline__ vector signed char __ATTRS_o_ai
3250vec_div(vector signed char __a, vector signed char __b) {
3251  return __a / __b;
3252}
3253
3254static __inline__ vector unsigned char __ATTRS_o_ai
3255vec_div(vector unsigned char __a, vector unsigned char __b) {
3256  return __a / __b;
3257}
3258
3259static __inline__ vector signed short __ATTRS_o_ai
3260vec_div(vector signed short __a, vector signed short __b) {
3261  return __a / __b;
3262}
3263
3264static __inline__ vector unsigned short __ATTRS_o_ai
3265vec_div(vector unsigned short __a, vector unsigned short __b) {
3266  return __a / __b;
3267}
3268
3269static __inline__ vector signed int __ATTRS_o_ai
3270vec_div(vector signed int __a, vector signed int __b) {
3271  return __a / __b;
3272}
3273
3274static __inline__ vector unsigned int __ATTRS_o_ai
3275vec_div(vector unsigned int __a, vector unsigned int __b) {
3276  return __a / __b;
3277}
3278
3279#ifdef __VSX__
3280static __inline__ vector signed long long __ATTRS_o_ai
3281vec_div(vector signed long long __a, vector signed long long __b) {
3282  return __a / __b;
3283}
3284
3285static __inline__ vector unsigned long long __ATTRS_o_ai
3286vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3287  return __a / __b;
3288}
3289
3290static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3291                                                    vector float __b) {
3292  return __a / __b;
3293}
3294
3295static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3296                                                     vector double __b) {
3297  return __a / __b;
3298}
3299#endif
3300
3301/* vec_dss */
3302
3303static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
3304  __builtin_altivec_dss(__a);
3305}
3306
3307/* vec_dssall */
3308
3309static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3310  __builtin_altivec_dssall();
3311}
3312
3313/* vec_dst */
3314#define vec_dst(__PTR, __CW, __STR) \
3315  __extension__(                    \
3316      { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
3317
3318/* vec_dstst */
3319#define vec_dstst(__PTR, __CW, __STR) \
3320  __extension__(                      \
3321      { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
3322
3323/* vec_dststt */
3324#define vec_dststt(__PTR, __CW, __STR) \
3325  __extension__(                       \
3326      { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
3327
3328/* vec_dstt */
3329#define vec_dstt(__PTR, __CW, __STR) \
3330  __extension__(                     \
3331      { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
3332
3333/* vec_eqv */
3334
3335#ifdef __POWER8_VECTOR__
3336static __inline__ vector signed char __ATTRS_o_ai
3337vec_eqv(vector signed char __a, vector signed char __b) {
3338  return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3339                                                  (vector unsigned int)__b);
3340}
3341
3342static __inline__ vector unsigned char __ATTRS_o_ai
3343vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3344  return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3345                                                    (vector unsigned int)__b);
3346}
3347
3348static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3349                                                        vector bool char __b) {
3350  return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3351                                                (vector unsigned int)__b);
3352}
3353
3354static __inline__ vector signed short __ATTRS_o_ai
3355vec_eqv(vector signed short __a, vector signed short __b) {
3356  return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3357                                                   (vector unsigned int)__b);
3358}
3359
3360static __inline__ vector unsigned short __ATTRS_o_ai
3361vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3362  return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3363                                                     (vector unsigned int)__b);
3364}
3365
3366static __inline__ vector bool short __ATTRS_o_ai
3367vec_eqv(vector bool short __a, vector bool short __b) {
3368  return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3369                                                 (vector unsigned int)__b);
3370}
3371
3372static __inline__ vector signed int __ATTRS_o_ai
3373vec_eqv(vector signed int __a, vector signed int __b) {
3374  return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3375                                                 (vector unsigned int)__b);
3376}
3377
3378static __inline__ vector unsigned int __ATTRS_o_ai
3379vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3380  return __builtin_vsx_xxleqv(__a, __b);
3381}
3382
3383static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3384                                                       vector bool int __b) {
3385  return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3386                                               (vector unsigned int)__b);
3387}
3388
3389static __inline__ vector signed long long __ATTRS_o_ai
3390vec_eqv(vector signed long long __a, vector signed long long __b) {
3391  return (vector signed long long)__builtin_vsx_xxleqv(
3392      (vector unsigned int)__a, (vector unsigned int)__b);
3393}
3394
3395static __inline__ vector unsigned long long __ATTRS_o_ai
3396vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3397  return (vector unsigned long long)__builtin_vsx_xxleqv(
3398      (vector unsigned int)__a, (vector unsigned int)__b);
3399}
3400
3401static __inline__ vector bool long long __ATTRS_o_ai
3402vec_eqv(vector bool long long __a, vector bool long long __b) {
3403  return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3404                                                     (vector unsigned int)__b);
3405}
3406
3407static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3408                                                    vector float __b) {
3409  return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3410                                            (vector unsigned int)__b);
3411}
3412
3413static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3414                                                     vector double __b) {
3415  return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3416                                             (vector unsigned int)__b);
3417}
3418#endif
3419
3420/* vec_expte */
3421
3422static __inline__ vector float __attribute__((__always_inline__))
3423vec_expte(vector float __a) {
3424  return __builtin_altivec_vexptefp(__a);
3425}
3426
3427/* vec_vexptefp */
3428
3429static __inline__ vector float __attribute__((__always_inline__))
3430vec_vexptefp(vector float __a) {
3431  return __builtin_altivec_vexptefp(__a);
3432}
3433
3434/* vec_floor */
3435
3436static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3437#ifdef __VSX__
3438  return __builtin_vsx_xvrspim(__a);
3439#else
3440  return __builtin_altivec_vrfim(__a);
3441#endif
3442}
3443
3444#ifdef __VSX__
3445static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3446  return __builtin_vsx_xvrdpim(__a);
3447}
3448#endif
3449
3450/* vec_vrfim */
3451
3452static __inline__ vector float __attribute__((__always_inline__))
3453vec_vrfim(vector float __a) {
3454  return __builtin_altivec_vrfim(__a);
3455}
3456
3457/* vec_ld */
3458
3459static __inline__ vector signed char __ATTRS_o_ai
3460vec_ld(int __a, const vector signed char *__b) {
3461  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3462}
3463
3464static __inline__ vector signed char __ATTRS_o_ai
3465vec_ld(int __a, const signed char *__b) {
3466  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3467}
3468
3469static __inline__ vector unsigned char __ATTRS_o_ai
3470vec_ld(int __a, const vector unsigned char *__b) {
3471  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3472}
3473
3474static __inline__ vector unsigned char __ATTRS_o_ai
3475vec_ld(int __a, const unsigned char *__b) {
3476  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3477}
3478
3479static __inline__ vector bool char __ATTRS_o_ai
3480vec_ld(int __aconst vector bool char *__b) {
3481  return (vector bool char)__builtin_altivec_lvx(__a, __b);
3482}
3483
3484static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3485                                                   const vector short *__b) {
3486  return (vector short)__builtin_altivec_lvx(__a, __b);
3487}
3488
3489static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3490  return (vector short)__builtin_altivec_lvx(__a, __b);
3491}
3492
3493static __inline__ vector unsigned short __ATTRS_o_ai
3494vec_ld(int __a, const vector unsigned short *__b) {
3495  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3496}
3497
3498static __inline__ vector unsigned short __ATTRS_o_ai
3499vec_ld(int __a, const unsigned short *__b) {
3500  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3501}
3502
3503static __inline__ vector bool short __ATTRS_o_ai
3504vec_ld(int __aconst vector bool short *__b) {
3505  return (vector bool short)__builtin_altivec_lvx(__a, __b);
3506}
3507
3508static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3509                                                   const vector pixel *__b) {
3510  return (vector pixel)__builtin_altivec_lvx(__a, __b);
3511}
3512
3513static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3514                                                 const vector int *__b) {
3515  return (vector int)__builtin_altivec_lvx(__a, __b);
3516}
3517
3518static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3519  return (vector int)__builtin_altivec_lvx(__a, __b);
3520}
3521
3522static __inline__ vector unsigned int __ATTRS_o_ai
3523vec_ld(int __a, const vector unsigned int *__b) {
3524  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3525}
3526
3527static __inline__ vector unsigned int __ATTRS_o_ai
3528vec_ld(int __a, const unsigned int *__b) {
3529  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3530}
3531
3532static __inline__ vector bool int __ATTRS_o_ai
3533vec_ld(int __a, const vector bool int *__b) {
3534  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3535}
3536
3537static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3538                                                   const vector float *__b) {
3539  return (vector float)__builtin_altivec_lvx(__a, __b);
3540}
3541
3542static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3543  return (vector float)__builtin_altivec_lvx(__a, __b);
3544}
3545
3546/* vec_lvx */
3547
3548static __inline__ vector signed char __ATTRS_o_ai
3549vec_lvx(int __a, const vector signed char *__b) {
3550  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3551}
3552
3553static __inline__ vector signed char __ATTRS_o_ai
3554vec_lvx(int __a, const signed char *__b) {
3555  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3556}
3557
3558static __inline__ vector unsigned char __ATTRS_o_ai
3559vec_lvx(int __a, const vector unsigned char *__b) {
3560  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3561}
3562
3563static __inline__ vector unsigned char __ATTRS_o_ai
3564vec_lvx(int __a, const unsigned char *__b) {
3565  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3566}
3567
3568static __inline__ vector bool char __ATTRS_o_ai
3569vec_lvx(int __a, const vector bool char *__b) {
3570  return (vector bool char)__builtin_altivec_lvx(__a, __b);
3571}
3572
3573static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3574                                                    const vector short *__b) {
3575  return (vector short)__builtin_altivec_lvx(__a, __b);
3576}
3577
3578static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3579  return (vector short)__builtin_altivec_lvx(__a, __b);
3580}
3581
3582static __inline__ vector unsigned short __ATTRS_o_ai
3583vec_lvx(int __a, const vector unsigned short *__b) {
3584  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3585}
3586
3587static __inline__ vector unsigned short __ATTRS_o_ai
3588vec_lvx(int __a, const unsigned short *__b) {
3589  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3590}
3591
3592static __inline__ vector bool short __ATTRS_o_ai
3593vec_lvx(int __a, const vector bool short *__b) {
3594  return (vector bool short)__builtin_altivec_lvx(__a, __b);
3595}
3596
3597static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3598                                                    const vector pixel *__b) {
3599  return (vector pixel)__builtin_altivec_lvx(__a, __b);
3600}
3601
3602static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3603                                                  const vector int *__b) {
3604  return (vector int)__builtin_altivec_lvx(__a, __b);
3605}
3606
3607static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3608  return (vector int)__builtin_altivec_lvx(__a, __b);
3609}
3610
3611static __inline__ vector unsigned int __ATTRS_o_ai
3612vec_lvx(int __a, const vector unsigned int *__b) {
3613  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3614}
3615
3616static __inline__ vector unsigned int __ATTRS_o_ai
3617vec_lvx(int __a, const unsigned int *__b) {
3618  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3619}
3620
3621static __inline__ vector bool int __ATTRS_o_ai
3622vec_lvx(int __a, const vector bool int *__b) {
3623  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3624}
3625
3626static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3627                                                    const vector float *__b) {
3628  return (vector float)__builtin_altivec_lvx(__a, __b);
3629}
3630
3631static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3632  return (vector float)__builtin_altivec_lvx(__a, __b);
3633}
3634
3635/* vec_lde */
3636
3637static __inline__ vector signed char __ATTRS_o_ai
3638vec_lde(int __a, const signed char *__b) {
3639  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3640}
3641
3642static __inline__ vector unsigned char __ATTRS_o_ai
3643vec_lde(int __a, const unsigned char *__b) {
3644  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3645}
3646
3647static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3648  return (vector short)__builtin_altivec_lvehx(__a, __b);
3649}
3650
3651static __inline__ vector unsigned short __ATTRS_o_ai
3652vec_lde(int __a, const unsigned short *__b) {
3653  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3654}
3655
3656static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3657  return (vector int)__builtin_altivec_lvewx(__a, __b);
3658}
3659
3660static __inline__ vector unsigned int __ATTRS_o_ai
3661vec_lde(int __a, const unsigned int *__b) {
3662  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3663}
3664
3665static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3666  return (vector float)__builtin_altivec_lvewx(__a, __b);
3667}
3668
3669/* vec_lvebx */
3670
3671static __inline__ vector signed char __ATTRS_o_ai
3672vec_lvebx(int __a, const signed char *__b) {
3673  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3674}
3675
3676static __inline__ vector unsigned char __ATTRS_o_ai
3677vec_lvebx(int __a, const unsigned char *__b) {
3678  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3679}
3680
3681/* vec_lvehx */
3682
3683static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3684                                                      const short *__b) {
3685  return (vector short)__builtin_altivec_lvehx(__a, __b);
3686}
3687
3688static __inline__ vector unsigned short __ATTRS_o_ai
3689vec_lvehx(int __a, const unsigned short *__b) {
3690  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3691}
3692
3693/* vec_lvewx */
3694
3695static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3696  return (vector int)__builtin_altivec_lvewx(__a, __b);
3697}
3698
3699static __inline__ vector unsigned int __ATTRS_o_ai
3700vec_lvewx(int __a, const unsigned int *__b) {
3701  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3702}
3703
3704static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3705                                                      const float *__b) {
3706  return (vector float)__builtin_altivec_lvewx(__a, __b);
3707}
3708
3709/* vec_ldl */
3710
3711static __inline__ vector signed char __ATTRS_o_ai
3712vec_ldl(int __a, const vector signed char *__b) {
3713  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3714}
3715
3716static __inline__ vector signed char __ATTRS_o_ai
3717vec_ldl(int __a, const signed char *__b) {
3718  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3719}
3720
3721static __inline__ vector unsigned char __ATTRS_o_ai
3722vec_ldl(int __a, const vector unsigned char *__b) {
3723  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3724}
3725
3726static __inline__ vector unsigned char __ATTRS_o_ai
3727vec_ldl(int __a, const unsigned char *__b) {
3728  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3729}
3730
3731static __inline__ vector bool char __ATTRS_o_ai
3732vec_ldl(int __a, const vector bool char *__b) {
3733  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3734}
3735
3736static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3737                                                    const vector short *__b) {
3738  return (vector short)__builtin_altivec_lvxl(__a, __b);
3739}
3740
3741static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3742  return (vector short)__builtin_altivec_lvxl(__a, __b);
3743}
3744
3745static __inline__ vector unsigned short __ATTRS_o_ai
3746vec_ldl(int __a, const vector unsigned short *__b) {
3747  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3748}
3749
3750static __inline__ vector unsigned short __ATTRS_o_ai
3751vec_ldl(int __a, const unsigned short *__b) {
3752  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3753}
3754
3755static __inline__ vector bool short __ATTRS_o_ai
3756vec_ldl(int __a, const vector bool short *__b) {
3757  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3758}
3759
3760static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3761                                                    const vector pixel *__b) {
3762  return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3763}
3764
3765static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3766                                                  const vector int *__b) {
3767  return (vector int)__builtin_altivec_lvxl(__a, __b);
3768}
3769
3770static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3771  return (vector int)__builtin_altivec_lvxl(__a, __b);
3772}
3773
3774static __inline__ vector unsigned int __ATTRS_o_ai
3775vec_ldl(int __a, const vector unsigned int *__b) {
3776  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3777}
3778
3779static __inline__ vector unsigned int __ATTRS_o_ai
3780vec_ldl(int __a, const unsigned int *__b) {
3781  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3782}
3783
3784static __inline__ vector bool int __ATTRS_o_ai
3785vec_ldl(int __a, const vector bool int *__b) {
3786  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3787}
3788
3789static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3790                                                    const vector float *__b) {
3791  return (vector float)__builtin_altivec_lvxl(__a, __b);
3792}
3793
3794static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3795  return (vector float)__builtin_altivec_lvxl(__a, __b);
3796}
3797
3798/* vec_lvxl */
3799
3800static __inline__ vector signed char __ATTRS_o_ai
3801vec_lvxl(int __a, const vector signed char *__b) {
3802  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3803}
3804
3805static __inline__ vector signed char __ATTRS_o_ai
3806vec_lvxl(int __a, const signed char *__b) {
3807  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3808}
3809
3810static __inline__ vector unsigned char __ATTRS_o_ai
3811vec_lvxl(int __a, const vector unsigned char *__b) {
3812  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3813}
3814
3815static __inline__ vector unsigned char __ATTRS_o_ai
3816vec_lvxl(int __a, const unsigned char *__b) {
3817  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3818}
3819
3820static __inline__ vector bool char __ATTRS_o_ai
3821vec_lvxl(int __a, const vector bool char *__b) {
3822  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3823}
3824
3825static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3826                                                     const vector short *__b) {
3827  return (vector short)__builtin_altivec_lvxl(__a, __b);
3828}
3829
3830static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3831                                                     const short *__b) {
3832  return (vector short)__builtin_altivec_lvxl(__a, __b);
3833}
3834
3835static __inline__ vector unsigned short __ATTRS_o_ai
3836vec_lvxl(int __a, const vector unsigned short *__b) {
3837  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3838}
3839
3840static __inline__ vector unsigned short __ATTRS_o_ai
3841vec_lvxl(int __a, const unsigned short *__b) {
3842  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3843}
3844
3845static __inline__ vector bool short __ATTRS_o_ai
3846vec_lvxl(int __a, const vector bool short *__b) {
3847  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3848}
3849
3850static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3851                                                     const vector pixel *__b) {
3852  return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3853}
3854
3855static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3856                                                   const vector int *__b) {
3857  return (vector int)__builtin_altivec_lvxl(__a, __b);
3858}
3859
3860static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3861  return (vector int)__builtin_altivec_lvxl(__a, __b);
3862}
3863
3864static __inline__ vector unsigned int __ATTRS_o_ai
3865vec_lvxl(int __a, const vector unsigned int *__b) {
3866  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3867}
3868
3869static __inline__ vector unsigned int __ATTRS_o_ai
3870vec_lvxl(int __a, const unsigned int *__b) {
3871  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3872}
3873
3874static __inline__ vector bool int __ATTRS_o_ai
3875vec_lvxl(int __a, const vector bool int *__b) {
3876  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3877}
3878
3879static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3880                                                     const vector float *__b) {
3881  return (vector float)__builtin_altivec_lvxl(__a, __b);
3882}
3883
3884static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3885                                                     const float *__b) {
3886  return (vector float)__builtin_altivec_lvxl(__a, __b);
3887}
3888
3889/* vec_loge */
3890
3891static __inline__ vector float __attribute__((__always_inline__))
3892vec_loge(vector float __a) {
3893  return __builtin_altivec_vlogefp(__a);
3894}
3895
3896/* vec_vlogefp */
3897
3898static __inline__ vector float __attribute__((__always_inline__))
3899vec_vlogefp(vector float __a) {
3900  return __builtin_altivec_vlogefp(__a);
3901}
3902
3903/* vec_lvsl */
3904
3905#ifdef __LITTLE_ENDIAN__
3906static __inline__ vector unsigned char __ATTRS_o_ai
3907    __attribute__((__deprecated__("use assignment for unaligned little endian \
3908loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3909  vector unsigned char mask =
3910      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3911  vector unsigned char reverse = {15141312111098,
3912                                  7,  6,  5,  4,  3,  2,  10};
3913  return vec_perm(mask, mask, reverse);
3914}
3915#else
3916static __inline__ vector unsigned char __ATTRS_o_ai
3917vec_lvsl(int __a, const signed char *__b) {
3918  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3919}
3920#endif
3921
3922#ifdef __LITTLE_ENDIAN__
3923static __inline__ vector unsigned char __ATTRS_o_ai
3924    __attribute__((__deprecated__("use assignment for unaligned little endian \
3925loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3926  vector unsigned char mask =
3927      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3928  vector unsigned char reverse = {15141312111098,
3929                                  7,  6,  5,  4,  3,  2,  10};
3930  return vec_perm(mask, mask, reverse);
3931}
3932#else
3933static __inline__ vector unsigned char __ATTRS_o_ai
3934vec_lvsl(int __a, const unsigned char *__b) {
3935  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3936}
3937#endif
3938
3939#ifdef __LITTLE_ENDIAN__
3940static __inline__ vector unsigned char __ATTRS_o_ai
3941    __attribute__((__deprecated__("use assignment for unaligned little endian \
3942loads/stores"))) vec_lvsl(int __a, const short *__b) {
3943  vector unsigned char mask =
3944      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3945  vector unsigned char reverse = {15141312111098,
3946                                  7,  6,  5,  4,  3,  2,  10};
3947  return vec_perm(mask, mask, reverse);
3948}
3949#else
3950static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3951                                                             const short *__b) {
3952  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3953}
3954#endif
3955
3956#ifdef __LITTLE_ENDIAN__
3957static __inline__ vector unsigned char __ATTRS_o_ai
3958    __attribute__((__deprecated__("use assignment for unaligned little endian \
3959loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3960  vector unsigned char mask =
3961      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3962  vector unsigned char reverse = {15141312111098,
3963                                  7,  6,  5,  4,  3,  2,  10};
3964  return vec_perm(mask, mask, reverse);
3965}
3966#else
3967static __inline__ vector unsigned char __ATTRS_o_ai
3968vec_lvsl(int __a, const unsigned short *__b) {
3969  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3970}
3971#endif
3972
3973#ifdef __LITTLE_ENDIAN__
3974static __inline__ vector unsigned char __ATTRS_o_ai
3975    __attribute__((__deprecated__("use assignment for unaligned little endian \
3976loads/stores"))) vec_lvsl(int __a, const int *__b) {
3977  vector unsigned char mask =
3978      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3979  vector unsigned char reverse = {15141312111098,
3980                                  7,  6,  5,  4,  3,  2,  10};
3981  return vec_perm(mask, mask, reverse);
3982}
3983#else
3984static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3985                                                             const int *__b) {
3986  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3987}
3988#endif
3989
3990#ifdef __LITTLE_ENDIAN__
3991static __inline__ vector unsigned char __ATTRS_o_ai
3992    __attribute__((__deprecated__("use assignment for unaligned little endian \
3993loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
3994  vector unsigned char mask =
3995      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3996  vector unsigned char reverse = {15141312111098,
3997                                  7,  6,  5,  4,  3,  2,  10};
3998  return vec_perm(mask, mask, reverse);
3999}
4000#else
4001static __inline__ vector unsigned char __ATTRS_o_ai
4002vec_lvsl(int __a, const unsigned int *__b) {
4003  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4004}
4005#endif
4006
4007#ifdef __LITTLE_ENDIAN__
4008static __inline__ vector unsigned char __ATTRS_o_ai
4009    __attribute__((__deprecated__("use assignment for unaligned little endian \
4010loads/stores"))) vec_lvsl(int __a, const float *__b) {
4011  vector unsigned char mask =
4012      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4013  vector unsigned char reverse = {15141312111098,
4014                                  7,  6,  5,  4,  3,  2,  10};
4015  return vec_perm(mask, mask, reverse);
4016}
4017#else
4018static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4019                                                             const float *__b) {
4020  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4021}
4022#endif
4023
4024/* vec_lvsr */
4025
4026#ifdef __LITTLE_ENDIAN__
4027static __inline__ vector unsigned char __ATTRS_o_ai
4028    __attribute__((__deprecated__("use assignment for unaligned little endian \
4029loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4030  vector unsigned char mask =
4031      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4032  vector unsigned char reverse = {15141312111098,
4033                                  7,  6,  5,  4,  3,  2,  10};
4034  return vec_perm(mask, mask, reverse);
4035}
4036#else
4037static __inline__ vector unsigned char __ATTRS_o_ai
4038vec_lvsr(int __a, const signed char *__b) {
4039  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4040}
4041#endif
4042
4043#ifdef __LITTLE_ENDIAN__
4044static __inline__ vector unsigned char __ATTRS_o_ai
4045    __attribute__((__deprecated__("use assignment for unaligned little endian \
4046loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4047  vector unsigned char mask =
4048      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4049  vector unsigned char reverse = {15141312111098,
4050                                  7,  6,  5,  4,  3,  2,  10};
4051  return vec_perm(mask, mask, reverse);
4052}
4053#else
4054static __inline__ vector unsigned char __ATTRS_o_ai
4055vec_lvsr(int __a, const unsigned char *__b) {
4056  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4057}
4058#endif
4059
4060#ifdef __LITTLE_ENDIAN__
4061static __inline__ vector unsigned char __ATTRS_o_ai
4062    __attribute__((__deprecated__("use assignment for unaligned little endian \
4063loads/stores"))) vec_lvsr(int __a, const short *__b) {
4064  vector unsigned char mask =
4065      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4066  vector unsigned char reverse = {15141312111098,
4067                                  7,  6,  5,  4,  3,  2,  10};
4068  return vec_perm(mask, mask, reverse);
4069}
4070#else
4071static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4072                                                             const short *__b) {
4073  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4074}
4075#endif
4076
4077#ifdef __LITTLE_ENDIAN__
4078static __inline__ vector unsigned char __ATTRS_o_ai
4079    __attribute__((__deprecated__("use assignment for unaligned little endian \
4080loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4081  vector unsigned char mask =
4082      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4083  vector unsigned char reverse = {15141312111098,
4084                                  7,  6,  5,  4,  3,  2,  10};
4085  return vec_perm(mask, mask, reverse);
4086}
4087#else
4088static __inline__ vector unsigned char __ATTRS_o_ai
4089vec_lvsr(int __a, const unsigned short *__b) {
4090  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4091}
4092#endif
4093
4094#ifdef __LITTLE_ENDIAN__
4095static __inline__ vector unsigned char __ATTRS_o_ai
4096    __attribute__((__deprecated__("use assignment for unaligned little endian \
4097loads/stores"))) vec_lvsr(int __a, const int *__b) {
4098  vector unsigned char mask =
4099      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4100  vector unsigned char reverse = {15141312111098,
4101                                  7,  6,  5,  4,  3,  2,  10};
4102  return vec_perm(mask, mask, reverse);
4103}
4104#else
4105static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4106                                                             const int *__b) {
4107  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4108}
4109#endif
4110
4111#ifdef __LITTLE_ENDIAN__
4112static __inline__ vector unsigned char __ATTRS_o_ai
4113    __attribute__((__deprecated__("use assignment for unaligned little endian \
4114loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4115  vector unsigned char mask =
4116      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4117  vector unsigned char reverse = {15141312111098,
4118                                  7,  6,  5,  4,  3,  2,  10};
4119  return vec_perm(mask, mask, reverse);
4120}
4121#else
4122static __inline__ vector unsigned char __ATTRS_o_ai
4123vec_lvsr(int __a, const unsigned int *__b) {
4124  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4125}
4126#endif
4127
4128#ifdef __LITTLE_ENDIAN__
4129static __inline__ vector unsigned char __ATTRS_o_ai
4130    __attribute__((__deprecated__("use assignment for unaligned little endian \
4131loads/stores"))) vec_lvsr(int __a, const float *__b) {
4132  vector unsigned char mask =
4133      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4134  vector unsigned char reverse = {15141312111098,
4135                                  7,  6,  5,  4,  3,  2,  10};
4136  return vec_perm(mask, mask, reverse);
4137}
4138#else
4139static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4140                                                             const float *__b) {
4141  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4142}
4143#endif
4144
4145/* vec_madd */
4146static __inline__ vector signed short __ATTRS_o_ai
4147vec_mladd(vector signed short, vector signed short, vector signed short);
4148static __inline__ vector signed short __ATTRS_o_ai
4149vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4150static __inline__ vector signed short __ATTRS_o_ai
4151vec_mladd(vector unsigned short, vector signed short, vector signed short);
4152static __inline__ vector unsigned short __ATTRS_o_ai
4153vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4154
4155static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4156    vector signed short __a, vector signed short __b, vector signed short __c) {
4157  return vec_mladd(__a, __b, __c);
4158}
4159
4160static __inline__ vector signed short __ATTRS_o_ai
4161vec_madd(vector signed short __a, vector unsigned short __b,
4162         vector unsigned short __c) {
4163  return vec_mladd(__a, __b, __c);
4164}
4165
4166static __inline__ vector signed short __ATTRS_o_ai
4167vec_madd(vector unsigned short __a, vector signed short __b,
4168         vector signed short __c) {
4169  return vec_mladd(__a, __b, __c);
4170}
4171
4172static __inline__ vector unsigned short __ATTRS_o_ai
4173vec_madd(vector unsigned short __a, vector unsigned short __b,
4174         vector unsigned short __c) {
4175  return vec_mladd(__a, __b, __c);
4176}
4177
4178static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4179                                                     vector float __b,
4180                                                     vector float __c) {
4181#ifdef __VSX__
4182  return __builtin_vsx_xvmaddasp(__a, __b, __c);
4183#else
4184  return __builtin_altivec_vmaddfp(__a, __b, __c);
4185#endif
4186}
4187
4188#ifdef __VSX__
4189static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4190                                                      vector double __b,
4191                                                      vector double __c) {
4192  return __builtin_vsx_xvmaddadp(__a, __b, __c);
4193}
4194#endif
4195
4196/* vec_vmaddfp */
4197
4198static __inline__ vector float __attribute__((__always_inline__))
4199vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4200  return __builtin_altivec_vmaddfp(__a, __b, __c);
4201}
4202
4203/* vec_madds */
4204
4205static __inline__ vector signed short __attribute__((__always_inline__))
4206vec_madds(vector signed short __a, vector signed short __b,
4207          vector signed short __c) {
4208  return __builtin_altivec_vmhaddshs(__a, __b, __c);
4209}
4210
4211/* vec_vmhaddshs */
4212static __inline__ vector signed short __attribute__((__always_inline__))
4213vec_vmhaddshs(vector signed short __a, vector signed short __b,
4214              vector signed short __c) {
4215  return __builtin_altivec_vmhaddshs(__a, __b, __c);
4216}
4217
4218/* vec_msub */
4219
4220#ifdef __VSX__
4221static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4222                                                     vector float __b,
4223                                                     vector float __c) {
4224  return __builtin_vsx_xvmsubasp(__a, __b, __c);
4225}
4226
4227static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4228                                                      vector double __b,
4229                                                      vector double __c) {
4230  return __builtin_vsx_xvmsubadp(__a, __b, __c);
4231}
4232#endif
4233
4234/* vec_max */
4235
4236static __inline__ vector signed char __ATTRS_o_ai
4237vec_max(vector signed char __a, vector signed char __b) {
4238  return __builtin_altivec_vmaxsb(__a, __b);
4239}
4240
4241static __inline__ vector signed char __ATTRS_o_ai
4242vec_max(vector bool char __a, vector signed char __b) {
4243  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4244}
4245
4246static __inline__ vector signed char __ATTRS_o_ai
4247vec_max(vector signed char __a, vector bool char __b) {
4248  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4249}
4250
4251static __inline__ vector unsigned char __ATTRS_o_ai
4252vec_max(vector unsigned char __a, vector unsigned char __b) {
4253  return __builtin_altivec_vmaxub(__a, __b);
4254}
4255
4256static __inline__ vector unsigned char __ATTRS_o_ai
4257vec_max(vector bool char __a, vector unsigned char __b) {
4258  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4259}
4260
4261static __inline__ vector unsigned char __ATTRS_o_ai
4262vec_max(vector unsigned char __a, vector bool char __b) {
4263  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4264}
4265
4266static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4267                                                    vector short __b) {
4268  return __builtin_altivec_vmaxsh(__a, __b);
4269}
4270
4271static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4272                                                    vector short __b) {
4273  return __builtin_altivec_vmaxsh((vector short)__a, __b);
4274}
4275
4276static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4277                                                    vector bool short __b) {
4278  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4279}
4280
4281static __inline__ vector unsigned short __ATTRS_o_ai
4282vec_max(vector unsigned short __a, vector unsigned short __b) {
4283  return __builtin_altivec_vmaxuh(__a, __b);
4284}
4285
4286static __inline__ vector unsigned short __ATTRS_o_ai
4287vec_max(vector bool short __a, vector unsigned short __b) {
4288  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4289}
4290
4291static __inline__ vector unsigned short __ATTRS_o_ai
4292vec_max(vector unsigned short __a, vector bool short __b) {
4293  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4294}
4295
4296static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4297                                                  vector int __b) {
4298  return __builtin_altivec_vmaxsw(__a, __b);
4299}
4300
4301static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4302                                                  vector int __b) {
4303  return __builtin_altivec_vmaxsw((vector int)__a, __b);
4304}
4305
4306static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4307                                                  vector bool int __b) {
4308  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4309}
4310
4311static __inline__ vector unsigned int __ATTRS_o_ai
4312vec_max(vector unsigned int __a, vector unsigned int __b) {
4313  return __builtin_altivec_vmaxuw(__a, __b);
4314}
4315
4316static __inline__ vector unsigned int __ATTRS_o_ai
4317vec_max(vector bool int __a, vector unsigned int __b) {
4318  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4319}
4320
4321static __inline__ vector unsigned int __ATTRS_o_ai
4322vec_max(vector unsigned int __a, vector bool int __b) {
4323  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4324}
4325
4326#ifdef __POWER8_VECTOR__
4327static __inline__ vector signed long long __ATTRS_o_ai
4328vec_max(vector signed long long __a, vector signed long long __b) {
4329  return __builtin_altivec_vmaxsd(__a, __b);
4330}
4331
4332static __inline__ vector signed long long __ATTRS_o_ai
4333vec_max(vector bool long long __a, vector signed long long __b) {
4334  return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4335}
4336
4337static __inline__ vector signed long long __ATTRS_o_ai
4338vec_max(vector signed long long __a, vector bool long long __b) {
4339  return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4340}
4341
4342static __inline__ vector unsigned long long __ATTRS_o_ai
4343vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4344  return __builtin_altivec_vmaxud(__a, __b);
4345}
4346
4347static __inline__ vector unsigned long long __ATTRS_o_ai
4348vec_max(vector bool long long __a, vector unsigned long long __b) {
4349  return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4350}
4351
4352static __inline__ vector unsigned long long __ATTRS_o_ai
4353vec_max(vector unsigned long long __a, vector bool long long __b) {
4354  return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4355}
4356#endif
4357
4358static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4359                                                    vector float __b) {
4360#ifdef __VSX__
4361  return __builtin_vsx_xvmaxsp(__a, __b);
4362#else
4363  return __builtin_altivec_vmaxfp(__a, __b);
4364#endif
4365}
4366
4367#ifdef __VSX__
4368static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4369                                                     vector double __b) {
4370  return __builtin_vsx_xvmaxdp(__a, __b);
4371}
4372#endif
4373
4374/* vec_vmaxsb */
4375
4376static __inline__ vector signed char __ATTRS_o_ai
4377vec_vmaxsb(vector signed char __a, vector signed char __b) {
4378  return __builtin_altivec_vmaxsb(__a, __b);
4379}
4380
4381static __inline__ vector signed char __ATTRS_o_ai
4382vec_vmaxsb(vector bool char __a, vector signed char __b) {
4383  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4384}
4385
4386static __inline__ vector signed char __ATTRS_o_ai
4387vec_vmaxsb(vector signed char __a, vector bool char __b) {
4388  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4389}
4390
4391/* vec_vmaxub */
4392
4393static __inline__ vector unsigned char __ATTRS_o_ai
4394vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4395  return __builtin_altivec_vmaxub(__a, __b);
4396}
4397
4398static __inline__ vector unsigned char __ATTRS_o_ai
4399vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4400  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4401}
4402
4403static __inline__ vector unsigned char __ATTRS_o_ai
4404vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4405  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4406}
4407
4408/* vec_vmaxsh */
4409
4410static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4411                                                       vector short __b) {
4412  return __builtin_altivec_vmaxsh(__a, __b);
4413}
4414
4415static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4416                                                       vector short __b) {
4417  return __builtin_altivec_vmaxsh((vector short)__a, __b);
4418}
4419
4420static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4421                                                       vector bool short __b) {
4422  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4423}
4424
4425/* vec_vmaxuh */
4426
4427static __inline__ vector unsigned short __ATTRS_o_ai
4428vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4429  return __builtin_altivec_vmaxuh(__a, __b);
4430}
4431
4432static __inline__ vector unsigned short __ATTRS_o_ai
4433vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4434  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4435}
4436
4437static __inline__ vector unsigned short __ATTRS_o_ai
4438vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4439  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4440}
4441
4442/* vec_vmaxsw */
4443
4444static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4445                                                     vector int __b) {
4446  return __builtin_altivec_vmaxsw(__a, __b);
4447}
4448
4449static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4450                                                     vector int __b) {
4451  return __builtin_altivec_vmaxsw((vector int)__a, __b);
4452}
4453
4454static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4455                                                     vector bool int __b) {
4456  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4457}
4458
4459/* vec_vmaxuw */
4460
4461static __inline__ vector unsigned int __ATTRS_o_ai
4462vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4463  return __builtin_altivec_vmaxuw(__a, __b);
4464}
4465
4466static __inline__ vector unsigned int __ATTRS_o_ai
4467vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4468  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4469}
4470
4471static __inline__ vector unsigned int __ATTRS_o_ai
4472vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4473  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4474}
4475
4476/* vec_vmaxfp */
4477
4478static __inline__ vector float __attribute__((__always_inline__))
4479vec_vmaxfp(vector float __a, vector float __b) {
4480#ifdef __VSX__
4481  return __builtin_vsx_xvmaxsp(__a, __b);
4482#else
4483  return __builtin_altivec_vmaxfp(__a, __b);
4484#endif
4485}
4486
4487/* vec_mergeh */
4488
4489static __inline__ vector signed char __ATTRS_o_ai
4490vec_mergeh(vector signed char __a, vector signed char __b) {
4491  return vec_perm(__a, __b,
4492                  (vector unsigned char)(0x000x100x010x110x020x12,
4493                                         0x030x130x040x140x050x15,
4494                                         0x060x160x070x17));
4495}
4496
4497static __inline__ vector unsigned char __ATTRS_o_ai
4498vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4499  return vec_perm(__a, __b,
4500                  (vector unsigned char)(0x000x100x010x110x020x12,
4501                                         0x030x130x040x140x050x15,
4502                                         0x060x160x070x17));
4503}
4504
4505static __inline__ vector bool char __ATTRS_o_ai
4506vec_mergeh(vector bool char __a, vector bool char __b) {
4507  return vec_perm(__a, __b,
4508                  (vector unsigned char)(0x000x100x010x110x020x12,
4509                                         0x030x130x040x140x050x15,
4510                                         0x060x160x070x17));
4511}
4512
4513static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4514                                                       vector short __b) {
4515  return vec_perm(__a, __b,
4516                  (vector unsigned char)(0x000x010x100x110x020x03,
4517                                         0x120x130x040x050x140x15,
4518                                         0x060x070x160x17));
4519}
4520
4521static __inline__ vector unsigned short __ATTRS_o_ai
4522vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4523  return vec_perm(__a, __b,
4524                  (vector unsigned char)(0x000x010x100x110x020x03,
4525                                         0x120x130x040x050x140x15,
4526                                         0x060x070x160x17));
4527}
4528
4529static __inline__ vector bool short __ATTRS_o_ai
4530vec_mergeh(vector bool short __a, vector bool short __b) {
4531  return vec_perm(__a, __b,
4532                  (vector unsigned char)(0x000x010x100x110x020x03,
4533                                         0x120x130x040x050x140x15,
4534                                         0x060x070x160x17));
4535}
4536
4537static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4538                                                       vector pixel __b) {
4539  return vec_perm(__a, __b,
4540                  (vector unsigned char)(0x000x010x100x110x020x03,
4541                                         0x120x130x040x050x140x15,
4542                                         0x060x070x160x17));
4543}
4544
4545static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4546                                                     vector int __b) {
4547  return vec_perm(__a, __b,
4548                  (vector unsigned char)(0x000x010x020x030x100x11,
4549                                         0x120x130x040x050x060x07,
4550                                         0x140x150x160x17));
4551}
4552
4553static __inline__ vector unsigned int __ATTRS_o_ai
4554vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4555  return vec_perm(__a, __b,
4556                  (vector unsigned char)(0x000x010x020x030x100x11,
4557                                         0x120x130x040x050x060x07,
4558                                         0x140x150x160x17));
4559}
4560
4561static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4562                                                          vector bool int __b) {
4563  return vec_perm(__a, __b,
4564                  (vector unsigned char)(0x000x010x020x030x100x11,
4565                                         0x120x130x040x050x060x07,
4566                                         0x140x150x160x17));
4567}
4568
4569static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4570                                                       vector float __b) {
4571  return vec_perm(__a, __b,
4572                  (vector unsigned char)(0x000x010x020x030x100x11,
4573                                         0x120x130x040x050x060x07,
4574                                         0x140x150x160x17));
4575}
4576
4577#ifdef __VSX__
4578static __inline__ vector signed long long __ATTRS_o_ai
4579vec_mergeh(vector signed long long __a, vector signed long long __b) {
4580  return vec_perm(__a, __b,
4581                  (vector unsigned char)(0x000x010x020x030x040x05,
4582                                         0x060x070x100x110x120x13,
4583                                         0x140x150x160x17));
4584}
4585
4586static __inline__ vector signed long long __ATTRS_o_ai
4587vec_mergeh(vector signed long long __a, vector bool long long __b) {
4588  return vec_perm(__a, (vector signed long long)__b,
4589                  (vector unsigned char)(0x000x010x020x030x040x05,
4590                                         0x060x070x100x110x120x13,
4591                                         0x140x150x160x17));
4592}
4593
4594static __inline__ vector signed long long __ATTRS_o_ai
4595vec_mergeh(vector bool long long __a, vector signed long long __b) {
4596  return vec_perm((vector signed long long)__a, __b,
4597                  (vector unsigned char)(0x000x010x020x030x040x05,
4598                                         0x060x070x100x110x120x13,
4599                                         0x140x150x160x17));
4600}
4601
4602static __inline__ vector unsigned long long __ATTRS_o_ai
4603vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4604  return vec_perm(__a, __b,
4605                  (vector unsigned char)(0x000x010x020x030x040x05,
4606                                         0x060x070x100x110x120x13,
4607                                         0x140x150x160x17));
4608}
4609
4610static __inline__ vector unsigned long long __ATTRS_o_ai
4611vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4612  return vec_perm(__a, (vector unsigned long long)__b,
4613                  (vector unsigned char)(0x000x010x020x030x040x05,
4614                                         0x060x070x100x110x120x13,
4615                                         0x140x150x160x17));
4616}
4617
4618static __inline__ vector unsigned long long __ATTRS_o_ai
4619vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4620  return vec_perm((vector unsigned long long)__a, __b,
4621                  (vector unsigned char)(0x000x010x020x030x040x05,
4622                                         0x060x070x100x110x120x13,
4623                                         0x140x150x160x17));
4624}
4625
4626static __inline__ vector bool long long __ATTRS_o_ai
4627vec_mergeh(vector bool long long __a, vector bool long long __b) {
4628  return vec_perm(__a, __b,
4629                  (vector unsigned char)(0x000x010x020x030x040x05,
4630                                         0x060x070x100x110x120x13,
4631                                         0x140x150x160x17));
4632}
4633
4634static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4635                                                        vector double __b) {
4636  return vec_perm(__a, __b,
4637                  (vector unsigned char)(0x000x010x020x030x040x05,
4638                                         0x060x070x100x110x120x13,
4639                                         0x140x150x160x17));
4640}
4641static __inline__ vector double __ATTRS_o_ai
4642vec_mergeh(vector double __a, vector bool long long __b) {
4643  return vec_perm(__a, (vector double)__b,
4644                  (vector unsigned char)(0x000x010x020x030x040x05,
4645                                         0x060x070x100x110x120x13,
4646                                         0x140x150x160x17));
4647}
4648static __inline__ vector double __ATTRS_o_ai
4649vec_mergeh(vector bool long long __a, vector double __b) {
4650  return vec_perm((vector double)__a, __b,
4651                  (vector unsigned char)(0x000x010x020x030x040x05,
4652                                         0x060x070x100x110x120x13,
4653                                         0x140x150x160x17));
4654}
4655#endif
4656
4657/* vec_vmrghb */
4658
4659#define __builtin_altivec_vmrghb vec_vmrghb
4660
4661static __inline__ vector signed char __ATTRS_o_ai
4662vec_vmrghb(vector signed char __a, vector signed char __b) {
4663  return vec_perm(__a, __b,
4664                  (vector unsigned char)(0x000x100x010x110x020x12,
4665                                         0x030x130x040x140x050x15,
4666                                         0x060x160x070x17));
4667}
4668
4669static __inline__ vector unsigned char __ATTRS_o_ai
4670vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4671  return vec_perm(__a, __b,
4672                  (vector unsigned char)(0x000x100x010x110x020x12,
4673                                         0x030x130x040x140x050x15,
4674                                         0x060x160x070x17));
4675}
4676
4677static __inline__ vector bool char __ATTRS_o_ai
4678vec_vmrghb(vector bool char __a, vector bool char __b) {
4679  return vec_perm(__a, __b,
4680                  (vector unsigned char)(0x000x100x010x110x020x12,
4681                                         0x030x130x040x140x050x15,
4682                                         0x060x160x070x17));
4683}
4684
4685/* vec_vmrghh */
4686
4687#define __builtin_altivec_vmrghh vec_vmrghh
4688
4689static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4690                                                       vector short __b) {
4691  return vec_perm(__a, __b,
4692                  (vector unsigned char)(0x000x010x100x110x020x03,
4693                                         0x120x130x040x050x140x15,
4694                                         0x060x070x160x17));
4695}
4696
4697static __inline__ vector unsigned short __ATTRS_o_ai
4698vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4699  return vec_perm(__a, __b,
4700                  (vector unsigned char)(0x000x010x100x110x020x03,
4701                                         0x120x130x040x050x140x15,
4702                                         0x060x070x160x17));
4703}
4704
4705static __inline__ vector bool short __ATTRS_o_ai
4706vec_vmrghh(vector bool short __a, vector bool short __b) {
4707  return vec_perm(__a, __b,
4708                  (vector unsigned char)(0x000x010x100x110x020x03,
4709                                         0x120x130x040x050x140x15,
4710                                         0x060x070x160x17));
4711}
4712
4713static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4714                                                       vector pixel __b) {
4715  return vec_perm(__a, __b,
4716                  (vector unsigned char)(0x000x010x100x110x020x03,
4717                                         0x120x130x040x050x140x15,
4718                                         0x060x070x160x17));
4719}
4720
4721/* vec_vmrghw */
4722
4723#define __builtin_altivec_vmrghw vec_vmrghw
4724
4725static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4726                                                     vector int __b) {
4727  return vec_perm(__a, __b,
4728                  (vector unsigned char)(0x000x010x020x030x100x11,
4729                                         0x120x130x040x050x060x07,
4730                                         0x140x150x160x17));
4731}
4732
4733static __inline__ vector unsigned int __ATTRS_o_ai
4734vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4735  return vec_perm(__a, __b,
4736                  (vector unsigned char)(0x000x010x020x030x100x11,
4737                                         0x120x130x040x050x060x07,
4738                                         0x140x150x160x17));
4739}
4740
4741static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4742                                                          vector bool int __b) {
4743  return vec_perm(__a, __b,
4744                  (vector unsigned char)(0x000x010x020x030x100x11,
4745                                         0x120x130x040x050x060x07,
4746                                         0x140x150x160x17));
4747}
4748
4749static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4750                                                       vector float __b) {
4751  return vec_perm(__a, __b,
4752                  (vector unsigned char)(0x000x010x020x030x100x11,
4753                                         0x120x130x040x050x060x07,
4754                                         0x140x150x160x17));
4755}
4756
4757/* vec_mergel */
4758
4759static __inline__ vector signed char __ATTRS_o_ai
4760vec_mergel(vector signed char __a, vector signed char __b) {
4761  return vec_perm(__a, __b,
4762                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4763                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4764                                         0x0E0x1E0x0F0x1F));
4765}
4766
4767static __inline__ vector unsigned char __ATTRS_o_ai
4768vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4769  return vec_perm(__a, __b,
4770                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4771                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4772                                         0x0E0x1E0x0F0x1F));
4773}
4774
4775static __inline__ vector bool char __ATTRS_o_ai
4776vec_mergel(vector bool char __a, vector bool char __b) {
4777  return vec_perm(__a, __b,
4778                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4779                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4780                                         0x0E0x1E0x0F0x1F));
4781}
4782
4783static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4784                                                       vector short __b) {
4785  return vec_perm(__a, __b,
4786                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4787                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4788                                         0x0E0x0F0x1E0x1F));
4789}
4790
4791static __inline__ vector unsigned short __ATTRS_o_ai
4792vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4793  return vec_perm(__a, __b,
4794                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4795                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4796                                         0x0E0x0F0x1E0x1F));
4797}
4798
4799static __inline__ vector bool short __ATTRS_o_ai
4800vec_mergel(vector bool short __a, vector bool short __b) {
4801  return vec_perm(__a, __b,
4802                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4803                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4804                                         0x0E0x0F0x1E0x1F));
4805}
4806
4807static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4808                                                       vector pixel __b) {
4809  return vec_perm(__a, __b,
4810                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4811                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4812                                         0x0E0x0F0x1E0x1F));
4813}
4814
4815static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4816                                                     vector int __b) {
4817  return vec_perm(__a, __b,
4818                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
4819                                         0x1A0x1B0x0C0x0D0x0E0x0F,
4820                                         0x1C0x1D0x1E0x1F));
4821}
4822
4823static __inline__ vector unsigned int __ATTRS_o_ai
4824vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4825  return vec_perm(__a, __b,
4826                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
4827                                         0x1A0x1B0x0C0x0D0x0E0x0F,
4828                                         0x1C0x1D0x1E0x1F));
4829}
4830
4831static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4832                                                          vector bool int __b) {
4833  return vec_perm(__a, __b,
4834                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
4835                                         0x1A0x1B0x0C0x0D0x0E0x0F,
4836                                         0x1C0x1D0x1E0x1F));
4837}
4838
4839static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4840                                                       vector float __b) {
4841  return vec_perm(__a, __b,
4842                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
4843                                         0x1A0x1B0x0C0x0D0x0E0x0F,
4844                                         0x1C0x1D0x1E0x1F));
4845}
4846
4847#ifdef __VSX__
4848static __inline__ vector signed long long __ATTRS_o_ai
4849vec_mergel(vector signed long long __a, vector signed long long __b) {
4850  return vec_perm(__a, __b,
4851                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4852                                         0x0E0x0F0x180X190x1A0x1B,
4853                                         0x1C0x1D0x1E0x1F));
4854}
4855static __inline__ vector signed long long __ATTRS_o_ai
4856vec_mergel(vector signed long long __a, vector bool long long __b) {
4857  return vec_perm(__a, (vector signed long long)__b,
4858                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4859                                         0x0E0x0F0x180X190x1A0x1B,
4860                                         0x1C0x1D0x1E0x1F));
4861}
4862static __inline__ vector signed long long __ATTRS_o_ai
4863vec_mergel(vector bool long long __a, vector signed long long __b) {
4864  return vec_perm((vector signed long long)__a, __b,
4865                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4866                                         0x0E0x0F0x180X190x1A0x1B,
4867                                         0x1C0x1D0x1E0x1F));
4868}
4869static __inline__ vector unsigned long long __ATTRS_o_ai
4870vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4871  return vec_perm(__a, __b,
4872                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4873                                         0x0E0x0F0x180X190x1A0x1B,
4874                                         0x1C0x1D0x1E0x1F));
4875}
4876static __inline__ vector unsigned long long __ATTRS_o_ai
4877vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4878  return vec_perm(__a, (vector unsigned long long)__b,
4879                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4880                                         0x0E0x0F0x180X190x1A0x1B,
4881                                         0x1C0x1D0x1E0x1F));
4882}
4883static __inline__ vector unsigned long long __ATTRS_o_ai
4884vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4885  return vec_perm((vector unsigned long long)__a, __b,
4886                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4887                                         0x0E0x0F0x180X190x1A0x1B,
4888                                         0x1C0x1D0x1E0x1F));
4889}
4890static __inline__ vector bool long long __ATTRS_o_ai
4891vec_mergel(vector bool long long __a, vector bool long long __b) {
4892  return vec_perm(__a, __b,
4893                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4894                                         0x0E0x0F0x180X190x1A0x1B,
4895                                         0x1C0x1D0x1E0x1F));
4896}
4897static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4898                                                        vector double __b) {
4899  return vec_perm(__a, __b,
4900                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4901                                         0x0E0x0F0x180X190x1A0x1B,
4902                                         0x1C0x1D0x1E0x1F));
4903}
4904static __inline__ vector double __ATTRS_o_ai
4905vec_mergel(vector double __a, vector bool long long __b) {
4906  return vec_perm(__a, (vector double)__b,
4907                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4908                                         0x0E0x0F0x180X190x1A0x1B,
4909                                         0x1C0x1D0x1E0x1F));
4910}
4911static __inline__ vector double __ATTRS_o_ai
4912vec_mergel(vector bool long long __a, vector double __b) {
4913  return vec_perm((vector double)__a, __b,
4914                  (vector unsigned char)(0x080x090x0A0x0B0x0C0x0D,
4915                                         0x0E0x0F0x180X190x1A0x1B,
4916                                         0x1C0x1D0x1E0x1F));
4917}
4918#endif
4919
4920/* vec_vmrglb */
4921
4922#define __builtin_altivec_vmrglb vec_vmrglb
4923
4924static __inline__ vector signed char __ATTRS_o_ai
4925vec_vmrglb(vector signed char __a, vector signed char __b) {
4926  return vec_perm(__a, __b,
4927                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4928                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4929                                         0x0E0x1E0x0F0x1F));
4930}
4931
4932static __inline__ vector unsigned char __ATTRS_o_ai
4933vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4934  return vec_perm(__a, __b,
4935                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4936                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4937                                         0x0E0x1E0x0F0x1F));
4938}
4939
4940static __inline__ vector bool char __ATTRS_o_ai
4941vec_vmrglb(vector bool char __a, vector bool char __b) {
4942  return vec_perm(__a, __b,
4943                  (vector unsigned char)(0x080x180x090x190x0A0x1A,
4944                                         0x0B0x1B0x0C0x1C0x0D0x1D,
4945                                         0x0E0x1E0x0F0x1F));
4946}
4947
4948/* vec_vmrglh */
4949
4950#define __builtin_altivec_vmrglh vec_vmrglh
4951
4952static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4953                                                       vector short __b) {
4954  return vec_perm(__a, __b,
4955                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4956                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4957                                         0x0E0x0F0x1E0x1F));
4958}
4959
4960static __inline__ vector unsigned short __ATTRS_o_ai
4961vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4962  return vec_perm(__a, __b,
4963                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4964                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4965                                         0x0E0x0F0x1E0x1F));
4966}
4967
4968static __inline__ vector bool short __ATTRS_o_ai
4969vec_vmrglh(vector bool short __a, vector bool short __b) {
4970  return vec_perm(__a, __b,
4971                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4972                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4973                                         0x0E0x0F0x1E0x1F));
4974}
4975
4976static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4977                                                       vector pixel __b) {
4978  return vec_perm(__a, __b,
4979                  (vector unsigned char)(0x080x090x180x190x0A0x0B,
4980                                         0x1A0x1B0x0C0x0D0x1C0x1D,
4981                                         0x0E0x0F0x1E0x1F));
4982}
4983
4984/* vec_vmrglw */
4985
4986#define __builtin_altivec_vmrglw vec_vmrglw
4987
4988static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4989                                                     vector int __b) {
4990  return vec_perm(__a, __b,
4991                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
4992                                         0x1A0x1B0x0C0x0D0x0E0x0F,
4993                                         0x1C0x1D0x1E0x1F));
4994}
4995
4996static __inline__ vector unsigned int __ATTRS_o_ai
4997vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
4998  return vec_perm(__a, __b,
4999                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
5000                                         0x1A0x1B0x0C0x0D0x0E0x0F,
5001                                         0x1C0x1D0x1E0x1F));
5002}
5003
5004static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5005                                                          vector bool int __b) {
5006  return vec_perm(__a, __b,
5007                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
5008                                         0x1A0x1B0x0C0x0D0x0E0x0F,
5009                                         0x1C0x1D0x1E0x1F));
5010}
5011
5012static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5013                                                       vector float __b) {
5014  return vec_perm(__a, __b,
5015                  (vector unsigned char)(0x080x090x0A0x0B0x180x19,
5016                                         0x1A0x1B0x0C0x0D0x0E0x0F,
5017                                         0x1C0x1D0x1E0x1F));
5018}
5019
5020#ifdef __POWER8_VECTOR__
5021/* vec_mergee */
5022
5023static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5024                                                          vector bool int __b) {
5025  return vec_perm(__a, __b,
5026                  (vector unsigned char)(0x000x010x020x030x100x11,
5027                                         0x120x130x080x090x0A0x0B,
5028                                         0x180x190x1A0x1B));
5029}
5030
5031static __inline__ vector signed int __ATTRS_o_ai
5032vec_mergee(vector signed int __a, vector signed int __b) {
5033  return vec_perm(__a, __b,
5034                  (vector unsigned char)(0x000x010x020x030x100x11,
5035                                         0x120x130x080x090x0A0x0B,
5036                                         0x180x190x1A0x1B));
5037}
5038
5039static __inline__ vector unsigned int __ATTRS_o_ai
5040vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5041  return vec_perm(__a, __b,
5042                  (vector unsigned char)(0x000x010x020x030x100x11,
5043                                         0x120x130x080x090x0A0x0B,
5044                                         0x180x190x1A0x1B));
5045}
5046
5047static __inline__ vector bool long long __ATTRS_o_ai
5048vec_mergee(vector bool long long __a, vector bool long long __b) {
5049  return vec_mergeh(__a, __b);
5050}
5051
5052static __inline__ vector signed long long __ATTRS_o_ai
5053vec_mergee(vector signed long long __a, vector signed long long __b) {
5054  return vec_mergeh(__a, __b);
5055}
5056
5057static __inline__ vector unsigned long long __ATTRS_o_ai
5058vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5059  return vec_mergeh(__a, __b);
5060}
5061
5062static __inline__ vector float __ATTRS_o_ai
5063vec_mergee(vector float __a, vector float __b) {
5064  return vec_perm(__a, __b,
5065                  (vector unsigned char)(0x000x010x020x030x100x11,
5066                                         0x120x130x080x090x0A0x0B,
5067                                         0x180x190x1A0x1B));
5068}
5069
5070static __inline__ vector double __ATTRS_o_ai
5071vec_mergee(vector double __a, vector double __b) {
5072  return vec_mergeh(__a, __b);
5073}
5074
5075/* vec_mergeo */
5076
5077static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5078                                                          vector bool int __b) {
5079  return vec_perm(__a, __b,
5080                  (vector unsigned char)(0x040x050x060x070x140x15,
5081                                         0x160x170x0C0x0D0x0E0x0F,
5082                                         0x1C0x1D0x1E0x1F));
5083}
5084
5085static __inline__ vector signed int __ATTRS_o_ai
5086vec_mergeo(vector signed int __a, vector signed int __b) {
5087  return vec_perm(__a, __b,
5088                  (vector unsigned char)(0x040x050x060x070x140x15,
5089                                         0x160x170x0C0x0D0x0E0x0F,
5090                                         0x1C0x1D0x1E0x1F));
5091}
5092
5093static __inline__ vector unsigned int __ATTRS_o_ai
5094vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5095  return vec_perm(__a, __b,
5096                  (vector unsigned char)(0x040x050x060x070x140x15,
5097                                         0x160x170x0C0x0D0x0E0x0F,
5098                                         0x1C0x1D0x1E0x1F));
5099}
5100
5101static __inline__ vector bool long long __ATTRS_o_ai
5102vec_mergeo(vector bool long long __a, vector bool long long __b) {
5103  return vec_mergel(__a, __b);
5104}
5105
5106static __inline__ vector signed long long __ATTRS_o_ai
5107vec_mergeo(vector signed long long __a, vector signed long long __b) {
5108  return vec_mergel(__a, __b);
5109}
5110
5111static __inline__ vector unsigned long long __ATTRS_o_ai
5112vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5113  return vec_mergel(__a, __b);
5114}
5115
5116static __inline__ vector float __ATTRS_o_ai
5117vec_mergeo(vector float __a, vector float __b) {
5118  return vec_perm(__a, __b,
5119                  (vector unsigned char)(0x040x050x060x070x140x15,
5120                                         0x160x170x0C0x0D0x0E0x0F,
5121                                         0x1C0x1D0x1E0x1F));
5122}
5123
5124static __inline__ vector double __ATTRS_o_ai
5125vec_mergeo(vector double __a, vector double __b) {
5126  return vec_mergel(__a, __b);
5127}
5128
5129#endif
5130
5131/* vec_mfvscr */
5132
5133static __inline__ vector unsigned short __attribute__((__always_inline__))
5134vec_mfvscr(void) {
5135  return __builtin_altivec_mfvscr();
5136}
5137
5138/* vec_min */
5139
5140static __inline__ vector signed char __ATTRS_o_ai
5141vec_min(vector signed char __a, vector signed char __b) {
5142  return __builtin_altivec_vminsb(__a, __b);
5143}
5144
5145static __inline__ vector signed char __ATTRS_o_ai
5146vec_min(vector bool char __a, vector signed char __b) {
5147  return __builtin_altivec_vminsb((vector signed char)__a, __b);
5148}
5149
5150static __inline__ vector signed char __ATTRS_o_ai
5151vec_min(vector signed char __a, vector bool char __b) {
5152  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5153}
5154
5155static __inline__ vector unsigned char __ATTRS_o_ai
5156vec_min(vector unsigned char __a, vector unsigned char __b) {
5157  return __builtin_altivec_vminub(__a, __b);
5158}
5159
5160static __inline__ vector unsigned char __ATTRS_o_ai
5161vec_min(vector bool char __a, vector unsigned char __b) {
5162  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5163}
5164
5165static __inline__ vector unsigned char __ATTRS_o_ai
5166vec_min(vector unsigned char __a, vector bool char __b) {
5167  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5168}
5169
5170static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5171                                                    vector short __b) {
5172  return __builtin_altivec_vminsh(__a, __b);
5173}
5174
5175static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5176                                                    vector short __b) {
5177  return __builtin_altivec_vminsh((vector short)__a, __b);
5178}
5179
5180static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5181                                                    vector bool short __b) {
5182  return __builtin_altivec_vminsh(__a, (vector short)__b);
5183}
5184
5185static __inline__ vector unsigned short __ATTRS_o_ai
5186vec_min(vector unsigned short __a, vector unsigned short __b) {
5187  return __builtin_altivec_vminuh(__a, __b);
5188}
5189
5190static __inline__ vector unsigned short __ATTRS_o_ai
5191vec_min(vector bool short __a, vector unsigned short __b) {
5192  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5193}
5194
5195static __inline__ vector unsigned short __ATTRS_o_ai
5196vec_min(vector unsigned short __a, vector bool short __b) {
5197  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5198}
5199
5200static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5201                                                  vector int __b) {
5202  return __builtin_altivec_vminsw(__a, __b);
5203}
5204
5205static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5206                                                  vector int __b) {
5207  return __builtin_altivec_vminsw((vector int)__a, __b);
5208}
5209
5210static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5211                                                  vector bool int __b) {
5212  return __builtin_altivec_vminsw(__a, (vector int)__b);
5213}
5214
5215static __inline__ vector unsigned int __ATTRS_o_ai
5216vec_min(vector unsigned int __a, vector unsigned int __b) {
5217  return __builtin_altivec_vminuw(__a, __b);
5218}
5219
5220static __inline__ vector unsigned int __ATTRS_o_ai
5221vec_min(vector bool int __a, vector unsigned int __b) {
5222  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5223}
5224
5225static __inline__ vector unsigned int __ATTRS_o_ai
5226vec_min(vector unsigned int __a, vector bool int __b) {
5227  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5228}
5229
5230#ifdef __POWER8_VECTOR__
5231static __inline__ vector signed long long __ATTRS_o_ai
5232vec_min(vector signed long long __a, vector signed long long __b) {
5233  return __builtin_altivec_vminsd(__a, __b);
5234}
5235
5236static __inline__ vector signed long long __ATTRS_o_ai
5237vec_min(vector bool long long __a, vector signed long long __b) {
5238  return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5239}
5240
5241static __inline__ vector signed long long __ATTRS_o_ai
5242vec_min(vector signed long long __a, vector bool long long __b) {
5243  return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5244}
5245
5246static __inline__ vector unsigned long long __ATTRS_o_ai
5247vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5248  return __builtin_altivec_vminud(__a, __b);
5249}
5250
5251static __inline__ vector unsigned long long __ATTRS_o_ai
5252vec_min(vector bool long long __a, vector unsigned long long __b) {
5253  return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5254}
5255
5256static __inline__ vector unsigned long long __ATTRS_o_ai
5257vec_min(vector unsigned long long __a, vector bool long long __b) {
5258  return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5259}
5260#endif
5261
5262static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5263                                                    vector float __b) {
5264#ifdef __VSX__
5265  return __builtin_vsx_xvminsp(__a, __b);
5266#else
5267  return __builtin_altivec_vminfp(__a, __b);
5268#endif
5269}
5270
5271#ifdef __VSX__
5272static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5273                                                     vector double __b) {
5274  return __builtin_vsx_xvmindp(__a, __b);
5275}
5276#endif
5277
5278/* vec_vminsb */
5279
5280static __inline__ vector signed char __ATTRS_o_ai
5281vec_vminsb(vector signed char __a, vector signed char __b) {
5282  return __builtin_altivec_vminsb(__a, __b);
5283}
5284
5285static __inline__ vector signed char __ATTRS_o_ai
5286vec_vminsb(vector bool char __a, vector signed char __b) {
5287  return __builtin_altivec_vminsb((vector signed char)__a, __b);
5288}
5289
5290static __inline__ vector signed char __ATTRS_o_ai
5291vec_vminsb(vector signed char __a, vector bool char __b) {
5292  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5293}
5294
5295/* vec_vminub */
5296
5297static __inline__ vector unsigned char __ATTRS_o_ai
5298vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5299  return __builtin_altivec_vminub(__a, __b);
5300}
5301
5302static __inline__ vector unsigned char __ATTRS_o_ai
5303vec_vminub(vector bool char __a, vector unsigned char __b) {
5304  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5305}
5306
5307static __inline__ vector unsigned char __ATTRS_o_ai
5308vec_vminub(vector unsigned char __a, vector bool char __b) {
5309  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5310}
5311
5312/* vec_vminsh */
5313
5314static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5315                                                       vector short __b) {
5316  return __builtin_altivec_vminsh(__a, __b);
5317}
5318
5319static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5320                                                       vector short __b) {
5321  return __builtin_altivec_vminsh((vector short)__a, __b);
5322}
5323
5324static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5325                                                       vector bool short __b) {
5326  return __builtin_altivec_vminsh(__a, (vector short)__b);
5327}
5328
5329/* vec_vminuh */
5330
5331static __inline__ vector unsigned short __ATTRS_o_ai
5332vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5333  return __builtin_altivec_vminuh(__a, __b);
5334}
5335
5336static __inline__ vector unsigned short __ATTRS_o_ai
5337vec_vminuh(vector bool short __a, vector unsigned short __b) {
5338  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5339}
5340
5341static __inline__ vector unsigned short __ATTRS_o_ai
5342vec_vminuh(vector unsigned short __a, vector bool short __b) {
5343  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5344}
5345
5346/* vec_vminsw */
5347
5348static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5349                                                     vector int __b) {
5350  return __builtin_altivec_vminsw(__a, __b);
5351}
5352
5353static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5354                                                     vector int __b) {
5355  return __builtin_altivec_vminsw((vector int)__a, __b);
5356}
5357
5358static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5359                                                     vector bool int __b) {
5360  return __builtin_altivec_vminsw(__a, (vector int)__b);
5361}
5362
5363/* vec_vminuw */
5364
5365static __inline__ vector unsigned int __ATTRS_o_ai
5366vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5367  return __builtin_altivec_vminuw(__a, __b);
5368}
5369
5370static __inline__ vector unsigned int __ATTRS_o_ai
5371vec_vminuw(vector bool int __a, vector unsigned int __b) {
5372  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5373}
5374
5375static __inline__ vector unsigned int __ATTRS_o_ai
5376vec_vminuw(vector unsigned int __a, vector bool int __b) {
5377  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5378}
5379
5380/* vec_vminfp */
5381
5382static __inline__ vector float __attribute__((__always_inline__))
5383vec_vminfp(vector float __a, vector float __b) {
5384#ifdef __VSX__
5385  return __builtin_vsx_xvminsp(__a, __b);
5386#else
5387  return __builtin_altivec_vminfp(__a, __b);
5388#endif
5389}
5390
5391/* vec_mladd */
5392
5393#define __builtin_altivec_vmladduhm vec_mladd
5394
5395static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5396                                                      vector short __b,
5397                                                      vector short __c) {
5398  return __a * __b + __c;
5399}
5400
5401static __inline__ vector short __ATTRS_o_ai vec_mladd(
5402    vector short __a, vector unsigned short __b, vector unsigned short __c) {
5403  return __a * (vector short)__b + (vector short)__c;
5404}
5405
5406static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5407                                                      vector short __b,
5408                                                      vector short __c) {
5409  return (vector short)__a * __b + __c;
5410}
5411
5412static __inline__ vector unsigned short __ATTRS_o_ai
5413vec_mladd(vector unsigned short __a, vector unsigned short __b,
5414          vector unsigned short __c) {
5415  return __a * __b + __c;
5416}
5417
5418/* vec_vmladduhm */
5419
5420static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5421                                                          vector short __b,
5422                                                          vector short __c) {
5423  return __a * __b + __c;
5424}
5425
5426static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5427    vector short __a, vector unsigned short __b, vector unsigned short __c) {
5428  return __a * (vector short)__b + (vector short)__c;
5429}
5430
5431static __inline__ vector short __ATTRS_o_ai
5432vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5433  return (vector short)__a * __b + __c;
5434}
5435
5436static __inline__ vector unsigned short __ATTRS_o_ai
5437vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5438              vector unsigned short __c) {
5439  return __a * __b + __c;
5440}
5441
5442/* vec_mradds */
5443
5444static __inline__ vector short __attribute__((__always_inline__))
5445vec_mradds(vector short __a, vector short __b, vector short __c) {
5446  return __builtin_altivec_vmhraddshs(__a, __b, __c);
5447}
5448
5449/* vec_vmhraddshs */
5450
5451static __inline__ vector short __attribute__((__always_inline__))
5452vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5453  return __builtin_altivec_vmhraddshs(__a, __b, __c);
5454}
5455
5456/* vec_msum */
5457
5458static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5459                                                   vector unsigned char __b,
5460                                                   vector int __c) {
5461  return __builtin_altivec_vmsummbm(__a, __b, __c);
5462}
5463
5464static __inline__ vector unsigned int __ATTRS_o_ai
5465vec_msum(vector unsigned char __a, vector unsigned char __b,
5466         vector unsigned int __c) {
5467  return __builtin_altivec_vmsumubm(__a, __b, __c);
5468}
5469
5470static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5471                                                   vector short __b,
5472                                                   vector int __c) {
5473  return __builtin_altivec_vmsumshm(__a, __b, __c);
5474}
5475
5476static __inline__ vector unsigned int __ATTRS_o_ai
5477vec_msum(vector unsigned short __a, vector unsigned short __b,
5478         vector unsigned int __c) {
5479  return __builtin_altivec_vmsumuhm(__a, __b, __c);
5480}
5481
5482/* vec_vmsummbm */
5483
5484static __inline__ vector int __attribute__((__always_inline__))
5485vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5486  return __builtin_altivec_vmsummbm(__a, __b, __c);
5487}
5488
5489/* vec_vmsumubm */
5490
5491static __inline__ vector unsigned int __attribute__((__always_inline__))
5492vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5493             vector unsigned int __c) {
5494  return __builtin_altivec_vmsumubm(__a, __b, __c);
5495}
5496
5497/* vec_vmsumshm */
5498
5499static __inline__ vector int __attribute__((__always_inline__))
5500vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5501  return __builtin_altivec_vmsumshm(__a, __b, __c);
5502}
5503
5504/* vec_vmsumuhm */
5505
5506static __inline__ vector unsigned int __attribute__((__always_inline__))
5507vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5508             vector unsigned int __c) {
5509  return __builtin_altivec_vmsumuhm(__a, __b, __c);
5510}
5511
5512/* vec_msums */
5513
5514static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5515                                                    vector short __b,
5516                                                    vector int __c) {
5517  return __builtin_altivec_vmsumshs(__a, __b, __c);
5518}
5519
5520static __inline__ vector unsigned int __ATTRS_o_ai
5521vec_msums(vector unsigned short __a, vector unsigned short __b,
5522          vector unsigned int __c) {
5523  return __builtin_altivec_vmsumuhs(__a, __b, __c);
5524}
5525
5526/* vec_vmsumshs */
5527
5528static __inline__ vector int __attribute__((__always_inline__))
5529vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5530  return __builtin_altivec_vmsumshs(__a, __b, __c);
5531}
5532
5533/* vec_vmsumuhs */
5534
5535static __inline__ vector unsigned int __attribute__((__always_inline__))
5536vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5537             vector unsigned int __c) {
5538  return __builtin_altivec_vmsumuhs(__a, __b, __c);
5539}
5540
5541/* vec_mtvscr */
5542
5543static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5544  __builtin_altivec_mtvscr((vector int)__a);
5545}
5546
5547static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5548  __builtin_altivec_mtvscr((vector int)__a);
5549}
5550
5551static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5552  __builtin_altivec_mtvscr((vector int)__a);
5553}
5554
5555static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5556  __builtin_altivec_mtvscr((vector int)__a);
5557}
5558
5559static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5560  __builtin_altivec_mtvscr((vector int)__a);
5561}
5562
5563static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5564  __builtin_altivec_mtvscr((vector int)__a);
5565}
5566
5567static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5568  __builtin_altivec_mtvscr((vector int)__a);
5569}
5570
5571static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5572  __builtin_altivec_mtvscr((vector int)__a);
5573}
5574
5575static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5576  __builtin_altivec_mtvscr((vector int)__a);
5577}
5578
5579static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5580  __builtin_altivec_mtvscr((vector int)__a);
5581}
5582
5583static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5584  __builtin_altivec_mtvscr((vector int)__a);
5585}
5586
5587/* vec_mul */
5588
5589/* Integer vector multiplication will involve multiplication of the odd/even
5590   elements separately, then truncating the results and moving to the
5591   result vector.
5592*/
5593static __inline__ vector signed char __ATTRS_o_ai
5594vec_mul(vector signed char __a, vector signed char __b) {
5595  return __a * __b;
5596}
5597
5598static __inline__ vector unsigned char __ATTRS_o_ai
5599vec_mul(vector unsigned char __a, vector unsigned char __b) {
5600  return __a * __b;
5601}
5602
5603static __inline__ vector signed short __ATTRS_o_ai
5604vec_mul(vector signed short __a, vector signed short __b) {
5605  return __a * __b;
5606}
5607
5608static __inline__ vector unsigned short __ATTRS_o_ai
5609vec_mul(vector unsigned short __a, vector unsigned short __b) {
5610  return __a * __b;
5611}
5612
5613static __inline__ vector signed int __ATTRS_o_ai
5614vec_mul(vector signed int __a, vector signed int __b) {
5615  return __a * __b;
5616}
5617
5618static __inline__ vector unsigned int __ATTRS_o_ai
5619vec_mul(vector unsigned int __a, vector unsigned int __b) {
5620  return __a * __b;
5621}
5622
5623#ifdef __VSX__
5624static __inline__ vector signed long long __ATTRS_o_ai
5625vec_mul(vector signed long long __a, vector signed long long __b) {
5626  return __a * __b;
5627}
5628
5629static __inline__ vector unsigned long long __ATTRS_o_ai
5630vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5631  return __a * __b;
5632}
5633#endif
5634
5635static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5636                                                    vector float __b) {
5637  return __a * __b;
5638}
5639
5640#ifdef __VSX__
5641static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5642                                                     vector double __b) {
5643  return __a * __b;
5644}
5645#endif
5646
5647/* The vmulos* and vmules* instructions have a big endian bias, so
5648   we must reverse the meaning of "even" and "odd" for little endian.  */
5649
5650/* vec_mule */
5651
5652static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5653                                                     vector signed char __b) {
5654#ifdef __LITTLE_ENDIAN__
5655  return __builtin_altivec_vmulosb(__a, __b);
5656#else
5657  return __builtin_altivec_vmulesb(__a, __b);
5658#endif
5659}
5660
5661static __inline__ vector unsigned short __ATTRS_o_ai
5662vec_mule(vector unsigned char __a, vector unsigned char __b) {
5663#ifdef __LITTLE_ENDIAN__
5664  return __builtin_altivec_vmuloub(__a, __b);
5665#else
5666  return __builtin_altivec_vmuleub(__a, __b);
5667#endif
5668}
5669
5670static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5671                                                   vector short __b) {
5672#ifdef __LITTLE_ENDIAN__
5673  return __builtin_altivec_vmulosh(__a, __b);
5674#else
5675  return __builtin_altivec_vmulesh(__a, __b);
5676#endif
5677}
5678
5679static __inline__ vector unsigned int __ATTRS_o_ai
5680vec_mule(vector unsigned short __a, vector unsigned short __b) {
5681#ifdef __LITTLE_ENDIAN__
5682  return __builtin_altivec_vmulouh(__a, __b);
5683#else
5684  return __builtin_altivec_vmuleuh(__a, __b);
5685#endif
5686}
5687
5688#ifdef __POWER8_VECTOR__
5689static __inline__ vector signed long long __ATTRS_o_ai
5690vec_mule(vector signed int __a, vector signed int __b) {
5691#ifdef __LITTLE_ENDIAN__
5692  return __builtin_altivec_vmulosw(__a, __b);
5693#else
5694  return __builtin_altivec_vmulesw(__a, __b);
5695#endif
5696}
5697
5698static __inline__ vector unsigned long long __ATTRS_o_ai
5699vec_mule(vector unsigned int __a, vector unsigned int __b) {
5700#ifdef __LITTLE_ENDIAN__
5701  return __builtin_altivec_vmulouw(__a, __b);
5702#else
5703  return __builtin_altivec_vmuleuw(__a, __b);
5704#endif
5705}
5706#endif
5707
5708/* vec_vmulesb */
5709
5710static __inline__ vector short __attribute__((__always_inline__))
5711vec_vmulesb(vector signed char __a, vector signed char __b) {
5712#ifdef __LITTLE_ENDIAN__
5713  return __builtin_altivec_vmulosb(__a, __b);
5714#else
5715  return __builtin_altivec_vmulesb(__a, __b);
5716#endif
5717}
5718
5719/* vec_vmuleub */
5720
5721static __inline__ vector unsigned short __attribute__((__always_inline__))
5722vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5723#ifdef __LITTLE_ENDIAN__
5724  return __builtin_altivec_vmuloub(__a, __b);
5725#else
5726  return __builtin_altivec_vmuleub(__a, __b);
5727#endif
5728}
5729
5730/* vec_vmulesh */
5731
5732static __inline__ vector int __attribute__((__always_inline__))
5733vec_vmulesh(vector short __a, vector short __b) {
5734#ifdef __LITTLE_ENDIAN__
5735  return __builtin_altivec_vmulosh(__a, __b);
5736#else
5737  return __builtin_altivec_vmulesh(__a, __b);
5738#endif
5739}
5740
5741/* vec_vmuleuh */
5742
5743static __inline__ vector unsigned int __attribute__((__always_inline__))
5744vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5745#ifdef __LITTLE_ENDIAN__
5746  return __builtin_altivec_vmulouh(__a, __b);
5747#else
5748  return __builtin_altivec_vmuleuh(__a, __b);
5749#endif
5750}
5751
5752/* vec_mulo */
5753
5754static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5755                                                     vector signed char __b) {
5756#ifdef __LITTLE_ENDIAN__
5757  return __builtin_altivec_vmulesb(__a, __b);
5758#else
5759  return __builtin_altivec_vmulosb(__a, __b);
5760#endif
5761}
5762
5763static __inline__ vector unsigned short __ATTRS_o_ai
5764vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5765#ifdef __LITTLE_ENDIAN__
5766  return __builtin_altivec_vmuleub(__a, __b);
5767#else
5768  return __builtin_altivec_vmuloub(__a, __b);
5769#endif
5770}
5771
5772static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5773                                                   vector short __b) {
5774#ifdef __LITTLE_ENDIAN__
5775  return __builtin_altivec_vmulesh(__a, __b);
5776#else
5777  return __builtin_altivec_vmulosh(__a, __b);
5778#endif
5779}
5780
5781static __inline__ vector unsigned int __ATTRS_o_ai
5782vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5783#ifdef __LITTLE_ENDIAN__
5784  return __builtin_altivec_vmuleuh(__a, __b);
5785#else
5786  return __builtin_altivec_vmulouh(__a, __b);
5787#endif
5788}
5789
5790#ifdef __POWER8_VECTOR__
5791static __inline__ vector signed long long __ATTRS_o_ai
5792vec_mulo(vector signed int __a, vector signed int __b) {
5793#ifdef __LITTLE_ENDIAN__
5794  return __builtin_altivec_vmulesw(__a, __b);
5795#else
5796  return __builtin_altivec_vmulosw(__a, __b);
5797#endif
5798}
5799
5800static __inline__ vector unsigned long long __ATTRS_o_ai
5801vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5802#ifdef __LITTLE_ENDIAN__
5803  return __builtin_altivec_vmuleuw(__a, __b);
5804#else
5805  return __builtin_altivec_vmulouw(__a, __b);
5806#endif
5807}
5808#endif
5809
5810/* vec_vmulosb */
5811
5812static __inline__ vector short __attribute__((__always_inline__))
5813vec_vmulosb(vector signed char __a, vector signed char __b) {
5814#ifdef __LITTLE_ENDIAN__
5815  return __builtin_altivec_vmulesb(__a, __b);
5816#else
5817  return __builtin_altivec_vmulosb(__a, __b);
5818#endif
5819}
5820
5821/* vec_vmuloub */
5822
5823static __inline__ vector unsigned short __attribute__((__always_inline__))
5824vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5825#ifdef __LITTLE_ENDIAN__
5826  return __builtin_altivec_vmuleub(__a, __b);
5827#else
5828  return __builtin_altivec_vmuloub(__a, __b);
5829#endif
5830}
5831
5832/* vec_vmulosh */
5833
5834static __inline__ vector int __attribute__((__always_inline__))
5835vec_vmulosh(vector short __a, vector short __b) {
5836#ifdef __LITTLE_ENDIAN__
5837  return __builtin_altivec_vmulesh(__a, __b);
5838#else
5839  return __builtin_altivec_vmulosh(__a, __b);
5840#endif
5841}
5842
5843/* vec_vmulouh */
5844
5845static __inline__ vector unsigned int __attribute__((__always_inline__))
5846vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5847#ifdef __LITTLE_ENDIAN__
5848  return __builtin_altivec_vmuleuh(__a, __b);
5849#else
5850  return __builtin_altivec_vmulouh(__a, __b);
5851#endif
5852}
5853
5854/*  vec_nand */
5855
5856#ifdef __POWER8_VECTOR__
5857static __inline__ vector signed char __ATTRS_o_ai
5858vec_nand(vector signed char __a, vector signed char __b) {
5859  return ~(__a & __b);
5860}
5861
5862static __inline__ vector signed char __ATTRS_o_ai
5863vec_nand(vector signed char __a, vector bool char __b) {
5864  return ~(__a & __b);
5865}
5866
5867static __inline__ vector signed char __ATTRS_o_ai
5868vec_nand(vector bool char __a, vector signed char __b) {
5869  return ~(__a & __b);
5870}
5871
5872static __inline__ vector unsigned char __ATTRS_o_ai
5873vec_nand(vector unsigned char __a, vector unsigned char __b) {
5874  return ~(__a & __b);
5875}
5876
5877static __inline__ vector unsigned char __ATTRS_o_ai
5878vec_nand(vector unsigned char __a, vector bool char __b) {
5879  return ~(__a & __b);
5880}
5881
5882static __inline__ vector unsigned char __ATTRS_o_ai
5883vec_nand(vector bool char __a, vector unsigned char __b) {
5884  return ~(__a & __b);
5885}
5886
5887static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5888                                                         vector bool char __b) {
5889  return ~(__a & __b);
5890}
5891
5892static __inline__ vector signed short __ATTRS_o_ai
5893vec_nand(vector signed short __a, vector signed short __b) {
5894  return ~(__a & __b);
5895}
5896
5897static __inline__ vector signed short __ATTRS_o_ai
5898vec_nand(vector signed short __a, vector bool short __b) {
5899  return ~(__a & __b);
5900}
5901
5902static __inline__ vector signed short __ATTRS_o_ai
5903vec_nand(vector bool short __a, vector signed short __b) {
5904  return ~(__a & __b);
5905}
5906
5907static __inline__ vector unsigned short __ATTRS_o_ai
5908vec_nand(vector unsigned short __a, vector unsigned short __b) {
5909  return ~(__a & __b);
5910}
5911
5912static __inline__ vector unsigned short __ATTRS_o_ai
5913vec_nand(vector unsigned short __a, vector bool short __b) {
5914  return ~(__a & __b);
5915}
5916
5917static __inline__ vector bool short __ATTRS_o_ai
5918vec_nand(vector bool short __a, vector bool short __b) {
5919  return ~(__a & __b);
5920}
5921
5922static __inline__ vector signed int __ATTRS_o_ai
5923vec_nand(vector signed int __a, vector signed int __b) {
5924  return ~(__a & __b);
5925}
5926
5927static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5928                                                          vector bool int __b) {
5929  return ~(__a & __b);
5930}
5931
5932static __inline__ vector signed int __ATTRS_o_ai
5933vec_nand(vector bool int __a, vector signed int __b) {
5934  return ~(__a & __b);
5935}
5936
5937static __inline__ vector unsigned int __ATTRS_o_ai
5938vec_nand(vector unsigned int __a, vector unsigned int __b) {
5939  return ~(__a & __b);
5940}
5941
5942static __inline__ vector unsigned int __ATTRS_o_ai
5943vec_nand(vector unsigned int __a, vector bool int __b) {
5944  return ~(__a & __b);
5945}
5946
5947static __inline__ vector unsigned int __ATTRS_o_ai
5948vec_nand(vector bool int __a, vector unsigned int __b) {
5949  return ~(__a & __b);
5950}
5951
5952static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5953                                                        vector bool int __b) {
5954  return ~(__a & __b);
5955}
5956
5957static __inline__ vector float __ATTRS_o_ai
5958vec_nand(vector float __a, vector float __b) {
5959  return (vector float)(~((vector unsigned int)__a &
5960                          (vector unsigned int)__b));
5961}
5962
5963static __inline__ vector signed long long __ATTRS_o_ai
5964vec_nand(vector signed long long __a, vector signed long long __b) {
5965  return ~(__a & __b);
5966}
5967
5968static __inline__ vector signed long long __ATTRS_o_ai
5969vec_nand(vector signed long long __a, vector bool long long __b) {
5970  return ~(__a & __b);
5971}
5972
5973static __inline__ vector signed long long __ATTRS_o_ai
5974vec_nand(vector bool long long __a, vector signed long long __b) {
5975  return ~(__a & __b);
5976}
5977
5978static __inline__ vector unsigned long long __ATTRS_o_ai
5979vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5980  return ~(__a & __b);
5981}
5982
5983static __inline__ vector unsigned long long __ATTRS_o_ai
5984vec_nand(vector unsigned long long __a, vector bool long long __b) {
5985  return ~(__a & __b);
5986}
5987
5988static __inline__ vector unsigned long long __ATTRS_o_ai
5989vec_nand(vector bool long long __a, vector unsigned long long __b) {
5990  return ~(__a & __b);
5991}
5992
5993static __inline__ vector bool long long __ATTRS_o_ai
5994vec_nand(vector bool long long __a, vector bool long long __b) {
5995  return ~(__a & __b);
5996}
5997
5998static __inline__ vector double __ATTRS_o_ai
5999vec_nand(vector double __a, vector double __b) {
6000  return (vector double)(~((vector unsigned long long)__a &
6001                           (vector unsigned long long)__b));
6002}
6003
6004#endif
6005
6006/* vec_nmadd */
6007
6008#ifdef __VSX__
6009static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6010                                                      vector float __b,
6011                                                      vector float __c) {
6012  return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6013}
6014
6015static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6016                                                       vector double __b,
6017                                                       vector double __c) {
6018  return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6019}
6020#endif
6021
6022/* vec_nmsub */
6023
6024static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6025                                                      vector float __b,
6026                                                      vector float __c) {
6027#ifdef __VSX__
6028  return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6029#else
6030  return __builtin_altivec_vnmsubfp(__a, __b, __c);
6031#endif
6032}
6033
6034#ifdef __VSX__
6035static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6036                                                       vector double __b,
6037                                                       vector double __c) {
6038  return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6039}
6040#endif
6041
6042/* vec_vnmsubfp */
6043
6044static __inline__ vector float __attribute__((__always_inline__))
6045vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6046  return __builtin_altivec_vnmsubfp(__a, __b, __c);
6047}
6048
6049/* vec_nor */
6050
6051#define __builtin_altivec_vnor vec_nor
6052
6053static __inline__ vector signed char __ATTRS_o_ai
6054vec_nor(vector signed char __a, vector signed char __b) {
6055  return ~(__a | __b);
6056}
6057
6058static __inline__ vector unsigned char __ATTRS_o_ai
6059vec_nor(vector unsigned char __a, vector unsigned char __b) {
6060  return ~(__a | __b);
6061}
6062
6063static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6064                                                        vector bool char __b) {
6065  return ~(__a | __b);
6066}
6067
6068static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6069                                                    vector short __b) {
6070  return ~(__a | __b);
6071}
6072
6073static __inline__ vector unsigned short __ATTRS_o_ai
6074vec_nor(vector unsigned short __a, vector unsigned short __b) {
6075  return ~(__a | __b);
6076}
6077
6078static __inline__ vector bool short __ATTRS_o_ai
6079vec_nor(vector bool short __a, vector bool short __b) {
6080  return ~(__a | __b);
6081}
6082
6083static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6084                                                  vector int __b) {
6085  return ~(__a | __b);
6086}
6087
6088static __inline__ vector unsigned int __ATTRS_o_ai
6089vec_nor(vector unsigned int __a, vector unsigned int __b) {
6090  return ~(__a | __b);
6091}
6092
6093static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6094                                                       vector bool int __b) {
6095  return ~(__a | __b);
6096}
6097
6098static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6099                                                    vector float __b) {
6100  vector unsigned int __res =
6101      ~((vector unsigned int)__a | (vector unsigned int)__b);
6102  return (vector float)__res;
6103}
6104
6105#ifdef __VSX__
6106static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6107                                                     vector double __b) {
6108  vector unsigned long long __res =
6109      ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6110  return (vector double)__res;
6111}
6112#endif
6113
6114/* vec_vnor */
6115
6116static __inline__ vector signed char __ATTRS_o_ai
6117vec_vnor(vector signed char __a, vector signed char __b) {
6118  return ~(__a | __b);
6119}
6120
6121static __inline__ vector unsigned char __ATTRS_o_ai
6122vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6123  return ~(__a | __b);
6124}
6125
6126static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6127                                                         vector bool char __b) {
6128  return ~(__a | __b);
6129}
6130
6131static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6132                                                     vector short __b) {
6133  return ~(__a | __b);
6134}
6135
6136static __inline__ vector unsigned short __ATTRS_o_ai
6137vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6138  return ~(__a | __b);
6139}
6140
6141static __inline__ vector bool short __ATTRS_o_ai
6142vec_vnor(vector bool short __a, vector bool short __b) {
6143  return ~(__a | __b);
6144}
6145
6146static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6147                                                   vector int __b) {
6148  return ~(__a | __b);
6149}
6150
6151static __inline__ vector unsigned int __ATTRS_o_ai
6152vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6153  return ~(__a | __b);
6154}
6155
6156static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6157                                                        vector bool int __b) {
6158  return ~(__a | __b);
6159}
6160
6161static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6162                                                     vector float __b) {
6163  vector unsigned int __res =
6164      ~((vector unsigned int)__a | (vector unsigned int)__b);
6165  return (vector float)__res;
6166}
6167
6168#ifdef __VSX__
6169static __inline__ vector signed long long __ATTRS_o_ai
6170vec_nor(vector signed long long __a, vector signed long long __b) {
6171  return ~(__a | __b);
6172}
6173
6174static __inline__ vector unsigned long long __ATTRS_o_ai
6175vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6176  return ~(__a | __b);
6177}
6178
6179static __inline__ vector bool long long __ATTRS_o_ai
6180vec_nor(vector bool long long __a, vector bool long long __b) {
6181  return ~(__a | __b);
6182}
6183#endif
6184
6185/* vec_or */
6186
6187#define __builtin_altivec_vor vec_or
6188
6189static __inline__ vector signed char __ATTRS_o_ai
6190vec_or(vector signed char __a, vector signed char __b) {
6191  return __a | __b;
6192}
6193
6194static __inline__ vector signed char __ATTRS_o_ai
6195vec_or(vector bool char __a, vector signed char __b) {
6196  return (vector signed char)__a | __b;
6197}
6198
6199static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6200                                                         vector bool char __b) {
6201  return __a | (vector signed char)__b;
6202}
6203
6204static __inline__ vector unsigned char __ATTRS_o_ai
6205vec_or(vector unsigned char __a, vector unsigned char __b) {
6206  return __a | __b;
6207}
6208
6209static __inline__ vector unsigned char __ATTRS_o_ai
6210vec_or(vector bool char __a, vector unsigned char __b) {
6211  return (vector unsigned char)__a | __b;
6212}
6213
6214static __inline__ vector unsigned char __ATTRS_o_ai
6215vec_or(vector unsigned char __a, vector bool char __b) {
6216  return __a | (vector unsigned char)__b;
6217}
6218
6219static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6220                                                       vector bool char __b) {
6221  return __a | __b;
6222}
6223
6224static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6225                                                   vector short __b) {
6226  return __a | __b;
6227}
6228
6229static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6230                                                   vector short __b) {
6231  return (vector short)__a | __b;
6232}
6233
6234static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6235                                                   vector bool short __b) {
6236  return __a | (vector short)__b;
6237}
6238
6239static __inline__ vector unsigned short __ATTRS_o_ai
6240vec_or(vector unsigned short __a, vector unsigned short __b) {
6241  return __a | __b;
6242}
6243
6244static __inline__ vector unsigned short __ATTRS_o_ai
6245vec_or(vector bool short __a, vector unsigned short __b) {
6246  return (vector unsigned short)__a | __b;
6247}
6248
6249static __inline__ vector unsigned short __ATTRS_o_ai
6250vec_or(vector unsigned short __a, vector bool short __b) {
6251  return __a | (vector unsigned short)__b;
6252}
6253
6254static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6255                                                        vector bool short __b) {
6256  return __a | __b;
6257}
6258
6259static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6260                                                 vector int __b) {
6261  return __a | __b;
6262}
6263
6264static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6265                                                 vector int __b) {
6266  return (vector int)__a | __b;
6267}
6268
6269static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6270                                                 vector bool int __b) {
6271  return __a | (vector int)__b;
6272}
6273
6274static __inline__ vector unsigned int __ATTRS_o_ai
6275vec_or(vector unsigned int __a, vector unsigned int __b) {
6276  return __a | __b;
6277}
6278
6279static __inline__ vector unsigned int __ATTRS_o_ai
6280vec_or(vector bool int __a, vector unsigned int __b) {
6281  return (vector unsigned int)__a | __b;
6282}
6283
6284static __inline__ vector unsigned int __ATTRS_o_ai
6285vec_or(vector unsigned int __a, vector bool int __b) {
6286  return __a | (vector unsigned int)__b;
6287}
6288
6289static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6290                                                      vector bool int __b) {
6291  return __a | __b;
6292}
6293
6294static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6295                                                   vector float __b) {
6296  vector unsigned int __res =
6297      (vector unsigned int)__a | (vector unsigned int)__b;
6298  return (vector float)__res;
6299}
6300
6301static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6302                                                   vector float __b) {
6303  vector unsigned int __res =
6304      (vector unsigned int)__a | (vector unsigned int)__b;
6305  return (vector float)__res;
6306}
6307
6308static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6309                                                   vector bool int __b) {
6310  vector unsigned int __res =
6311      (vector unsigned int)__a | (vector unsigned int)__b;
6312  return (vector float)__res;
6313}
6314
6315#ifdef __VSX__
6316static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6317                                                    vector double __b) {
6318  return (vector unsigned long long)__a | (vector unsigned long long)__b;
6319}
6320
6321static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6322                                                    vector bool long long __b) {
6323  return (vector unsigned long long)__a | (vector unsigned long long)__b;
6324}
6325
6326static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6327                                                    vector double __b) {
6328  vector unsigned long long __res =
6329      (vector unsigned long long)__a | (vector unsigned long long)__b;
6330  return (vector double)__res;
6331}
6332
6333static __inline__ vector signed long long __ATTRS_o_ai
6334vec_or(vector signed long long __a, vector signed long long __b) {
6335  return __a | __b;
6336}
6337
6338static __inline__ vector signed long long __ATTRS_o_ai
6339vec_or(vector bool long long __a, vector signed long long __b) {
6340  return (vector signed long long)__a | __b;
6341}
6342
6343static __inline__ vector signed long long __ATTRS_o_ai
6344vec_or(vector signed long long __a, vector bool long long __b) {
6345  return __a | (vector signed long long)__b;
6346}
6347
6348static __inline__ vector unsigned long long __ATTRS_o_ai
6349vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6350  return __a | __b;
6351}
6352
6353static __inline__ vector unsigned long long __ATTRS_o_ai
6354vec_or(vector bool long long __a, vector unsigned long long __b) {
6355  return (vector unsigned long long)__a | __b;
6356}
6357
6358static __inline__ vector unsigned long long __ATTRS_o_ai
6359vec_or(vector unsigned long long __a, vector bool long long __b) {
6360  return __a | (vector unsigned long long)__b;
6361}
6362
6363static __inline__ vector bool long long __ATTRS_o_ai
6364vec_or(vector bool long long __a, vector bool long long __b) {
6365  return __a | __b;
6366}
6367#endif
6368
6369#ifdef __POWER8_VECTOR__
6370static __inline__ vector signed char __ATTRS_o_ai
6371vec_orc(vector signed char __a, vector signed char __b) {
6372  return __a | ~__b;
6373}
6374
6375static __inline__ vector signed char __ATTRS_o_ai
6376vec_orc(vector signed char __a, vector bool char __b) {
6377  return __a | ~__b;
6378}
6379
6380static __inline__ vector signed char __ATTRS_o_ai
6381vec_orc(vector bool char __a, vector signed char __b) {
6382  return __a | ~__b;
6383}
6384
6385static __inline__ vector unsigned char __ATTRS_o_ai
6386vec_orc(vector unsigned char __a, vector unsigned char __b) {
6387  return __a | ~__b;
6388}
6389
6390static __inline__ vector unsigned char __ATTRS_o_ai
6391vec_orc(vector unsigned char __a, vector bool char __b) {
6392  return __a | ~__b;
6393}
6394
6395static __inline__ vector unsigned char __ATTRS_o_ai
6396vec_orc(vector bool char __a, vector unsigned char __b) {
6397  return __a | ~__b;
6398}
6399
6400static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6401                                                        vector bool char __b) {
6402  return __a | ~__b;
6403}
6404
6405static __inline__ vector signed short __ATTRS_o_ai
6406vec_orc(vector signed short __a, vector signed short __b) {
6407  return __a | ~__b;
6408}
6409
6410static __inline__ vector signed short __ATTRS_o_ai
6411vec_orc(vector signed short __a, vector bool short __b) {
6412  return __a | ~__b;
6413}
6414
6415static __inline__ vector signed short __ATTRS_o_ai
6416vec_orc(vector bool short __a, vector signed short __b) {
6417  return __a | ~__b;
6418}
6419
6420static __inline__ vector unsigned short __ATTRS_o_ai
6421vec_orc(vector unsigned short __a, vector unsigned short __b) {
6422  return __a | ~__b;
6423}
6424
6425static __inline__ vector unsigned short __ATTRS_o_ai
6426vec_orc(vector unsigned short __a, vector bool short __b) {
6427  return __a | ~__b;
6428}
6429
6430static __inline__ vector unsigned short __ATTRS_o_ai
6431vec_orc(vector bool short __a, vector unsigned short __b) {
6432  return __a | ~__b;
6433}
6434
6435static __inline__ vector bool short __ATTRS_o_ai
6436vec_orc(vector bool short __a, vector bool short __b) {
6437  return __a | ~__b;
6438}
6439
6440static __inline__ vector signed int __ATTRS_o_ai
6441vec_orc(vector signed int __a, vector signed int __b) {
6442  return __a | ~__b;
6443}
6444
6445static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6446                                                         vector bool int __b) {
6447  return __a | ~__b;
6448}
6449
6450static __inline__ vector signed int __ATTRS_o_ai
6451vec_orc(vector bool int __a, vector signed int __b) {
6452  return __a | ~__b;
6453}
6454
6455static __inline__ vector unsigned int __ATTRS_o_ai
6456vec_orc(vector unsigned int __a, vector unsigned int __b) {
6457  return __a | ~__b;
6458}
6459
6460static __inline__ vector unsigned int __ATTRS_o_ai
6461vec_orc(vector unsigned int __a, vector bool int __b) {
6462  return __a | ~__b;
6463}
6464
6465static __inline__ vector unsigned int __ATTRS_o_ai
6466vec_orc(vector bool int __a, vector unsigned int __b) {
6467  return __a | ~__b;
6468}
6469
6470static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6471                                                       vector bool int __b) {
6472  return __a | ~__b;
6473}
6474
6475static __inline__ vector float __ATTRS_o_ai
6476vec_orc(vector bool int __a, vector float __b) {
6477 return (vector float)(__a | ~(vector unsigned int)__b);
6478}
6479
6480static __inline__ vector float __ATTRS_o_ai
6481vec_orc(vector float __a, vector bool int __b) {
6482  return (vector float)((vector unsigned int)__a | ~__b);
6483}
6484
6485static __inline__ vector signed long long __ATTRS_o_ai
6486vec_orc(vector signed long long __a, vector signed long long __b) {
6487  return __a | ~__b;
6488}
6489
6490static __inline__ vector signed long long __ATTRS_o_ai
6491vec_orc(vector signed long long __a, vector bool long long __b) {
6492  return __a | ~__b;
6493}
6494
6495static __inline__ vector signed long long __ATTRS_o_ai
6496vec_orc(vector bool long long __a, vector signed long long __b) {
6497  return __a | ~__b;
6498}
6499
6500static __inline__ vector unsigned long long __ATTRS_o_ai
6501vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6502  return __a | ~__b;
6503}
6504
6505static __inline__ vector unsigned long long __ATTRS_o_ai
6506vec_orc(vector unsigned long long __a, vector bool long long __b) {
6507  return __a | ~__b;
6508}
6509
6510static __inline__ vector unsigned long long __ATTRS_o_ai
6511vec_orc(vector bool long long __a, vector unsigned long long __b) {
6512  return __a | ~__b;
6513}
6514
6515static __inline__ vector bool long long __ATTRS_o_ai
6516vec_orc(vector bool long long __a, vector bool long long __b) {
6517  return __a | ~__b;
6518}
6519
6520static __inline__ vector double __ATTRS_o_ai
6521vec_orc(vector double __a, vector bool long long __b) {
6522  return (vector double)((vector unsigned long long)__a | ~__b);
6523}
6524
6525static __inline__ vector double __ATTRS_o_ai
6526vec_orc(vector bool long long __a, vector double __b) {
6527  return (vector double)(__a | ~(vector unsigned long long)__b);
6528}
6529#endif
6530
6531/* vec_vor */
6532
6533static __inline__ vector signed char __ATTRS_o_ai
6534vec_vor(vector signed char __a, vector signed char __b) {
6535  return __a | __b;
6536}
6537
6538static __inline__ vector signed char __ATTRS_o_ai
6539vec_vor(vector bool char __a, vector signed char __b) {
6540  return (vector signed char)__a | __b;
6541}
6542
6543static __inline__ vector signed char __ATTRS_o_ai
6544vec_vor(vector signed char __a, vector bool char __b) {
6545  return __a | (vector signed char)__b;
6546}
6547
6548static __inline__ vector unsigned char __ATTRS_o_ai
6549vec_vor(vector unsigned char __a, vector unsigned char __b) {
6550  return __a | __b;
6551}
6552
6553static __inline__ vector unsigned char __ATTRS_o_ai
6554vec_vor(vector bool char __a, vector unsigned char __b) {
6555  return (vector unsigned char)__a | __b;
6556}
6557
6558static __inline__ vector unsigned char __ATTRS_o_ai
6559vec_vor(vector unsigned char __a, vector bool char __b) {
6560  return __a | (vector unsigned char)__b;
6561}
6562
6563static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6564                                                        vector bool char __b) {
6565  return __a | __b;
6566}
6567
6568static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6569                                                    vector short __b) {
6570  return __a | __b;
6571}
6572
6573static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6574                                                    vector short __b) {
6575  return (vector short)__a | __b;
6576}
6577
6578static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6579                                                    vector bool short __b) {
6580  return __a | (vector short)__b;
6581}
6582
6583static __inline__ vector unsigned short __ATTRS_o_ai
6584vec_vor(vector unsigned short __a, vector unsigned short __b) {
6585  return __a | __b;
6586}
6587
6588static __inline__ vector unsigned short __ATTRS_o_ai
6589vec_vor(vector bool short __a, vector unsigned short __b) {
6590  return (vector unsigned short)__a | __b;
6591}
6592
6593static __inline__ vector unsigned short __ATTRS_o_ai
6594vec_vor(vector unsigned short __a, vector bool short __b) {
6595  return __a | (vector unsigned short)__b;
6596}
6597
6598static __inline__ vector bool short __ATTRS_o_ai
6599vec_vor(vector bool short __a, vector bool short __b) {
6600  return __a | __b;
6601}
6602
6603static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6604                                                  vector int __b) {
6605  return __a | __b;
6606}
6607
6608static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6609                                                  vector int __b) {
6610  return (vector int)__a | __b;
6611}
6612
6613static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6614                                                  vector bool int __b) {
6615  return __a | (vector int)__b;
6616}
6617
6618static __inline__ vector unsigned int __ATTRS_o_ai
6619vec_vor(vector unsigned int __a, vector unsigned int __b) {
6620  return __a | __b;
6621}
6622
6623static __inline__ vector unsigned int __ATTRS_o_ai
6624vec_vor(vector bool int __a, vector unsigned int __b) {
6625  return (vector unsigned int)__a | __b;
6626}
6627
6628static __inline__ vector unsigned int __ATTRS_o_ai
6629vec_vor(vector unsigned int __a, vector bool int __b) {
6630  return __a | (vector unsigned int)__b;
6631}
6632
6633static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6634                                                       vector bool int __b) {
6635  return __a | __b;
6636}
6637
6638static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6639                                                    vector float __b) {
6640  vector unsigned int __res =
6641      (vector unsigned int)__a | (vector unsigned int)__b;
6642  return (vector float)__res;
6643}
6644
6645static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6646                                                    vector float __b) {
6647  vector unsigned int __res =
6648      (vector unsigned int)__a | (vector unsigned int)__b;
6649  return (vector float)__res;
6650}
6651
6652static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6653                                                    vector bool int __b) {
6654  vector unsigned int __res =
6655      (vector unsigned int)__a | (vector unsigned int)__b;
6656  return (vector float)__res;
6657}
6658
6659#ifdef __VSX__
6660static __inline__ vector signed long long __ATTRS_o_ai
6661vec_vor(vector signed long long __a, vector signed long long __b) {
6662  return __a | __b;
6663}
6664
6665static __inline__ vector signed long long __ATTRS_o_ai
6666vec_vor(vector bool long long __a, vector signed long long __b) {
6667  return (vector signed long long)__a | __b;
6668}
6669
6670static __inline__ vector signed long long __ATTRS_o_ai
6671vec_vor(vector signed long long __a, vector bool long long __b) {
6672  return __a | (vector signed long long)__b;
6673}
6674
6675static __inline__ vector unsigned long long __ATTRS_o_ai
6676vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6677  return __a | __b;
6678}
6679
6680static __inline__ vector unsigned long long __ATTRS_o_ai
6681vec_vor(vector bool long long __a, vector unsigned long long __b) {
6682  return (vector unsigned long long)__a | __b;
6683}
6684
6685static __inline__ vector unsigned long long __ATTRS_o_ai
6686vec_vor(vector unsigned long long __a, vector bool long long __b) {
6687  return __a | (vector unsigned long long)__b;
6688}
6689
6690static __inline__ vector bool long long __ATTRS_o_ai
6691vec_vor(vector bool long long __a, vector bool long long __b) {
6692  return __a | __b;
6693}
6694#endif
6695
6696/* vec_pack */
6697
6698/* The various vector pack instructions have a big-endian bias, so for
6699   little endian we must handle reversed element numbering.  */
6700
6701static __inline__ vector signed char __ATTRS_o_ai
6702vec_pack(vector signed short __a, vector signed short __b) {
6703#ifdef __LITTLE_ENDIAN__
6704  return (vector signed char)vec_perm(
6705      __a, __b,
6706      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6707                             0x100x120x140x160x180x1A0x1C0x1E));
6708#else
6709  return (vector signed char)vec_perm(
6710      __a, __b,
6711      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6712                             0x110x130x150x170x190x1B0x1D0x1F));
6713#endif
6714}
6715
6716static __inline__ vector unsigned char __ATTRS_o_ai
6717vec_pack(vector unsigned short __a, vector unsigned short __b) {
6718#ifdef __LITTLE_ENDIAN__
6719  return (vector unsigned char)vec_perm(
6720      __a, __b,
6721      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6722                             0x100x120x140x160x180x1A0x1C0x1E));
6723#else
6724  return (vector unsigned char)vec_perm(
6725      __a, __b,
6726      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6727                             0x110x130x150x170x190x1B0x1D0x1F));
6728#endif
6729}
6730
6731static __inline__ vector bool char __ATTRS_o_ai
6732vec_pack(vector bool short __a, vector bool short __b) {
6733#ifdef __LITTLE_ENDIAN__
6734  return (vector bool char)vec_perm(
6735      __a, __b,
6736      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6737                             0x100x120x140x160x180x1A0x1C0x1E));
6738#else
6739  return (vector bool char)vec_perm(
6740      __a, __b,
6741      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6742                             0x110x130x150x170x190x1B0x1D0x1F));
6743#endif
6744}
6745
6746static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6747                                                     vector int __b) {
6748#ifdef __LITTLE_ENDIAN__
6749  return (vector short)vec_perm(
6750      __a, __b,
6751      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6752                             0x100x110x140x150x180x190x1C0x1D));
6753#else
6754  return (vector short)vec_perm(
6755      __a, __b,
6756      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6757                             0x120x130x160x170x1A0x1B0x1E0x1F));
6758#endif
6759}
6760
6761static __inline__ vector unsigned short __ATTRS_o_ai
6762vec_pack(vector unsigned int __a, vector unsigned int __b) {
6763#ifdef __LITTLE_ENDIAN__
6764  return (vector unsigned short)vec_perm(
6765      __a, __b,
6766      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6767                             0x100x110x140x150x180x190x1C0x1D));
6768#else
6769  return (vector unsigned short)vec_perm(
6770      __a, __b,
6771      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6772                             0x120x130x160x170x1A0x1B0x1E0x1F));
6773#endif
6774}
6775
6776static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6777                                                          vector bool int __b) {
6778#ifdef __LITTLE_ENDIAN__
6779  return (vector bool short)vec_perm(
6780      __a, __b,
6781      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6782                             0x100x110x140x150x180x190x1C0x1D));
6783#else
6784  return (vector bool short)vec_perm(
6785      __a, __b,
6786      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6787                             0x120x130x160x170x1A0x1B0x1E0x1F));
6788#endif
6789}
6790
6791#ifdef __VSX__
6792static __inline__ vector signed int __ATTRS_o_ai
6793vec_pack(vector signed long long __a, vector signed long long __b) {
6794#ifdef __LITTLE_ENDIAN__
6795  return (vector signed int)vec_perm(
6796      __a, __b,
6797      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6798                             0x100x110x120x130x180x190x1A0x1B));
6799#else
6800  return (vector signed int)vec_perm(
6801      __a, __b,
6802      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6803                             0x140x150x160x170x1C0x1D0x1E0x1F));
6804#endif
6805}
6806static __inline__ vector unsigned int __ATTRS_o_ai
6807vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6808#ifdef __LITTLE_ENDIAN__
6809  return (vector unsigned int)vec_perm(
6810      __a, __b,
6811      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6812                             0x100x110x120x130x180x190x1A0x1B));
6813#else
6814  return (vector unsigned int)vec_perm(
6815      __a, __b,
6816      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6817                             0x140x150x160x170x1C0x1D0x1E0x1F));
6818#endif
6819}
6820
6821static __inline__ vector bool int __ATTRS_o_ai
6822vec_pack(vector bool long long __a, vector bool long long __b) {
6823#ifdef __LITTLE_ENDIAN__
6824  return (vector bool int)vec_perm(
6825      __a, __b,
6826      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6827                             0x100x110x120x130x180x190x1A0x1B));
6828#else
6829  return (vector bool int)vec_perm(
6830      __a, __b,
6831      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6832                             0x140x150x160x170x1C0x1D0x1E0x1F));
6833#endif
6834}
6835
6836static __inline__ vector float __ATTRS_o_ai
6837vec_pack(vector double __a, vector double __b) {
6838  return (vector float) (__a[0], __a[1], __b[0], __b[1]);
6839}
6840#endif
6841
6842#ifdef __POWER9_VECTOR__
6843static __inline__ vector unsigned short __ATTRS_o_ai
6844vec_pack_to_short_fp32(vector float __a, vector float __b) {
6845  vector float __resa = __builtin_vsx_xvcvsphp(__a);
6846  vector float __resb = __builtin_vsx_xvcvsphp(__b);
6847#ifdef __LITTLE_ENDIAN__
6848  return (vector unsigned short)vec_mergee(__resa, __resb);
6849#else
6850  return (vector unsigned short)vec_mergeo(__resa, __resb);
6851#endif
6852}
6853
6854#endif
6855/* vec_vpkuhum */
6856
6857#define __builtin_altivec_vpkuhum vec_vpkuhum
6858
6859static __inline__ vector signed char __ATTRS_o_ai
6860vec_vpkuhum(vector signed short __a, vector signed short __b) {
6861#ifdef __LITTLE_ENDIAN__
6862  return (vector signed char)vec_perm(
6863      __a, __b,
6864      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6865                             0x100x120x140x160x180x1A0x1C0x1E));
6866#else
6867  return (vector signed char)vec_perm(
6868      __a, __b,
6869      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6870                             0x110x130x150x170x190x1B0x1D0x1F));
6871#endif
6872}
6873
6874static __inline__ vector unsigned char __ATTRS_o_ai
6875vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6876#ifdef __LITTLE_ENDIAN__
6877  return (vector unsigned char)vec_perm(
6878      __a, __b,
6879      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6880                             0x100x120x140x160x180x1A0x1C0x1E));
6881#else
6882  return (vector unsigned char)vec_perm(
6883      __a, __b,
6884      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6885                             0x110x130x150x170x190x1B0x1D0x1F));
6886#endif
6887}
6888
6889static __inline__ vector bool char __ATTRS_o_ai
6890vec_vpkuhum(vector bool short __a, vector bool short __b) {
6891#ifdef __LITTLE_ENDIAN__
6892  return (vector bool char)vec_perm(
6893      __a, __b,
6894      (vector unsigned char)(0x000x020x040x060x080x0A0x0C0x0E,
6895                             0x100x120x140x160x180x1A0x1C0x1E));
6896#else
6897  return (vector bool char)vec_perm(
6898      __a, __b,
6899      (vector unsigned char)(0x010x030x050x070x090x0B0x0D0x0F,
6900                             0x110x130x150x170x190x1B0x1D0x1F));
6901#endif
6902}
6903
6904/* vec_vpkuwum */
6905
6906#define __builtin_altivec_vpkuwum vec_vpkuwum
6907
6908static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6909                                                        vector int __b) {
6910#ifdef __LITTLE_ENDIAN__
6911  return (vector short)vec_perm(
6912      __a, __b,
6913      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6914                             0x100x110x140x150x180x190x1C0x1D));
6915#else
6916  return (vector short)vec_perm(
6917      __a, __b,
6918      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6919                             0x120x130x160x170x1A0x1B0x1E0x1F));
6920#endif
6921}
6922
6923static __inline__ vector unsigned short __ATTRS_o_ai
6924vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6925#ifdef __LITTLE_ENDIAN__
6926  return (vector unsigned short)vec_perm(
6927      __a, __b,
6928      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6929                             0x100x110x140x150x180x190x1C0x1D));
6930#else
6931  return (vector unsigned short)vec_perm(
6932      __a, __b,
6933      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6934                             0x120x130x160x170x1A0x1B0x1E0x1F));
6935#endif
6936}
6937
6938static __inline__ vector bool short __ATTRS_o_ai
6939vec_vpkuwum(vector bool int __a, vector bool int __b) {
6940#ifdef __LITTLE_ENDIAN__
6941  return (vector bool short)vec_perm(
6942      __a, __b,
6943      (vector unsigned char)(0x000x010x040x050x080x090x0C0x0D,
6944                             0x100x110x140x150x180x190x1C0x1D));
6945#else
6946  return (vector bool short)vec_perm(
6947      __a, __b,
6948      (vector unsigned char)(0x020x030x060x070x0A0x0B0x0E0x0F,
6949                             0x120x130x160x170x1A0x1B0x1E0x1F));
6950#endif
6951}
6952
6953/* vec_vpkudum */
6954
6955#ifdef __POWER8_VECTOR__
6956#define __builtin_altivec_vpkudum vec_vpkudum
6957
6958static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6959                                                      vector long long __b) {
6960#ifdef __LITTLE_ENDIAN__
6961  return (vector int)vec_perm(
6962      __a, __b,
6963      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6964                             0x100x110x120x130x180x190x1A0x1B));
6965#else
6966  return (vector int)vec_perm(
6967      __a, __b,
6968      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6969                             0x140x150x160x170x1C0x1D0x1E0x1F));
6970#endif
6971}
6972
6973static __inline__ vector unsigned int __ATTRS_o_ai
6974vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6975#ifdef __LITTLE_ENDIAN__
6976  return (vector unsigned int)vec_perm(
6977      __a, __b,
6978      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6979                             0x100x110x120x130x180x190x1A0x1B));
6980#else
6981  return (vector unsigned int)vec_perm(
6982      __a, __b,
6983      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6984                             0x140x150x160x170x1C0x1D0x1E0x1F));
6985#endif
6986}
6987
6988static __inline__ vector bool int __ATTRS_o_ai
6989vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6990#ifdef __LITTLE_ENDIAN__
6991  return (vector bool int)vec_perm(
6992      (vector long long)__a, (vector long long)__b,
6993      (vector unsigned char)(0x000x010x020x030x080x090x0A0x0B,
6994                             0x100x110x120x130x180x190x1A0x1B));
6995#else
6996  return (vector bool int)vec_perm(
6997      (vector long long)__a, (vector long long)__b,
6998      (vector unsigned char)(0x040x050x060x070x0C0x0D0x0E0x0F,
6999                             0x140x150x160x170x1C0x1D0x1E0x1F));
7000#endif
7001}
7002#endif
7003
7004/* vec_packpx */
7005
7006static __inline__ vector pixel __attribute__((__always_inline__))
7007vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7008#ifdef __LITTLE_ENDIAN__
7009  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7010#else
7011  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7012#endif
7013}
7014
7015/* vec_vpkpx */
7016
7017static __inline__ vector pixel __attribute__((__always_inline__))
7018vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7019#ifdef __LITTLE_ENDIAN__
7020  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7021#else
7022  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7023#endif
7024}
7025
7026/* vec_packs */
7027
7028static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7029                                                            vector short __b) {
7030#ifdef __LITTLE_ENDIAN__
7031  return __builtin_altivec_vpkshss(__b, __a);
7032#else
7033  return __builtin_altivec_vpkshss(__a, __b);
7034#endif
7035}
7036
7037static __inline__ vector unsigned char __ATTRS_o_ai
7038vec_packs(vector unsigned short __a, vector unsigned short __b) {
7039#ifdef __LITTLE_ENDIAN__
7040  return __builtin_altivec_vpkuhus(__b, __a);
7041#else
7042  return __builtin_altivec_vpkuhus(__a, __b);
7043#endif
7044}
7045
7046static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7047                                                             vector int __b) {
7048#ifdef __LITTLE_ENDIAN__
7049  return __builtin_altivec_vpkswss(__b, __a);
7050#else
7051  return __builtin_altivec_vpkswss(__a, __b);
7052#endif
7053}
7054
7055static __inline__ vector unsigned short __ATTRS_o_ai
7056vec_packs(vector unsigned int __a, vector unsigned int __b) {
7057#ifdef __LITTLE_ENDIAN__
7058  return __builtin_altivec_vpkuwus(__b, __a);
7059#else
7060  return __builtin_altivec_vpkuwus(__a, __b);
7061#endif
7062}
7063
7064#ifdef __POWER8_VECTOR__
7065static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7066                                                    vector long long __b) {
7067#ifdef __LITTLE_ENDIAN__
7068  return __builtin_altivec_vpksdss(__b, __a);
7069#else
7070  return __builtin_altivec_vpksdss(__a, __b);
7071#endif
7072}
7073
7074static __inline__ vector unsigned int __ATTRS_o_ai
7075vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7076#ifdef __LITTLE_ENDIAN__
7077  return __builtin_altivec_vpkudus(__b, __a);
7078#else
7079  return __builtin_altivec_vpkudus(__a, __b);
7080#endif
7081}
7082#endif
7083
7084/* vec_vpkshss */
7085
7086static __inline__ vector signed char __attribute__((__always_inline__))
7087vec_vpkshss(vector short __a, vector short __b) {
7088#ifdef __LITTLE_ENDIAN__
7089  return __builtin_altivec_vpkshss(__b, __a);
7090#else
7091  return __builtin_altivec_vpkshss(__a, __b);
7092#endif
7093}
7094
7095/* vec_vpksdss */
7096
7097#ifdef __POWER8_VECTOR__
7098static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7099                                                      vector long long __b) {
7100#ifdef __LITTLE_ENDIAN__
7101  return __builtin_altivec_vpksdss(__b, __a);
7102#else
7103  return __builtin_altivec_vpksdss(__a, __b);
7104#endif
7105}
7106#endif
7107
7108/* vec_vpkuhus */
7109
7110static __inline__ vector unsigned char __attribute__((__always_inline__))
7111vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7112#ifdef __LITTLE_ENDIAN__
7113  return __builtin_altivec_vpkuhus(__b, __a);
7114#else
7115  return __builtin_altivec_vpkuhus(__a, __b);
7116#endif
7117}
7118
7119/* vec_vpkudus */
7120
7121#ifdef __POWER8_VECTOR__
7122static __inline__ vector unsigned int __attribute__((__always_inline__))
7123vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7124#ifdef __LITTLE_ENDIAN__
7125  return __builtin_altivec_vpkudus(__b, __a);
7126#else
7127  return __builtin_altivec_vpkudus(__a, __b);
7128#endif
7129}
7130#endif
7131
7132/* vec_vpkswss */
7133
7134static __inline__ vector signed short __attribute__((__always_inline__))
7135vec_vpkswss(vector int __a, vector int __b) {
7136#ifdef __LITTLE_ENDIAN__
7137  return __builtin_altivec_vpkswss(__b, __a);
7138#else
7139  return __builtin_altivec_vpkswss(__a, __b);
7140#endif
7141}
7142
7143/* vec_vpkuwus */
7144
7145static __inline__ vector unsigned short __attribute__((__always_inline__))
7146vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7147#ifdef __LITTLE_ENDIAN__
7148  return __builtin_altivec_vpkuwus(__b, __a);
7149#else
7150  return __builtin_altivec_vpkuwus(__a, __b);
7151#endif
7152}
7153
7154/* vec_packsu */
7155
7156static __inline__ vector unsigned char __ATTRS_o_ai
7157vec_packsu(vector short __a, vector short __b) {
7158#ifdef __LITTLE_ENDIAN__
7159  return __builtin_altivec_vpkshus(__b, __a);
7160#else
7161  return __builtin_altivec_vpkshus(__a, __b);
7162#endif
7163}
7164
7165static __inline__ vector unsigned char __ATTRS_o_ai
7166vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7167#ifdef __LITTLE_ENDIAN__
7168  return __builtin_altivec_vpkuhus(__b, __a);
7169#else
7170  return __builtin_altivec_vpkuhus(__a, __b);
7171#endif
7172}
7173
7174static __inline__ vector unsigned short __ATTRS_o_ai
7175vec_packsu(vector int __a, vector int __b) {
7176#ifdef __LITTLE_ENDIAN__
7177  return __builtin_altivec_vpkswus(__b, __a);
7178#else
7179  return __builtin_altivec_vpkswus(__a, __b);
7180#endif
7181}
7182
7183static __inline__ vector unsigned short __ATTRS_o_ai
7184vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7185#ifdef __LITTLE_ENDIAN__
7186  return __builtin_altivec_vpkuwus(__b, __a);
7187#else
7188  return __builtin_altivec_vpkuwus(__a, __b);
7189#endif
7190}
7191
7192#ifdef __POWER8_VECTOR__
7193static __inline__ vector unsigned int __ATTRS_o_ai
7194vec_packsu(vector long long __a, vector long long __b) {
7195#ifdef __LITTLE_ENDIAN__
7196  return __builtin_altivec_vpksdus(__b, __a);
7197#else
7198  return __builtin_altivec_vpksdus(__a, __b);
7199#endif
7200}
7201
7202static __inline__ vector unsigned int __ATTRS_o_ai
7203vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7204#ifdef __LITTLE_ENDIAN__
7205  return __builtin_altivec_vpkudus(__b, __a);
7206#else
7207  return __builtin_altivec_vpkudus(__a, __b);
7208#endif
7209}
7210#endif
7211
7212/* vec_vpkshus */
7213
7214static __inline__ vector unsigned char __ATTRS_o_ai
7215vec_vpkshus(vector short __a, vector short __b) {
7216#ifdef __LITTLE_ENDIAN__
7217  return __builtin_altivec_vpkshus(__b, __a);
7218#else
7219  return __builtin_altivec_vpkshus(__a, __b);
7220#endif
7221}
7222
7223static __inline__ vector unsigned char __ATTRS_o_ai
7224vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7225#ifdef __LITTLE_ENDIAN__
7226  return __builtin_altivec_vpkuhus(__b, __a);
7227#else
7228  return __builtin_altivec_vpkuhus(__a, __b);
7229#endif
7230}
7231
7232/* vec_vpkswus */
7233
7234static __inline__ vector unsigned short __ATTRS_o_ai
7235vec_vpkswus(vector int __a, vector int __b) {
7236#ifdef __LITTLE_ENDIAN__
7237  return __builtin_altivec_vpkswus(__b, __a);
7238#else
7239  return __builtin_altivec_vpkswus(__a, __b);
7240#endif
7241}
7242
7243static __inline__ vector unsigned short __ATTRS_o_ai
7244vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7245#ifdef __LITTLE_ENDIAN__
7246  return __builtin_altivec_vpkuwus(__b, __a);
7247#else
7248  return __builtin_altivec_vpkuwus(__a, __b);
7249#endif
7250}
7251
7252/* vec_vpksdus */
7253
7254#ifdef __POWER8_VECTOR__
7255static __inline__ vector unsigned int __ATTRS_o_ai
7256vec_vpksdus(vector long long __a, vector long long __b) {
7257#ifdef __LITTLE_ENDIAN__
7258  return __builtin_altivec_vpksdus(__b, __a);
7259#else
7260  return __builtin_altivec_vpksdus(__a, __b);
7261#endif
7262}
7263#endif
7264
7265/* vec_perm */
7266
7267// The vperm instruction is defined architecturally with a big-endian bias.
7268// For little endian, we swap the input operands and invert the permute
7269// control vector.  Only the rightmost 5 bits matter, so we could use
7270// a vector of all 31s instead of all 255s to perform the inversion.
7271// However, when the PCV is not a constant, using 255 has an advantage
7272// in that the vec_xor can be recognized as a vec_nor (and for P8 and
7273// later, possibly a vec_nand).
7274
7275static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7276    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7277#ifdef __LITTLE_ENDIAN__
7278  vector unsigned char __d = {255255255255255255255255,
7279                              255255255255255255255255};
7280  __d = vec_xor(__c, __d);
7281  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7282                                                         (vector int)__a, __d);
7283#else
7284  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7285                                                         (vector int)__b, __c);
7286#endif
7287}
7288
7289static __inline__ vector unsigned char __ATTRS_o_ai
7290vec_perm(vector unsigned char __a, vector unsigned char __b,
7291         vector unsigned char __c) {
7292#ifdef __LITTLE_ENDIAN__
7293  vector unsigned char __d = {255255255255255255255255,
7294                              255255255255255255255255};
7295  __d = vec_xor(__c, __d);
7296  return (vector unsigned char)__builtin_altivec_vperm_4si(
7297      (vector int)__b, (vector int)__a, __d);
7298#else
7299  return (vector unsigned char)__builtin_altivec_vperm_4si(
7300      (vector int)__a, (vector int)__b, __c);
7301#endif
7302}
7303
7304static __inline__ vector bool char __ATTRS_o_ai
7305vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7306#ifdef __LITTLE_ENDIAN__
7307  vector unsigned char __d = {255255255255255255255255,
7308                              255255255255255255255255};
7309  __d = vec_xor(__c, __d);
7310  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7311                                                       (vector int)__a, __d);
7312#else
7313  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7314                                                       (vector int)__b, __c);
7315#endif
7316}
7317
7318static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7319                                                     vector signed short __b,
7320                                                     vector unsigned char __c) {
7321#ifdef __LITTLE_ENDIAN__
7322  vector unsigned char __d = {255255255255255255255255,
7323                              255255255255255255255255};
7324  __d = vec_xor(__c, __d);
7325  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7326                                                          (vector int)__a, __d);
7327#else
7328  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7329                                                          (vector int)__b, __c);
7330#endif
7331}
7332
7333static __inline__ vector unsigned short __ATTRS_o_ai
7334vec_perm(vector unsigned short __a, vector unsigned short __b,
7335         vector unsigned char __c) {
7336#ifdef __LITTLE_ENDIAN__
7337  vector unsigned char __d = {255255255255255255255255,
7338                              255255255255255255255255};
7339  __d = vec_xor(__c, __d);
7340  return (vector unsigned short)__builtin_altivec_vperm_4si(
7341      (vector int)__b, (vector int)__a, __d);
7342#else
7343  return (vector unsigned short)__builtin_altivec_vperm_4si(
7344      (vector int)__a, (vector int)__b, __c);
7345#endif
7346}
7347
7348static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7349    vector bool short __a, vector bool short __b, vector unsigned char __c) {
7350#ifdef __LITTLE_ENDIAN__
7351  vector unsigned char __d = {255255255255255255255255,
7352                              255255255255255255255255};
7353  __d = vec_xor(__c, __d);
7354  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7355                                                        (vector int)__a, __d);
7356#else
7357  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7358                                                        (vector int)__b, __c);
7359#endif
7360}
7361
7362static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7363                                                     vector pixel __b,
7364                                                     vector unsigned char __c) {
7365#ifdef __LITTLE_ENDIAN__
7366  vector unsigned char __d = {255255255255255255255255,
7367                              255255255255255255255255};
7368  __d = vec_xor(__c, __d);
7369  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7370                                                   (vector int)__a, __d);
7371#else
7372  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7373                                                   (vector int)__b, __c);
7374#endif
7375}
7376
7377static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7378                                                   vector signed int __b,
7379                                                   vector unsigned char __c) {
7380#ifdef __LITTLE_ENDIAN__
7381  vector unsigned char __d = {255255255255255255255255,
7382                              255255255255255255255255};
7383  __d = vec_xor(__c, __d);
7384  return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7385#else
7386  return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7387#endif
7388}
7389
7390static __inline__ vector unsigned int __ATTRS_o_ai
7391vec_perm(vector unsigned int __a, vector unsigned int __b,
7392         vector unsigned char __c) {
7393#ifdef __LITTLE_ENDIAN__
7394  vector unsigned char __d = {255255255255255255255255,
7395                              255255255255255255255255};
7396  __d = vec_xor(__c, __d);
7397  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7398                                                          (vector int)__a, __d);
7399#else
7400  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7401                                                          (vector int)__b, __c);
7402#endif
7403}
7404
7405static __inline__ vector bool int __ATTRS_o_ai
7406vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7407#ifdef __LITTLE_ENDIAN__
7408  vector unsigned char __d = {255255255255255255255255,
7409                              255255255255255255255255};
7410  __d = vec_xor(__c, __d);
7411  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7412                                                      (vector int)__a, __d);
7413#else
7414  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7415                                                      (vector int)__b, __c);
7416#endif
7417}
7418
7419static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7420                                                     vector float __b,
7421                                                     vector unsigned char __c) {
7422#ifdef __LITTLE_ENDIAN__
7423  vector unsigned char __d = {255255255255255255255255,
7424                              255255255255255255255255};
7425  __d = vec_xor(__c, __d);
7426  return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7427                                                   (vector int)__a, __d);
7428#else
7429  return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7430                                                   (vector int)__b, __c);
7431#endif
7432}
7433
7434#ifdef __VSX__
7435static __inline__ vector long long __ATTRS_o_ai
7436vec_perm(vector signed long long __a, vector signed long long __b,
7437         vector unsigned char __c) {
7438#ifdef __LITTLE_ENDIAN__
7439  vector unsigned char __d = {255255255255255255255255,
7440                              255255255255255255255255};
7441  __d = vec_xor(__c, __d);
7442  return (vector signed long long)__builtin_altivec_vperm_4si(
7443      (vector int)__b, (vector int)__a, __d);
7444#else
7445  return (vector signed long long)__builtin_altivec_vperm_4si(
7446      (vector int)__a, (vector int)__b, __c);
7447#endif
7448}
7449
7450static __inline__ vector unsigned long long __ATTRS_o_ai
7451vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7452         vector unsigned char __c) {
7453#ifdef __LITTLE_ENDIAN__
7454  vector unsigned char __d = {255255255255255255255255,
7455                              255255255255255255255255};
7456  __d = vec_xor(__c, __d);
7457  return (vector unsigned long long)__builtin_altivec_vperm_4si(
7458      (vector int)__b, (vector int)__a, __d);
7459#else
7460  return (vector unsigned long long)__builtin_altivec_vperm_4si(
7461      (vector int)__a, (vector int)__b, __c);
7462#endif
7463}
7464
7465static __inline__ vector bool long long __ATTRS_o_ai
7466vec_perm(vector bool long long __a, vector bool long long __b,
7467         vector unsigned char __c) {
7468#ifdef __LITTLE_ENDIAN__
7469  vector unsigned char __d = {255255255255255255255255,
7470                              255255255255255255255255};
7471  __d = vec_xor(__c, __d);
7472  return (vector bool long long)__builtin_altivec_vperm_4si(
7473      (vector int)__b, (vector int)__a, __d);
7474#else
7475  return (vector bool long long)__builtin_altivec_vperm_4si(
7476      (vector int)__a, (vector int)__b, __c);
7477#endif
7478}
7479
7480static __inline__ vector double __ATTRS_o_ai
7481vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7482#ifdef __LITTLE_ENDIAN__
7483  vector unsigned char __d = {255255255255255255255255,
7484                              255255255255255255255255};
7485  __d = vec_xor(__c, __d);
7486  return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7487                                                    (vector int)__a, __d);
7488#else
7489  return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7490                                                    (vector int)__b, __c);
7491#endif
7492}
7493#endif
7494
7495/* vec_vperm */
7496
7497static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7498    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7499  return vec_perm(__a, __b, __c);
7500}
7501
7502static __inline__ vector unsigned char __ATTRS_o_ai
7503vec_vperm(vector unsigned char __a, vector unsigned char __b,
7504          vector unsigned char __c) {
7505  return vec_perm(__a, __b, __c);
7506}
7507
7508static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7509    vector bool char __a, vector bool char __b, vector unsigned char __c) {
7510  return vec_perm(__a, __b, __c);
7511}
7512
7513static __inline__ vector short __ATTRS_o_ai
7514vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7515  return vec_perm(__a, __b, __c);
7516}
7517
7518static __inline__ vector unsigned short __ATTRS_o_ai
7519vec_vperm(vector unsigned short __a, vector unsigned short __b,
7520          vector unsigned char __c) {
7521  return vec_perm(__a, __b, __c);
7522}
7523
7524static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7525    vector bool short __a, vector bool short __b, vector unsigned char __c) {
7526  return vec_perm(__a, __b, __c);
7527}
7528
7529static __inline__ vector pixel __ATTRS_o_ai
7530vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7531  return vec_perm(__a, __b, __c);
7532}
7533
7534static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7535                                                    vector int __b,
7536                                                    vector unsigned char __c) {
7537  return vec_perm(__a, __b, __c);
7538}
7539
7540static __inline__ vector unsigned int __ATTRS_o_ai
7541vec_vperm(vector unsigned int __a, vector unsigned int __b,
7542          vector unsigned char __c) {
7543  return vec_perm(__a, __b, __c);
7544}
7545
7546static __inline__ vector bool int __ATTRS_o_ai
7547vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7548  return vec_perm(__a, __b, __c);
7549}
7550
7551static __inline__ vector float __ATTRS_o_ai
7552vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7553  return vec_perm(__a, __b, __c);
7554}
7555
7556#ifdef __VSX__
7557static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7558    vector long long __a, vector long long __b, vector unsigned char __c) {
7559  return vec_perm(__a, __b, __c);
7560}
7561
7562static __inline__ vector unsigned long long __ATTRS_o_ai
7563vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7564          vector unsigned char __c) {
7565  return vec_perm(__a, __b, __c);
7566}
7567
7568static __inline__ vector double __ATTRS_o_ai
7569vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7570  return vec_perm(__a, __b, __c);
7571}
7572#endif
7573
7574/* vec_re */
7575
7576static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7577#ifdef __VSX__
7578  return __builtin_vsx_xvresp(__a);
7579#else
7580  return __builtin_altivec_vrefp(__a);
7581#endif
7582}
7583
7584#ifdef __VSX__
7585static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7586  return __builtin_vsx_xvredp(__a);
7587}
7588#endif
7589
7590/* vec_vrefp */
7591
7592static __inline__ vector float __attribute__((__always_inline__))
7593vec_vrefp(vector float __a) {
7594  return __builtin_altivec_vrefp(__a);
7595}
7596
7597/* vec_rl */
7598
7599static __inline__ vector signed char __ATTRS_o_ai
7600vec_rl(vector signed char __a, vector unsigned char __b) {
7601  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7602}
7603
7604static __inline__ vector unsigned char __ATTRS_o_ai
7605vec_rl(vector unsigned char __a, vector unsigned char __b) {
7606  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7607}
7608
7609static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7610                                                   vector unsigned short __b) {
7611  return __builtin_altivec_vrlh(__a, __b);
7612}
7613
7614static __inline__ vector unsigned short __ATTRS_o_ai
7615vec_rl(vector unsigned short __a, vector unsigned short __b) {
7616  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7617}
7618
7619static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7620                                                 vector unsigned int __b) {
7621  return __builtin_altivec_vrlw(__a, __b);
7622}
7623
7624static __inline__ vector unsigned int __ATTRS_o_ai
7625vec_rl(vector unsigned int __a, vector unsigned int __b) {
7626  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7627}
7628
7629#ifdef __POWER8_VECTOR__
7630static __inline__ vector signed long long __ATTRS_o_ai
7631vec_rl(vector signed long long __a, vector unsigned long long __b) {
7632  return __builtin_altivec_vrld(__a, __b);
7633}
7634
7635static __inline__ vector unsigned long long __ATTRS_o_ai
7636vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7637  return __builtin_altivec_vrld(__a, __b);
7638}
7639#endif
7640
7641/* vec_rlmi */
7642#ifdef __POWER9_VECTOR__
7643static __inline__ vector unsigned int __ATTRS_o_ai
7644vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7645         vector unsigned int __c) {
7646  return __builtin_altivec_vrlwmi(__a, __c, __b);
7647}
7648
7649static __inline__ vector unsigned long long __ATTRS_o_ai
7650vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7651         vector unsigned long long __c) {
7652  return __builtin_altivec_vrldmi(__a, __c, __b);
7653}
7654
7655/* vec_rlnm */
7656static __inline__ vector unsigned int __ATTRS_o_ai
7657vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7658         vector unsigned int __c) {
7659  vector unsigned int OneByte = { 0x80x80x80x8 };
7660  return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7661}
7662
7663static __inline__ vector unsigned long long __ATTRS_o_ai
7664vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7665         vector unsigned long long __c) {
7666  vector unsigned long long OneByte = { 0x80x8 };
7667  return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7668}
7669#endif
7670
7671/* vec_vrlb */
7672
7673static __inline__ vector signed char __ATTRS_o_ai
7674vec_vrlb(vector signed char __a, vector unsigned char __b) {
7675  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7676}
7677
7678static __inline__ vector unsigned char __ATTRS_o_ai
7679vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7680  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7681}
7682
7683/* vec_vrlh */
7684
7685static __inline__ vector short __ATTRS_o_ai
7686vec_vrlh(vector short __a, vector unsigned short __b) {
7687  return __builtin_altivec_vrlh(__a, __b);
7688}
7689
7690static __inline__ vector unsigned short __ATTRS_o_ai
7691vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7692  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7693}
7694
7695/* vec_vrlw */
7696
7697static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7698                                                   vector unsigned int __b) {
7699  return __builtin_altivec_vrlw(__a, __b);
7700}
7701
7702static __inline__ vector unsigned int __ATTRS_o_ai
7703vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7704  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7705}
7706
7707/* vec_round */
7708
7709static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7710#ifdef __VSX__
7711  return __builtin_vsx_xvrspi(__a);
7712#else
7713  return __builtin_altivec_vrfin(__a);
7714#endif
7715}
7716
7717#ifdef __VSX__
7718static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7719  return __builtin_vsx_xvrdpi(__a);
7720}
7721
7722/* vec_rint */
7723
7724static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7725  return __builtin_vsx_xvrspic(__a);
7726}
7727
7728static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7729  return __builtin_vsx_xvrdpic(__a);
7730}
7731
7732/* vec_nearbyint */
7733
7734static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7735  return __builtin_vsx_xvrspi(__a);
7736}
7737
7738static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7739  return __builtin_vsx_xvrdpi(__a);
7740}
7741#endif
7742
7743/* vec_vrfin */
7744
7745static __inline__ vector float __attribute__((__always_inline__))
7746vec_vrfin(vector float __a) {
7747  return __builtin_altivec_vrfin(__a);
7748}
7749
7750/* vec_sqrt */
7751
7752#ifdef __VSX__
7753static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7754  return __builtin_vsx_xvsqrtsp(__a);
7755}
7756
7757static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7758  return __builtin_vsx_xvsqrtdp(__a);
7759}
7760#endif
7761
7762/* vec_rsqrte */
7763
7764static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7765#ifdef __VSX__
7766  return __builtin_vsx_xvrsqrtesp(__a);
7767#else
7768  return __builtin_altivec_vrsqrtefp(__a);
7769#endif
7770}
7771
7772#ifdef __VSX__
7773static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7774  return __builtin_vsx_xvrsqrtedp(__a);
7775}
7776#endif
7777
7778/* vec_vrsqrtefp */
7779
7780static __inline__ __vector float __attribute__((__always_inline__))
7781vec_vrsqrtefp(vector float __a) {
7782  return __builtin_altivec_vrsqrtefp(__a);
7783}
7784
7785/* vec_sel */
7786
7787#define __builtin_altivec_vsel_4si vec_sel
7788
7789static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7790    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7791  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7792}
7793
7794static __inline__ vector signed char __ATTRS_o_ai
7795vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7796  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7797}
7798
7799static __inline__ vector unsigned char __ATTRS_o_ai
7800vec_sel(vector unsigned char __a, vector unsigned char __b,
7801        vector unsigned char __c) {
7802  return (__a & ~__c) | (__b & __c);
7803}
7804
7805static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7806    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7807  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7808}
7809
7810static __inline__ vector bool char __ATTRS_o_ai
7811vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7812  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7813}
7814
7815static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7816                                                        vector bool char __b,
7817                                                        vector bool char __c) {
7818  return (__a & ~__c) | (__b & __c);
7819}
7820
7821static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7822                                                    vector short __b,
7823                                                    vector unsigned short __c) {
7824  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7825}
7826
7827static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7828                                                    vector short __b,
7829                                                    vector bool short __c) {
7830  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7831}
7832
7833static __inline__ vector unsigned short __ATTRS_o_ai
7834vec_sel(vector unsigned short __a, vector unsigned short __b,
7835        vector unsigned short __c) {
7836  return (__a & ~__c) | (__b & __c);
7837}
7838
7839static __inline__ vector unsigned short __ATTRS_o_ai
7840vec_sel(vector unsigned short __a, vector unsigned short __b,
7841        vector bool short __c) {
7842  return (__a & ~(vector unsigned short)__c) |
7843         (__b & (vector unsigned short)__c);
7844}
7845
7846static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7847    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7848  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7849}
7850
7851static __inline__ vector bool short __ATTRS_o_ai
7852vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7853  return (__a & ~__c) | (__b & __c);
7854}
7855
7856static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7857                                                  vector int __b,
7858                                                  vector unsigned int __c) {
7859  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7860}
7861
7862static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7863                                                  vector int __b,
7864                                                  vector bool int __c) {
7865  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7866}
7867
7868static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7869    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7870  return (__a & ~__c) | (__b & __c);
7871}
7872
7873static __inline__ vector unsigned int __ATTRS_o_ai
7874vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7875  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7876}
7877
7878static __inline__ vector bool int __ATTRS_o_ai
7879vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7880  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7881}
7882
7883static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7884                                                       vector bool int __b,
7885                                                       vector bool int __c) {
7886  return (__a & ~__c) | (__b & __c);
7887}
7888
7889static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7890                                                    vector float __b,
7891                                                    vector unsigned int __c) {
7892  vector int __res = ((vector int)__a & ~(vector int)__c) |
7893                     ((vector int)__b & (vector int)__c);
7894  return (vector float)__res;
7895}
7896
7897static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7898                                                    vector float __b,
7899                                                    vector bool int __c) {
7900  vector int __res = ((vector int)__a & ~(vector int)__c) |
7901                     ((vector int)__b & (vector int)__c);
7902  return (vector float)__res;
7903}
7904
7905#ifdef __VSX__
7906static __inline__ vector double __ATTRS_o_ai
7907vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7908  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7909                           ((vector long long)__b & (vector long long)__c);
7910  return (vector double)__res;
7911}
7912
7913static __inline__ vector double __ATTRS_o_ai
7914vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7915  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7916                           ((vector long long)__b & (vector long long)__c);
7917  return (vector double)__res;
7918}
7919#endif
7920
7921/* vec_vsel */
7922
7923static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7924    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7925  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7926}
7927
7928static __inline__ vector signed char __ATTRS_o_ai
7929vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7930  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7931}
7932
7933static __inline__ vector unsigned char __ATTRS_o_ai
7934vec_vsel(vector unsigned char __a, vector unsigned char __b,
7935         vector unsigned char __c) {
7936  return (__a & ~__c) | (__b & __c);
7937}
7938
7939static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7940    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7941  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7942}
7943
7944static __inline__ vector bool char __ATTRS_o_ai
7945vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7946  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7947}
7948
7949static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7950                                                         vector bool char __b,
7951                                                         vector bool char __c) {
7952  return (__a & ~__c) | (__b & __c);
7953}
7954
7955static __inline__ vector short __ATTRS_o_ai
7956vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7957  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7958}
7959
7960static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7961                                                     vector short __b,
7962                                                     vector bool short __c) {
7963  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7964}
7965
7966static __inline__ vector unsigned short __ATTRS_o_ai
7967vec_vsel(vector unsigned short __a, vector unsigned short __b,
7968         vector unsigned short __c) {
7969  return (__a & ~__c) | (__b & __c);
7970}
7971
7972static __inline__ vector unsigned short __ATTRS_o_ai
7973vec_vsel(vector unsigned short __a, vector unsigned short __b,
7974         vector bool short __c) {
7975  return (__a & ~(vector unsigned short)__c) |
7976         (__b & (vector unsigned short)__c);
7977}
7978
7979static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7980    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7981  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7982}
7983
7984static __inline__ vector bool short __ATTRS_o_ai
7985vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7986  return (__a & ~__c) | (__b & __c);
7987}
7988
7989static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7990                                                   vector int __b,
7991                                                   vector unsigned int __c) {
7992  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7993}
7994
7995static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7996                                                   vector int __b,
7997                                                   vector bool int __c) {
7998  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7999}
8000
8001static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8002    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8003  return (__a & ~__c) | (__b & __c);
8004}
8005
8006static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8007    vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8008  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8009}
8010
8011static __inline__ vector bool int __ATTRS_o_ai
8012vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8013  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8014}
8015
8016static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8017                                                        vector bool int __b,
8018                                                        vector bool int __c) {
8019  return (__a & ~__c) | (__b & __c);
8020}
8021
8022static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8023                                                     vector float __b,
8024                                                     vector unsigned int __c) {
8025  vector int __res = ((vector int)__a & ~(vector int)__c) |
8026                     ((vector int)__b & (vector int)__c);
8027  return (vector float)__res;
8028}
8029
8030static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8031                                                     vector float __b,
8032                                                     vector bool int __c) {
8033  vector int __res = ((vector int)__a & ~(vector int)__c) |
8034                     ((vector int)__b & (vector int)__c);
8035  return (vector float)__res;
8036}
8037
8038/* vec_sl */
8039
8040// vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8041// than the length of __a.
8042static __inline__ vector unsigned char __ATTRS_o_ai
8043vec_sl(vector unsigned char __a, vector unsigned char __b) {
8044  return __a << (__b %
8045                 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8046}
8047
8048static __inline__ vector signed char __ATTRS_o_ai
8049vec_sl(vector signed char __a, vector unsigned char __b) {
8050  return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8051}
8052
8053static __inline__ vector unsigned short __ATTRS_o_ai
8054vec_sl(vector unsigned short __a, vector unsigned short __b) {
8055  return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8056                                               __CHAR_BIT__));
8057}
8058
8059static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8060                                                   vector unsigned short __b) {
8061  return (vector short)vec_sl((vector unsigned short)__a, __b);
8062}
8063
8064static __inline__ vector unsigned int __ATTRS_o_ai
8065vec_sl(vector unsigned int __a, vector unsigned int __b) {
8066  return __a << (__b %
8067                 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8068}
8069
8070static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8071                                                 vector unsigned int __b) {
8072  return (vector int)vec_sl((vector unsigned int)__a, __b);
8073}
8074
8075#ifdef __POWER8_VECTOR__
8076static __inline__ vector unsigned long long __ATTRS_o_ai
8077vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8078  return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8079                                                   __CHAR_BIT__));
8080}
8081
8082static __inline__ vector long long __ATTRS_o_ai
8083vec_sl(vector long long __a, vector unsigned long long __b) {
8084  return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8085}
8086#endif
8087
8088/* vec_vslb */
8089
8090#define __builtin_altivec_vslb vec_vslb
8091
8092static __inline__ vector signed char __ATTRS_o_ai
8093vec_vslb(vector signed char __a, vector unsigned char __b) {
8094  return vec_sl(__a, __b);
8095}
8096
8097static __inline__ vector unsigned char __ATTRS_o_ai
8098vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8099  return vec_sl(__a, __b);
8100}
8101
8102/* vec_vslh */
8103
8104#define __builtin_altivec_vslh vec_vslh
8105
8106static __inline__ vector short __ATTRS_o_ai
8107vec_vslh(vector short __a, vector unsigned short __b) {
8108  return vec_sl(__a, __b);
8109}
8110
8111static __inline__ vector unsigned short __ATTRS_o_ai
8112vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8113  return vec_sl(__a, __b);
8114}
8115
8116/* vec_vslw */
8117
8118#define __builtin_altivec_vslw vec_vslw
8119
8120static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8121                                                   vector unsigned int __b) {
8122  return vec_sl(__a, __b);
8123}
8124
8125static __inline__ vector unsigned int __ATTRS_o_ai
8126vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8127  return vec_sl(__a, __b);
8128}
8129
8130/* vec_sld */
8131
8132#define __builtin_altivec_vsldoi_4si vec_sld
8133
8134static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8135    vector signed char __a, vector signed char __b, unsigned const int __c) {
8136  unsigned char __d = __c & 0x0F;
8137#ifdef __LITTLE_ENDIAN__
8138  return vec_perm(
8139      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8140                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8141                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8142                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8143#else
8144  return vec_perm(
8145      __a, __b,
8146      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8147                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8148                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8149#endif
8150}
8151
8152static __inline__ vector unsigned char __ATTRS_o_ai
8153vec_sld(vector unsigned char __a, vector unsigned char __b,
8154        unsigned const int __c) {
8155  unsigned char __d = __c & 0x0F;
8156#ifdef __LITTLE_ENDIAN__
8157  return vec_perm(
8158      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8159                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8160                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8161                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8162#else
8163  return vec_perm(
8164      __a, __b,
8165      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8166                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8167                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8168#endif
8169}
8170
8171static __inline__ vector bool char __ATTRS_o_ai
8172vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8173  unsigned char __d = __c & 0x0F;
8174#ifdef __LITTLE_ENDIAN__
8175  return vec_perm(
8176      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8177                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8178                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8179                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8180#else
8181  return vec_perm(
8182      __a, __b,
8183      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8184                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8185                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8186#endif
8187}
8188
8189static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8190    vector signed short __a, vector signed short __b, unsigned const int __c) {
8191  unsigned char __d = __c & 0x0F;
8192#ifdef __LITTLE_ENDIAN__
8193  return vec_perm(
8194      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8195                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8196                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8197                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8198#else
8199  return vec_perm(
8200      __a, __b,
8201      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8202                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8203                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8204#endif
8205}
8206
8207static __inline__ vector unsigned short __ATTRS_o_ai
8208vec_sld(vector unsigned short __a, vector unsigned short __b,
8209        unsigned const int __c) {
8210  unsigned char __d = __c & 0x0F;
8211#ifdef __LITTLE_ENDIAN__
8212  return vec_perm(
8213      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8214                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8215                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8216                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8217#else
8218  return vec_perm(
8219      __a, __b,
8220      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8221                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8222                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8223#endif
8224}
8225
8226static __inline__ vector bool short __ATTRS_o_ai
8227vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8228  unsigned char __d = __c & 0x0F;
8229#ifdef __LITTLE_ENDIAN__
8230  return vec_perm(
8231      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8232                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8233                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8234                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8235#else
8236  return vec_perm(
8237      __a, __b,
8238      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8239                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8240                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8241#endif
8242}
8243
8244static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8245                                                    vector pixel __b,
8246                                                    unsigned const int __c) {
8247  unsigned char __d = __c & 0x0F;
8248#ifdef __LITTLE_ENDIAN__
8249  return vec_perm(
8250      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8251                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8252                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8253                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8254#else
8255  return vec_perm(
8256      __a, __b,
8257      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8258                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8259                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8260#endif
8261}
8262
8263static __inline__ vector signed int __ATTRS_o_ai
8264vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8265  unsigned char __d = __c & 0x0F;
8266#ifdef __LITTLE_ENDIAN__
8267  return vec_perm(
8268      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8269                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8270                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8271                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8272#else
8273  return vec_perm(
8274      __a, __b,
8275      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8276                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8277                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8278#endif
8279}
8280
8281static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8282    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8283  unsigned char __d = __c & 0x0F;
8284#ifdef __LITTLE_ENDIAN__
8285  return vec_perm(
8286      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8287                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8288                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8289                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8290#else
8291  return vec_perm(
8292      __a, __b,
8293      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8294                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8295                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8296#endif
8297}
8298
8299static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8300                                                       vector bool int __b,
8301                                                       unsigned const int __c) {
8302  unsigned char __d = __c & 0x0F;
8303#ifdef __LITTLE_ENDIAN__
8304  return vec_perm(
8305      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8306                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8307                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8308                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8309#else
8310  return vec_perm(
8311      __a, __b,
8312      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8313                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8314                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8315#endif
8316}
8317
8318static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8319                                                    vector float __b,
8320                                                    unsigned const int __c) {
8321  unsigned char __d = __c & 0x0F;
8322#ifdef __LITTLE_ENDIAN__
8323  return vec_perm(
8324      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8325                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8326                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8327                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8328#else
8329  return vec_perm(
8330      __a, __b,
8331      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8332                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8333                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8334#endif
8335}
8336
8337#ifdef __VSX__
8338static __inline__ vector bool long long __ATTRS_o_ai
8339vec_sld(vector bool long long __a, vector bool long long __b,
8340        unsigned const int __c) {
8341  unsigned char __d = __c & 0x0F;
8342#ifdef __LITTLE_ENDIAN__
8343  return vec_perm(
8344      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8345                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8346                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8347                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8348#else
8349  return vec_perm(
8350      __a, __b,
8351      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8352                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8353                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8354#endif
8355}
8356
8357static __inline__ vector signed long long __ATTRS_o_ai
8358vec_sld(vector signed long long __a, vector signed long long __b,
8359        unsigned const int __c) {
8360  unsigned char __d = __c & 0x0F;
8361#ifdef __LITTLE_ENDIAN__
8362  return vec_perm(
8363      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8364                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8365                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8366                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8367#else
8368  return vec_perm(
8369      __a, __b,
8370      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8371                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8372                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8373#endif
8374}
8375
8376static __inline__ vector unsigned long long __ATTRS_o_ai
8377vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8378        unsigned const int __c) {
8379  unsigned char __d = __c & 0x0F;
8380#ifdef __LITTLE_ENDIAN__
8381  return vec_perm(
8382      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8383                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8384                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8385                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8386#else
8387  return vec_perm(
8388      __a, __b,
8389      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8390                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8391                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8392#endif
8393}
8394
8395static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8396                                                     vector double __b,
8397                                                     unsigned const int __c) {
8398  unsigned char __d = __c & 0x0F;
8399#ifdef __LITTLE_ENDIAN__
8400  return vec_perm(
8401      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8402                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8403                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8404                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8405#else
8406  return vec_perm(
8407      __a, __b,
8408      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8409                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8410                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8411#endif
8412}
8413#endif
8414
8415/* vec_sldw */
8416static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8417    vector signed char __a, vector signed char __b, unsigned const int __c) {
8418  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8419}
8420
8421static __inline__ vector unsigned char __ATTRS_o_ai
8422vec_sldw(vector unsigned char __a, vector unsigned char __b,
8423         unsigned const int __c) {
8424  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8425}
8426
8427static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8428    vector signed short __a, vector signed short __b, unsigned const int __c) {
8429  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8430}
8431
8432static __inline__ vector unsigned short __ATTRS_o_ai
8433vec_sldw(vector unsigned short __a, vector unsigned short __b,
8434         unsigned const int __c) {
8435  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8436}
8437
8438static __inline__ vector signed int __ATTRS_o_ai
8439vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8440  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8441}
8442
8443static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8444    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8445  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8446}
8447
8448#ifdef __VSX__
8449static __inline__ vector signed long long __ATTRS_o_ai
8450vec_sldw(vector signed long long __a, vector signed long long __b,
8451         unsigned const int __c) {
8452  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8453}
8454
8455static __inline__ vector unsigned long long __ATTRS_o_ai
8456vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8457         unsigned const int __c) {
8458  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8459}
8460#endif
8461
8462#ifdef __POWER9_VECTOR__
8463/* vec_slv */
8464static __inline__ vector unsigned char __ATTRS_o_ai
8465vec_slv(vector unsigned char __a, vector unsigned char __b) {
8466  return __builtin_altivec_vslv(__a, __b);
8467}
8468
8469/* vec_srv */
8470static __inline__ vector unsigned char __ATTRS_o_ai
8471vec_srv(vector unsigned char __a, vector unsigned char __b) {
8472  return __builtin_altivec_vsrv(__a, __b);
8473}
8474#endif
8475
8476/* vec_vsldoi */
8477
8478static __inline__ vector signed char __ATTRS_o_ai
8479vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8480  unsigned char __d = __c & 0x0F;
8481#ifdef __LITTLE_ENDIAN__
8482  return vec_perm(
8483      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8484                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8485                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8486                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8487#else
8488  return vec_perm(
8489      __a, __b,
8490      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8491                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8492                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8493#endif
8494}
8495
8496static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8497    vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8498  unsigned char __d = __c & 0x0F;
8499#ifdef __LITTLE_ENDIAN__
8500  return vec_perm(
8501      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8502                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8503                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8504                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8505#else
8506  return vec_perm(
8507      __a, __b,
8508      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8509                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8510                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8511#endif
8512}
8513
8514static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8515                                                       vector short __b,
8516                                                       unsigned char __c) {
8517  unsigned char __d = __c & 0x0F;
8518#ifdef __LITTLE_ENDIAN__
8519  return vec_perm(
8520      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8521                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8522                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8523                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8524#else
8525  return vec_perm(
8526      __a, __b,
8527      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8528                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8529                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8530#endif
8531}
8532
8533static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8534    vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8535  unsigned char __d = __c & 0x0F;
8536#ifdef __LITTLE_ENDIAN__
8537  return vec_perm(
8538      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8539                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8540                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8541                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8542#else
8543  return vec_perm(
8544      __a, __b,
8545      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8546                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8547                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8548#endif
8549}
8550
8551static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8552                                                       vector pixel __b,
8553                                                       unsigned char __c) {
8554  unsigned char __d = __c & 0x0F;
8555#ifdef __LITTLE_ENDIAN__
8556  return vec_perm(
8557      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8558                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8559                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8560                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8561#else
8562  return vec_perm(
8563      __a, __b,
8564      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8565                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8566                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8567#endif
8568}
8569
8570static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8571                                                     vector int __b,
8572                                                     unsigned char __c) {
8573  unsigned char __d = __c & 0x0F;
8574#ifdef __LITTLE_ENDIAN__
8575  return vec_perm(
8576      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8577                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8578                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8579                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8580#else
8581  return vec_perm(
8582      __a, __b,
8583      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8584                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8585                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8586#endif
8587}
8588
8589static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8590    vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8591  unsigned char __d = __c & 0x0F;
8592#ifdef __LITTLE_ENDIAN__
8593  return vec_perm(
8594      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8595                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8596                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8597                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8598#else
8599  return vec_perm(
8600      __a, __b,
8601      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8602                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8603                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8604#endif
8605}
8606
8607static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8608                                                       vector float __b,
8609                                                       unsigned char __c) {
8610  unsigned char __d = __c & 0x0F;
8611#ifdef __LITTLE_ENDIAN__
8612  return vec_perm(
8613      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8614                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8615                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8616                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8617#else
8618  return vec_perm(
8619      __a, __b,
8620      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8621                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8622                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8623#endif
8624}
8625
8626/* vec_sll */
8627
8628static __inline__ vector signed char __ATTRS_o_ai
8629vec_sll(vector signed char __a, vector unsigned char __b) {
8630  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8631                                                   (vector int)__b);
8632}
8633
8634static __inline__ vector signed char __ATTRS_o_ai
8635vec_sll(vector signed char __a, vector unsigned short __b) {
8636  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8637                                                   (vector int)__b);
8638}
8639
8640static __inline__ vector signed char __ATTRS_o_ai
8641vec_sll(vector signed char __a, vector unsigned int __b) {
8642  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8643                                                   (vector int)__b);
8644}
8645
8646static __inline__ vector unsigned char __ATTRS_o_ai
8647vec_sll(vector unsigned char __a, vector unsigned char __b) {
8648  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8649                                                     (vector int)__b);
8650}
8651
8652static __inline__ vector unsigned char __ATTRS_o_ai
8653vec_sll(vector unsigned char __a, vector unsigned short __b) {
8654  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8655                                                     (vector int)__b);
8656}
8657
8658static __inline__ vector unsigned char __ATTRS_o_ai
8659vec_sll(vector unsigned char __a, vector unsigned int __b) {
8660  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8661                                                     (vector int)__b);
8662}
8663
8664static __inline__ vector bool char __ATTRS_o_ai
8665vec_sll(vector bool char __a, vector unsigned char __b) {
8666  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8667                                                 (vector int)__b);
8668}
8669
8670static __inline__ vector bool char __ATTRS_o_ai
8671vec_sll(vector bool char __a, vector unsigned short __b) {
8672  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8673                                                 (vector int)__b);
8674}
8675
8676static __inline__ vector bool char __ATTRS_o_ai
8677vec_sll(vector bool char __a, vector unsigned int __b) {
8678  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8679                                                 (vector int)__b);
8680}
8681
8682static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8683                                                    vector unsigned char __b) {
8684  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8685}
8686
8687static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8688                                                    vector unsigned short __b) {
8689  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8690}
8691
8692static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8693                                                    vector unsigned int __b) {
8694  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8695}
8696
8697static __inline__ vector unsigned short __ATTRS_o_ai
8698vec_sll(vector unsigned short __a, vector unsigned char __b) {
8699  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8700                                                      (vector int)__b);
8701}
8702
8703static __inline__ vector unsigned short __ATTRS_o_ai
8704vec_sll(vector unsigned short __a, vector unsigned short __b) {
8705  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8706                                                      (vector int)__b);
8707}
8708
8709static __inline__ vector unsigned short __ATTRS_o_ai
8710vec_sll(vector unsigned short __a, vector unsigned int __b) {
8711  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8712                                                      (vector int)__b);
8713}
8714
8715static __inline__ vector bool short __ATTRS_o_ai
8716vec_sll(vector bool short __a, vector unsigned char __b) {
8717  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8718                                                  (vector int)__b);
8719}
8720
8721static __inline__ vector bool short __ATTRS_o_ai
8722vec_sll(vector bool short __a, vector unsigned short __b) {
8723  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8724                                                  (vector int)__b);
8725}
8726
8727static __inline__ vector bool short __ATTRS_o_ai
8728vec_sll(vector bool short __a, vector unsigned int __b) {
8729  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8730                                                  (vector int)__b);
8731}
8732
8733static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8734                                                    vector unsigned char __b) {
8735  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8736}
8737
8738static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8739                                                    vector unsigned short __b) {
8740  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8741}
8742
8743static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8744                                                    vector unsigned int __b) {
8745  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8746}
8747
8748static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8749                                                  vector unsigned char __b) {
8750  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8751}
8752
8753static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8754                                                  vector unsigned short __b) {
8755  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8756}
8757
8758static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8759                                                  vector unsigned int __b) {
8760  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8761}
8762
8763static __inline__ vector unsigned int __ATTRS_o_ai
8764vec_sll(vector unsigned int __a, vector unsigned char __b) {
8765  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8766                                                    (vector int)__b);
8767}
8768
8769static __inline__ vector unsigned int __ATTRS_o_ai
8770vec_sll(vector unsigned int __a, vector unsigned short __b) {
8771  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8772                                                    (vector int)__b);
8773}
8774
8775static __inline__ vector unsigned int __ATTRS_o_ai
8776vec_sll(vector unsigned int __a, vector unsigned int __b) {
8777  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8778                                                    (vector int)__b);
8779}
8780
8781static __inline__ vector bool int __ATTRS_o_ai
8782vec_sll(vector bool int __a, vector unsigned char __b) {
8783  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8784                                                (vector int)__b);
8785}
8786
8787static __inline__ vector bool int __ATTRS_o_ai
8788vec_sll(vector bool int __a, vector unsigned short __b) {
8789  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8790                                                (vector int)__b);
8791}
8792
8793static __inline__ vector bool int __ATTRS_o_ai
8794vec_sll(vector bool int __a, vector unsigned int __b) {
8795  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8796                                                (vector int)__b);
8797}
8798
8799#ifdef __VSX__
8800static __inline__ vector signed long long __ATTRS_o_ai
8801vec_sll(vector signed long long __a, vector unsigned char __b) {
8802  return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8803                                                        (vector int)__b);
8804}
8805
8806static __inline__ vector unsigned long long __ATTRS_o_ai
8807vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8808  return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8809                                                          (vector int)__b);
8810}
8811#endif
8812
8813/* vec_vsl */
8814
8815static __inline__ vector signed char __ATTRS_o_ai
8816vec_vsl(vector signed char __a, vector unsigned char __b) {
8817  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8818                                                   (vector int)__b);
8819}
8820
8821static __inline__ vector signed char __ATTRS_o_ai
8822vec_vsl(vector signed char __a, vector unsigned short __b) {
8823  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8824                                                   (vector int)__b);
8825}
8826
8827static __inline__ vector signed char __ATTRS_o_ai
8828vec_vsl(vector signed char __a, vector unsigned int __b) {
8829  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8830                                                   (vector int)__b);
8831}
8832
8833static __inline__ vector unsigned char __ATTRS_o_ai
8834vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8835  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8836                                                     (vector int)__b);
8837}
8838
8839static __inline__ vector unsigned char __ATTRS_o_ai
8840vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8841  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8842                                                     (vector int)__b);
8843}
8844
8845static __inline__ vector unsigned char __ATTRS_o_ai
8846vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8847  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8848                                                     (vector int)__b);
8849}
8850
8851static __inline__ vector bool char __ATTRS_o_ai
8852vec_vsl(vector bool char __a, vector unsigned char __b) {
8853  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8854                                                 (vector int)__b);
8855}
8856
8857static __inline__ vector bool char __ATTRS_o_ai
8858vec_vsl(vector bool char __a, vector unsigned short __b) {
8859  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8860                                                 (vector int)__b);
8861}
8862
8863static __inline__ vector bool char __ATTRS_o_ai
8864vec_vsl(vector bool char __a, vector unsigned int __b) {
8865  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8866                                                 (vector int)__b);
8867}
8868
8869static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8870                                                    vector unsigned char __b) {
8871  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8872}
8873
8874static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8875                                                    vector unsigned short __b) {
8876  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8877}
8878
8879static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8880                                                    vector unsigned int __b) {
8881  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8882}
8883
8884static __inline__ vector unsigned short __ATTRS_o_ai
8885vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8886  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8887                                                      (vector int)__b);
8888}
8889
8890static __inline__ vector unsigned short __ATTRS_o_ai
8891vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8892  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8893                                                      (vector int)__b);
8894}
8895
8896static __inline__ vector unsigned short __ATTRS_o_ai
8897vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8898  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8899                                                      (vector int)__b);
8900}
8901
8902static __inline__ vector bool short __ATTRS_o_ai
8903vec_vsl(vector bool short __a, vector unsigned char __b) {
8904  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8905                                                  (vector int)__b);
8906}
8907
8908static __inline__ vector bool short __ATTRS_o_ai
8909vec_vsl(vector bool short __a, vector unsigned short __b) {
8910  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8911                                                  (vector int)__b);
8912}
8913
8914static __inline__ vector bool short __ATTRS_o_ai
8915vec_vsl(vector bool short __a, vector unsigned int __b) {
8916  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8917                                                  (vector int)__b);
8918}
8919
8920static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8921                                                    vector unsigned char __b) {
8922  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8923}
8924
8925static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8926                                                    vector unsigned short __b) {
8927  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8928}
8929
8930static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8931                                                    vector unsigned int __b) {
8932  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8933}
8934
8935static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8936                                                  vector unsigned char __b) {
8937  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8938}
8939
8940static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8941                                                  vector unsigned short __b) {
8942  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8943}
8944
8945static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8946                                                  vector unsigned int __b) {
8947  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8948}
8949
8950static __inline__ vector unsigned int __ATTRS_o_ai
8951vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8952  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8953                                                    (vector int)__b);
8954}
8955
8956static __inline__ vector unsigned int __ATTRS_o_ai
8957vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8958  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8959                                                    (vector int)__b);
8960}
8961
8962static __inline__ vector unsigned int __ATTRS_o_ai
8963vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8964  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8965                                                    (vector int)__b);
8966}
8967
8968static __inline__ vector bool int __ATTRS_o_ai
8969vec_vsl(vector bool int __a, vector unsigned char __b) {
8970  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8971                                                (vector int)__b);
8972}
8973
8974static __inline__ vector bool int __ATTRS_o_ai
8975vec_vsl(vector bool int __a, vector unsigned short __b) {
8976  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8977                                                (vector int)__b);
8978}
8979
8980static __inline__ vector bool int __ATTRS_o_ai
8981vec_vsl(vector bool int __a, vector unsigned int __b) {
8982  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8983                                                (vector int)__b);
8984}
8985
8986/* vec_slo */
8987
8988static __inline__ vector signed char __ATTRS_o_ai
8989vec_slo(vector signed char __a, vector signed char __b) {
8990  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8991                                                    (vector int)__b);
8992}
8993
8994static __inline__ vector signed char __ATTRS_o_ai
8995vec_slo(vector signed char __a, vector unsigned char __b) {
8996  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8997                                                    (vector int)__b);
8998}
8999
9000static __inline__ vector unsigned char __ATTRS_o_ai
9001vec_slo(vector unsigned char __a, vector signed char __b) {
9002  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9003                                                      (vector int)__b);
9004}
9005
9006static __inline__ vector unsigned char __ATTRS_o_ai
9007vec_slo(vector unsigned char __a, vector unsigned char __b) {
9008  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9009                                                      (vector int)__b);
9010}
9011
9012static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9013                                                    vector signed char __b) {
9014  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9015}
9016
9017static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9018                                                    vector unsigned char __b) {
9019  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9020}
9021
9022static __inline__ vector unsigned short __ATTRS_o_ai
9023vec_slo(vector unsigned short __a, vector signed char __b) {
9024  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9025                                                       (vector int)__b);
9026}
9027
9028static __inline__ vector unsigned short __ATTRS_o_ai
9029vec_slo(vector unsigned short __a, vector unsigned char __b) {
9030  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9031                                                       (vector int)__b);
9032}
9033
9034static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9035                                                    vector signed char __b) {
9036  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9037}
9038
9039static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9040                                                    vector unsigned char __b) {
9041  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9042}
9043
9044static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9045                                                  vector signed char __b) {
9046  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9047}
9048
9049static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9050                                                  vector unsigned char __b) {
9051  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9052}
9053
9054static __inline__ vector unsigned int __ATTRS_o_ai
9055vec_slo(vector unsigned int __a, vector signed char __b) {
9056  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9057                                                     (vector int)__b);
9058}
9059
9060static __inline__ vector unsigned int __ATTRS_o_ai
9061vec_slo(vector unsigned int __a, vector unsigned char __b) {
9062  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9063                                                     (vector int)__b);
9064}
9065
9066static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9067                                                    vector signed char __b) {
9068  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9069}
9070
9071static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9072                                                    vector unsigned char __b) {
9073  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9074}
9075
9076#ifdef __VSX__
9077static __inline__ vector signed long long __ATTRS_o_ai
9078vec_slo(vector signed long long __a, vector signed char __b) {
9079  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9080                                                         (vector int)__b);
9081}
9082
9083static __inline__ vector signed long long __ATTRS_o_ai
9084vec_slo(vector signed long long __a, vector unsigned char __b) {
9085  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9086                                                         (vector int)__b);
9087}
9088
9089static __inline__ vector unsigned long long __ATTRS_o_ai
9090vec_slo(vector unsigned long long __a, vector signed char __b) {
9091  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9092                                                           (vector int)__b);
9093}
9094
9095static __inline__ vector unsigned long long __ATTRS_o_ai
9096vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9097  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9098                                                           (vector int)__b);
9099}
9100#endif
9101
9102/* vec_vslo */
9103
9104static __inline__ vector signed char __ATTRS_o_ai
9105vec_vslo(vector signed char __a, vector signed char __b) {
9106  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9107                                                    (vector int)__b);
9108}
9109
9110static __inline__ vector signed char __ATTRS_o_ai
9111vec_vslo(vector signed char __a, vector unsigned char __b) {
9112  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9113                                                    (vector int)__b);
9114}
9115
9116static __inline__ vector unsigned char __ATTRS_o_ai
9117vec_vslo(vector unsigned char __a, vector signed char __b) {
9118  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9119                                                      (vector int)__b);
9120}
9121
9122static __inline__ vector unsigned char __ATTRS_o_ai
9123vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9124  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9125                                                      (vector int)__b);
9126}
9127
9128static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9129                                                     vector signed char __b) {
9130  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9131}
9132
9133static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9134                                                     vector unsigned char __b) {
9135  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9136}
9137
9138static __inline__ vector unsigned short __ATTRS_o_ai
9139vec_vslo(vector unsigned short __a, vector signed char __b) {
9140  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9141                                                       (vector int)__b);
9142}
9143
9144static __inline__ vector unsigned short __ATTRS_o_ai
9145vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9146  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9147                                                       (vector int)__b);
9148}
9149
9150static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9151                                                     vector signed char __b) {
9152  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9153}
9154
9155static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9156                                                     vector unsigned char __b) {
9157  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9158}
9159
9160static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9161                                                   vector signed char __b) {
9162  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9163}
9164
9165static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9166                                                   vector unsigned char __b) {
9167  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9168}
9169
9170static __inline__ vector unsigned int __ATTRS_o_ai
9171vec_vslo(vector unsigned int __a, vector signed char __b) {
9172  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9173                                                     (vector int)__b);
9174}
9175
9176static __inline__ vector unsigned int __ATTRS_o_ai
9177vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9178  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9179                                                     (vector int)__b);
9180}
9181
9182static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9183                                                     vector signed char __b) {
9184  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9185}
9186
9187static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9188                                                     vector unsigned char __b) {
9189  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9190}
9191
9192/* vec_splat */
9193
9194static __inline__ vector signed char __ATTRS_o_ai
9195vec_splat(vector signed char __a, unsigned const int __b) {
9196  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9197}
9198
9199static __inline__ vector unsigned char __ATTRS_o_ai
9200vec_splat(vector unsigned char __a, unsigned const int __b) {
9201  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9202}
9203
9204static __inline__ vector bool char __ATTRS_o_ai
9205vec_splat(vector bool char __a, unsigned const int __b) {
9206  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9207}
9208
9209static __inline__ vector signed short __ATTRS_o_ai
9210vec_splat(vector signed short __a, unsigned const int __b) {
9211  unsigned char b0 = (__b & 0x07) * 2;
9212  unsigned char b1 = b0 + 1;
9213  return vec_perm(__a, __a,
9214                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9215                                         b0, b1, b0, b1, b0, b1));
9216}
9217
9218static __inline__ vector unsigned short __ATTRS_o_ai
9219vec_splat(vector unsigned short __a, unsigned const int __b) {
9220  unsigned char b0 = (__b & 0x07) * 2;
9221  unsigned char b1 = b0 + 1;
9222  return vec_perm(__a, __a,
9223                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9224                                         b0, b1, b0, b1, b0, b1));
9225}
9226
9227static __inline__ vector bool short __ATTRS_o_ai
9228vec_splat(vector bool short __a, unsigned const int __b) {
9229  unsigned char b0 = (__b & 0x07) * 2;
9230  unsigned char b1 = b0 + 1;
9231  return vec_perm(__a, __a,
9232                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9233                                         b0, b1, b0, b1, b0, b1));
9234}
9235
9236static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9237                                                      unsigned const int __b) {
9238  unsigned char b0 = (__b & 0x07) * 2;
9239  unsigned char b1 = b0 + 1;
9240  return vec_perm(__a, __a,
9241                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9242                                         b0, b1, b0, b1, b0, b1));
9243}
9244
9245static __inline__ vector signed int __ATTRS_o_ai
9246vec_splat(vector signed int __a, unsigned const int __b) {
9247  unsigned char b0 = (__b & 0x03) * 4;
9248  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9249  return vec_perm(__a, __a,
9250                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9251                                         b2, b3, b0, b1, b2, b3));
9252}
9253
9254static __inline__ vector unsigned int __ATTRS_o_ai
9255vec_splat(vector unsigned int __a, unsigned const int __b) {
9256  unsigned char b0 = (__b & 0x03) * 4;
9257  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9258  return vec_perm(__a, __a,
9259                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9260                                         b2, b3, b0, b1, b2, b3));
9261}
9262
9263static __inline__ vector bool int __ATTRS_o_ai
9264vec_splat(vector bool int __a, unsigned const int __b) {
9265  unsigned char b0 = (__b & 0x03) * 4;
9266  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9267  return vec_perm(__a, __a,
9268                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9269                                         b2, b3, b0, b1, b2, b3));
9270}
9271
9272static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9273                                                      unsigned const int __b) {
9274  unsigned char b0 = (__b & 0x03) * 4;
9275  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9276  return vec_perm(__a, __a,
9277                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9278                                         b2, b3, b0, b1, b2, b3));
9279}
9280
9281#ifdef __VSX__
9282static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9283                                                       unsigned const int __b) {
9284  unsigned char b0 = (__b & 0x01) * 8;
9285  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9286                b6 = b0 + 6, b7 = b0 + 7;
9287  return vec_perm(__a, __a,
9288                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9289                                         b2, b3, b4, b5, b6, b7));
9290}
9291static __inline__ vector bool long long __ATTRS_o_ai
9292vec_splat(vector bool long long __a, unsigned const int __b) {
9293  unsigned char b0 = (__b & 0x01) * 8;
9294  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9295                b6 = b0 + 6, b7 = b0 + 7;
9296  return vec_perm(__a, __a,
9297                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9298                                         b2, b3, b4, b5, b6, b7));
9299}
9300static __inline__ vector signed long long __ATTRS_o_ai
9301vec_splat(vector signed long long __a, unsigned const int __b) {
9302  unsigned char b0 = (__b & 0x01) * 8;
9303  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9304                b6 = b0 + 6, b7 = b0 + 7;
9305  return vec_perm(__a, __a,
9306                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9307                                         b2, b3, b4, b5, b6, b7));
9308}
9309static __inline__ vector unsigned long long __ATTRS_o_ai
9310vec_splat(vector unsigned long long __a, unsigned const int __b) {
9311  unsigned char b0 = (__b & 0x01) * 8;
9312  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9313                b6 = b0 + 6, b7 = b0 + 7;
9314  return vec_perm(__a, __a,
9315                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9316                                         b2, b3, b4, b5, b6, b7));
9317}
9318#endif
9319
9320/* vec_vspltb */
9321
9322#define __builtin_altivec_vspltb vec_vspltb
9323
9324static __inline__ vector signed char __ATTRS_o_ai
9325vec_vspltb(vector signed char __a, unsigned char __b) {
9326  return vec_perm(__a, __a, (vector unsigned char)(__b));
9327}
9328
9329static __inline__ vector unsigned char __ATTRS_o_ai
9330vec_vspltb(vector unsigned char __a, unsigned char __b) {
9331  return vec_perm(__a, __a, (vector unsigned char)(__b));
9332}
9333
9334static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9335                                                           unsigned char __b) {
9336  return vec_perm(__a, __a, (vector unsigned char)(__b));
9337}
9338
9339/* vec_vsplth */
9340
9341#define __builtin_altivec_vsplth vec_vsplth
9342
9343static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9344                                                       unsigned char __b) {
9345  __b *= 2;
9346  unsigned char b1 = __b + 1;
9347  return vec_perm(__a, __a,
9348                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9349                                         __b, b1, __b, b1, __b, b1, __b, b1));
9350}
9351
9352static __inline__ vector unsigned short __ATTRS_o_ai
9353vec_vsplth(vector unsigned short __a, unsigned char __b) {
9354  __b *= 2;
9355  unsigned char b1 = __b + 1;
9356  return vec_perm(__a, __a,
9357                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9358                                         __b, b1, __b, b1, __b, b1, __b, b1));
9359}
9360
9361static __inline__ vector bool short __ATTRS_o_ai
9362vec_vsplth(vector bool short __a, unsigned char __b) {
9363  __b *= 2;
9364  unsigned char b1 = __b + 1;
9365  return vec_perm(__a, __a,
9366                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9367                                         __b, b1, __b, b1, __b, b1, __b, b1));
9368}
9369
9370static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9371                                                       unsigned char __b) {
9372  __b *= 2;
9373  unsigned char b1 = __b + 1;
9374  return vec_perm(__a, __a,
9375                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9376                                         __b, b1, __b, b1, __b, b1, __b, b1));
9377}
9378
9379/* vec_vspltw */
9380
9381#define __builtin_altivec_vspltw vec_vspltw
9382
9383static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9384                                                     unsigned char __b) {
9385  __b *= 4;
9386  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9387  return vec_perm(__a, __a,
9388                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9389                                         b1, b2, b3, __b, b1, b2, b3));
9390}
9391
9392static __inline__ vector unsigned int __ATTRS_o_ai
9393vec_vspltw(vector unsigned int __a, unsigned char __b) {
9394  __b *= 4;
9395  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9396  return vec_perm(__a, __a,
9397                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9398                                         b1, b2, b3, __b, b1, b2, b3));
9399}
9400
9401static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9402                                                          unsigned char __b) {
9403  __b *= 4;
9404  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9405  return vec_perm(__a, __a,
9406                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9407                                         b1, b2, b3, __b, b1, b2, b3));
9408}
9409
9410static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9411                                                       unsigned char __b) {
9412  __b *= 4;
9413  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9414  return vec_perm(__a, __a,
9415                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9416                                         b1, b2, b3, __b, b1, b2, b3));
9417}
9418
9419/* vec_splat_s8 */
9420
9421#define __builtin_altivec_vspltisb vec_splat_s8
9422
9423// FIXME: parameter should be treated as 5-bit signed literal
9424static __inline__ vector signed char __ATTRS_o_ai
9425vec_splat_s8(signed char __a) {
9426  return (vector signed char)(__a);
9427}
9428
9429/* vec_vspltisb */
9430
9431// FIXME: parameter should be treated as 5-bit signed literal
9432static __inline__ vector signed char __ATTRS_o_ai
9433vec_vspltisb(signed char __a) {
9434  return (vector signed char)(__a);
9435}
9436
9437/* vec_splat_s16 */
9438
9439#define __builtin_altivec_vspltish vec_splat_s16
9440
9441// FIXME: parameter should be treated as 5-bit signed literal
9442static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9443  return (vector short)(__a);
9444}
9445
9446/* vec_vspltish */
9447
9448// FIXME: parameter should be treated as 5-bit signed literal
9449static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9450  return (vector short)(__a);
9451}
9452
9453/* vec_splat_s32 */
9454
9455#define __builtin_altivec_vspltisw vec_splat_s32
9456
9457// FIXME: parameter should be treated as 5-bit signed literal
9458static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9459  return (vector int)(__a);
9460}
9461
9462/* vec_vspltisw */
9463
9464// FIXME: parameter should be treated as 5-bit signed literal
9465static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9466  return (vector int)(__a);
9467}
9468
9469/* vec_splat_u8 */
9470
9471// FIXME: parameter should be treated as 5-bit signed literal
9472static __inline__ vector unsigned char __ATTRS_o_ai
9473vec_splat_u8(unsigned char __a) {
9474  return (vector unsigned char)(__a);
9475}
9476
9477/* vec_splat_u16 */
9478
9479// FIXME: parameter should be treated as 5-bit signed literal
9480static __inline__ vector unsigned short __ATTRS_o_ai
9481vec_splat_u16(signed char __a) {
9482  return (vector unsigned short)(__a);
9483}
9484
9485/* vec_splat_u32 */
9486
9487// FIXME: parameter should be treated as 5-bit signed literal
9488static __inline__ vector unsigned int __ATTRS_o_ai
9489vec_splat_u32(signed char __a) {
9490  return (vector unsigned int)(__a);
9491}
9492
9493/* vec_sr */
9494
9495// vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
9496// than the length of __a.
9497static __inline__ vector unsigned char __ATTRS_o_ai
9498vec_sr(vector unsigned char __a, vector unsigned char __b) {
9499  return __a >>
9500         (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
9501}
9502
9503static __inline__ vector signed char __ATTRS_o_ai
9504vec_sr(vector signed char __a, vector unsigned char __b) {
9505  return (vector signed char)vec_sr((vector unsigned char)__a, __b);
9506}
9507
9508static __inline__ vector unsigned short __ATTRS_o_ai
9509vec_sr(vector unsigned short __a, vector unsigned short __b) {
9510  return __a >>
9511         (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
9512}
9513
9514static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
9515                                                   vector unsigned short __b) {
9516  return (vector short)vec_sr((vector unsigned short)__a, __b);
9517}
9518
9519static __inline__ vector unsigned int __ATTRS_o_ai
9520vec_sr(vector unsigned int __a, vector unsigned int __b) {
9521  return __a >>
9522         (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
9523}
9524
9525static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
9526                                                 vector unsigned int __b) {
9527  return (vector int)vec_sr((vector unsigned int)__a, __b);
9528}
9529
9530#ifdef __POWER8_VECTOR__
9531static __inline__ vector unsigned long long __ATTRS_o_ai
9532vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9533  return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
9534                                                   __CHAR_BIT__));
9535}
9536
9537static __inline__ vector long long __ATTRS_o_ai
9538vec_sr(vector long long __a, vector unsigned long long __b) {
9539  return (vector long long)vec_sr((vector unsigned long long)__a, __b);
9540}
9541#endif
9542
9543/* vec_vsrb */
9544
9545#define __builtin_altivec_vsrb vec_vsrb
9546
9547static __inline__ vector signed char __ATTRS_o_ai
9548vec_vsrb(vector signed char __a, vector unsigned char __b) {
9549  return vec_sr(__a, __b);
9550}
9551
9552static __inline__ vector unsigned char __ATTRS_o_ai
9553vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9554  return vec_sr(__a, __b);
9555}
9556
9557/* vec_vsrh */
9558
9559#define __builtin_altivec_vsrh vec_vsrh
9560
9561static __inline__ vector short __ATTRS_o_ai
9562vec_vsrh(vector short __a, vector unsigned short __b) {
9563  return vec_sr(__a, __b);
9564}
9565
9566static __inline__ vector unsigned short __ATTRS_o_ai
9567vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9568  return vec_sr(__a, __b);
9569}
9570
9571/* vec_vsrw */
9572
9573#define __builtin_altivec_vsrw vec_vsrw
9574
9575static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9576                                                   vector unsigned int __b) {
9577  return vec_sr(__a, __b);
9578}
9579
9580static __inline__ vector unsigned int __ATTRS_o_ai
9581vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9582  return vec_sr(__a, __b);
9583}
9584
9585/* vec_sra */
9586
9587static __inline__ vector signed char __ATTRS_o_ai
9588vec_sra(vector signed char __a, vector unsigned char __b) {
9589  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9590}
9591
9592static __inline__ vector unsigned char __ATTRS_o_ai
9593vec_sra(vector unsigned char __a, vector unsigned char __b) {
9594  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9595}
9596
9597static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9598                                                    vector unsigned short __b) {
9599  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9600}
9601
9602static __inline__ vector unsigned short __ATTRS_o_ai
9603vec_sra(vector unsigned short __a, vector unsigned short __b) {
9604  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9605}
9606
9607static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9608                                                  vector unsigned int __b) {
9609  return __builtin_altivec_vsraw(__a, __b);
9610}
9611
9612static __inline__ vector unsigned int __ATTRS_o_ai
9613vec_sra(vector unsigned int __a, vector unsigned int __b) {
9614  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9615}
9616
9617#ifdef __POWER8_VECTOR__
9618static __inline__ vector signed long long __ATTRS_o_ai
9619vec_sra(vector signed long long __a, vector unsigned long long __b) {
9620  return __a >> __b;
9621}
9622
9623static __inline__ vector unsigned long long __ATTRS_o_ai
9624vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9625  return (vector unsigned long long)((vector signed long long)__a >> __b);
9626}
9627#endif
9628
9629/* vec_vsrab */
9630
9631static __inline__ vector signed char __ATTRS_o_ai
9632vec_vsrab(vector signed char __a, vector unsigned char __b) {
9633  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9634}
9635
9636static __inline__ vector unsigned char __ATTRS_o_ai
9637vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9638  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9639}
9640
9641/* vec_vsrah */
9642
9643static __inline__ vector short __ATTRS_o_ai
9644vec_vsrah(vector short __a, vector unsigned short __b) {
9645  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9646}
9647
9648static __inline__ vector unsigned short __ATTRS_o_ai
9649vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9650  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9651}
9652
9653/* vec_vsraw */
9654
9655static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9656                                                    vector unsigned int __b) {
9657  return __builtin_altivec_vsraw(__a, __b);
9658}
9659
9660static __inline__ vector unsigned int __ATTRS_o_ai
9661vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9662  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9663}
9664
9665/* vec_srl */
9666
9667static __inline__ vector signed char __ATTRS_o_ai
9668vec_srl(vector signed char __a, vector unsigned char __b) {
9669  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9670                                                   (vector int)__b);
9671}
9672
9673static __inline__ vector signed char __ATTRS_o_ai
9674vec_srl(vector signed char __a, vector unsigned short __b) {
9675  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9676                                                   (vector int)__b);
9677}
9678
9679static __inline__ vector signed char __ATTRS_o_ai
9680vec_srl(vector signed char __a, vector unsigned int __b) {
9681  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9682                                                   (vector int)__b);
9683}
9684
9685static __inline__ vector unsigned char __ATTRS_o_ai
9686vec_srl(vector unsigned char __a, vector unsigned char __b) {
9687  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9688                                                     (vector int)__b);
9689}
9690
9691static __inline__ vector unsigned char __ATTRS_o_ai
9692vec_srl(vector unsigned char __a, vector unsigned short __b) {
9693  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9694                                                     (vector int)__b);
9695}
9696
9697static __inline__ vector unsigned char __ATTRS_o_ai
9698vec_srl(vector unsigned char __a, vector unsigned int __b) {
9699  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9700                                                     (vector int)__b);
9701}
9702
9703static __inline__ vector bool char __ATTRS_o_ai
9704vec_srl(vector bool char __a, vector unsigned char __b) {
9705  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9706                                                 (vector int)__b);
9707}
9708
9709static __inline__ vector bool char __ATTRS_o_ai
9710vec_srl(vector bool char __a, vector unsigned short __b) {
9711  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9712                                                 (vector int)__b);
9713}
9714
9715static __inline__ vector bool char __ATTRS_o_ai
9716vec_srl(vector bool char __a, vector unsigned int __b) {
9717  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9718                                                 (vector int)__b);
9719}
9720
9721static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9722                                                    vector unsigned char __b) {
9723  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9724}
9725
9726static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9727                                                    vector unsigned short __b) {
9728  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9729}
9730
9731static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9732                                                    vector unsigned int __b) {
9733  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9734}
9735
9736static __inline__ vector unsigned short __ATTRS_o_ai
9737vec_srl(vector unsigned short __a, vector unsigned char __b) {
9738  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9739                                                      (vector int)__b);
9740}
9741
9742static __inline__ vector unsigned short __ATTRS_o_ai
9743vec_srl(vector unsigned short __a, vector unsigned short __b) {
9744  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9745                                                      (vector int)__b);
9746}
9747
9748static __inline__ vector unsigned short __ATTRS_o_ai
9749vec_srl(vector unsigned short __a, vector unsigned int __b) {
9750  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9751                                                      (vector int)__b);
9752}
9753
9754static __inline__ vector bool short __ATTRS_o_ai
9755vec_srl(vector bool short __a, vector unsigned char __b) {
9756  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9757                                                  (vector int)__b);
9758}
9759
9760static __inline__ vector bool short __ATTRS_o_ai
9761vec_srl(vector bool short __a, vector unsigned short __b) {
9762  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9763                                                  (vector int)__b);
9764}
9765
9766static __inline__ vector bool short __ATTRS_o_ai
9767vec_srl(vector bool short __a, vector unsigned int __b) {
9768  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9769                                                  (vector int)__b);
9770}
9771
9772static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9773                                                    vector unsigned char __b) {
9774  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9775}
9776
9777static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9778                                                    vector unsigned short __b) {
9779  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9780}
9781
9782static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9783                                                    vector unsigned int __b) {
9784  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9785}
9786
9787static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9788                                                  vector unsigned char __b) {
9789  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9790}
9791
9792static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9793                                                  vector unsigned short __b) {
9794  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9795}
9796
9797static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9798                                                  vector unsigned int __b) {
9799  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9800}
9801
9802static __inline__ vector unsigned int __ATTRS_o_ai
9803vec_srl(vector unsigned int __a, vector unsigned char __b) {
9804  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9805                                                    (vector int)__b);
9806}
9807
9808static __inline__ vector unsigned int __ATTRS_o_ai
9809vec_srl(vector unsigned int __a, vector unsigned short __b) {
9810  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9811                                                    (vector int)__b);
9812}
9813
9814static __inline__ vector unsigned int __ATTRS_o_ai
9815vec_srl(vector unsigned int __a, vector unsigned int __b) {
9816  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9817                                                    (vector int)__b);
9818}
9819
9820static __inline__ vector bool int __ATTRS_o_ai
9821vec_srl(vector bool int __a, vector unsigned char __b) {
9822  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9823                                                (vector int)__b);
9824}
9825
9826static __inline__ vector bool int __ATTRS_o_ai
9827vec_srl(vector bool int __a, vector unsigned short __b) {
9828  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9829                                                (vector int)__b);
9830}
9831
9832static __inline__ vector bool int __ATTRS_o_ai
9833vec_srl(vector bool int __a, vector unsigned int __b) {
9834  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9835                                                (vector int)__b);
9836}
9837
9838#ifdef __VSX__
9839static __inline__ vector signed long long __ATTRS_o_ai
9840vec_srl(vector signed long long __a, vector unsigned char __b) {
9841  return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9842                                                        (vector int)__b);
9843}
9844
9845static __inline__ vector unsigned long long __ATTRS_o_ai
9846vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9847  return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9848                                                          (vector int)__b);
9849}
9850#endif
9851
9852/* vec_vsr */
9853
9854static __inline__ vector signed char __ATTRS_o_ai
9855vec_vsr(vector signed char __a, vector unsigned char __b) {
9856  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9857                                                   (vector int)__b);
9858}
9859
9860static __inline__ vector signed char __ATTRS_o_ai
9861vec_vsr(vector signed char __a, vector unsigned short __b) {
9862  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9863                                                   (vector int)__b);
9864}
9865
9866static __inline__ vector signed char __ATTRS_o_ai
9867vec_vsr(vector signed char __a, vector unsigned int __b) {
9868  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9869                                                   (vector int)__b);
9870}
9871
9872static __inline__ vector unsigned char __ATTRS_o_ai
9873vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9874  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9875                                                     (vector int)__b);
9876}
9877
9878static __inline__ vector unsigned char __ATTRS_o_ai
9879vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9880  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9881                                                     (vector int)__b);
9882}
9883
9884static __inline__ vector unsigned char __ATTRS_o_ai
9885vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9886  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9887                                                     (vector int)__b);
9888}
9889
9890static __inline__ vector bool char __ATTRS_o_ai
9891vec_vsr(vector bool char __a, vector unsigned char __b) {
9892  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9893                                                 (vector int)__b);
9894}
9895
9896static __inline__ vector bool char __ATTRS_o_ai
9897vec_vsr(vector bool char __a, vector unsigned short __b) {
9898  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9899                                                 (vector int)__b);
9900}
9901
9902static __inline__ vector bool char __ATTRS_o_ai
9903vec_vsr(vector bool char __a, vector unsigned int __b) {
9904  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9905                                                 (vector int)__b);
9906}
9907
9908static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9909                                                    vector unsigned char __b) {
9910  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9911}
9912
9913static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9914                                                    vector unsigned short __b) {
9915  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9916}
9917
9918static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9919                                                    vector unsigned int __b) {
9920  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9921}
9922
9923static __inline__ vector unsigned short __ATTRS_o_ai
9924vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9925  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9926                                                      (vector int)__b);
9927}
9928
9929static __inline__ vector unsigned short __ATTRS_o_ai
9930vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9931  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9932                                                      (vector int)__b);
9933}
9934
9935static __inline__ vector unsigned short __ATTRS_o_ai
9936vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9937  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9938                                                      (vector int)__b);
9939}
9940
9941static __inline__ vector bool short __ATTRS_o_ai
9942vec_vsr(vector bool short __a, vector unsigned char __b) {
9943  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9944                                                  (vector int)__b);
9945}
9946
9947static __inline__ vector bool short __ATTRS_o_ai
9948vec_vsr(vector bool short __a, vector unsigned short __b) {
9949  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9950                                                  (vector int)__b);
9951}
9952
9953static __inline__ vector bool short __ATTRS_o_ai
9954vec_vsr(vector bool short __a, vector unsigned int __b) {
9955  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9956                                                  (vector int)__b);
9957}
9958
9959static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9960                                                    vector unsigned char __b) {
9961  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9962}
9963
9964static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9965                                                    vector unsigned short __b) {
9966  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9967}
9968
9969static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9970                                                    vector unsigned int __b) {
9971  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9972}
9973
9974static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9975                                                  vector unsigned char __b) {
9976  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9977}
9978
9979static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9980                                                  vector unsigned short __b) {
9981  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9982}
9983
9984static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9985                                                  vector unsigned int __b) {
9986  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9987}
9988
9989static __inline__ vector unsigned int __ATTRS_o_ai
9990vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9991  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9992                                                    (vector int)__b);
9993}
9994
9995static __inline__ vector unsigned int __ATTRS_o_ai
9996vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9997  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9998                                                    (vector int)__b);
9999}
10000
10001static __inline__ vector unsigned int __ATTRS_o_ai
10002vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10003  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10004                                                    (vector int)__b);
10005}
10006
10007static __inline__ vector bool int __ATTRS_o_ai
10008vec_vsr(vector bool int __a, vector unsigned char __b) {
10009  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10010                                                (vector int)__b);
10011}
10012
10013static __inline__ vector bool int __ATTRS_o_ai
10014vec_vsr(vector bool int __a, vector unsigned short __b) {
10015  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10016                                                (vector int)__b);
10017}
10018
10019static __inline__ vector bool int __ATTRS_o_ai
10020vec_vsr(vector bool int __a, vector unsigned int __b) {
10021  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10022                                                (vector int)__b);
10023}
10024
10025/* vec_sro */
10026
10027static __inline__ vector signed char __ATTRS_o_ai
10028vec_sro(vector signed char __a, vector signed char __b) {
10029  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10030                                                    (vector int)__b);
10031}
10032
10033static __inline__ vector signed char __ATTRS_o_ai
10034vec_sro(vector signed char __a, vector unsigned char __b) {
10035  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10036                                                    (vector int)__b);
10037}
10038
10039static __inline__ vector unsigned char __ATTRS_o_ai
10040vec_sro(vector unsigned char __a, vector signed char __b) {
10041  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10042                                                      (vector int)__b);
10043}
10044
10045static __inline__ vector unsigned char __ATTRS_o_ai
10046vec_sro(vector unsigned char __a, vector unsigned char __b) {
10047  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10048                                                      (vector int)__b);
10049}
10050
10051static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10052                                                    vector signed char __b) {
10053  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10054}
10055
10056static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10057                                                    vector unsigned char __b) {
10058  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10059}
10060
10061static __inline__ vector unsigned short __ATTRS_o_ai
10062vec_sro(vector unsigned short __a, vector signed char __b) {
10063  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10064                                                       (vector int)__b);
10065}
10066
10067static __inline__ vector unsigned short __ATTRS_o_ai
10068vec_sro(vector unsigned short __a, vector unsigned char __b) {
10069  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10070                                                       (vector int)__b);
10071}
10072
10073static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10074                                                    vector signed char __b) {
10075  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10076}
10077
10078static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10079                                                    vector unsigned char __b) {
10080  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10081}
10082
10083static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10084                                                  vector signed char __b) {
10085  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10086}
10087
10088static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10089                                                  vector unsigned char __b) {
10090  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10091}
10092
10093static __inline__ vector unsigned int __ATTRS_o_ai
10094vec_sro(vector unsigned int __a, vector signed char __b) {
10095  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10096                                                     (vector int)__b);
10097}
10098
10099static __inline__ vector unsigned int __ATTRS_o_ai
10100vec_sro(vector unsigned int __a, vector unsigned char __b) {
10101  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10102                                                     (vector int)__b);
10103}
10104
10105static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10106                                                    vector signed char __b) {
10107  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10108}
10109
10110static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10111                                                    vector unsigned char __b) {
10112  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10113}
10114
10115#ifdef __VSX__
10116static __inline__ vector signed long long __ATTRS_o_ai
10117vec_sro(vector signed long long __a, vector signed char __b) {
10118  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10119                                                         (vector int)__b);
10120}
10121
10122static __inline__ vector signed long long __ATTRS_o_ai
10123vec_sro(vector signed long long __a, vector unsigned char __b) {
10124  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10125                                                         (vector int)__b);
10126}
10127
10128static __inline__ vector unsigned long long __ATTRS_o_ai
10129vec_sro(vector unsigned long long __a, vector signed char __b) {
10130  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10131                                                           (vector int)__b);
10132}
10133
10134static __inline__ vector unsigned long long __ATTRS_o_ai
10135vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10136  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10137                                                           (vector int)__b);
10138}
10139#endif
10140
10141/* vec_vsro */
10142
10143static __inline__ vector signed char __ATTRS_o_ai
10144vec_vsro(vector signed char __a, vector signed char __b) {
10145  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10146                                                    (vector int)__b);
10147}
10148
10149static __inline__ vector signed char __ATTRS_o_ai
10150vec_vsro(vector signed char __a, vector unsigned char __b) {
10151  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10152                                                    (vector int)__b);
10153}
10154
10155static __inline__ vector unsigned char __ATTRS_o_ai
10156vec_vsro(vector unsigned char __a, vector signed char __b) {
10157  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10158                                                      (vector int)__b);
10159}
10160
10161static __inline__ vector unsigned char __ATTRS_o_ai
10162vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10163  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10164                                                      (vector int)__b);
10165}
10166
10167static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10168                                                     vector signed char __b) {
10169  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10170}
10171
10172static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10173                                                     vector unsigned char __b) {
10174  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10175}
10176
10177static __inline__ vector unsigned short __ATTRS_o_ai
10178vec_vsro(vector unsigned short __a, vector signed char __b) {
10179  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10180                                                       (vector int)__b);
10181}
10182
10183static __inline__ vector unsigned short __ATTRS_o_ai
10184vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10185  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10186                                                       (vector int)__b);
10187}
10188
10189static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10190                                                     vector signed char __b) {
10191  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10192}
10193
10194static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10195                                                     vector unsigned char __b) {
10196  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10197}
10198
10199static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10200                                                   vector signed char __b) {
10201  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10202}
10203
10204static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10205                                                   vector unsigned char __b) {
10206  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10207}
10208
10209static __inline__ vector unsigned int __ATTRS_o_ai
10210vec_vsro(vector unsigned int __a, vector signed char __b) {
10211  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10212                                                     (vector int)__b);
10213}
10214
10215static __inline__ vector unsigned int __ATTRS_o_ai
10216vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10217  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10218                                                     (vector int)__b);
10219}
10220
10221static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10222                                                     vector signed char __b) {
10223  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10224}
10225
10226static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10227                                                     vector unsigned char __b) {
10228  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10229}
10230
10231/* vec_st */
10232
10233static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10234                                           vector signed char *__c) {
10235  __builtin_altivec_stvx((vector int)__a, __b, __c);
10236}
10237
10238static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10239                                           signed char *__c) {
10240  __builtin_altivec_stvx((vector int)__a, __b, __c);
10241}
10242
10243static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10244                                           vector unsigned char *__c) {
10245  __builtin_altivec_stvx((vector int)__a, __b, __c);
10246}
10247
10248static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10249                                           unsigned char *__c) {
10250  __builtin_altivec_stvx((vector int)__a, __b, __c);
10251}
10252
10253static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10254                                           signed char *__c) {
10255  __builtin_altivec_stvx((vector int)__a, __b, __c);
10256}
10257
10258static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10259                                           unsigned char *__c) {
10260  __builtin_altivec_stvx((vector int)__a, __b, __c);
10261}
10262
10263static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10264                                           vector bool char *__c) {
10265  __builtin_altivec_stvx((vector int)__a, __b, __c);
10266}
10267
10268static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10269                                           vector short *__c) {
10270  __builtin_altivec_stvx((vector int)__a, __b, __c);
10271}
10272
10273static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10274                                           short *__c) {
10275  __builtin_altivec_stvx((vector int)__a, __b, __c);
10276}
10277
10278static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10279                                           vector unsigned short *__c) {
10280  __builtin_altivec_stvx((vector int)__a, __b, __c);
10281}
10282
10283static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10284                                           unsigned short *__c) {
10285  __builtin_altivec_stvx((vector int)__a, __b, __c);
10286}
10287
10288static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10289                                           short *__c) {
10290  __builtin_altivec_stvx((vector int)__a, __b, __c);
10291}
10292
10293static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10294                                           unsigned short *__c) {
10295  __builtin_altivec_stvx((vector int)__a, __b, __c);
10296}
10297
10298static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10299                                           vector bool short *__c) {
10300  __builtin_altivec_stvx((vector int)__a, __b, __c);
10301}
10302
10303static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10304                                           short *__c) {
10305  __builtin_altivec_stvx((vector int)__a, __b, __c);
10306}
10307
10308static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10309                                           unsigned short *__c) {
10310  __builtin_altivec_stvx((vector int)__a, __b, __c);
10311}
10312
10313static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10314                                           vector pixel *__c) {
10315  __builtin_altivec_stvx((vector int)__a, __b, __c);
10316}
10317
10318static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10319                                           vector int *__c) {
10320  __builtin_altivec_stvx(__a, __b, __c);
10321}
10322
10323static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10324  __builtin_altivec_stvx(__a, __b, __c);
10325}
10326
10327static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10328                                           vector unsigned int *__c) {
10329  __builtin_altivec_stvx((vector int)__a, __b, __c);
10330}
10331
10332static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10333                                           unsigned int *__c) {
10334  __builtin_altivec_stvx((vector int)__a, __b, __c);
10335}
10336
10337static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10338                                           int *__c) {
10339  __builtin_altivec_stvx((vector int)__a, __b, __c);
10340}
10341
10342static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10343                                           unsigned int *__c) {
10344  __builtin_altivec_stvx((vector int)__a, __b, __c);
10345}
10346
10347static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10348                                           vector bool int *__c) {
10349  __builtin_altivec_stvx((vector int)__a, __b, __c);
10350}
10351
10352static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10353                                           vector float *__c) {
10354  __builtin_altivec_stvx((vector int)__a, __b, __c);
10355}
10356
10357static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10358                                           float *__c) {
10359  __builtin_altivec_stvx((vector int)__a, __b, __c);
10360}
10361
10362/* vec_stvx */
10363
10364static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10365                                             vector signed char *__c) {
10366  __builtin_altivec_stvx((vector int)__a, __b, __c);
10367}
10368
10369static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10370                                             signed char *__c) {
10371  __builtin_altivec_stvx((vector int)__a, __b, __c);
10372}
10373
10374static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10375                                             vector unsigned char *__c) {
10376  __builtin_altivec_stvx((vector int)__a, __b, __c);
10377}
10378
10379static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10380                                             unsigned char *__c) {
10381  __builtin_altivec_stvx((vector int)__a, __b, __c);
10382}
10383
10384static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10385                                             signed char *__c) {
10386  __builtin_altivec_stvx((vector int)__a, __b, __c);
10387}
10388
10389static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10390                                             unsigned char *__c) {
10391  __builtin_altivec_stvx((vector int)__a, __b, __c);
10392}
10393
10394static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10395                                             vector bool char *__c) {
10396  __builtin_altivec_stvx((vector int)__a, __b, __c);
10397}
10398
10399static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10400                                             vector short *__c) {
10401  __builtin_altivec_stvx((vector int)__a, __b, __c);
10402}
10403
10404static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10405                                             short *__c) {
10406  __builtin_altivec_stvx((vector int)__a, __b, __c);
10407}
10408
10409static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10410                                             vector unsigned short *__c) {
10411  __builtin_altivec_stvx((vector int)__a, __b, __c);
10412}
10413
10414static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10415                                             unsigned short *__c) {
10416  __builtin_altivec_stvx((vector int)__a, __b, __c);
10417}
10418
10419static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10420                                             short *__c) {
10421  __builtin_altivec_stvx((vector int)__a, __b, __c);
10422}
10423
10424static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10425                                             unsigned short *__c) {
10426  __builtin_altivec_stvx((vector int)__a, __b, __c);
10427}
10428
10429static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10430                                             vector bool short *__c) {
10431  __builtin_altivec_stvx((vector int)__a, __b, __c);
10432}
10433
10434static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10435                                             short *__c) {
10436  __builtin_altivec_stvx((vector int)__a, __b, __c);
10437}
10438
10439static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10440                                             unsigned short *__c) {
10441  __builtin_altivec_stvx((vector int)__a, __b, __c);
10442}
10443
10444static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10445                                             vector pixel *__c) {
10446  __builtin_altivec_stvx((vector int)__a, __b, __c);
10447}
10448
10449static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10450                                             vector int *__c) {
10451  __builtin_altivec_stvx(__a, __b, __c);
10452}
10453
10454static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10455                                             int *__c) {
10456  __builtin_altivec_stvx(__a, __b, __c);
10457}
10458
10459static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10460                                             vector unsigned int *__c) {
10461  __builtin_altivec_stvx((vector int)__a, __b, __c);
10462}
10463
10464static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10465                                             unsigned int *__c) {
10466  __builtin_altivec_stvx((vector int)__a, __b, __c);
10467}
10468
10469static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10470                                             int *__c) {
10471  __builtin_altivec_stvx((vector int)__a, __b, __c);
10472}
10473
10474static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10475                                             unsigned int *__c) {
10476  __builtin_altivec_stvx((vector int)__a, __b, __c);
10477}
10478
10479static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10480                                             vector bool int *__c) {
10481  __builtin_altivec_stvx((vector int)__a, __b, __c);
10482}
10483
10484static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10485                                             vector float *__c) {
10486  __builtin_altivec_stvx((vector int)__a, __b, __c);
10487}
10488
10489static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10490                                             float *__c) {
10491  __builtin_altivec_stvx((vector int)__a, __b, __c);
10492}
10493
10494/* vec_ste */
10495
10496static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10497                                            signed char *__c) {
10498  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10499}
10500
10501static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10502                                            unsigned char *__c) {
10503  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10504}
10505
10506static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10507                                            signed char *__c) {
10508  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10509}
10510
10511static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10512                                            unsigned char *__c) {
10513  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10514}
10515
10516static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10517                                            short *__c) {
10518  __builtin_altivec_stvehx(__a, __b, __c);
10519}
10520
10521static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10522                                            unsigned short *__c) {
10523  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10524}
10525
10526static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10527                                            short *__c) {
10528  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10529}
10530
10531static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10532                                            unsigned short *__c) {
10533  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10534}
10535
10536static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10537                                            short *__c) {
10538  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10539}
10540
10541static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10542                                            unsigned short *__c) {
10543  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10544}
10545
10546static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10547  __builtin_altivec_stvewx(__a, __b, __c);
10548}
10549
10550static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10551                                            unsigned int *__c) {
10552  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10553}
10554
10555static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10556                                            int *__c) {
10557  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10558}
10559
10560static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10561                                            unsigned int *__c) {
10562  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10563}
10564
10565static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10566                                            float *__c) {
10567  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10568}
10569
10570/* vec_stvebx */
10571
10572static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10573                                               signed char *__c) {
10574  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10575}
10576
10577static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10578                                               int __b, unsigned char *__c) {
10579  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10580}
10581
10582static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10583                                               signed char *__c) {
10584  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10585}
10586
10587static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10588                                               unsigned char *__c) {
10589  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10590}
10591
10592/* vec_stvehx */
10593
10594static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10595                                               short *__c) {
10596  __builtin_altivec_stvehx(__a, __b, __c);
10597}
10598
10599static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10600                                               int __b, unsigned short *__c) {
10601  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10602}
10603
10604static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10605                                               short *__c) {
10606  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10607}
10608
10609static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10610                                               unsigned short *__c) {
10611  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10612}
10613
10614static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10615                                               short *__c) {
10616  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10617}
10618
10619static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10620                                               unsigned short *__c) {
10621  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10622}
10623
10624/* vec_stvewx */
10625
10626static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10627                                               int *__c) {
10628  __builtin_altivec_stvewx(__a, __b, __c);
10629}
10630
10631static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10632                                               unsigned int *__c) {
10633  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10634}
10635
10636static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10637                                               int *__c) {
10638  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10639}
10640
10641static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10642                                               unsigned int *__c) {
10643  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10644}
10645
10646static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10647                                               float *__c) {
10648  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10649}
10650
10651/* vec_stl */
10652
10653static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10654                                            vector signed char *__c) {
10655  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10656}
10657
10658static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10659                                            signed char *__c) {
10660  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10661}
10662
10663static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10664                                            vector unsigned char *__c) {
10665  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10666}
10667
10668static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10669                                            unsigned char *__c) {
10670  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10671}
10672
10673static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10674                                            signed char *__c) {
10675  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10676}
10677
10678static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10679                                            unsigned char *__c) {
10680  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10681}
10682
10683static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10684                                            vector bool char *__c) {
10685  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10686}
10687
10688static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10689                                            vector short *__c) {
10690  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10691}
10692
10693static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10694                                            short *__c) {
10695  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10696}
10697
10698static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10699                                            vector unsigned short *__c) {
10700  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10701}
10702
10703static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10704                                            unsigned short *__c) {
10705  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10706}
10707
10708static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10709                                            short *__c) {
10710  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10711}
10712
10713static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10714                                            unsigned short *__c) {
10715  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10716}
10717
10718static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10719                                            vector bool short *__c) {
10720  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10721}
10722
10723static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10724                                            short *__c) {
10725  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10726}
10727
10728static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10729                                            unsigned short *__c) {
10730  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10731}
10732
10733static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10734                                            vector pixel *__c) {
10735  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10736}
10737
10738static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10739                                            vector int *__c) {
10740  __builtin_altivec_stvxl(__a, __b, __c);
10741}
10742
10743static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10744  __builtin_altivec_stvxl(__a, __b, __c);
10745}
10746
10747static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10748                                            vector unsigned int *__c) {
10749  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10750}
10751
10752static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10753                                            unsigned int *__c) {
10754  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10755}
10756
10757static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10758                                            int *__c) {
10759  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10760}
10761
10762static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10763                                            unsigned int *__c) {
10764  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10765}
10766
10767static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10768                                            vector bool int *__c) {
10769  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10770}
10771
10772static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10773                                            vector float *__c) {
10774  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10775}
10776
10777static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10778                                            float *__c) {
10779  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10780}
10781
10782/* vec_stvxl */
10783
10784static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10785                                              vector signed char *__c) {
10786  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10787}
10788
10789static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10790                                              signed char *__c) {
10791  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10792}
10793
10794static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10795                                              vector unsigned char *__c) {
10796  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10797}
10798
10799static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10800                                              unsigned char *__c) {
10801  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10802}
10803
10804static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10805                                              signed char *__c) {
10806  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10807}
10808
10809static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10810                                              unsigned char *__c) {
10811  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10812}
10813
10814static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10815                                              vector bool char *__c) {
10816  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10817}
10818
10819static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10820                                              vector short *__c) {
10821  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10822}
10823
10824static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10825                                              short *__c) {
10826  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10827}
10828
10829static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10830                                              int __b,
10831                                              vector unsigned short *__c) {
10832  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10833}
10834
10835static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10836                                              int __b, unsigned short *__c) {
10837  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10838}
10839
10840static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10841                                              short *__c) {
10842  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10843}
10844
10845static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10846                                              unsigned short *__c) {
10847  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10848}
10849
10850static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10851                                              vector bool short *__c) {
10852  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10853}
10854
10855static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10856                                              short *__c) {
10857  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10858}
10859
10860static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10861                                              unsigned short *__c) {
10862  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10863}
10864
10865static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10866                                              vector pixel *__c) {
10867  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10868}
10869
10870static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10871                                              vector int *__c) {
10872  __builtin_altivec_stvxl(__a, __b, __c);
10873}
10874
10875static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10876                                              int *__c) {
10877  __builtin_altivec_stvxl(__a, __b, __c);
10878}
10879
10880static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10881                                              vector unsigned int *__c) {
10882  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10883}
10884
10885static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10886                                              unsigned int *__c) {
10887  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10888}
10889
10890static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10891                                              int *__c) {
10892  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10893}
10894
10895static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10896                                              unsigned int *__c) {
10897  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10898}
10899
10900static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10901                                              vector bool int *__c) {
10902  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10903}
10904
10905static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10906                                              vector float *__c) {
10907  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10908}
10909
10910static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10911                                              float *__c) {
10912  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10913}
10914
10915/* vec_sub */
10916
10917static __inline__ vector signed char __ATTRS_o_ai
10918vec_sub(vector signed char __a, vector signed char __b) {
10919  return __a - __b;
10920}
10921
10922static __inline__ vector signed char __ATTRS_o_ai
10923vec_sub(vector bool char __a, vector signed char __b) {
10924  return (vector signed char)__a - __b;
10925}
10926
10927static __inline__ vector signed char __ATTRS_o_ai
10928vec_sub(vector signed char __a, vector bool char __b) {
10929  return __a - (vector signed char)__b;
10930}
10931
10932static __inline__ vector unsigned char __ATTRS_o_ai
10933vec_sub(vector unsigned char __a, vector unsigned char __b) {
10934  return __a - __b;
10935}
10936
10937static __inline__ vector unsigned char __ATTRS_o_ai
10938vec_sub(vector bool char __a, vector unsigned char __b) {
10939  return (vector unsigned char)__a - __b;
10940}
10941
10942static __inline__ vector unsigned char __ATTRS_o_ai
10943vec_sub(vector unsigned char __a, vector bool char __b) {
10944  return __a - (vector unsigned char)__b;
10945}
10946
10947static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10948                                                    vector short __b) {
10949  return __a - __b;
10950}
10951
10952static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10953                                                    vector short __b) {
10954  return (vector short)__a - __b;
10955}
10956
10957static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10958                                                    vector bool short __b) {
10959  return __a - (vector short)__b;
10960}
10961
10962static __inline__ vector unsigned short __ATTRS_o_ai
10963vec_sub(vector unsigned short __a, vector unsigned short __b) {
10964  return __a - __b;
10965}
10966
10967static __inline__ vector unsigned short __ATTRS_o_ai
10968vec_sub(vector bool short __a, vector unsigned short __b) {
10969  return (vector unsigned short)__a - __b;
10970}
10971
10972static __inline__ vector unsigned short __ATTRS_o_ai
10973vec_sub(vector unsigned short __a, vector bool short __b) {
10974  return __a - (vector unsigned short)__b;
10975}
10976
10977static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10978                                                  vector int __b) {
10979  return __a - __b;
10980}
10981
10982static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10983                                                  vector int __b) {
10984  return (vector int)__a - __b;
10985}
10986
10987static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10988                                                  vector bool int __b) {
10989  return __a - (vector int)__b;
10990}
10991
10992static __inline__ vector unsigned int __ATTRS_o_ai
10993vec_sub(vector unsigned int __a, vector unsigned int __b) {
10994  return __a - __b;
10995}
10996
10997static __inline__ vector unsigned int __ATTRS_o_ai
10998vec_sub(vector bool int __a, vector unsigned int __b) {
10999  return (vector unsigned int)__a - __b;
11000}
11001
11002static __inline__ vector unsigned int __ATTRS_o_ai
11003vec_sub(vector unsigned int __a, vector bool int __b) {
11004  return __a - (vector unsigned int)__b;
11005}
11006
11007#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11008static __inline__ vector signed __int128 __ATTRS_o_ai
11009vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11010  return __a - __b;
11011}
11012
11013static __inline__ vector unsigned __int128 __ATTRS_o_ai
11014vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11015  return __a - __b;
11016}
11017#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11018
11019#ifdef __VSX__
11020static __inline__ vector signed long long __ATTRS_o_ai
11021vec_sub(vector signed long long __a, vector signed long long __b) {
11022  return __a - __b;
11023}
11024
11025static __inline__ vector unsigned long long __ATTRS_o_ai
11026vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11027  return __a - __b;
11028}
11029
11030static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11031                                                     vector double __b) {
11032  return __a - __b;
11033}
11034#endif
11035
11036static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11037                                                    vector float __b) {
11038  return __a - __b;
11039}
11040
11041/* vec_vsububm */
11042
11043#define __builtin_altivec_vsububm vec_vsububm
11044
11045static __inline__ vector signed char __ATTRS_o_ai
11046vec_vsububm(vector signed char __a, vector signed char __b) {
11047  return __a - __b;
11048}
11049
11050static __inline__ vector signed char __ATTRS_o_ai
11051vec_vsububm(vector bool char __a, vector signed char __b) {
11052  return (vector signed char)__a - __b;
11053}
11054
11055static __inline__ vector signed char __ATTRS_o_ai
11056vec_vsububm(vector signed char __a, vector bool char __b) {
11057  return __a - (vector signed char)__b;
11058}
11059
11060static __inline__ vector unsigned char __ATTRS_o_ai
11061vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11062  return __a - __b;
11063}
11064
11065static __inline__ vector unsigned char __ATTRS_o_ai
11066vec_vsububm(vector bool char __a, vector unsigned char __b) {
11067  return (vector unsigned char)__a - __b;
11068}
11069
11070static __inline__ vector unsigned char __ATTRS_o_ai
11071vec_vsububm(vector unsigned char __a, vector bool char __b) {
11072  return __a - (vector unsigned char)__b;
11073}
11074
11075/* vec_vsubuhm */
11076
11077#define __builtin_altivec_vsubuhm vec_vsubuhm
11078
11079static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11080                                                        vector short __b) {
11081  return __a - __b;
11082}
11083
11084static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11085                                                        vector short __b) {
11086  return (vector short)__a - __b;
11087}
11088
11089static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11090                                                        vector bool short __b) {
11091  return __a - (vector short)__b;
11092}
11093
11094static __inline__ vector unsigned short __ATTRS_o_ai
11095vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11096  return __a - __b;
11097}
11098
11099static __inline__ vector unsigned short __ATTRS_o_ai
11100vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11101  return (vector unsigned short)__a - __b;
11102}
11103
11104static __inline__ vector unsigned short __ATTRS_o_ai
11105vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11106  return __a - (vector unsigned short)__b;
11107}
11108
11109/* vec_vsubuwm */
11110
11111#define __builtin_altivec_vsubuwm vec_vsubuwm
11112
11113static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11114                                                      vector int __b) {
11115  return __a - __b;
11116}
11117
11118static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11119                                                      vector int __b) {
11120  return (vector int)__a - __b;
11121}
11122
11123static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11124                                                      vector bool int __b) {
11125  return __a - (vector int)__b;
11126}
11127
11128static __inline__ vector unsigned int __ATTRS_o_ai
11129vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11130  return __a - __b;
11131}
11132
11133static __inline__ vector unsigned int __ATTRS_o_ai
11134vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11135  return (vector unsigned int)__a - __b;
11136}
11137
11138static __inline__ vector unsigned int __ATTRS_o_ai
11139vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11140  return __a - (vector unsigned int)__b;
11141}
11142
11143/* vec_vsubfp */
11144
11145#define __builtin_altivec_vsubfp vec_vsubfp
11146
11147static __inline__ vector float __attribute__((__always_inline__))
11148vec_vsubfp(vector float __a, vector float __b) {
11149  return __a - __b;
11150}
11151
11152/* vec_subc */
11153
11154static __inline__ vector signed int __ATTRS_o_ai
11155vec_subc(vector signed int __a, vector signed int __b) {
11156  return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11157                                                      (vector unsigned int) __b);
11158}
11159
11160static __inline__ vector unsigned int __ATTRS_o_ai
11161vec_subc(vector unsigned int __a, vector unsigned int __b) {
11162  return __builtin_altivec_vsubcuw(__a, __b);
11163}
11164
11165#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11166static __inline__ vector unsigned __int128 __ATTRS_o_ai
11167vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11168  return __builtin_altivec_vsubcuq(__a, __b);
11169}
11170
11171static __inline__ vector signed __int128 __ATTRS_o_ai
11172vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11173  return __builtin_altivec_vsubcuq(__a, __b);
11174}
11175#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11176
11177/* vec_vsubcuw */
11178
11179static __inline__ vector unsigned int __attribute__((__always_inline__))
11180vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11181  return __builtin_altivec_vsubcuw(__a, __b);
11182}
11183
11184/* vec_subs */
11185
11186static __inline__ vector signed char __ATTRS_o_ai
11187vec_subs(vector signed char __a, vector signed char __b) {
11188  return __builtin_altivec_vsubsbs(__a, __b);
11189}
11190
11191static __inline__ vector signed char __ATTRS_o_ai
11192vec_subs(vector bool char __a, vector signed char __b) {
11193  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11194}
11195
11196static __inline__ vector signed char __ATTRS_o_ai
11197vec_subs(vector signed char __a, vector bool char __b) {
11198  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11199}
11200
11201static __inline__ vector unsigned char __ATTRS_o_ai
11202vec_subs(vector unsigned char __a, vector unsigned char __b) {
11203  return __builtin_altivec_vsububs(__a, __b);
11204}
11205
11206static __inline__ vector unsigned char __ATTRS_o_ai
11207vec_subs(vector bool char __a, vector unsigned char __b) {
11208  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11209}
11210
11211static __inline__ vector unsigned char __ATTRS_o_ai
11212vec_subs(vector unsigned char __a, vector bool char __b) {
11213  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11214}
11215
11216static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11217                                                     vector short __b) {
11218  return __builtin_altivec_vsubshs(__a, __b);
11219}
11220
11221static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11222                                                     vector short __b) {
11223  return __builtin_altivec_vsubshs((vector short)__a, __b);
11224}
11225
11226static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11227                                                     vector bool short __b) {
11228  return __builtin_altivec_vsubshs(__a, (vector short)__b);
11229}
11230
11231static __inline__ vector unsigned short __ATTRS_o_ai
11232vec_subs(vector unsigned short __a, vector unsigned short __b) {
11233  return __builtin_altivec_vsubuhs(__a, __b);
11234}
11235
11236static __inline__ vector unsigned short __ATTRS_o_ai
11237vec_subs(vector bool short __a, vector unsigned short __b) {
11238  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11239}
11240
11241static __inline__ vector unsigned short __ATTRS_o_ai
11242vec_subs(vector unsigned short __a, vector bool short __b) {
11243  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11244}
11245
11246static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11247                                                   vector int __b) {
11248  return __builtin_altivec_vsubsws(__a, __b);
11249}
11250
11251static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11252                                                   vector int __b) {
11253  return __builtin_altivec_vsubsws((vector int)__a, __b);
11254}
11255
11256static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11257                                                   vector bool int __b) {
11258  return __builtin_altivec_vsubsws(__a, (vector int)__b);
11259}
11260
11261static __inline__ vector unsigned int __ATTRS_o_ai
11262vec_subs(vector unsigned int __a, vector unsigned int __b) {
11263  return __builtin_altivec_vsubuws(__a, __b);
11264}
11265
11266static __inline__ vector unsigned int __ATTRS_o_ai
11267vec_subs(vector bool int __a, vector unsigned int __b) {
11268  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11269}
11270
11271static __inline__ vector unsigned int __ATTRS_o_ai
11272vec_subs(vector unsigned int __a, vector bool int __b) {
11273  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11274}
11275
11276/* vec_vsubsbs */
11277
11278static __inline__ vector signed char __ATTRS_o_ai
11279vec_vsubsbs(vector signed char __a, vector signed char __b) {
11280  return __builtin_altivec_vsubsbs(__a, __b);
11281}
11282
11283static __inline__ vector signed char __ATTRS_o_ai
11284vec_vsubsbs(vector bool char __a, vector signed char __b) {
11285  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11286}
11287
11288static __inline__ vector signed char __ATTRS_o_ai
11289vec_vsubsbs(vector signed char __a, vector bool char __b) {
11290  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11291}
11292
11293/* vec_vsububs */
11294
11295static __inline__ vector unsigned char __ATTRS_o_ai
11296vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11297  return __builtin_altivec_vsububs(__a, __b);
11298}
11299
11300static __inline__ vector unsigned char __ATTRS_o_ai
11301vec_vsububs(vector bool char __a, vector unsigned char __b) {
11302  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11303}
11304
11305static __inline__ vector unsigned char __ATTRS_o_ai
11306vec_vsububs(vector unsigned char __a, vector bool char __b) {
11307  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11308}
11309
11310/* vec_vsubshs */
11311
11312static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11313                                                        vector short __b) {
11314  return __builtin_altivec_vsubshs(__a, __b);
11315}
11316
11317static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11318                                                        vector short __b) {
11319  return __builtin_altivec_vsubshs((vector short)__a, __b);
11320}
11321
11322static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11323                                                        vector bool short __b) {
11324  return __builtin_altivec_vsubshs(__a, (vector short)__b);
11325}
11326
11327/* vec_vsubuhs */
11328
11329static __inline__ vector unsigned short __ATTRS_o_ai
11330vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11331  return __builtin_altivec_vsubuhs(__a, __b);
11332}
11333
11334static __inline__ vector unsigned short __ATTRS_o_ai
11335vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11336  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11337}
11338
11339static __inline__ vector unsigned short __ATTRS_o_ai
11340vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11341  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11342}
11343
11344/* vec_vsubsws */
11345
11346static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11347                                                      vector int __b) {
11348  return __builtin_altivec_vsubsws(__a, __b);
11349}
11350
11351static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11352                                                      vector int __b) {
11353  return __builtin_altivec_vsubsws((vector int)__a, __b);
11354}
11355
11356static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11357                                                      vector bool int __b) {
11358  return __builtin_altivec_vsubsws(__a, (vector int)__b);
11359}
11360
11361/* vec_vsubuws */
11362
11363static __inline__ vector unsigned int __ATTRS_o_ai
11364vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11365  return __builtin_altivec_vsubuws(__a, __b);
11366}
11367
11368static __inline__ vector unsigned int __ATTRS_o_ai
11369vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11370  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11371}
11372
11373static __inline__ vector unsigned int __ATTRS_o_ai
11374vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11375  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11376}
11377
11378#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11379/* vec_vsubuqm */
11380
11381static __inline__ vector signed __int128 __ATTRS_o_ai
11382vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11383  return __a - __b;
11384}
11385
11386static __inline__ vector unsigned __int128 __ATTRS_o_ai
11387vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11388  return __a - __b;
11389}
11390
11391/* vec_vsubeuqm */
11392
11393
11394static __inline__ vector signed __int128 __ATTRS_o_ai
11395vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11396             vector signed __int128 __c) {
11397  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11398}
11399
11400static __inline__ vector unsigned __int128 __ATTRS_o_ai
11401vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11402             vector unsigned __int128 __c) {
11403  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11404}
11405
11406static __inline__ vector signed __int128 __ATTRS_o_ai
11407vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11408             vector signed __int128 __c) {
11409  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11410}
11411
11412static __inline__ vector unsigned __int128 __ATTRS_o_ai
11413vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11414             vector unsigned __int128 __c) {
11415  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11416}
11417
11418/* vec_vsubcuq */
11419
11420static __inline__ vector signed __int128 __ATTRS_o_ai
11421vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11422  return __builtin_altivec_vsubcuq(__a, __b);
11423}
11424
11425static __inline__ vector unsigned __int128 __ATTRS_o_ai
11426vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11427  return __builtin_altivec_vsubcuq(__a, __b);
11428}
11429
11430/* vec_vsubecuq */
11431
11432static __inline__ vector signed __int128 __ATTRS_o_ai
11433vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11434             vector signed __int128 __c) {
11435  return __builtin_altivec_vsubecuq(__a, __b, __c);
11436}
11437
11438static __inline__ vector unsigned __int128 __ATTRS_o_ai
11439vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11440             vector unsigned __int128 __c) {
11441  return __builtin_altivec_vsubecuq(__a, __b, __c);
11442}
11443
11444static __inline__ vector signed int __ATTRS_o_ai
11445vec_subec(vector signed int __a, vector signed int __b,
11446             vector signed int __c) {
11447  return vec_addec(__a, ~__b, __c);
11448}
11449
11450static __inline__ vector unsigned int __ATTRS_o_ai
11451vec_subec(vector unsigned int __a, vector unsigned int __b,
11452             vector unsigned int __c) {
11453  return vec_addec(__a, ~__b, __c);
11454}
11455
11456static __inline__ vector signed __int128 __ATTRS_o_ai
11457vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11458             vector signed __int128 __c) {
11459  return __builtin_altivec_vsubecuq(__a, __b, __c);
11460}
11461
11462static __inline__ vector unsigned __int128 __ATTRS_o_ai
11463vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11464             vector unsigned __int128 __c) {
11465  return __builtin_altivec_vsubecuq(__a, __b, __c);
11466}
11467#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11468
11469static __inline__ vector signed int __ATTRS_o_ai
11470vec_sube(vector signed int __a, vector signed int __b,
11471         vector signed int __c) {
11472  vector signed int __mask = {1111};
11473  vector signed int __carry = __c & __mask;
11474  return vec_adde(__a, ~__b, __carry);
11475}
11476
11477static __inline__ vector unsigned int __ATTRS_o_ai
11478vec_sube(vector unsigned int __a, vector unsigned int __b,
11479         vector unsigned int __c) {
11480  vector unsigned int __mask = {1111};
11481  vector unsigned int __carry = __c & __mask;
11482  return vec_adde(__a, ~__b, __carry);
11483}
11484/* vec_sum4s */
11485
11486static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11487                                                    vector int __b) {
11488  return __builtin_altivec_vsum4sbs(__a, __b);
11489}
11490
11491static __inline__ vector unsigned int __ATTRS_o_ai
11492vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11493  return __builtin_altivec_vsum4ubs(__a, __b);
11494}
11495
11496static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11497                                                    vector int __b) {
11498  return __builtin_altivec_vsum4shs(__a, __b);
11499}
11500
11501/* vec_vsum4sbs */
11502
11503static __inline__ vector int __attribute__((__always_inline__))
11504vec_vsum4sbs(vector signed char __a, vector int __b) {
11505  return __builtin_altivec_vsum4sbs(__a, __b);
11506}
11507
11508/* vec_vsum4ubs */
11509
11510static __inline__ vector unsigned int __attribute__((__always_inline__))
11511vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11512  return __builtin_altivec_vsum4ubs(__a, __b);
11513}
11514
11515/* vec_vsum4shs */
11516
11517static __inline__ vector int __attribute__((__always_inline__))
11518vec_vsum4shs(vector signed short __a, vector int __b) {
11519  return __builtin_altivec_vsum4shs(__a, __b);
11520}
11521
11522/* vec_sum2s */
11523
11524/* The vsum2sws instruction has a big-endian bias, so that the second
11525   input vector and the result always reference big-endian elements
11526   1 and 3 (little-endian element 0 and 2).  For ease of porting the
11527   programmer wants elements 1 and 3 in both cases, so for little
11528   endian we must perform some permutes.  */
11529
11530static __inline__ vector signed int __attribute__((__always_inline__))
11531vec_sum2s(vector int __a, vector int __b) {
11532#ifdef __LITTLE_ENDIAN__
11533  vector int __c = (vector signed int)vec_perm(
11534      __b, __b, (vector unsigned char)(4567012312131415,
11535                                       891011));
11536  __c = __builtin_altivec_vsum2sws(__a, __c);
11537  return (vector signed int)vec_perm(
11538      __c, __c, (vector unsigned char)(4567012312131415,
11539                                       891011));
11540#else
11541  return __builtin_altivec_vsum2sws(__a, __b);
11542#endif
11543}
11544
11545/* vec_vsum2sws */
11546
11547static __inline__ vector signed int __attribute__((__always_inline__))
11548vec_vsum2sws(vector int __a, vector int __b) {
11549#ifdef __LITTLE_ENDIAN__
11550  vector int __c = (vector signed int)vec_perm(
11551      __b, __b, (vector unsigned char)(4567012312131415,
11552                                       891011));
11553  __c = __builtin_altivec_vsum2sws(__a, __c);
11554  return (vector signed int)vec_perm(
11555      __c, __c, (vector unsigned char)(4567012312131415,
11556                                       891011));
11557#else
11558  return __builtin_altivec_vsum2sws(__a, __b);
11559#endif
11560}
11561
11562/* vec_sums */
11563
11564/* The vsumsws instruction has a big-endian bias, so that the second
11565   input vector and the result always reference big-endian element 3
11566   (little-endian element 0).  For ease of porting the programmer
11567   wants element 3 in both cases, so for little endian we must perform
11568   some permutes.  */
11569
11570static __inline__ vector signed int __attribute__((__always_inline__))
11571vec_sums(vector signed int __a, vector signed int __b) {
11572#ifdef __LITTLE_ENDIAN__
11573  __b = (vector signed int)vec_splat(__b, 3);
11574  __b = __builtin_altivec_vsumsws(__a, __b);
11575  return (vector signed int)(000, __b[0]);
11576#else
11577  return __builtin_altivec_vsumsws(__a, __b);
11578#endif
11579}
11580
11581/* vec_vsumsws */
11582
11583static __inline__ vector signed int __attribute__((__always_inline__))
11584vec_vsumsws(vector signed int __a, vector signed int __b) {
11585#ifdef __LITTLE_ENDIAN__
11586  __b = (vector signed int)vec_splat(__b, 3);
11587  __b = __builtin_altivec_vsumsws(__a, __b);
11588  return (vector signed int)(000, __b[0]);
11589#else
11590  return __builtin_altivec_vsumsws(__a, __b);
11591#endif
11592}
11593
11594/* vec_trunc */
11595
11596static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11597#ifdef __VSX__
11598  return __builtin_vsx_xvrspiz(__a);
11599#else
11600  return __builtin_altivec_vrfiz(__a);
11601#endif
11602}
11603
11604#ifdef __VSX__
11605static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11606  return __builtin_vsx_xvrdpiz(__a);
11607}
11608#endif
11609
11610/* vec_vrfiz */
11611
11612static __inline__ vector float __attribute__((__always_inline__))
11613vec_vrfiz(vector float __a) {
11614  return __builtin_altivec_vrfiz(__a);
11615}
11616
11617/* vec_unpackh */
11618
11619/* The vector unpack instructions all have a big-endian bias, so for
11620   little endian we must reverse the meanings of "high" and "low."  */
11621
11622static __inline__ vector short __ATTRS_o_ai
11623vec_unpackh(vector signed char __a) {
11624#ifdef __LITTLE_ENDIAN__
11625  return __builtin_altivec_vupklsb((vector char)__a);
11626#else
11627  return __builtin_altivec_vupkhsb((vector char)__a);
11628#endif
11629}
11630
11631static __inline__ vector bool short __ATTRS_o_ai
11632vec_unpackh(vector bool char __a) {
11633#ifdef __LITTLE_ENDIAN__
11634  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11635#else
11636  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11637#endif
11638}
11639
11640static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11641#ifdef __LITTLE_ENDIAN__
11642  return __builtin_altivec_vupklsh(__a);
11643#else
11644  return __builtin_altivec_vupkhsh(__a);
11645#endif
11646}
11647
11648static __inline__ vector bool int __ATTRS_o_ai
11649vec_unpackh(vector bool short __a) {
11650#ifdef __LITTLE_ENDIAN__
11651  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11652#else
11653  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11654#endif
11655}
11656
11657static __inline__ vector unsigned int __ATTRS_o_ai
11658vec_unpackh(vector pixel __a) {
11659#ifdef __LITTLE_ENDIAN__
11660  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11661#else
11662  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11663#endif
11664}
11665
11666#ifdef __POWER8_VECTOR__
11667static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11668#ifdef __LITTLE_ENDIAN__
11669  return __builtin_altivec_vupklsw(__a);
11670#else
11671  return __builtin_altivec_vupkhsw(__a);
11672#endif
11673}
11674
11675static __inline__ vector bool long long __ATTRS_o_ai
11676vec_unpackh(vector bool int __a) {
11677#ifdef __LITTLE_ENDIAN__
11678  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11679#else
11680  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11681#endif
11682}
11683
11684static __inline__ vector double __ATTRS_o_ai
11685vec_unpackh(vector float __a) {
11686  return (vector double)(__a[0], __a[1]);
11687}
11688#endif
11689
11690/* vec_vupkhsb */
11691
11692static __inline__ vector short __ATTRS_o_ai
11693vec_vupkhsb(vector signed char __a) {
11694#ifdef __LITTLE_ENDIAN__
11695  return __builtin_altivec_vupklsb((vector char)__a);
11696#else
11697  return __builtin_altivec_vupkhsb((vector char)__a);
11698#endif
11699}
11700
11701static __inline__ vector bool short __ATTRS_o_ai
11702vec_vupkhsb(vector bool char __a) {
11703#ifdef __LITTLE_ENDIAN__
11704  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11705#else
11706  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11707#endif
11708}
11709
11710/* vec_vupkhsh */
11711
11712static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11713#ifdef __LITTLE_ENDIAN__
11714  return __builtin_altivec_vupklsh(__a);
11715#else
11716  return __builtin_altivec_vupkhsh(__a);
11717#endif
11718}
11719
11720static __inline__ vector bool int __ATTRS_o_ai
11721vec_vupkhsh(vector bool short __a) {
11722#ifdef __LITTLE_ENDIAN__
11723  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11724#else
11725  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11726#endif
11727}
11728
11729static __inline__ vector unsigned int __ATTRS_o_ai
11730vec_vupkhsh(vector pixel __a) {
11731#ifdef __LITTLE_ENDIAN__
11732  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11733#else
11734  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11735#endif
11736}
11737
11738/* vec_vupkhsw */
11739
11740#ifdef __POWER8_VECTOR__
11741static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11742#ifdef __LITTLE_ENDIAN__
11743  return __builtin_altivec_vupklsw(__a);
11744#else
11745  return __builtin_altivec_vupkhsw(__a);
11746#endif
11747}
11748
11749static __inline__ vector bool long long __ATTRS_o_ai
11750vec_vupkhsw(vector bool int __a) {
11751#ifdef __LITTLE_ENDIAN__
11752  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11753#else
11754  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11755#endif
11756}
11757#endif
11758
11759/* vec_unpackl */
11760
11761static __inline__ vector short __ATTRS_o_ai
11762vec_unpackl(vector signed char __a) {
11763#ifdef __LITTLE_ENDIAN__
11764  return __builtin_altivec_vupkhsb((vector char)__a);
11765#else
11766  return __builtin_altivec_vupklsb((vector char)__a);
11767#endif
11768}
11769
11770static __inline__ vector bool short __ATTRS_o_ai
11771vec_unpackl(vector bool char __a) {
11772#ifdef __LITTLE_ENDIAN__
11773  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11774#else
11775  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11776#endif
11777}
11778
11779static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11780#ifdef __LITTLE_ENDIAN__
11781  return __builtin_altivec_vupkhsh(__a);
11782#else
11783  return __builtin_altivec_vupklsh(__a);
11784#endif
11785}
11786
11787static __inline__ vector bool int __ATTRS_o_ai
11788vec_unpackl(vector bool short __a) {
11789#ifdef __LITTLE_ENDIAN__
11790  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11791#else
11792  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11793#endif
11794}
11795
11796static __inline__ vector unsigned int __ATTRS_o_ai
11797vec_unpackl(vector pixel __a) {
11798#ifdef __LITTLE_ENDIAN__
11799  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11800#else
11801  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11802#endif
11803}
11804
11805#ifdef __POWER8_VECTOR__
11806static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11807#ifdef __LITTLE_ENDIAN__
11808  return __builtin_altivec_vupkhsw(__a);
11809#else
11810  return __builtin_altivec_vupklsw(__a);
11811#endif
11812}
11813
11814static __inline__ vector bool long long __ATTRS_o_ai
11815vec_unpackl(vector bool int __a) {
11816#ifdef __LITTLE_ENDIAN__
11817  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11818#else
11819  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11820#endif
11821}
11822
11823static __inline__ vector double __ATTRS_o_ai
11824vec_unpackl(vector float __a) {
11825  return (vector double)(__a[2], __a[3]);
11826}
11827#endif
11828
11829/* vec_vupklsb */
11830
11831static __inline__ vector short __ATTRS_o_ai
11832vec_vupklsb(vector signed char __a) {
11833#ifdef __LITTLE_ENDIAN__
11834  return __builtin_altivec_vupkhsb((vector char)__a);
11835#else
11836  return __builtin_altivec_vupklsb((vector char)__a);
11837#endif
11838}
11839
11840static __inline__ vector bool short __ATTRS_o_ai
11841vec_vupklsb(vector bool char __a) {
11842#ifdef __LITTLE_ENDIAN__
11843  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11844#else
11845  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11846#endif
11847}
11848
11849/* vec_vupklsh */
11850
11851static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11852#ifdef __LITTLE_ENDIAN__
11853  return __builtin_altivec_vupkhsh(__a);
11854#else
11855  return __builtin_altivec_vupklsh(__a);
11856#endif
11857}
11858
11859static __inline__ vector bool int __ATTRS_o_ai
11860vec_vupklsh(vector bool short __a) {
11861#ifdef __LITTLE_ENDIAN__
11862  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11863#else
11864  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11865#endif
11866}
11867
11868static __inline__ vector unsigned int __ATTRS_o_ai
11869vec_vupklsh(vector pixel __a) {
11870#ifdef __LITTLE_ENDIAN__
11871  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11872#else
11873  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11874#endif
11875}
11876
11877/* vec_vupklsw */
11878
11879#ifdef __POWER8_VECTOR__
11880static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11881#ifdef __LITTLE_ENDIAN__
11882  return __builtin_altivec_vupkhsw(__a);
11883#else
11884  return __builtin_altivec_vupklsw(__a);
11885#endif
11886}
11887
11888static __inline__ vector bool long long __ATTRS_o_ai
11889vec_vupklsw(vector bool int __a) {
11890#ifdef __LITTLE_ENDIAN__
11891  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11892#else
11893  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11894#endif
11895}
11896#endif
11897
11898/* vec_vsx_ld */
11899
11900#ifdef __VSX__
11901
11902static __inline__ vector bool int __ATTRS_o_ai
11903vec_vsx_ld(int __a, const vector bool int *__b) {
11904  return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11905}
11906
11907static __inline__ vector signed int __ATTRS_o_ai
11908vec_vsx_ld(int __a, const vector signed int *__b) {
11909  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11910}
11911
11912static __inline__ vector signed int __ATTRS_o_ai
11913vec_vsx_ld(int __a, const signed int *__b) {
11914  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11915}
11916
11917static __inline__ vector unsigned int __ATTRS_o_ai
11918vec_vsx_ld(int __a, const vector unsigned int *__b) {
11919  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11920}
11921
11922static __inline__ vector unsigned int __ATTRS_o_ai
11923vec_vsx_ld(int __a, const unsigned int *__b) {
11924  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11925}
11926
11927static __inline__ vector float __ATTRS_o_ai
11928vec_vsx_ld(int __a, const vector float *__b) {
11929  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11930}
11931
11932static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11933                                                       const float *__b) {
11934  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11935}
11936
11937static __inline__ vector signed long long __ATTRS_o_ai
11938vec_vsx_ld(int __a, const vector signed long long *__b) {
11939  return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11940}
11941
11942static __inline__ vector unsigned long long __ATTRS_o_ai
11943vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11944  return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11945}
11946
11947static __inline__ vector double __ATTRS_o_ai
11948vec_vsx_ld(int __a, const vector double *__b) {
11949  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11950}
11951
11952static __inline__ vector double __ATTRS_o_ai
11953vec_vsx_ld(int __a, const double *__b) {
11954  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11955}
11956
11957static __inline__ vector bool short __ATTRS_o_ai
11958vec_vsx_ld(int __a, const vector bool short *__b) {
11959  return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11960}
11961
11962static __inline__ vector signed short __ATTRS_o_ai
11963vec_vsx_ld(int __a, const vector signed short *__b) {
11964  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11965}
11966
11967static __inline__ vector signed short __ATTRS_o_ai
11968vec_vsx_ld(int __a, const signed short *__b) {
11969  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11970}
11971
11972static __inline__ vector unsigned short __ATTRS_o_ai
11973vec_vsx_ld(int __a, const vector unsigned short *__b) {
11974  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11975}
11976
11977static __inline__ vector unsigned short __ATTRS_o_ai
11978vec_vsx_ld(int __a, const unsigned short *__b) {
11979  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11980}
11981
11982static __inline__ vector bool char __ATTRS_o_ai
11983vec_vsx_ld(int __a, const vector bool char *__b) {
11984  return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11985}
11986
11987static __inline__ vector signed char __ATTRS_o_ai
11988vec_vsx_ld(int __a, const vector signed char *__b) {
11989  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11990}
11991
11992static __inline__ vector signed char __ATTRS_o_ai
11993vec_vsx_ld(int __a, const signed char *__b) {
11994  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11995}
11996
11997static __inline__ vector unsigned char __ATTRS_o_ai
11998vec_vsx_ld(int __a, const vector unsigned char *__b) {
11999  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12000}
12001
12002static __inline__ vector unsigned char __ATTRS_o_ai
12003vec_vsx_ld(int __a, const unsigned char *__b) {
12004  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12005}
12006
12007#endif
12008
12009/* vec_vsx_st */
12010
12011#ifdef __VSX__
12012
12013static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12014                                               vector bool int *__c) {
12015  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12016}
12017
12018static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12019                                               signed int *__c) {
12020  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12021}
12022
12023static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12024                                               unsigned int *__c) {
12025  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12026}
12027
12028static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12029                                               vector signed int *__c) {
12030  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12031}
12032
12033static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12034                                               signed int *__c) {
12035  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12036}
12037
12038static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12039                                               vector unsigned int *__c) {
12040  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12041}
12042
12043static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12044                                               unsigned int *__c) {
12045  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12046}
12047
12048static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12049                                               vector float *__c) {
12050  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12051}
12052
12053static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12054                                               float *__c) {
12055  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12056}
12057
12058static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12059                                               int __b,
12060                                               vector signed long long *__c) {
12061  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12062}
12063
12064static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12065                                               int __b,
12066                                               vector unsigned long long *__c) {
12067  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12068}
12069
12070static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12071                                               vector double *__c) {
12072  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12073}
12074
12075static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12076                                               double *__c) {
12077  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12078}
12079
12080static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12081                                               vector bool short *__c) {
12082  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12083}
12084
12085static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12086                                               signed short *__c) {
12087  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12088}
12089
12090static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12091                                               unsigned short *__c) {
12092  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12093}
12094static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12095                                               vector signed short *__c) {
12096  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12097}
12098
12099static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12100                                               signed short *__c) {
12101  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12102}
12103
12104static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12105                                               int __b,
12106                                               vector unsigned short *__c) {
12107  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12108}
12109
12110static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12111                                               int __b, unsigned short *__c) {
12112  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12113}
12114
12115static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12116                                               vector bool char *__c) {
12117  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12118}
12119
12120static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12121                                               signed char *__c) {
12122  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12123}
12124
12125static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12126                                               unsigned char *__c) {
12127  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12128}
12129
12130static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12131                                               vector signed char *__c) {
12132  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12133}
12134
12135static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12136                                               signed char *__c) {
12137  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12138}
12139
12140static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12141                                               int __b,
12142                                               vector unsigned char *__c) {
12143  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12144}
12145
12146static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12147                                               int __b, unsigned char *__c) {
12148  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12149}
12150
12151#endif
12152
12153#ifdef __VSX__
12154#define vec_xxpermdi __builtin_vsx_xxpermdi
12155#define vec_xxsldwi __builtin_vsx_xxsldwi
12156#endif
12157
12158/* vec_xor */
12159
12160#define __builtin_altivec_vxor vec_xor
12161
12162static __inline__ vector signed char __ATTRS_o_ai
12163vec_xor(vector signed char __a, vector signed char __b) {
12164  return __a ^ __b;
12165}
12166
12167static __inline__ vector signed char __ATTRS_o_ai
12168vec_xor(vector bool char __a, vector signed char __b) {
12169  return (vector signed char)__a ^ __b;
12170}
12171
12172static __inline__ vector signed char __ATTRS_o_ai
12173vec_xor(vector signed char __a, vector bool char __b) {
12174  return __a ^ (vector signed char)__b;
12175}
12176
12177static __inline__ vector unsigned char __ATTRS_o_ai
12178vec_xor(vector unsigned char __a, vector unsigned char __b) {
12179  return __a ^ __b;
12180}
12181
12182static __inline__ vector unsigned char __ATTRS_o_ai
12183vec_xor(vector bool char __a, vector unsigned char __b) {
12184  return (vector unsigned char)__a ^ __b;
12185}
12186
12187static __inline__ vector unsigned char __ATTRS_o_ai
12188vec_xor(vector unsigned char __a, vector bool char __b) {
12189  return __a ^ (vector unsigned char)__b;
12190}
12191
12192static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12193                                                        vector bool char __b) {
12194  return __a ^ __b;
12195}
12196
12197static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12198                                                    vector short __b) {
12199  return __a ^ __b;
12200}
12201
12202static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12203                                                    vector short __b) {
12204  return (vector short)__a ^ __b;
12205}
12206
12207static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12208                                                    vector bool short __b) {
12209  return __a ^ (vector short)__b;
12210}
12211
12212static __inline__ vector unsigned short __ATTRS_o_ai
12213vec_xor(vector unsigned short __a, vector unsigned short __b) {
12214  return __a ^ __b;
12215}
12216
12217static __inline__ vector unsigned short __ATTRS_o_ai
12218vec_xor(vector bool short __a, vector unsigned short __b) {
12219  return (vector unsigned short)__a ^ __b;
12220}
12221
12222static __inline__ vector unsigned short __ATTRS_o_ai
12223vec_xor(vector unsigned short __a, vector bool short __b) {
12224  return __a ^ (vector unsigned short)__b;
12225}
12226
12227static __inline__ vector bool short __ATTRS_o_ai
12228vec_xor(vector bool short __a, vector bool short __b) {
12229  return __a ^ __b;
12230}
12231
12232static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12233                                                  vector int __b) {
12234  return __a ^ __b;
12235}
12236
12237static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12238                                                  vector int __b) {
12239  return (vector int)__a ^ __b;
12240}
12241
12242static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12243                                                  vector bool int __b) {
12244  return __a ^ (vector int)__b;
12245}
12246
12247static __inline__ vector unsigned int __ATTRS_o_ai
12248vec_xor(vector unsigned int __a, vector unsigned int __b) {
12249  return __a ^ __b;
12250}
12251
12252static __inline__ vector unsigned int __ATTRS_o_ai
12253vec_xor(vector bool int __a, vector unsigned int __b) {
12254  return (vector unsigned int)__a ^ __b;
12255}
12256
12257static __inline__ vector unsigned int __ATTRS_o_ai
12258vec_xor(vector unsigned int __a, vector bool int __b) {
12259  return __a ^ (vector unsigned int)__b;
12260}
12261
12262static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12263                                                       vector bool int __b) {
12264  return __a ^ __b;
12265}
12266
12267static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12268                                                    vector float __b) {
12269  vector unsigned int __res =
12270      (vector unsigned int)__a ^ (vector unsigned int)__b;
12271  return (vector float)__res;
12272}
12273
12274static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12275                                                    vector float __b) {
12276  vector unsigned int __res =
12277      (vector unsigned int)__a ^ (vector unsigned int)__b;
12278  return (vector float)__res;
12279}
12280
12281static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12282                                                    vector bool int __b) {
12283  vector unsigned int __res =
12284      (vector unsigned int)__a ^ (vector unsigned int)__b;
12285  return (vector float)__res;
12286}
12287
12288#ifdef __VSX__
12289static __inline__ vector signed long long __ATTRS_o_ai
12290vec_xor(vector signed long long __a, vector signed long long __b) {
12291  return __a ^ __b;
12292}
12293
12294static __inline__ vector signed long long __ATTRS_o_ai
12295vec_xor(vector bool long long __a, vector signed long long __b) {
12296  return (vector signed long long)__a ^ __b;
12297}
12298
12299static __inline__ vector signed long long __ATTRS_o_ai
12300vec_xor(vector signed long long __a, vector bool long long __b) {
12301  return __a ^ (vector signed long long)__b;
12302}
12303
12304static __inline__ vector unsigned long long __ATTRS_o_ai
12305vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12306  return __a ^ __b;
12307}
12308
12309static __inline__ vector unsigned long long __ATTRS_o_ai
12310vec_xor(vector bool long long __a, vector unsigned long long __b) {
12311  return (vector unsigned long long)__a ^ __b;
12312}
12313
12314static __inline__ vector unsigned long long __ATTRS_o_ai
12315vec_xor(vector unsigned long long __a, vector bool long long __b) {
12316  return __a ^ (vector unsigned long long)__b;
12317}
12318
12319static __inline__ vector bool long long __ATTRS_o_ai
12320vec_xor(vector bool long long __a, vector bool long long __b) {
12321  return __a ^ __b;
12322}
12323
12324static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12325                                                     vector double __b) {
12326  return (vector double)((vector unsigned long long)__a ^
12327                         (vector unsigned long long)__b);
12328}
12329
12330static __inline__ vector double __ATTRS_o_ai
12331vec_xor(vector double __a, vector bool long long __b) {
12332  return (vector double)((vector unsigned long long)__a ^
12333                         (vector unsigned long long)__b);
12334}
12335
12336static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12337                                                     vector double __b) {
12338  return (vector double)((vector unsigned long long)__a ^
12339                         (vector unsigned long long)__b);
12340}
12341#endif
12342
12343/* vec_vxor */
12344
12345static __inline__ vector signed char __ATTRS_o_ai
12346vec_vxor(vector signed char __a, vector signed char __b) {
12347  return __a ^ __b;
12348}
12349
12350static __inline__ vector signed char __ATTRS_o_ai
12351vec_vxor(vector bool char __a, vector signed char __b) {
12352  return (vector signed char)__a ^ __b;
12353}
12354
12355static __inline__ vector signed char __ATTRS_o_ai
12356vec_vxor(vector signed char __a, vector bool char __b) {
12357  return __a ^ (vector signed char)__b;
12358}
12359
12360static __inline__ vector unsigned char __ATTRS_o_ai
12361vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12362  return __a ^ __b;
12363}
12364
12365static __inline__ vector unsigned char __ATTRS_o_ai
12366vec_vxor(vector bool char __a, vector unsigned char __b) {
12367  return (vector unsigned char)__a ^ __b;
12368}
12369
12370static __inline__ vector unsigned char __ATTRS_o_ai
12371vec_vxor(vector unsigned char __a, vector bool char __b) {
12372  return __a ^ (vector unsigned char)__b;
12373}
12374
12375static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12376                                                         vector bool char __b) {
12377  return __a ^ __b;
12378}
12379
12380static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12381                                                     vector short __b) {
12382  return __a ^ __b;
12383}
12384
12385static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12386                                                     vector short __b) {
12387  return (vector short)__a ^ __b;
12388}
12389
12390static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12391                                                     vector bool short __b) {
12392  return __a ^ (vector short)__b;
12393}
12394
12395static __inline__ vector unsigned short __ATTRS_o_ai
12396vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12397  return __a ^ __b;
12398}
12399
12400static __inline__ vector unsigned short __ATTRS_o_ai
12401vec_vxor(vector bool short __a, vector unsigned short __b) {
12402  return (vector unsigned short)__a ^ __b;
12403}
12404
12405static __inline__ vector unsigned short __ATTRS_o_ai
12406vec_vxor(vector unsigned short __a, vector bool short __b) {
12407  return __a ^ (vector unsigned short)__b;
12408}
12409
12410static __inline__ vector bool short __ATTRS_o_ai
12411vec_vxor(vector bool short __a, vector bool short __b) {
12412  return __a ^ __b;
12413}
12414
12415static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12416                                                   vector int __b) {
12417  return __a ^ __b;
12418}
12419
12420static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12421                                                   vector int __b) {
12422  return (vector int)__a ^ __b;
12423}
12424
12425static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12426                                                   vector bool int __b) {
12427  return __a ^ (vector int)__b;
12428}
12429
12430static __inline__ vector unsigned int __ATTRS_o_ai
12431vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12432  return __a ^ __b;
12433}
12434
12435static __inline__ vector unsigned int __ATTRS_o_ai
12436vec_vxor(vector bool int __a, vector unsigned int __b) {
12437  return (vector unsigned int)__a ^ __b;
12438}
12439
12440static __inline__ vector unsigned int __ATTRS_o_ai
12441vec_vxor(vector unsigned int __a, vector bool int __b) {
12442  return __a ^ (vector unsigned int)__b;
12443}
12444
12445static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12446                                                        vector bool int __b) {
12447  return __a ^ __b;
12448}
12449
12450static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12451                                                     vector float __b) {
12452  vector unsigned int __res =
12453      (vector unsigned int)__a ^ (vector unsigned int)__b;
12454  return (vector float)__res;
12455}
12456
12457static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12458                                                     vector float __b) {
12459  vector unsigned int __res =
12460      (vector unsigned int)__a ^ (vector unsigned int)__b;
12461  return (vector float)__res;
12462}
12463
12464static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12465                                                     vector bool int __b) {
12466  vector unsigned int __res =
12467      (vector unsigned int)__a ^ (vector unsigned int)__b;
12468  return (vector float)__res;
12469}
12470
12471#ifdef __VSX__
12472static __inline__ vector signed long long __ATTRS_o_ai
12473vec_vxor(vector signed long long __a, vector signed long long __b) {
12474  return __a ^ __b;
12475}
12476
12477static __inline__ vector signed long long __ATTRS_o_ai
12478vec_vxor(vector bool long long __a, vector signed long long __b) {
12479  return (vector signed long long)__a ^ __b;
12480}
12481
12482static __inline__ vector signed long long __ATTRS_o_ai
12483vec_vxor(vector signed long long __a, vector bool long long __b) {
12484  return __a ^ (vector signed long long)__b;
12485}
12486
12487static __inline__ vector unsigned long long __ATTRS_o_ai
12488vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12489  return __a ^ __b;
12490}
12491
12492static __inline__ vector unsigned long long __ATTRS_o_ai
12493vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12494  return (vector unsigned long long)__a ^ __b;
12495}
12496
12497static __inline__ vector unsigned long long __ATTRS_o_ai
12498vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12499  return __a ^ (vector unsigned long long)__b;
12500}
12501
12502static __inline__ vector bool long long __ATTRS_o_ai
12503vec_vxor(vector bool long long __a, vector bool long long __b) {
12504  return __a ^ __b;
12505}
12506#endif
12507
12508/* ------------------------ extensions for CBEA ----------------------------- */
12509
12510/* vec_extract */
12511
12512static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12513                                                       int __b) {
12514  return __a[__b];
12515}
12516
12517static __inline__ unsigned char __ATTRS_o_ai
12518vec_extract(vector unsigned char __a, int __b) {
12519  return __a[__b];
12520}
12521
12522static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12523                                                         int __b) {
12524  return __a[__b];
12525}
12526
12527static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12528                                                        int __b) {
12529  return __a[__b];
12530}
12531
12532static __inline__ unsigned short __ATTRS_o_ai
12533vec_extract(vector unsigned short __a, int __b) {
12534  return __a[__b];
12535}
12536
12537static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12538                                                          int __b) {
12539  return __a[__b];
12540}
12541
12542static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12543                                                      int __b) {
12544  return __a[__b];
12545}
12546
12547static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12548                                                        int __b) {
12549  return __a[__b];
12550}
12551
12552static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12553                                                        int __b) {
12554  return __a[__b];
12555}
12556
12557#ifdef __VSX__
12558static __inline__ signed long long __ATTRS_o_ai
12559vec_extract(vector signed long long __a, int __b) {
12560  return __a[__b];
12561}
12562
12563static __inline__ unsigned long long __ATTRS_o_ai
12564vec_extract(vector unsigned long long __a, int __b) {
12565  return __a[__b];
12566}
12567
12568static __inline__ unsigned long long __ATTRS_o_ai
12569vec_extract(vector bool long long __a, int __b) {
12570  return __a[__b];
12571}
12572
12573static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12574  return __a[__b];
12575}
12576#endif
12577
12578static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12579  return __a[__b];
12580}
12581
12582#ifdef __POWER9_VECTOR__
12583
12584#define vec_insert4b __builtin_vsx_insertword
12585#define vec_extract4b __builtin_vsx_extractuword
12586
12587/* vec_extract_exp */
12588
12589static __inline__ vector unsigned int __ATTRS_o_ai
12590vec_extract_exp(vector float __a) {
12591  return __builtin_vsx_xvxexpsp(__a);
12592}
12593
12594static __inline__ vector unsigned long long __ATTRS_o_ai
12595vec_extract_exp(vector double __a) {
12596  return __builtin_vsx_xvxexpdp(__a);
12597}
12598
12599/* vec_extract_sig */
12600
12601static __inline__ vector unsigned int __ATTRS_o_ai
12602vec_extract_sig(vector float __a) {
12603  return __builtin_vsx_xvxsigsp(__a);
12604}
12605
12606static __inline__ vector unsigned long long __ATTRS_o_ai
12607vec_extract_sig (vector double __a) {
12608  return __builtin_vsx_xvxsigdp(__a);
12609}
12610
12611static __inline__ vector float __ATTRS_o_ai
12612vec_extract_fp32_from_shorth(vector unsigned short __a) {
12613  vector unsigned short __b =
12614#ifdef __LITTLE_ENDIAN__
12615            __builtin_shufflevector(__a, __a, 0, -11, -12, -13, -1);
12616#else
12617            __builtin_shufflevector(__a, __a, -10, -11, -12, -13);
12618#endif
12619  return __builtin_vsx_xvcvhpsp(__b);
12620}
12621
12622static __inline__ vector float __ATTRS_o_ai
12623vec_extract_fp32_from_shortl(vector unsigned short __a) {
12624  vector unsigned short __b =
12625#ifdef __LITTLE_ENDIAN__
12626            __builtin_shufflevector(__a, __a, 4, -15, -16, -17, -1);
12627#else
12628            __builtin_shufflevector(__a, __a, -14, -15, -16, -17);
12629#endif
12630  return __builtin_vsx_xvcvhpsp(__b);
12631}
12632#endif /* __POWER9_VECTOR__ */
12633
12634/* vec_insert */
12635
12636static __inline__ vector signed char __ATTRS_o_ai
12637vec_insert(signed char __a, vector signed char __b, int __c) {
12638  __b[__c] = __a;
12639  return __b;
12640}
12641
12642static __inline__ vector unsigned char __ATTRS_o_ai
12643vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12644  __b[__c] = __a;
12645  return __b;
12646}
12647
12648static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12649                                                           vector bool char __b,
12650                                                           int __c) {
12651  __b[__c] = __a;
12652  return __b;
12653}
12654
12655static __inline__ vector signed short __ATTRS_o_ai
12656vec_insert(signed short __a, vector signed short __b, int __c) {
12657  __b[__c] = __a;
12658  return __b;
12659}
12660
12661static __inline__ vector unsigned short __ATTRS_o_ai
12662vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12663  __b[__c] = __a;
12664  return __b;
12665}
12666
12667static __inline__ vector bool short __ATTRS_o_ai
12668vec_insert(unsigned short __a, vector bool short __b, int __c) {
12669  __b[__c] = __a;
12670  return __b;
12671}
12672
12673static __inline__ vector signed int __ATTRS_o_ai
12674vec_insert(signed int __a, vector signed int __b, int __c) {
12675  __b[__c] = __a;
12676  return __b;
12677}
12678
12679static __inline__ vector unsigned int __ATTRS_o_ai
12680vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12681  __b[__c] = __a;
12682  return __b;
12683}
12684
12685static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12686                                                          vector bool int __b,
12687                                                          int __c) {
12688  __b[__c] = __a;
12689  return __b;
12690}
12691
12692#ifdef __VSX__
12693static __inline__ vector signed long long __ATTRS_o_ai
12694vec_insert(signed long long __a, vector signed long long __b, int __c) {
12695  __b[__c] = __a;
12696  return __b;
12697}
12698
12699static __inline__ vector unsigned long long __ATTRS_o_ai
12700vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12701  __b[__c] = __a;
12702  return __b;
12703}
12704
12705static __inline__ vector bool long long __ATTRS_o_ai
12706vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12707  __b[__c] = __a;
12708  return __b;
12709}
12710static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12711                                                        vector double __b,
12712                                                        int __c) {
12713  __b[__c] = __a;
12714  return __b;
12715}
12716#endif
12717
12718static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12719                                                       vector float __b,
12720                                                       int __c) {
12721  __b[__c] = __a;
12722  return __b;
12723}
12724
12725/* vec_lvlx */
12726
12727static __inline__ vector signed char __ATTRS_o_ai
12728vec_lvlx(int __a, const signed char *__b) {
12729  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12730                  vec_lvsl(__a, __b));
12731}
12732
12733static __inline__ vector signed char __ATTRS_o_ai
12734vec_lvlx(int __a, const vector signed char *__b) {
12735  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12736                  vec_lvsl(__a, (unsigned char *)__b));
12737}
12738
12739static __inline__ vector unsigned char __ATTRS_o_ai
12740vec_lvlx(int __a, const unsigned char *__b) {
12741  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12742                  vec_lvsl(__a, __b));
12743}
12744
12745static __inline__ vector unsigned char __ATTRS_o_ai
12746vec_lvlx(int __a, const vector unsigned char *__b) {
12747  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12748                  vec_lvsl(__a, (unsigned char *)__b));
12749}
12750
12751static __inline__ vector bool char __ATTRS_o_ai
12752vec_lvlx(int __a, const vector bool char *__b) {
12753  return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12754                  vec_lvsl(__a, (unsigned char *)__b));
12755}
12756
12757static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12758                                                     const short *__b) {
12759  return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12760}
12761
12762static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12763                                                     const vector short *__b) {
12764  return vec_perm(vec_ld(__a, __b), (vector short)(0),
12765                  vec_lvsl(__a, (unsigned char *)__b));
12766}
12767
12768static __inline__ vector unsigned short __ATTRS_o_ai
12769vec_lvlx(int __a, const unsigned short *__b) {
12770  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12771                  vec_lvsl(__a, __b));
12772}
12773
12774static __inline__ vector unsigned short __ATTRS_o_ai
12775vec_lvlx(int __a, const vector unsigned short *__b) {
12776  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12777                  vec_lvsl(__a, (unsigned char *)__b));
12778}
12779
12780static __inline__ vector bool short __ATTRS_o_ai
12781vec_lvlx(int __a, const vector bool short *__b) {
12782  return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12783                  vec_lvsl(__a, (unsigned char *)__b));
12784}
12785
12786static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12787                                                     const vector pixel *__b) {
12788  return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12789                  vec_lvsl(__a, (unsigned char *)__b));
12790}
12791
12792static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12793  return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12794}
12795
12796static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12797                                                   const vector int *__b) {
12798  return vec_perm(vec_ld(__a, __b), (vector int)(0),
12799                  vec_lvsl(__a, (unsigned char *)__b));
12800}
12801
12802static __inline__ vector unsigned int __ATTRS_o_ai
12803vec_lvlx(int __a, const unsigned int *__b) {
12804  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12805                  vec_lvsl(__a, __b));
12806}
12807
12808static __inline__ vector unsigned int __ATTRS_o_ai
12809vec_lvlx(int __a, const vector unsigned int *__b) {
12810  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12811                  vec_lvsl(__a, (unsigned char *)__b));
12812}
12813
12814static __inline__ vector bool int __ATTRS_o_ai
12815vec_lvlx(int __a, const vector bool int *__b) {
12816  return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12817                  vec_lvsl(__a, (unsigned char *)__b));
12818}
12819
12820static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12821                                                     const float *__b) {
12822  return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12823}
12824
12825static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12826                                                     const vector float *__b) {
12827  return vec_perm(vec_ld(__a, __b), (vector float)(0),
12828                  vec_lvsl(__a, (unsigned char *)__b));
12829}
12830
12831/* vec_lvlxl */
12832
12833static __inline__ vector signed char __ATTRS_o_ai
12834vec_lvlxl(int __a, const signed char *__b) {
12835  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12836                  vec_lvsl(__a, __b));
12837}
12838
12839static __inline__ vector signed char __ATTRS_o_ai
12840vec_lvlxl(int __a, const vector signed char *__b) {
12841  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12842                  vec_lvsl(__a, (unsigned char *)__b));
12843}
12844
12845static __inline__ vector unsigned char __ATTRS_o_ai
12846vec_lvlxl(int __a, const unsigned char *__b) {
12847  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12848                  vec_lvsl(__a, __b));
12849}
12850
12851static __inline__ vector unsigned char __ATTRS_o_ai
12852vec_lvlxl(int __a, const vector unsigned char *__b) {
12853  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12854                  vec_lvsl(__a, (unsigned char *)__b));
12855}
12856
12857static __inline__ vector bool char __ATTRS_o_ai
12858vec_lvlxl(int __a, const vector bool char *__b) {
12859  return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12860                  vec_lvsl(__a, (unsigned char *)__b));
12861}
12862
12863static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12864                                                      const short *__b) {
12865  return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12866}
12867
12868static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12869                                                      const vector short *__b) {
12870  return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12871                  vec_lvsl(__a, (unsigned char *)__b));
12872}
12873
12874static __inline__ vector unsigned short __ATTRS_o_ai
12875vec_lvlxl(int __a, const unsigned short *__b) {
12876  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12877                  vec_lvsl(__a, __b));
12878}
12879
12880static __inline__ vector unsigned short __ATTRS_o_ai
12881vec_lvlxl(int __a, const vector unsigned short *__b) {
12882  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12883                  vec_lvsl(__a, (unsigned char *)__b));
12884}
12885
12886static __inline__ vector bool short __ATTRS_o_ai
12887vec_lvlxl(int __a, const vector bool short *__b) {
12888  return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12889                  vec_lvsl(__a, (unsigned char *)__b));
12890}
12891
12892static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12893                                                      const vector pixel *__b) {
12894  return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12895                  vec_lvsl(__a, (unsigned char *)__b));
12896}
12897
12898static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12899  return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12900}
12901
12902static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12903                                                    const vector int *__b) {
12904  return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12905                  vec_lvsl(__a, (unsigned char *)__b));
12906}
12907
12908static __inline__ vector unsigned int __ATTRS_o_ai
12909vec_lvlxl(int __a, const unsigned int *__b) {
12910  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12911                  vec_lvsl(__a, __b));
12912}
12913
12914static __inline__ vector unsigned int __ATTRS_o_ai
12915vec_lvlxl(int __a, const vector unsigned int *__b) {
12916  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12917                  vec_lvsl(__a, (unsigned char *)__b));
12918}
12919
12920static __inline__ vector bool int __ATTRS_o_ai
12921vec_lvlxl(int __a, const vector bool int *__b) {
12922  return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12923                  vec_lvsl(__a, (unsigned char *)__b));
12924}
12925
12926static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12927                                                      const float *__b) {
12928  return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12929}
12930
12931static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12932                                                      vector float *__b) {
12933  return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12934                  vec_lvsl(__a, (unsigned char *)__b));
12935}
12936
12937/* vec_lvrx */
12938
12939static __inline__ vector signed char __ATTRS_o_ai
12940vec_lvrx(int __a, const signed char *__b) {
12941  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12942                  vec_lvsl(__a, __b));
12943}
12944
12945static __inline__ vector signed char __ATTRS_o_ai
12946vec_lvrx(int __a, const vector signed char *__b) {
12947  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12948                  vec_lvsl(__a, (unsigned char *)__b));
12949}
12950
12951static __inline__ vector unsigned char __ATTRS_o_ai
12952vec_lvrx(int __a, const unsigned char *__b) {
12953  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12954                  vec_lvsl(__a, __b));
12955}
12956
12957static __inline__ vector unsigned char __ATTRS_o_ai
12958vec_lvrx(int __a, const vector unsigned char *__b) {
12959  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12960                  vec_lvsl(__a, (unsigned char *)__b));
12961}
12962
12963static __inline__ vector bool char __ATTRS_o_ai
12964vec_lvrx(int __a, const vector bool char *__b) {
12965  return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12966                  vec_lvsl(__a, (unsigned char *)__b));
12967}
12968
12969static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12970                                                     const short *__b) {
12971  return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12972}
12973
12974static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12975                                                     const vector short *__b) {
12976  return vec_perm((vector short)(0), vec_ld(__a, __b),
12977                  vec_lvsl(__a, (unsigned char *)__b));
12978}
12979
12980static __inline__ vector unsigned short __ATTRS_o_ai
12981vec_lvrx(int __a, const unsigned short *__b) {
12982  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12983                  vec_lvsl(__a, __b));
12984}
12985
12986static __inline__ vector unsigned short __ATTRS_o_ai
12987vec_lvrx(int __a, const vector unsigned short *__b) {
12988  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12989                  vec_lvsl(__a, (unsigned char *)__b));
12990}
12991
12992static __inline__ vector bool short __ATTRS_o_ai
12993vec_lvrx(int __a, const vector bool short *__b) {
12994  return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12995                  vec_lvsl(__a, (unsigned char *)__b));
12996}
12997
12998static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12999                                                     const vector pixel *__b) {
13000  return vec_perm((vector pixel)(0), vec_ld(__a, __b),
13001                  vec_lvsl(__a, (unsigned char *)__b));
13002}
13003
13004static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
13005  return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13006}
13007
13008static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
13009                                                   const vector int *__b) {
13010  return vec_perm((vector int)(0), vec_ld(__a, __b),
13011                  vec_lvsl(__a, (unsigned char *)__b));
13012}
13013
13014static __inline__ vector unsigned int __ATTRS_o_ai
13015vec_lvrx(int __a, const unsigned int *__b) {
13016  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13017                  vec_lvsl(__a, __b));
13018}
13019
13020static __inline__ vector unsigned int __ATTRS_o_ai
13021vec_lvrx(int __a, const vector unsigned int *__b) {
13022  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13023                  vec_lvsl(__a, (unsigned char *)__b));
13024}
13025
13026static __inline__ vector bool int __ATTRS_o_ai
13027vec_lvrx(int __a, const vector bool int *__b) {
13028  return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13029                  vec_lvsl(__a, (unsigned char *)__b));
13030}
13031
13032static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13033                                                     const float *__b) {
13034  return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13035}
13036
13037static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13038                                                     const vector float *__b) {
13039  return vec_perm((vector float)(0), vec_ld(__a, __b),
13040                  vec_lvsl(__a, (unsigned char *)__b));
13041}
13042
13043/* vec_lvrxl */
13044
13045static __inline__ vector signed char __ATTRS_o_ai
13046vec_lvrxl(int __a, const signed char *__b) {
13047  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13048                  vec_lvsl(__a, __b));
13049}
13050
13051static __inline__ vector signed char __ATTRS_o_ai
13052vec_lvrxl(int __a, const vector signed char *__b) {
13053  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13054                  vec_lvsl(__a, (unsigned char *)__b));
13055}
13056
13057static __inline__ vector unsigned char __ATTRS_o_ai
13058vec_lvrxl(int __a, const unsigned char *__b) {
13059  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13060                  vec_lvsl(__a, __b));
13061}
13062
13063static __inline__ vector unsigned char __ATTRS_o_ai
13064vec_lvrxl(int __a, const vector unsigned char *__b) {
13065  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13066                  vec_lvsl(__a, (unsigned char *)__b));
13067}
13068
13069static __inline__ vector bool char __ATTRS_o_ai
13070vec_lvrxl(int __a, const vector bool char *__b) {
13071  return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13072                  vec_lvsl(__a, (unsigned char *)__b));
13073}
13074
13075static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13076                                                      const short *__b) {
13077  return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13078}
13079
13080static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13081                                                      const vector short *__b) {
13082  return vec_perm((vector short)(0), vec_ldl(__a, __b),
13083                  vec_lvsl(__a, (unsigned char *)__b));
13084}
13085
13086static __inline__ vector unsigned short __ATTRS_o_ai
13087vec_lvrxl(int __a, const unsigned short *__b) {
13088  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13089                  vec_lvsl(__a, __b));
13090}
13091
13092static __inline__ vector unsigned short __ATTRS_o_ai
13093vec_lvrxl(int __a, const vector unsigned short *__b) {
13094  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13095                  vec_lvsl(__a, (unsigned char *)__b));
13096}
13097
13098static __inline__ vector bool short __ATTRS_o_ai
13099vec_lvrxl(int __a, const vector bool short *__b) {
13100  return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13101                  vec_lvsl(__a, (unsigned char *)__b));
13102}
13103
13104static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13105                                                      const vector pixel *__b) {
13106  return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13107                  vec_lvsl(__a, (unsigned char *)__b));
13108}
13109
13110static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13111  return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13112}
13113
13114static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13115                                                    const vector int *__b) {
13116  return vec_perm((vector int)(0), vec_ldl(__a, __b),
13117                  vec_lvsl(__a, (unsigned char *)__b));
13118}
13119
13120static __inline__ vector unsigned int __ATTRS_o_ai
13121vec_lvrxl(int __a, const unsigned int *__b) {
13122  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13123                  vec_lvsl(__a, __b));
13124}
13125
13126static __inline__ vector unsigned int __ATTRS_o_ai
13127vec_lvrxl(int __a, const vector unsigned int *__b) {
13128  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13129                  vec_lvsl(__a, (unsigned char *)__b));
13130}
13131
13132static __inline__ vector bool int __ATTRS_o_ai
13133vec_lvrxl(int __a, const vector bool int *__b) {
13134  return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13135                  vec_lvsl(__a, (unsigned char *)__b));
13136}
13137
13138static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13139                                                      const float *__b) {
13140  return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13141}
13142
13143static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13144                                                      const vector float *__b) {
13145  return vec_perm((vector float)(0), vec_ldl(__a, __b),
13146                  vec_lvsl(__a, (unsigned char *)__b));
13147}
13148
13149/* vec_stvlx */
13150
13151static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13152                                              signed char *__c) {
13153  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13154                __c);
13155}
13156
13157static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13158                                              vector signed char *__c) {
13159  return vec_st(
13160      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13161      __b, __c);
13162}
13163
13164static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13165                                              unsigned char *__c) {
13166  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13167                __c);
13168}
13169
13170static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13171                                              vector unsigned char *__c) {
13172  return vec_st(
13173      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13174      __b, __c);
13175}
13176
13177static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13178                                              vector bool char *__c) {
13179  return vec_st(
13180      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13181      __b, __c);
13182}
13183
13184static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13185                                              short *__c) {
13186  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13187                __c);
13188}
13189
13190static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13191                                              vector short *__c) {
13192  return vec_st(
13193      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13194      __b, __c);
13195}
13196
13197static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13198                                              int __b, unsigned short *__c) {
13199  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13200                __c);
13201}
13202
13203static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13204                                              int __b,
13205                                              vector unsigned short *__c) {
13206  return vec_st(
13207      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13208      __b, __c);
13209}
13210
13211static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13212                                              vector bool short *__c) {
13213  return vec_st(
13214      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13215      __b, __c);
13216}
13217
13218static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13219                                              vector pixel *__c) {
13220  return vec_st(
13221      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13222      __b, __c);
13223}
13224
13225static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13226                                              int *__c) {
13227  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13228                __c);
13229}
13230
13231static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13232                                              vector int *__c) {
13233  return vec_st(
13234      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13235      __b, __c);
13236}
13237
13238static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13239                                              unsigned int *__c) {
13240  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13241                __c);
13242}
13243
13244static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13245                                              vector unsigned int *__c) {
13246  return vec_st(
13247      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13248      __b, __c);
13249}
13250
13251static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13252                                              vector bool int *__c) {
13253  return vec_st(
13254      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13255      __b, __c);
13256}
13257
13258static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13259                                              vector float *__c) {
13260  return vec_st(
13261      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13262      __b, __c);
13263}
13264
13265/* vec_stvlxl */
13266
13267static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13268                                               signed char *__c) {
13269  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13270                 __c);
13271}
13272
13273static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13274                                               vector signed char *__c) {
13275  return vec_stl(
13276      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13277      __b, __c);
13278}
13279
13280static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13281                                               int __b, unsigned char *__c) {
13282  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13283                 __c);
13284}
13285
13286static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13287                                               int __b,
13288                                               vector unsigned char *__c) {
13289  return vec_stl(
13290      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13291      __b, __c);
13292}
13293
13294static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13295                                               vector bool char *__c) {
13296  return vec_stl(
13297      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13298      __b, __c);
13299}
13300
13301static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13302                                               short *__c) {
13303  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13304                 __c);
13305}
13306
13307static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13308                                               vector short *__c) {
13309  return vec_stl(
13310      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13311      __b, __c);
13312}
13313
13314static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13315                                               int __b, unsigned short *__c) {
13316  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13317                 __c);
13318}
13319
13320static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13321                                               int __b,
13322                                               vector unsigned short *__c) {
13323  return vec_stl(
13324      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13325      __b, __c);
13326}
13327
13328static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13329                                               vector bool short *__c) {
13330  return vec_stl(
13331      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13332      __b, __c);
13333}
13334
13335static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13336                                               vector pixel *__c) {
13337  return vec_stl(
13338      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13339      __b, __c);
13340}
13341
13342static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13343                                               int *__c) {
13344  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13345                 __c);
13346}
13347
13348static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13349                                               vector int *__c) {
13350  return vec_stl(
13351      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13352      __b, __c);
13353}
13354
13355static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13356                                               unsigned int *__c) {
13357  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13358                 __c);
13359}
13360
13361static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13362                                               vector unsigned int *__c) {
13363  return vec_stl(
13364      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13365      __b, __c);
13366}
13367
13368static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13369                                               vector bool int *__c) {
13370  return vec_stl(
13371      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13372      __b, __c);
13373}
13374
13375static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13376                                               vector float *__c) {
13377  return vec_stl(
13378      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13379      __b, __c);
13380}
13381
13382/* vec_stvrx */
13383
13384static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13385                                              signed char *__c) {
13386  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13387                __c);
13388}
13389
13390static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13391                                              vector signed char *__c) {
13392  return vec_st(
13393      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13394      __b, __c);
13395}
13396
13397static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13398                                              unsigned char *__c) {
13399  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13400                __c);
13401}
13402
13403static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13404                                              vector unsigned char *__c) {
13405  return vec_st(
13406      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13407      __b, __c);
13408}
13409
13410static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13411                                              vector bool char *__c) {
13412  return vec_st(
13413      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13414      __b, __c);
13415}
13416
13417static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13418                                              short *__c) {
13419  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13420                __c);
13421}
13422
13423static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13424                                              vector short *__c) {
13425  return vec_st(
13426      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13427      __b, __c);
13428}
13429
13430static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13431                                              int __b, unsigned short *__c) {
13432  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13433                __c);
13434}
13435
13436static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13437                                              int __b,
13438                                              vector unsigned short *__c) {
13439  return vec_st(
13440      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13441      __b, __c);
13442}
13443
13444static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13445                                              vector bool short *__c) {
13446  return vec_st(
13447      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13448      __b, __c);
13449}
13450
13451static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13452                                              vector pixel *__c) {
13453  return vec_st(
13454      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13455      __b, __c);
13456}
13457
13458static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13459                                              int *__c) {
13460  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13461                __c);
13462}
13463
13464static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13465                                              vector int *__c) {
13466  return vec_st(
13467      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13468      __b, __c);
13469}
13470
13471static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13472                                              unsigned int *__c) {
13473  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13474                __c);
13475}
13476
13477static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13478                                              vector unsigned int *__c) {
13479  return vec_st(
13480      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13481      __b, __c);
13482}
13483
13484static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13485                                              vector bool int *__c) {
13486  return vec_st(
13487      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13488      __b, __c);
13489}
13490
13491static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13492                                              vector float *__c) {
13493  return vec_st(
13494      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13495      __b, __c);
13496}
13497
13498/* vec_stvrxl */
13499
13500static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13501                                               signed char *__c) {
13502  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13503                 __c);
13504}
13505
13506static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13507                                               vector signed char *__c) {
13508  return vec_stl(
13509      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13510      __b, __c);
13511}
13512
13513static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13514                                               int __b, unsigned char *__c) {
13515  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13516                 __c);
13517}
13518
13519static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13520                                               int __b,
13521                                               vector unsigned char *__c) {
13522  return vec_stl(
13523      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13524      __b, __c);
13525}
13526
13527static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13528                                               vector bool char *__c) {
13529  return vec_stl(
13530      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13531      __b, __c);
13532}
13533
13534static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13535                                               short *__c) {
13536  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13537                 __c);
13538}
13539
13540static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13541                                               vector short *__c) {
13542  return vec_stl(
13543      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13544      __b, __c);
13545}
13546
13547static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13548                                               int __b, unsigned short *__c) {
13549  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13550                 __c);
13551}
13552
13553static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13554                                               int __b,
13555                                               vector unsigned short *__c) {
13556  return vec_stl(
13557      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13558      __b, __c);
13559}
13560
13561static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13562                                               vector bool short *__c) {
13563  return vec_stl(
13564      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13565      __b, __c);
13566}
13567
13568static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13569                                               vector pixel *__c) {
13570  return vec_stl(
13571      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13572      __b, __c);
13573}
13574
13575static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13576                                               int *__c) {
13577  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13578                 __c);
13579}
13580
13581static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13582                                               vector int *__c) {
13583  return vec_stl(
13584      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13585      __b, __c);
13586}
13587
13588static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13589                                               unsigned int *__c) {
13590  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13591                 __c);
13592}
13593
13594static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13595                                               vector unsigned int *__c) {
13596  return vec_stl(
13597      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13598      __b, __c);
13599}
13600
13601static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13602                                               vector bool int *__c) {
13603  return vec_stl(
13604      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13605      __b, __c);
13606}
13607
13608static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13609                                               vector float *__c) {
13610  return vec_stl(
13611      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13612      __b, __c);
13613}
13614
13615/* vec_promote */
13616
13617static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13618                                                              int __b) {
13619  vector signed char __res = (vector signed char)(0);
13620  __res[__b] = __a;
13621  return __res;
13622}
13623
13624static __inline__ vector unsigned char __ATTRS_o_ai
13625vec_promote(unsigned char __a, int __b) {
13626  vector unsigned char __res = (vector unsigned char)(0);
13627  __res[__b] = __a;
13628  return __res;
13629}
13630
13631static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13632  vector short __res = (vector short)(0);
13633  __res[__b] = __a;
13634  return __res;
13635}
13636
13637static __inline__ vector unsigned short __ATTRS_o_ai
13638vec_promote(unsigned short __a, int __b) {
13639  vector unsigned short __res = (vector unsigned short)(0);
13640  __res[__b] = __a;
13641  return __res;
13642}
13643
13644static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13645  vector int __res = (vector int)(0);
13646  __res[__b] = __a;
13647  return __res;
13648}
13649
13650static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13651                                                               int __b) {
13652  vector unsigned int __res = (vector unsigned int)(0);
13653  __res[__b] = __a;
13654  return __res;
13655}
13656
13657static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13658  vector float __res = (vector float)(0);
13659  __res[__b] = __a;
13660  return __res;
13661}
13662
13663/* vec_splats */
13664
13665static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13666  return (vector signed char)(__a);
13667}
13668
13669static __inline__ vector unsigned char __ATTRS_o_ai
13670vec_splats(unsigned char __a) {
13671  return (vector unsigned char)(__a);
13672}
13673
13674static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13675  return (vector short)(__a);
13676}
13677
13678static __inline__ vector unsigned short __ATTRS_o_ai
13679vec_splats(unsigned short __a) {
13680  return (vector unsigned short)(__a);
13681}
13682
13683static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13684  return (vector int)(__a);
13685}
13686
13687static __inline__ vector unsigned int __ATTRS_o_ai
13688vec_splats(unsigned int __a) {
13689  return (vector unsigned int)(__a);
13690}
13691
13692#ifdef __VSX__
13693static __inline__ vector signed long long __ATTRS_o_ai
13694vec_splats(signed long long __a) {
13695  return (vector signed long long)(__a);
13696}
13697
13698static __inline__ vector unsigned long long __ATTRS_o_ai
13699vec_splats(unsigned long long __a) {
13700  return (vector unsigned long long)(__a);
13701}
13702
13703#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13704static __inline__ vector signed __int128 __ATTRS_o_ai
13705vec_splats(signed __int128 __a) {
13706  return (vector signed __int128)(__a);
13707}
13708
13709static __inline__ vector unsigned __int128 __ATTRS_o_ai
13710vec_splats(unsigned __int128 __a) {
13711  return (vector unsigned __int128)(__a);
13712}
13713
13714#endif
13715
13716static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13717  return (vector double)(__a);
13718}
13719#endif
13720
13721static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13722  return (vector float)(__a);
13723}
13724
13725/* ----------------------------- predicates --------------------------------- */
13726
13727/* vec_all_eq */
13728
13729static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13730                                              vector signed char __b) {
13731  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13732                                      (vector char)__b);
13733}
13734
13735static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13736                                              vector bool char __b) {
13737  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13738                                      (vector char)__b);
13739}
13740
13741static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13742                                              vector unsigned char __b) {
13743  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13744                                      (vector char)__b);
13745}
13746
13747static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13748                                              vector bool char __b) {
13749  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13750                                      (vector char)__b);
13751}
13752
13753static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13754                                              vector signed char __b) {
13755  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13756                                      (vector char)__b);
13757}
13758
13759static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13760                                              vector unsigned char __b) {
13761  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13762                                      (vector char)__b);
13763}
13764
13765static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13766                                              vector bool char __b) {
13767  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13768                                      (vector char)__b);
13769}
13770
13771static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13772                                              vector short __b) {
13773  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13774}
13775
13776static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13777                                              vector bool short __b) {
13778  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13779}
13780
13781static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13782                                              vector unsigned short __b) {
13783  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13784                                      (vector short)__b);
13785}
13786
13787static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13788                                              vector bool short __b) {
13789  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13790                                      (vector short)__b);
13791}
13792
13793static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13794                                              vector short __b) {
13795  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13796                                      (vector short)__b);
13797}
13798
13799static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13800                                              vector unsigned short __b) {
13801  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13802                                      (vector short)__b);
13803}
13804
13805static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13806                                              vector bool short __b) {
13807  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13808                                      (vector short)__b);
13809}
13810
13811static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13812                                              vector pixel __b) {
13813  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13814                                      (vector short)__b);
13815}
13816
13817static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13818  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13819}
13820
13821static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13822                                              vector bool int __b) {
13823  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13824}
13825
13826static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13827                                              vector unsigned int __b) {
13828  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13829                                      (vector int)__b);
13830}
13831
13832static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13833                                              vector bool int __b) {
13834  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13835                                      (vector int)__b);
13836}
13837
13838static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13839                                              vector int __b) {
13840  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13841                                      (vector int)__b);
13842}
13843
13844static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13845                                              vector unsigned int __b) {
13846  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13847                                      (vector int)__b);
13848}
13849
13850static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13851                                              vector bool int __b) {
13852  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13853                                      (vector int)__b);
13854}
13855
13856#ifdef __POWER8_VECTOR__
13857static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13858                                              vector signed long long __b) {
13859  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13860}
13861
13862static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13863                                              vector bool long long __b) {
13864  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13865}
13866
13867static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13868                                              vector unsigned long long __b) {
13869  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13870                                      (vector long long)__b);
13871}
13872
13873static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13874                                              vector bool long long __b) {
13875  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13876                                      (vector long long)__b);
13877}
13878
13879static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13880                                              vector long long __b) {
13881  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13882                                      (vector long long)__b);
13883}
13884
13885static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13886                                              vector unsigned long long __b) {
13887  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13888                                      (vector long long)__b);
13889}
13890
13891static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13892                                              vector bool long long __b) {
13893  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13894                                      (vector long long)__b);
13895}
13896#endif
13897
13898static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13899                                              vector float __b) {
13900#ifdef __VSX__
13901  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13902#else
13903  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13904#endif
13905}
13906
13907#ifdef __VSX__
13908static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13909                                              vector double __b) {
13910  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13911}
13912#endif
13913
13914/* vec_all_ge */
13915
13916static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13917                                              vector signed char __b) {
13918  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13919}
13920
13921static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13922                                              vector bool char __b) {
13923  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13924}
13925
13926static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13927                                              vector unsigned char __b) {
13928  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13929}
13930
13931static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13932                                              vector bool char __b) {
13933  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13934}
13935
13936static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13937                                              vector signed char __b) {
13938  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13939                                      (vector unsigned char)__a);
13940}
13941
13942static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13943                                              vector unsigned char __b) {
13944  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13945}
13946
13947static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13948                                              vector bool char __b) {
13949  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13950                                      (vector unsigned char)__a);
13951}
13952
13953static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13954                                              vector short __b) {
13955  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13956}
13957
13958static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13959                                              vector bool short __b) {
13960  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13961}
13962
13963static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13964                                              vector unsigned short __b) {
13965  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13966}
13967
13968static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13969                                              vector bool short __b) {
13970  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13971                                      __a);
13972}
13973
13974static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13975                                              vector short __b) {
13976  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13977                                      (vector unsigned short)__a);
13978}
13979
13980static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13981                                              vector unsigned short __b) {
13982  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13983                                      (vector unsigned short)__a);
13984}
13985
13986static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13987                                              vector bool short __b) {
13988  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13989                                      (vector unsigned short)__a);
13990}
13991
13992static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13993  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13994}
13995
13996static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13997                                              vector bool int __b) {
13998  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13999}
14000
14001static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14002                                              vector unsigned int __b) {
14003  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
14004}
14005
14006static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14007                                              vector bool int __b) {
14008  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
14009}
14010
14011static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14012                                              vector int __b) {
14013  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14014                                      (vector unsigned int)__a);
14015}
14016
14017static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14018                                              vector unsigned int __b) {
14019  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14020}
14021
14022static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14023                                              vector bool int __b) {
14024  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14025                                      (vector unsigned int)__a);
14026}
14027
14028#ifdef __POWER8_VECTOR__
14029static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14030                                              vector signed long long __b) {
14031  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14032}
14033static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14034                                              vector bool long long __b) {
14035  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14036                                      __a);
14037}
14038
14039static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14040                                              vector unsigned long long __b) {
14041  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14042}
14043
14044static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14045                                              vector bool long long __b) {
14046  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14047                                      __a);
14048}
14049
14050static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14051                                              vector signed long long __b) {
14052  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14053                                      (vector unsigned long long)__a);
14054}
14055
14056static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14057                                              vector unsigned long long __b) {
14058  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14059                                      (vector unsigned long long)__a);
14060}
14061
14062static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14063                                              vector bool long long __b) {
14064  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14065                                      (vector unsigned long long)__a);
14066}
14067#endif
14068
14069static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14070                                              vector float __b) {
14071#ifdef __VSX__
14072  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14073#else
14074  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14075#endif
14076}
14077
14078#ifdef __VSX__
14079static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14080                                              vector double __b) {
14081  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14082}
14083#endif
14084
14085/* vec_all_gt */
14086
14087static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14088                                              vector signed char __b) {
14089  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14090}
14091
14092static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14093                                              vector bool char __b) {
14094  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14095}
14096
14097static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14098                                              vector unsigned char __b) {
14099  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14100}
14101
14102static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14103                                              vector bool char __b) {
14104  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14105}
14106
14107static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14108                                              vector signed char __b) {
14109  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14110                                      (vector unsigned char)__b);
14111}
14112
14113static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14114                                              vector unsigned char __b) {
14115  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14116}
14117
14118static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14119                                              vector bool char __b) {
14120  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14121                                      (vector unsigned char)__b);
14122}
14123
14124static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14125                                              vector short __b) {
14126  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14127}
14128
14129static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14130                                              vector bool short __b) {
14131  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14132}
14133
14134static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14135                                              vector unsigned short __b) {
14136  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14137}
14138
14139static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14140                                              vector bool short __b) {
14141  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14142                                      (vector unsigned short)__b);
14143}
14144
14145static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14146                                              vector short __b) {
14147  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14148                                      (vector unsigned short)__b);
14149}
14150
14151static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14152                                              vector unsigned short __b) {
14153  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14154                                      __b);
14155}
14156
14157static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14158                                              vector bool short __b) {
14159  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14160                                      (vector unsigned short)__b);
14161}
14162
14163static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14164  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14165}
14166
14167static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14168                                              vector bool int __b) {
14169  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14170}
14171
14172static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14173                                              vector unsigned int __b) {
14174  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14175}
14176
14177static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14178                                              vector bool int __b) {
14179  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14180}
14181
14182static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14183                                              vector int __b) {
14184  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14185                                      (vector unsigned int)__b);
14186}
14187
14188static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14189                                              vector unsigned int __b) {
14190  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14191}
14192
14193static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14194                                              vector bool int __b) {
14195  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14196                                      (vector unsigned int)__b);
14197}
14198
14199#ifdef __POWER8_VECTOR__
14200static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14201                                              vector signed long long __b) {
14202  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14203}
14204static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14205                                              vector bool long long __b) {
14206  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14207                                      (vector signed long long)__b);
14208}
14209
14210static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14211                                              vector unsigned long long __b) {
14212  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14213}
14214
14215static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14216                                              vector bool long long __b) {
14217  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14218                                      (vector unsigned long long)__b);
14219}
14220
14221static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14222                                              vector signed long long __b) {
14223  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14224                                      (vector unsigned long long)__b);
14225}
14226
14227static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14228                                              vector unsigned long long __b) {
14229  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14230                                      __b);
14231}
14232
14233static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14234                                              vector bool long long __b) {
14235  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14236                                      (vector unsigned long long)__b);
14237}
14238#endif
14239
14240static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14241                                              vector float __b) {
14242#ifdef __VSX__
14243  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14244#else
14245  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14246#endif
14247}
14248
14249#ifdef __VSX__
14250static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14251                                              vector double __b) {
14252  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14253}
14254#endif
14255
14256/* vec_all_in */
14257
14258static __inline__ int __attribute__((__always_inline__))
14259vec_all_in(vector float __a, vector float __b) {
14260  return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14261}
14262
14263/* vec_all_le */
14264
14265static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14266                                              vector signed char __b) {
14267  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14268}
14269
14270static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14271                                              vector bool char __b) {
14272  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14273}
14274
14275static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14276                                              vector unsigned char __b) {
14277  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14278}
14279
14280static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14281                                              vector bool char __b) {
14282  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14283}
14284
14285static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14286                                              vector signed char __b) {
14287  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14288                                      (vector unsigned char)__b);
14289}
14290
14291static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14292                                              vector unsigned char __b) {
14293  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14294}
14295
14296static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14297                                              vector bool char __b) {
14298  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14299                                      (vector unsigned char)__b);
14300}
14301
14302static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14303                                              vector short __b) {
14304  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14305}
14306
14307static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14308                                              vector bool short __b) {
14309  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14310}
14311
14312static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14313                                              vector unsigned short __b) {
14314  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14315}
14316
14317static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14318                                              vector bool short __b) {
14319  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14320                                      (vector unsigned short)__b);
14321}
14322
14323static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14324                                              vector short __b) {
14325  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14326                                      (vector unsigned short)__b);
14327}
14328
14329static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14330                                              vector unsigned short __b) {
14331  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14332                                      __b);
14333}
14334
14335static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14336                                              vector bool short __b) {
14337  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14338                                      (vector unsigned short)__b);
14339}
14340
14341static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14342  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14343}
14344
14345static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14346                                              vector bool int __b) {
14347  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14348}
14349
14350static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14351                                              vector unsigned int __b) {
14352  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14353}
14354
14355static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14356                                              vector bool int __b) {
14357  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14358}
14359
14360static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14361                                              vector int __b) {
14362  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14363                                      (vector unsigned int)__b);
14364}
14365
14366static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14367                                              vector unsigned int __b) {
14368  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14369}
14370
14371static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14372                                              vector bool int __b) {
14373  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14374                                      (vector unsigned int)__b);
14375}
14376
14377#ifdef __POWER8_VECTOR__
14378static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14379                                              vector signed long long __b) {
14380  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14381}
14382
14383static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14384                                              vector unsigned long long __b) {
14385  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14386}
14387
14388static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14389                                              vector bool long long __b) {
14390  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14391                                      (vector signed long long)__b);
14392}
14393
14394static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14395                                              vector bool long long __b) {
14396  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14397                                      (vector unsigned long long)__b);
14398}
14399
14400static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14401                                              vector signed long long __b) {
14402  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14403                                      (vector unsigned long long)__b);
14404}
14405
14406static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14407                                              vector unsigned long long __b) {
14408  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14409                                      __b);
14410}
14411
14412static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14413                                              vector bool long long __b) {
14414  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14415                                      (vector unsigned long long)__b);
14416}
14417#endif
14418
14419static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14420                                              vector float __b) {
14421#ifdef __VSX__
14422  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14423#else
14424  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14425#endif
14426}
14427
14428#ifdef __VSX__
14429static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14430                                              vector double __b) {
14431  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14432}
14433#endif
14434
14435/* vec_all_lt */
14436
14437static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14438                                              vector signed char __b) {
14439  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14440}
14441
14442static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14443                                              vector bool char __b) {
14444  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14445}
14446
14447static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14448                                              vector unsigned char __b) {
14449  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14450}
14451
14452static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14453                                              vector bool char __b) {
14454  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14455}
14456
14457static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14458                                              vector signed char __b) {
14459  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14460                                      (vector unsigned char)__a);
14461}
14462
14463static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14464                                              vector unsigned char __b) {
14465  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14466}
14467
14468static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14469                                              vector bool char __b) {
14470  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14471                                      (vector unsigned char)__a);
14472}
14473
14474static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14475                                              vector short __b) {
14476  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14477}
14478
14479static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14480                                              vector bool short __b) {
14481  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14482}
14483
14484static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14485                                              vector unsigned short __b) {
14486  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14487}
14488
14489static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14490                                              vector bool short __b) {
14491  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14492                                      __a);
14493}
14494
14495static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14496                                              vector short __b) {
14497  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14498                                      (vector unsigned short)__a);
14499}
14500
14501static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14502                                              vector unsigned short __b) {
14503  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14504                                      (vector unsigned short)__a);
14505}
14506
14507static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14508                                              vector bool short __b) {
14509  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14510                                      (vector unsigned short)__a);
14511}
14512
14513static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14514  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14515}
14516
14517static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14518                                              vector bool int __b) {
14519  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14520}
14521
14522static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14523                                              vector unsigned int __b) {
14524  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14525}
14526
14527static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14528                                              vector bool int __b) {
14529  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14530}
14531
14532static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14533                                              vector int __b) {
14534  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14535                                      (vector unsigned int)__a);
14536}
14537
14538static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14539                                              vector unsigned int __b) {
14540  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14541}
14542
14543static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14544                                              vector bool int __b) {
14545  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14546                                      (vector unsigned int)__a);
14547}
14548
14549#ifdef __POWER8_VECTOR__
14550static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14551                                              vector signed long long __b) {
14552  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14553}
14554
14555static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14556                                              vector unsigned long long __b) {
14557  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14558}
14559
14560static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14561                                              vector bool long long __b) {
14562  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14563                                      __a);
14564}
14565
14566static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14567                                              vector bool long long __b) {
14568  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14569                                      __a);
14570}
14571
14572static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14573                                              vector signed long long __b) {
14574  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14575                                      (vector unsigned long long)__a);
14576}
14577
14578static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14579                                              vector unsigned long long __b) {
14580  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14581                                      (vector unsigned long long)__a);
14582}
14583
14584static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14585                                              vector bool long long __b) {
14586  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14587                                      (vector unsigned long long)__a);
14588}
14589#endif
14590
14591static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14592                                              vector float __b) {
14593#ifdef __VSX__
14594  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14595#else
14596  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14597#endif
14598}
14599
14600#ifdef __VSX__
14601static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14602                                              vector double __b) {
14603  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14604}
14605#endif
14606
14607/* vec_all_nan */
14608
14609static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14610#ifdef __VSX__
14611  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14612#else
14613  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14614#endif
14615}
14616
14617#ifdef __VSX__
14618static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14619  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14620}
14621#endif
14622
14623/* vec_all_ne */
14624
14625static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14626                                              vector signed char __b) {
14627  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14628                                      (vector char)__b);
14629}
14630
14631static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14632                                              vector bool char __b) {
14633  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14634                                      (vector char)__b);
14635}
14636
14637static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14638                                              vector unsigned char __b) {
14639  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14640                                      (vector char)__b);
14641}
14642
14643static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14644                                              vector bool char __b) {
14645  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14646                                      (vector char)__b);
14647}
14648
14649static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14650                                              vector signed char __b) {
14651  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14652                                      (vector char)__b);
14653}
14654
14655static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14656                                              vector unsigned char __b) {
14657  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14658                                      (vector char)__b);
14659}
14660
14661static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14662                                              vector bool char __b) {
14663  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14664                                      (vector char)__b);
14665}
14666
14667static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14668                                              vector short __b) {
14669  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14670}
14671
14672static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14673                                              vector bool short __b) {
14674  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14675}
14676
14677static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14678                                              vector unsigned short __b) {
14679  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14680                                      (vector short)__b);
14681}
14682
14683static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14684                                              vector bool short __b) {
14685  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14686                                      (vector short)__b);
14687}
14688
14689static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14690                                              vector short __b) {
14691  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14692                                      (vector short)__b);
14693}
14694
14695static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14696                                              vector unsigned short __b) {
14697  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14698                                      (vector short)__b);
14699}
14700
14701static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14702                                              vector bool short __b) {
14703  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14704                                      (vector short)__b);
14705}
14706
14707static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
14708                                              vector pixel __b) {
14709  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14710                                      (vector short)__b);
14711}
14712
14713static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14714  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14715}
14716
14717static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14718                                              vector bool int __b) {
14719  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14720}
14721
14722static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14723                                              vector unsigned int __b) {
14724  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14725                                      (vector int)__b);
14726}
14727
14728static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14729                                              vector bool int __b) {
14730  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14731                                      (vector int)__b);
14732}
14733
14734static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14735                                              vector int __b) {
14736  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14737                                      (vector int)__b);
14738}
14739
14740static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14741                                              vector unsigned int __b) {
14742  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14743                                      (vector int)__b);
14744}
14745
14746static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14747                                              vector bool int __b) {
14748  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14749                                      (vector int)__b);
14750}
14751
14752#ifdef __POWER8_VECTOR__
14753static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14754                                              vector signed long long __b) {
14755  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14756}
14757
14758static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14759                                              vector unsigned long long __b) {
14760  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14761                                      (vector long long)__b);
14762}
14763
14764static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14765                                              vector bool long long __b) {
14766  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14767                                      (vector signed long long)__b);
14768}
14769
14770static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14771                                              vector bool long long __b) {
14772  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14773                                      (vector signed long long)__b);
14774}
14775
14776static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14777                                              vector signed long long __b) {
14778  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14779                                      (vector signed long long)__b);
14780}
14781
14782static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14783                                              vector unsigned long long __b) {
14784  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14785                                      (vector signed long long)__b);
14786}
14787
14788static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14789                                              vector bool long long __b) {
14790  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14791                                      (vector signed long long)__b);
14792}
14793#endif
14794
14795static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14796                                              vector float __b) {
14797#ifdef __VSX__
14798  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14799#else
14800  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14801#endif
14802}
14803
14804#ifdef __VSX__
14805static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14806                                              vector double __b) {
14807  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14808}
14809#endif
14810
14811/* vec_all_nge */
14812
14813static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14814                                               vector float __b) {
14815#ifdef __VSX__
14816  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14817#else
14818  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14819#endif
14820}
14821
14822#ifdef __VSX__
14823static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14824                                               vector double __b) {
14825  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14826}
14827#endif
14828
14829/* vec_all_ngt */
14830
14831static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14832                                               vector float __b) {
14833#ifdef __VSX__
14834  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14835#else
14836  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14837#endif
14838}
14839
14840#ifdef __VSX__
14841static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14842                                               vector double __b) {
14843  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14844}
14845#endif
14846
14847/* vec_all_nle */
14848
14849static __inline__ int __attribute__((__always_inline__))
14850vec_all_nle(vector float __a, vector float __b) {
14851  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14852}
14853
14854/* vec_all_nlt */
14855
14856static __inline__ int __attribute__((__always_inline__))
14857vec_all_nlt(vector float __a, vector float __b) {
14858  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14859}
14860
14861/* vec_all_numeric */
14862
14863static __inline__ int __attribute__((__always_inline__))
14864vec_all_numeric(vector float __a) {
14865  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14866}
14867
14868/* vec_any_eq */
14869
14870static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14871                                              vector signed char __b) {
14872  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14873                                      (vector char)__b);
14874}
14875
14876static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14877                                              vector bool char __b) {
14878  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14879                                      (vector char)__b);
14880}
14881
14882static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14883                                              vector unsigned char __b) {
14884  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14885                                      (vector char)__b);
14886}
14887
14888static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14889                                              vector bool char __b) {
14890  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14891                                      (vector char)__b);
14892}
14893
14894static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14895                                              vector signed char __b) {
14896  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14897                                      (vector char)__b);
14898}
14899
14900static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14901                                              vector unsigned char __b) {
14902  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14903                                      (vector char)__b);
14904}
14905
14906static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14907                                              vector bool char __b) {
14908  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14909                                      (vector char)__b);
14910}
14911
14912static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14913                                              vector short __b) {
14914  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14915}
14916
14917static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14918                                              vector bool short __b) {
14919  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14920}
14921
14922static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14923                                              vector unsigned short __b) {
14924  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14925                                      (vector short)__b);
14926}
14927
14928static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14929                                              vector bool short __b) {
14930  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14931                                      (vector short)__b);
14932}
14933
14934static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14935                                              vector short __b) {
14936  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14937                                      (vector short)__b);
14938}
14939
14940static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14941                                              vector unsigned short __b) {
14942  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14943                                      (vector short)__b);
14944}
14945
14946static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14947                                              vector bool short __b) {
14948  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14949                                      (vector short)__b);
14950}
14951
14952static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14953                                              vector pixel __b) {
14954  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14955                                      (vector short)__b);
14956}
14957
14958static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14959  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14960}
14961
14962static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14963                                              vector bool int __b) {
14964  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14965}
14966
14967static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14968                                              vector unsigned int __b) {
14969  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14970                                      (vector int)__b);
14971}
14972
14973static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14974                                              vector bool int __b) {
14975  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14976                                      (vector int)__b);
14977}
14978
14979static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14980                                              vector int __b) {
14981  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14982                                      (vector int)__b);
14983}
14984
14985static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14986                                              vector unsigned int __b) {
14987  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14988                                      (vector int)__b);
14989}
14990
14991static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14992                                              vector bool int __b) {
14993  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14994                                      (vector int)__b);
14995}
14996
14997#ifdef __POWER8_VECTOR__
14998static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14999                                              vector signed long long __b) {
15000  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
15001}
15002
15003static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15004                                              vector unsigned long long __b) {
15005  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
15006                                      (vector long long)__b);
15007}
15008
15009static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
15010                                              vector bool long long __b) {
15011  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15012                                      (vector signed long long)__b);
15013}
15014
15015static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15016                                              vector bool long long __b) {
15017  return __builtin_altivec_vcmpequd_p(
15018      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15019}
15020
15021static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15022                                              vector signed long long __b) {
15023  return __builtin_altivec_vcmpequd_p(
15024      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15025}
15026
15027static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15028                                              vector unsigned long long __b) {
15029  return __builtin_altivec_vcmpequd_p(
15030      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15031}
15032
15033static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15034                                              vector bool long long __b) {
15035  return __builtin_altivec_vcmpequd_p(
15036      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15037}
15038#endif
15039
15040static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15041                                              vector float __b) {
15042#ifdef __VSX__
15043  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15044#else
15045  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15046#endif
15047}
15048
15049#ifdef __VSX__
15050static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15051                                              vector double __b) {
15052  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15053}
15054#endif
15055
15056/* vec_any_ge */
15057
15058static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15059                                              vector signed char __b) {
15060  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15061}
15062
15063static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15064                                              vector bool char __b) {
15065  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15066                                      __a);
15067}
15068
15069static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15070                                              vector unsigned char __b) {
15071  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15072}
15073
15074static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15075                                              vector bool char __b) {
15076  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15077                                      __a);
15078}
15079
15080static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15081                                              vector signed char __b) {
15082  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15083                                      (vector unsigned char)__a);
15084}
15085
15086static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15087                                              vector unsigned char __b) {
15088  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15089                                      (vector unsigned char)__a);
15090}
15091
15092static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15093                                              vector bool char __b) {
15094  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15095                                      (vector unsigned char)__a);
15096}
15097
15098static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15099                                              vector short __b) {
15100  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15101}
15102
15103static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15104                                              vector bool short __b) {
15105  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15106}
15107
15108static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15109                                              vector unsigned short __b) {
15110  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15111}
15112
15113static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15114                                              vector bool short __b) {
15115  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15116                                      __a);
15117}
15118
15119static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15120                                              vector short __b) {
15121  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15122                                      (vector unsigned short)__a);
15123}
15124
15125static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15126                                              vector unsigned short __b) {
15127  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15128                                      (vector unsigned short)__a);
15129}
15130
15131static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15132                                              vector bool short __b) {
15133  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15134                                      (vector unsigned short)__a);
15135}
15136
15137static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15138  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15139}
15140
15141static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15142                                              vector bool int __b) {
15143  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15144}
15145
15146static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15147                                              vector unsigned int __b) {
15148  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15149}
15150
15151static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15152                                              vector bool int __b) {
15153  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15154                                      __a);
15155}
15156
15157static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15158                                              vector int __b) {
15159  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15160                                      (vector unsigned int)__a);
15161}
15162
15163static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15164                                              vector unsigned int __b) {
15165  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15166                                      (vector unsigned int)__a);
15167}
15168
15169static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15170                                              vector bool int __b) {
15171  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15172                                      (vector unsigned int)__a);
15173}
15174
15175#ifdef __POWER8_VECTOR__
15176static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15177                                              vector signed long long __b) {
15178  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15179}
15180
15181static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15182                                              vector unsigned long long __b) {
15183  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15184}
15185
15186static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15187                                              vector bool long long __b) {
15188  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15189                                      (vector signed long long)__b, __a);
15190}
15191
15192static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15193                                              vector bool long long __b) {
15194  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15195                                      (vector unsigned long long)__b, __a);
15196}
15197
15198static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15199                                              vector signed long long __b) {
15200  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15201                                      (vector unsigned long long)__b,
15202                                      (vector unsigned long long)__a);
15203}
15204
15205static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15206                                              vector unsigned long long __b) {
15207  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15208                                      (vector unsigned long long)__a);
15209}
15210
15211static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15212                                              vector bool long long __b) {
15213  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15214                                      (vector unsigned long long)__b,
15215                                      (vector unsigned long long)__a);
15216}
15217#endif
15218
15219static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15220                                              vector float __b) {
15221#ifdef __VSX__
15222  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15223#else
15224  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15225#endif
15226}
15227
15228#ifdef __VSX__
15229static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15230                                              vector double __b) {
15231  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15232}
15233#endif
15234
15235/* vec_any_gt */
15236
15237static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15238                                              vector signed char __b) {
15239  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15240}
15241
15242static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15243                                              vector bool char __b) {
15244  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15245                                      (vector signed char)__b);
15246}
15247
15248static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15249                                              vector unsigned char __b) {
15250  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15251}
15252
15253static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15254                                              vector bool char __b) {
15255  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15256                                      (vector unsigned char)__b);
15257}
15258
15259static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15260                                              vector signed char __b) {
15261  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15262                                      (vector unsigned char)__b);
15263}
15264
15265static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15266                                              vector unsigned char __b) {
15267  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15268                                      __b);
15269}
15270
15271static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15272                                              vector bool char __b) {
15273  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15274                                      (vector unsigned char)__b);
15275}
15276
15277static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15278                                              vector short __b) {
15279  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15280}
15281
15282static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15283                                              vector bool short __b) {
15284  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15285}
15286
15287static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15288                                              vector unsigned short __b) {
15289  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15290}
15291
15292static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15293                                              vector bool short __b) {
15294  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15295                                      (vector unsigned short)__b);
15296}
15297
15298static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15299                                              vector short __b) {
15300  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15301                                      (vector unsigned short)__b);
15302}
15303
15304static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15305                                              vector unsigned short __b) {
15306  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15307                                      __b);
15308}
15309
15310static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15311                                              vector bool short __b) {
15312  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15313                                      (vector unsigned short)__b);
15314}
15315
15316static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15317  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15318}
15319
15320static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15321                                              vector bool int __b) {
15322  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15323}
15324
15325static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15326                                              vector unsigned int __b) {
15327  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15328}
15329
15330static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15331                                              vector bool int __b) {
15332  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15333                                      (vector unsigned int)__b);
15334}
15335
15336static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15337                                              vector int __b) {
15338  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15339                                      (vector unsigned int)__b);
15340}
15341
15342static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15343                                              vector unsigned int __b) {
15344  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15345                                      __b);
15346}
15347
15348static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15349                                              vector bool int __b) {
15350  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15351                                      (vector unsigned int)__b);
15352}
15353
15354#ifdef __POWER8_VECTOR__
15355static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15356                                              vector signed long long __b) {
15357  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15358}
15359
15360static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15361                                              vector unsigned long long __b) {
15362  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15363}
15364
15365static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15366                                              vector bool long long __b) {
15367  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15368                                      (vector signed long long)__b);
15369}
15370
15371static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15372                                              vector bool long long __b) {
15373  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15374                                      (vector unsigned long long)__b);
15375}
15376
15377static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15378                                              vector signed long long __b) {
15379  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15380                                      (vector unsigned long long)__a,
15381                                      (vector unsigned long long)__b);
15382}
15383
15384static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15385                                              vector unsigned long long __b) {
15386  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15387                                      (vector unsigned long long)__a, __b);
15388}
15389
15390static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15391                                              vector bool long long __b) {
15392  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15393                                      (vector unsigned long long)__a,
15394                                      (vector unsigned long long)__b);
15395}
15396#endif
15397
15398static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15399                                              vector float __b) {
15400#ifdef __VSX__
15401  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15402#else
15403  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15404#endif
15405}
15406
15407#ifdef __VSX__
15408static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15409                                              vector double __b) {
15410  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15411}
15412#endif
15413
15414/* vec_any_le */
15415
15416static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15417                                              vector signed char __b) {
15418  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15419}
15420
15421static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15422                                              vector bool char __b) {
15423  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15424                                      (vector signed char)__b);
15425}
15426
15427static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15428                                              vector unsigned char __b) {
15429  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15430}
15431
15432static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15433                                              vector bool char __b) {
15434  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15435                                      (vector unsigned char)__b);
15436}
15437
15438static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15439                                              vector signed char __b) {
15440  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15441                                      (vector unsigned char)__b);
15442}
15443
15444static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15445                                              vector unsigned char __b) {
15446  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15447                                      __b);
15448}
15449
15450static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15451                                              vector bool char __b) {
15452  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15453                                      (vector unsigned char)__b);
15454}
15455
15456static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15457                                              vector short __b) {
15458  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15459}
15460
15461static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15462                                              vector bool short __b) {
15463  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15464}
15465
15466static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15467                                              vector unsigned short __b) {
15468  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15469}
15470
15471static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15472                                              vector bool short __b) {
15473  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15474                                      (vector unsigned short)__b);
15475}
15476
15477static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15478                                              vector short __b) {
15479  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15480                                      (vector unsigned short)__b);
15481}
15482
15483static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15484                                              vector unsigned short __b) {
15485  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15486                                      __b);
15487}
15488
15489static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15490                                              vector bool short __b) {
15491  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15492                                      (vector unsigned short)__b);
15493}
15494
15495static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15496  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15497}
15498
15499static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15500                                              vector bool int __b) {
15501  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15502}
15503
15504static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15505                                              vector unsigned int __b) {
15506  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15507}
15508
15509static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15510                                              vector bool int __b) {
15511  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15512                                      (vector unsigned int)__b);
15513}
15514
15515static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15516                                              vector int __b) {
15517  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15518                                      (vector unsigned int)__b);
15519}
15520
15521static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15522                                              vector unsigned int __b) {
15523  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15524                                      __b);
15525}
15526
15527static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15528                                              vector bool int __b) {
15529  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15530                                      (vector unsigned int)__b);
15531}
15532
15533#ifdef __POWER8_VECTOR__
15534static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15535                                              vector signed long long __b) {
15536  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15537}
15538
15539static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15540                                              vector unsigned long long __b) {
15541  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15542}
15543
15544static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15545                                              vector bool long long __b) {
15546  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15547                                      (vector signed long long)__b);
15548}
15549
15550static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15551                                              vector bool long long __b) {
15552  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15553                                      (vector unsigned long long)__b);
15554}
15555
15556static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15557                                              vector signed long long __b) {
15558  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15559                                      (vector unsigned long long)__a,
15560                                      (vector unsigned long long)__b);
15561}
15562
15563static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15564                                              vector unsigned long long __b) {
15565  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15566                                      (vector unsigned long long)__a, __b);
15567}
15568
15569static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15570                                              vector bool long long __b) {
15571  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15572                                      (vector unsigned long long)__a,
15573                                      (vector unsigned long long)__b);
15574}
15575#endif
15576
15577static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15578                                              vector float __b) {
15579#ifdef __VSX__
15580  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15581#else
15582  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15583#endif
15584}
15585
15586#ifdef __VSX__
15587static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15588                                              vector double __b) {
15589  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15590}
15591#endif
15592
15593/* vec_any_lt */
15594
15595static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15596                                              vector signed char __b) {
15597  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15598}
15599
15600static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15601                                              vector bool char __b) {
15602  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15603                                      __a);
15604}
15605
15606static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15607                                              vector unsigned char __b) {
15608  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15609}
15610
15611static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15612                                              vector bool char __b) {
15613  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15614                                      __a);
15615}
15616
15617static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15618                                              vector signed char __b) {
15619  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15620                                      (vector unsigned char)__a);
15621}
15622
15623static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15624                                              vector unsigned char __b) {
15625  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15626                                      (vector unsigned char)__a);
15627}
15628
15629static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15630                                              vector bool char __b) {
15631  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15632                                      (vector unsigned char)__a);
15633}
15634
15635static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15636                                              vector short __b) {
15637  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15638}
15639
15640static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15641                                              vector bool short __b) {
15642  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15643}
15644
15645static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15646                                              vector unsigned short __b) {
15647  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15648}
15649
15650static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15651                                              vector bool short __b) {
15652  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15653                                      __a);
15654}
15655
15656static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15657                                              vector short __b) {
15658  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15659                                      (vector unsigned short)__a);
15660}
15661
15662static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15663                                              vector unsigned short __b) {
15664  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15665                                      (vector unsigned short)__a);
15666}
15667
15668static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15669                                              vector bool short __b) {
15670  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15671                                      (vector unsigned short)__a);
15672}
15673
15674static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15675  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15676}
15677
15678static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15679                                              vector bool int __b) {
15680  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15681}
15682
15683static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15684                                              vector unsigned int __b) {
15685  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15686}
15687
15688static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15689                                              vector bool int __b) {
15690  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15691                                      __a);
15692}
15693
15694static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15695                                              vector int __b) {
15696  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15697                                      (vector unsigned int)__a);
15698}
15699
15700static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15701                                              vector unsigned int __b) {
15702  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15703                                      (vector unsigned int)__a);
15704}
15705
15706static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15707                                              vector bool int __b) {
15708  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15709                                      (vector unsigned int)__a);
15710}
15711
15712#ifdef __POWER8_VECTOR__
15713static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15714                                              vector signed long long __b) {
15715  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15716}
15717
15718static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15719                                              vector unsigned long long __b) {
15720  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15721}
15722
15723static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15724                                              vector bool long long __b) {
15725  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15726                                      (vector signed long long)__b, __a);
15727}
15728
15729static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15730                                              vector bool long long __b) {
15731  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15732                                      (vector unsigned long long)__b, __a);
15733}
15734
15735static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15736                                              vector signed long long __b) {
15737  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15738                                      (vector unsigned long long)__b,
15739                                      (vector unsigned long long)__a);
15740}
15741
15742static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15743                                              vector unsigned long long __b) {
15744  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15745                                      (vector unsigned long long)__a);
15746}
15747
15748static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15749                                              vector bool long long __b) {
15750  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15751                                      (vector unsigned long long)__b,
15752                                      (vector unsigned long long)__a);
15753}
15754#endif
15755
15756static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15757                                              vector float __b) {
15758#ifdef __VSX__
15759  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15760#else
15761  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15762#endif
15763}
15764
15765#ifdef __VSX__
15766static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15767                                              vector double __b) {
15768  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15769}
15770#endif
15771
15772/* vec_any_nan */
15773
15774static __inline__ int __attribute__((__always_inline__))
15775vec_any_nan(vector float __a) {
15776  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15777}
15778
15779/* vec_any_ne */
15780
15781static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15782                                              vector signed char __b) {
15783  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15784                                      (vector char)__b);
15785}
15786
15787static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15788                                              vector bool char __b) {
15789  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15790                                      (vector char)__b);
15791}
15792
15793static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15794                                              vector unsigned char __b) {
15795  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15796                                      (vector char)__b);
15797}
15798
15799static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15800                                              vector bool char __b) {
15801  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15802                                      (vector char)__b);
15803}
15804
15805static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15806                                              vector signed char __b) {
15807  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15808                                      (vector char)__b);
15809}
15810
15811static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15812                                              vector unsigned char __b) {
15813  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15814                                      (vector char)__b);
15815}
15816
15817static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15818                                              vector bool char __b) {
15819  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15820                                      (vector char)__b);
15821}
15822
15823static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15824                                              vector short __b) {
15825  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15826}
15827
15828static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15829                                              vector bool short __b) {
15830  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15831}
15832
15833static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15834                                              vector unsigned short __b) {
15835  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15836                                      (vector short)__b);
15837}
15838
15839static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15840                                              vector bool short __b) {
15841  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15842                                      (vector short)__b);
15843}
15844
15845static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15846                                              vector short __b) {
15847  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15848                                      (vector short)__b);
15849}
15850
15851static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15852                                              vector unsigned short __b) {
15853  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15854                                      (vector short)__b);
15855}
15856
15857static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15858                                              vector bool short __b) {
15859  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15860                                      (vector short)__b);
15861}
15862
15863static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15864                                              vector pixel __b) {
15865  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15866                                      (vector short)__b);
15867}
15868
15869static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15870  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15871}
15872
15873static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15874                                              vector bool int __b) {
15875  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15876}
15877
15878static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15879                                              vector unsigned int __b) {
15880  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15881                                      (vector int)__b);
15882}
15883
15884static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15885                                              vector bool int __b) {
15886  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15887                                      (vector int)__b);
15888}
15889
15890static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15891                                              vector int __b) {
15892  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15893                                      (vector int)__b);
15894}
15895
15896static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15897                                              vector unsigned int __b) {
15898  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15899                                      (vector int)__b);
15900}
15901
15902static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15903                                              vector bool int __b) {
15904  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15905                                      (vector int)__b);
15906}
15907
15908#ifdef __POWER8_VECTOR__
15909static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15910                                              vector signed long long __b) {
15911  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15912}
15913
15914static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15915                                              vector unsigned long long __b) {
15916  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15917                                      (vector long long)__b);
15918}
15919
15920static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15921                                              vector bool long long __b) {
15922  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15923                                      (vector signed long long)__b);
15924}
15925
15926static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15927                                              vector bool long long __b) {
15928  return __builtin_altivec_vcmpequd_p(
15929      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15930}
15931
15932static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15933                                              vector signed long long __b) {
15934  return __builtin_altivec_vcmpequd_p(
15935      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15936}
15937
15938static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15939                                              vector unsigned long long __b) {
15940  return __builtin_altivec_vcmpequd_p(
15941      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15942}
15943
15944static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15945                                              vector bool long long __b) {
15946  return __builtin_altivec_vcmpequd_p(
15947      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15948}
15949#endif
15950
15951static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15952                                              vector float __b) {
15953#ifdef __VSX__
15954  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15955#else
15956  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15957#endif
15958}
15959
15960#ifdef __VSX__
15961static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15962                                              vector double __b) {
15963  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15964}
15965#endif
15966
15967/* vec_any_nge */
15968
15969static __inline__ int __attribute__((__always_inline__))
15970vec_any_nge(vector float __a, vector float __b) {
15971  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15972}
15973
15974/* vec_any_ngt */
15975
15976static __inline__ int __attribute__((__always_inline__))
15977vec_any_ngt(vector float __a, vector float __b) {
15978  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15979}
15980
15981/* vec_any_nle */
15982
15983static __inline__ int __attribute__((__always_inline__))
15984vec_any_nle(vector float __a, vector float __b) {
15985  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15986}
15987
15988/* vec_any_nlt */
15989
15990static __inline__ int __attribute__((__always_inline__))
15991vec_any_nlt(vector float __a, vector float __b) {
15992  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15993}
15994
15995/* vec_any_numeric */
15996
15997static __inline__ int __attribute__((__always_inline__))
15998vec_any_numeric(vector float __a) {
15999  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
16000}
16001
16002/* vec_any_out */
16003
16004static __inline__ int __attribute__((__always_inline__))
16005vec_any_out(vector float __a, vector float __b) {
16006  return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
16007}
16008
16009/* Power 8 Crypto functions
16010Note: We diverge from the current GCC implementation with regard
16011to cryptography and related functions as follows:
16012- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16013- The remaining ones are only available on Power8 and up so
16014  require -mpower8-vector
16015The justification for this is that export requirements require that
16016Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16017support). As a result, we need to be able to turn off support for those.
16018The remaining ones (currently controlled by -mcrypto for GCC) still
16019need to be provided on compliant hardware even if Vector.Crypto is not
16020provided.
16021*/
16022#ifdef __CRYPTO__
16023#define vec_sbox_be __builtin_altivec_crypto_vsbox
16024#define vec_cipher_be __builtin_altivec_crypto_vcipher
16025#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16026#define vec_ncipher_be __builtin_altivec_crypto_vncipher
16027#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16028
16029static __inline__ vector unsigned long long __attribute__((__always_inline__))
16030__builtin_crypto_vsbox(vector unsigned long long __a) {
16031  return __builtin_altivec_crypto_vsbox(__a);
16032}
16033
16034static __inline__ vector unsigned long long __attribute__((__always_inline__))
16035__builtin_crypto_vcipher(vector unsigned long long __a,
16036                         vector unsigned long long __b) {
16037  return __builtin_altivec_crypto_vcipher(__a, __b);
16038}
16039
16040static __inline__ vector unsigned long long __attribute__((__always_inline__))
16041__builtin_crypto_vcipherlast(vector unsigned long long __a,
16042                             vector unsigned long long __b) {
16043  return __builtin_altivec_crypto_vcipherlast(__a, __b);
16044}
16045
16046static __inline__ vector unsigned long long __attribute__((__always_inline__))
16047__builtin_crypto_vncipher(vector unsigned long long __a,
16048                          vector unsigned long long __b) {
16049  return __builtin_altivec_crypto_vncipher(__a, __b);
16050}
16051
16052static __inline__ vector unsigned long long __attribute__((__always_inline__))
16053__builtin_crypto_vncipherlast(vector unsigned long long __a,
16054                              vector unsigned long long __b) {
16055  return __builtin_altivec_crypto_vncipherlast(__a, __b);
16056}
16057
16058#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16059#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16060
16061#define vec_shasigma_be(X, Y, Z)                                               \
16062  _Generic((X), vector unsigned int                                            \
16063           : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16064           : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16065#endif
16066
16067#ifdef __POWER8_VECTOR__
16068static __inline__ vector bool char __ATTRS_o_ai
16069vec_permxor(vector bool char __a, vector bool char __b,
16070            vector bool char __c) {
16071  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16072}
16073
16074static __inline__ vector signed char __ATTRS_o_ai
16075vec_permxor(vector signed char __a, vector signed char __b,
16076            vector signed char __c) {
16077  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16078}
16079
16080static __inline__ vector unsigned char __ATTRS_o_ai
16081vec_permxor(vector unsigned char __a, vector unsigned char __b,
16082            vector unsigned char __c) {
16083  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16084}
16085
16086static __inline__ vector unsigned char __ATTRS_o_ai
16087__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16088                          vector unsigned char __c) {
16089  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16090}
16091
16092static __inline__ vector unsigned short __ATTRS_o_ai
16093__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16094                          vector unsigned short __c) {
16095  return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16096      (vector unsigned char)__a, (vector unsigned char)__b,
16097      (vector unsigned char)__c);
16098}
16099
16100static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16101    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16102  return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16103      (vector unsigned char)__a, (vector unsigned char)__b,
16104      (vector unsigned char)__c);
16105}
16106
16107static __inline__ vector unsigned long long __ATTRS_o_ai
16108__builtin_crypto_vpermxor(vector unsigned long long __a,
16109                          vector unsigned long long __b,
16110                          vector unsigned long long __c) {
16111  return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16112      (vector unsigned char)__a, (vector unsigned char)__b,
16113      (vector unsigned char)__c);
16114}
16115
16116static __inline__ vector unsigned char __ATTRS_o_ai
16117__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16118  return __builtin_altivec_crypto_vpmsumb(__a, __b);
16119}
16120
16121static __inline__ vector unsigned short __ATTRS_o_ai
16122__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16123  return __builtin_altivec_crypto_vpmsumh(__a, __b);
16124}
16125
16126static __inline__ vector unsigned int __ATTRS_o_ai
16127__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16128  return __builtin_altivec_crypto_vpmsumw(__a, __b);
16129}
16130
16131static __inline__ vector unsigned long long __ATTRS_o_ai
16132__builtin_crypto_vpmsumb(vector unsigned long long __a,
16133                         vector unsigned long long __b) {
16134  return __builtin_altivec_crypto_vpmsumd(__a, __b);
16135}
16136
16137static __inline__ vector signed char __ATTRS_o_ai
16138vec_vgbbd(vector signed char __a) {
16139  return __builtin_altivec_vgbbd((vector unsigned char)__a);
16140}
16141
16142#define vec_pmsum_be __builtin_crypto_vpmsumb
16143#define vec_gb __builtin_altivec_vgbbd
16144
16145static __inline__ vector unsigned char __ATTRS_o_ai
16146vec_vgbbd(vector unsigned char __a) {
16147  return __builtin_altivec_vgbbd(__a);
16148}
16149
16150static __inline__ vector long long __ATTRS_o_ai
16151vec_vbpermq(vector signed char __a, vector signed char __b) {
16152  return __builtin_altivec_vbpermq((vector unsigned char)__a,
16153                                   (vector unsigned char)__b);
16154}
16155
16156static __inline__ vector long long __ATTRS_o_ai
16157vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16158  return __builtin_altivec_vbpermq(__a, __b);
16159}
16160
16161#ifdef __powerpc64__
16162static __inline__ vector unsigned long long __attribute__((__always_inline__))
16163vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16164  return __builtin_altivec_vbpermq((vector unsigned char)__a,
16165                                   (vector unsigned char)__b);
16166}
16167#endif
16168#endif
16169
16170
16171/* vec_reve */
16172
16173static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16174  return __builtin_shufflevector(__a, __a, 1514131211109876,
16175                                 543210);
16176}
16177
16178static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16179  return __builtin_shufflevector(__a, __a, 1514131211109876,
16180                                 543210);
16181}
16182
16183static inline __ATTRS_o_ai vector unsigned char
16184vec_reve(vector unsigned char __a) {
16185  return __builtin_shufflevector(__a, __a, 1514131211109876,
16186                                 543210);
16187}
16188
16189static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16190  return __builtin_shufflevector(__a, __a, 3210);
16191}
16192
16193static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16194  return __builtin_shufflevector(__a, __a, 3210);
16195}
16196
16197static inline __ATTRS_o_ai vector unsigned int
16198vec_reve(vector unsigned int __a) {
16199  return __builtin_shufflevector(__a, __a, 3210);
16200}
16201
16202static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16203  return __builtin_shufflevector(__a, __a, 76543210);
16204}
16205
16206static inline __ATTRS_o_ai vector signed short
16207vec_reve(vector signed short __a) {
16208  return __builtin_shufflevector(__a, __a, 76543210);
16209}
16210
16211static inline __ATTRS_o_ai vector unsigned short
16212vec_reve(vector unsigned short __a) {
16213  return __builtin_shufflevector(__a, __a, 76543210);
16214}
16215
16216static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16217  return __builtin_shufflevector(__a, __a, 3210);
16218}
16219
16220#ifdef __VSX__
16221static inline __ATTRS_o_ai vector bool long long
16222vec_reve(vector bool long long __a) {
16223  return __builtin_shufflevector(__a, __a, 10);
16224}
16225
16226static inline __ATTRS_o_ai vector signed long long
16227vec_reve(vector signed long long __a) {
16228  return __builtin_shufflevector(__a, __a, 10);
16229}
16230
16231static inline __ATTRS_o_ai vector unsigned long long
16232vec_reve(vector unsigned long long __a) {
16233  return __builtin_shufflevector(__a, __a, 10);
16234}
16235
16236static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16237  return __builtin_shufflevector(__a, __a, 10);
16238}
16239#endif
16240
16241/* vec_revb */
16242static __inline__ vector bool char __ATTRS_o_ai
16243vec_revb(vector bool char __a) {
16244  return __a;
16245}
16246
16247static __inline__ vector signed char __ATTRS_o_ai
16248vec_revb(vector signed char __a) {
16249  return __a;
16250}
16251
16252static __inline__ vector unsigned char __ATTRS_o_ai
16253vec_revb(vector unsigned char __a) {
16254  return __a;
16255}
16256
16257static __inline__ vector bool short __ATTRS_o_ai
16258vec_revb(vector bool short __a) {
16259  vector unsigned char __indices =
16260      { 1032547698111013121514 };
16261  return vec_perm(__a, __a, __indices);
16262}
16263
16264static __inline__ vector signed short __ATTRS_o_ai
16265vec_revb(vector signed short __a) {
16266  vector unsigned char __indices =
16267      { 1032547698111013121514 };
16268  return vec_perm(__a, __a, __indices);
16269}
16270
16271static __inline__ vector unsigned short __ATTRS_o_ai
16272vec_revb(vector unsigned short __a) {
16273  vector unsigned char __indices =
16274     { 1032547698111013121514 };
16275  return vec_perm(__a, __a, __indices);
16276}
16277
16278static __inline__ vector bool int __ATTRS_o_ai
16279vec_revb(vector bool int __a) {
16280  vector unsigned char __indices =
16281      { 3210765411109815141312 };
16282  return vec_perm(__a, __a, __indices);
16283}
16284
16285static __inline__ vector signed int __ATTRS_o_ai
16286vec_revb(vector signed int __a) {
16287  vector unsigned char __indices =
16288      { 3210765411109815141312 };
16289  return vec_perm(__a, __a, __indices);
16290}
16291
16292static __inline__ vector unsigned int __ATTRS_o_ai
16293vec_revb(vector unsigned int __a) {
16294  vector unsigned char __indices =
16295      { 3210765411109815141312 };
16296  return vec_perm(__a, __a, __indices);
16297}
16298
16299static __inline__ vector float __ATTRS_o_ai
16300vec_revb(vector float __a) {
16301 vector unsigned char __indices =
16302      { 3210765411109815141312 };
16303 return vec_perm(__a, __a, __indices);
16304}
16305
16306#ifdef __VSX__
16307static __inline__ vector bool long long __ATTRS_o_ai
16308vec_revb(vector bool long long __a) {
16309  vector unsigned char __indices =
16310      { 7654321015141312111098 };
16311  return vec_perm(__a, __a, __indices);
16312}
16313
16314static __inline__ vector signed long long __ATTRS_o_ai
16315vec_revb(vector signed long long __a) {
16316  vector unsigned char __indices =
16317      { 7654321015141312111098 };
16318  return vec_perm(__a, __a, __indices);
16319}
16320
16321static __inline__ vector unsigned long long __ATTRS_o_ai
16322vec_revb(vector unsigned long long __a) {
16323  vector unsigned char __indices =
16324      { 7654321015141312111098 };
16325  return vec_perm(__a, __a, __indices);
16326}
16327
16328static __inline__ vector double __ATTRS_o_ai
16329vec_revb(vector double __a) {
16330  vector unsigned char __indices =
16331      { 7654321015141312111098 };
16332  return vec_perm(__a, __a, __indices);
16333}
16334#endif /* End __VSX__ */
16335
16336#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16337static __inline__ vector signed __int128 __ATTRS_o_ai
16338vec_revb(vector signed __int128 __a) {
16339  vector unsigned char __indices =
16340      { 1514131211109876543210 };
16341  return (vector signed __int128)vec_perm((vector signed int)__a,
16342                                          (vector signed int)__a,
16343                                           __indices);
16344}
16345
16346static __inline__ vector unsigned __int128 __ATTRS_o_ai
16347vec_revb(vector unsigned __int128 __a) {
16348  vector unsigned char __indices =
16349      { 1514131211109876543210 };
16350  return (vector unsigned __int128)vec_perm((vector signed int)__a,
16351                                            (vector signed int)__a,
16352                                             __indices);
16353}
16354#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16355
16356/* vec_xl */
16357
16358typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
16359typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
16360typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
16361typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
16362typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
16363typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
16364typedef vector float unaligned_vec_float __attribute__((aligned(1)));
16365
16366static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16367                                                     signed char *__ptr) {
16368  return *(unaligned_vec_schar *)(__ptr + __offset);
16369}
16370
16371static inline __ATTRS_o_ai vector unsigned char
16372vec_xl(signed long long __offset, unsigned char *__ptr) {
16373  return *(unaligned_vec_uchar*)(__ptr + __offset);
16374}
16375
16376static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16377                                                      signed short *__ptr) {
16378  return *(unaligned_vec_sshort *)(__ptr + __offset);
16379}
16380
16381static inline __ATTRS_o_ai vector unsigned short
16382vec_xl(signed long long __offset, unsigned short *__ptr) {
16383  return *(unaligned_vec_ushort *)(__ptr + __offset);
16384}
16385
16386static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16387                                                    signed int *__ptr) {
16388  return *(unaligned_vec_sint *)(__ptr + __offset);
16389}
16390
16391static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16392                                                      unsigned int *__ptr) {
16393  return *(unaligned_vec_uint *)(__ptr + __offset);
16394}
16395
16396static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16397                                               float *__ptr) {
16398  return *(unaligned_vec_float *)(__ptr + __offset);
16399}
16400
16401#ifdef __VSX__
16402typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
16403typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
16404typedef vector double unaligned_vec_double __attribute__((aligned(1)));
16405
16406static inline __ATTRS_o_ai vector signed long long
16407vec_xl(signed long long __offset, signed long long *__ptr) {
16408  return *(unaligned_vec_sll *)(__ptr + __offset);
16409}
16410
16411static inline __ATTRS_o_ai vector unsigned long long
16412vec_xl(signed long long __offset, unsigned long long *__ptr) {
16413  return *(unaligned_vec_ull *)(__ptr + __offset);
16414}
16415
16416static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16417                                                double *__ptr) {
16418  return *(unaligned_vec_double *)(__ptr + __offset);
16419}
16420#endif
16421
16422#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16423typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
16424typedef vector unsigned __int128 unaligned_vec_ui128
16425    __attribute__((aligned(1)));
16426static inline __ATTRS_o_ai vector signed __int128
16427vec_xl(signed long long __offset, signed __int128 *__ptr) {
16428  return *(unaligned_vec_si128 *)(__ptr + __offset);
16429}
16430
16431static inline __ATTRS_o_ai vector unsigned __int128
16432vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16433  return *(unaligned_vec_ui128 *)(__ptr + __offset);
16434}
16435#endif
16436
16437/* vec_xl_be */
16438
16439#ifdef __LITTLE_ENDIAN__
16440static __inline__ vector signed char __ATTRS_o_ai
16441vec_xl_be(signed long long __offset, signed char *__ptr) {
16442  vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16443  return __builtin_shufflevector(__vec, __vec, 765432101514,
16444                                 1312111098);
16445}
16446
16447static __inline__ vector unsigned char __ATTRS_o_ai
16448vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16449  vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16450  return __builtin_shufflevector(__vec, __vec, 765432101514,
16451                                 1312111098);
16452}
16453
16454static __inline__ vector signed short  __ATTRS_o_ai
16455vec_xl_be(signed long long __offset, signed short *__ptr) {
16456  vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16457  return __builtin_shufflevector(__vec, __vec, 32107654);
16458}
16459
16460static __inline__ vector unsigned short __ATTRS_o_ai
16461vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16462  vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16463  return __builtin_shufflevector(__vec, __vec, 32107654);
16464}
16465
16466static __inline__ vector signed int __ATTRS_o_ai
16467vec_xl_be(signed long long  __offset, signed int *__ptr) {
16468  return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16469}
16470
16471static __inline__ vector unsigned int __ATTRS_o_ai
16472vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16473  return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16474}
16475
16476static __inline__ vector float __ATTRS_o_ai
16477vec_xl_be(signed long long  __offset, float *__ptr) {
16478  return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16479}
16480
16481#ifdef __VSX__
16482static __inline__ vector signed long long __ATTRS_o_ai
16483vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16484  return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16485}
16486
16487static __inline__ vector unsigned long long __ATTRS_o_ai
16488vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16489  return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16490}
16491
16492static __inline__ vector double __ATTRS_o_ai
16493vec_xl_be(signed long long  __offset, double *__ptr) {
16494  return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16495}
16496#endif
16497
16498#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16499static __inline__ vector signed __int128 __ATTRS_o_ai
16500vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16501  return vec_xl(__offset, __ptr);
16502}
16503
16504static __inline__ vector unsigned __int128 __ATTRS_o_ai
16505vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16506  return vec_xl(__offset, __ptr);
16507}
16508#endif
16509#else
16510  #define vec_xl_be vec_xl
16511#endif
16512
16513/* vec_xst */
16514
16515static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16516                                        signed long long __offset,
16517                                        signed char *__ptr) {
16518  *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
16519}
16520
16521static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16522                                        signed long long __offset,
16523                                        unsigned char *__ptr) {
16524  *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
16525}
16526
16527static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16528                                        signed long long __offset,
16529                                        signed short *__ptr) {
16530  *(unaligned_vec_sshort *)(__ptr + __offset) = __vec;
16531}
16532
16533static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
16534                                        signed long long __offset,
16535                                        unsigned short *__ptr) {
16536  *(unaligned_vec_ushort *)(__ptr + __offset) = __vec;
16537}
16538
16539static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16540                                        signed long long __offset,
16541                                        signed int *__ptr) {
16542  *(unaligned_vec_sint *)(__ptr + __offset) = __vec;
16543}
16544
16545static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16546                                        signed long long __offset,
16547                                        unsigned int *__ptr) {
16548  *(unaligned_vec_uint *)(__ptr + __offset) = __vec;
16549}
16550
16551static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16552                                        signed long long __offset,
16553                                        float *__ptr) {
16554  *(unaligned_vec_float *)(__ptr + __offset) = __vec;
16555}
16556
16557#ifdef __VSX__
16558static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16559                                        signed long long __offset,
16560                                        signed long long *__ptr) {
16561  *(unaligned_vec_sll *)(__ptr + __offset) = __vec;
16562}
16563
16564static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16565                                        signed long long __offset,
16566                                        unsigned long long *__ptr) {
16567  *(unaligned_vec_ull *)(__ptr + __offset) = __vec;
16568}
16569
16570static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16571                                        signed long long __offset,
16572                                        double *__ptr) {
16573  *(unaligned_vec_double *)(__ptr + __offset) = __vec;
16574}
16575#endif
16576
16577#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16578static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16579                                        signed long long __offset,
16580                                        signed __int128 *__ptr) {
16581  *(unaligned_vec_si128 *)(__ptr + __offset) = __vec;
16582}
16583
16584static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16585                                        signed long long __offset,
16586                                        unsigned __int128 *__ptr) {
16587  *(unaligned_vec_ui128 *)(__ptr + __offset) = __vec;
16588}
16589#endif
16590
16591/* vec_xst_be */
16592
16593#ifdef __LITTLE_ENDIAN__
16594static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16595                                               signed long long  __offset,
16596                                               signed char *__ptr) {
16597  vector signed char __tmp =
16598     __builtin_shufflevector(__vec, __vec, 765432101514,
16599                             1312111098);
16600  __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16601}
16602
16603static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16604                                               signed long long  __offset,
16605                                               unsigned char *__ptr) {
16606  vector unsigned char __tmp =
16607     __builtin_shufflevector(__vec, __vec, 765432101514,
16608                             1312111098);
16609  __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16610}
16611
16612static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16613                                               signed long long  __offset,
16614                                               signed short *__ptr) {
16615  vector signed short __tmp =
16616     __builtin_shufflevector(__vec, __vec, 32107654);
16617  __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16618}
16619
16620static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16621                                               signed long long  __offset,
16622                                               unsigned short *__ptr) {
16623  vector unsigned short __tmp =
16624     __builtin_shufflevector(__vec, __vec, 32107654);
16625  __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16626}
16627
16628static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16629                                               signed long long  __offset,
16630                                               signed int *__ptr) {
16631  __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16632}
16633
16634static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16635                                               signed long long  __offset,
16636                                               unsigned int *__ptr) {
16637  __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16638}
16639
16640static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16641                                               signed long long  __offset,
16642                                               float *__ptr) {
16643  __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16644}
16645
16646#ifdef __VSX__
16647static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16648                                               signed long long  __offset,
16649                                               signed long long *__ptr) {
16650  __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16651}
16652
16653static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16654                                               signed long long  __offset,
16655                                               unsigned long long *__ptr) {
16656  __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16657}
16658
16659static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16660                                               signed long long  __offset,
16661                                               double *__ptr) {
16662  __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16663}
16664#endif
16665
16666#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16667static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16668                                               signed long long  __offset,
16669                                               signed __int128 *__ptr) {
16670  vec_xst(__vec, __offset, __ptr);
16671}
16672
16673static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16674                                               signed long long  __offset,
16675                                               unsigned __int128 *__ptr) {
16676  vec_xst(__vec, __offset, __ptr);
16677}
16678#endif
16679#else
16680  #define vec_xst_be vec_xst
16681#endif
16682
16683#ifdef __POWER9_VECTOR__
16684#define vec_test_data_class(__a, __b)                                      \
16685        _Generic((__a),                                                    \
16686           vector float:                                                   \
16687             (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)),       \
16688           vector double:                                                  \
16689             (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b))  \
16690        )
16691
16692#endif /* #ifdef __POWER9_VECTOR__ */
16693
16694static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16695  return -__a;
16696}
16697
16698#ifdef __VSX__
16699static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16700  return -__a;
16701}
16702
16703#endif
16704
16705#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16706static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16707  return -__a;
16708}
16709#endif
16710
16711static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16712  return -__a;
16713}
16714
16715static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16716  return -__a;
16717}
16718
16719static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16720  return -__a;
16721}
16722
16723static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16724  return - vec_abs(__a);
16725}
16726
16727#ifdef __VSX__
16728static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16729  return - vec_abs(__a);
16730}
16731
16732#endif
16733
16734#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16735static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16736  return __builtin_altivec_vminsd(__a, -__a);
16737}
16738#endif
16739
16740static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16741  return __builtin_altivec_vminsw(__a, -__a);
16742}
16743
16744static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16745  return __builtin_altivec_vminsh(__a, -__a);
16746}
16747
16748static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16749  return __builtin_altivec_vminsb(__a, -__a);
16750}
16751#undef __ATTRS_o_ai
16752
16753#endif /* __ALTIVEC_H */
16754