1/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7\*===----------------------------------------------------------------------===*/
8
9#ifndef __ALTIVEC_H
10#define __ALTIVEC_H
11
12#ifndef __ALTIVEC__
13#error "AltiVec support not enabled"
14#endif
15
16/* Constants for mapping CR6 bits to predicate result. */
17
18#define __CR6_EQ 0
19#define __CR6_EQ_REV 1
20#define __CR6_LT 2
21#define __CR6_LT_REV 3
22
23/* Constants for vec_test_data_class */
24#define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
25#define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
26#define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
27                                  __VEC_CLASS_FP_SUBNORMAL_N)
28#define __VEC_CLASS_FP_ZERO_N (1<<2)
29#define __VEC_CLASS_FP_ZERO_P (1<<3)
30#define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P           | \
31                             __VEC_CLASS_FP_ZERO_N)
32#define __VEC_CLASS_FP_INFINITY_N (1<<4)
33#define __VEC_CLASS_FP_INFINITY_P (1<<5)
34#define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P   | \
35                                 __VEC_CLASS_FP_INFINITY_N)
36#define __VEC_CLASS_FP_NAN (1<<6)
37#define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN        | \
38                                   __VEC_CLASS_FP_SUBNORMAL  | \
39                                   __VEC_CLASS_FP_ZERO       | \
40                                   __VEC_CLASS_FP_INFINITY)
41
42#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
43
44#ifdef __POWER9_VECTOR__
45#include <stddef.h>
46#endif
47
48static __inline__ vector signed char __ATTRS_o_ai vec_perm(
49    vector signed char __a, vector signed char __b, vector unsigned char __c);
50
51static __inline__ vector unsigned char __ATTRS_o_ai
52vec_perm(vector unsigned char __a, vector unsigned char __b,
53         vector unsigned char __c);
54
55static __inline__ vector bool char __ATTRS_o_ai
56vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
57
58static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
59                                                     vector signed short __b,
60                                                     vector unsigned char __c);
61
62static __inline__ vector unsigned short __ATTRS_o_ai
63vec_perm(vector unsigned short __a, vector unsigned short __b,
64         vector unsigned char __c);
65
66static __inline__ vector bool short __ATTRS_o_ai vec_perm(
67    vector bool short __a, vector bool short __b, vector unsigned char __c);
68
69static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
70                                                     vector pixel __b,
71                                                     vector unsigned char __c);
72
73static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
74                                                   vector signed int __b,
75                                                   vector unsigned char __c);
76
77static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
78    vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
79
80static __inline__ vector bool int __ATTRS_o_ai
81vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
82
83static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
84                                                     vector float __b,
85                                                     vector unsigned char __c);
86
87#ifdef __VSX__
88static __inline__ vector long long __ATTRS_o_ai
89vec_perm(vector signed long long __a, vector signed long long __b,
90         vector unsigned char __c);
91
92static __inline__ vector unsigned long long __ATTRS_o_ai
93vec_perm(vector unsigned long long __a, vector unsigned long long __b,
94         vector unsigned char __c);
95
96static __inline__ vector bool long long __ATTRS_o_ai
97vec_perm(vector bool long long __a, vector bool long long __b,
98         vector unsigned char __c);
99
100static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
101                                                      vector double __b,
102                                                      vector unsigned char __c);
103#endif
104
105static __inline__ vector unsigned char __ATTRS_o_ai
106vec_xor(vector unsigned char __a, vector unsigned char __b);
107
108/* vec_abs */
109
110#define __builtin_altivec_abs_v16qi vec_abs
111#define __builtin_altivec_abs_v8hi vec_abs
112#define __builtin_altivec_abs_v4si vec_abs
113
114static __inline__ vector signed char __ATTRS_o_ai
115vec_abs(vector signed char __a) {
116  return __builtin_altivec_vmaxsb(__a, -__a);
117}
118
119static __inline__ vector signed short __ATTRS_o_ai
120vec_abs(vector signed short __a) {
121  return __builtin_altivec_vmaxsh(__a, -__a);
122}
123
124static __inline__ vector signed int __ATTRS_o_ai
125vec_abs(vector signed int __a) {
126  return __builtin_altivec_vmaxsw(__a, -__a);
127}
128
129#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
130static __inline__ vector signed long long __ATTRS_o_ai
131vec_abs(vector signed long long __a) {
132  return __builtin_altivec_vmaxsd(__a, -__a);
133}
134#endif
135
136static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
137#ifdef __VSX__
138  return __builtin_vsx_xvabssp(__a);
139#else
140  vector unsigned int __res =
141      (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
142  return (vector float)__res;
143#endif
144}
145
146#ifdef __VSX__
147static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
148  return __builtin_vsx_xvabsdp(__a);
149}
150#endif
151
152/* vec_abss */
153#define __builtin_altivec_abss_v16qi vec_abss
154#define __builtin_altivec_abss_v8hi vec_abss
155#define __builtin_altivec_abss_v4si vec_abss
156
157static __inline__ vector signed char __ATTRS_o_ai
158vec_abss(vector signed char __a) {
159  return __builtin_altivec_vmaxsb(
160      __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
161}
162
163static __inline__ vector signed short __ATTRS_o_ai
164vec_abss(vector signed short __a) {
165  return __builtin_altivec_vmaxsh(
166      __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
167}
168
169static __inline__ vector signed int __ATTRS_o_ai
170vec_abss(vector signed int __a) {
171  return __builtin_altivec_vmaxsw(
172      __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
173}
174
175/* vec_absd */
176#if defined(__POWER9_VECTOR__)
177
178static __inline__ vector unsigned char __ATTRS_o_ai
179vec_absd(vector unsigned char __a, vector unsigned char __b) {
180  return __builtin_altivec_vabsdub(__a, __b);
181}
182
183static __inline__ vector unsigned short __ATTRS_o_ai
184vec_absd(vector unsigned short __a, vector unsigned short __b) {
185  return __builtin_altivec_vabsduh(__a, __b);
186}
187
188static __inline__ vector unsigned int __ATTRS_o_ai
189vec_absd(vector unsigned int __a,  vector unsigned int __b) {
190  return __builtin_altivec_vabsduw(__a, __b);
191}
192
193#endif /* End __POWER9_VECTOR__ */
194
195/* vec_add */
196
197static __inline__ vector signed char __ATTRS_o_ai
198vec_add(vector signed char __a, vector signed char __b) {
199  return __a + __b;
200}
201
202static __inline__ vector signed char __ATTRS_o_ai
203vec_add(vector bool char __a, vector signed char __b) {
204  return (vector signed char)__a + __b;
205}
206
207static __inline__ vector signed char __ATTRS_o_ai
208vec_add(vector signed char __a, vector bool char __b) {
209  return __a + (vector signed char)__b;
210}
211
212static __inline__ vector unsigned char __ATTRS_o_ai
213vec_add(vector unsigned char __a, vector unsigned char __b) {
214  return __a + __b;
215}
216
217static __inline__ vector unsigned char __ATTRS_o_ai
218vec_add(vector bool char __a, vector unsigned char __b) {
219  return (vector unsigned char)__a + __b;
220}
221
222static __inline__ vector unsigned char __ATTRS_o_ai
223vec_add(vector unsigned char __a, vector bool char __b) {
224  return __a + (vector unsigned char)__b;
225}
226
227static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
228                                                    vector short __b) {
229  return __a + __b;
230}
231
232static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
233                                                    vector short __b) {
234  return (vector short)__a + __b;
235}
236
237static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
238                                                    vector bool short __b) {
239  return __a + (vector short)__b;
240}
241
242static __inline__ vector unsigned short __ATTRS_o_ai
243vec_add(vector unsigned short __a, vector unsigned short __b) {
244  return __a + __b;
245}
246
247static __inline__ vector unsigned short __ATTRS_o_ai
248vec_add(vector bool short __a, vector unsigned short __b) {
249  return (vector unsigned short)__a + __b;
250}
251
252static __inline__ vector unsigned short __ATTRS_o_ai
253vec_add(vector unsigned short __a, vector bool short __b) {
254  return __a + (vector unsigned short)__b;
255}
256
257static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
258                                                  vector int __b) {
259  return __a + __b;
260}
261
262static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
263                                                  vector int __b) {
264  return (vector int)__a + __b;
265}
266
267static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
268                                                  vector bool int __b) {
269  return __a + (vector int)__b;
270}
271
272static __inline__ vector unsigned int __ATTRS_o_ai
273vec_add(vector unsigned int __a, vector unsigned int __b) {
274  return __a + __b;
275}
276
277static __inline__ vector unsigned int __ATTRS_o_ai
278vec_add(vector bool int __a, vector unsigned int __b) {
279  return (vector unsigned int)__a + __b;
280}
281
282static __inline__ vector unsigned int __ATTRS_o_ai
283vec_add(vector unsigned int __a, vector bool int __b) {
284  return __a + (vector unsigned int)__b;
285}
286
287#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
288static __inline__ vector signed long long __ATTRS_o_ai
289vec_add(vector signed long long __a, vector signed long long __b) {
290  return __a + __b;
291}
292
293static __inline__ vector unsigned long long __ATTRS_o_ai
294vec_add(vector unsigned long long __a, vector unsigned long long __b) {
295  return __a + __b;
296}
297
298static __inline__ vector signed __int128 __ATTRS_o_ai
299vec_add(vector signed __int128 __a, vector signed __int128 __b) {
300  return __a + __b;
301}
302
303static __inline__ vector unsigned __int128 __ATTRS_o_ai
304vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
305  return __a + __b;
306}
307#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
308
309static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
310                                                    vector float __b) {
311  return __a + __b;
312}
313
314#ifdef __VSX__
315static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
316                                                     vector double __b) {
317  return __a + __b;
318}
319#endif // __VSX__
320
321/* vec_adde */
322
323#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
324static __inline__ vector signed __int128 __ATTRS_o_ai
325vec_adde(vector signed __int128 __a, vector signed __int128 __b,
326         vector signed __int128 __c) {
327  return __builtin_altivec_vaddeuqm(__a, __b, __c);
328}
329
330static __inline__ vector unsigned __int128 __ATTRS_o_ai
331vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
332         vector unsigned __int128 __c) {
333  return __builtin_altivec_vaddeuqm(__a, __b, __c);
334}
335#endif
336
337static __inline__ vector signed int __ATTRS_o_ai
338vec_adde(vector signed int __a, vector signed int __b,
339         vector signed int __c) {
340  vector signed int __mask = {1, 1, 1, 1};
341  vector signed int __carry = __c & __mask;
342  return vec_add(vec_add(__a, __b), __carry);
343}
344
345static __inline__ vector unsigned int __ATTRS_o_ai
346vec_adde(vector unsigned int __a, vector unsigned int __b,
347         vector unsigned int __c) {
348  vector unsigned int __mask = {1, 1, 1, 1};
349  vector unsigned int __carry = __c & __mask;
350  return vec_add(vec_add(__a, __b), __carry);
351}
352
353/* vec_addec */
354
355#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
356static __inline__ vector signed __int128 __ATTRS_o_ai
357vec_addec(vector signed __int128 __a, vector signed __int128 __b,
358          vector signed __int128 __c) {
359  return __builtin_altivec_vaddecuq(__a, __b, __c);
360}
361
362static __inline__ vector unsigned __int128 __ATTRS_o_ai
363vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
364          vector unsigned __int128 __c) {
365  return __builtin_altivec_vaddecuq(__a, __b, __c);
366}
367
368static __inline__ vector signed int __ATTRS_o_ai
369vec_addec(vector signed int __a, vector signed int __b,
370          vector signed int __c) {
371
372  signed int __result[4];
373  for (int i = 0; i < 4; i++) {
374    unsigned int __tempa = (unsigned int) __a[i];
375    unsigned int __tempb = (unsigned int) __b[i];
376    unsigned int __tempc = (unsigned int) __c[i];
377    __tempc = __tempc & 0x00000001;
378    unsigned long long __longa = (unsigned long long) __tempa;
379    unsigned long long __longb = (unsigned long long) __tempb;
380    unsigned long long __longc = (unsigned long long) __tempc;
381    unsigned long long __sum = __longa + __longb + __longc;
382    unsigned long long __res = (__sum >> 32) & 0x01;
383    unsigned long long __tempres = (unsigned int) __res;
384    __result[i] = (signed int) __tempres;
385  }
386
387  vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
388  return ret;
389}
390
391static __inline__ vector unsigned int __ATTRS_o_ai
392vec_addec(vector unsigned int __a, vector unsigned int __b,
393          vector unsigned int __c) {
394
395  unsigned int __result[4];
396  for (int i = 0; i < 4; i++) {
397    unsigned int __tempc = __c[i] & 1;
398    unsigned long long __longa = (unsigned long long) __a[i];
399    unsigned long long __longb = (unsigned long long) __b[i];
400    unsigned long long __longc = (unsigned long long) __tempc;
401    unsigned long long __sum = __longa + __longb + __longc;
402    unsigned long long __res = (__sum >> 32) & 0x01;
403    unsigned long long __tempres = (unsigned int) __res;
404    __result[i] = (signed int) __tempres;
405  }
406
407  vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
408  return ret;
409}
410
411#endif
412
413/* vec_vaddubm */
414
415#define __builtin_altivec_vaddubm vec_vaddubm
416
417static __inline__ vector signed char __ATTRS_o_ai
418vec_vaddubm(vector signed char __a, vector signed char __b) {
419  return __a + __b;
420}
421
422static __inline__ vector signed char __ATTRS_o_ai
423vec_vaddubm(vector bool char __a, vector signed char __b) {
424  return (vector signed char)__a + __b;
425}
426
427static __inline__ vector signed char __ATTRS_o_ai
428vec_vaddubm(vector signed char __a, vector bool char __b) {
429  return __a + (vector signed char)__b;
430}
431
432static __inline__ vector unsigned char __ATTRS_o_ai
433vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
434  return __a + __b;
435}
436
437static __inline__ vector unsigned char __ATTRS_o_ai
438vec_vaddubm(vector bool char __a, vector unsigned char __b) {
439  return (vector unsigned char)__a + __b;
440}
441
442static __inline__ vector unsigned char __ATTRS_o_ai
443vec_vaddubm(vector unsigned char __a, vector bool char __b) {
444  return __a + (vector unsigned char)__b;
445}
446
447/* vec_vadduhm */
448
449#define __builtin_altivec_vadduhm vec_vadduhm
450
451static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
452                                                        vector short __b) {
453  return __a + __b;
454}
455
456static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
457                                                        vector short __b) {
458  return (vector short)__a + __b;
459}
460
461static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
462                                                        vector bool short __b) {
463  return __a + (vector short)__b;
464}
465
466static __inline__ vector unsigned short __ATTRS_o_ai
467vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
468  return __a + __b;
469}
470
471static __inline__ vector unsigned short __ATTRS_o_ai
472vec_vadduhm(vector bool short __a, vector unsigned short __b) {
473  return (vector unsigned short)__a + __b;
474}
475
476static __inline__ vector unsigned short __ATTRS_o_ai
477vec_vadduhm(vector unsigned short __a, vector bool short __b) {
478  return __a + (vector unsigned short)__b;
479}
480
481/* vec_vadduwm */
482
483#define __builtin_altivec_vadduwm vec_vadduwm
484
485static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
486                                                      vector int __b) {
487  return __a + __b;
488}
489
490static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
491                                                      vector int __b) {
492  return (vector int)__a + __b;
493}
494
495static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
496                                                      vector bool int __b) {
497  return __a + (vector int)__b;
498}
499
500static __inline__ vector unsigned int __ATTRS_o_ai
501vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
502  return __a + __b;
503}
504
505static __inline__ vector unsigned int __ATTRS_o_ai
506vec_vadduwm(vector bool int __a, vector unsigned int __b) {
507  return (vector unsigned int)__a + __b;
508}
509
510static __inline__ vector unsigned int __ATTRS_o_ai
511vec_vadduwm(vector unsigned int __a, vector bool int __b) {
512  return __a + (vector unsigned int)__b;
513}
514
515/* vec_vaddfp */
516
517#define __builtin_altivec_vaddfp vec_vaddfp
518
519static __inline__ vector float __attribute__((__always_inline__))
520vec_vaddfp(vector float __a, vector float __b) {
521  return __a + __b;
522}
523
524/* vec_addc */
525
526static __inline__ vector signed int __ATTRS_o_ai
527vec_addc(vector signed int __a, vector signed int __b) {
528  return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
529                                                      (vector unsigned int)__b);
530}
531
532static __inline__ vector unsigned int __ATTRS_o_ai
533vec_addc(vector unsigned int __a, vector unsigned int __b) {
534  return __builtin_altivec_vaddcuw(__a, __b);
535}
536
537#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
538static __inline__ vector signed __int128 __ATTRS_o_ai
539vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
540  return (vector signed __int128)__builtin_altivec_vaddcuq(
541      (vector unsigned __int128)__a, (vector unsigned __int128)__b);
542}
543
544static __inline__ vector unsigned __int128 __ATTRS_o_ai
545vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
546  return __builtin_altivec_vaddcuq(__a, __b);
547}
548#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
549
550/* vec_vaddcuw */
551
552static __inline__ vector unsigned int __attribute__((__always_inline__))
553vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
554  return __builtin_altivec_vaddcuw(__a, __b);
555}
556
557/* vec_adds */
558
559static __inline__ vector signed char __ATTRS_o_ai
560vec_adds(vector signed char __a, vector signed char __b) {
561  return __builtin_altivec_vaddsbs(__a, __b);
562}
563
564static __inline__ vector signed char __ATTRS_o_ai
565vec_adds(vector bool char __a, vector signed char __b) {
566  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
567}
568
569static __inline__ vector signed char __ATTRS_o_ai
570vec_adds(vector signed char __a, vector bool char __b) {
571  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
572}
573
574static __inline__ vector unsigned char __ATTRS_o_ai
575vec_adds(vector unsigned char __a, vector unsigned char __b) {
576  return __builtin_altivec_vaddubs(__a, __b);
577}
578
579static __inline__ vector unsigned char __ATTRS_o_ai
580vec_adds(vector bool char __a, vector unsigned char __b) {
581  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
582}
583
584static __inline__ vector unsigned char __ATTRS_o_ai
585vec_adds(vector unsigned char __a, vector bool char __b) {
586  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
587}
588
589static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
590                                                     vector short __b) {
591  return __builtin_altivec_vaddshs(__a, __b);
592}
593
594static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
595                                                     vector short __b) {
596  return __builtin_altivec_vaddshs((vector short)__a, __b);
597}
598
599static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
600                                                     vector bool short __b) {
601  return __builtin_altivec_vaddshs(__a, (vector short)__b);
602}
603
604static __inline__ vector unsigned short __ATTRS_o_ai
605vec_adds(vector unsigned short __a, vector unsigned short __b) {
606  return __builtin_altivec_vadduhs(__a, __b);
607}
608
609static __inline__ vector unsigned short __ATTRS_o_ai
610vec_adds(vector bool short __a, vector unsigned short __b) {
611  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
612}
613
614static __inline__ vector unsigned short __ATTRS_o_ai
615vec_adds(vector unsigned short __a, vector bool short __b) {
616  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
617}
618
619static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
620                                                   vector int __b) {
621  return __builtin_altivec_vaddsws(__a, __b);
622}
623
624static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
625                                                   vector int __b) {
626  return __builtin_altivec_vaddsws((vector int)__a, __b);
627}
628
629static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
630                                                   vector bool int __b) {
631  return __builtin_altivec_vaddsws(__a, (vector int)__b);
632}
633
634static __inline__ vector unsigned int __ATTRS_o_ai
635vec_adds(vector unsigned int __a, vector unsigned int __b) {
636  return __builtin_altivec_vadduws(__a, __b);
637}
638
639static __inline__ vector unsigned int __ATTRS_o_ai
640vec_adds(vector bool int __a, vector unsigned int __b) {
641  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
642}
643
644static __inline__ vector unsigned int __ATTRS_o_ai
645vec_adds(vector unsigned int __a, vector bool int __b) {
646  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
647}
648
649/* vec_vaddsbs */
650
651static __inline__ vector signed char __ATTRS_o_ai
652vec_vaddsbs(vector signed char __a, vector signed char __b) {
653  return __builtin_altivec_vaddsbs(__a, __b);
654}
655
656static __inline__ vector signed char __ATTRS_o_ai
657vec_vaddsbs(vector bool char __a, vector signed char __b) {
658  return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
659}
660
661static __inline__ vector signed char __ATTRS_o_ai
662vec_vaddsbs(vector signed char __a, vector bool char __b) {
663  return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
664}
665
666/* vec_vaddubs */
667
668static __inline__ vector unsigned char __ATTRS_o_ai
669vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
670  return __builtin_altivec_vaddubs(__a, __b);
671}
672
673static __inline__ vector unsigned char __ATTRS_o_ai
674vec_vaddubs(vector bool char __a, vector unsigned char __b) {
675  return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
676}
677
678static __inline__ vector unsigned char __ATTRS_o_ai
679vec_vaddubs(vector unsigned char __a, vector bool char __b) {
680  return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
681}
682
683/* vec_vaddshs */
684
685static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
686                                                        vector short __b) {
687  return __builtin_altivec_vaddshs(__a, __b);
688}
689
690static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
691                                                        vector short __b) {
692  return __builtin_altivec_vaddshs((vector short)__a, __b);
693}
694
695static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
696                                                        vector bool short __b) {
697  return __builtin_altivec_vaddshs(__a, (vector short)__b);
698}
699
700/* vec_vadduhs */
701
702static __inline__ vector unsigned short __ATTRS_o_ai
703vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
704  return __builtin_altivec_vadduhs(__a, __b);
705}
706
707static __inline__ vector unsigned short __ATTRS_o_ai
708vec_vadduhs(vector bool short __a, vector unsigned short __b) {
709  return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
710}
711
712static __inline__ vector unsigned short __ATTRS_o_ai
713vec_vadduhs(vector unsigned short __a, vector bool short __b) {
714  return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
715}
716
717/* vec_vaddsws */
718
719static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
720                                                      vector int __b) {
721  return __builtin_altivec_vaddsws(__a, __b);
722}
723
724static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
725                                                      vector int __b) {
726  return __builtin_altivec_vaddsws((vector int)__a, __b);
727}
728
729static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
730                                                      vector bool int __b) {
731  return __builtin_altivec_vaddsws(__a, (vector int)__b);
732}
733
734/* vec_vadduws */
735
736static __inline__ vector unsigned int __ATTRS_o_ai
737vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
738  return __builtin_altivec_vadduws(__a, __b);
739}
740
741static __inline__ vector unsigned int __ATTRS_o_ai
742vec_vadduws(vector bool int __a, vector unsigned int __b) {
743  return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
744}
745
746static __inline__ vector unsigned int __ATTRS_o_ai
747vec_vadduws(vector unsigned int __a, vector bool int __b) {
748  return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
749}
750
751#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
752/* vec_vadduqm */
753
754static __inline__ vector signed __int128 __ATTRS_o_ai
755vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
756  return __a + __b;
757}
758
759static __inline__ vector unsigned __int128 __ATTRS_o_ai
760vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
761  return __a + __b;
762}
763
764/* vec_vaddeuqm */
765
766static __inline__ vector signed __int128 __ATTRS_o_ai
767vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
768             vector signed __int128 __c) {
769  return __builtin_altivec_vaddeuqm(__a, __b, __c);
770}
771
772static __inline__ vector unsigned __int128 __ATTRS_o_ai
773vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
774             vector unsigned __int128 __c) {
775  return __builtin_altivec_vaddeuqm(__a, __b, __c);
776}
777
778/* vec_vaddcuq */
779
780static __inline__ vector signed __int128 __ATTRS_o_ai
781vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
782  return __builtin_altivec_vaddcuq(__a, __b);
783}
784
785static __inline__ vector unsigned __int128 __ATTRS_o_ai
786vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
787  return __builtin_altivec_vaddcuq(__a, __b);
788}
789
790/* vec_vaddecuq */
791
792static __inline__ vector signed __int128 __ATTRS_o_ai
793vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
794             vector signed __int128 __c) {
795  return __builtin_altivec_vaddecuq(__a, __b, __c);
796}
797
798static __inline__ vector unsigned __int128 __ATTRS_o_ai
799vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
800             vector unsigned __int128 __c) {
801  return __builtin_altivec_vaddecuq(__a, __b, __c);
802}
803#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
804
805/* vec_and */
806
807#define __builtin_altivec_vand vec_and
808
809static __inline__ vector signed char __ATTRS_o_ai
810vec_and(vector signed char __a, vector signed char __b) {
811  return __a & __b;
812}
813
814static __inline__ vector signed char __ATTRS_o_ai
815vec_and(vector bool char __a, vector signed char __b) {
816  return (vector signed char)__a & __b;
817}
818
819static __inline__ vector signed char __ATTRS_o_ai
820vec_and(vector signed char __a, vector bool char __b) {
821  return __a & (vector signed char)__b;
822}
823
824static __inline__ vector unsigned char __ATTRS_o_ai
825vec_and(vector unsigned char __a, vector unsigned char __b) {
826  return __a & __b;
827}
828
829static __inline__ vector unsigned char __ATTRS_o_ai
830vec_and(vector bool char __a, vector unsigned char __b) {
831  return (vector unsigned char)__a & __b;
832}
833
834static __inline__ vector unsigned char __ATTRS_o_ai
835vec_and(vector unsigned char __a, vector bool char __b) {
836  return __a & (vector unsigned char)__b;
837}
838
839static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
840                                                        vector bool char __b) {
841  return __a & __b;
842}
843
844static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
845                                                    vector short __b) {
846  return __a & __b;
847}
848
849static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
850                                                    vector short __b) {
851  return (vector short)__a & __b;
852}
853
854static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
855                                                    vector bool short __b) {
856  return __a & (vector short)__b;
857}
858
859static __inline__ vector unsigned short __ATTRS_o_ai
860vec_and(vector unsigned short __a, vector unsigned short __b) {
861  return __a & __b;
862}
863
864static __inline__ vector unsigned short __ATTRS_o_ai
865vec_and(vector bool short __a, vector unsigned short __b) {
866  return (vector unsigned short)__a & __b;
867}
868
869static __inline__ vector unsigned short __ATTRS_o_ai
870vec_and(vector unsigned short __a, vector bool short __b) {
871  return __a & (vector unsigned short)__b;
872}
873
874static __inline__ vector bool short __ATTRS_o_ai
875vec_and(vector bool short __a, vector bool short __b) {
876  return __a & __b;
877}
878
879static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
880                                                  vector int __b) {
881  return __a & __b;
882}
883
884static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
885                                                  vector int __b) {
886  return (vector int)__a & __b;
887}
888
889static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
890                                                  vector bool int __b) {
891  return __a & (vector int)__b;
892}
893
894static __inline__ vector unsigned int __ATTRS_o_ai
895vec_and(vector unsigned int __a, vector unsigned int __b) {
896  return __a & __b;
897}
898
899static __inline__ vector unsigned int __ATTRS_o_ai
900vec_and(vector bool int __a, vector unsigned int __b) {
901  return (vector unsigned int)__a & __b;
902}
903
904static __inline__ vector unsigned int __ATTRS_o_ai
905vec_and(vector unsigned int __a, vector bool int __b) {
906  return __a & (vector unsigned int)__b;
907}
908
909static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
910                                                       vector bool int __b) {
911  return __a & __b;
912}
913
914static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
915                                                    vector float __b) {
916  vector unsigned int __res =
917      (vector unsigned int)__a & (vector unsigned int)__b;
918  return (vector float)__res;
919}
920
921static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
922                                                    vector float __b) {
923  vector unsigned int __res =
924      (vector unsigned int)__a & (vector unsigned int)__b;
925  return (vector float)__res;
926}
927
928static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
929                                                    vector bool int __b) {
930  vector unsigned int __res =
931      (vector unsigned int)__a & (vector unsigned int)__b;
932  return (vector float)__res;
933}
934
935#ifdef __VSX__
936static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
937                                                     vector double __b) {
938  vector unsigned long long __res =
939      (vector unsigned long long)__a & (vector unsigned long long)__b;
940  return (vector double)__res;
941}
942
943static __inline__ vector double __ATTRS_o_ai
944vec_and(vector double __a, vector bool long long __b) {
945  vector unsigned long long __res =
946      (vector unsigned long long)__a & (vector unsigned long long)__b;
947  return (vector double)__res;
948}
949
950static __inline__ vector double __ATTRS_o_ai vec_and(vector double __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 signed long long __ATTRS_o_ai
958vec_and(vector signed long long __a, vector signed long long __b) {
959  return __a & __b;
960}
961
962static __inline__ vector signed long long __ATTRS_o_ai
963vec_and(vector bool long long __a, vector signed long long __b) {
964  return (vector signed long long)__a & __b;
965}
966
967static __inline__ vector signed long long __ATTRS_o_ai
968vec_and(vector signed long long __a, vector bool long long __b) {
969  return __a & (vector signed long long)__b;
970}
971
972static __inline__ vector unsigned long long __ATTRS_o_ai
973vec_and(vector unsigned long long __a, vector unsigned long long __b) {
974  return __a & __b;
975}
976
977static __inline__ vector unsigned long long __ATTRS_o_ai
978vec_and(vector bool long long __a, vector unsigned long long __b) {
979  return (vector unsigned long long)__a & __b;
980}
981
982static __inline__ vector unsigned long long __ATTRS_o_ai
983vec_and(vector unsigned long long __a, vector bool long long __b) {
984  return __a & (vector unsigned long long)__b;
985}
986
987static __inline__ vector bool long long __ATTRS_o_ai
988vec_and(vector bool long long __a, vector bool long long __b) {
989  return __a & __b;
990}
991#endif
992
993/* vec_vand */
994
995static __inline__ vector signed char __ATTRS_o_ai
996vec_vand(vector signed char __a, vector signed char __b) {
997  return __a & __b;
998}
999
1000static __inline__ vector signed char __ATTRS_o_ai
1001vec_vand(vector bool char __a, vector signed char __b) {
1002  return (vector signed char)__a & __b;
1003}
1004
1005static __inline__ vector signed char __ATTRS_o_ai
1006vec_vand(vector signed char __a, vector bool char __b) {
1007  return __a & (vector signed char)__b;
1008}
1009
1010static __inline__ vector unsigned char __ATTRS_o_ai
1011vec_vand(vector unsigned char __a, vector unsigned char __b) {
1012  return __a & __b;
1013}
1014
1015static __inline__ vector unsigned char __ATTRS_o_ai
1016vec_vand(vector bool char __a, vector unsigned char __b) {
1017  return (vector unsigned char)__a & __b;
1018}
1019
1020static __inline__ vector unsigned char __ATTRS_o_ai
1021vec_vand(vector unsigned char __a, vector bool char __b) {
1022  return __a & (vector unsigned char)__b;
1023}
1024
1025static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1026                                                         vector bool char __b) {
1027  return __a & __b;
1028}
1029
1030static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1031                                                     vector short __b) {
1032  return __a & __b;
1033}
1034
1035static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1036                                                     vector short __b) {
1037  return (vector short)__a & __b;
1038}
1039
1040static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1041                                                     vector bool short __b) {
1042  return __a & (vector short)__b;
1043}
1044
1045static __inline__ vector unsigned short __ATTRS_o_ai
1046vec_vand(vector unsigned short __a, vector unsigned short __b) {
1047  return __a & __b;
1048}
1049
1050static __inline__ vector unsigned short __ATTRS_o_ai
1051vec_vand(vector bool short __a, vector unsigned short __b) {
1052  return (vector unsigned short)__a & __b;
1053}
1054
1055static __inline__ vector unsigned short __ATTRS_o_ai
1056vec_vand(vector unsigned short __a, vector bool short __b) {
1057  return __a & (vector unsigned short)__b;
1058}
1059
1060static __inline__ vector bool short __ATTRS_o_ai
1061vec_vand(vector bool short __a, vector bool short __b) {
1062  return __a & __b;
1063}
1064
1065static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1066                                                   vector int __b) {
1067  return __a & __b;
1068}
1069
1070static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1071                                                   vector int __b) {
1072  return (vector int)__a & __b;
1073}
1074
1075static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1076                                                   vector bool int __b) {
1077  return __a & (vector int)__b;
1078}
1079
1080static __inline__ vector unsigned int __ATTRS_o_ai
1081vec_vand(vector unsigned int __a, vector unsigned int __b) {
1082  return __a & __b;
1083}
1084
1085static __inline__ vector unsigned int __ATTRS_o_ai
1086vec_vand(vector bool int __a, vector unsigned int __b) {
1087  return (vector unsigned int)__a & __b;
1088}
1089
1090static __inline__ vector unsigned int __ATTRS_o_ai
1091vec_vand(vector unsigned int __a, vector bool int __b) {
1092  return __a & (vector unsigned int)__b;
1093}
1094
1095static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1096                                                        vector bool int __b) {
1097  return __a & __b;
1098}
1099
1100static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1101                                                     vector float __b) {
1102  vector unsigned int __res =
1103      (vector unsigned int)__a & (vector unsigned int)__b;
1104  return (vector float)__res;
1105}
1106
1107static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1108                                                     vector float __b) {
1109  vector unsigned int __res =
1110      (vector unsigned int)__a & (vector unsigned int)__b;
1111  return (vector float)__res;
1112}
1113
1114static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1115                                                     vector bool int __b) {
1116  vector unsigned int __res =
1117      (vector unsigned int)__a & (vector unsigned int)__b;
1118  return (vector float)__res;
1119}
1120
1121#ifdef __VSX__
1122static __inline__ vector signed long long __ATTRS_o_ai
1123vec_vand(vector signed long long __a, vector signed long long __b) {
1124  return __a & __b;
1125}
1126
1127static __inline__ vector signed long long __ATTRS_o_ai
1128vec_vand(vector bool long long __a, vector signed long long __b) {
1129  return (vector signed long long)__a & __b;
1130}
1131
1132static __inline__ vector signed long long __ATTRS_o_ai
1133vec_vand(vector signed long long __a, vector bool long long __b) {
1134  return __a & (vector signed long long)__b;
1135}
1136
1137static __inline__ vector unsigned long long __ATTRS_o_ai
1138vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1139  return __a & __b;
1140}
1141
1142static __inline__ vector unsigned long long __ATTRS_o_ai
1143vec_vand(vector bool long long __a, vector unsigned long long __b) {
1144  return (vector unsigned long long)__a & __b;
1145}
1146
1147static __inline__ vector unsigned long long __ATTRS_o_ai
1148vec_vand(vector unsigned long long __a, vector bool long long __b) {
1149  return __a & (vector unsigned long long)__b;
1150}
1151
1152static __inline__ vector bool long long __ATTRS_o_ai
1153vec_vand(vector bool long long __a, vector bool long long __b) {
1154  return __a & __b;
1155}
1156#endif
1157
1158/* vec_andc */
1159
1160#define __builtin_altivec_vandc vec_andc
1161
1162static __inline__ vector signed char __ATTRS_o_ai
1163vec_andc(vector signed char __a, vector signed char __b) {
1164  return __a & ~__b;
1165}
1166
1167static __inline__ vector signed char __ATTRS_o_ai
1168vec_andc(vector bool char __a, vector signed char __b) {
1169  return (vector signed char)__a & ~__b;
1170}
1171
1172static __inline__ vector signed char __ATTRS_o_ai
1173vec_andc(vector signed char __a, vector bool char __b) {
1174  return __a & ~(vector signed char)__b;
1175}
1176
1177static __inline__ vector unsigned char __ATTRS_o_ai
1178vec_andc(vector unsigned char __a, vector unsigned char __b) {
1179  return __a & ~__b;
1180}
1181
1182static __inline__ vector unsigned char __ATTRS_o_ai
1183vec_andc(vector bool char __a, vector unsigned char __b) {
1184  return (vector unsigned char)__a & ~__b;
1185}
1186
1187static __inline__ vector unsigned char __ATTRS_o_ai
1188vec_andc(vector unsigned char __a, vector bool char __b) {
1189  return __a & ~(vector unsigned char)__b;
1190}
1191
1192static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1193                                                         vector bool char __b) {
1194  return __a & ~__b;
1195}
1196
1197static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1198                                                     vector short __b) {
1199  return __a & ~__b;
1200}
1201
1202static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1203                                                     vector short __b) {
1204  return (vector short)__a & ~__b;
1205}
1206
1207static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1208                                                     vector bool short __b) {
1209  return __a & ~(vector short)__b;
1210}
1211
1212static __inline__ vector unsigned short __ATTRS_o_ai
1213vec_andc(vector unsigned short __a, vector unsigned short __b) {
1214  return __a & ~__b;
1215}
1216
1217static __inline__ vector unsigned short __ATTRS_o_ai
1218vec_andc(vector bool short __a, vector unsigned short __b) {
1219  return (vector unsigned short)__a & ~__b;
1220}
1221
1222static __inline__ vector unsigned short __ATTRS_o_ai
1223vec_andc(vector unsigned short __a, vector bool short __b) {
1224  return __a & ~(vector unsigned short)__b;
1225}
1226
1227static __inline__ vector bool short __ATTRS_o_ai
1228vec_andc(vector bool short __a, vector bool short __b) {
1229  return __a & ~__b;
1230}
1231
1232static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1233                                                   vector int __b) {
1234  return __a & ~__b;
1235}
1236
1237static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1238                                                   vector int __b) {
1239  return (vector int)__a & ~__b;
1240}
1241
1242static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1243                                                   vector bool int __b) {
1244  return __a & ~(vector int)__b;
1245}
1246
1247static __inline__ vector unsigned int __ATTRS_o_ai
1248vec_andc(vector unsigned int __a, vector unsigned int __b) {
1249  return __a & ~__b;
1250}
1251
1252static __inline__ vector unsigned int __ATTRS_o_ai
1253vec_andc(vector bool int __a, vector unsigned int __b) {
1254  return (vector unsigned int)__a & ~__b;
1255}
1256
1257static __inline__ vector unsigned int __ATTRS_o_ai
1258vec_andc(vector unsigned int __a, vector bool int __b) {
1259  return __a & ~(vector unsigned int)__b;
1260}
1261
1262static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1263                                                        vector bool int __b) {
1264  return __a & ~__b;
1265}
1266
1267static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1268                                                     vector float __b) {
1269  vector unsigned int __res =
1270      (vector unsigned int)__a & ~(vector unsigned int)__b;
1271  return (vector float)__res;
1272}
1273
1274static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1275                                                     vector float __b) {
1276  vector unsigned int __res =
1277      (vector unsigned int)__a & ~(vector unsigned int)__b;
1278  return (vector float)__res;
1279}
1280
1281static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1282                                                     vector bool int __b) {
1283  vector unsigned int __res =
1284      (vector unsigned int)__a & ~(vector unsigned int)__b;
1285  return (vector float)__res;
1286}
1287
1288#ifdef __VSX__
1289static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1290                                                      vector double __b) {
1291  vector unsigned long long __res =
1292      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1293  return (vector double)__res;
1294}
1295
1296static __inline__ vector double __ATTRS_o_ai
1297vec_andc(vector double __a, vector bool long long __b) {
1298  vector unsigned long long __res =
1299      (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1300  return (vector double)__res;
1301}
1302
1303static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __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 signed long long __ATTRS_o_ai
1311vec_andc(vector signed long long __a, vector signed long long __b) {
1312  return __a & ~__b;
1313}
1314
1315static __inline__ vector signed long long __ATTRS_o_ai
1316vec_andc(vector bool long long __a, vector signed long long __b) {
1317  return (vector signed long long)__a & ~__b;
1318}
1319
1320static __inline__ vector signed long long __ATTRS_o_ai
1321vec_andc(vector signed long long __a, vector bool long long __b) {
1322  return __a & ~(vector signed long long)__b;
1323}
1324
1325static __inline__ vector unsigned long long __ATTRS_o_ai
1326vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1327  return __a & ~__b;
1328}
1329
1330static __inline__ vector unsigned long long __ATTRS_o_ai
1331vec_andc(vector bool long long __a, vector unsigned long long __b) {
1332  return (vector unsigned long long)__a & ~__b;
1333}
1334
1335static __inline__ vector unsigned long long __ATTRS_o_ai
1336vec_andc(vector unsigned long long __a, vector bool long long __b) {
1337  return __a & ~(vector unsigned long long)__b;
1338}
1339
1340static __inline__ vector bool long long __ATTRS_o_ai
1341vec_andc(vector bool long long __a, vector bool long long __b) {
1342  return __a & ~__b;
1343}
1344#endif
1345
1346/* vec_vandc */
1347
1348static __inline__ vector signed char __ATTRS_o_ai
1349vec_vandc(vector signed char __a, vector signed char __b) {
1350  return __a & ~__b;
1351}
1352
1353static __inline__ vector signed char __ATTRS_o_ai
1354vec_vandc(vector bool char __a, vector signed char __b) {
1355  return (vector signed char)__a & ~__b;
1356}
1357
1358static __inline__ vector signed char __ATTRS_o_ai
1359vec_vandc(vector signed char __a, vector bool char __b) {
1360  return __a & ~(vector signed char)__b;
1361}
1362
1363static __inline__ vector unsigned char __ATTRS_o_ai
1364vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1365  return __a & ~__b;
1366}
1367
1368static __inline__ vector unsigned char __ATTRS_o_ai
1369vec_vandc(vector bool char __a, vector unsigned char __b) {
1370  return (vector unsigned char)__a & ~__b;
1371}
1372
1373static __inline__ vector unsigned char __ATTRS_o_ai
1374vec_vandc(vector unsigned char __a, vector bool char __b) {
1375  return __a & ~(vector unsigned char)__b;
1376}
1377
1378static __inline__ vector bool char __ATTRS_o_ai
1379vec_vandc(vector bool char __a, vector bool char __b) {
1380  return __a & ~__b;
1381}
1382
1383static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1384                                                      vector short __b) {
1385  return __a & ~__b;
1386}
1387
1388static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1389                                                      vector short __b) {
1390  return (vector short)__a & ~__b;
1391}
1392
1393static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1394                                                      vector bool short __b) {
1395  return __a & ~(vector short)__b;
1396}
1397
1398static __inline__ vector unsigned short __ATTRS_o_ai
1399vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1400  return __a & ~__b;
1401}
1402
1403static __inline__ vector unsigned short __ATTRS_o_ai
1404vec_vandc(vector bool short __a, vector unsigned short __b) {
1405  return (vector unsigned short)__a & ~__b;
1406}
1407
1408static __inline__ vector unsigned short __ATTRS_o_ai
1409vec_vandc(vector unsigned short __a, vector bool short __b) {
1410  return __a & ~(vector unsigned short)__b;
1411}
1412
1413static __inline__ vector bool short __ATTRS_o_ai
1414vec_vandc(vector bool short __a, vector bool short __b) {
1415  return __a & ~__b;
1416}
1417
1418static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1419                                                    vector int __b) {
1420  return __a & ~__b;
1421}
1422
1423static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1424                                                    vector int __b) {
1425  return (vector int)__a & ~__b;
1426}
1427
1428static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1429                                                    vector bool int __b) {
1430  return __a & ~(vector int)__b;
1431}
1432
1433static __inline__ vector unsigned int __ATTRS_o_ai
1434vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1435  return __a & ~__b;
1436}
1437
1438static __inline__ vector unsigned int __ATTRS_o_ai
1439vec_vandc(vector bool int __a, vector unsigned int __b) {
1440  return (vector unsigned int)__a & ~__b;
1441}
1442
1443static __inline__ vector unsigned int __ATTRS_o_ai
1444vec_vandc(vector unsigned int __a, vector bool int __b) {
1445  return __a & ~(vector unsigned int)__b;
1446}
1447
1448static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1449                                                         vector bool int __b) {
1450  return __a & ~__b;
1451}
1452
1453static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1454                                                      vector float __b) {
1455  vector unsigned int __res =
1456      (vector unsigned int)__a & ~(vector unsigned int)__b;
1457  return (vector float)__res;
1458}
1459
1460static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1461                                                      vector float __b) {
1462  vector unsigned int __res =
1463      (vector unsigned int)__a & ~(vector unsigned int)__b;
1464  return (vector float)__res;
1465}
1466
1467static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1468                                                      vector bool int __b) {
1469  vector unsigned int __res =
1470      (vector unsigned int)__a & ~(vector unsigned int)__b;
1471  return (vector float)__res;
1472}
1473
1474#ifdef __VSX__
1475static __inline__ vector signed long long __ATTRS_o_ai
1476vec_vandc(vector signed long long __a, vector signed long long __b) {
1477  return __a & ~__b;
1478}
1479
1480static __inline__ vector signed long long __ATTRS_o_ai
1481vec_vandc(vector bool long long __a, vector signed long long __b) {
1482  return (vector signed long long)__a & ~__b;
1483}
1484
1485static __inline__ vector signed long long __ATTRS_o_ai
1486vec_vandc(vector signed long long __a, vector bool long long __b) {
1487  return __a & ~(vector signed long long)__b;
1488}
1489
1490static __inline__ vector unsigned long long __ATTRS_o_ai
1491vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1492  return __a & ~__b;
1493}
1494
1495static __inline__ vector unsigned long long __ATTRS_o_ai
1496vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1497  return (vector unsigned long long)__a & ~__b;
1498}
1499
1500static __inline__ vector unsigned long long __ATTRS_o_ai
1501vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1502  return __a & ~(vector unsigned long long)__b;
1503}
1504
1505static __inline__ vector bool long long __ATTRS_o_ai
1506vec_vandc(vector bool long long __a, vector bool long long __b) {
1507  return __a & ~__b;
1508}
1509#endif
1510
1511/* vec_avg */
1512
1513static __inline__ vector signed char __ATTRS_o_ai
1514vec_avg(vector signed char __a, vector signed char __b) {
1515  return __builtin_altivec_vavgsb(__a, __b);
1516}
1517
1518static __inline__ vector unsigned char __ATTRS_o_ai
1519vec_avg(vector unsigned char __a, vector unsigned char __b) {
1520  return __builtin_altivec_vavgub(__a, __b);
1521}
1522
1523static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1524                                                    vector short __b) {
1525  return __builtin_altivec_vavgsh(__a, __b);
1526}
1527
1528static __inline__ vector unsigned short __ATTRS_o_ai
1529vec_avg(vector unsigned short __a, vector unsigned short __b) {
1530  return __builtin_altivec_vavguh(__a, __b);
1531}
1532
1533static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1534                                                  vector int __b) {
1535  return __builtin_altivec_vavgsw(__a, __b);
1536}
1537
1538static __inline__ vector unsigned int __ATTRS_o_ai
1539vec_avg(vector unsigned int __a, vector unsigned int __b) {
1540  return __builtin_altivec_vavguw(__a, __b);
1541}
1542
1543/* vec_vavgsb */
1544
1545static __inline__ vector signed char __attribute__((__always_inline__))
1546vec_vavgsb(vector signed char __a, vector signed char __b) {
1547  return __builtin_altivec_vavgsb(__a, __b);
1548}
1549
1550/* vec_vavgub */
1551
1552static __inline__ vector unsigned char __attribute__((__always_inline__))
1553vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1554  return __builtin_altivec_vavgub(__a, __b);
1555}
1556
1557/* vec_vavgsh */
1558
1559static __inline__ vector short __attribute__((__always_inline__))
1560vec_vavgsh(vector short __a, vector short __b) {
1561  return __builtin_altivec_vavgsh(__a, __b);
1562}
1563
1564/* vec_vavguh */
1565
1566static __inline__ vector unsigned short __attribute__((__always_inline__))
1567vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1568  return __builtin_altivec_vavguh(__a, __b);
1569}
1570
1571/* vec_vavgsw */
1572
1573static __inline__ vector int __attribute__((__always_inline__))
1574vec_vavgsw(vector int __a, vector int __b) {
1575  return __builtin_altivec_vavgsw(__a, __b);
1576}
1577
1578/* vec_vavguw */
1579
1580static __inline__ vector unsigned int __attribute__((__always_inline__))
1581vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1582  return __builtin_altivec_vavguw(__a, __b);
1583}
1584
1585/* vec_ceil */
1586
1587static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1588#ifdef __VSX__
1589  return __builtin_vsx_xvrspip(__a);
1590#else
1591  return __builtin_altivec_vrfip(__a);
1592#endif
1593}
1594
1595#ifdef __VSX__
1596static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1597  return __builtin_vsx_xvrdpip(__a);
1598}
1599#endif
1600
1601/* vec_vrfip */
1602
1603static __inline__ vector float __attribute__((__always_inline__))
1604vec_vrfip(vector float __a) {
1605  return __builtin_altivec_vrfip(__a);
1606}
1607
1608/* vec_cmpb */
1609
1610static __inline__ vector int __attribute__((__always_inline__))
1611vec_cmpb(vector float __a, vector float __b) {
1612  return __builtin_altivec_vcmpbfp(__a, __b);
1613}
1614
1615/* vec_vcmpbfp */
1616
1617static __inline__ vector int __attribute__((__always_inline__))
1618vec_vcmpbfp(vector float __a, vector float __b) {
1619  return __builtin_altivec_vcmpbfp(__a, __b);
1620}
1621
1622/* vec_cmpeq */
1623
1624static __inline__ vector bool char __ATTRS_o_ai
1625vec_cmpeq(vector signed char __a, vector signed char __b) {
1626  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1627                                                      (vector char)__b);
1628}
1629
1630static __inline__ vector bool char __ATTRS_o_ai
1631vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1632  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1633                                                      (vector char)__b);
1634}
1635
1636static __inline__ vector bool char __ATTRS_o_ai
1637vec_cmpeq(vector bool char __a, vector bool char __b) {
1638  return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1639                                                      (vector char)__b);
1640}
1641
1642static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1643                                                           vector short __b) {
1644  return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1645}
1646
1647static __inline__ vector bool short __ATTRS_o_ai
1648vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1649  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1650                                                       (vector short)__b);
1651}
1652
1653static __inline__ vector bool short __ATTRS_o_ai
1654vec_cmpeq(vector bool short __a, vector bool short __b) {
1655  return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1656                                                       (vector short)__b);
1657}
1658
1659static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1660                                                         vector int __b) {
1661  return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1662}
1663
1664static __inline__ vector bool int __ATTRS_o_ai
1665vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1666  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1667                                                     (vector int)__b);
1668}
1669
1670static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1671                                                         vector bool int __b) {
1672  return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1673                                                     (vector int)__b);
1674}
1675
1676#ifdef __POWER8_VECTOR__
1677static __inline__ vector bool long long __ATTRS_o_ai
1678vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1679  return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1680}
1681
1682static __inline__ vector bool long long __ATTRS_o_ai
1683vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1684  return (vector bool long long)__builtin_altivec_vcmpequd(
1685      (vector long long)__a, (vector long long)__b);
1686}
1687
1688static __inline__ vector bool long long __ATTRS_o_ai
1689vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1690  return (vector bool long long)__builtin_altivec_vcmpequd(
1691      (vector long long)__a, (vector long long)__b);
1692}
1693
1694#endif
1695
1696static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1697                                                         vector float __b) {
1698#ifdef __VSX__
1699  return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1700#else
1701  return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1702#endif
1703}
1704
1705#ifdef __VSX__
1706static __inline__ vector bool long long __ATTRS_o_ai
1707vec_cmpeq(vector double __a, vector double __b) {
1708  return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1709}
1710#endif
1711
1712#ifdef __POWER9_VECTOR__
1713/* vec_cmpne */
1714
1715static __inline__ vector bool char __ATTRS_o_ai
1716vec_cmpne(vector bool char __a, vector bool char __b) {
1717  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1718                                                     (vector char)__b);
1719}
1720
1721static __inline__ vector bool char __ATTRS_o_ai
1722vec_cmpne(vector signed char __a, vector signed char __b) {
1723  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1724                                                     (vector char)__b);
1725}
1726
1727static __inline__ vector bool char __ATTRS_o_ai
1728vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1729  return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1730                                                     (vector char)__b);
1731}
1732
1733static __inline__ vector bool short __ATTRS_o_ai
1734vec_cmpne(vector bool short __a, vector bool short __b) {
1735  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1736                                                      (vector short)__b);
1737}
1738
1739static __inline__ vector bool short __ATTRS_o_ai
1740vec_cmpne(vector signed short __a, vector signed short __b) {
1741  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1742                                                      (vector short)__b);
1743}
1744
1745static __inline__ vector bool short __ATTRS_o_ai
1746vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1747  return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1748                                                      (vector short)__b);
1749}
1750
1751static __inline__ vector bool int __ATTRS_o_ai
1752vec_cmpne(vector bool int __a, vector bool int __b) {
1753  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1754                                                    (vector int)__b);
1755}
1756
1757static __inline__ vector bool int __ATTRS_o_ai
1758vec_cmpne(vector signed int __a, vector signed int __b) {
1759  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1760                                                    (vector int)__b);
1761}
1762
1763static __inline__ vector bool int __ATTRS_o_ai
1764vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1765  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1766                                                    (vector int)__b);
1767}
1768
1769static __inline__ vector bool long long __ATTRS_o_ai
1770vec_cmpne(vector bool long long __a, vector bool long long __b) {
1771  return (vector bool long long)
1772    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1773}
1774
1775static __inline__ vector bool long long __ATTRS_o_ai
1776vec_cmpne(vector signed long long __a, vector signed long long __b) {
1777  return (vector bool long long)
1778    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1779}
1780
1781static __inline__ vector bool long long __ATTRS_o_ai
1782vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
1783  return (vector bool long long)
1784    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1785}
1786
1787static __inline__ vector bool int __ATTRS_o_ai
1788vec_cmpne(vector float __a, vector float __b) {
1789  return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1790                                                    (vector int)__b);
1791}
1792
1793static __inline__ vector bool long long __ATTRS_o_ai
1794vec_cmpne(vector double __a, vector double __b) {
1795  return (vector bool long long)
1796    ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1797}
1798
1799/* vec_cmpnez */
1800
1801static __inline__ vector bool char __ATTRS_o_ai
1802vec_cmpnez(vector signed char __a, vector signed char __b) {
1803  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1804                                                      (vector char)__b);
1805}
1806
1807static __inline__ vector bool char __ATTRS_o_ai
1808vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1809  return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1810                                                      (vector char)__b);
1811}
1812
1813static __inline__ vector bool short __ATTRS_o_ai
1814vec_cmpnez(vector signed short __a, vector signed short __b) {
1815  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1816                                                       (vector short)__b);
1817}
1818
1819static __inline__ vector bool short __ATTRS_o_ai
1820vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1821  return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1822                                                       (vector short)__b);
1823}
1824
1825static __inline__ vector bool int __ATTRS_o_ai
1826vec_cmpnez(vector signed int __a, vector signed int __b) {
1827  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1828                                                     (vector int)__b);
1829}
1830
1831static __inline__ vector bool int __ATTRS_o_ai
1832vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1833  return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1834                                                     (vector int)__b);
1835}
1836
1837static __inline__ signed int __ATTRS_o_ai
1838vec_cntlz_lsbb(vector signed char __a) {
1839#ifdef __LITTLE_ENDIAN__
1840  return __builtin_altivec_vctzlsbb(__a);
1841#else
1842  return __builtin_altivec_vclzlsbb(__a);
1843#endif
1844}
1845
1846static __inline__ signed int __ATTRS_o_ai
1847vec_cntlz_lsbb(vector unsigned char __a) {
1848#ifdef __LITTLE_ENDIAN__
1849  return __builtin_altivec_vctzlsbb(__a);
1850#else
1851  return __builtin_altivec_vclzlsbb(__a);
1852#endif
1853}
1854
1855static __inline__ signed int __ATTRS_o_ai
1856vec_cnttz_lsbb(vector signed char __a) {
1857#ifdef __LITTLE_ENDIAN__
1858  return __builtin_altivec_vclzlsbb(__a);
1859#else
1860  return __builtin_altivec_vctzlsbb(__a);
1861#endif
1862}
1863
1864static __inline__ signed int __ATTRS_o_ai
1865vec_cnttz_lsbb(vector unsigned char __a) {
1866#ifdef __LITTLE_ENDIAN__
1867  return __builtin_altivec_vclzlsbb(__a);
1868#else
1869  return __builtin_altivec_vctzlsbb(__a);
1870#endif
1871}
1872
1873static __inline__ vector unsigned int __ATTRS_o_ai
1874vec_parity_lsbb(vector unsigned int __a) {
1875  return __builtin_altivec_vprtybw(__a);
1876}
1877
1878static __inline__ vector unsigned int __ATTRS_o_ai
1879vec_parity_lsbb(vector signed int __a) {
1880  return __builtin_altivec_vprtybw(__a);
1881}
1882
1883static __inline__ vector unsigned __int128 __ATTRS_o_ai
1884vec_parity_lsbb(vector unsigned __int128 __a) {
1885  return __builtin_altivec_vprtybq(__a);
1886}
1887
1888static __inline__ vector unsigned __int128 __ATTRS_o_ai
1889vec_parity_lsbb(vector signed __int128 __a) {
1890  return __builtin_altivec_vprtybq(__a);
1891}
1892
1893static __inline__ vector unsigned long long __ATTRS_o_ai
1894vec_parity_lsbb(vector unsigned long long __a) {
1895  return __builtin_altivec_vprtybd(__a);
1896}
1897
1898static __inline__ vector unsigned long long __ATTRS_o_ai
1899vec_parity_lsbb(vector signed long long __a) {
1900  return __builtin_altivec_vprtybd(__a);
1901}
1902
1903#endif
1904
1905/* vec_cmpgt */
1906
1907static __inline__ vector bool char __ATTRS_o_ai
1908vec_cmpgt(vector signed char __a, vector signed char __b) {
1909  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1910}
1911
1912static __inline__ vector bool char __ATTRS_o_ai
1913vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1914  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1915}
1916
1917static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1918                                                           vector short __b) {
1919  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1920}
1921
1922static __inline__ vector bool short __ATTRS_o_ai
1923vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1924  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1925}
1926
1927static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1928                                                         vector int __b) {
1929  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1930}
1931
1932static __inline__ vector bool int __ATTRS_o_ai
1933vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1934  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1935}
1936
1937#ifdef __POWER8_VECTOR__
1938static __inline__ vector bool long long __ATTRS_o_ai
1939vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1940  return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1941}
1942
1943static __inline__ vector bool long long __ATTRS_o_ai
1944vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1945  return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1946}
1947#endif
1948
1949static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1950                                                         vector float __b) {
1951#ifdef __VSX__
1952  return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1953#else
1954  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1955#endif
1956}
1957
1958#ifdef __VSX__
1959static __inline__ vector bool long long __ATTRS_o_ai
1960vec_cmpgt(vector double __a, vector double __b) {
1961  return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1962}
1963#endif
1964
1965/* vec_cmpge */
1966
1967static __inline__ vector bool char __ATTRS_o_ai
1968vec_cmpge(vector signed char __a, vector signed char __b) {
1969  return ~(vec_cmpgt(__b, __a));
1970}
1971
1972static __inline__ vector bool char __ATTRS_o_ai
1973vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1974  return ~(vec_cmpgt(__b, __a));
1975}
1976
1977static __inline__ vector bool short __ATTRS_o_ai
1978vec_cmpge(vector signed short __a, vector signed short __b) {
1979  return ~(vec_cmpgt(__b, __a));
1980}
1981
1982static __inline__ vector bool short __ATTRS_o_ai
1983vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1984  return ~(vec_cmpgt(__b, __a));
1985}
1986
1987static __inline__ vector bool int __ATTRS_o_ai
1988vec_cmpge(vector signed int __a, vector signed int __b) {
1989  return ~(vec_cmpgt(__b, __a));
1990}
1991
1992static __inline__ vector bool int __ATTRS_o_ai
1993vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1994  return ~(vec_cmpgt(__b, __a));
1995}
1996
1997static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
1998                                                         vector float __b) {
1999#ifdef __VSX__
2000  return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2001#else
2002  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2003#endif
2004}
2005
2006#ifdef __VSX__
2007static __inline__ vector bool long long __ATTRS_o_ai
2008vec_cmpge(vector double __a, vector double __b) {
2009  return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2010}
2011#endif
2012
2013#ifdef __POWER8_VECTOR__
2014static __inline__ vector bool long long __ATTRS_o_ai
2015vec_cmpge(vector signed long long __a, vector signed long long __b) {
2016  return ~(vec_cmpgt(__b, __a));
2017}
2018
2019static __inline__ vector bool long long __ATTRS_o_ai
2020vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2021  return ~(vec_cmpgt(__b, __a));
2022}
2023#endif
2024
2025/* vec_vcmpgefp */
2026
2027static __inline__ vector bool int __attribute__((__always_inline__))
2028vec_vcmpgefp(vector float __a, vector float __b) {
2029  return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2030}
2031
2032/* vec_vcmpgtsb */
2033
2034static __inline__ vector bool char __attribute__((__always_inline__))
2035vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2036  return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2037}
2038
2039/* vec_vcmpgtub */
2040
2041static __inline__ vector bool char __attribute__((__always_inline__))
2042vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2043  return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2044}
2045
2046/* vec_vcmpgtsh */
2047
2048static __inline__ vector bool short __attribute__((__always_inline__))
2049vec_vcmpgtsh(vector short __a, vector short __b) {
2050  return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2051}
2052
2053/* vec_vcmpgtuh */
2054
2055static __inline__ vector bool short __attribute__((__always_inline__))
2056vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2057  return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2058}
2059
2060/* vec_vcmpgtsw */
2061
2062static __inline__ vector bool int __attribute__((__always_inline__))
2063vec_vcmpgtsw(vector int __a, vector int __b) {
2064  return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2065}
2066
2067/* vec_vcmpgtuw */
2068
2069static __inline__ vector bool int __attribute__((__always_inline__))
2070vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2071  return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2072}
2073
2074/* vec_vcmpgtfp */
2075
2076static __inline__ vector bool int __attribute__((__always_inline__))
2077vec_vcmpgtfp(vector float __a, vector float __b) {
2078  return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2079}
2080
2081/* vec_cmple */
2082
2083static __inline__ vector bool char __ATTRS_o_ai
2084vec_cmple(vector signed char __a, vector signed char __b) {
2085  return vec_cmpge(__b, __a);
2086}
2087
2088static __inline__ vector bool char __ATTRS_o_ai
2089vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2090  return vec_cmpge(__b, __a);
2091}
2092
2093static __inline__ vector bool short __ATTRS_o_ai
2094vec_cmple(vector signed short __a, vector signed short __b) {
2095  return vec_cmpge(__b, __a);
2096}
2097
2098static __inline__ vector bool short __ATTRS_o_ai
2099vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2100  return vec_cmpge(__b, __a);
2101}
2102
2103static __inline__ vector bool int __ATTRS_o_ai
2104vec_cmple(vector signed int __a, vector signed int __b) {
2105  return vec_cmpge(__b, __a);
2106}
2107
2108static __inline__ vector bool int __ATTRS_o_ai
2109vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2110  return vec_cmpge(__b, __a);
2111}
2112
2113static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2114                                                         vector float __b) {
2115  return vec_cmpge(__b, __a);
2116}
2117
2118#ifdef __VSX__
2119static __inline__ vector bool long long __ATTRS_o_ai
2120vec_cmple(vector double __a, vector double __b) {
2121  return vec_cmpge(__b, __a);
2122}
2123#endif
2124
2125#ifdef __POWER8_VECTOR__
2126static __inline__ vector bool long long __ATTRS_o_ai
2127vec_cmple(vector signed long long __a, vector signed long long __b) {
2128  return vec_cmpge(__b, __a);
2129}
2130
2131static __inline__ vector bool long long __ATTRS_o_ai
2132vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2133  return vec_cmpge(__b, __a);
2134}
2135#endif
2136
2137/* vec_cmplt */
2138
2139static __inline__ vector bool char __ATTRS_o_ai
2140vec_cmplt(vector signed char __a, vector signed char __b) {
2141  return vec_cmpgt(__b, __a);
2142}
2143
2144static __inline__ vector bool char __ATTRS_o_ai
2145vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2146  return vec_cmpgt(__b, __a);
2147}
2148
2149static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2150                                                           vector short __b) {
2151  return vec_cmpgt(__b, __a);
2152}
2153
2154static __inline__ vector bool short __ATTRS_o_ai
2155vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2156  return vec_cmpgt(__b, __a);
2157}
2158
2159static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2160                                                         vector int __b) {
2161  return vec_cmpgt(__b, __a);
2162}
2163
2164static __inline__ vector bool int __ATTRS_o_ai
2165vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2166  return vec_cmpgt(__b, __a);
2167}
2168
2169static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2170                                                         vector float __b) {
2171  return vec_cmpgt(__b, __a);
2172}
2173
2174#ifdef __VSX__
2175static __inline__ vector bool long long __ATTRS_o_ai
2176vec_cmplt(vector double __a, vector double __b) {
2177  return vec_cmpgt(__b, __a);
2178}
2179#endif
2180
2181#ifdef __POWER8_VECTOR__
2182static __inline__ vector bool long long __ATTRS_o_ai
2183vec_cmplt(vector signed long long __a, vector signed long long __b) {
2184  return vec_cmpgt(__b, __a);
2185}
2186
2187static __inline__ vector bool long long __ATTRS_o_ai
2188vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2189  return vec_cmpgt(__b, __a);
2190}
2191
2192/* vec_popcnt */
2193
2194static __inline__ vector signed char __ATTRS_o_ai
2195vec_popcnt(vector signed char __a) {
2196  return __builtin_altivec_vpopcntb(__a);
2197}
2198static __inline__ vector unsigned char __ATTRS_o_ai
2199vec_popcnt(vector unsigned char __a) {
2200  return __builtin_altivec_vpopcntb(__a);
2201}
2202static __inline__ vector signed short __ATTRS_o_ai
2203vec_popcnt(vector signed short __a) {
2204  return __builtin_altivec_vpopcnth(__a);
2205}
2206static __inline__ vector unsigned short __ATTRS_o_ai
2207vec_popcnt(vector unsigned short __a) {
2208  return __builtin_altivec_vpopcnth(__a);
2209}
2210static __inline__ vector signed int __ATTRS_o_ai
2211vec_popcnt(vector signed int __a) {
2212  return __builtin_altivec_vpopcntw(__a);
2213}
2214static __inline__ vector unsigned int __ATTRS_o_ai
2215vec_popcnt(vector unsigned int __a) {
2216  return __builtin_altivec_vpopcntw(__a);
2217}
2218static __inline__ vector signed long long __ATTRS_o_ai
2219vec_popcnt(vector signed long long __a) {
2220  return __builtin_altivec_vpopcntd(__a);
2221}
2222static __inline__ vector unsigned long long __ATTRS_o_ai
2223vec_popcnt(vector unsigned long long __a) {
2224  return __builtin_altivec_vpopcntd(__a);
2225}
2226
2227/* vec_cntlz */
2228
2229static __inline__ vector signed char __ATTRS_o_ai
2230vec_cntlz(vector signed char __a) {
2231  return __builtin_altivec_vclzb(__a);
2232}
2233static __inline__ vector unsigned char __ATTRS_o_ai
2234vec_cntlz(vector unsigned char __a) {
2235  return __builtin_altivec_vclzb(__a);
2236}
2237static __inline__ vector signed short __ATTRS_o_ai
2238vec_cntlz(vector signed short __a) {
2239  return __builtin_altivec_vclzh(__a);
2240}
2241static __inline__ vector unsigned short __ATTRS_o_ai
2242vec_cntlz(vector unsigned short __a) {
2243  return __builtin_altivec_vclzh(__a);
2244}
2245static __inline__ vector signed int __ATTRS_o_ai
2246vec_cntlz(vector signed int __a) {
2247  return __builtin_altivec_vclzw(__a);
2248}
2249static __inline__ vector unsigned int __ATTRS_o_ai
2250vec_cntlz(vector unsigned int __a) {
2251  return __builtin_altivec_vclzw(__a);
2252}
2253static __inline__ vector signed long long __ATTRS_o_ai
2254vec_cntlz(vector signed long long __a) {
2255  return __builtin_altivec_vclzd(__a);
2256}
2257static __inline__ vector unsigned long long __ATTRS_o_ai
2258vec_cntlz(vector unsigned long long __a) {
2259  return __builtin_altivec_vclzd(__a);
2260}
2261#endif
2262
2263#ifdef __POWER9_VECTOR__
2264
2265/* vec_cnttz */
2266
2267static __inline__ vector signed char __ATTRS_o_ai
2268vec_cnttz(vector signed char __a) {
2269  return __builtin_altivec_vctzb(__a);
2270}
2271static __inline__ vector unsigned char __ATTRS_o_ai
2272vec_cnttz(vector unsigned char __a) {
2273  return __builtin_altivec_vctzb(__a);
2274}
2275static __inline__ vector signed short __ATTRS_o_ai
2276vec_cnttz(vector signed short __a) {
2277  return __builtin_altivec_vctzh(__a);
2278}
2279static __inline__ vector unsigned short __ATTRS_o_ai
2280vec_cnttz(vector unsigned short __a) {
2281  return __builtin_altivec_vctzh(__a);
2282}
2283static __inline__ vector signed int __ATTRS_o_ai
2284vec_cnttz(vector signed int __a) {
2285  return __builtin_altivec_vctzw(__a);
2286}
2287static __inline__ vector unsigned int __ATTRS_o_ai
2288vec_cnttz(vector unsigned int __a) {
2289  return __builtin_altivec_vctzw(__a);
2290}
2291static __inline__ vector signed long long __ATTRS_o_ai
2292vec_cnttz(vector signed long long __a) {
2293  return __builtin_altivec_vctzd(__a);
2294}
2295static __inline__ vector unsigned long long __ATTRS_o_ai
2296vec_cnttz(vector unsigned long long __a) {
2297  return __builtin_altivec_vctzd(__a);
2298}
2299
2300/* vec_first_match_index */
2301
2302static __inline__ unsigned __ATTRS_o_ai
2303vec_first_match_index(vector signed char __a, vector signed char __b) {
2304  vector unsigned long long __res =
2305#ifdef __LITTLE_ENDIAN__
2306    vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2307#else
2308    vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2309#endif
2310  if (__res[0] == 64) {
2311    return (__res[1] + 64) >> 3;
2312  }
2313  return __res[0] >> 3;
2314}
2315
2316static __inline__ unsigned __ATTRS_o_ai
2317vec_first_match_index(vector unsigned char __a, vector unsigned 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 signed short __a, vector signed short __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) >> 4;
2340  }
2341  return __res[0] >> 4;
2342}
2343
2344static __inline__ unsigned __ATTRS_o_ai
2345vec_first_match_index(vector unsigned short __a, vector unsigned 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 signed int __a, vector signed int __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) >> 5;
2368  }
2369  return __res[0] >> 5;
2370}
2371
2372static __inline__ unsigned __ATTRS_o_ai
2373vec_first_match_index(vector unsigned int __a, vector unsigned 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
2386/* vec_first_match_or_eos_index */
2387
2388static __inline__ unsigned __ATTRS_o_ai
2389vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2390  /* Compare the result of the comparison of two vectors with either and OR the
2391     result. Either the elements are equal or one will equal the comparison
2392     result if either is zero.
2393  */
2394  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2395  vector bool char __tmp2 = __tmp1 |
2396                            vec_cmpeq((vector signed char)__tmp1, __a) |
2397                            vec_cmpeq((vector signed char)__tmp1, __b);
2398
2399  vector unsigned long long __res =
2400#ifdef __LITTLE_ENDIAN__
2401      vec_cnttz((vector unsigned long long)__tmp2);
2402#else
2403      vec_cntlz((vector unsigned long long)__tmp2);
2404#endif
2405  if (__res[0] == 64) {
2406    return (__res[1] + 64) >> 3;
2407  }
2408  return __res[0] >> 3;
2409}
2410
2411static __inline__ unsigned __ATTRS_o_ai
2412vec_first_match_or_eos_index(vector unsigned char __a,
2413                             vector unsigned char __b) {
2414  vector bool char __tmp1 = vec_cmpeq(__a, __b);
2415  vector bool char __tmp2 = __tmp1 |
2416                            vec_cmpeq((vector unsigned char)__tmp1, __a) |
2417                            vec_cmpeq((vector unsigned char)__tmp1, __b);
2418
2419  vector unsigned long long __res =
2420#ifdef __LITTLE_ENDIAN__
2421      vec_cnttz((vector unsigned long long)__tmp2);
2422#else
2423      vec_cntlz((vector unsigned long long)__tmp2);
2424#endif
2425  if (__res[0] == 64) {
2426    return (__res[1] + 64) >> 3;
2427  }
2428  return __res[0] >> 3;
2429}
2430
2431static __inline__ unsigned __ATTRS_o_ai
2432vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2433  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2434  vector bool short __tmp2 = __tmp1 |
2435                             vec_cmpeq((vector signed short)__tmp1, __a) |
2436                             vec_cmpeq((vector signed short)__tmp1, __b);
2437
2438  vector unsigned long long __res =
2439#ifdef __LITTLE_ENDIAN__
2440      vec_cnttz((vector unsigned long long)__tmp2);
2441#else
2442      vec_cntlz((vector unsigned long long)__tmp2);
2443#endif
2444  if (__res[0] == 64) {
2445    return (__res[1] + 64) >> 4;
2446  }
2447  return __res[0] >> 4;
2448}
2449
2450static __inline__ unsigned __ATTRS_o_ai
2451vec_first_match_or_eos_index(vector unsigned short __a,
2452                             vector unsigned short __b) {
2453  vector bool short __tmp1 = vec_cmpeq(__a, __b);
2454  vector bool short __tmp2 = __tmp1 |
2455                             vec_cmpeq((vector unsigned short)__tmp1, __a) |
2456                             vec_cmpeq((vector unsigned short)__tmp1, __b);
2457
2458  vector unsigned long long __res =
2459#ifdef __LITTLE_ENDIAN__
2460      vec_cnttz((vector unsigned long long)__tmp2);
2461#else
2462      vec_cntlz((vector unsigned long long)__tmp2);
2463#endif
2464  if (__res[0] == 64) {
2465    return (__res[1] + 64) >> 4;
2466  }
2467  return __res[0] >> 4;
2468}
2469
2470static __inline__ unsigned __ATTRS_o_ai
2471vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2472  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2473  vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2474                           vec_cmpeq((vector signed int)__tmp1, __b);
2475
2476  vector unsigned long long __res =
2477#ifdef __LITTLE_ENDIAN__
2478      vec_cnttz((vector unsigned long long)__tmp2);
2479#else
2480      vec_cntlz((vector unsigned long long)__tmp2);
2481#endif
2482  if (__res[0] == 64) {
2483    return (__res[1] + 64) >> 5;
2484  }
2485  return __res[0] >> 5;
2486}
2487
2488static __inline__ unsigned __ATTRS_o_ai
2489vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2490  vector bool int __tmp1 = vec_cmpeq(__a, __b);
2491  vector bool int __tmp2 = __tmp1 |
2492                           vec_cmpeq((vector unsigned int)__tmp1, __a) |
2493                           vec_cmpeq((vector unsigned int)__tmp1, __b);
2494
2495  vector unsigned long long __res =
2496#ifdef __LITTLE_ENDIAN__
2497    vec_cnttz((vector unsigned long long)__tmp2);
2498#else
2499    vec_cntlz((vector unsigned long long)__tmp2);
2500#endif
2501  if (__res[0] == 64) {
2502    return (__res[1] + 64) >> 5;
2503  }
2504  return __res[0] >> 5;
2505}
2506
2507/* vec_first_mismatch_index */
2508
2509static __inline__ unsigned __ATTRS_o_ai
2510vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2511  vector unsigned long long __res =
2512#ifdef __LITTLE_ENDIAN__
2513    vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2514#else
2515    vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2516#endif
2517  if (__res[0] == 64) {
2518    return (__res[1] + 64) >> 3;
2519  }
2520  return __res[0] >> 3;
2521}
2522
2523static __inline__ unsigned __ATTRS_o_ai
2524vec_first_mismatch_index(vector unsigned char __a, vector unsigned 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 signed short __a, vector signed short __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) >> 4;
2547  }
2548  return __res[0] >> 4;
2549}
2550
2551static __inline__ unsigned __ATTRS_o_ai
2552vec_first_mismatch_index(vector unsigned short __a, vector unsigned 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 signed int __a, vector signed int __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) >> 5;
2575  }
2576  return __res[0] >> 5;
2577}
2578
2579static __inline__ unsigned __ATTRS_o_ai
2580vec_first_mismatch_index(vector unsigned int __a, vector unsigned 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
2593/* vec_first_mismatch_or_eos_index */
2594
2595static __inline__ unsigned __ATTRS_o_ai
2596vec_first_mismatch_or_eos_index(vector signed char __a,
2597                                vector signed char __b) {
2598  vector unsigned long long __res =
2599#ifdef __LITTLE_ENDIAN__
2600    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2601#else
2602    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2603#endif
2604  if (__res[0] == 64) {
2605    return (__res[1] + 64) >> 3;
2606  }
2607  return __res[0] >> 3;
2608}
2609
2610static __inline__ unsigned __ATTRS_o_ai
2611vec_first_mismatch_or_eos_index(vector unsigned char __a,
2612                                vector unsigned char __b) {
2613  vector unsigned long long __res =
2614#ifdef __LITTLE_ENDIAN__
2615    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2616#else
2617    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2618#endif
2619  if (__res[0] == 64) {
2620    return (__res[1] + 64) >> 3;
2621  }
2622  return __res[0] >> 3;
2623}
2624
2625static __inline__ unsigned __ATTRS_o_ai
2626vec_first_mismatch_or_eos_index(vector signed short __a,
2627                                vector signed short __b) {
2628  vector unsigned long long __res =
2629#ifdef __LITTLE_ENDIAN__
2630    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2631#else
2632    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2633#endif
2634  if (__res[0] == 64) {
2635    return (__res[1] + 64) >> 4;
2636  }
2637  return __res[0] >> 4;
2638}
2639
2640static __inline__ unsigned __ATTRS_o_ai
2641vec_first_mismatch_or_eos_index(vector unsigned short __a,
2642                                vector unsigned short __b) {
2643  vector unsigned long long __res =
2644#ifdef __LITTLE_ENDIAN__
2645    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2646#else
2647    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2648#endif
2649  if (__res[0] == 64) {
2650    return (__res[1] + 64) >> 4;
2651  }
2652  return __res[0] >> 4;
2653}
2654
2655static __inline__ unsigned __ATTRS_o_ai
2656vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __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) >> 5;
2665  }
2666  return __res[0] >> 5;
2667}
2668
2669static __inline__ unsigned __ATTRS_o_ai
2670vec_first_mismatch_or_eos_index(vector unsigned int __a,
2671                                vector unsigned int __b) {
2672  vector unsigned long long __res =
2673#ifdef __LITTLE_ENDIAN__
2674    vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2675#else
2676    vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2677#endif
2678  if (__res[0] == 64) {
2679    return (__res[1] + 64) >> 5;
2680  }
2681  return __res[0] >> 5;
2682}
2683
2684static __inline__ vector double  __ATTRS_o_ai
2685vec_insert_exp(vector double __a, vector unsigned long long __b) {
2686  return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2687}
2688
2689static __inline__ vector double  __ATTRS_o_ai
2690vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2691  return __builtin_vsx_xviexpdp(__a,__b);
2692}
2693
2694static __inline__ vector float  __ATTRS_o_ai
2695vec_insert_exp(vector float __a, vector unsigned int __b) {
2696  return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2697}
2698
2699static __inline__ vector float  __ATTRS_o_ai
2700vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2701  return __builtin_vsx_xviexpsp(__a,__b);
2702}
2703
2704#if defined(__powerpc64__)
2705static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(signed char *__a,
2706                                                             size_t __b) {
2707  return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
2708}
2709
2710static __inline__ vector unsigned char __ATTRS_o_ai
2711vec_xl_len(unsigned char *__a, size_t __b) {
2712  return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
2713}
2714
2715static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(signed short *__a,
2716                                                              size_t __b) {
2717  return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
2718}
2719
2720static __inline__ vector unsigned short __ATTRS_o_ai
2721vec_xl_len(unsigned short *__a, size_t __b) {
2722  return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
2723}
2724
2725static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(signed int *__a,
2726                                                            size_t __b) {
2727  return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
2728}
2729
2730static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(unsigned int *__a,
2731                                                              size_t __b) {
2732  return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
2733}
2734
2735static __inline__ vector float __ATTRS_o_ai vec_xl_len(float *__a, size_t __b) {
2736  return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
2737}
2738
2739static __inline__ vector signed __int128 __ATTRS_o_ai
2740vec_xl_len(signed __int128 *__a, size_t __b) {
2741  return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2742}
2743
2744static __inline__ vector unsigned __int128 __ATTRS_o_ai
2745vec_xl_len(unsigned __int128 *__a, size_t __b) {
2746  return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2747}
2748
2749static __inline__ vector signed long long __ATTRS_o_ai
2750vec_xl_len(signed long long *__a, size_t __b) {
2751  return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
2752}
2753
2754static __inline__ vector unsigned long long __ATTRS_o_ai
2755vec_xl_len(unsigned long long *__a, size_t __b) {
2756  return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
2757}
2758
2759static __inline__ vector double __ATTRS_o_ai vec_xl_len(double *__a,
2760                                                        size_t __b) {
2761  return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
2762}
2763
2764static __inline__ vector unsigned char __ATTRS_o_ai
2765vec_xl_len_r(unsigned char *__a, size_t __b) {
2766  vector unsigned char __res =
2767      (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
2768#ifdef __LITTLE_ENDIAN__
2769  vector unsigned char __mask =
2770      (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
2771  __res = (vector unsigned char)__builtin_altivec_vperm_4si(
2772      (vector int)__res, (vector int)__res, __mask);
2773#endif
2774  return __res;
2775}
2776
2777// vec_xst_len
2778static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
2779                                                unsigned char *__b,
2780                                                size_t __c) {
2781  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2782}
2783
2784static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
2785                                                signed char *__b, size_t __c) {
2786  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2787}
2788
2789static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
2790                                                signed short *__b, size_t __c) {
2791  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2792}
2793
2794static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
2795                                                unsigned short *__b,
2796                                                size_t __c) {
2797  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2798}
2799
2800static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
2801                                                signed int *__b, size_t __c) {
2802  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2803}
2804
2805static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
2806                                                unsigned int *__b, size_t __c) {
2807  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2808}
2809
2810static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
2811                                                size_t __c) {
2812  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2813}
2814
2815static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
2816                                                signed __int128 *__b,
2817                                                size_t __c) {
2818  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2819}
2820
2821static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
2822                                                unsigned __int128 *__b,
2823                                                size_t __c) {
2824  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2825}
2826
2827static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
2828                                                signed long long *__b,
2829                                                size_t __c) {
2830  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2831}
2832
2833static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
2834                                                unsigned long long *__b,
2835                                                size_t __c) {
2836  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2837}
2838
2839static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
2840                                                size_t __c) {
2841  return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2842}
2843
2844static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
2845                                                  unsigned char *__b,
2846                                                  size_t __c) {
2847#ifdef __LITTLE_ENDIAN__
2848  vector unsigned char __mask =
2849      (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
2850  vector unsigned char __res =
2851      __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask);
2852  return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
2853#else
2854  return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56));
2855#endif
2856}
2857#endif
2858#endif
2859
2860/* vec_cpsgn */
2861
2862#ifdef __VSX__
2863static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2864                                                      vector float __b) {
2865  return __builtin_vsx_xvcpsgnsp(__a, __b);
2866}
2867
2868static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
2869                                                       vector double __b) {
2870  return __builtin_vsx_xvcpsgndp(__a, __b);
2871}
2872#endif
2873
2874/* vec_ctf */
2875
2876#ifdef __VSX__
2877#define vec_ctf(__a, __b)                                                      \
2878  _Generic((__a), vector int                                                   \
2879           : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)),  \
2880             vector unsigned int                                               \
2881           : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
2882                                                   (__b)),                     \
2883             vector unsigned long long                                         \
2884           : (__builtin_convertvector((vector unsigned long long)(__a),        \
2885                                      vector double) *                         \
2886              (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2887                                                         << 52)),              \
2888             vector signed long long                                           \
2889           : (__builtin_convertvector((vector signed long long)(__a),          \
2890                                      vector double) *                         \
2891              (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2892                                                         << 52)))
2893#else
2894#define vec_ctf(__a, __b)                                                      \
2895  _Generic((__a), vector int                                                   \
2896           : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)),  \
2897             vector unsigned int                                               \
2898           : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
2899                                                   (__b)))
2900#endif
2901
2902/* vec_vcfsx */
2903
2904#define vec_vcfux __builtin_altivec_vcfux
2905
2906/* vec_vcfux */
2907
2908#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
2909
2910/* vec_cts */
2911
2912#ifdef __VSX__
2913#define vec_cts(__a, __b)                                                      \
2914  _Generic((__a), vector float                                                 \
2915           : __builtin_altivec_vctsxs((vector float)(__a), (__b)),             \
2916             vector double                                                     \
2917           : __extension__({                                                   \
2918             vector double __ret =                                             \
2919                 (vector double)(__a) *                                        \
2920                 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
2921                                                            << 52);            \
2922             __builtin_convertvector(__ret, vector signed long long);          \
2923           }))
2924#else
2925#define vec_cts __builtin_altivec_vctsxs
2926#endif
2927
2928/* vec_vctsxs */
2929
2930#define vec_vctsxs __builtin_altivec_vctsxs
2931
2932/* vec_ctu */
2933
2934#ifdef __VSX__
2935#define vec_ctu(__a, __b)                                                      \
2936  _Generic((__a), vector float                                                 \
2937           : __builtin_altivec_vctuxs((vector float)(__a), (__b)),             \
2938             vector double                                                     \
2939           : __extension__({                                                   \
2940             vector double __ret =                                             \
2941                 (vector double)(__a) *                                        \
2942                 (vector double)(vector unsigned long long)((0x3ffULL + __b)   \
2943                                                            << 52);            \
2944             __builtin_convertvector(__ret, vector unsigned long long);        \
2945           }))
2946#else
2947#define vec_ctu __builtin_altivec_vctuxs
2948#endif
2949
2950/* vec_vctuxs */
2951
2952#define vec_vctuxs __builtin_altivec_vctuxs
2953
2954/* vec_signed */
2955
2956static __inline__ vector signed int __ATTRS_o_ai
2957vec_sld(vector signed int, vector signed int, unsigned const int __c);
2958
2959static __inline__ vector signed int __ATTRS_o_ai
2960vec_signed(vector float __a) {
2961  return __builtin_convertvector(__a, vector signed int);
2962}
2963
2964#ifdef __VSX__
2965static __inline__ vector signed long long __ATTRS_o_ai
2966vec_signed(vector double __a) {
2967  return __builtin_convertvector(__a, vector signed long long);
2968}
2969
2970static __inline__ vector signed int __attribute__((__always_inline__))
2971vec_signed2(vector double __a, vector double __b) {
2972  return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
2973}
2974
2975static __inline__ vector signed int __ATTRS_o_ai
2976vec_signede(vector double __a) {
2977#ifdef __LITTLE_ENDIAN__
2978  vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2979  return vec_sld(__ret, __ret, 12);
2980#else
2981  return __builtin_vsx_xvcvdpsxws(__a);
2982#endif
2983}
2984
2985static __inline__ vector signed int __ATTRS_o_ai
2986vec_signedo(vector double __a) {
2987#ifdef __LITTLE_ENDIAN__
2988  return __builtin_vsx_xvcvdpsxws(__a);
2989#else
2990  vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2991  return vec_sld(__ret, __ret, 12);
2992#endif
2993}
2994#endif
2995
2996/* vec_unsigned */
2997
2998static __inline__ vector unsigned int __ATTRS_o_ai
2999vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3000
3001static __inline__ vector unsigned int __ATTRS_o_ai
3002vec_unsigned(vector float __a) {
3003  return __builtin_convertvector(__a, vector unsigned int);
3004}
3005
3006#ifdef __VSX__
3007static __inline__ vector unsigned long long __ATTRS_o_ai
3008vec_unsigned(vector double __a) {
3009  return __builtin_convertvector(__a, vector unsigned long long);
3010}
3011
3012static __inline__ vector unsigned int __attribute__((__always_inline__))
3013vec_unsigned2(vector double __a, vector double __b) {
3014  return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3015}
3016
3017static __inline__ vector unsigned int __ATTRS_o_ai
3018vec_unsignede(vector double __a) {
3019#ifdef __LITTLE_ENDIAN__
3020  vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3021  return vec_sld(__ret, __ret, 12);
3022#else
3023  return __builtin_vsx_xvcvdpuxws(__a);
3024#endif
3025}
3026
3027static __inline__ vector unsigned int __ATTRS_o_ai
3028vec_unsignedo(vector double __a) {
3029#ifdef __LITTLE_ENDIAN__
3030  return __builtin_vsx_xvcvdpuxws(__a);
3031#else
3032  vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3033  return vec_sld(__ret, __ret, 12);
3034#endif
3035}
3036#endif
3037
3038/* vec_float */
3039
3040static __inline__ vector float __ATTRS_o_ai
3041vec_sld(vector float, vector float, unsigned const int __c);
3042
3043static __inline__ vector float __ATTRS_o_ai
3044vec_float(vector signed int __a) {
3045  return __builtin_convertvector(__a, vector float);
3046}
3047
3048static __inline__ vector float __ATTRS_o_ai
3049vec_float(vector unsigned int __a) {
3050  return __builtin_convertvector(__a, vector float);
3051}
3052
3053#ifdef __VSX__
3054static __inline__ vector float __ATTRS_o_ai
3055vec_float2(vector signed long long __a, vector signed long long __b) {
3056  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3057}
3058
3059static __inline__ vector float __ATTRS_o_ai
3060vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3061  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3062}
3063
3064static __inline__ vector float __ATTRS_o_ai
3065vec_float2(vector double __a, vector double __b) {
3066  return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3067}
3068
3069static __inline__ vector float __ATTRS_o_ai
3070vec_floate(vector signed long long __a) {
3071#ifdef __LITTLE_ENDIAN__
3072  vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3073  return vec_sld(__ret, __ret, 12);
3074#else
3075  return __builtin_vsx_xvcvsxdsp(__a);
3076#endif
3077}
3078
3079static __inline__ vector float __ATTRS_o_ai
3080vec_floate(vector unsigned long long __a) {
3081#ifdef __LITTLE_ENDIAN__
3082  vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3083  return vec_sld(__ret, __ret, 12);
3084#else
3085  return __builtin_vsx_xvcvuxdsp(__a);
3086#endif
3087}
3088
3089static __inline__ vector float __ATTRS_o_ai
3090vec_floate(vector double __a) {
3091#ifdef __LITTLE_ENDIAN__
3092  vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3093  return vec_sld(__ret, __ret, 12);
3094#else
3095  return __builtin_vsx_xvcvdpsp(__a);
3096#endif
3097}
3098
3099static __inline__ vector float __ATTRS_o_ai
3100vec_floato(vector signed long long __a) {
3101#ifdef __LITTLE_ENDIAN__
3102  return __builtin_vsx_xvcvsxdsp(__a);
3103#else
3104  vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3105  return vec_sld(__ret, __ret, 12);
3106#endif
3107}
3108
3109static __inline__ vector float __ATTRS_o_ai
3110vec_floato(vector unsigned long long __a) {
3111#ifdef __LITTLE_ENDIAN__
3112  return __builtin_vsx_xvcvuxdsp(__a);
3113#else
3114  vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3115  return vec_sld(__ret, __ret, 12);
3116#endif
3117}
3118
3119static __inline__ vector float __ATTRS_o_ai
3120vec_floato(vector double __a) {
3121#ifdef __LITTLE_ENDIAN__
3122  return __builtin_vsx_xvcvdpsp(__a);
3123#else
3124  vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3125  return vec_sld(__ret, __ret, 12);
3126#endif
3127}
3128#endif
3129
3130/* vec_double */
3131
3132#ifdef __VSX__
3133static __inline__ vector double __ATTRS_o_ai
3134vec_double(vector signed long long __a) {
3135  return __builtin_convertvector(__a, vector double);
3136}
3137
3138static __inline__ vector double __ATTRS_o_ai
3139vec_double(vector unsigned long long __a) {
3140  return __builtin_convertvector(__a, vector double);
3141}
3142
3143static __inline__ vector double __ATTRS_o_ai
3144vec_doublee(vector signed int __a) {
3145#ifdef __LITTLE_ENDIAN__
3146  return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3147#else
3148  return __builtin_vsx_xvcvsxwdp(__a);
3149#endif
3150}
3151
3152static __inline__ vector double __ATTRS_o_ai
3153vec_doublee(vector unsigned int __a) {
3154#ifdef __LITTLE_ENDIAN__
3155  return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3156#else
3157  return __builtin_vsx_xvcvuxwdp(__a);
3158#endif
3159}
3160
3161static __inline__ vector double __ATTRS_o_ai
3162vec_doublee(vector float __a) {
3163#ifdef __LITTLE_ENDIAN__
3164  return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3165#else
3166  return __builtin_vsx_xvcvspdp(__a);
3167#endif
3168}
3169
3170static __inline__ vector double __ATTRS_o_ai
3171vec_doubleh(vector signed int __a) {
3172  vector double __ret = {__a[0], __a[1]};
3173  return __ret;
3174}
3175
3176static __inline__ vector double __ATTRS_o_ai
3177vec_doubleh(vector unsigned int __a) {
3178  vector double __ret = {__a[0], __a[1]};
3179  return __ret;
3180}
3181
3182static __inline__ vector double __ATTRS_o_ai
3183vec_doubleh(vector float __a) {
3184  vector double __ret = {__a[0], __a[1]};
3185  return __ret;
3186}
3187
3188static __inline__ vector double __ATTRS_o_ai
3189vec_doublel(vector signed int __a) {
3190  vector double __ret = {__a[2], __a[3]};
3191  return __ret;
3192}
3193
3194static __inline__ vector double __ATTRS_o_ai
3195vec_doublel(vector unsigned int __a) {
3196  vector double __ret = {__a[2], __a[3]};
3197  return __ret;
3198}
3199
3200static __inline__ vector double __ATTRS_o_ai
3201vec_doublel(vector float __a) {
3202  vector double __ret = {__a[2], __a[3]};
3203  return __ret;
3204}
3205
3206static __inline__ vector double __ATTRS_o_ai
3207vec_doubleo(vector signed int __a) {
3208#ifdef __LITTLE_ENDIAN__
3209  return __builtin_vsx_xvcvsxwdp(__a);
3210#else
3211  return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3212#endif
3213}
3214
3215static __inline__ vector double __ATTRS_o_ai
3216vec_doubleo(vector unsigned int __a) {
3217#ifdef __LITTLE_ENDIAN__
3218  return __builtin_vsx_xvcvuxwdp(__a);
3219#else
3220  return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3221#endif
3222}
3223
3224static __inline__ vector double __ATTRS_o_ai
3225vec_doubleo(vector float __a) {
3226#ifdef __LITTLE_ENDIAN__
3227  return __builtin_vsx_xvcvspdp(__a);
3228#else
3229  return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3230#endif
3231}
3232#endif
3233
3234/* vec_div */
3235
3236/* Integer vector divides (vectors are scalarized, elements divided
3237   and the vectors reassembled).
3238*/
3239static __inline__ vector signed char __ATTRS_o_ai
3240vec_div(vector signed char __a, vector signed char __b) {
3241  return __a / __b;
3242}
3243
3244static __inline__ vector unsigned char __ATTRS_o_ai
3245vec_div(vector unsigned char __a, vector unsigned char __b) {
3246  return __a / __b;
3247}
3248
3249static __inline__ vector signed short __ATTRS_o_ai
3250vec_div(vector signed short __a, vector signed short __b) {
3251  return __a / __b;
3252}
3253
3254static __inline__ vector unsigned short __ATTRS_o_ai
3255vec_div(vector unsigned short __a, vector unsigned short __b) {
3256  return __a / __b;
3257}
3258
3259static __inline__ vector signed int __ATTRS_o_ai
3260vec_div(vector signed int __a, vector signed int __b) {
3261  return __a / __b;
3262}
3263
3264static __inline__ vector unsigned int __ATTRS_o_ai
3265vec_div(vector unsigned int __a, vector unsigned int __b) {
3266  return __a / __b;
3267}
3268
3269#ifdef __VSX__
3270static __inline__ vector signed long long __ATTRS_o_ai
3271vec_div(vector signed long long __a, vector signed long long __b) {
3272  return __a / __b;
3273}
3274
3275static __inline__ vector unsigned long long __ATTRS_o_ai
3276vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3277  return __a / __b;
3278}
3279
3280static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3281                                                    vector float __b) {
3282  return __a / __b;
3283}
3284
3285static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3286                                                     vector double __b) {
3287  return __a / __b;
3288}
3289#endif
3290
3291/* vec_dss */
3292
3293#define vec_dss __builtin_altivec_dss
3294
3295/* vec_dssall */
3296
3297static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3298  __builtin_altivec_dssall();
3299}
3300
3301/* vec_dst */
3302#define vec_dst(__PTR, __CW, __STR) \
3303  __extension__(                    \
3304      { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
3305
3306/* vec_dstst */
3307#define vec_dstst(__PTR, __CW, __STR) \
3308  __extension__(                      \
3309      { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
3310
3311/* vec_dststt */
3312#define vec_dststt(__PTR, __CW, __STR) \
3313  __extension__(                       \
3314      { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
3315
3316/* vec_dstt */
3317#define vec_dstt(__PTR, __CW, __STR) \
3318  __extension__(                     \
3319      { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
3320
3321/* vec_eqv */
3322
3323#ifdef __POWER8_VECTOR__
3324static __inline__ vector signed char __ATTRS_o_ai
3325vec_eqv(vector signed char __a, vector signed char __b) {
3326  return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3327                                                  (vector unsigned int)__b);
3328}
3329
3330static __inline__ vector unsigned char __ATTRS_o_ai
3331vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3332  return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3333                                                    (vector unsigned int)__b);
3334}
3335
3336static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3337                                                        vector bool char __b) {
3338  return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3339                                                (vector unsigned int)__b);
3340}
3341
3342static __inline__ vector signed short __ATTRS_o_ai
3343vec_eqv(vector signed short __a, vector signed short __b) {
3344  return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3345                                                   (vector unsigned int)__b);
3346}
3347
3348static __inline__ vector unsigned short __ATTRS_o_ai
3349vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3350  return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3351                                                     (vector unsigned int)__b);
3352}
3353
3354static __inline__ vector bool short __ATTRS_o_ai
3355vec_eqv(vector bool short __a, vector bool short __b) {
3356  return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3357                                                 (vector unsigned int)__b);
3358}
3359
3360static __inline__ vector signed int __ATTRS_o_ai
3361vec_eqv(vector signed int __a, vector signed int __b) {
3362  return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3363                                                 (vector unsigned int)__b);
3364}
3365
3366static __inline__ vector unsigned int __ATTRS_o_ai
3367vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3368  return __builtin_vsx_xxleqv(__a, __b);
3369}
3370
3371static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3372                                                       vector bool int __b) {
3373  return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3374                                               (vector unsigned int)__b);
3375}
3376
3377static __inline__ vector signed long long __ATTRS_o_ai
3378vec_eqv(vector signed long long __a, vector signed long long __b) {
3379  return (vector signed long long)__builtin_vsx_xxleqv(
3380      (vector unsigned int)__a, (vector unsigned int)__b);
3381}
3382
3383static __inline__ vector unsigned long long __ATTRS_o_ai
3384vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3385  return (vector unsigned long long)__builtin_vsx_xxleqv(
3386      (vector unsigned int)__a, (vector unsigned int)__b);
3387}
3388
3389static __inline__ vector bool long long __ATTRS_o_ai
3390vec_eqv(vector bool long long __a, vector bool long long __b) {
3391  return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3392                                                     (vector unsigned int)__b);
3393}
3394
3395static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3396                                                    vector float __b) {
3397  return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3398                                            (vector unsigned int)__b);
3399}
3400
3401static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3402                                                     vector double __b) {
3403  return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3404                                             (vector unsigned int)__b);
3405}
3406#endif
3407
3408/* vec_expte */
3409
3410static __inline__ vector float __attribute__((__always_inline__))
3411vec_expte(vector float __a) {
3412  return __builtin_altivec_vexptefp(__a);
3413}
3414
3415/* vec_vexptefp */
3416
3417static __inline__ vector float __attribute__((__always_inline__))
3418vec_vexptefp(vector float __a) {
3419  return __builtin_altivec_vexptefp(__a);
3420}
3421
3422/* vec_floor */
3423
3424static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3425#ifdef __VSX__
3426  return __builtin_vsx_xvrspim(__a);
3427#else
3428  return __builtin_altivec_vrfim(__a);
3429#endif
3430}
3431
3432#ifdef __VSX__
3433static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3434  return __builtin_vsx_xvrdpim(__a);
3435}
3436#endif
3437
3438/* vec_vrfim */
3439
3440static __inline__ vector float __attribute__((__always_inline__))
3441vec_vrfim(vector float __a) {
3442  return __builtin_altivec_vrfim(__a);
3443}
3444
3445/* vec_ld */
3446
3447static __inline__ vector signed char __ATTRS_o_ai
3448vec_ld(int __a, const vector signed char *__b) {
3449  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3450}
3451
3452static __inline__ vector signed char __ATTRS_o_ai
3453vec_ld(int __a, const signed char *__b) {
3454  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3455}
3456
3457static __inline__ vector unsigned char __ATTRS_o_ai
3458vec_ld(int __a, const vector unsigned char *__b) {
3459  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3460}
3461
3462static __inline__ vector unsigned char __ATTRS_o_ai
3463vec_ld(int __a, const unsigned char *__b) {
3464  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3465}
3466
3467static __inline__ vector bool char __ATTRS_o_ai
3468vec_ld(int __a, const vector bool char *__b) {
3469  return (vector bool char)__builtin_altivec_lvx(__a, __b);
3470}
3471
3472static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3473                                                   const vector short *__b) {
3474  return (vector short)__builtin_altivec_lvx(__a, __b);
3475}
3476
3477static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3478  return (vector short)__builtin_altivec_lvx(__a, __b);
3479}
3480
3481static __inline__ vector unsigned short __ATTRS_o_ai
3482vec_ld(int __a, const vector unsigned short *__b) {
3483  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3484}
3485
3486static __inline__ vector unsigned short __ATTRS_o_ai
3487vec_ld(int __a, const unsigned short *__b) {
3488  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3489}
3490
3491static __inline__ vector bool short __ATTRS_o_ai
3492vec_ld(int __a, const vector bool short *__b) {
3493  return (vector bool short)__builtin_altivec_lvx(__a, __b);
3494}
3495
3496static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3497                                                   const vector pixel *__b) {
3498  return (vector pixel)__builtin_altivec_lvx(__a, __b);
3499}
3500
3501static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3502                                                 const vector int *__b) {
3503  return (vector int)__builtin_altivec_lvx(__a, __b);
3504}
3505
3506static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3507  return (vector int)__builtin_altivec_lvx(__a, __b);
3508}
3509
3510static __inline__ vector unsigned int __ATTRS_o_ai
3511vec_ld(int __a, const vector unsigned int *__b) {
3512  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3513}
3514
3515static __inline__ vector unsigned int __ATTRS_o_ai
3516vec_ld(int __a, const unsigned int *__b) {
3517  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3518}
3519
3520static __inline__ vector bool int __ATTRS_o_ai
3521vec_ld(int __a, const vector bool int *__b) {
3522  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3523}
3524
3525static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3526                                                   const vector float *__b) {
3527  return (vector float)__builtin_altivec_lvx(__a, __b);
3528}
3529
3530static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3531  return (vector float)__builtin_altivec_lvx(__a, __b);
3532}
3533
3534/* vec_lvx */
3535
3536static __inline__ vector signed char __ATTRS_o_ai
3537vec_lvx(int __a, const vector signed char *__b) {
3538  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3539}
3540
3541static __inline__ vector signed char __ATTRS_o_ai
3542vec_lvx(int __a, const signed char *__b) {
3543  return (vector signed char)__builtin_altivec_lvx(__a, __b);
3544}
3545
3546static __inline__ vector unsigned char __ATTRS_o_ai
3547vec_lvx(int __a, const vector unsigned char *__b) {
3548  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3549}
3550
3551static __inline__ vector unsigned char __ATTRS_o_ai
3552vec_lvx(int __a, const unsigned char *__b) {
3553  return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3554}
3555
3556static __inline__ vector bool char __ATTRS_o_ai
3557vec_lvx(int __a, const vector bool char *__b) {
3558  return (vector bool char)__builtin_altivec_lvx(__a, __b);
3559}
3560
3561static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3562                                                    const vector short *__b) {
3563  return (vector short)__builtin_altivec_lvx(__a, __b);
3564}
3565
3566static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3567  return (vector short)__builtin_altivec_lvx(__a, __b);
3568}
3569
3570static __inline__ vector unsigned short __ATTRS_o_ai
3571vec_lvx(int __a, const vector unsigned short *__b) {
3572  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3573}
3574
3575static __inline__ vector unsigned short __ATTRS_o_ai
3576vec_lvx(int __a, const unsigned short *__b) {
3577  return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3578}
3579
3580static __inline__ vector bool short __ATTRS_o_ai
3581vec_lvx(int __a, const vector bool short *__b) {
3582  return (vector bool short)__builtin_altivec_lvx(__a, __b);
3583}
3584
3585static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3586                                                    const vector pixel *__b) {
3587  return (vector pixel)__builtin_altivec_lvx(__a, __b);
3588}
3589
3590static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3591                                                  const vector int *__b) {
3592  return (vector int)__builtin_altivec_lvx(__a, __b);
3593}
3594
3595static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3596  return (vector int)__builtin_altivec_lvx(__a, __b);
3597}
3598
3599static __inline__ vector unsigned int __ATTRS_o_ai
3600vec_lvx(int __a, const vector unsigned int *__b) {
3601  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3602}
3603
3604static __inline__ vector unsigned int __ATTRS_o_ai
3605vec_lvx(int __a, const unsigned int *__b) {
3606  return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3607}
3608
3609static __inline__ vector bool int __ATTRS_o_ai
3610vec_lvx(int __a, const vector bool int *__b) {
3611  return (vector bool int)__builtin_altivec_lvx(__a, __b);
3612}
3613
3614static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3615                                                    const vector float *__b) {
3616  return (vector float)__builtin_altivec_lvx(__a, __b);
3617}
3618
3619static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3620  return (vector float)__builtin_altivec_lvx(__a, __b);
3621}
3622
3623/* vec_lde */
3624
3625static __inline__ vector signed char __ATTRS_o_ai
3626vec_lde(int __a, const signed char *__b) {
3627  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3628}
3629
3630static __inline__ vector unsigned char __ATTRS_o_ai
3631vec_lde(int __a, const unsigned char *__b) {
3632  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3633}
3634
3635static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3636  return (vector short)__builtin_altivec_lvehx(__a, __b);
3637}
3638
3639static __inline__ vector unsigned short __ATTRS_o_ai
3640vec_lde(int __a, const unsigned short *__b) {
3641  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3642}
3643
3644static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3645  return (vector int)__builtin_altivec_lvewx(__a, __b);
3646}
3647
3648static __inline__ vector unsigned int __ATTRS_o_ai
3649vec_lde(int __a, const unsigned int *__b) {
3650  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3651}
3652
3653static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3654  return (vector float)__builtin_altivec_lvewx(__a, __b);
3655}
3656
3657/* vec_lvebx */
3658
3659static __inline__ vector signed char __ATTRS_o_ai
3660vec_lvebx(int __a, const signed char *__b) {
3661  return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3662}
3663
3664static __inline__ vector unsigned char __ATTRS_o_ai
3665vec_lvebx(int __a, const unsigned char *__b) {
3666  return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3667}
3668
3669/* vec_lvehx */
3670
3671static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3672                                                      const short *__b) {
3673  return (vector short)__builtin_altivec_lvehx(__a, __b);
3674}
3675
3676static __inline__ vector unsigned short __ATTRS_o_ai
3677vec_lvehx(int __a, const unsigned short *__b) {
3678  return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3679}
3680
3681/* vec_lvewx */
3682
3683static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3684  return (vector int)__builtin_altivec_lvewx(__a, __b);
3685}
3686
3687static __inline__ vector unsigned int __ATTRS_o_ai
3688vec_lvewx(int __a, const unsigned int *__b) {
3689  return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3690}
3691
3692static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3693                                                      const float *__b) {
3694  return (vector float)__builtin_altivec_lvewx(__a, __b);
3695}
3696
3697/* vec_ldl */
3698
3699static __inline__ vector signed char __ATTRS_o_ai
3700vec_ldl(int __a, const vector signed char *__b) {
3701  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3702}
3703
3704static __inline__ vector signed char __ATTRS_o_ai
3705vec_ldl(int __a, const signed char *__b) {
3706  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3707}
3708
3709static __inline__ vector unsigned char __ATTRS_o_ai
3710vec_ldl(int __a, const vector unsigned char *__b) {
3711  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3712}
3713
3714static __inline__ vector unsigned char __ATTRS_o_ai
3715vec_ldl(int __a, const unsigned char *__b) {
3716  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3717}
3718
3719static __inline__ vector bool char __ATTRS_o_ai
3720vec_ldl(int __a, const vector bool char *__b) {
3721  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3722}
3723
3724static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3725                                                    const vector short *__b) {
3726  return (vector short)__builtin_altivec_lvxl(__a, __b);
3727}
3728
3729static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3730  return (vector short)__builtin_altivec_lvxl(__a, __b);
3731}
3732
3733static __inline__ vector unsigned short __ATTRS_o_ai
3734vec_ldl(int __a, const vector unsigned short *__b) {
3735  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3736}
3737
3738static __inline__ vector unsigned short __ATTRS_o_ai
3739vec_ldl(int __a, const unsigned short *__b) {
3740  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3741}
3742
3743static __inline__ vector bool short __ATTRS_o_ai
3744vec_ldl(int __a, const vector bool short *__b) {
3745  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3746}
3747
3748static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3749                                                    const vector pixel *__b) {
3750  return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3751}
3752
3753static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3754                                                  const vector int *__b) {
3755  return (vector int)__builtin_altivec_lvxl(__a, __b);
3756}
3757
3758static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3759  return (vector int)__builtin_altivec_lvxl(__a, __b);
3760}
3761
3762static __inline__ vector unsigned int __ATTRS_o_ai
3763vec_ldl(int __a, const vector unsigned int *__b) {
3764  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3765}
3766
3767static __inline__ vector unsigned int __ATTRS_o_ai
3768vec_ldl(int __a, const unsigned int *__b) {
3769  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3770}
3771
3772static __inline__ vector bool int __ATTRS_o_ai
3773vec_ldl(int __a, const vector bool int *__b) {
3774  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3775}
3776
3777static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3778                                                    const vector float *__b) {
3779  return (vector float)__builtin_altivec_lvxl(__a, __b);
3780}
3781
3782static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3783  return (vector float)__builtin_altivec_lvxl(__a, __b);
3784}
3785
3786/* vec_lvxl */
3787
3788static __inline__ vector signed char __ATTRS_o_ai
3789vec_lvxl(int __a, const vector signed char *__b) {
3790  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3791}
3792
3793static __inline__ vector signed char __ATTRS_o_ai
3794vec_lvxl(int __a, const signed char *__b) {
3795  return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3796}
3797
3798static __inline__ vector unsigned char __ATTRS_o_ai
3799vec_lvxl(int __a, const vector unsigned char *__b) {
3800  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3801}
3802
3803static __inline__ vector unsigned char __ATTRS_o_ai
3804vec_lvxl(int __a, const unsigned char *__b) {
3805  return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3806}
3807
3808static __inline__ vector bool char __ATTRS_o_ai
3809vec_lvxl(int __a, const vector bool char *__b) {
3810  return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3811}
3812
3813static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3814                                                     const vector short *__b) {
3815  return (vector short)__builtin_altivec_lvxl(__a, __b);
3816}
3817
3818static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3819                                                     const short *__b) {
3820  return (vector short)__builtin_altivec_lvxl(__a, __b);
3821}
3822
3823static __inline__ vector unsigned short __ATTRS_o_ai
3824vec_lvxl(int __a, const vector unsigned short *__b) {
3825  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3826}
3827
3828static __inline__ vector unsigned short __ATTRS_o_ai
3829vec_lvxl(int __a, const unsigned short *__b) {
3830  return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3831}
3832
3833static __inline__ vector bool short __ATTRS_o_ai
3834vec_lvxl(int __a, const vector bool short *__b) {
3835  return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3836}
3837
3838static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3839                                                     const vector pixel *__b) {
3840  return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3841}
3842
3843static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3844                                                   const vector int *__b) {
3845  return (vector int)__builtin_altivec_lvxl(__a, __b);
3846}
3847
3848static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3849  return (vector int)__builtin_altivec_lvxl(__a, __b);
3850}
3851
3852static __inline__ vector unsigned int __ATTRS_o_ai
3853vec_lvxl(int __a, const vector unsigned int *__b) {
3854  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3855}
3856
3857static __inline__ vector unsigned int __ATTRS_o_ai
3858vec_lvxl(int __a, const unsigned int *__b) {
3859  return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3860}
3861
3862static __inline__ vector bool int __ATTRS_o_ai
3863vec_lvxl(int __a, const vector bool int *__b) {
3864  return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3865}
3866
3867static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3868                                                     const vector float *__b) {
3869  return (vector float)__builtin_altivec_lvxl(__a, __b);
3870}
3871
3872static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3873                                                     const float *__b) {
3874  return (vector float)__builtin_altivec_lvxl(__a, __b);
3875}
3876
3877/* vec_loge */
3878
3879static __inline__ vector float __attribute__((__always_inline__))
3880vec_loge(vector float __a) {
3881  return __builtin_altivec_vlogefp(__a);
3882}
3883
3884/* vec_vlogefp */
3885
3886static __inline__ vector float __attribute__((__always_inline__))
3887vec_vlogefp(vector float __a) {
3888  return __builtin_altivec_vlogefp(__a);
3889}
3890
3891/* vec_lvsl */
3892
3893#ifdef __LITTLE_ENDIAN__
3894static __inline__ vector unsigned char __ATTRS_o_ai
3895    __attribute__((__deprecated__("use assignment for unaligned little endian \
3896loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3897  vector unsigned char mask =
3898      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3899  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3900                                  7,  6,  5,  4,  3,  2,  1, 0};
3901  return vec_perm(mask, mask, reverse);
3902}
3903#else
3904static __inline__ vector unsigned char __ATTRS_o_ai
3905vec_lvsl(int __a, const signed char *__b) {
3906  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3907}
3908#endif
3909
3910#ifdef __LITTLE_ENDIAN__
3911static __inline__ vector unsigned char __ATTRS_o_ai
3912    __attribute__((__deprecated__("use assignment for unaligned little endian \
3913loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3914  vector unsigned char mask =
3915      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3916  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3917                                  7,  6,  5,  4,  3,  2,  1, 0};
3918  return vec_perm(mask, mask, reverse);
3919}
3920#else
3921static __inline__ vector unsigned char __ATTRS_o_ai
3922vec_lvsl(int __a, const unsigned char *__b) {
3923  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3924}
3925#endif
3926
3927#ifdef __LITTLE_ENDIAN__
3928static __inline__ vector unsigned char __ATTRS_o_ai
3929    __attribute__((__deprecated__("use assignment for unaligned little endian \
3930loads/stores"))) vec_lvsl(int __a, const short *__b) {
3931  vector unsigned char mask =
3932      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3933  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3934                                  7,  6,  5,  4,  3,  2,  1, 0};
3935  return vec_perm(mask, mask, reverse);
3936}
3937#else
3938static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3939                                                             const short *__b) {
3940  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3941}
3942#endif
3943
3944#ifdef __LITTLE_ENDIAN__
3945static __inline__ vector unsigned char __ATTRS_o_ai
3946    __attribute__((__deprecated__("use assignment for unaligned little endian \
3947loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3948  vector unsigned char mask =
3949      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3950  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3951                                  7,  6,  5,  4,  3,  2,  1, 0};
3952  return vec_perm(mask, mask, reverse);
3953}
3954#else
3955static __inline__ vector unsigned char __ATTRS_o_ai
3956vec_lvsl(int __a, const unsigned short *__b) {
3957  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3958}
3959#endif
3960
3961#ifdef __LITTLE_ENDIAN__
3962static __inline__ vector unsigned char __ATTRS_o_ai
3963    __attribute__((__deprecated__("use assignment for unaligned little endian \
3964loads/stores"))) vec_lvsl(int __a, const int *__b) {
3965  vector unsigned char mask =
3966      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3967  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3968                                  7,  6,  5,  4,  3,  2,  1, 0};
3969  return vec_perm(mask, mask, reverse);
3970}
3971#else
3972static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3973                                                             const int *__b) {
3974  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3975}
3976#endif
3977
3978#ifdef __LITTLE_ENDIAN__
3979static __inline__ vector unsigned char __ATTRS_o_ai
3980    __attribute__((__deprecated__("use assignment for unaligned little endian \
3981loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
3982  vector unsigned char mask =
3983      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3984  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3985                                  7,  6,  5,  4,  3,  2,  1, 0};
3986  return vec_perm(mask, mask, reverse);
3987}
3988#else
3989static __inline__ vector unsigned char __ATTRS_o_ai
3990vec_lvsl(int __a, const unsigned int *__b) {
3991  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3992}
3993#endif
3994
3995#ifdef __LITTLE_ENDIAN__
3996static __inline__ vector unsigned char __ATTRS_o_ai
3997    __attribute__((__deprecated__("use assignment for unaligned little endian \
3998loads/stores"))) vec_lvsl(int __a, const float *__b) {
3999  vector unsigned char mask =
4000      (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4001  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4002                                  7,  6,  5,  4,  3,  2,  1, 0};
4003  return vec_perm(mask, mask, reverse);
4004}
4005#else
4006static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4007                                                             const float *__b) {
4008  return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4009}
4010#endif
4011
4012/* vec_lvsr */
4013
4014#ifdef __LITTLE_ENDIAN__
4015static __inline__ vector unsigned char __ATTRS_o_ai
4016    __attribute__((__deprecated__("use assignment for unaligned little endian \
4017loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4018  vector unsigned char mask =
4019      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4020  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4021                                  7,  6,  5,  4,  3,  2,  1, 0};
4022  return vec_perm(mask, mask, reverse);
4023}
4024#else
4025static __inline__ vector unsigned char __ATTRS_o_ai
4026vec_lvsr(int __a, const signed char *__b) {
4027  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4028}
4029#endif
4030
4031#ifdef __LITTLE_ENDIAN__
4032static __inline__ vector unsigned char __ATTRS_o_ai
4033    __attribute__((__deprecated__("use assignment for unaligned little endian \
4034loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4035  vector unsigned char mask =
4036      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4037  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4038                                  7,  6,  5,  4,  3,  2,  1, 0};
4039  return vec_perm(mask, mask, reverse);
4040}
4041#else
4042static __inline__ vector unsigned char __ATTRS_o_ai
4043vec_lvsr(int __a, const unsigned char *__b) {
4044  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4045}
4046#endif
4047
4048#ifdef __LITTLE_ENDIAN__
4049static __inline__ vector unsigned char __ATTRS_o_ai
4050    __attribute__((__deprecated__("use assignment for unaligned little endian \
4051loads/stores"))) vec_lvsr(int __a, const short *__b) {
4052  vector unsigned char mask =
4053      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4054  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4055                                  7,  6,  5,  4,  3,  2,  1, 0};
4056  return vec_perm(mask, mask, reverse);
4057}
4058#else
4059static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4060                                                             const short *__b) {
4061  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4062}
4063#endif
4064
4065#ifdef __LITTLE_ENDIAN__
4066static __inline__ vector unsigned char __ATTRS_o_ai
4067    __attribute__((__deprecated__("use assignment for unaligned little endian \
4068loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4069  vector unsigned char mask =
4070      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4071  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4072                                  7,  6,  5,  4,  3,  2,  1, 0};
4073  return vec_perm(mask, mask, reverse);
4074}
4075#else
4076static __inline__ vector unsigned char __ATTRS_o_ai
4077vec_lvsr(int __a, const unsigned short *__b) {
4078  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4079}
4080#endif
4081
4082#ifdef __LITTLE_ENDIAN__
4083static __inline__ vector unsigned char __ATTRS_o_ai
4084    __attribute__((__deprecated__("use assignment for unaligned little endian \
4085loads/stores"))) vec_lvsr(int __a, const int *__b) {
4086  vector unsigned char mask =
4087      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4088  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4089                                  7,  6,  5,  4,  3,  2,  1, 0};
4090  return vec_perm(mask, mask, reverse);
4091}
4092#else
4093static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4094                                                             const int *__b) {
4095  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4096}
4097#endif
4098
4099#ifdef __LITTLE_ENDIAN__
4100static __inline__ vector unsigned char __ATTRS_o_ai
4101    __attribute__((__deprecated__("use assignment for unaligned little endian \
4102loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4103  vector unsigned char mask =
4104      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4105  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4106                                  7,  6,  5,  4,  3,  2,  1, 0};
4107  return vec_perm(mask, mask, reverse);
4108}
4109#else
4110static __inline__ vector unsigned char __ATTRS_o_ai
4111vec_lvsr(int __a, const unsigned int *__b) {
4112  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4113}
4114#endif
4115
4116#ifdef __LITTLE_ENDIAN__
4117static __inline__ vector unsigned char __ATTRS_o_ai
4118    __attribute__((__deprecated__("use assignment for unaligned little endian \
4119loads/stores"))) vec_lvsr(int __a, const float *__b) {
4120  vector unsigned char mask =
4121      (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4122  vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4123                                  7,  6,  5,  4,  3,  2,  1, 0};
4124  return vec_perm(mask, mask, reverse);
4125}
4126#else
4127static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4128                                                             const float *__b) {
4129  return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4130}
4131#endif
4132
4133/* vec_madd */
4134static __inline__ vector signed short __ATTRS_o_ai
4135vec_mladd(vector signed short, vector signed short, vector signed short);
4136static __inline__ vector signed short __ATTRS_o_ai
4137vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4138static __inline__ vector signed short __ATTRS_o_ai
4139vec_mladd(vector unsigned short, vector signed short, vector signed short);
4140static __inline__ vector unsigned short __ATTRS_o_ai
4141vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4142
4143static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4144    vector signed short __a, vector signed short __b, vector signed short __c) {
4145  return vec_mladd(__a, __b, __c);
4146}
4147
4148static __inline__ vector signed short __ATTRS_o_ai
4149vec_madd(vector signed short __a, vector unsigned short __b,
4150         vector unsigned short __c) {
4151  return vec_mladd(__a, __b, __c);
4152}
4153
4154static __inline__ vector signed short __ATTRS_o_ai
4155vec_madd(vector unsigned short __a, vector signed short __b,
4156         vector signed short __c) {
4157  return vec_mladd(__a, __b, __c);
4158}
4159
4160static __inline__ vector unsigned short __ATTRS_o_ai
4161vec_madd(vector unsigned short __a, vector unsigned short __b,
4162         vector unsigned short __c) {
4163  return vec_mladd(__a, __b, __c);
4164}
4165
4166static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4167                                                     vector float __b,
4168                                                     vector float __c) {
4169#ifdef __VSX__
4170  return __builtin_vsx_xvmaddasp(__a, __b, __c);
4171#else
4172  return __builtin_altivec_vmaddfp(__a, __b, __c);
4173#endif
4174}
4175
4176#ifdef __VSX__
4177static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4178                                                      vector double __b,
4179                                                      vector double __c) {
4180  return __builtin_vsx_xvmaddadp(__a, __b, __c);
4181}
4182#endif
4183
4184/* vec_vmaddfp */
4185
4186static __inline__ vector float __attribute__((__always_inline__))
4187vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4188  return __builtin_altivec_vmaddfp(__a, __b, __c);
4189}
4190
4191/* vec_madds */
4192
4193static __inline__ vector signed short __attribute__((__always_inline__))
4194vec_madds(vector signed short __a, vector signed short __b,
4195          vector signed short __c) {
4196  return __builtin_altivec_vmhaddshs(__a, __b, __c);
4197}
4198
4199/* vec_vmhaddshs */
4200static __inline__ vector signed short __attribute__((__always_inline__))
4201vec_vmhaddshs(vector signed short __a, vector signed short __b,
4202              vector signed short __c) {
4203  return __builtin_altivec_vmhaddshs(__a, __b, __c);
4204}
4205
4206/* vec_msub */
4207
4208#ifdef __VSX__
4209static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4210                                                     vector float __b,
4211                                                     vector float __c) {
4212  return __builtin_vsx_xvmsubasp(__a, __b, __c);
4213}
4214
4215static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4216                                                      vector double __b,
4217                                                      vector double __c) {
4218  return __builtin_vsx_xvmsubadp(__a, __b, __c);
4219}
4220#endif
4221
4222/* vec_max */
4223
4224static __inline__ vector signed char __ATTRS_o_ai
4225vec_max(vector signed char __a, vector signed char __b) {
4226  return __builtin_altivec_vmaxsb(__a, __b);
4227}
4228
4229static __inline__ vector signed char __ATTRS_o_ai
4230vec_max(vector bool char __a, vector signed char __b) {
4231  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4232}
4233
4234static __inline__ vector signed char __ATTRS_o_ai
4235vec_max(vector signed char __a, vector bool char __b) {
4236  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4237}
4238
4239static __inline__ vector unsigned char __ATTRS_o_ai
4240vec_max(vector unsigned char __a, vector unsigned char __b) {
4241  return __builtin_altivec_vmaxub(__a, __b);
4242}
4243
4244static __inline__ vector unsigned char __ATTRS_o_ai
4245vec_max(vector bool char __a, vector unsigned char __b) {
4246  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4247}
4248
4249static __inline__ vector unsigned char __ATTRS_o_ai
4250vec_max(vector unsigned char __a, vector bool char __b) {
4251  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4252}
4253
4254static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4255                                                    vector short __b) {
4256  return __builtin_altivec_vmaxsh(__a, __b);
4257}
4258
4259static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4260                                                    vector short __b) {
4261  return __builtin_altivec_vmaxsh((vector short)__a, __b);
4262}
4263
4264static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4265                                                    vector bool short __b) {
4266  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4267}
4268
4269static __inline__ vector unsigned short __ATTRS_o_ai
4270vec_max(vector unsigned short __a, vector unsigned short __b) {
4271  return __builtin_altivec_vmaxuh(__a, __b);
4272}
4273
4274static __inline__ vector unsigned short __ATTRS_o_ai
4275vec_max(vector bool short __a, vector unsigned short __b) {
4276  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4277}
4278
4279static __inline__ vector unsigned short __ATTRS_o_ai
4280vec_max(vector unsigned short __a, vector bool short __b) {
4281  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4282}
4283
4284static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4285                                                  vector int __b) {
4286  return __builtin_altivec_vmaxsw(__a, __b);
4287}
4288
4289static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4290                                                  vector int __b) {
4291  return __builtin_altivec_vmaxsw((vector int)__a, __b);
4292}
4293
4294static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4295                                                  vector bool int __b) {
4296  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4297}
4298
4299static __inline__ vector unsigned int __ATTRS_o_ai
4300vec_max(vector unsigned int __a, vector unsigned int __b) {
4301  return __builtin_altivec_vmaxuw(__a, __b);
4302}
4303
4304static __inline__ vector unsigned int __ATTRS_o_ai
4305vec_max(vector bool int __a, vector unsigned int __b) {
4306  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4307}
4308
4309static __inline__ vector unsigned int __ATTRS_o_ai
4310vec_max(vector unsigned int __a, vector bool int __b) {
4311  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4312}
4313
4314#ifdef __POWER8_VECTOR__
4315static __inline__ vector signed long long __ATTRS_o_ai
4316vec_max(vector signed long long __a, vector signed long long __b) {
4317  return __builtin_altivec_vmaxsd(__a, __b);
4318}
4319
4320static __inline__ vector signed long long __ATTRS_o_ai
4321vec_max(vector bool long long __a, vector signed long long __b) {
4322  return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4323}
4324
4325static __inline__ vector signed long long __ATTRS_o_ai
4326vec_max(vector signed long long __a, vector bool long long __b) {
4327  return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4328}
4329
4330static __inline__ vector unsigned long long __ATTRS_o_ai
4331vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4332  return __builtin_altivec_vmaxud(__a, __b);
4333}
4334
4335static __inline__ vector unsigned long long __ATTRS_o_ai
4336vec_max(vector bool long long __a, vector unsigned long long __b) {
4337  return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4338}
4339
4340static __inline__ vector unsigned long long __ATTRS_o_ai
4341vec_max(vector unsigned long long __a, vector bool long long __b) {
4342  return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4343}
4344#endif
4345
4346static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4347                                                    vector float __b) {
4348#ifdef __VSX__
4349  return __builtin_vsx_xvmaxsp(__a, __b);
4350#else
4351  return __builtin_altivec_vmaxfp(__a, __b);
4352#endif
4353}
4354
4355#ifdef __VSX__
4356static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4357                                                     vector double __b) {
4358  return __builtin_vsx_xvmaxdp(__a, __b);
4359}
4360#endif
4361
4362/* vec_vmaxsb */
4363
4364static __inline__ vector signed char __ATTRS_o_ai
4365vec_vmaxsb(vector signed char __a, vector signed char __b) {
4366  return __builtin_altivec_vmaxsb(__a, __b);
4367}
4368
4369static __inline__ vector signed char __ATTRS_o_ai
4370vec_vmaxsb(vector bool char __a, vector signed char __b) {
4371  return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4372}
4373
4374static __inline__ vector signed char __ATTRS_o_ai
4375vec_vmaxsb(vector signed char __a, vector bool char __b) {
4376  return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4377}
4378
4379/* vec_vmaxub */
4380
4381static __inline__ vector unsigned char __ATTRS_o_ai
4382vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4383  return __builtin_altivec_vmaxub(__a, __b);
4384}
4385
4386static __inline__ vector unsigned char __ATTRS_o_ai
4387vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4388  return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4389}
4390
4391static __inline__ vector unsigned char __ATTRS_o_ai
4392vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4393  return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4394}
4395
4396/* vec_vmaxsh */
4397
4398static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4399                                                       vector short __b) {
4400  return __builtin_altivec_vmaxsh(__a, __b);
4401}
4402
4403static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4404                                                       vector short __b) {
4405  return __builtin_altivec_vmaxsh((vector short)__a, __b);
4406}
4407
4408static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4409                                                       vector bool short __b) {
4410  return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4411}
4412
4413/* vec_vmaxuh */
4414
4415static __inline__ vector unsigned short __ATTRS_o_ai
4416vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4417  return __builtin_altivec_vmaxuh(__a, __b);
4418}
4419
4420static __inline__ vector unsigned short __ATTRS_o_ai
4421vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4422  return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4423}
4424
4425static __inline__ vector unsigned short __ATTRS_o_ai
4426vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4427  return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4428}
4429
4430/* vec_vmaxsw */
4431
4432static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4433                                                     vector int __b) {
4434  return __builtin_altivec_vmaxsw(__a, __b);
4435}
4436
4437static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4438                                                     vector int __b) {
4439  return __builtin_altivec_vmaxsw((vector int)__a, __b);
4440}
4441
4442static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4443                                                     vector bool int __b) {
4444  return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4445}
4446
4447/* vec_vmaxuw */
4448
4449static __inline__ vector unsigned int __ATTRS_o_ai
4450vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4451  return __builtin_altivec_vmaxuw(__a, __b);
4452}
4453
4454static __inline__ vector unsigned int __ATTRS_o_ai
4455vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4456  return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4457}
4458
4459static __inline__ vector unsigned int __ATTRS_o_ai
4460vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4461  return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4462}
4463
4464/* vec_vmaxfp */
4465
4466static __inline__ vector float __attribute__((__always_inline__))
4467vec_vmaxfp(vector float __a, vector float __b) {
4468#ifdef __VSX__
4469  return __builtin_vsx_xvmaxsp(__a, __b);
4470#else
4471  return __builtin_altivec_vmaxfp(__a, __b);
4472#endif
4473}
4474
4475/* vec_mergeh */
4476
4477static __inline__ vector signed char __ATTRS_o_ai
4478vec_mergeh(vector signed char __a, vector signed char __b) {
4479  return vec_perm(__a, __b,
4480                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4481                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4482                                         0x06, 0x16, 0x07, 0x17));
4483}
4484
4485static __inline__ vector unsigned char __ATTRS_o_ai
4486vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4487  return vec_perm(__a, __b,
4488                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4489                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4490                                         0x06, 0x16, 0x07, 0x17));
4491}
4492
4493static __inline__ vector bool char __ATTRS_o_ai
4494vec_mergeh(vector bool char __a, vector bool char __b) {
4495  return vec_perm(__a, __b,
4496                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4497                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4498                                         0x06, 0x16, 0x07, 0x17));
4499}
4500
4501static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4502                                                       vector short __b) {
4503  return vec_perm(__a, __b,
4504                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4505                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4506                                         0x06, 0x07, 0x16, 0x17));
4507}
4508
4509static __inline__ vector unsigned short __ATTRS_o_ai
4510vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4511  return vec_perm(__a, __b,
4512                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4513                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4514                                         0x06, 0x07, 0x16, 0x17));
4515}
4516
4517static __inline__ vector bool short __ATTRS_o_ai
4518vec_mergeh(vector bool short __a, vector bool short __b) {
4519  return vec_perm(__a, __b,
4520                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4521                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4522                                         0x06, 0x07, 0x16, 0x17));
4523}
4524
4525static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4526                                                       vector pixel __b) {
4527  return vec_perm(__a, __b,
4528                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4529                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4530                                         0x06, 0x07, 0x16, 0x17));
4531}
4532
4533static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4534                                                     vector int __b) {
4535  return vec_perm(__a, __b,
4536                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4537                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4538                                         0x14, 0x15, 0x16, 0x17));
4539}
4540
4541static __inline__ vector unsigned int __ATTRS_o_ai
4542vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4543  return vec_perm(__a, __b,
4544                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4545                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4546                                         0x14, 0x15, 0x16, 0x17));
4547}
4548
4549static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4550                                                          vector bool int __b) {
4551  return vec_perm(__a, __b,
4552                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4553                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4554                                         0x14, 0x15, 0x16, 0x17));
4555}
4556
4557static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4558                                                       vector float __b) {
4559  return vec_perm(__a, __b,
4560                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4561                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4562                                         0x14, 0x15, 0x16, 0x17));
4563}
4564
4565#ifdef __VSX__
4566static __inline__ vector signed long long __ATTRS_o_ai
4567vec_mergeh(vector signed long long __a, vector signed long long __b) {
4568  return vec_perm(__a, __b,
4569                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4570                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4571                                         0x14, 0x15, 0x16, 0x17));
4572}
4573
4574static __inline__ vector signed long long __ATTRS_o_ai
4575vec_mergeh(vector signed long long __a, vector bool long long __b) {
4576  return vec_perm(__a, (vector signed long long)__b,
4577                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4578                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4579                                         0x14, 0x15, 0x16, 0x17));
4580}
4581
4582static __inline__ vector signed long long __ATTRS_o_ai
4583vec_mergeh(vector bool long long __a, vector signed long long __b) {
4584  return vec_perm((vector signed long long)__a, __b,
4585                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4586                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4587                                         0x14, 0x15, 0x16, 0x17));
4588}
4589
4590static __inline__ vector unsigned long long __ATTRS_o_ai
4591vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4592  return vec_perm(__a, __b,
4593                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4594                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4595                                         0x14, 0x15, 0x16, 0x17));
4596}
4597
4598static __inline__ vector unsigned long long __ATTRS_o_ai
4599vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4600  return vec_perm(__a, (vector unsigned long long)__b,
4601                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4602                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4603                                         0x14, 0x15, 0x16, 0x17));
4604}
4605
4606static __inline__ vector unsigned long long __ATTRS_o_ai
4607vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4608  return vec_perm((vector unsigned long long)__a, __b,
4609                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4610                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4611                                         0x14, 0x15, 0x16, 0x17));
4612}
4613
4614static __inline__ vector bool long long __ATTRS_o_ai
4615vec_mergeh(vector bool long long __a, vector bool long long __b) {
4616  return vec_perm(__a, __b,
4617                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4618                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4619                                         0x14, 0x15, 0x16, 0x17));
4620}
4621
4622static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4623                                                        vector double __b) {
4624  return vec_perm(__a, __b,
4625                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4626                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4627                                         0x14, 0x15, 0x16, 0x17));
4628}
4629static __inline__ vector double __ATTRS_o_ai
4630vec_mergeh(vector double __a, vector bool long long __b) {
4631  return vec_perm(__a, (vector double)__b,
4632                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4633                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4634                                         0x14, 0x15, 0x16, 0x17));
4635}
4636static __inline__ vector double __ATTRS_o_ai
4637vec_mergeh(vector bool long long __a, vector double __b) {
4638  return vec_perm((vector double)__a, __b,
4639                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4640                                         0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4641                                         0x14, 0x15, 0x16, 0x17));
4642}
4643#endif
4644
4645/* vec_vmrghb */
4646
4647#define __builtin_altivec_vmrghb vec_vmrghb
4648
4649static __inline__ vector signed char __ATTRS_o_ai
4650vec_vmrghb(vector signed char __a, vector signed char __b) {
4651  return vec_perm(__a, __b,
4652                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4653                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4654                                         0x06, 0x16, 0x07, 0x17));
4655}
4656
4657static __inline__ vector unsigned char __ATTRS_o_ai
4658vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4659  return vec_perm(__a, __b,
4660                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4661                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4662                                         0x06, 0x16, 0x07, 0x17));
4663}
4664
4665static __inline__ vector bool char __ATTRS_o_ai
4666vec_vmrghb(vector bool char __a, vector bool char __b) {
4667  return vec_perm(__a, __b,
4668                  (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4669                                         0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4670                                         0x06, 0x16, 0x07, 0x17));
4671}
4672
4673/* vec_vmrghh */
4674
4675#define __builtin_altivec_vmrghh vec_vmrghh
4676
4677static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4678                                                       vector short __b) {
4679  return vec_perm(__a, __b,
4680                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4681                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4682                                         0x06, 0x07, 0x16, 0x17));
4683}
4684
4685static __inline__ vector unsigned short __ATTRS_o_ai
4686vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4687  return vec_perm(__a, __b,
4688                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4689                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4690                                         0x06, 0x07, 0x16, 0x17));
4691}
4692
4693static __inline__ vector bool short __ATTRS_o_ai
4694vec_vmrghh(vector bool short __a, vector bool short __b) {
4695  return vec_perm(__a, __b,
4696                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4697                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4698                                         0x06, 0x07, 0x16, 0x17));
4699}
4700
4701static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4702                                                       vector pixel __b) {
4703  return vec_perm(__a, __b,
4704                  (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4705                                         0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4706                                         0x06, 0x07, 0x16, 0x17));
4707}
4708
4709/* vec_vmrghw */
4710
4711#define __builtin_altivec_vmrghw vec_vmrghw
4712
4713static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4714                                                     vector int __b) {
4715  return vec_perm(__a, __b,
4716                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4717                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4718                                         0x14, 0x15, 0x16, 0x17));
4719}
4720
4721static __inline__ vector unsigned int __ATTRS_o_ai
4722vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4723  return vec_perm(__a, __b,
4724                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4725                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4726                                         0x14, 0x15, 0x16, 0x17));
4727}
4728
4729static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4730                                                          vector bool int __b) {
4731  return vec_perm(__a, __b,
4732                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4733                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4734                                         0x14, 0x15, 0x16, 0x17));
4735}
4736
4737static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4738                                                       vector float __b) {
4739  return vec_perm(__a, __b,
4740                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4741                                         0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4742                                         0x14, 0x15, 0x16, 0x17));
4743}
4744
4745/* vec_mergel */
4746
4747static __inline__ vector signed char __ATTRS_o_ai
4748vec_mergel(vector signed char __a, vector signed char __b) {
4749  return vec_perm(__a, __b,
4750                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4751                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4752                                         0x0E, 0x1E, 0x0F, 0x1F));
4753}
4754
4755static __inline__ vector unsigned char __ATTRS_o_ai
4756vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4757  return vec_perm(__a, __b,
4758                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4759                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4760                                         0x0E, 0x1E, 0x0F, 0x1F));
4761}
4762
4763static __inline__ vector bool char __ATTRS_o_ai
4764vec_mergel(vector bool char __a, vector bool char __b) {
4765  return vec_perm(__a, __b,
4766                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4767                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4768                                         0x0E, 0x1E, 0x0F, 0x1F));
4769}
4770
4771static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4772                                                       vector short __b) {
4773  return vec_perm(__a, __b,
4774                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4775                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4776                                         0x0E, 0x0F, 0x1E, 0x1F));
4777}
4778
4779static __inline__ vector unsigned short __ATTRS_o_ai
4780vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4781  return vec_perm(__a, __b,
4782                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4783                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4784                                         0x0E, 0x0F, 0x1E, 0x1F));
4785}
4786
4787static __inline__ vector bool short __ATTRS_o_ai
4788vec_mergel(vector bool short __a, vector bool short __b) {
4789  return vec_perm(__a, __b,
4790                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4791                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4792                                         0x0E, 0x0F, 0x1E, 0x1F));
4793}
4794
4795static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4796                                                       vector pixel __b) {
4797  return vec_perm(__a, __b,
4798                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4799                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4800                                         0x0E, 0x0F, 0x1E, 0x1F));
4801}
4802
4803static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4804                                                     vector int __b) {
4805  return vec_perm(__a, __b,
4806                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4807                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4808                                         0x1C, 0x1D, 0x1E, 0x1F));
4809}
4810
4811static __inline__ vector unsigned int __ATTRS_o_ai
4812vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4813  return vec_perm(__a, __b,
4814                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4815                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4816                                         0x1C, 0x1D, 0x1E, 0x1F));
4817}
4818
4819static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4820                                                          vector bool int __b) {
4821  return vec_perm(__a, __b,
4822                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4823                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4824                                         0x1C, 0x1D, 0x1E, 0x1F));
4825}
4826
4827static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4828                                                       vector float __b) {
4829  return vec_perm(__a, __b,
4830                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4831                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4832                                         0x1C, 0x1D, 0x1E, 0x1F));
4833}
4834
4835#ifdef __VSX__
4836static __inline__ vector signed long long __ATTRS_o_ai
4837vec_mergel(vector signed long long __a, vector signed long long __b) {
4838  return vec_perm(__a, __b,
4839                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4840                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4841                                         0x1C, 0x1D, 0x1E, 0x1F));
4842}
4843static __inline__ vector signed long long __ATTRS_o_ai
4844vec_mergel(vector signed long long __a, vector bool long long __b) {
4845  return vec_perm(__a, (vector signed long long)__b,
4846                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4847                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4848                                         0x1C, 0x1D, 0x1E, 0x1F));
4849}
4850static __inline__ vector signed long long __ATTRS_o_ai
4851vec_mergel(vector bool long long __a, vector signed long long __b) {
4852  return vec_perm((vector signed long long)__a, __b,
4853                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4854                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4855                                         0x1C, 0x1D, 0x1E, 0x1F));
4856}
4857static __inline__ vector unsigned long long __ATTRS_o_ai
4858vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4859  return vec_perm(__a, __b,
4860                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4861                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4862                                         0x1C, 0x1D, 0x1E, 0x1F));
4863}
4864static __inline__ vector unsigned long long __ATTRS_o_ai
4865vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4866  return vec_perm(__a, (vector unsigned long long)__b,
4867                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4868                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4869                                         0x1C, 0x1D, 0x1E, 0x1F));
4870}
4871static __inline__ vector unsigned long long __ATTRS_o_ai
4872vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4873  return vec_perm((vector unsigned long long)__a, __b,
4874                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4875                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4876                                         0x1C, 0x1D, 0x1E, 0x1F));
4877}
4878static __inline__ vector bool long long __ATTRS_o_ai
4879vec_mergel(vector bool long long __a, vector bool long long __b) {
4880  return vec_perm(__a, __b,
4881                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4882                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4883                                         0x1C, 0x1D, 0x1E, 0x1F));
4884}
4885static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4886                                                        vector double __b) {
4887  return vec_perm(__a, __b,
4888                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4889                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4890                                         0x1C, 0x1D, 0x1E, 0x1F));
4891}
4892static __inline__ vector double __ATTRS_o_ai
4893vec_mergel(vector double __a, vector bool long long __b) {
4894  return vec_perm(__a, (vector double)__b,
4895                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4896                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4897                                         0x1C, 0x1D, 0x1E, 0x1F));
4898}
4899static __inline__ vector double __ATTRS_o_ai
4900vec_mergel(vector bool long long __a, vector double __b) {
4901  return vec_perm((vector double)__a, __b,
4902                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4903                                         0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4904                                         0x1C, 0x1D, 0x1E, 0x1F));
4905}
4906#endif
4907
4908/* vec_vmrglb */
4909
4910#define __builtin_altivec_vmrglb vec_vmrglb
4911
4912static __inline__ vector signed char __ATTRS_o_ai
4913vec_vmrglb(vector signed char __a, vector signed char __b) {
4914  return vec_perm(__a, __b,
4915                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4916                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4917                                         0x0E, 0x1E, 0x0F, 0x1F));
4918}
4919
4920static __inline__ vector unsigned char __ATTRS_o_ai
4921vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4922  return vec_perm(__a, __b,
4923                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4924                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4925                                         0x0E, 0x1E, 0x0F, 0x1F));
4926}
4927
4928static __inline__ vector bool char __ATTRS_o_ai
4929vec_vmrglb(vector bool char __a, vector bool char __b) {
4930  return vec_perm(__a, __b,
4931                  (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4932                                         0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4933                                         0x0E, 0x1E, 0x0F, 0x1F));
4934}
4935
4936/* vec_vmrglh */
4937
4938#define __builtin_altivec_vmrglh vec_vmrglh
4939
4940static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4941                                                       vector short __b) {
4942  return vec_perm(__a, __b,
4943                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4944                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4945                                         0x0E, 0x0F, 0x1E, 0x1F));
4946}
4947
4948static __inline__ vector unsigned short __ATTRS_o_ai
4949vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4950  return vec_perm(__a, __b,
4951                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4952                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4953                                         0x0E, 0x0F, 0x1E, 0x1F));
4954}
4955
4956static __inline__ vector bool short __ATTRS_o_ai
4957vec_vmrglh(vector bool short __a, vector bool short __b) {
4958  return vec_perm(__a, __b,
4959                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4960                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4961                                         0x0E, 0x0F, 0x1E, 0x1F));
4962}
4963
4964static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4965                                                       vector pixel __b) {
4966  return vec_perm(__a, __b,
4967                  (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4968                                         0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4969                                         0x0E, 0x0F, 0x1E, 0x1F));
4970}
4971
4972/* vec_vmrglw */
4973
4974#define __builtin_altivec_vmrglw vec_vmrglw
4975
4976static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4977                                                     vector int __b) {
4978  return vec_perm(__a, __b,
4979                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4980                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4981                                         0x1C, 0x1D, 0x1E, 0x1F));
4982}
4983
4984static __inline__ vector unsigned int __ATTRS_o_ai
4985vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
4986  return vec_perm(__a, __b,
4987                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4988                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4989                                         0x1C, 0x1D, 0x1E, 0x1F));
4990}
4991
4992static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
4993                                                          vector bool int __b) {
4994  return vec_perm(__a, __b,
4995                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4996                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4997                                         0x1C, 0x1D, 0x1E, 0x1F));
4998}
4999
5000static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5001                                                       vector float __b) {
5002  return vec_perm(__a, __b,
5003                  (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5004                                         0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5005                                         0x1C, 0x1D, 0x1E, 0x1F));
5006}
5007
5008#ifdef __POWER8_VECTOR__
5009/* vec_mergee */
5010
5011static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5012                                                          vector bool int __b) {
5013  return vec_perm(__a, __b,
5014                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5015                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5016                                         0x18, 0x19, 0x1A, 0x1B));
5017}
5018
5019static __inline__ vector signed int __ATTRS_o_ai
5020vec_mergee(vector signed int __a, vector signed int __b) {
5021  return vec_perm(__a, __b,
5022                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5023                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5024                                         0x18, 0x19, 0x1A, 0x1B));
5025}
5026
5027static __inline__ vector unsigned int __ATTRS_o_ai
5028vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5029  return vec_perm(__a, __b,
5030                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5031                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5032                                         0x18, 0x19, 0x1A, 0x1B));
5033}
5034
5035static __inline__ vector bool long long __ATTRS_o_ai
5036vec_mergee(vector bool long long __a, vector bool long long __b) {
5037  return vec_mergeh(__a, __b);
5038}
5039
5040static __inline__ vector signed long long __ATTRS_o_ai
5041vec_mergee(vector signed long long __a, vector signed long long __b) {
5042  return vec_mergeh(__a, __b);
5043}
5044
5045static __inline__ vector unsigned long long __ATTRS_o_ai
5046vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5047  return vec_mergeh(__a, __b);
5048}
5049
5050static __inline__ vector float __ATTRS_o_ai
5051vec_mergee(vector float __a, vector float __b) {
5052  return vec_perm(__a, __b,
5053                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5054                                         0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5055                                         0x18, 0x19, 0x1A, 0x1B));
5056}
5057
5058static __inline__ vector double __ATTRS_o_ai
5059vec_mergee(vector double __a, vector double __b) {
5060  return vec_mergeh(__a, __b);
5061}
5062
5063/* vec_mergeo */
5064
5065static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5066                                                          vector bool int __b) {
5067  return vec_perm(__a, __b,
5068                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5069                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5070                                         0x1C, 0x1D, 0x1E, 0x1F));
5071}
5072
5073static __inline__ vector signed int __ATTRS_o_ai
5074vec_mergeo(vector signed int __a, vector signed int __b) {
5075  return vec_perm(__a, __b,
5076                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5077                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5078                                         0x1C, 0x1D, 0x1E, 0x1F));
5079}
5080
5081static __inline__ vector unsigned int __ATTRS_o_ai
5082vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5083  return vec_perm(__a, __b,
5084                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5085                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5086                                         0x1C, 0x1D, 0x1E, 0x1F));
5087}
5088
5089static __inline__ vector bool long long __ATTRS_o_ai
5090vec_mergeo(vector bool long long __a, vector bool long long __b) {
5091  return vec_mergel(__a, __b);
5092}
5093
5094static __inline__ vector signed long long __ATTRS_o_ai
5095vec_mergeo(vector signed long long __a, vector signed long long __b) {
5096  return vec_mergel(__a, __b);
5097}
5098
5099static __inline__ vector unsigned long long __ATTRS_o_ai
5100vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5101  return vec_mergel(__a, __b);
5102}
5103
5104static __inline__ vector float __ATTRS_o_ai
5105vec_mergeo(vector float __a, vector float __b) {
5106  return vec_perm(__a, __b,
5107                  (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5108                                         0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5109                                         0x1C, 0x1D, 0x1E, 0x1F));
5110}
5111
5112static __inline__ vector double __ATTRS_o_ai
5113vec_mergeo(vector double __a, vector double __b) {
5114  return vec_mergel(__a, __b);
5115}
5116
5117#endif
5118
5119/* vec_mfvscr */
5120
5121static __inline__ vector unsigned short __attribute__((__always_inline__))
5122vec_mfvscr(void) {
5123  return __builtin_altivec_mfvscr();
5124}
5125
5126/* vec_min */
5127
5128static __inline__ vector signed char __ATTRS_o_ai
5129vec_min(vector signed char __a, vector signed char __b) {
5130  return __builtin_altivec_vminsb(__a, __b);
5131}
5132
5133static __inline__ vector signed char __ATTRS_o_ai
5134vec_min(vector bool char __a, vector signed char __b) {
5135  return __builtin_altivec_vminsb((vector signed char)__a, __b);
5136}
5137
5138static __inline__ vector signed char __ATTRS_o_ai
5139vec_min(vector signed char __a, vector bool char __b) {
5140  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5141}
5142
5143static __inline__ vector unsigned char __ATTRS_o_ai
5144vec_min(vector unsigned char __a, vector unsigned char __b) {
5145  return __builtin_altivec_vminub(__a, __b);
5146}
5147
5148static __inline__ vector unsigned char __ATTRS_o_ai
5149vec_min(vector bool char __a, vector unsigned char __b) {
5150  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5151}
5152
5153static __inline__ vector unsigned char __ATTRS_o_ai
5154vec_min(vector unsigned char __a, vector bool char __b) {
5155  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5156}
5157
5158static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5159                                                    vector short __b) {
5160  return __builtin_altivec_vminsh(__a, __b);
5161}
5162
5163static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5164                                                    vector short __b) {
5165  return __builtin_altivec_vminsh((vector short)__a, __b);
5166}
5167
5168static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5169                                                    vector bool short __b) {
5170  return __builtin_altivec_vminsh(__a, (vector short)__b);
5171}
5172
5173static __inline__ vector unsigned short __ATTRS_o_ai
5174vec_min(vector unsigned short __a, vector unsigned short __b) {
5175  return __builtin_altivec_vminuh(__a, __b);
5176}
5177
5178static __inline__ vector unsigned short __ATTRS_o_ai
5179vec_min(vector bool short __a, vector unsigned short __b) {
5180  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5181}
5182
5183static __inline__ vector unsigned short __ATTRS_o_ai
5184vec_min(vector unsigned short __a, vector bool short __b) {
5185  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5186}
5187
5188static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5189                                                  vector int __b) {
5190  return __builtin_altivec_vminsw(__a, __b);
5191}
5192
5193static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5194                                                  vector int __b) {
5195  return __builtin_altivec_vminsw((vector int)__a, __b);
5196}
5197
5198static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5199                                                  vector bool int __b) {
5200  return __builtin_altivec_vminsw(__a, (vector int)__b);
5201}
5202
5203static __inline__ vector unsigned int __ATTRS_o_ai
5204vec_min(vector unsigned int __a, vector unsigned int __b) {
5205  return __builtin_altivec_vminuw(__a, __b);
5206}
5207
5208static __inline__ vector unsigned int __ATTRS_o_ai
5209vec_min(vector bool int __a, vector unsigned int __b) {
5210  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5211}
5212
5213static __inline__ vector unsigned int __ATTRS_o_ai
5214vec_min(vector unsigned int __a, vector bool int __b) {
5215  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5216}
5217
5218#ifdef __POWER8_VECTOR__
5219static __inline__ vector signed long long __ATTRS_o_ai
5220vec_min(vector signed long long __a, vector signed long long __b) {
5221  return __builtin_altivec_vminsd(__a, __b);
5222}
5223
5224static __inline__ vector signed long long __ATTRS_o_ai
5225vec_min(vector bool long long __a, vector signed long long __b) {
5226  return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5227}
5228
5229static __inline__ vector signed long long __ATTRS_o_ai
5230vec_min(vector signed long long __a, vector bool long long __b) {
5231  return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5232}
5233
5234static __inline__ vector unsigned long long __ATTRS_o_ai
5235vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5236  return __builtin_altivec_vminud(__a, __b);
5237}
5238
5239static __inline__ vector unsigned long long __ATTRS_o_ai
5240vec_min(vector bool long long __a, vector unsigned long long __b) {
5241  return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5242}
5243
5244static __inline__ vector unsigned long long __ATTRS_o_ai
5245vec_min(vector unsigned long long __a, vector bool long long __b) {
5246  return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5247}
5248#endif
5249
5250static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5251                                                    vector float __b) {
5252#ifdef __VSX__
5253  return __builtin_vsx_xvminsp(__a, __b);
5254#else
5255  return __builtin_altivec_vminfp(__a, __b);
5256#endif
5257}
5258
5259#ifdef __VSX__
5260static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5261                                                     vector double __b) {
5262  return __builtin_vsx_xvmindp(__a, __b);
5263}
5264#endif
5265
5266/* vec_vminsb */
5267
5268static __inline__ vector signed char __ATTRS_o_ai
5269vec_vminsb(vector signed char __a, vector signed char __b) {
5270  return __builtin_altivec_vminsb(__a, __b);
5271}
5272
5273static __inline__ vector signed char __ATTRS_o_ai
5274vec_vminsb(vector bool char __a, vector signed char __b) {
5275  return __builtin_altivec_vminsb((vector signed char)__a, __b);
5276}
5277
5278static __inline__ vector signed char __ATTRS_o_ai
5279vec_vminsb(vector signed char __a, vector bool char __b) {
5280  return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5281}
5282
5283/* vec_vminub */
5284
5285static __inline__ vector unsigned char __ATTRS_o_ai
5286vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5287  return __builtin_altivec_vminub(__a, __b);
5288}
5289
5290static __inline__ vector unsigned char __ATTRS_o_ai
5291vec_vminub(vector bool char __a, vector unsigned char __b) {
5292  return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5293}
5294
5295static __inline__ vector unsigned char __ATTRS_o_ai
5296vec_vminub(vector unsigned char __a, vector bool char __b) {
5297  return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5298}
5299
5300/* vec_vminsh */
5301
5302static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5303                                                       vector short __b) {
5304  return __builtin_altivec_vminsh(__a, __b);
5305}
5306
5307static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5308                                                       vector short __b) {
5309  return __builtin_altivec_vminsh((vector short)__a, __b);
5310}
5311
5312static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5313                                                       vector bool short __b) {
5314  return __builtin_altivec_vminsh(__a, (vector short)__b);
5315}
5316
5317/* vec_vminuh */
5318
5319static __inline__ vector unsigned short __ATTRS_o_ai
5320vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5321  return __builtin_altivec_vminuh(__a, __b);
5322}
5323
5324static __inline__ vector unsigned short __ATTRS_o_ai
5325vec_vminuh(vector bool short __a, vector unsigned short __b) {
5326  return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5327}
5328
5329static __inline__ vector unsigned short __ATTRS_o_ai
5330vec_vminuh(vector unsigned short __a, vector bool short __b) {
5331  return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5332}
5333
5334/* vec_vminsw */
5335
5336static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5337                                                     vector int __b) {
5338  return __builtin_altivec_vminsw(__a, __b);
5339}
5340
5341static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5342                                                     vector int __b) {
5343  return __builtin_altivec_vminsw((vector int)__a, __b);
5344}
5345
5346static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5347                                                     vector bool int __b) {
5348  return __builtin_altivec_vminsw(__a, (vector int)__b);
5349}
5350
5351/* vec_vminuw */
5352
5353static __inline__ vector unsigned int __ATTRS_o_ai
5354vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5355  return __builtin_altivec_vminuw(__a, __b);
5356}
5357
5358static __inline__ vector unsigned int __ATTRS_o_ai
5359vec_vminuw(vector bool int __a, vector unsigned int __b) {
5360  return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5361}
5362
5363static __inline__ vector unsigned int __ATTRS_o_ai
5364vec_vminuw(vector unsigned int __a, vector bool int __b) {
5365  return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5366}
5367
5368/* vec_vminfp */
5369
5370static __inline__ vector float __attribute__((__always_inline__))
5371vec_vminfp(vector float __a, vector float __b) {
5372#ifdef __VSX__
5373  return __builtin_vsx_xvminsp(__a, __b);
5374#else
5375  return __builtin_altivec_vminfp(__a, __b);
5376#endif
5377}
5378
5379/* vec_mladd */
5380
5381#define __builtin_altivec_vmladduhm vec_mladd
5382
5383static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5384                                                      vector short __b,
5385                                                      vector short __c) {
5386  return __a * __b + __c;
5387}
5388
5389static __inline__ vector short __ATTRS_o_ai vec_mladd(
5390    vector short __a, vector unsigned short __b, vector unsigned short __c) {
5391  return __a * (vector short)__b + (vector short)__c;
5392}
5393
5394static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5395                                                      vector short __b,
5396                                                      vector short __c) {
5397  return (vector short)__a * __b + __c;
5398}
5399
5400static __inline__ vector unsigned short __ATTRS_o_ai
5401vec_mladd(vector unsigned short __a, vector unsigned short __b,
5402          vector unsigned short __c) {
5403  return __a * __b + __c;
5404}
5405
5406/* vec_vmladduhm */
5407
5408static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5409                                                          vector short __b,
5410                                                          vector short __c) {
5411  return __a * __b + __c;
5412}
5413
5414static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5415    vector short __a, vector unsigned short __b, vector unsigned short __c) {
5416  return __a * (vector short)__b + (vector short)__c;
5417}
5418
5419static __inline__ vector short __ATTRS_o_ai
5420vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5421  return (vector short)__a * __b + __c;
5422}
5423
5424static __inline__ vector unsigned short __ATTRS_o_ai
5425vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5426              vector unsigned short __c) {
5427  return __a * __b + __c;
5428}
5429
5430/* vec_mradds */
5431
5432static __inline__ vector short __attribute__((__always_inline__))
5433vec_mradds(vector short __a, vector short __b, vector short __c) {
5434  return __builtin_altivec_vmhraddshs(__a, __b, __c);
5435}
5436
5437/* vec_vmhraddshs */
5438
5439static __inline__ vector short __attribute__((__always_inline__))
5440vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5441  return __builtin_altivec_vmhraddshs(__a, __b, __c);
5442}
5443
5444/* vec_msum */
5445
5446static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5447                                                   vector unsigned char __b,
5448                                                   vector int __c) {
5449  return __builtin_altivec_vmsummbm(__a, __b, __c);
5450}
5451
5452static __inline__ vector unsigned int __ATTRS_o_ai
5453vec_msum(vector unsigned char __a, vector unsigned char __b,
5454         vector unsigned int __c) {
5455  return __builtin_altivec_vmsumubm(__a, __b, __c);
5456}
5457
5458static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5459                                                   vector short __b,
5460                                                   vector int __c) {
5461  return __builtin_altivec_vmsumshm(__a, __b, __c);
5462}
5463
5464static __inline__ vector unsigned int __ATTRS_o_ai
5465vec_msum(vector unsigned short __a, vector unsigned short __b,
5466         vector unsigned int __c) {
5467  return __builtin_altivec_vmsumuhm(__a, __b, __c);
5468}
5469
5470/* vec_vmsummbm */
5471
5472static __inline__ vector int __attribute__((__always_inline__))
5473vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5474  return __builtin_altivec_vmsummbm(__a, __b, __c);
5475}
5476
5477/* vec_vmsumubm */
5478
5479static __inline__ vector unsigned int __attribute__((__always_inline__))
5480vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5481             vector unsigned int __c) {
5482  return __builtin_altivec_vmsumubm(__a, __b, __c);
5483}
5484
5485/* vec_vmsumshm */
5486
5487static __inline__ vector int __attribute__((__always_inline__))
5488vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5489  return __builtin_altivec_vmsumshm(__a, __b, __c);
5490}
5491
5492/* vec_vmsumuhm */
5493
5494static __inline__ vector unsigned int __attribute__((__always_inline__))
5495vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5496             vector unsigned int __c) {
5497  return __builtin_altivec_vmsumuhm(__a, __b, __c);
5498}
5499
5500/* vec_msums */
5501
5502static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5503                                                    vector short __b,
5504                                                    vector int __c) {
5505  return __builtin_altivec_vmsumshs(__a, __b, __c);
5506}
5507
5508static __inline__ vector unsigned int __ATTRS_o_ai
5509vec_msums(vector unsigned short __a, vector unsigned short __b,
5510          vector unsigned int __c) {
5511  return __builtin_altivec_vmsumuhs(__a, __b, __c);
5512}
5513
5514/* vec_vmsumshs */
5515
5516static __inline__ vector int __attribute__((__always_inline__))
5517vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5518  return __builtin_altivec_vmsumshs(__a, __b, __c);
5519}
5520
5521/* vec_vmsumuhs */
5522
5523static __inline__ vector unsigned int __attribute__((__always_inline__))
5524vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5525             vector unsigned int __c) {
5526  return __builtin_altivec_vmsumuhs(__a, __b, __c);
5527}
5528
5529/* vec_mtvscr */
5530
5531static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5532  __builtin_altivec_mtvscr((vector int)__a);
5533}
5534
5535static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5536  __builtin_altivec_mtvscr((vector int)__a);
5537}
5538
5539static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5540  __builtin_altivec_mtvscr((vector int)__a);
5541}
5542
5543static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5544  __builtin_altivec_mtvscr((vector int)__a);
5545}
5546
5547static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5548  __builtin_altivec_mtvscr((vector int)__a);
5549}
5550
5551static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5552  __builtin_altivec_mtvscr((vector int)__a);
5553}
5554
5555static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5556  __builtin_altivec_mtvscr((vector int)__a);
5557}
5558
5559static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5560  __builtin_altivec_mtvscr((vector int)__a);
5561}
5562
5563static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5564  __builtin_altivec_mtvscr((vector int)__a);
5565}
5566
5567static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5568  __builtin_altivec_mtvscr((vector int)__a);
5569}
5570
5571static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5572  __builtin_altivec_mtvscr((vector int)__a);
5573}
5574
5575/* vec_mul */
5576
5577/* Integer vector multiplication will involve multiplication of the odd/even
5578   elements separately, then truncating the results and moving to the
5579   result vector.
5580*/
5581static __inline__ vector signed char __ATTRS_o_ai
5582vec_mul(vector signed char __a, vector signed char __b) {
5583  return __a * __b;
5584}
5585
5586static __inline__ vector unsigned char __ATTRS_o_ai
5587vec_mul(vector unsigned char __a, vector unsigned char __b) {
5588  return __a * __b;
5589}
5590
5591static __inline__ vector signed short __ATTRS_o_ai
5592vec_mul(vector signed short __a, vector signed short __b) {
5593  return __a * __b;
5594}
5595
5596static __inline__ vector unsigned short __ATTRS_o_ai
5597vec_mul(vector unsigned short __a, vector unsigned short __b) {
5598  return __a * __b;
5599}
5600
5601static __inline__ vector signed int __ATTRS_o_ai
5602vec_mul(vector signed int __a, vector signed int __b) {
5603  return __a * __b;
5604}
5605
5606static __inline__ vector unsigned int __ATTRS_o_ai
5607vec_mul(vector unsigned int __a, vector unsigned int __b) {
5608  return __a * __b;
5609}
5610
5611#ifdef __VSX__
5612static __inline__ vector signed long long __ATTRS_o_ai
5613vec_mul(vector signed long long __a, vector signed long long __b) {
5614  return __a * __b;
5615}
5616
5617static __inline__ vector unsigned long long __ATTRS_o_ai
5618vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5619  return __a * __b;
5620}
5621#endif
5622
5623static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5624                                                    vector float __b) {
5625  return __a * __b;
5626}
5627
5628#ifdef __VSX__
5629static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5630                                                     vector double __b) {
5631  return __a * __b;
5632}
5633#endif
5634
5635/* The vmulos* and vmules* instructions have a big endian bias, so
5636   we must reverse the meaning of "even" and "odd" for little endian.  */
5637
5638/* vec_mule */
5639
5640static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5641                                                     vector signed char __b) {
5642#ifdef __LITTLE_ENDIAN__
5643  return __builtin_altivec_vmulosb(__a, __b);
5644#else
5645  return __builtin_altivec_vmulesb(__a, __b);
5646#endif
5647}
5648
5649static __inline__ vector unsigned short __ATTRS_o_ai
5650vec_mule(vector unsigned char __a, vector unsigned char __b) {
5651#ifdef __LITTLE_ENDIAN__
5652  return __builtin_altivec_vmuloub(__a, __b);
5653#else
5654  return __builtin_altivec_vmuleub(__a, __b);
5655#endif
5656}
5657
5658static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5659                                                   vector short __b) {
5660#ifdef __LITTLE_ENDIAN__
5661  return __builtin_altivec_vmulosh(__a, __b);
5662#else
5663  return __builtin_altivec_vmulesh(__a, __b);
5664#endif
5665}
5666
5667static __inline__ vector unsigned int __ATTRS_o_ai
5668vec_mule(vector unsigned short __a, vector unsigned short __b) {
5669#ifdef __LITTLE_ENDIAN__
5670  return __builtin_altivec_vmulouh(__a, __b);
5671#else
5672  return __builtin_altivec_vmuleuh(__a, __b);
5673#endif
5674}
5675
5676#ifdef __POWER8_VECTOR__
5677static __inline__ vector signed long long __ATTRS_o_ai
5678vec_mule(vector signed int __a, vector signed int __b) {
5679#ifdef __LITTLE_ENDIAN__
5680  return __builtin_altivec_vmulosw(__a, __b);
5681#else
5682  return __builtin_altivec_vmulesw(__a, __b);
5683#endif
5684}
5685
5686static __inline__ vector unsigned long long __ATTRS_o_ai
5687vec_mule(vector unsigned int __a, vector unsigned int __b) {
5688#ifdef __LITTLE_ENDIAN__
5689  return __builtin_altivec_vmulouw(__a, __b);
5690#else
5691  return __builtin_altivec_vmuleuw(__a, __b);
5692#endif
5693}
5694#endif
5695
5696/* vec_vmulesb */
5697
5698static __inline__ vector short __attribute__((__always_inline__))
5699vec_vmulesb(vector signed char __a, vector signed char __b) {
5700#ifdef __LITTLE_ENDIAN__
5701  return __builtin_altivec_vmulosb(__a, __b);
5702#else
5703  return __builtin_altivec_vmulesb(__a, __b);
5704#endif
5705}
5706
5707/* vec_vmuleub */
5708
5709static __inline__ vector unsigned short __attribute__((__always_inline__))
5710vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5711#ifdef __LITTLE_ENDIAN__
5712  return __builtin_altivec_vmuloub(__a, __b);
5713#else
5714  return __builtin_altivec_vmuleub(__a, __b);
5715#endif
5716}
5717
5718/* vec_vmulesh */
5719
5720static __inline__ vector int __attribute__((__always_inline__))
5721vec_vmulesh(vector short __a, vector short __b) {
5722#ifdef __LITTLE_ENDIAN__
5723  return __builtin_altivec_vmulosh(__a, __b);
5724#else
5725  return __builtin_altivec_vmulesh(__a, __b);
5726#endif
5727}
5728
5729/* vec_vmuleuh */
5730
5731static __inline__ vector unsigned int __attribute__((__always_inline__))
5732vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5733#ifdef __LITTLE_ENDIAN__
5734  return __builtin_altivec_vmulouh(__a, __b);
5735#else
5736  return __builtin_altivec_vmuleuh(__a, __b);
5737#endif
5738}
5739
5740/* vec_mulo */
5741
5742static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5743                                                     vector signed char __b) {
5744#ifdef __LITTLE_ENDIAN__
5745  return __builtin_altivec_vmulesb(__a, __b);
5746#else
5747  return __builtin_altivec_vmulosb(__a, __b);
5748#endif
5749}
5750
5751static __inline__ vector unsigned short __ATTRS_o_ai
5752vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5753#ifdef __LITTLE_ENDIAN__
5754  return __builtin_altivec_vmuleub(__a, __b);
5755#else
5756  return __builtin_altivec_vmuloub(__a, __b);
5757#endif
5758}
5759
5760static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5761                                                   vector short __b) {
5762#ifdef __LITTLE_ENDIAN__
5763  return __builtin_altivec_vmulesh(__a, __b);
5764#else
5765  return __builtin_altivec_vmulosh(__a, __b);
5766#endif
5767}
5768
5769static __inline__ vector unsigned int __ATTRS_o_ai
5770vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5771#ifdef __LITTLE_ENDIAN__
5772  return __builtin_altivec_vmuleuh(__a, __b);
5773#else
5774  return __builtin_altivec_vmulouh(__a, __b);
5775#endif
5776}
5777
5778#ifdef __POWER8_VECTOR__
5779static __inline__ vector signed long long __ATTRS_o_ai
5780vec_mulo(vector signed int __a, vector signed int __b) {
5781#ifdef __LITTLE_ENDIAN__
5782  return __builtin_altivec_vmulesw(__a, __b);
5783#else
5784  return __builtin_altivec_vmulosw(__a, __b);
5785#endif
5786}
5787
5788static __inline__ vector unsigned long long __ATTRS_o_ai
5789vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5790#ifdef __LITTLE_ENDIAN__
5791  return __builtin_altivec_vmuleuw(__a, __b);
5792#else
5793  return __builtin_altivec_vmulouw(__a, __b);
5794#endif
5795}
5796#endif
5797
5798/* vec_vmulosb */
5799
5800static __inline__ vector short __attribute__((__always_inline__))
5801vec_vmulosb(vector signed char __a, vector signed char __b) {
5802#ifdef __LITTLE_ENDIAN__
5803  return __builtin_altivec_vmulesb(__a, __b);
5804#else
5805  return __builtin_altivec_vmulosb(__a, __b);
5806#endif
5807}
5808
5809/* vec_vmuloub */
5810
5811static __inline__ vector unsigned short __attribute__((__always_inline__))
5812vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5813#ifdef __LITTLE_ENDIAN__
5814  return __builtin_altivec_vmuleub(__a, __b);
5815#else
5816  return __builtin_altivec_vmuloub(__a, __b);
5817#endif
5818}
5819
5820/* vec_vmulosh */
5821
5822static __inline__ vector int __attribute__((__always_inline__))
5823vec_vmulosh(vector short __a, vector short __b) {
5824#ifdef __LITTLE_ENDIAN__
5825  return __builtin_altivec_vmulesh(__a, __b);
5826#else
5827  return __builtin_altivec_vmulosh(__a, __b);
5828#endif
5829}
5830
5831/* vec_vmulouh */
5832
5833static __inline__ vector unsigned int __attribute__((__always_inline__))
5834vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5835#ifdef __LITTLE_ENDIAN__
5836  return __builtin_altivec_vmuleuh(__a, __b);
5837#else
5838  return __builtin_altivec_vmulouh(__a, __b);
5839#endif
5840}
5841
5842/*  vec_nand */
5843
5844#ifdef __POWER8_VECTOR__
5845static __inline__ vector signed char __ATTRS_o_ai
5846vec_nand(vector signed char __a, vector signed char __b) {
5847  return ~(__a & __b);
5848}
5849
5850static __inline__ vector signed char __ATTRS_o_ai
5851vec_nand(vector signed char __a, vector bool char __b) {
5852  return ~(__a & __b);
5853}
5854
5855static __inline__ vector signed char __ATTRS_o_ai
5856vec_nand(vector bool char __a, vector signed char __b) {
5857  return ~(__a & __b);
5858}
5859
5860static __inline__ vector unsigned char __ATTRS_o_ai
5861vec_nand(vector unsigned char __a, vector unsigned char __b) {
5862  return ~(__a & __b);
5863}
5864
5865static __inline__ vector unsigned char __ATTRS_o_ai
5866vec_nand(vector unsigned char __a, vector bool char __b) {
5867  return ~(__a & __b);
5868}
5869
5870static __inline__ vector unsigned char __ATTRS_o_ai
5871vec_nand(vector bool char __a, vector unsigned char __b) {
5872  return ~(__a & __b);
5873}
5874
5875static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5876                                                         vector bool char __b) {
5877  return ~(__a & __b);
5878}
5879
5880static __inline__ vector signed short __ATTRS_o_ai
5881vec_nand(vector signed short __a, vector signed short __b) {
5882  return ~(__a & __b);
5883}
5884
5885static __inline__ vector signed short __ATTRS_o_ai
5886vec_nand(vector signed short __a, vector bool short __b) {
5887  return ~(__a & __b);
5888}
5889
5890static __inline__ vector signed short __ATTRS_o_ai
5891vec_nand(vector bool short __a, vector signed short __b) {
5892  return ~(__a & __b);
5893}
5894
5895static __inline__ vector unsigned short __ATTRS_o_ai
5896vec_nand(vector unsigned short __a, vector unsigned short __b) {
5897  return ~(__a & __b);
5898}
5899
5900static __inline__ vector unsigned short __ATTRS_o_ai
5901vec_nand(vector unsigned short __a, vector bool short __b) {
5902  return ~(__a & __b);
5903}
5904
5905static __inline__ vector bool short __ATTRS_o_ai
5906vec_nand(vector bool short __a, vector bool short __b) {
5907  return ~(__a & __b);
5908}
5909
5910static __inline__ vector signed int __ATTRS_o_ai
5911vec_nand(vector signed int __a, vector signed int __b) {
5912  return ~(__a & __b);
5913}
5914
5915static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5916                                                          vector bool int __b) {
5917  return ~(__a & __b);
5918}
5919
5920static __inline__ vector signed int __ATTRS_o_ai
5921vec_nand(vector bool int __a, vector signed int __b) {
5922  return ~(__a & __b);
5923}
5924
5925static __inline__ vector unsigned int __ATTRS_o_ai
5926vec_nand(vector unsigned int __a, vector unsigned int __b) {
5927  return ~(__a & __b);
5928}
5929
5930static __inline__ vector unsigned int __ATTRS_o_ai
5931vec_nand(vector unsigned int __a, vector bool int __b) {
5932  return ~(__a & __b);
5933}
5934
5935static __inline__ vector unsigned int __ATTRS_o_ai
5936vec_nand(vector bool int __a, vector unsigned int __b) {
5937  return ~(__a & __b);
5938}
5939
5940static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5941                                                        vector bool int __b) {
5942  return ~(__a & __b);
5943}
5944
5945static __inline__ vector float __ATTRS_o_ai
5946vec_nand(vector float __a, vector float __b) {
5947  return (vector float)(~((vector unsigned int)__a &
5948                          (vector unsigned int)__b));
5949}
5950
5951static __inline__ vector signed long long __ATTRS_o_ai
5952vec_nand(vector signed long long __a, vector signed long long __b) {
5953  return ~(__a & __b);
5954}
5955
5956static __inline__ vector signed long long __ATTRS_o_ai
5957vec_nand(vector signed long long __a, vector bool long long __b) {
5958  return ~(__a & __b);
5959}
5960
5961static __inline__ vector signed long long __ATTRS_o_ai
5962vec_nand(vector bool long long __a, vector signed long long __b) {
5963  return ~(__a & __b);
5964}
5965
5966static __inline__ vector unsigned long long __ATTRS_o_ai
5967vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5968  return ~(__a & __b);
5969}
5970
5971static __inline__ vector unsigned long long __ATTRS_o_ai
5972vec_nand(vector unsigned long long __a, vector bool long long __b) {
5973  return ~(__a & __b);
5974}
5975
5976static __inline__ vector unsigned long long __ATTRS_o_ai
5977vec_nand(vector bool long long __a, vector unsigned long long __b) {
5978  return ~(__a & __b);
5979}
5980
5981static __inline__ vector bool long long __ATTRS_o_ai
5982vec_nand(vector bool long long __a, vector bool long long __b) {
5983  return ~(__a & __b);
5984}
5985
5986static __inline__ vector double __ATTRS_o_ai
5987vec_nand(vector double __a, vector double __b) {
5988  return (vector double)(~((vector unsigned long long)__a &
5989                           (vector unsigned long long)__b));
5990}
5991
5992#endif
5993
5994/* vec_nmadd */
5995
5996#ifdef __VSX__
5997static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
5998                                                      vector float __b,
5999                                                      vector float __c) {
6000  return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6001}
6002
6003static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6004                                                       vector double __b,
6005                                                       vector double __c) {
6006  return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6007}
6008#endif
6009
6010/* vec_nmsub */
6011
6012static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6013                                                      vector float __b,
6014                                                      vector float __c) {
6015#ifdef __VSX__
6016  return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6017#else
6018  return __builtin_altivec_vnmsubfp(__a, __b, __c);
6019#endif
6020}
6021
6022#ifdef __VSX__
6023static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6024                                                       vector double __b,
6025                                                       vector double __c) {
6026  return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6027}
6028#endif
6029
6030/* vec_vnmsubfp */
6031
6032static __inline__ vector float __attribute__((__always_inline__))
6033vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6034  return __builtin_altivec_vnmsubfp(__a, __b, __c);
6035}
6036
6037/* vec_nor */
6038
6039#define __builtin_altivec_vnor vec_nor
6040
6041static __inline__ vector signed char __ATTRS_o_ai
6042vec_nor(vector signed char __a, vector signed char __b) {
6043  return ~(__a | __b);
6044}
6045
6046static __inline__ vector unsigned char __ATTRS_o_ai
6047vec_nor(vector unsigned char __a, vector unsigned char __b) {
6048  return ~(__a | __b);
6049}
6050
6051static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6052                                                        vector bool char __b) {
6053  return ~(__a | __b);
6054}
6055
6056static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6057                                                    vector short __b) {
6058  return ~(__a | __b);
6059}
6060
6061static __inline__ vector unsigned short __ATTRS_o_ai
6062vec_nor(vector unsigned short __a, vector unsigned short __b) {
6063  return ~(__a | __b);
6064}
6065
6066static __inline__ vector bool short __ATTRS_o_ai
6067vec_nor(vector bool short __a, vector bool short __b) {
6068  return ~(__a | __b);
6069}
6070
6071static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6072                                                  vector int __b) {
6073  return ~(__a | __b);
6074}
6075
6076static __inline__ vector unsigned int __ATTRS_o_ai
6077vec_nor(vector unsigned int __a, vector unsigned int __b) {
6078  return ~(__a | __b);
6079}
6080
6081static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6082                                                       vector bool int __b) {
6083  return ~(__a | __b);
6084}
6085
6086static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6087                                                    vector float __b) {
6088  vector unsigned int __res =
6089      ~((vector unsigned int)__a | (vector unsigned int)__b);
6090  return (vector float)__res;
6091}
6092
6093#ifdef __VSX__
6094static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6095                                                     vector double __b) {
6096  vector unsigned long long __res =
6097      ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6098  return (vector double)__res;
6099}
6100#endif
6101
6102/* vec_vnor */
6103
6104static __inline__ vector signed char __ATTRS_o_ai
6105vec_vnor(vector signed char __a, vector signed char __b) {
6106  return ~(__a | __b);
6107}
6108
6109static __inline__ vector unsigned char __ATTRS_o_ai
6110vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6111  return ~(__a | __b);
6112}
6113
6114static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6115                                                         vector bool char __b) {
6116  return ~(__a | __b);
6117}
6118
6119static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6120                                                     vector short __b) {
6121  return ~(__a | __b);
6122}
6123
6124static __inline__ vector unsigned short __ATTRS_o_ai
6125vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6126  return ~(__a | __b);
6127}
6128
6129static __inline__ vector bool short __ATTRS_o_ai
6130vec_vnor(vector bool short __a, vector bool short __b) {
6131  return ~(__a | __b);
6132}
6133
6134static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6135                                                   vector int __b) {
6136  return ~(__a | __b);
6137}
6138
6139static __inline__ vector unsigned int __ATTRS_o_ai
6140vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6141  return ~(__a | __b);
6142}
6143
6144static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6145                                                        vector bool int __b) {
6146  return ~(__a | __b);
6147}
6148
6149static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6150                                                     vector float __b) {
6151  vector unsigned int __res =
6152      ~((vector unsigned int)__a | (vector unsigned int)__b);
6153  return (vector float)__res;
6154}
6155
6156#ifdef __VSX__
6157static __inline__ vector signed long long __ATTRS_o_ai
6158vec_nor(vector signed long long __a, vector signed long long __b) {
6159  return ~(__a | __b);
6160}
6161
6162static __inline__ vector unsigned long long __ATTRS_o_ai
6163vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6164  return ~(__a | __b);
6165}
6166
6167static __inline__ vector bool long long __ATTRS_o_ai
6168vec_nor(vector bool long long __a, vector bool long long __b) {
6169  return ~(__a | __b);
6170}
6171#endif
6172
6173/* vec_or */
6174
6175#define __builtin_altivec_vor vec_or
6176
6177static __inline__ vector signed char __ATTRS_o_ai
6178vec_or(vector signed char __a, vector signed char __b) {
6179  return __a | __b;
6180}
6181
6182static __inline__ vector signed char __ATTRS_o_ai
6183vec_or(vector bool char __a, vector signed char __b) {
6184  return (vector signed char)__a | __b;
6185}
6186
6187static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6188                                                         vector bool char __b) {
6189  return __a | (vector signed char)__b;
6190}
6191
6192static __inline__ vector unsigned char __ATTRS_o_ai
6193vec_or(vector unsigned char __a, vector unsigned char __b) {
6194  return __a | __b;
6195}
6196
6197static __inline__ vector unsigned char __ATTRS_o_ai
6198vec_or(vector bool char __a, vector unsigned char __b) {
6199  return (vector unsigned char)__a | __b;
6200}
6201
6202static __inline__ vector unsigned char __ATTRS_o_ai
6203vec_or(vector unsigned char __a, vector bool char __b) {
6204  return __a | (vector unsigned char)__b;
6205}
6206
6207static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6208                                                       vector bool char __b) {
6209  return __a | __b;
6210}
6211
6212static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6213                                                   vector short __b) {
6214  return __a | __b;
6215}
6216
6217static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6218                                                   vector short __b) {
6219  return (vector short)__a | __b;
6220}
6221
6222static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6223                                                   vector bool short __b) {
6224  return __a | (vector short)__b;
6225}
6226
6227static __inline__ vector unsigned short __ATTRS_o_ai
6228vec_or(vector unsigned short __a, vector unsigned short __b) {
6229  return __a | __b;
6230}
6231
6232static __inline__ vector unsigned short __ATTRS_o_ai
6233vec_or(vector bool short __a, vector unsigned short __b) {
6234  return (vector unsigned short)__a | __b;
6235}
6236
6237static __inline__ vector unsigned short __ATTRS_o_ai
6238vec_or(vector unsigned short __a, vector bool short __b) {
6239  return __a | (vector unsigned short)__b;
6240}
6241
6242static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6243                                                        vector bool short __b) {
6244  return __a | __b;
6245}
6246
6247static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6248                                                 vector int __b) {
6249  return __a | __b;
6250}
6251
6252static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6253                                                 vector int __b) {
6254  return (vector int)__a | __b;
6255}
6256
6257static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6258                                                 vector bool int __b) {
6259  return __a | (vector int)__b;
6260}
6261
6262static __inline__ vector unsigned int __ATTRS_o_ai
6263vec_or(vector unsigned int __a, vector unsigned int __b) {
6264  return __a | __b;
6265}
6266
6267static __inline__ vector unsigned int __ATTRS_o_ai
6268vec_or(vector bool int __a, vector unsigned int __b) {
6269  return (vector unsigned int)__a | __b;
6270}
6271
6272static __inline__ vector unsigned int __ATTRS_o_ai
6273vec_or(vector unsigned int __a, vector bool int __b) {
6274  return __a | (vector unsigned int)__b;
6275}
6276
6277static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6278                                                      vector bool int __b) {
6279  return __a | __b;
6280}
6281
6282static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6283                                                   vector float __b) {
6284  vector unsigned int __res =
6285      (vector unsigned int)__a | (vector unsigned int)__b;
6286  return (vector float)__res;
6287}
6288
6289static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6290                                                   vector float __b) {
6291  vector unsigned int __res =
6292      (vector unsigned int)__a | (vector unsigned int)__b;
6293  return (vector float)__res;
6294}
6295
6296static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6297                                                   vector bool int __b) {
6298  vector unsigned int __res =
6299      (vector unsigned int)__a | (vector unsigned int)__b;
6300  return (vector float)__res;
6301}
6302
6303#ifdef __VSX__
6304static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6305                                                    vector double __b) {
6306  return (vector double)((vector unsigned long long)__a |
6307                         (vector unsigned long long)__b);
6308}
6309
6310static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6311                                                    vector bool long long __b) {
6312  return (vector double)((vector unsigned long long)__a |
6313                         (vector unsigned long long)__b);
6314}
6315
6316static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6317                                                    vector double __b) {
6318  return (vector double)((vector unsigned long long)__a |
6319                         (vector unsigned long long)__b);
6320}
6321
6322static __inline__ vector signed long long __ATTRS_o_ai
6323vec_or(vector signed long long __a, vector signed long long __b) {
6324  return __a | __b;
6325}
6326
6327static __inline__ vector signed long long __ATTRS_o_ai
6328vec_or(vector bool long long __a, vector signed long long __b) {
6329  return (vector signed long long)__a | __b;
6330}
6331
6332static __inline__ vector signed long long __ATTRS_o_ai
6333vec_or(vector signed long long __a, vector bool long long __b) {
6334  return __a | (vector signed long long)__b;
6335}
6336
6337static __inline__ vector unsigned long long __ATTRS_o_ai
6338vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6339  return __a | __b;
6340}
6341
6342static __inline__ vector unsigned long long __ATTRS_o_ai
6343vec_or(vector bool long long __a, vector unsigned long long __b) {
6344  return (vector unsigned long long)__a | __b;
6345}
6346
6347static __inline__ vector unsigned long long __ATTRS_o_ai
6348vec_or(vector unsigned long long __a, vector bool long long __b) {
6349  return __a | (vector unsigned long long)__b;
6350}
6351
6352static __inline__ vector bool long long __ATTRS_o_ai
6353vec_or(vector bool long long __a, vector bool long long __b) {
6354  return __a | __b;
6355}
6356#endif
6357
6358#ifdef __POWER8_VECTOR__
6359static __inline__ vector signed char __ATTRS_o_ai
6360vec_orc(vector signed char __a, vector signed char __b) {
6361  return __a | ~__b;
6362}
6363
6364static __inline__ vector signed char __ATTRS_o_ai
6365vec_orc(vector signed char __a, vector bool char __b) {
6366  return __a | ~__b;
6367}
6368
6369static __inline__ vector signed char __ATTRS_o_ai
6370vec_orc(vector bool char __a, vector signed char __b) {
6371  return __a | ~__b;
6372}
6373
6374static __inline__ vector unsigned char __ATTRS_o_ai
6375vec_orc(vector unsigned char __a, vector unsigned char __b) {
6376  return __a | ~__b;
6377}
6378
6379static __inline__ vector unsigned char __ATTRS_o_ai
6380vec_orc(vector unsigned char __a, vector bool char __b) {
6381  return __a | ~__b;
6382}
6383
6384static __inline__ vector unsigned char __ATTRS_o_ai
6385vec_orc(vector bool char __a, vector unsigned char __b) {
6386  return __a | ~__b;
6387}
6388
6389static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6390                                                        vector bool char __b) {
6391  return __a | ~__b;
6392}
6393
6394static __inline__ vector signed short __ATTRS_o_ai
6395vec_orc(vector signed short __a, vector signed short __b) {
6396  return __a | ~__b;
6397}
6398
6399static __inline__ vector signed short __ATTRS_o_ai
6400vec_orc(vector signed short __a, vector bool short __b) {
6401  return __a | ~__b;
6402}
6403
6404static __inline__ vector signed short __ATTRS_o_ai
6405vec_orc(vector bool short __a, vector signed short __b) {
6406  return __a | ~__b;
6407}
6408
6409static __inline__ vector unsigned short __ATTRS_o_ai
6410vec_orc(vector unsigned short __a, vector unsigned short __b) {
6411  return __a | ~__b;
6412}
6413
6414static __inline__ vector unsigned short __ATTRS_o_ai
6415vec_orc(vector unsigned short __a, vector bool short __b) {
6416  return __a | ~__b;
6417}
6418
6419static __inline__ vector unsigned short __ATTRS_o_ai
6420vec_orc(vector bool short __a, vector unsigned short __b) {
6421  return __a | ~__b;
6422}
6423
6424static __inline__ vector bool short __ATTRS_o_ai
6425vec_orc(vector bool short __a, vector bool short __b) {
6426  return __a | ~__b;
6427}
6428
6429static __inline__ vector signed int __ATTRS_o_ai
6430vec_orc(vector signed int __a, vector signed int __b) {
6431  return __a | ~__b;
6432}
6433
6434static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6435                                                         vector bool int __b) {
6436  return __a | ~__b;
6437}
6438
6439static __inline__ vector signed int __ATTRS_o_ai
6440vec_orc(vector bool int __a, vector signed int __b) {
6441  return __a | ~__b;
6442}
6443
6444static __inline__ vector unsigned int __ATTRS_o_ai
6445vec_orc(vector unsigned int __a, vector unsigned int __b) {
6446  return __a | ~__b;
6447}
6448
6449static __inline__ vector unsigned int __ATTRS_o_ai
6450vec_orc(vector unsigned int __a, vector bool int __b) {
6451  return __a | ~__b;
6452}
6453
6454static __inline__ vector unsigned int __ATTRS_o_ai
6455vec_orc(vector bool int __a, vector unsigned int __b) {
6456  return __a | ~__b;
6457}
6458
6459static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6460                                                       vector bool int __b) {
6461  return __a | ~__b;
6462}
6463
6464static __inline__ vector float __ATTRS_o_ai
6465vec_orc(vector bool int __a, vector float __b) {
6466 return (vector float)(__a | ~(vector unsigned int)__b);
6467}
6468
6469static __inline__ vector float __ATTRS_o_ai
6470vec_orc(vector float __a, vector bool int __b) {
6471  return (vector float)((vector unsigned int)__a | ~__b);
6472}
6473
6474static __inline__ vector signed long long __ATTRS_o_ai
6475vec_orc(vector signed long long __a, vector signed long long __b) {
6476  return __a | ~__b;
6477}
6478
6479static __inline__ vector signed long long __ATTRS_o_ai
6480vec_orc(vector signed long long __a, vector bool long long __b) {
6481  return __a | ~__b;
6482}
6483
6484static __inline__ vector signed long long __ATTRS_o_ai
6485vec_orc(vector bool long long __a, vector signed long long __b) {
6486  return __a | ~__b;
6487}
6488
6489static __inline__ vector unsigned long long __ATTRS_o_ai
6490vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6491  return __a | ~__b;
6492}
6493
6494static __inline__ vector unsigned long long __ATTRS_o_ai
6495vec_orc(vector unsigned long long __a, vector bool long long __b) {
6496  return __a | ~__b;
6497}
6498
6499static __inline__ vector unsigned long long __ATTRS_o_ai
6500vec_orc(vector bool long long __a, vector unsigned long long __b) {
6501  return __a | ~__b;
6502}
6503
6504static __inline__ vector bool long long __ATTRS_o_ai
6505vec_orc(vector bool long long __a, vector bool long long __b) {
6506  return __a | ~__b;
6507}
6508
6509static __inline__ vector double __ATTRS_o_ai
6510vec_orc(vector double __a, vector bool long long __b) {
6511  return (vector double)((vector unsigned long long)__a | ~__b);
6512}
6513
6514static __inline__ vector double __ATTRS_o_ai
6515vec_orc(vector bool long long __a, vector double __b) {
6516  return (vector double)(__a | ~(vector unsigned long long)__b);
6517}
6518#endif
6519
6520/* vec_vor */
6521
6522static __inline__ vector signed char __ATTRS_o_ai
6523vec_vor(vector signed char __a, vector signed char __b) {
6524  return __a | __b;
6525}
6526
6527static __inline__ vector signed char __ATTRS_o_ai
6528vec_vor(vector bool char __a, vector signed char __b) {
6529  return (vector signed char)__a | __b;
6530}
6531
6532static __inline__ vector signed char __ATTRS_o_ai
6533vec_vor(vector signed char __a, vector bool char __b) {
6534  return __a | (vector signed char)__b;
6535}
6536
6537static __inline__ vector unsigned char __ATTRS_o_ai
6538vec_vor(vector unsigned char __a, vector unsigned char __b) {
6539  return __a | __b;
6540}
6541
6542static __inline__ vector unsigned char __ATTRS_o_ai
6543vec_vor(vector bool char __a, vector unsigned char __b) {
6544  return (vector unsigned char)__a | __b;
6545}
6546
6547static __inline__ vector unsigned char __ATTRS_o_ai
6548vec_vor(vector unsigned char __a, vector bool char __b) {
6549  return __a | (vector unsigned char)__b;
6550}
6551
6552static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6553                                                        vector bool char __b) {
6554  return __a | __b;
6555}
6556
6557static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6558                                                    vector short __b) {
6559  return __a | __b;
6560}
6561
6562static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6563                                                    vector short __b) {
6564  return (vector short)__a | __b;
6565}
6566
6567static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6568                                                    vector bool short __b) {
6569  return __a | (vector short)__b;
6570}
6571
6572static __inline__ vector unsigned short __ATTRS_o_ai
6573vec_vor(vector unsigned short __a, vector unsigned short __b) {
6574  return __a | __b;
6575}
6576
6577static __inline__ vector unsigned short __ATTRS_o_ai
6578vec_vor(vector bool short __a, vector unsigned short __b) {
6579  return (vector unsigned short)__a | __b;
6580}
6581
6582static __inline__ vector unsigned short __ATTRS_o_ai
6583vec_vor(vector unsigned short __a, vector bool short __b) {
6584  return __a | (vector unsigned short)__b;
6585}
6586
6587static __inline__ vector bool short __ATTRS_o_ai
6588vec_vor(vector bool short __a, vector bool short __b) {
6589  return __a | __b;
6590}
6591
6592static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6593                                                  vector int __b) {
6594  return __a | __b;
6595}
6596
6597static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6598                                                  vector int __b) {
6599  return (vector int)__a | __b;
6600}
6601
6602static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6603                                                  vector bool int __b) {
6604  return __a | (vector int)__b;
6605}
6606
6607static __inline__ vector unsigned int __ATTRS_o_ai
6608vec_vor(vector unsigned int __a, vector unsigned int __b) {
6609  return __a | __b;
6610}
6611
6612static __inline__ vector unsigned int __ATTRS_o_ai
6613vec_vor(vector bool int __a, vector unsigned int __b) {
6614  return (vector unsigned int)__a | __b;
6615}
6616
6617static __inline__ vector unsigned int __ATTRS_o_ai
6618vec_vor(vector unsigned int __a, vector bool int __b) {
6619  return __a | (vector unsigned int)__b;
6620}
6621
6622static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6623                                                       vector bool int __b) {
6624  return __a | __b;
6625}
6626
6627static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6628                                                    vector float __b) {
6629  vector unsigned int __res =
6630      (vector unsigned int)__a | (vector unsigned int)__b;
6631  return (vector float)__res;
6632}
6633
6634static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6635                                                    vector float __b) {
6636  vector unsigned int __res =
6637      (vector unsigned int)__a | (vector unsigned int)__b;
6638  return (vector float)__res;
6639}
6640
6641static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6642                                                    vector bool int __b) {
6643  vector unsigned int __res =
6644      (vector unsigned int)__a | (vector unsigned int)__b;
6645  return (vector float)__res;
6646}
6647
6648#ifdef __VSX__
6649static __inline__ vector signed long long __ATTRS_o_ai
6650vec_vor(vector signed long long __a, vector signed long long __b) {
6651  return __a | __b;
6652}
6653
6654static __inline__ vector signed long long __ATTRS_o_ai
6655vec_vor(vector bool long long __a, vector signed long long __b) {
6656  return (vector signed long long)__a | __b;
6657}
6658
6659static __inline__ vector signed long long __ATTRS_o_ai
6660vec_vor(vector signed long long __a, vector bool long long __b) {
6661  return __a | (vector signed long long)__b;
6662}
6663
6664static __inline__ vector unsigned long long __ATTRS_o_ai
6665vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6666  return __a | __b;
6667}
6668
6669static __inline__ vector unsigned long long __ATTRS_o_ai
6670vec_vor(vector bool long long __a, vector unsigned long long __b) {
6671  return (vector unsigned long long)__a | __b;
6672}
6673
6674static __inline__ vector unsigned long long __ATTRS_o_ai
6675vec_vor(vector unsigned long long __a, vector bool long long __b) {
6676  return __a | (vector unsigned long long)__b;
6677}
6678
6679static __inline__ vector bool long long __ATTRS_o_ai
6680vec_vor(vector bool long long __a, vector bool long long __b) {
6681  return __a | __b;
6682}
6683#endif
6684
6685/* vec_pack */
6686
6687/* The various vector pack instructions have a big-endian bias, so for
6688   little endian we must handle reversed element numbering.  */
6689
6690static __inline__ vector signed char __ATTRS_o_ai
6691vec_pack(vector signed short __a, vector signed short __b) {
6692#ifdef __LITTLE_ENDIAN__
6693  return (vector signed char)vec_perm(
6694      __a, __b,
6695      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6696                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6697#else
6698  return (vector signed char)vec_perm(
6699      __a, __b,
6700      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6701                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6702#endif
6703}
6704
6705static __inline__ vector unsigned char __ATTRS_o_ai
6706vec_pack(vector unsigned short __a, vector unsigned short __b) {
6707#ifdef __LITTLE_ENDIAN__
6708  return (vector unsigned char)vec_perm(
6709      __a, __b,
6710      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6711                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6712#else
6713  return (vector unsigned char)vec_perm(
6714      __a, __b,
6715      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6716                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6717#endif
6718}
6719
6720static __inline__ vector bool char __ATTRS_o_ai
6721vec_pack(vector bool short __a, vector bool short __b) {
6722#ifdef __LITTLE_ENDIAN__
6723  return (vector bool char)vec_perm(
6724      __a, __b,
6725      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6726                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6727#else
6728  return (vector bool char)vec_perm(
6729      __a, __b,
6730      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6731                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6732#endif
6733}
6734
6735static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6736                                                     vector int __b) {
6737#ifdef __LITTLE_ENDIAN__
6738  return (vector short)vec_perm(
6739      __a, __b,
6740      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6741                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6742#else
6743  return (vector short)vec_perm(
6744      __a, __b,
6745      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6746                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6747#endif
6748}
6749
6750static __inline__ vector unsigned short __ATTRS_o_ai
6751vec_pack(vector unsigned int __a, vector unsigned int __b) {
6752#ifdef __LITTLE_ENDIAN__
6753  return (vector unsigned short)vec_perm(
6754      __a, __b,
6755      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6756                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6757#else
6758  return (vector unsigned short)vec_perm(
6759      __a, __b,
6760      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6761                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6762#endif
6763}
6764
6765static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6766                                                          vector bool int __b) {
6767#ifdef __LITTLE_ENDIAN__
6768  return (vector bool short)vec_perm(
6769      __a, __b,
6770      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6771                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6772#else
6773  return (vector bool short)vec_perm(
6774      __a, __b,
6775      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6776                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6777#endif
6778}
6779
6780#ifdef __VSX__
6781static __inline__ vector signed int __ATTRS_o_ai
6782vec_pack(vector signed long long __a, vector signed long long __b) {
6783#ifdef __LITTLE_ENDIAN__
6784  return (vector signed int)vec_perm(
6785      __a, __b,
6786      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6787                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6788#else
6789  return (vector signed int)vec_perm(
6790      __a, __b,
6791      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6792                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6793#endif
6794}
6795static __inline__ vector unsigned int __ATTRS_o_ai
6796vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6797#ifdef __LITTLE_ENDIAN__
6798  return (vector unsigned int)vec_perm(
6799      __a, __b,
6800      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6801                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6802#else
6803  return (vector unsigned int)vec_perm(
6804      __a, __b,
6805      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6806                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6807#endif
6808}
6809
6810static __inline__ vector bool int __ATTRS_o_ai
6811vec_pack(vector bool long long __a, vector bool long long __b) {
6812#ifdef __LITTLE_ENDIAN__
6813  return (vector bool int)vec_perm(
6814      __a, __b,
6815      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6816                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6817#else
6818  return (vector bool int)vec_perm(
6819      __a, __b,
6820      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6821                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6822#endif
6823}
6824
6825static __inline__ vector float __ATTRS_o_ai
6826vec_pack(vector double __a, vector double __b) {
6827  return (vector float) (__a[0], __a[1], __b[0], __b[1]);
6828}
6829#endif
6830
6831#ifdef __POWER9_VECTOR__
6832static __inline__ vector unsigned short __ATTRS_o_ai
6833vec_pack_to_short_fp32(vector float __a, vector float __b) {
6834  vector float __resa = __builtin_vsx_xvcvsphp(__a);
6835  vector float __resb = __builtin_vsx_xvcvsphp(__b);
6836#ifdef __LITTLE_ENDIAN__
6837  return (vector unsigned short)vec_mergee(__resa, __resb);
6838#else
6839  return (vector unsigned short)vec_mergeo(__resa, __resb);
6840#endif
6841}
6842
6843#endif
6844/* vec_vpkuhum */
6845
6846#define __builtin_altivec_vpkuhum vec_vpkuhum
6847
6848static __inline__ vector signed char __ATTRS_o_ai
6849vec_vpkuhum(vector signed short __a, vector signed short __b) {
6850#ifdef __LITTLE_ENDIAN__
6851  return (vector signed char)vec_perm(
6852      __a, __b,
6853      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6854                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6855#else
6856  return (vector signed char)vec_perm(
6857      __a, __b,
6858      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6859                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6860#endif
6861}
6862
6863static __inline__ vector unsigned char __ATTRS_o_ai
6864vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6865#ifdef __LITTLE_ENDIAN__
6866  return (vector unsigned char)vec_perm(
6867      __a, __b,
6868      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6869                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6870#else
6871  return (vector unsigned char)vec_perm(
6872      __a, __b,
6873      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6874                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6875#endif
6876}
6877
6878static __inline__ vector bool char __ATTRS_o_ai
6879vec_vpkuhum(vector bool short __a, vector bool short __b) {
6880#ifdef __LITTLE_ENDIAN__
6881  return (vector bool char)vec_perm(
6882      __a, __b,
6883      (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6884                             0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6885#else
6886  return (vector bool char)vec_perm(
6887      __a, __b,
6888      (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6889                             0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6890#endif
6891}
6892
6893/* vec_vpkuwum */
6894
6895#define __builtin_altivec_vpkuwum vec_vpkuwum
6896
6897static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6898                                                        vector int __b) {
6899#ifdef __LITTLE_ENDIAN__
6900  return (vector short)vec_perm(
6901      __a, __b,
6902      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6903                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6904#else
6905  return (vector short)vec_perm(
6906      __a, __b,
6907      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6908                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6909#endif
6910}
6911
6912static __inline__ vector unsigned short __ATTRS_o_ai
6913vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6914#ifdef __LITTLE_ENDIAN__
6915  return (vector unsigned short)vec_perm(
6916      __a, __b,
6917      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6918                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6919#else
6920  return (vector unsigned short)vec_perm(
6921      __a, __b,
6922      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6923                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6924#endif
6925}
6926
6927static __inline__ vector bool short __ATTRS_o_ai
6928vec_vpkuwum(vector bool int __a, vector bool int __b) {
6929#ifdef __LITTLE_ENDIAN__
6930  return (vector bool short)vec_perm(
6931      __a, __b,
6932      (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6933                             0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6934#else
6935  return (vector bool short)vec_perm(
6936      __a, __b,
6937      (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6938                             0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6939#endif
6940}
6941
6942/* vec_vpkudum */
6943
6944#ifdef __POWER8_VECTOR__
6945#define __builtin_altivec_vpkudum vec_vpkudum
6946
6947static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6948                                                      vector long long __b) {
6949#ifdef __LITTLE_ENDIAN__
6950  return (vector int)vec_perm(
6951      __a, __b,
6952      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6953                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6954#else
6955  return (vector int)vec_perm(
6956      __a, __b,
6957      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6958                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6959#endif
6960}
6961
6962static __inline__ vector unsigned int __ATTRS_o_ai
6963vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6964#ifdef __LITTLE_ENDIAN__
6965  return (vector unsigned int)vec_perm(
6966      __a, __b,
6967      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6968                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6969#else
6970  return (vector unsigned int)vec_perm(
6971      __a, __b,
6972      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6973                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6974#endif
6975}
6976
6977static __inline__ vector bool int __ATTRS_o_ai
6978vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6979#ifdef __LITTLE_ENDIAN__
6980  return (vector bool int)vec_perm(
6981      (vector long long)__a, (vector long long)__b,
6982      (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6983                             0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6984#else
6985  return (vector bool int)vec_perm(
6986      (vector long long)__a, (vector long long)__b,
6987      (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6988                             0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6989#endif
6990}
6991#endif
6992
6993/* vec_packpx */
6994
6995static __inline__ vector pixel __attribute__((__always_inline__))
6996vec_packpx(vector unsigned int __a, vector unsigned int __b) {
6997#ifdef __LITTLE_ENDIAN__
6998  return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
6999#else
7000  return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7001#endif
7002}
7003
7004/* vec_vpkpx */
7005
7006static __inline__ vector pixel __attribute__((__always_inline__))
7007vec_vpkpx(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_packs */
7016
7017static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7018                                                            vector short __b) {
7019#ifdef __LITTLE_ENDIAN__
7020  return __builtin_altivec_vpkshss(__b, __a);
7021#else
7022  return __builtin_altivec_vpkshss(__a, __b);
7023#endif
7024}
7025
7026static __inline__ vector unsigned char __ATTRS_o_ai
7027vec_packs(vector unsigned short __a, vector unsigned short __b) {
7028#ifdef __LITTLE_ENDIAN__
7029  return __builtin_altivec_vpkuhus(__b, __a);
7030#else
7031  return __builtin_altivec_vpkuhus(__a, __b);
7032#endif
7033}
7034
7035static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7036                                                             vector int __b) {
7037#ifdef __LITTLE_ENDIAN__
7038  return __builtin_altivec_vpkswss(__b, __a);
7039#else
7040  return __builtin_altivec_vpkswss(__a, __b);
7041#endif
7042}
7043
7044static __inline__ vector unsigned short __ATTRS_o_ai
7045vec_packs(vector unsigned int __a, vector unsigned int __b) {
7046#ifdef __LITTLE_ENDIAN__
7047  return __builtin_altivec_vpkuwus(__b, __a);
7048#else
7049  return __builtin_altivec_vpkuwus(__a, __b);
7050#endif
7051}
7052
7053#ifdef __POWER8_VECTOR__
7054static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7055                                                    vector long long __b) {
7056#ifdef __LITTLE_ENDIAN__
7057  return __builtin_altivec_vpksdss(__b, __a);
7058#else
7059  return __builtin_altivec_vpksdss(__a, __b);
7060#endif
7061}
7062
7063static __inline__ vector unsigned int __ATTRS_o_ai
7064vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7065#ifdef __LITTLE_ENDIAN__
7066  return __builtin_altivec_vpkudus(__b, __a);
7067#else
7068  return __builtin_altivec_vpkudus(__a, __b);
7069#endif
7070}
7071#endif
7072
7073/* vec_vpkshss */
7074
7075static __inline__ vector signed char __attribute__((__always_inline__))
7076vec_vpkshss(vector short __a, vector short __b) {
7077#ifdef __LITTLE_ENDIAN__
7078  return __builtin_altivec_vpkshss(__b, __a);
7079#else
7080  return __builtin_altivec_vpkshss(__a, __b);
7081#endif
7082}
7083
7084/* vec_vpksdss */
7085
7086#ifdef __POWER8_VECTOR__
7087static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7088                                                      vector long long __b) {
7089#ifdef __LITTLE_ENDIAN__
7090  return __builtin_altivec_vpksdss(__b, __a);
7091#else
7092  return __builtin_altivec_vpksdss(__a, __b);
7093#endif
7094}
7095#endif
7096
7097/* vec_vpkuhus */
7098
7099static __inline__ vector unsigned char __attribute__((__always_inline__))
7100vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7101#ifdef __LITTLE_ENDIAN__
7102  return __builtin_altivec_vpkuhus(__b, __a);
7103#else
7104  return __builtin_altivec_vpkuhus(__a, __b);
7105#endif
7106}
7107
7108/* vec_vpkudus */
7109
7110#ifdef __POWER8_VECTOR__
7111static __inline__ vector unsigned int __attribute__((__always_inline__))
7112vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7113#ifdef __LITTLE_ENDIAN__
7114  return __builtin_altivec_vpkudus(__b, __a);
7115#else
7116  return __builtin_altivec_vpkudus(__a, __b);
7117#endif
7118}
7119#endif
7120
7121/* vec_vpkswss */
7122
7123static __inline__ vector signed short __attribute__((__always_inline__))
7124vec_vpkswss(vector int __a, vector int __b) {
7125#ifdef __LITTLE_ENDIAN__
7126  return __builtin_altivec_vpkswss(__b, __a);
7127#else
7128  return __builtin_altivec_vpkswss(__a, __b);
7129#endif
7130}
7131
7132/* vec_vpkuwus */
7133
7134static __inline__ vector unsigned short __attribute__((__always_inline__))
7135vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7136#ifdef __LITTLE_ENDIAN__
7137  return __builtin_altivec_vpkuwus(__b, __a);
7138#else
7139  return __builtin_altivec_vpkuwus(__a, __b);
7140#endif
7141}
7142
7143/* vec_packsu */
7144
7145static __inline__ vector unsigned char __ATTRS_o_ai
7146vec_packsu(vector short __a, vector short __b) {
7147#ifdef __LITTLE_ENDIAN__
7148  return __builtin_altivec_vpkshus(__b, __a);
7149#else
7150  return __builtin_altivec_vpkshus(__a, __b);
7151#endif
7152}
7153
7154static __inline__ vector unsigned char __ATTRS_o_ai
7155vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7156#ifdef __LITTLE_ENDIAN__
7157  return __builtin_altivec_vpkuhus(__b, __a);
7158#else
7159  return __builtin_altivec_vpkuhus(__a, __b);
7160#endif
7161}
7162
7163static __inline__ vector unsigned short __ATTRS_o_ai
7164vec_packsu(vector int __a, vector int __b) {
7165#ifdef __LITTLE_ENDIAN__
7166  return __builtin_altivec_vpkswus(__b, __a);
7167#else
7168  return __builtin_altivec_vpkswus(__a, __b);
7169#endif
7170}
7171
7172static __inline__ vector unsigned short __ATTRS_o_ai
7173vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7174#ifdef __LITTLE_ENDIAN__
7175  return __builtin_altivec_vpkuwus(__b, __a);
7176#else
7177  return __builtin_altivec_vpkuwus(__a, __b);
7178#endif
7179}
7180
7181#ifdef __POWER8_VECTOR__
7182static __inline__ vector unsigned int __ATTRS_o_ai
7183vec_packsu(vector long long __a, vector long long __b) {
7184#ifdef __LITTLE_ENDIAN__
7185  return __builtin_altivec_vpksdus(__b, __a);
7186#else
7187  return __builtin_altivec_vpksdus(__a, __b);
7188#endif
7189}
7190
7191static __inline__ vector unsigned int __ATTRS_o_ai
7192vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7193#ifdef __LITTLE_ENDIAN__
7194  return __builtin_altivec_vpkudus(__b, __a);
7195#else
7196  return __builtin_altivec_vpkudus(__a, __b);
7197#endif
7198}
7199#endif
7200
7201/* vec_vpkshus */
7202
7203static __inline__ vector unsigned char __ATTRS_o_ai
7204vec_vpkshus(vector short __a, vector short __b) {
7205#ifdef __LITTLE_ENDIAN__
7206  return __builtin_altivec_vpkshus(__b, __a);
7207#else
7208  return __builtin_altivec_vpkshus(__a, __b);
7209#endif
7210}
7211
7212static __inline__ vector unsigned char __ATTRS_o_ai
7213vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7214#ifdef __LITTLE_ENDIAN__
7215  return __builtin_altivec_vpkuhus(__b, __a);
7216#else
7217  return __builtin_altivec_vpkuhus(__a, __b);
7218#endif
7219}
7220
7221/* vec_vpkswus */
7222
7223static __inline__ vector unsigned short __ATTRS_o_ai
7224vec_vpkswus(vector int __a, vector int __b) {
7225#ifdef __LITTLE_ENDIAN__
7226  return __builtin_altivec_vpkswus(__b, __a);
7227#else
7228  return __builtin_altivec_vpkswus(__a, __b);
7229#endif
7230}
7231
7232static __inline__ vector unsigned short __ATTRS_o_ai
7233vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7234#ifdef __LITTLE_ENDIAN__
7235  return __builtin_altivec_vpkuwus(__b, __a);
7236#else
7237  return __builtin_altivec_vpkuwus(__a, __b);
7238#endif
7239}
7240
7241/* vec_vpksdus */
7242
7243#ifdef __POWER8_VECTOR__
7244static __inline__ vector unsigned int __ATTRS_o_ai
7245vec_vpksdus(vector long long __a, vector long long __b) {
7246#ifdef __LITTLE_ENDIAN__
7247  return __builtin_altivec_vpksdus(__b, __a);
7248#else
7249  return __builtin_altivec_vpksdus(__a, __b);
7250#endif
7251}
7252#endif
7253
7254/* vec_perm */
7255
7256// The vperm instruction is defined architecturally with a big-endian bias.
7257// For little endian, we swap the input operands and invert the permute
7258// control vector.  Only the rightmost 5 bits matter, so we could use
7259// a vector of all 31s instead of all 255s to perform the inversion.
7260// However, when the PCV is not a constant, using 255 has an advantage
7261// in that the vec_xor can be recognized as a vec_nor (and for P8 and
7262// later, possibly a vec_nand).
7263
7264static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7265    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7266#ifdef __LITTLE_ENDIAN__
7267  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7268                              255, 255, 255, 255, 255, 255, 255, 255};
7269  __d = vec_xor(__c, __d);
7270  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7271                                                         (vector int)__a, __d);
7272#else
7273  return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7274                                                         (vector int)__b, __c);
7275#endif
7276}
7277
7278static __inline__ vector unsigned char __ATTRS_o_ai
7279vec_perm(vector unsigned char __a, vector unsigned char __b,
7280         vector unsigned char __c) {
7281#ifdef __LITTLE_ENDIAN__
7282  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7283                              255, 255, 255, 255, 255, 255, 255, 255};
7284  __d = vec_xor(__c, __d);
7285  return (vector unsigned char)__builtin_altivec_vperm_4si(
7286      (vector int)__b, (vector int)__a, __d);
7287#else
7288  return (vector unsigned char)__builtin_altivec_vperm_4si(
7289      (vector int)__a, (vector int)__b, __c);
7290#endif
7291}
7292
7293static __inline__ vector bool char __ATTRS_o_ai
7294vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7295#ifdef __LITTLE_ENDIAN__
7296  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7297                              255, 255, 255, 255, 255, 255, 255, 255};
7298  __d = vec_xor(__c, __d);
7299  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7300                                                       (vector int)__a, __d);
7301#else
7302  return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7303                                                       (vector int)__b, __c);
7304#endif
7305}
7306
7307static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7308                                                     vector signed short __b,
7309                                                     vector unsigned char __c) {
7310#ifdef __LITTLE_ENDIAN__
7311  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7312                              255, 255, 255, 255, 255, 255, 255, 255};
7313  __d = vec_xor(__c, __d);
7314  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7315                                                          (vector int)__a, __d);
7316#else
7317  return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7318                                                          (vector int)__b, __c);
7319#endif
7320}
7321
7322static __inline__ vector unsigned short __ATTRS_o_ai
7323vec_perm(vector unsigned short __a, vector unsigned short __b,
7324         vector unsigned char __c) {
7325#ifdef __LITTLE_ENDIAN__
7326  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7327                              255, 255, 255, 255, 255, 255, 255, 255};
7328  __d = vec_xor(__c, __d);
7329  return (vector unsigned short)__builtin_altivec_vperm_4si(
7330      (vector int)__b, (vector int)__a, __d);
7331#else
7332  return (vector unsigned short)__builtin_altivec_vperm_4si(
7333      (vector int)__a, (vector int)__b, __c);
7334#endif
7335}
7336
7337static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7338    vector bool short __a, vector bool short __b, vector unsigned char __c) {
7339#ifdef __LITTLE_ENDIAN__
7340  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7341                              255, 255, 255, 255, 255, 255, 255, 255};
7342  __d = vec_xor(__c, __d);
7343  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7344                                                        (vector int)__a, __d);
7345#else
7346  return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7347                                                        (vector int)__b, __c);
7348#endif
7349}
7350
7351static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7352                                                     vector pixel __b,
7353                                                     vector unsigned char __c) {
7354#ifdef __LITTLE_ENDIAN__
7355  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7356                              255, 255, 255, 255, 255, 255, 255, 255};
7357  __d = vec_xor(__c, __d);
7358  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7359                                                   (vector int)__a, __d);
7360#else
7361  return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7362                                                   (vector int)__b, __c);
7363#endif
7364}
7365
7366static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7367                                                   vector signed int __b,
7368                                                   vector unsigned char __c) {
7369#ifdef __LITTLE_ENDIAN__
7370  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7371                              255, 255, 255, 255, 255, 255, 255, 255};
7372  __d = vec_xor(__c, __d);
7373  return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7374#else
7375  return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7376#endif
7377}
7378
7379static __inline__ vector unsigned int __ATTRS_o_ai
7380vec_perm(vector unsigned int __a, vector unsigned int __b,
7381         vector unsigned char __c) {
7382#ifdef __LITTLE_ENDIAN__
7383  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7384                              255, 255, 255, 255, 255, 255, 255, 255};
7385  __d = vec_xor(__c, __d);
7386  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7387                                                          (vector int)__a, __d);
7388#else
7389  return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7390                                                          (vector int)__b, __c);
7391#endif
7392}
7393
7394static __inline__ vector bool int __ATTRS_o_ai
7395vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7396#ifdef __LITTLE_ENDIAN__
7397  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7398                              255, 255, 255, 255, 255, 255, 255, 255};
7399  __d = vec_xor(__c, __d);
7400  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7401                                                      (vector int)__a, __d);
7402#else
7403  return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7404                                                      (vector int)__b, __c);
7405#endif
7406}
7407
7408static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7409                                                     vector float __b,
7410                                                     vector unsigned char __c) {
7411#ifdef __LITTLE_ENDIAN__
7412  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7413                              255, 255, 255, 255, 255, 255, 255, 255};
7414  __d = vec_xor(__c, __d);
7415  return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7416                                                   (vector int)__a, __d);
7417#else
7418  return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7419                                                   (vector int)__b, __c);
7420#endif
7421}
7422
7423#ifdef __VSX__
7424static __inline__ vector long long __ATTRS_o_ai
7425vec_perm(vector signed long long __a, vector signed long long __b,
7426         vector unsigned char __c) {
7427#ifdef __LITTLE_ENDIAN__
7428  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7429                              255, 255, 255, 255, 255, 255, 255, 255};
7430  __d = vec_xor(__c, __d);
7431  return (vector signed long long)__builtin_altivec_vperm_4si(
7432      (vector int)__b, (vector int)__a, __d);
7433#else
7434  return (vector signed long long)__builtin_altivec_vperm_4si(
7435      (vector int)__a, (vector int)__b, __c);
7436#endif
7437}
7438
7439static __inline__ vector unsigned long long __ATTRS_o_ai
7440vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7441         vector unsigned char __c) {
7442#ifdef __LITTLE_ENDIAN__
7443  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7444                              255, 255, 255, 255, 255, 255, 255, 255};
7445  __d = vec_xor(__c, __d);
7446  return (vector unsigned long long)__builtin_altivec_vperm_4si(
7447      (vector int)__b, (vector int)__a, __d);
7448#else
7449  return (vector unsigned long long)__builtin_altivec_vperm_4si(
7450      (vector int)__a, (vector int)__b, __c);
7451#endif
7452}
7453
7454static __inline__ vector bool long long __ATTRS_o_ai
7455vec_perm(vector bool long long __a, vector bool long long __b,
7456         vector unsigned char __c) {
7457#ifdef __LITTLE_ENDIAN__
7458  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7459                              255, 255, 255, 255, 255, 255, 255, 255};
7460  __d = vec_xor(__c, __d);
7461  return (vector bool long long)__builtin_altivec_vperm_4si(
7462      (vector int)__b, (vector int)__a, __d);
7463#else
7464  return (vector bool long long)__builtin_altivec_vperm_4si(
7465      (vector int)__a, (vector int)__b, __c);
7466#endif
7467}
7468
7469static __inline__ vector double __ATTRS_o_ai
7470vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7471#ifdef __LITTLE_ENDIAN__
7472  vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7473                              255, 255, 255, 255, 255, 255, 255, 255};
7474  __d = vec_xor(__c, __d);
7475  return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7476                                                    (vector int)__a, __d);
7477#else
7478  return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7479                                                    (vector int)__b, __c);
7480#endif
7481}
7482#endif
7483
7484/* vec_vperm */
7485
7486static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7487    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7488  return vec_perm(__a, __b, __c);
7489}
7490
7491static __inline__ vector unsigned char __ATTRS_o_ai
7492vec_vperm(vector unsigned char __a, vector unsigned char __b,
7493          vector unsigned char __c) {
7494  return vec_perm(__a, __b, __c);
7495}
7496
7497static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7498    vector bool char __a, vector bool char __b, vector unsigned char __c) {
7499  return vec_perm(__a, __b, __c);
7500}
7501
7502static __inline__ vector short __ATTRS_o_ai
7503vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7504  return vec_perm(__a, __b, __c);
7505}
7506
7507static __inline__ vector unsigned short __ATTRS_o_ai
7508vec_vperm(vector unsigned short __a, vector unsigned short __b,
7509          vector unsigned char __c) {
7510  return vec_perm(__a, __b, __c);
7511}
7512
7513static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7514    vector bool short __a, vector bool short __b, vector unsigned char __c) {
7515  return vec_perm(__a, __b, __c);
7516}
7517
7518static __inline__ vector pixel __ATTRS_o_ai
7519vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7520  return vec_perm(__a, __b, __c);
7521}
7522
7523static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7524                                                    vector int __b,
7525                                                    vector unsigned char __c) {
7526  return vec_perm(__a, __b, __c);
7527}
7528
7529static __inline__ vector unsigned int __ATTRS_o_ai
7530vec_vperm(vector unsigned int __a, vector unsigned int __b,
7531          vector unsigned char __c) {
7532  return vec_perm(__a, __b, __c);
7533}
7534
7535static __inline__ vector bool int __ATTRS_o_ai
7536vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7537  return vec_perm(__a, __b, __c);
7538}
7539
7540static __inline__ vector float __ATTRS_o_ai
7541vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7542  return vec_perm(__a, __b, __c);
7543}
7544
7545#ifdef __VSX__
7546static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7547    vector long long __a, vector long long __b, vector unsigned char __c) {
7548  return vec_perm(__a, __b, __c);
7549}
7550
7551static __inline__ vector unsigned long long __ATTRS_o_ai
7552vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7553          vector unsigned char __c) {
7554  return vec_perm(__a, __b, __c);
7555}
7556
7557static __inline__ vector double __ATTRS_o_ai
7558vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7559  return vec_perm(__a, __b, __c);
7560}
7561#endif
7562
7563/* vec_re */
7564
7565static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7566#ifdef __VSX__
7567  return __builtin_vsx_xvresp(__a);
7568#else
7569  return __builtin_altivec_vrefp(__a);
7570#endif
7571}
7572
7573#ifdef __VSX__
7574static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7575  return __builtin_vsx_xvredp(__a);
7576}
7577#endif
7578
7579/* vec_vrefp */
7580
7581static __inline__ vector float __attribute__((__always_inline__))
7582vec_vrefp(vector float __a) {
7583  return __builtin_altivec_vrefp(__a);
7584}
7585
7586/* vec_rl */
7587
7588static __inline__ vector signed char __ATTRS_o_ai
7589vec_rl(vector signed char __a, vector unsigned char __b) {
7590  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7591}
7592
7593static __inline__ vector unsigned char __ATTRS_o_ai
7594vec_rl(vector unsigned char __a, vector unsigned char __b) {
7595  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7596}
7597
7598static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7599                                                   vector unsigned short __b) {
7600  return __builtin_altivec_vrlh(__a, __b);
7601}
7602
7603static __inline__ vector unsigned short __ATTRS_o_ai
7604vec_rl(vector unsigned short __a, vector unsigned short __b) {
7605  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7606}
7607
7608static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7609                                                 vector unsigned int __b) {
7610  return __builtin_altivec_vrlw(__a, __b);
7611}
7612
7613static __inline__ vector unsigned int __ATTRS_o_ai
7614vec_rl(vector unsigned int __a, vector unsigned int __b) {
7615  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7616}
7617
7618#ifdef __POWER8_VECTOR__
7619static __inline__ vector signed long long __ATTRS_o_ai
7620vec_rl(vector signed long long __a, vector unsigned long long __b) {
7621  return __builtin_altivec_vrld(__a, __b);
7622}
7623
7624static __inline__ vector unsigned long long __ATTRS_o_ai
7625vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7626  return __builtin_altivec_vrld(__a, __b);
7627}
7628#endif
7629
7630/* vec_rlmi */
7631#ifdef __POWER9_VECTOR__
7632static __inline__ vector unsigned int __ATTRS_o_ai
7633vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7634         vector unsigned int __c) {
7635  return __builtin_altivec_vrlwmi(__a, __c, __b);
7636}
7637
7638static __inline__ vector unsigned long long __ATTRS_o_ai
7639vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7640         vector unsigned long long __c) {
7641  return __builtin_altivec_vrldmi(__a, __c, __b);
7642}
7643
7644/* vec_rlnm */
7645static __inline__ vector unsigned int __ATTRS_o_ai
7646vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7647         vector unsigned int __c) {
7648  vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
7649  return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7650}
7651
7652static __inline__ vector unsigned long long __ATTRS_o_ai
7653vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7654         vector unsigned long long __c) {
7655  vector unsigned long long OneByte = { 0x8, 0x8 };
7656  return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7657}
7658#endif
7659
7660/* vec_vrlb */
7661
7662static __inline__ vector signed char __ATTRS_o_ai
7663vec_vrlb(vector signed char __a, vector unsigned char __b) {
7664  return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7665}
7666
7667static __inline__ vector unsigned char __ATTRS_o_ai
7668vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7669  return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7670}
7671
7672/* vec_vrlh */
7673
7674static __inline__ vector short __ATTRS_o_ai
7675vec_vrlh(vector short __a, vector unsigned short __b) {
7676  return __builtin_altivec_vrlh(__a, __b);
7677}
7678
7679static __inline__ vector unsigned short __ATTRS_o_ai
7680vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7681  return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7682}
7683
7684/* vec_vrlw */
7685
7686static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7687                                                   vector unsigned int __b) {
7688  return __builtin_altivec_vrlw(__a, __b);
7689}
7690
7691static __inline__ vector unsigned int __ATTRS_o_ai
7692vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7693  return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7694}
7695
7696/* vec_round */
7697
7698static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7699#ifdef __VSX__
7700  return __builtin_vsx_xvrspi(__a);
7701#else
7702  return __builtin_altivec_vrfin(__a);
7703#endif
7704}
7705
7706#ifdef __VSX__
7707static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7708  return __builtin_vsx_xvrdpi(__a);
7709}
7710
7711/* vec_rint */
7712
7713static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7714  return __builtin_vsx_xvrspic(__a);
7715}
7716
7717static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7718  return __builtin_vsx_xvrdpic(__a);
7719}
7720
7721/* vec_nearbyint */
7722
7723static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7724  return __builtin_vsx_xvrspi(__a);
7725}
7726
7727static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7728  return __builtin_vsx_xvrdpi(__a);
7729}
7730#endif
7731
7732/* vec_vrfin */
7733
7734static __inline__ vector float __attribute__((__always_inline__))
7735vec_vrfin(vector float __a) {
7736  return __builtin_altivec_vrfin(__a);
7737}
7738
7739/* vec_sqrt */
7740
7741#ifdef __VSX__
7742static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7743  return __builtin_vsx_xvsqrtsp(__a);
7744}
7745
7746static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7747  return __builtin_vsx_xvsqrtdp(__a);
7748}
7749#endif
7750
7751/* vec_rsqrte */
7752
7753static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7754#ifdef __VSX__
7755  return __builtin_vsx_xvrsqrtesp(__a);
7756#else
7757  return __builtin_altivec_vrsqrtefp(__a);
7758#endif
7759}
7760
7761#ifdef __VSX__
7762static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7763  return __builtin_vsx_xvrsqrtedp(__a);
7764}
7765#endif
7766
7767/* vec_vrsqrtefp */
7768
7769static __inline__ __vector float __attribute__((__always_inline__))
7770vec_vrsqrtefp(vector float __a) {
7771  return __builtin_altivec_vrsqrtefp(__a);
7772}
7773
7774/* vec_sel */
7775
7776#define __builtin_altivec_vsel_4si vec_sel
7777
7778static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7779    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7780  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7781}
7782
7783static __inline__ vector signed char __ATTRS_o_ai
7784vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7785  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7786}
7787
7788static __inline__ vector unsigned char __ATTRS_o_ai
7789vec_sel(vector unsigned char __a, vector unsigned char __b,
7790        vector unsigned char __c) {
7791  return (__a & ~__c) | (__b & __c);
7792}
7793
7794static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7795    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7796  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7797}
7798
7799static __inline__ vector bool char __ATTRS_o_ai
7800vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7801  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7802}
7803
7804static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7805                                                        vector bool char __b,
7806                                                        vector bool char __c) {
7807  return (__a & ~__c) | (__b & __c);
7808}
7809
7810static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7811                                                    vector short __b,
7812                                                    vector unsigned short __c) {
7813  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7814}
7815
7816static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7817                                                    vector short __b,
7818                                                    vector bool short __c) {
7819  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7820}
7821
7822static __inline__ vector unsigned short __ATTRS_o_ai
7823vec_sel(vector unsigned short __a, vector unsigned short __b,
7824        vector unsigned short __c) {
7825  return (__a & ~__c) | (__b & __c);
7826}
7827
7828static __inline__ vector unsigned short __ATTRS_o_ai
7829vec_sel(vector unsigned short __a, vector unsigned short __b,
7830        vector bool short __c) {
7831  return (__a & ~(vector unsigned short)__c) |
7832         (__b & (vector unsigned short)__c);
7833}
7834
7835static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7836    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7837  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7838}
7839
7840static __inline__ vector bool short __ATTRS_o_ai
7841vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7842  return (__a & ~__c) | (__b & __c);
7843}
7844
7845static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7846                                                  vector int __b,
7847                                                  vector unsigned int __c) {
7848  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7849}
7850
7851static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7852                                                  vector int __b,
7853                                                  vector bool int __c) {
7854  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7855}
7856
7857static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7858    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7859  return (__a & ~__c) | (__b & __c);
7860}
7861
7862static __inline__ vector unsigned int __ATTRS_o_ai
7863vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7864  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7865}
7866
7867static __inline__ vector bool int __ATTRS_o_ai
7868vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7869  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7870}
7871
7872static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7873                                                       vector bool int __b,
7874                                                       vector bool int __c) {
7875  return (__a & ~__c) | (__b & __c);
7876}
7877
7878static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7879                                                    vector float __b,
7880                                                    vector unsigned int __c) {
7881  vector int __res = ((vector int)__a & ~(vector int)__c) |
7882                     ((vector int)__b & (vector int)__c);
7883  return (vector float)__res;
7884}
7885
7886static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7887                                                    vector float __b,
7888                                                    vector bool int __c) {
7889  vector int __res = ((vector int)__a & ~(vector int)__c) |
7890                     ((vector int)__b & (vector int)__c);
7891  return (vector float)__res;
7892}
7893
7894#ifdef __VSX__
7895static __inline__ vector double __ATTRS_o_ai
7896vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7897  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7898                           ((vector long long)__b & (vector long long)__c);
7899  return (vector double)__res;
7900}
7901
7902static __inline__ vector double __ATTRS_o_ai
7903vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7904  vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7905                           ((vector long long)__b & (vector long long)__c);
7906  return (vector double)__res;
7907}
7908#endif
7909
7910/* vec_vsel */
7911
7912static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7913    vector signed char __a, vector signed char __b, vector unsigned char __c) {
7914  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7915}
7916
7917static __inline__ vector signed char __ATTRS_o_ai
7918vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7919  return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7920}
7921
7922static __inline__ vector unsigned char __ATTRS_o_ai
7923vec_vsel(vector unsigned char __a, vector unsigned char __b,
7924         vector unsigned char __c) {
7925  return (__a & ~__c) | (__b & __c);
7926}
7927
7928static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7929    vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7930  return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7931}
7932
7933static __inline__ vector bool char __ATTRS_o_ai
7934vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7935  return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7936}
7937
7938static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7939                                                         vector bool char __b,
7940                                                         vector bool char __c) {
7941  return (__a & ~__c) | (__b & __c);
7942}
7943
7944static __inline__ vector short __ATTRS_o_ai
7945vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7946  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7947}
7948
7949static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7950                                                     vector short __b,
7951                                                     vector bool short __c) {
7952  return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7953}
7954
7955static __inline__ vector unsigned short __ATTRS_o_ai
7956vec_vsel(vector unsigned short __a, vector unsigned short __b,
7957         vector unsigned short __c) {
7958  return (__a & ~__c) | (__b & __c);
7959}
7960
7961static __inline__ vector unsigned short __ATTRS_o_ai
7962vec_vsel(vector unsigned short __a, vector unsigned short __b,
7963         vector bool short __c) {
7964  return (__a & ~(vector unsigned short)__c) |
7965         (__b & (vector unsigned short)__c);
7966}
7967
7968static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7969    vector bool short __a, vector bool short __b, vector unsigned short __c) {
7970  return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7971}
7972
7973static __inline__ vector bool short __ATTRS_o_ai
7974vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7975  return (__a & ~__c) | (__b & __c);
7976}
7977
7978static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7979                                                   vector int __b,
7980                                                   vector unsigned int __c) {
7981  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7982}
7983
7984static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7985                                                   vector int __b,
7986                                                   vector bool int __c) {
7987  return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7988}
7989
7990static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7991    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7992  return (__a & ~__c) | (__b & __c);
7993}
7994
7995static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7996    vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7997  return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7998}
7999
8000static __inline__ vector bool int __ATTRS_o_ai
8001vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8002  return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8003}
8004
8005static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8006                                                        vector bool int __b,
8007                                                        vector bool int __c) {
8008  return (__a & ~__c) | (__b & __c);
8009}
8010
8011static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8012                                                     vector float __b,
8013                                                     vector unsigned int __c) {
8014  vector int __res = ((vector int)__a & ~(vector int)__c) |
8015                     ((vector int)__b & (vector int)__c);
8016  return (vector float)__res;
8017}
8018
8019static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8020                                                     vector float __b,
8021                                                     vector bool int __c) {
8022  vector int __res = ((vector int)__a & ~(vector int)__c) |
8023                     ((vector int)__b & (vector int)__c);
8024  return (vector float)__res;
8025}
8026
8027/* vec_sl */
8028
8029// vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8030// than the length of __a.
8031static __inline__ vector unsigned char __ATTRS_o_ai
8032vec_sl(vector unsigned char __a, vector unsigned char __b) {
8033  return __a << (__b %
8034                 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8035}
8036
8037static __inline__ vector signed char __ATTRS_o_ai
8038vec_sl(vector signed char __a, vector unsigned char __b) {
8039  return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8040}
8041
8042static __inline__ vector unsigned short __ATTRS_o_ai
8043vec_sl(vector unsigned short __a, vector unsigned short __b) {
8044  return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8045                                               __CHAR_BIT__));
8046}
8047
8048static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8049                                                   vector unsigned short __b) {
8050  return (vector short)vec_sl((vector unsigned short)__a, __b);
8051}
8052
8053static __inline__ vector unsigned int __ATTRS_o_ai
8054vec_sl(vector unsigned int __a, vector unsigned int __b) {
8055  return __a << (__b %
8056                 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8057}
8058
8059static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8060                                                 vector unsigned int __b) {
8061  return (vector int)vec_sl((vector unsigned int)__a, __b);
8062}
8063
8064#ifdef __POWER8_VECTOR__
8065static __inline__ vector unsigned long long __ATTRS_o_ai
8066vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8067  return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8068                                                   __CHAR_BIT__));
8069}
8070
8071static __inline__ vector long long __ATTRS_o_ai
8072vec_sl(vector long long __a, vector unsigned long long __b) {
8073  return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8074}
8075#endif
8076
8077/* vec_vslb */
8078
8079#define __builtin_altivec_vslb vec_vslb
8080
8081static __inline__ vector signed char __ATTRS_o_ai
8082vec_vslb(vector signed char __a, vector unsigned char __b) {
8083  return vec_sl(__a, __b);
8084}
8085
8086static __inline__ vector unsigned char __ATTRS_o_ai
8087vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8088  return vec_sl(__a, __b);
8089}
8090
8091/* vec_vslh */
8092
8093#define __builtin_altivec_vslh vec_vslh
8094
8095static __inline__ vector short __ATTRS_o_ai
8096vec_vslh(vector short __a, vector unsigned short __b) {
8097  return vec_sl(__a, __b);
8098}
8099
8100static __inline__ vector unsigned short __ATTRS_o_ai
8101vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8102  return vec_sl(__a, __b);
8103}
8104
8105/* vec_vslw */
8106
8107#define __builtin_altivec_vslw vec_vslw
8108
8109static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8110                                                   vector unsigned int __b) {
8111  return vec_sl(__a, __b);
8112}
8113
8114static __inline__ vector unsigned int __ATTRS_o_ai
8115vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8116  return vec_sl(__a, __b);
8117}
8118
8119/* vec_sld */
8120
8121#define __builtin_altivec_vsldoi_4si vec_sld
8122
8123static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8124    vector signed char __a, vector signed char __b, unsigned const int __c) {
8125  unsigned char __d = __c & 0x0F;
8126#ifdef __LITTLE_ENDIAN__
8127  return vec_perm(
8128      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8129                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8130                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8131                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8132#else
8133  return vec_perm(
8134      __a, __b,
8135      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8136                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8137                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8138#endif
8139}
8140
8141static __inline__ vector unsigned char __ATTRS_o_ai
8142vec_sld(vector unsigned char __a, vector unsigned char __b,
8143        unsigned const int __c) {
8144  unsigned char __d = __c & 0x0F;
8145#ifdef __LITTLE_ENDIAN__
8146  return vec_perm(
8147      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8148                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8149                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8150                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8151#else
8152  return vec_perm(
8153      __a, __b,
8154      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8155                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8156                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8157#endif
8158}
8159
8160static __inline__ vector bool char __ATTRS_o_ai
8161vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8162  unsigned char __d = __c & 0x0F;
8163#ifdef __LITTLE_ENDIAN__
8164  return vec_perm(
8165      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8166                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8167                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8168                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8169#else
8170  return vec_perm(
8171      __a, __b,
8172      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8173                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8174                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8175#endif
8176}
8177
8178static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8179    vector signed short __a, vector signed short __b, unsigned const int __c) {
8180  unsigned char __d = __c & 0x0F;
8181#ifdef __LITTLE_ENDIAN__
8182  return vec_perm(
8183      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8184                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8185                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8186                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8187#else
8188  return vec_perm(
8189      __a, __b,
8190      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8191                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8192                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8193#endif
8194}
8195
8196static __inline__ vector unsigned short __ATTRS_o_ai
8197vec_sld(vector unsigned short __a, vector unsigned short __b,
8198        unsigned const int __c) {
8199  unsigned char __d = __c & 0x0F;
8200#ifdef __LITTLE_ENDIAN__
8201  return vec_perm(
8202      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8203                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8204                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8205                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8206#else
8207  return vec_perm(
8208      __a, __b,
8209      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8210                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8211                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8212#endif
8213}
8214
8215static __inline__ vector bool short __ATTRS_o_ai
8216vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8217  unsigned char __d = __c & 0x0F;
8218#ifdef __LITTLE_ENDIAN__
8219  return vec_perm(
8220      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8221                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8222                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8223                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8224#else
8225  return vec_perm(
8226      __a, __b,
8227      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8228                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8229                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8230#endif
8231}
8232
8233static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8234                                                    vector pixel __b,
8235                                                    unsigned const int __c) {
8236  unsigned char __d = __c & 0x0F;
8237#ifdef __LITTLE_ENDIAN__
8238  return vec_perm(
8239      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8240                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8241                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8242                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8243#else
8244  return vec_perm(
8245      __a, __b,
8246      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8247                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8248                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8249#endif
8250}
8251
8252static __inline__ vector signed int __ATTRS_o_ai
8253vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8254  unsigned char __d = __c & 0x0F;
8255#ifdef __LITTLE_ENDIAN__
8256  return vec_perm(
8257      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8258                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8259                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8260                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8261#else
8262  return vec_perm(
8263      __a, __b,
8264      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8265                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8266                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8267#endif
8268}
8269
8270static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8271    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8272  unsigned char __d = __c & 0x0F;
8273#ifdef __LITTLE_ENDIAN__
8274  return vec_perm(
8275      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8276                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8277                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8278                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8279#else
8280  return vec_perm(
8281      __a, __b,
8282      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8283                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8284                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8285#endif
8286}
8287
8288static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8289                                                       vector bool int __b,
8290                                                       unsigned const int __c) {
8291  unsigned char __d = __c & 0x0F;
8292#ifdef __LITTLE_ENDIAN__
8293  return vec_perm(
8294      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8295                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8296                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8297                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8298#else
8299  return vec_perm(
8300      __a, __b,
8301      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8302                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8303                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8304#endif
8305}
8306
8307static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8308                                                    vector float __b,
8309                                                    unsigned const int __c) {
8310  unsigned char __d = __c & 0x0F;
8311#ifdef __LITTLE_ENDIAN__
8312  return vec_perm(
8313      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8314                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8315                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8316                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8317#else
8318  return vec_perm(
8319      __a, __b,
8320      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8321                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8322                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8323#endif
8324}
8325
8326#ifdef __VSX__
8327static __inline__ vector bool long long __ATTRS_o_ai
8328vec_sld(vector bool long long __a, vector bool long long __b,
8329        unsigned const int __c) {
8330  unsigned char __d = __c & 0x0F;
8331#ifdef __LITTLE_ENDIAN__
8332  return vec_perm(
8333      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8334                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8335                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8336                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8337#else
8338  return vec_perm(
8339      __a, __b,
8340      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8341                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8342                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8343#endif
8344}
8345
8346static __inline__ vector signed long long __ATTRS_o_ai
8347vec_sld(vector signed long long __a, vector signed long long __b,
8348        unsigned const int __c) {
8349  unsigned char __d = __c & 0x0F;
8350#ifdef __LITTLE_ENDIAN__
8351  return vec_perm(
8352      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8353                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8354                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8355                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8356#else
8357  return vec_perm(
8358      __a, __b,
8359      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8360                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8361                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8362#endif
8363}
8364
8365static __inline__ vector unsigned long long __ATTRS_o_ai
8366vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8367        unsigned const int __c) {
8368  unsigned char __d = __c & 0x0F;
8369#ifdef __LITTLE_ENDIAN__
8370  return vec_perm(
8371      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8372                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8373                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8374                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8375#else
8376  return vec_perm(
8377      __a, __b,
8378      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8379                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8380                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8381#endif
8382}
8383
8384static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8385                                                     vector double __b,
8386                                                     unsigned const int __c) {
8387  unsigned char __d = __c & 0x0F;
8388#ifdef __LITTLE_ENDIAN__
8389  return vec_perm(
8390      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8391                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8392                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8393                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8394#else
8395  return vec_perm(
8396      __a, __b,
8397      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8398                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8399                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8400#endif
8401}
8402#endif
8403
8404/* vec_sldw */
8405static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8406    vector signed char __a, vector signed char __b, unsigned const int __c) {
8407  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8408}
8409
8410static __inline__ vector unsigned char __ATTRS_o_ai
8411vec_sldw(vector unsigned char __a, vector unsigned char __b,
8412         unsigned const int __c) {
8413  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8414}
8415
8416static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8417    vector signed short __a, vector signed short __b, unsigned const int __c) {
8418  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8419}
8420
8421static __inline__ vector unsigned short __ATTRS_o_ai
8422vec_sldw(vector unsigned short __a, vector unsigned short __b,
8423         unsigned const int __c) {
8424  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8425}
8426
8427static __inline__ vector signed int __ATTRS_o_ai
8428vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8429  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8430}
8431
8432static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8433    vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8434  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8435}
8436
8437#ifdef __VSX__
8438static __inline__ vector signed long long __ATTRS_o_ai
8439vec_sldw(vector signed long long __a, vector signed long long __b,
8440         unsigned const int __c) {
8441  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8442}
8443
8444static __inline__ vector unsigned long long __ATTRS_o_ai
8445vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8446         unsigned const int __c) {
8447  return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8448}
8449#endif
8450
8451#ifdef __POWER9_VECTOR__
8452/* vec_slv */
8453static __inline__ vector unsigned char __ATTRS_o_ai
8454vec_slv(vector unsigned char __a, vector unsigned char __b) {
8455  return __builtin_altivec_vslv(__a, __b);
8456}
8457
8458/* vec_srv */
8459static __inline__ vector unsigned char __ATTRS_o_ai
8460vec_srv(vector unsigned char __a, vector unsigned char __b) {
8461  return __builtin_altivec_vsrv(__a, __b);
8462}
8463#endif
8464
8465/* vec_vsldoi */
8466
8467static __inline__ vector signed char __ATTRS_o_ai
8468vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8469  unsigned char __d = __c & 0x0F;
8470#ifdef __LITTLE_ENDIAN__
8471  return vec_perm(
8472      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8473                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8474                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8475                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8476#else
8477  return vec_perm(
8478      __a, __b,
8479      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8480                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8481                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8482#endif
8483}
8484
8485static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8486    vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8487  unsigned char __d = __c & 0x0F;
8488#ifdef __LITTLE_ENDIAN__
8489  return vec_perm(
8490      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8491                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8492                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8493                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8494#else
8495  return vec_perm(
8496      __a, __b,
8497      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8498                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8499                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8500#endif
8501}
8502
8503static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8504                                                       vector short __b,
8505                                                       unsigned char __c) {
8506  unsigned char __d = __c & 0x0F;
8507#ifdef __LITTLE_ENDIAN__
8508  return vec_perm(
8509      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8510                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8511                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8512                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8513#else
8514  return vec_perm(
8515      __a, __b,
8516      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8517                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8518                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8519#endif
8520}
8521
8522static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8523    vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8524  unsigned char __d = __c & 0x0F;
8525#ifdef __LITTLE_ENDIAN__
8526  return vec_perm(
8527      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8528                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8529                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8530                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8531#else
8532  return vec_perm(
8533      __a, __b,
8534      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8535                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8536                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8537#endif
8538}
8539
8540static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8541                                                       vector pixel __b,
8542                                                       unsigned char __c) {
8543  unsigned char __d = __c & 0x0F;
8544#ifdef __LITTLE_ENDIAN__
8545  return vec_perm(
8546      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8547                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8548                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8549                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8550#else
8551  return vec_perm(
8552      __a, __b,
8553      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8554                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8555                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8556#endif
8557}
8558
8559static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8560                                                     vector int __b,
8561                                                     unsigned char __c) {
8562  unsigned char __d = __c & 0x0F;
8563#ifdef __LITTLE_ENDIAN__
8564  return vec_perm(
8565      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8566                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8567                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8568                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8569#else
8570  return vec_perm(
8571      __a, __b,
8572      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8573                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8574                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8575#endif
8576}
8577
8578static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8579    vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8580  unsigned char __d = __c & 0x0F;
8581#ifdef __LITTLE_ENDIAN__
8582  return vec_perm(
8583      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8584                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8585                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8586                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8587#else
8588  return vec_perm(
8589      __a, __b,
8590      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8591                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8592                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8593#endif
8594}
8595
8596static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8597                                                       vector float __b,
8598                                                       unsigned char __c) {
8599  unsigned char __d = __c & 0x0F;
8600#ifdef __LITTLE_ENDIAN__
8601  return vec_perm(
8602      __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8603                                       20 - __d, 21 - __d, 22 - __d, 23 - __d,
8604                                       24 - __d, 25 - __d, 26 - __d, 27 - __d,
8605                                       28 - __d, 29 - __d, 30 - __d, 31 - __d));
8606#else
8607  return vec_perm(
8608      __a, __b,
8609      (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8610                             __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8611                             __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8612#endif
8613}
8614
8615/* vec_sll */
8616
8617static __inline__ vector signed char __ATTRS_o_ai
8618vec_sll(vector signed char __a, vector unsigned char __b) {
8619  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8620                                                   (vector int)__b);
8621}
8622
8623static __inline__ vector signed char __ATTRS_o_ai
8624vec_sll(vector signed char __a, vector unsigned short __b) {
8625  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8626                                                   (vector int)__b);
8627}
8628
8629static __inline__ vector signed char __ATTRS_o_ai
8630vec_sll(vector signed char __a, vector unsigned int __b) {
8631  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8632                                                   (vector int)__b);
8633}
8634
8635static __inline__ vector unsigned char __ATTRS_o_ai
8636vec_sll(vector unsigned char __a, vector unsigned char __b) {
8637  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8638                                                     (vector int)__b);
8639}
8640
8641static __inline__ vector unsigned char __ATTRS_o_ai
8642vec_sll(vector unsigned char __a, vector unsigned short __b) {
8643  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8644                                                     (vector int)__b);
8645}
8646
8647static __inline__ vector unsigned char __ATTRS_o_ai
8648vec_sll(vector unsigned char __a, vector unsigned int __b) {
8649  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8650                                                     (vector int)__b);
8651}
8652
8653static __inline__ vector bool char __ATTRS_o_ai
8654vec_sll(vector bool char __a, vector unsigned char __b) {
8655  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8656                                                 (vector int)__b);
8657}
8658
8659static __inline__ vector bool char __ATTRS_o_ai
8660vec_sll(vector bool char __a, vector unsigned short __b) {
8661  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8662                                                 (vector int)__b);
8663}
8664
8665static __inline__ vector bool char __ATTRS_o_ai
8666vec_sll(vector bool char __a, vector unsigned int __b) {
8667  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8668                                                 (vector int)__b);
8669}
8670
8671static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8672                                                    vector unsigned char __b) {
8673  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8674}
8675
8676static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8677                                                    vector unsigned short __b) {
8678  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8679}
8680
8681static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8682                                                    vector unsigned int __b) {
8683  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8684}
8685
8686static __inline__ vector unsigned short __ATTRS_o_ai
8687vec_sll(vector unsigned short __a, vector unsigned char __b) {
8688  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8689                                                      (vector int)__b);
8690}
8691
8692static __inline__ vector unsigned short __ATTRS_o_ai
8693vec_sll(vector unsigned short __a, vector unsigned short __b) {
8694  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8695                                                      (vector int)__b);
8696}
8697
8698static __inline__ vector unsigned short __ATTRS_o_ai
8699vec_sll(vector unsigned short __a, vector unsigned int __b) {
8700  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8701                                                      (vector int)__b);
8702}
8703
8704static __inline__ vector bool short __ATTRS_o_ai
8705vec_sll(vector bool short __a, vector unsigned char __b) {
8706  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8707                                                  (vector int)__b);
8708}
8709
8710static __inline__ vector bool short __ATTRS_o_ai
8711vec_sll(vector bool short __a, vector unsigned short __b) {
8712  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8713                                                  (vector int)__b);
8714}
8715
8716static __inline__ vector bool short __ATTRS_o_ai
8717vec_sll(vector bool short __a, vector unsigned int __b) {
8718  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8719                                                  (vector int)__b);
8720}
8721
8722static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8723                                                    vector unsigned char __b) {
8724  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8725}
8726
8727static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8728                                                    vector unsigned short __b) {
8729  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8730}
8731
8732static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8733                                                    vector unsigned int __b) {
8734  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8735}
8736
8737static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8738                                                  vector unsigned char __b) {
8739  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8740}
8741
8742static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8743                                                  vector unsigned short __b) {
8744  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8745}
8746
8747static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8748                                                  vector unsigned int __b) {
8749  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8750}
8751
8752static __inline__ vector unsigned int __ATTRS_o_ai
8753vec_sll(vector unsigned int __a, vector unsigned char __b) {
8754  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8755                                                    (vector int)__b);
8756}
8757
8758static __inline__ vector unsigned int __ATTRS_o_ai
8759vec_sll(vector unsigned int __a, vector unsigned short __b) {
8760  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8761                                                    (vector int)__b);
8762}
8763
8764static __inline__ vector unsigned int __ATTRS_o_ai
8765vec_sll(vector unsigned int __a, vector unsigned int __b) {
8766  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8767                                                    (vector int)__b);
8768}
8769
8770static __inline__ vector bool int __ATTRS_o_ai
8771vec_sll(vector bool int __a, vector unsigned char __b) {
8772  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8773                                                (vector int)__b);
8774}
8775
8776static __inline__ vector bool int __ATTRS_o_ai
8777vec_sll(vector bool int __a, vector unsigned short __b) {
8778  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8779                                                (vector int)__b);
8780}
8781
8782static __inline__ vector bool int __ATTRS_o_ai
8783vec_sll(vector bool int __a, vector unsigned int __b) {
8784  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8785                                                (vector int)__b);
8786}
8787
8788#ifdef __VSX__
8789static __inline__ vector signed long long __ATTRS_o_ai
8790vec_sll(vector signed long long __a, vector unsigned char __b) {
8791  return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8792                                                        (vector int)__b);
8793}
8794
8795static __inline__ vector unsigned long long __ATTRS_o_ai
8796vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8797  return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8798                                                          (vector int)__b);
8799}
8800#endif
8801
8802/* vec_vsl */
8803
8804static __inline__ vector signed char __ATTRS_o_ai
8805vec_vsl(vector signed char __a, vector unsigned char __b) {
8806  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8807                                                   (vector int)__b);
8808}
8809
8810static __inline__ vector signed char __ATTRS_o_ai
8811vec_vsl(vector signed char __a, vector unsigned short __b) {
8812  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8813                                                   (vector int)__b);
8814}
8815
8816static __inline__ vector signed char __ATTRS_o_ai
8817vec_vsl(vector signed char __a, vector unsigned int __b) {
8818  return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8819                                                   (vector int)__b);
8820}
8821
8822static __inline__ vector unsigned char __ATTRS_o_ai
8823vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8824  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8825                                                     (vector int)__b);
8826}
8827
8828static __inline__ vector unsigned char __ATTRS_o_ai
8829vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8830  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8831                                                     (vector int)__b);
8832}
8833
8834static __inline__ vector unsigned char __ATTRS_o_ai
8835vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8836  return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8837                                                     (vector int)__b);
8838}
8839
8840static __inline__ vector bool char __ATTRS_o_ai
8841vec_vsl(vector bool char __a, vector unsigned char __b) {
8842  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8843                                                 (vector int)__b);
8844}
8845
8846static __inline__ vector bool char __ATTRS_o_ai
8847vec_vsl(vector bool char __a, vector unsigned short __b) {
8848  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8849                                                 (vector int)__b);
8850}
8851
8852static __inline__ vector bool char __ATTRS_o_ai
8853vec_vsl(vector bool char __a, vector unsigned int __b) {
8854  return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8855                                                 (vector int)__b);
8856}
8857
8858static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8859                                                    vector unsigned char __b) {
8860  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8861}
8862
8863static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8864                                                    vector unsigned short __b) {
8865  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8866}
8867
8868static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8869                                                    vector unsigned int __b) {
8870  return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8871}
8872
8873static __inline__ vector unsigned short __ATTRS_o_ai
8874vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8875  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8876                                                      (vector int)__b);
8877}
8878
8879static __inline__ vector unsigned short __ATTRS_o_ai
8880vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8881  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8882                                                      (vector int)__b);
8883}
8884
8885static __inline__ vector unsigned short __ATTRS_o_ai
8886vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8887  return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8888                                                      (vector int)__b);
8889}
8890
8891static __inline__ vector bool short __ATTRS_o_ai
8892vec_vsl(vector bool short __a, vector unsigned char __b) {
8893  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8894                                                  (vector int)__b);
8895}
8896
8897static __inline__ vector bool short __ATTRS_o_ai
8898vec_vsl(vector bool short __a, vector unsigned short __b) {
8899  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8900                                                  (vector int)__b);
8901}
8902
8903static __inline__ vector bool short __ATTRS_o_ai
8904vec_vsl(vector bool short __a, vector unsigned int __b) {
8905  return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8906                                                  (vector int)__b);
8907}
8908
8909static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8910                                                    vector unsigned char __b) {
8911  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8912}
8913
8914static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8915                                                    vector unsigned short __b) {
8916  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8917}
8918
8919static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8920                                                    vector unsigned int __b) {
8921  return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8922}
8923
8924static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8925                                                  vector unsigned char __b) {
8926  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8927}
8928
8929static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8930                                                  vector unsigned short __b) {
8931  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8932}
8933
8934static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8935                                                  vector unsigned int __b) {
8936  return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8937}
8938
8939static __inline__ vector unsigned int __ATTRS_o_ai
8940vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8941  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8942                                                    (vector int)__b);
8943}
8944
8945static __inline__ vector unsigned int __ATTRS_o_ai
8946vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8947  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8948                                                    (vector int)__b);
8949}
8950
8951static __inline__ vector unsigned int __ATTRS_o_ai
8952vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8953  return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8954                                                    (vector int)__b);
8955}
8956
8957static __inline__ vector bool int __ATTRS_o_ai
8958vec_vsl(vector bool int __a, vector unsigned char __b) {
8959  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8960                                                (vector int)__b);
8961}
8962
8963static __inline__ vector bool int __ATTRS_o_ai
8964vec_vsl(vector bool int __a, vector unsigned short __b) {
8965  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8966                                                (vector int)__b);
8967}
8968
8969static __inline__ vector bool int __ATTRS_o_ai
8970vec_vsl(vector bool int __a, vector unsigned int __b) {
8971  return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8972                                                (vector int)__b);
8973}
8974
8975/* vec_slo */
8976
8977static __inline__ vector signed char __ATTRS_o_ai
8978vec_slo(vector signed char __a, vector signed char __b) {
8979  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8980                                                    (vector int)__b);
8981}
8982
8983static __inline__ vector signed char __ATTRS_o_ai
8984vec_slo(vector signed char __a, vector unsigned char __b) {
8985  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8986                                                    (vector int)__b);
8987}
8988
8989static __inline__ vector unsigned char __ATTRS_o_ai
8990vec_slo(vector unsigned char __a, vector signed char __b) {
8991  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8992                                                      (vector int)__b);
8993}
8994
8995static __inline__ vector unsigned char __ATTRS_o_ai
8996vec_slo(vector unsigned char __a, vector unsigned char __b) {
8997  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8998                                                      (vector int)__b);
8999}
9000
9001static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9002                                                    vector signed char __b) {
9003  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9004}
9005
9006static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9007                                                    vector unsigned char __b) {
9008  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9009}
9010
9011static __inline__ vector unsigned short __ATTRS_o_ai
9012vec_slo(vector unsigned short __a, vector signed char __b) {
9013  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9014                                                       (vector int)__b);
9015}
9016
9017static __inline__ vector unsigned short __ATTRS_o_ai
9018vec_slo(vector unsigned short __a, vector unsigned char __b) {
9019  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9020                                                       (vector int)__b);
9021}
9022
9023static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9024                                                    vector signed char __b) {
9025  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9026}
9027
9028static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9029                                                    vector unsigned char __b) {
9030  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9031}
9032
9033static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9034                                                  vector signed char __b) {
9035  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9036}
9037
9038static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9039                                                  vector unsigned char __b) {
9040  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9041}
9042
9043static __inline__ vector unsigned int __ATTRS_o_ai
9044vec_slo(vector unsigned int __a, vector signed char __b) {
9045  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9046                                                     (vector int)__b);
9047}
9048
9049static __inline__ vector unsigned int __ATTRS_o_ai
9050vec_slo(vector unsigned int __a, vector unsigned char __b) {
9051  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9052                                                     (vector int)__b);
9053}
9054
9055static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9056                                                    vector signed char __b) {
9057  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9058}
9059
9060static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9061                                                    vector unsigned char __b) {
9062  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9063}
9064
9065#ifdef __VSX__
9066static __inline__ vector signed long long __ATTRS_o_ai
9067vec_slo(vector signed long long __a, vector signed char __b) {
9068  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9069                                                         (vector int)__b);
9070}
9071
9072static __inline__ vector signed long long __ATTRS_o_ai
9073vec_slo(vector signed long long __a, vector unsigned char __b) {
9074  return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9075                                                         (vector int)__b);
9076}
9077
9078static __inline__ vector unsigned long long __ATTRS_o_ai
9079vec_slo(vector unsigned long long __a, vector signed char __b) {
9080  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9081                                                           (vector int)__b);
9082}
9083
9084static __inline__ vector unsigned long long __ATTRS_o_ai
9085vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9086  return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9087                                                           (vector int)__b);
9088}
9089#endif
9090
9091/* vec_vslo */
9092
9093static __inline__ vector signed char __ATTRS_o_ai
9094vec_vslo(vector signed char __a, vector signed char __b) {
9095  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9096                                                    (vector int)__b);
9097}
9098
9099static __inline__ vector signed char __ATTRS_o_ai
9100vec_vslo(vector signed char __a, vector unsigned char __b) {
9101  return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9102                                                    (vector int)__b);
9103}
9104
9105static __inline__ vector unsigned char __ATTRS_o_ai
9106vec_vslo(vector unsigned char __a, vector signed char __b) {
9107  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9108                                                      (vector int)__b);
9109}
9110
9111static __inline__ vector unsigned char __ATTRS_o_ai
9112vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9113  return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9114                                                      (vector int)__b);
9115}
9116
9117static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9118                                                     vector signed char __b) {
9119  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9120}
9121
9122static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9123                                                     vector unsigned char __b) {
9124  return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9125}
9126
9127static __inline__ vector unsigned short __ATTRS_o_ai
9128vec_vslo(vector unsigned short __a, vector signed char __b) {
9129  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9130                                                       (vector int)__b);
9131}
9132
9133static __inline__ vector unsigned short __ATTRS_o_ai
9134vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9135  return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9136                                                       (vector int)__b);
9137}
9138
9139static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9140                                                     vector signed char __b) {
9141  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9142}
9143
9144static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9145                                                     vector unsigned char __b) {
9146  return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9147}
9148
9149static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9150                                                   vector signed char __b) {
9151  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9152}
9153
9154static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9155                                                   vector unsigned char __b) {
9156  return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9157}
9158
9159static __inline__ vector unsigned int __ATTRS_o_ai
9160vec_vslo(vector unsigned int __a, vector signed char __b) {
9161  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9162                                                     (vector int)__b);
9163}
9164
9165static __inline__ vector unsigned int __ATTRS_o_ai
9166vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9167  return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9168                                                     (vector int)__b);
9169}
9170
9171static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9172                                                     vector signed char __b) {
9173  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9174}
9175
9176static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9177                                                     vector unsigned char __b) {
9178  return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9179}
9180
9181/* vec_splat */
9182
9183static __inline__ vector signed char __ATTRS_o_ai
9184vec_splat(vector signed char __a, unsigned const int __b) {
9185  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9186}
9187
9188static __inline__ vector unsigned char __ATTRS_o_ai
9189vec_splat(vector unsigned char __a, unsigned const int __b) {
9190  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9191}
9192
9193static __inline__ vector bool char __ATTRS_o_ai
9194vec_splat(vector bool char __a, unsigned const int __b) {
9195  return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9196}
9197
9198static __inline__ vector signed short __ATTRS_o_ai
9199vec_splat(vector signed short __a, unsigned const int __b) {
9200  unsigned char b0 = (__b & 0x07) * 2;
9201  unsigned char b1 = b0 + 1;
9202  return vec_perm(__a, __a,
9203                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9204                                         b0, b1, b0, b1, b0, b1));
9205}
9206
9207static __inline__ vector unsigned short __ATTRS_o_ai
9208vec_splat(vector unsigned short __a, unsigned const int __b) {
9209  unsigned char b0 = (__b & 0x07) * 2;
9210  unsigned char b1 = b0 + 1;
9211  return vec_perm(__a, __a,
9212                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9213                                         b0, b1, b0, b1, b0, b1));
9214}
9215
9216static __inline__ vector bool short __ATTRS_o_ai
9217vec_splat(vector bool short __a, unsigned const int __b) {
9218  unsigned char b0 = (__b & 0x07) * 2;
9219  unsigned char b1 = b0 + 1;
9220  return vec_perm(__a, __a,
9221                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9222                                         b0, b1, b0, b1, b0, b1));
9223}
9224
9225static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9226                                                      unsigned const int __b) {
9227  unsigned char b0 = (__b & 0x07) * 2;
9228  unsigned char b1 = b0 + 1;
9229  return vec_perm(__a, __a,
9230                  (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9231                                         b0, b1, b0, b1, b0, b1));
9232}
9233
9234static __inline__ vector signed int __ATTRS_o_ai
9235vec_splat(vector signed int __a, unsigned const int __b) {
9236  unsigned char b0 = (__b & 0x03) * 4;
9237  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9238  return vec_perm(__a, __a,
9239                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9240                                         b2, b3, b0, b1, b2, b3));
9241}
9242
9243static __inline__ vector unsigned int __ATTRS_o_ai
9244vec_splat(vector unsigned int __a, unsigned const int __b) {
9245  unsigned char b0 = (__b & 0x03) * 4;
9246  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9247  return vec_perm(__a, __a,
9248                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9249                                         b2, b3, b0, b1, b2, b3));
9250}
9251
9252static __inline__ vector bool int __ATTRS_o_ai
9253vec_splat(vector bool int __a, unsigned const int __b) {
9254  unsigned char b0 = (__b & 0x03) * 4;
9255  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9256  return vec_perm(__a, __a,
9257                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9258                                         b2, b3, b0, b1, b2, b3));
9259}
9260
9261static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9262                                                      unsigned const int __b) {
9263  unsigned char b0 = (__b & 0x03) * 4;
9264  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9265  return vec_perm(__a, __a,
9266                  (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9267                                         b2, b3, b0, b1, b2, b3));
9268}
9269
9270#ifdef __VSX__
9271static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9272                                                       unsigned const int __b) {
9273  unsigned char b0 = (__b & 0x01) * 8;
9274  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9275                b6 = b0 + 6, b7 = b0 + 7;
9276  return vec_perm(__a, __a,
9277                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9278                                         b2, b3, b4, b5, b6, b7));
9279}
9280static __inline__ vector bool long long __ATTRS_o_ai
9281vec_splat(vector bool long long __a, unsigned const int __b) {
9282  unsigned char b0 = (__b & 0x01) * 8;
9283  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9284                b6 = b0 + 6, b7 = b0 + 7;
9285  return vec_perm(__a, __a,
9286                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9287                                         b2, b3, b4, b5, b6, b7));
9288}
9289static __inline__ vector signed long long __ATTRS_o_ai
9290vec_splat(vector signed long long __a, unsigned const int __b) {
9291  unsigned char b0 = (__b & 0x01) * 8;
9292  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9293                b6 = b0 + 6, b7 = b0 + 7;
9294  return vec_perm(__a, __a,
9295                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9296                                         b2, b3, b4, b5, b6, b7));
9297}
9298static __inline__ vector unsigned long long __ATTRS_o_ai
9299vec_splat(vector unsigned long long __a, unsigned const int __b) {
9300  unsigned char b0 = (__b & 0x01) * 8;
9301  unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9302                b6 = b0 + 6, b7 = b0 + 7;
9303  return vec_perm(__a, __a,
9304                  (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9305                                         b2, b3, b4, b5, b6, b7));
9306}
9307#endif
9308
9309/* vec_vspltb */
9310
9311#define __builtin_altivec_vspltb vec_vspltb
9312
9313static __inline__ vector signed char __ATTRS_o_ai
9314vec_vspltb(vector signed char __a, unsigned char __b) {
9315  return vec_perm(__a, __a, (vector unsigned char)(__b));
9316}
9317
9318static __inline__ vector unsigned char __ATTRS_o_ai
9319vec_vspltb(vector unsigned char __a, unsigned char __b) {
9320  return vec_perm(__a, __a, (vector unsigned char)(__b));
9321}
9322
9323static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9324                                                           unsigned char __b) {
9325  return vec_perm(__a, __a, (vector unsigned char)(__b));
9326}
9327
9328/* vec_vsplth */
9329
9330#define __builtin_altivec_vsplth vec_vsplth
9331
9332static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9333                                                       unsigned char __b) {
9334  __b *= 2;
9335  unsigned char b1 = __b + 1;
9336  return vec_perm(__a, __a,
9337                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9338                                         __b, b1, __b, b1, __b, b1, __b, b1));
9339}
9340
9341static __inline__ vector unsigned short __ATTRS_o_ai
9342vec_vsplth(vector unsigned short __a, unsigned char __b) {
9343  __b *= 2;
9344  unsigned char b1 = __b + 1;
9345  return vec_perm(__a, __a,
9346                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9347                                         __b, b1, __b, b1, __b, b1, __b, b1));
9348}
9349
9350static __inline__ vector bool short __ATTRS_o_ai
9351vec_vsplth(vector bool short __a, unsigned char __b) {
9352  __b *= 2;
9353  unsigned char b1 = __b + 1;
9354  return vec_perm(__a, __a,
9355                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9356                                         __b, b1, __b, b1, __b, b1, __b, b1));
9357}
9358
9359static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9360                                                       unsigned char __b) {
9361  __b *= 2;
9362  unsigned char b1 = __b + 1;
9363  return vec_perm(__a, __a,
9364                  (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9365                                         __b, b1, __b, b1, __b, b1, __b, b1));
9366}
9367
9368/* vec_vspltw */
9369
9370#define __builtin_altivec_vspltw vec_vspltw
9371
9372static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9373                                                     unsigned char __b) {
9374  __b *= 4;
9375  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9376  return vec_perm(__a, __a,
9377                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9378                                         b1, b2, b3, __b, b1, b2, b3));
9379}
9380
9381static __inline__ vector unsigned int __ATTRS_o_ai
9382vec_vspltw(vector unsigned int __a, unsigned char __b) {
9383  __b *= 4;
9384  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9385  return vec_perm(__a, __a,
9386                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9387                                         b1, b2, b3, __b, b1, b2, b3));
9388}
9389
9390static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9391                                                          unsigned char __b) {
9392  __b *= 4;
9393  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9394  return vec_perm(__a, __a,
9395                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9396                                         b1, b2, b3, __b, b1, b2, b3));
9397}
9398
9399static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9400                                                       unsigned char __b) {
9401  __b *= 4;
9402  unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9403  return vec_perm(__a, __a,
9404                  (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9405                                         b1, b2, b3, __b, b1, b2, b3));
9406}
9407
9408/* vec_splat_s8 */
9409
9410#define __builtin_altivec_vspltisb vec_splat_s8
9411
9412// FIXME: parameter should be treated as 5-bit signed literal
9413static __inline__ vector signed char __ATTRS_o_ai
9414vec_splat_s8(signed char __a) {
9415  return (vector signed char)(__a);
9416}
9417
9418/* vec_vspltisb */
9419
9420// FIXME: parameter should be treated as 5-bit signed literal
9421static __inline__ vector signed char __ATTRS_o_ai
9422vec_vspltisb(signed char __a) {
9423  return (vector signed char)(__a);
9424}
9425
9426/* vec_splat_s16 */
9427
9428#define __builtin_altivec_vspltish vec_splat_s16
9429
9430// FIXME: parameter should be treated as 5-bit signed literal
9431static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9432  return (vector short)(__a);
9433}
9434
9435/* vec_vspltish */
9436
9437// FIXME: parameter should be treated as 5-bit signed literal
9438static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9439  return (vector short)(__a);
9440}
9441
9442/* vec_splat_s32 */
9443
9444#define __builtin_altivec_vspltisw vec_splat_s32
9445
9446// FIXME: parameter should be treated as 5-bit signed literal
9447static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9448  return (vector int)(__a);
9449}
9450
9451/* vec_vspltisw */
9452
9453// FIXME: parameter should be treated as 5-bit signed literal
9454static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9455  return (vector int)(__a);
9456}
9457
9458/* vec_splat_u8 */
9459
9460// FIXME: parameter should be treated as 5-bit signed literal
9461static __inline__ vector unsigned char __ATTRS_o_ai
9462vec_splat_u8(unsigned char __a) {
9463  return (vector unsigned char)(__a);
9464}
9465
9466/* vec_splat_u16 */
9467
9468// FIXME: parameter should be treated as 5-bit signed literal
9469static __inline__ vector unsigned short __ATTRS_o_ai
9470vec_splat_u16(signed char __a) {
9471  return (vector unsigned short)(__a);
9472}
9473
9474/* vec_splat_u32 */
9475
9476// FIXME: parameter should be treated as 5-bit signed literal
9477static __inline__ vector unsigned int __ATTRS_o_ai
9478vec_splat_u32(signed char __a) {
9479  return (vector unsigned int)(__a);
9480}
9481
9482/* vec_sr */
9483
9484// vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
9485// than the length of __a.
9486static __inline__ vector unsigned char __ATTRS_o_ai
9487vec_sr(vector unsigned char __a, vector unsigned char __b) {
9488  return __a >>
9489         (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
9490}
9491
9492static __inline__ vector signed char __ATTRS_o_ai
9493vec_sr(vector signed char __a, vector unsigned char __b) {
9494  return (vector signed char)vec_sr((vector unsigned char)__a, __b);
9495}
9496
9497static __inline__ vector unsigned short __ATTRS_o_ai
9498vec_sr(vector unsigned short __a, vector unsigned short __b) {
9499  return __a >>
9500         (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
9501}
9502
9503static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
9504                                                   vector unsigned short __b) {
9505  return (vector short)vec_sr((vector unsigned short)__a, __b);
9506}
9507
9508static __inline__ vector unsigned int __ATTRS_o_ai
9509vec_sr(vector unsigned int __a, vector unsigned int __b) {
9510  return __a >>
9511         (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
9512}
9513
9514static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
9515                                                 vector unsigned int __b) {
9516  return (vector int)vec_sr((vector unsigned int)__a, __b);
9517}
9518
9519#ifdef __POWER8_VECTOR__
9520static __inline__ vector unsigned long long __ATTRS_o_ai
9521vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9522  return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
9523                                                   __CHAR_BIT__));
9524}
9525
9526static __inline__ vector long long __ATTRS_o_ai
9527vec_sr(vector long long __a, vector unsigned long long __b) {
9528  return (vector long long)vec_sr((vector unsigned long long)__a, __b);
9529}
9530#endif
9531
9532/* vec_vsrb */
9533
9534#define __builtin_altivec_vsrb vec_vsrb
9535
9536static __inline__ vector signed char __ATTRS_o_ai
9537vec_vsrb(vector signed char __a, vector unsigned char __b) {
9538  return vec_sr(__a, __b);
9539}
9540
9541static __inline__ vector unsigned char __ATTRS_o_ai
9542vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9543  return vec_sr(__a, __b);
9544}
9545
9546/* vec_vsrh */
9547
9548#define __builtin_altivec_vsrh vec_vsrh
9549
9550static __inline__ vector short __ATTRS_o_ai
9551vec_vsrh(vector short __a, vector unsigned short __b) {
9552  return vec_sr(__a, __b);
9553}
9554
9555static __inline__ vector unsigned short __ATTRS_o_ai
9556vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9557  return vec_sr(__a, __b);
9558}
9559
9560/* vec_vsrw */
9561
9562#define __builtin_altivec_vsrw vec_vsrw
9563
9564static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9565                                                   vector unsigned int __b) {
9566  return vec_sr(__a, __b);
9567}
9568
9569static __inline__ vector unsigned int __ATTRS_o_ai
9570vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9571  return vec_sr(__a, __b);
9572}
9573
9574/* vec_sra */
9575
9576static __inline__ vector signed char __ATTRS_o_ai
9577vec_sra(vector signed char __a, vector unsigned char __b) {
9578  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9579}
9580
9581static __inline__ vector unsigned char __ATTRS_o_ai
9582vec_sra(vector unsigned char __a, vector unsigned char __b) {
9583  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9584}
9585
9586static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9587                                                    vector unsigned short __b) {
9588  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9589}
9590
9591static __inline__ vector unsigned short __ATTRS_o_ai
9592vec_sra(vector unsigned short __a, vector unsigned short __b) {
9593  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9594}
9595
9596static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9597                                                  vector unsigned int __b) {
9598  return __builtin_altivec_vsraw(__a, __b);
9599}
9600
9601static __inline__ vector unsigned int __ATTRS_o_ai
9602vec_sra(vector unsigned int __a, vector unsigned int __b) {
9603  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9604}
9605
9606#ifdef __POWER8_VECTOR__
9607static __inline__ vector signed long long __ATTRS_o_ai
9608vec_sra(vector signed long long __a, vector unsigned long long __b) {
9609  return __a >> __b;
9610}
9611
9612static __inline__ vector unsigned long long __ATTRS_o_ai
9613vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9614  return (vector unsigned long long)((vector signed long long)__a >> __b);
9615}
9616#endif
9617
9618/* vec_vsrab */
9619
9620static __inline__ vector signed char __ATTRS_o_ai
9621vec_vsrab(vector signed char __a, vector unsigned char __b) {
9622  return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9623}
9624
9625static __inline__ vector unsigned char __ATTRS_o_ai
9626vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9627  return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9628}
9629
9630/* vec_vsrah */
9631
9632static __inline__ vector short __ATTRS_o_ai
9633vec_vsrah(vector short __a, vector unsigned short __b) {
9634  return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9635}
9636
9637static __inline__ vector unsigned short __ATTRS_o_ai
9638vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9639  return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9640}
9641
9642/* vec_vsraw */
9643
9644static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9645                                                    vector unsigned int __b) {
9646  return __builtin_altivec_vsraw(__a, __b);
9647}
9648
9649static __inline__ vector unsigned int __ATTRS_o_ai
9650vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9651  return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9652}
9653
9654/* vec_srl */
9655
9656static __inline__ vector signed char __ATTRS_o_ai
9657vec_srl(vector signed char __a, vector unsigned char __b) {
9658  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9659                                                   (vector int)__b);
9660}
9661
9662static __inline__ vector signed char __ATTRS_o_ai
9663vec_srl(vector signed char __a, vector unsigned short __b) {
9664  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9665                                                   (vector int)__b);
9666}
9667
9668static __inline__ vector signed char __ATTRS_o_ai
9669vec_srl(vector signed char __a, vector unsigned int __b) {
9670  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9671                                                   (vector int)__b);
9672}
9673
9674static __inline__ vector unsigned char __ATTRS_o_ai
9675vec_srl(vector unsigned char __a, vector unsigned char __b) {
9676  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9677                                                     (vector int)__b);
9678}
9679
9680static __inline__ vector unsigned char __ATTRS_o_ai
9681vec_srl(vector unsigned char __a, vector unsigned short __b) {
9682  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9683                                                     (vector int)__b);
9684}
9685
9686static __inline__ vector unsigned char __ATTRS_o_ai
9687vec_srl(vector unsigned char __a, vector unsigned int __b) {
9688  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9689                                                     (vector int)__b);
9690}
9691
9692static __inline__ vector bool char __ATTRS_o_ai
9693vec_srl(vector bool char __a, vector unsigned char __b) {
9694  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9695                                                 (vector int)__b);
9696}
9697
9698static __inline__ vector bool char __ATTRS_o_ai
9699vec_srl(vector bool char __a, vector unsigned short __b) {
9700  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9701                                                 (vector int)__b);
9702}
9703
9704static __inline__ vector bool char __ATTRS_o_ai
9705vec_srl(vector bool char __a, vector unsigned int __b) {
9706  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9707                                                 (vector int)__b);
9708}
9709
9710static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9711                                                    vector unsigned char __b) {
9712  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9713}
9714
9715static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9716                                                    vector unsigned short __b) {
9717  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9718}
9719
9720static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9721                                                    vector unsigned int __b) {
9722  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9723}
9724
9725static __inline__ vector unsigned short __ATTRS_o_ai
9726vec_srl(vector unsigned short __a, vector unsigned char __b) {
9727  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9728                                                      (vector int)__b);
9729}
9730
9731static __inline__ vector unsigned short __ATTRS_o_ai
9732vec_srl(vector unsigned short __a, vector unsigned short __b) {
9733  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9734                                                      (vector int)__b);
9735}
9736
9737static __inline__ vector unsigned short __ATTRS_o_ai
9738vec_srl(vector unsigned short __a, vector unsigned int __b) {
9739  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9740                                                      (vector int)__b);
9741}
9742
9743static __inline__ vector bool short __ATTRS_o_ai
9744vec_srl(vector bool short __a, vector unsigned char __b) {
9745  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9746                                                  (vector int)__b);
9747}
9748
9749static __inline__ vector bool short __ATTRS_o_ai
9750vec_srl(vector bool short __a, vector unsigned short __b) {
9751  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9752                                                  (vector int)__b);
9753}
9754
9755static __inline__ vector bool short __ATTRS_o_ai
9756vec_srl(vector bool short __a, vector unsigned int __b) {
9757  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9758                                                  (vector int)__b);
9759}
9760
9761static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9762                                                    vector unsigned char __b) {
9763  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9764}
9765
9766static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9767                                                    vector unsigned short __b) {
9768  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9769}
9770
9771static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9772                                                    vector unsigned int __b) {
9773  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9774}
9775
9776static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9777                                                  vector unsigned char __b) {
9778  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9779}
9780
9781static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9782                                                  vector unsigned short __b) {
9783  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9784}
9785
9786static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9787                                                  vector unsigned int __b) {
9788  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9789}
9790
9791static __inline__ vector unsigned int __ATTRS_o_ai
9792vec_srl(vector unsigned int __a, vector unsigned char __b) {
9793  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9794                                                    (vector int)__b);
9795}
9796
9797static __inline__ vector unsigned int __ATTRS_o_ai
9798vec_srl(vector unsigned int __a, vector unsigned short __b) {
9799  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9800                                                    (vector int)__b);
9801}
9802
9803static __inline__ vector unsigned int __ATTRS_o_ai
9804vec_srl(vector unsigned int __a, vector unsigned int __b) {
9805  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9806                                                    (vector int)__b);
9807}
9808
9809static __inline__ vector bool int __ATTRS_o_ai
9810vec_srl(vector bool int __a, vector unsigned char __b) {
9811  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9812                                                (vector int)__b);
9813}
9814
9815static __inline__ vector bool int __ATTRS_o_ai
9816vec_srl(vector bool int __a, vector unsigned short __b) {
9817  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9818                                                (vector int)__b);
9819}
9820
9821static __inline__ vector bool int __ATTRS_o_ai
9822vec_srl(vector bool int __a, vector unsigned int __b) {
9823  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9824                                                (vector int)__b);
9825}
9826
9827#ifdef __VSX__
9828static __inline__ vector signed long long __ATTRS_o_ai
9829vec_srl(vector signed long long __a, vector unsigned char __b) {
9830  return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9831                                                        (vector int)__b);
9832}
9833
9834static __inline__ vector unsigned long long __ATTRS_o_ai
9835vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9836  return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9837                                                          (vector int)__b);
9838}
9839#endif
9840
9841/* vec_vsr */
9842
9843static __inline__ vector signed char __ATTRS_o_ai
9844vec_vsr(vector signed char __a, vector unsigned char __b) {
9845  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9846                                                   (vector int)__b);
9847}
9848
9849static __inline__ vector signed char __ATTRS_o_ai
9850vec_vsr(vector signed char __a, vector unsigned short __b) {
9851  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9852                                                   (vector int)__b);
9853}
9854
9855static __inline__ vector signed char __ATTRS_o_ai
9856vec_vsr(vector signed char __a, vector unsigned int __b) {
9857  return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9858                                                   (vector int)__b);
9859}
9860
9861static __inline__ vector unsigned char __ATTRS_o_ai
9862vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9863  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9864                                                     (vector int)__b);
9865}
9866
9867static __inline__ vector unsigned char __ATTRS_o_ai
9868vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9869  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9870                                                     (vector int)__b);
9871}
9872
9873static __inline__ vector unsigned char __ATTRS_o_ai
9874vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9875  return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9876                                                     (vector int)__b);
9877}
9878
9879static __inline__ vector bool char __ATTRS_o_ai
9880vec_vsr(vector bool char __a, vector unsigned char __b) {
9881  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9882                                                 (vector int)__b);
9883}
9884
9885static __inline__ vector bool char __ATTRS_o_ai
9886vec_vsr(vector bool char __a, vector unsigned short __b) {
9887  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9888                                                 (vector int)__b);
9889}
9890
9891static __inline__ vector bool char __ATTRS_o_ai
9892vec_vsr(vector bool char __a, vector unsigned int __b) {
9893  return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9894                                                 (vector int)__b);
9895}
9896
9897static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9898                                                    vector unsigned char __b) {
9899  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9900}
9901
9902static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9903                                                    vector unsigned short __b) {
9904  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9905}
9906
9907static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9908                                                    vector unsigned int __b) {
9909  return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9910}
9911
9912static __inline__ vector unsigned short __ATTRS_o_ai
9913vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9914  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9915                                                      (vector int)__b);
9916}
9917
9918static __inline__ vector unsigned short __ATTRS_o_ai
9919vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9920  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9921                                                      (vector int)__b);
9922}
9923
9924static __inline__ vector unsigned short __ATTRS_o_ai
9925vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9926  return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9927                                                      (vector int)__b);
9928}
9929
9930static __inline__ vector bool short __ATTRS_o_ai
9931vec_vsr(vector bool short __a, vector unsigned char __b) {
9932  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9933                                                  (vector int)__b);
9934}
9935
9936static __inline__ vector bool short __ATTRS_o_ai
9937vec_vsr(vector bool short __a, vector unsigned short __b) {
9938  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9939                                                  (vector int)__b);
9940}
9941
9942static __inline__ vector bool short __ATTRS_o_ai
9943vec_vsr(vector bool short __a, vector unsigned int __b) {
9944  return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9945                                                  (vector int)__b);
9946}
9947
9948static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9949                                                    vector unsigned char __b) {
9950  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9951}
9952
9953static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9954                                                    vector unsigned short __b) {
9955  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9956}
9957
9958static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9959                                                    vector unsigned int __b) {
9960  return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9961}
9962
9963static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9964                                                  vector unsigned char __b) {
9965  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9966}
9967
9968static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9969                                                  vector unsigned short __b) {
9970  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9971}
9972
9973static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9974                                                  vector unsigned int __b) {
9975  return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9976}
9977
9978static __inline__ vector unsigned int __ATTRS_o_ai
9979vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9980  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9981                                                    (vector int)__b);
9982}
9983
9984static __inline__ vector unsigned int __ATTRS_o_ai
9985vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9986  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9987                                                    (vector int)__b);
9988}
9989
9990static __inline__ vector unsigned int __ATTRS_o_ai
9991vec_vsr(vector unsigned int __a, vector unsigned int __b) {
9992  return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9993                                                    (vector int)__b);
9994}
9995
9996static __inline__ vector bool int __ATTRS_o_ai
9997vec_vsr(vector bool int __a, vector unsigned char __b) {
9998  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9999                                                (vector int)__b);
10000}
10001
10002static __inline__ vector bool int __ATTRS_o_ai
10003vec_vsr(vector bool int __a, vector unsigned short __b) {
10004  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10005                                                (vector int)__b);
10006}
10007
10008static __inline__ vector bool int __ATTRS_o_ai
10009vec_vsr(vector bool int __a, vector unsigned int __b) {
10010  return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10011                                                (vector int)__b);
10012}
10013
10014/* vec_sro */
10015
10016static __inline__ vector signed char __ATTRS_o_ai
10017vec_sro(vector signed char __a, vector signed char __b) {
10018  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10019                                                    (vector int)__b);
10020}
10021
10022static __inline__ vector signed char __ATTRS_o_ai
10023vec_sro(vector signed char __a, vector unsigned char __b) {
10024  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10025                                                    (vector int)__b);
10026}
10027
10028static __inline__ vector unsigned char __ATTRS_o_ai
10029vec_sro(vector unsigned char __a, vector signed char __b) {
10030  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10031                                                      (vector int)__b);
10032}
10033
10034static __inline__ vector unsigned char __ATTRS_o_ai
10035vec_sro(vector unsigned char __a, vector unsigned char __b) {
10036  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10037                                                      (vector int)__b);
10038}
10039
10040static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10041                                                    vector signed char __b) {
10042  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10043}
10044
10045static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10046                                                    vector unsigned char __b) {
10047  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10048}
10049
10050static __inline__ vector unsigned short __ATTRS_o_ai
10051vec_sro(vector unsigned short __a, vector signed char __b) {
10052  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10053                                                       (vector int)__b);
10054}
10055
10056static __inline__ vector unsigned short __ATTRS_o_ai
10057vec_sro(vector unsigned short __a, vector unsigned char __b) {
10058  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10059                                                       (vector int)__b);
10060}
10061
10062static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10063                                                    vector signed char __b) {
10064  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10065}
10066
10067static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10068                                                    vector unsigned char __b) {
10069  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10070}
10071
10072static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10073                                                  vector signed char __b) {
10074  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10075}
10076
10077static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10078                                                  vector unsigned char __b) {
10079  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10080}
10081
10082static __inline__ vector unsigned int __ATTRS_o_ai
10083vec_sro(vector unsigned int __a, vector signed char __b) {
10084  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10085                                                     (vector int)__b);
10086}
10087
10088static __inline__ vector unsigned int __ATTRS_o_ai
10089vec_sro(vector unsigned int __a, vector unsigned char __b) {
10090  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10091                                                     (vector int)__b);
10092}
10093
10094static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10095                                                    vector signed char __b) {
10096  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10097}
10098
10099static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10100                                                    vector unsigned char __b) {
10101  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10102}
10103
10104#ifdef __VSX__
10105static __inline__ vector signed long long __ATTRS_o_ai
10106vec_sro(vector signed long long __a, vector signed char __b) {
10107  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10108                                                         (vector int)__b);
10109}
10110
10111static __inline__ vector signed long long __ATTRS_o_ai
10112vec_sro(vector signed long long __a, vector unsigned char __b) {
10113  return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10114                                                         (vector int)__b);
10115}
10116
10117static __inline__ vector unsigned long long __ATTRS_o_ai
10118vec_sro(vector unsigned long long __a, vector signed char __b) {
10119  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10120                                                           (vector int)__b);
10121}
10122
10123static __inline__ vector unsigned long long __ATTRS_o_ai
10124vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10125  return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10126                                                           (vector int)__b);
10127}
10128#endif
10129
10130/* vec_vsro */
10131
10132static __inline__ vector signed char __ATTRS_o_ai
10133vec_vsro(vector signed char __a, vector signed char __b) {
10134  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10135                                                    (vector int)__b);
10136}
10137
10138static __inline__ vector signed char __ATTRS_o_ai
10139vec_vsro(vector signed char __a, vector unsigned char __b) {
10140  return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10141                                                    (vector int)__b);
10142}
10143
10144static __inline__ vector unsigned char __ATTRS_o_ai
10145vec_vsro(vector unsigned char __a, vector signed char __b) {
10146  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10147                                                      (vector int)__b);
10148}
10149
10150static __inline__ vector unsigned char __ATTRS_o_ai
10151vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10152  return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10153                                                      (vector int)__b);
10154}
10155
10156static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10157                                                     vector signed char __b) {
10158  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10159}
10160
10161static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10162                                                     vector unsigned char __b) {
10163  return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10164}
10165
10166static __inline__ vector unsigned short __ATTRS_o_ai
10167vec_vsro(vector unsigned short __a, vector signed char __b) {
10168  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10169                                                       (vector int)__b);
10170}
10171
10172static __inline__ vector unsigned short __ATTRS_o_ai
10173vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10174  return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10175                                                       (vector int)__b);
10176}
10177
10178static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10179                                                     vector signed char __b) {
10180  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10181}
10182
10183static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10184                                                     vector unsigned char __b) {
10185  return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10186}
10187
10188static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10189                                                   vector signed char __b) {
10190  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10191}
10192
10193static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10194                                                   vector unsigned char __b) {
10195  return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10196}
10197
10198static __inline__ vector unsigned int __ATTRS_o_ai
10199vec_vsro(vector unsigned int __a, vector signed char __b) {
10200  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10201                                                     (vector int)__b);
10202}
10203
10204static __inline__ vector unsigned int __ATTRS_o_ai
10205vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10206  return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10207                                                     (vector int)__b);
10208}
10209
10210static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10211                                                     vector signed char __b) {
10212  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10213}
10214
10215static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10216                                                     vector unsigned char __b) {
10217  return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10218}
10219
10220/* vec_st */
10221
10222static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10223                                           vector signed char *__c) {
10224  __builtin_altivec_stvx((vector int)__a, __b, __c);
10225}
10226
10227static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10228                                           signed char *__c) {
10229  __builtin_altivec_stvx((vector int)__a, __b, __c);
10230}
10231
10232static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10233                                           vector unsigned char *__c) {
10234  __builtin_altivec_stvx((vector int)__a, __b, __c);
10235}
10236
10237static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10238                                           unsigned char *__c) {
10239  __builtin_altivec_stvx((vector int)__a, __b, __c);
10240}
10241
10242static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10243                                           signed char *__c) {
10244  __builtin_altivec_stvx((vector int)__a, __b, __c);
10245}
10246
10247static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10248                                           unsigned char *__c) {
10249  __builtin_altivec_stvx((vector int)__a, __b, __c);
10250}
10251
10252static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10253                                           vector bool char *__c) {
10254  __builtin_altivec_stvx((vector int)__a, __b, __c);
10255}
10256
10257static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10258                                           vector short *__c) {
10259  __builtin_altivec_stvx((vector int)__a, __b, __c);
10260}
10261
10262static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10263                                           short *__c) {
10264  __builtin_altivec_stvx((vector int)__a, __b, __c);
10265}
10266
10267static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10268                                           vector unsigned short *__c) {
10269  __builtin_altivec_stvx((vector int)__a, __b, __c);
10270}
10271
10272static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10273                                           unsigned short *__c) {
10274  __builtin_altivec_stvx((vector int)__a, __b, __c);
10275}
10276
10277static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10278                                           short *__c) {
10279  __builtin_altivec_stvx((vector int)__a, __b, __c);
10280}
10281
10282static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10283                                           unsigned short *__c) {
10284  __builtin_altivec_stvx((vector int)__a, __b, __c);
10285}
10286
10287static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10288                                           vector bool short *__c) {
10289  __builtin_altivec_stvx((vector int)__a, __b, __c);
10290}
10291
10292static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10293                                           short *__c) {
10294  __builtin_altivec_stvx((vector int)__a, __b, __c);
10295}
10296
10297static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10298                                           unsigned short *__c) {
10299  __builtin_altivec_stvx((vector int)__a, __b, __c);
10300}
10301
10302static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10303                                           vector pixel *__c) {
10304  __builtin_altivec_stvx((vector int)__a, __b, __c);
10305}
10306
10307static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10308                                           vector int *__c) {
10309  __builtin_altivec_stvx(__a, __b, __c);
10310}
10311
10312static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10313  __builtin_altivec_stvx(__a, __b, __c);
10314}
10315
10316static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10317                                           vector unsigned int *__c) {
10318  __builtin_altivec_stvx((vector int)__a, __b, __c);
10319}
10320
10321static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10322                                           unsigned int *__c) {
10323  __builtin_altivec_stvx((vector int)__a, __b, __c);
10324}
10325
10326static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10327                                           int *__c) {
10328  __builtin_altivec_stvx((vector int)__a, __b, __c);
10329}
10330
10331static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10332                                           unsigned int *__c) {
10333  __builtin_altivec_stvx((vector int)__a, __b, __c);
10334}
10335
10336static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10337                                           vector bool int *__c) {
10338  __builtin_altivec_stvx((vector int)__a, __b, __c);
10339}
10340
10341static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10342                                           vector float *__c) {
10343  __builtin_altivec_stvx((vector int)__a, __b, __c);
10344}
10345
10346static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10347                                           float *__c) {
10348  __builtin_altivec_stvx((vector int)__a, __b, __c);
10349}
10350
10351/* vec_stvx */
10352
10353static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10354                                             vector signed char *__c) {
10355  __builtin_altivec_stvx((vector int)__a, __b, __c);
10356}
10357
10358static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10359                                             signed char *__c) {
10360  __builtin_altivec_stvx((vector int)__a, __b, __c);
10361}
10362
10363static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10364                                             vector unsigned char *__c) {
10365  __builtin_altivec_stvx((vector int)__a, __b, __c);
10366}
10367
10368static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10369                                             unsigned char *__c) {
10370  __builtin_altivec_stvx((vector int)__a, __b, __c);
10371}
10372
10373static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10374                                             signed char *__c) {
10375  __builtin_altivec_stvx((vector int)__a, __b, __c);
10376}
10377
10378static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10379                                             unsigned char *__c) {
10380  __builtin_altivec_stvx((vector int)__a, __b, __c);
10381}
10382
10383static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10384                                             vector bool char *__c) {
10385  __builtin_altivec_stvx((vector int)__a, __b, __c);
10386}
10387
10388static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10389                                             vector short *__c) {
10390  __builtin_altivec_stvx((vector int)__a, __b, __c);
10391}
10392
10393static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10394                                             short *__c) {
10395  __builtin_altivec_stvx((vector int)__a, __b, __c);
10396}
10397
10398static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10399                                             vector unsigned short *__c) {
10400  __builtin_altivec_stvx((vector int)__a, __b, __c);
10401}
10402
10403static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10404                                             unsigned short *__c) {
10405  __builtin_altivec_stvx((vector int)__a, __b, __c);
10406}
10407
10408static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10409                                             short *__c) {
10410  __builtin_altivec_stvx((vector int)__a, __b, __c);
10411}
10412
10413static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10414                                             unsigned short *__c) {
10415  __builtin_altivec_stvx((vector int)__a, __b, __c);
10416}
10417
10418static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10419                                             vector bool short *__c) {
10420  __builtin_altivec_stvx((vector int)__a, __b, __c);
10421}
10422
10423static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10424                                             short *__c) {
10425  __builtin_altivec_stvx((vector int)__a, __b, __c);
10426}
10427
10428static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10429                                             unsigned short *__c) {
10430  __builtin_altivec_stvx((vector int)__a, __b, __c);
10431}
10432
10433static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10434                                             vector pixel *__c) {
10435  __builtin_altivec_stvx((vector int)__a, __b, __c);
10436}
10437
10438static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10439                                             vector int *__c) {
10440  __builtin_altivec_stvx(__a, __b, __c);
10441}
10442
10443static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10444                                             int *__c) {
10445  __builtin_altivec_stvx(__a, __b, __c);
10446}
10447
10448static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10449                                             vector unsigned int *__c) {
10450  __builtin_altivec_stvx((vector int)__a, __b, __c);
10451}
10452
10453static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10454                                             unsigned int *__c) {
10455  __builtin_altivec_stvx((vector int)__a, __b, __c);
10456}
10457
10458static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10459                                             int *__c) {
10460  __builtin_altivec_stvx((vector int)__a, __b, __c);
10461}
10462
10463static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10464                                             unsigned int *__c) {
10465  __builtin_altivec_stvx((vector int)__a, __b, __c);
10466}
10467
10468static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10469                                             vector bool int *__c) {
10470  __builtin_altivec_stvx((vector int)__a, __b, __c);
10471}
10472
10473static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10474                                             vector float *__c) {
10475  __builtin_altivec_stvx((vector int)__a, __b, __c);
10476}
10477
10478static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10479                                             float *__c) {
10480  __builtin_altivec_stvx((vector int)__a, __b, __c);
10481}
10482
10483/* vec_ste */
10484
10485static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10486                                            signed char *__c) {
10487  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10488}
10489
10490static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10491                                            unsigned char *__c) {
10492  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10493}
10494
10495static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10496                                            signed char *__c) {
10497  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10498}
10499
10500static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10501                                            unsigned char *__c) {
10502  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10503}
10504
10505static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10506                                            short *__c) {
10507  __builtin_altivec_stvehx(__a, __b, __c);
10508}
10509
10510static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10511                                            unsigned short *__c) {
10512  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10513}
10514
10515static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10516                                            short *__c) {
10517  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10518}
10519
10520static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10521                                            unsigned short *__c) {
10522  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10523}
10524
10525static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10526                                            short *__c) {
10527  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10528}
10529
10530static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10531                                            unsigned short *__c) {
10532  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10533}
10534
10535static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10536  __builtin_altivec_stvewx(__a, __b, __c);
10537}
10538
10539static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10540                                            unsigned int *__c) {
10541  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10542}
10543
10544static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10545                                            int *__c) {
10546  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10547}
10548
10549static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10550                                            unsigned int *__c) {
10551  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10552}
10553
10554static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10555                                            float *__c) {
10556  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10557}
10558
10559/* vec_stvebx */
10560
10561static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10562                                               signed char *__c) {
10563  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10564}
10565
10566static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10567                                               int __b, unsigned char *__c) {
10568  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10569}
10570
10571static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10572                                               signed char *__c) {
10573  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10574}
10575
10576static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10577                                               unsigned char *__c) {
10578  __builtin_altivec_stvebx((vector char)__a, __b, __c);
10579}
10580
10581/* vec_stvehx */
10582
10583static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10584                                               short *__c) {
10585  __builtin_altivec_stvehx(__a, __b, __c);
10586}
10587
10588static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10589                                               int __b, unsigned short *__c) {
10590  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10591}
10592
10593static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10594                                               short *__c) {
10595  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10596}
10597
10598static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10599                                               unsigned short *__c) {
10600  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10601}
10602
10603static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10604                                               short *__c) {
10605  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10606}
10607
10608static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10609                                               unsigned short *__c) {
10610  __builtin_altivec_stvehx((vector short)__a, __b, __c);
10611}
10612
10613/* vec_stvewx */
10614
10615static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10616                                               int *__c) {
10617  __builtin_altivec_stvewx(__a, __b, __c);
10618}
10619
10620static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10621                                               unsigned int *__c) {
10622  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10623}
10624
10625static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10626                                               int *__c) {
10627  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10628}
10629
10630static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10631                                               unsigned int *__c) {
10632  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10633}
10634
10635static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10636                                               float *__c) {
10637  __builtin_altivec_stvewx((vector int)__a, __b, __c);
10638}
10639
10640/* vec_stl */
10641
10642static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10643                                            vector signed char *__c) {
10644  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10645}
10646
10647static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10648                                            signed char *__c) {
10649  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10650}
10651
10652static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10653                                            vector unsigned char *__c) {
10654  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10655}
10656
10657static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10658                                            unsigned char *__c) {
10659  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10660}
10661
10662static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10663                                            signed char *__c) {
10664  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10665}
10666
10667static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10668                                            unsigned char *__c) {
10669  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10670}
10671
10672static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10673                                            vector bool char *__c) {
10674  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10675}
10676
10677static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10678                                            vector short *__c) {
10679  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10680}
10681
10682static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10683                                            short *__c) {
10684  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10685}
10686
10687static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10688                                            vector unsigned short *__c) {
10689  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10690}
10691
10692static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10693                                            unsigned short *__c) {
10694  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10695}
10696
10697static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10698                                            short *__c) {
10699  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10700}
10701
10702static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10703                                            unsigned short *__c) {
10704  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10705}
10706
10707static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10708                                            vector bool short *__c) {
10709  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10710}
10711
10712static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10713                                            short *__c) {
10714  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10715}
10716
10717static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10718                                            unsigned short *__c) {
10719  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10720}
10721
10722static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10723                                            vector pixel *__c) {
10724  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10725}
10726
10727static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10728                                            vector int *__c) {
10729  __builtin_altivec_stvxl(__a, __b, __c);
10730}
10731
10732static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10733  __builtin_altivec_stvxl(__a, __b, __c);
10734}
10735
10736static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10737                                            vector unsigned int *__c) {
10738  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10739}
10740
10741static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10742                                            unsigned int *__c) {
10743  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10744}
10745
10746static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10747                                            int *__c) {
10748  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10749}
10750
10751static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10752                                            unsigned int *__c) {
10753  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10754}
10755
10756static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10757                                            vector bool int *__c) {
10758  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10759}
10760
10761static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10762                                            vector float *__c) {
10763  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10764}
10765
10766static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10767                                            float *__c) {
10768  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10769}
10770
10771/* vec_stvxl */
10772
10773static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10774                                              vector signed char *__c) {
10775  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10776}
10777
10778static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10779                                              signed char *__c) {
10780  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10781}
10782
10783static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10784                                              vector unsigned char *__c) {
10785  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10786}
10787
10788static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10789                                              unsigned char *__c) {
10790  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10791}
10792
10793static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10794                                              signed char *__c) {
10795  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10796}
10797
10798static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10799                                              unsigned char *__c) {
10800  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10801}
10802
10803static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10804                                              vector bool char *__c) {
10805  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10806}
10807
10808static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10809                                              vector short *__c) {
10810  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10811}
10812
10813static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10814                                              short *__c) {
10815  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10816}
10817
10818static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10819                                              int __b,
10820                                              vector unsigned short *__c) {
10821  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10822}
10823
10824static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10825                                              int __b, unsigned short *__c) {
10826  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10827}
10828
10829static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10830                                              short *__c) {
10831  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10832}
10833
10834static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10835                                              unsigned short *__c) {
10836  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10837}
10838
10839static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10840                                              vector bool short *__c) {
10841  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10842}
10843
10844static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10845                                              short *__c) {
10846  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10847}
10848
10849static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10850                                              unsigned short *__c) {
10851  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10852}
10853
10854static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10855                                              vector pixel *__c) {
10856  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10857}
10858
10859static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10860                                              vector int *__c) {
10861  __builtin_altivec_stvxl(__a, __b, __c);
10862}
10863
10864static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10865                                              int *__c) {
10866  __builtin_altivec_stvxl(__a, __b, __c);
10867}
10868
10869static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10870                                              vector unsigned int *__c) {
10871  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10872}
10873
10874static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10875                                              unsigned int *__c) {
10876  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10877}
10878
10879static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10880                                              int *__c) {
10881  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10882}
10883
10884static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10885                                              unsigned int *__c) {
10886  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10887}
10888
10889static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10890                                              vector bool int *__c) {
10891  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10892}
10893
10894static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10895                                              vector float *__c) {
10896  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10897}
10898
10899static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10900                                              float *__c) {
10901  __builtin_altivec_stvxl((vector int)__a, __b, __c);
10902}
10903
10904/* vec_sub */
10905
10906static __inline__ vector signed char __ATTRS_o_ai
10907vec_sub(vector signed char __a, vector signed char __b) {
10908  return __a - __b;
10909}
10910
10911static __inline__ vector signed char __ATTRS_o_ai
10912vec_sub(vector bool char __a, vector signed char __b) {
10913  return (vector signed char)__a - __b;
10914}
10915
10916static __inline__ vector signed char __ATTRS_o_ai
10917vec_sub(vector signed char __a, vector bool char __b) {
10918  return __a - (vector signed char)__b;
10919}
10920
10921static __inline__ vector unsigned char __ATTRS_o_ai
10922vec_sub(vector unsigned char __a, vector unsigned char __b) {
10923  return __a - __b;
10924}
10925
10926static __inline__ vector unsigned char __ATTRS_o_ai
10927vec_sub(vector bool char __a, vector unsigned char __b) {
10928  return (vector unsigned char)__a - __b;
10929}
10930
10931static __inline__ vector unsigned char __ATTRS_o_ai
10932vec_sub(vector unsigned char __a, vector bool char __b) {
10933  return __a - (vector unsigned char)__b;
10934}
10935
10936static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10937                                                    vector short __b) {
10938  return __a - __b;
10939}
10940
10941static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10942                                                    vector short __b) {
10943  return (vector short)__a - __b;
10944}
10945
10946static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10947                                                    vector bool short __b) {
10948  return __a - (vector short)__b;
10949}
10950
10951static __inline__ vector unsigned short __ATTRS_o_ai
10952vec_sub(vector unsigned short __a, vector unsigned short __b) {
10953  return __a - __b;
10954}
10955
10956static __inline__ vector unsigned short __ATTRS_o_ai
10957vec_sub(vector bool short __a, vector unsigned short __b) {
10958  return (vector unsigned short)__a - __b;
10959}
10960
10961static __inline__ vector unsigned short __ATTRS_o_ai
10962vec_sub(vector unsigned short __a, vector bool short __b) {
10963  return __a - (vector unsigned short)__b;
10964}
10965
10966static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10967                                                  vector int __b) {
10968  return __a - __b;
10969}
10970
10971static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10972                                                  vector int __b) {
10973  return (vector int)__a - __b;
10974}
10975
10976static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10977                                                  vector bool int __b) {
10978  return __a - (vector int)__b;
10979}
10980
10981static __inline__ vector unsigned int __ATTRS_o_ai
10982vec_sub(vector unsigned int __a, vector unsigned int __b) {
10983  return __a - __b;
10984}
10985
10986static __inline__ vector unsigned int __ATTRS_o_ai
10987vec_sub(vector bool int __a, vector unsigned int __b) {
10988  return (vector unsigned int)__a - __b;
10989}
10990
10991static __inline__ vector unsigned int __ATTRS_o_ai
10992vec_sub(vector unsigned int __a, vector bool int __b) {
10993  return __a - (vector unsigned int)__b;
10994}
10995
10996#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10997static __inline__ vector signed __int128 __ATTRS_o_ai
10998vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
10999  return __a - __b;
11000}
11001
11002static __inline__ vector unsigned __int128 __ATTRS_o_ai
11003vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11004  return __a - __b;
11005}
11006#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11007
11008#ifdef __VSX__
11009static __inline__ vector signed long long __ATTRS_o_ai
11010vec_sub(vector signed long long __a, vector signed long long __b) {
11011  return __a - __b;
11012}
11013
11014static __inline__ vector unsigned long long __ATTRS_o_ai
11015vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11016  return __a - __b;
11017}
11018
11019static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11020                                                     vector double __b) {
11021  return __a - __b;
11022}
11023#endif
11024
11025static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11026                                                    vector float __b) {
11027  return __a - __b;
11028}
11029
11030/* vec_vsububm */
11031
11032#define __builtin_altivec_vsububm vec_vsububm
11033
11034static __inline__ vector signed char __ATTRS_o_ai
11035vec_vsububm(vector signed char __a, vector signed char __b) {
11036  return __a - __b;
11037}
11038
11039static __inline__ vector signed char __ATTRS_o_ai
11040vec_vsububm(vector bool char __a, vector signed char __b) {
11041  return (vector signed char)__a - __b;
11042}
11043
11044static __inline__ vector signed char __ATTRS_o_ai
11045vec_vsububm(vector signed char __a, vector bool char __b) {
11046  return __a - (vector signed char)__b;
11047}
11048
11049static __inline__ vector unsigned char __ATTRS_o_ai
11050vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11051  return __a - __b;
11052}
11053
11054static __inline__ vector unsigned char __ATTRS_o_ai
11055vec_vsububm(vector bool char __a, vector unsigned char __b) {
11056  return (vector unsigned char)__a - __b;
11057}
11058
11059static __inline__ vector unsigned char __ATTRS_o_ai
11060vec_vsububm(vector unsigned char __a, vector bool char __b) {
11061  return __a - (vector unsigned char)__b;
11062}
11063
11064/* vec_vsubuhm */
11065
11066#define __builtin_altivec_vsubuhm vec_vsubuhm
11067
11068static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11069                                                        vector short __b) {
11070  return __a - __b;
11071}
11072
11073static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11074                                                        vector short __b) {
11075  return (vector short)__a - __b;
11076}
11077
11078static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11079                                                        vector bool short __b) {
11080  return __a - (vector short)__b;
11081}
11082
11083static __inline__ vector unsigned short __ATTRS_o_ai
11084vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11085  return __a - __b;
11086}
11087
11088static __inline__ vector unsigned short __ATTRS_o_ai
11089vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11090  return (vector unsigned short)__a - __b;
11091}
11092
11093static __inline__ vector unsigned short __ATTRS_o_ai
11094vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11095  return __a - (vector unsigned short)__b;
11096}
11097
11098/* vec_vsubuwm */
11099
11100#define __builtin_altivec_vsubuwm vec_vsubuwm
11101
11102static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11103                                                      vector int __b) {
11104  return __a - __b;
11105}
11106
11107static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11108                                                      vector int __b) {
11109  return (vector int)__a - __b;
11110}
11111
11112static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11113                                                      vector bool int __b) {
11114  return __a - (vector int)__b;
11115}
11116
11117static __inline__ vector unsigned int __ATTRS_o_ai
11118vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11119  return __a - __b;
11120}
11121
11122static __inline__ vector unsigned int __ATTRS_o_ai
11123vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11124  return (vector unsigned int)__a - __b;
11125}
11126
11127static __inline__ vector unsigned int __ATTRS_o_ai
11128vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11129  return __a - (vector unsigned int)__b;
11130}
11131
11132/* vec_vsubfp */
11133
11134#define __builtin_altivec_vsubfp vec_vsubfp
11135
11136static __inline__ vector float __attribute__((__always_inline__))
11137vec_vsubfp(vector float __a, vector float __b) {
11138  return __a - __b;
11139}
11140
11141/* vec_subc */
11142
11143static __inline__ vector signed int __ATTRS_o_ai
11144vec_subc(vector signed int __a, vector signed int __b) {
11145  return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11146                                                      (vector unsigned int) __b);
11147}
11148
11149static __inline__ vector unsigned int __ATTRS_o_ai
11150vec_subc(vector unsigned int __a, vector unsigned int __b) {
11151  return __builtin_altivec_vsubcuw(__a, __b);
11152}
11153
11154#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11155static __inline__ vector unsigned __int128 __ATTRS_o_ai
11156vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11157  return __builtin_altivec_vsubcuq(__a, __b);
11158}
11159
11160static __inline__ vector signed __int128 __ATTRS_o_ai
11161vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11162  return __builtin_altivec_vsubcuq(__a, __b);
11163}
11164#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11165
11166/* vec_vsubcuw */
11167
11168static __inline__ vector unsigned int __attribute__((__always_inline__))
11169vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11170  return __builtin_altivec_vsubcuw(__a, __b);
11171}
11172
11173/* vec_subs */
11174
11175static __inline__ vector signed char __ATTRS_o_ai
11176vec_subs(vector signed char __a, vector signed char __b) {
11177  return __builtin_altivec_vsubsbs(__a, __b);
11178}
11179
11180static __inline__ vector signed char __ATTRS_o_ai
11181vec_subs(vector bool char __a, vector signed char __b) {
11182  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11183}
11184
11185static __inline__ vector signed char __ATTRS_o_ai
11186vec_subs(vector signed char __a, vector bool char __b) {
11187  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11188}
11189
11190static __inline__ vector unsigned char __ATTRS_o_ai
11191vec_subs(vector unsigned char __a, vector unsigned char __b) {
11192  return __builtin_altivec_vsububs(__a, __b);
11193}
11194
11195static __inline__ vector unsigned char __ATTRS_o_ai
11196vec_subs(vector bool char __a, vector unsigned char __b) {
11197  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11198}
11199
11200static __inline__ vector unsigned char __ATTRS_o_ai
11201vec_subs(vector unsigned char __a, vector bool char __b) {
11202  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11203}
11204
11205static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11206                                                     vector short __b) {
11207  return __builtin_altivec_vsubshs(__a, __b);
11208}
11209
11210static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11211                                                     vector short __b) {
11212  return __builtin_altivec_vsubshs((vector short)__a, __b);
11213}
11214
11215static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11216                                                     vector bool short __b) {
11217  return __builtin_altivec_vsubshs(__a, (vector short)__b);
11218}
11219
11220static __inline__ vector unsigned short __ATTRS_o_ai
11221vec_subs(vector unsigned short __a, vector unsigned short __b) {
11222  return __builtin_altivec_vsubuhs(__a, __b);
11223}
11224
11225static __inline__ vector unsigned short __ATTRS_o_ai
11226vec_subs(vector bool short __a, vector unsigned short __b) {
11227  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11228}
11229
11230static __inline__ vector unsigned short __ATTRS_o_ai
11231vec_subs(vector unsigned short __a, vector bool short __b) {
11232  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11233}
11234
11235static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11236                                                   vector int __b) {
11237  return __builtin_altivec_vsubsws(__a, __b);
11238}
11239
11240static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11241                                                   vector int __b) {
11242  return __builtin_altivec_vsubsws((vector int)__a, __b);
11243}
11244
11245static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11246                                                   vector bool int __b) {
11247  return __builtin_altivec_vsubsws(__a, (vector int)__b);
11248}
11249
11250static __inline__ vector unsigned int __ATTRS_o_ai
11251vec_subs(vector unsigned int __a, vector unsigned int __b) {
11252  return __builtin_altivec_vsubuws(__a, __b);
11253}
11254
11255static __inline__ vector unsigned int __ATTRS_o_ai
11256vec_subs(vector bool int __a, vector unsigned int __b) {
11257  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11258}
11259
11260static __inline__ vector unsigned int __ATTRS_o_ai
11261vec_subs(vector unsigned int __a, vector bool int __b) {
11262  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11263}
11264
11265/* vec_vsubsbs */
11266
11267static __inline__ vector signed char __ATTRS_o_ai
11268vec_vsubsbs(vector signed char __a, vector signed char __b) {
11269  return __builtin_altivec_vsubsbs(__a, __b);
11270}
11271
11272static __inline__ vector signed char __ATTRS_o_ai
11273vec_vsubsbs(vector bool char __a, vector signed char __b) {
11274  return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11275}
11276
11277static __inline__ vector signed char __ATTRS_o_ai
11278vec_vsubsbs(vector signed char __a, vector bool char __b) {
11279  return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11280}
11281
11282/* vec_vsububs */
11283
11284static __inline__ vector unsigned char __ATTRS_o_ai
11285vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11286  return __builtin_altivec_vsububs(__a, __b);
11287}
11288
11289static __inline__ vector unsigned char __ATTRS_o_ai
11290vec_vsububs(vector bool char __a, vector unsigned char __b) {
11291  return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11292}
11293
11294static __inline__ vector unsigned char __ATTRS_o_ai
11295vec_vsububs(vector unsigned char __a, vector bool char __b) {
11296  return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11297}
11298
11299/* vec_vsubshs */
11300
11301static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11302                                                        vector short __b) {
11303  return __builtin_altivec_vsubshs(__a, __b);
11304}
11305
11306static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11307                                                        vector short __b) {
11308  return __builtin_altivec_vsubshs((vector short)__a, __b);
11309}
11310
11311static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11312                                                        vector bool short __b) {
11313  return __builtin_altivec_vsubshs(__a, (vector short)__b);
11314}
11315
11316/* vec_vsubuhs */
11317
11318static __inline__ vector unsigned short __ATTRS_o_ai
11319vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11320  return __builtin_altivec_vsubuhs(__a, __b);
11321}
11322
11323static __inline__ vector unsigned short __ATTRS_o_ai
11324vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11325  return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11326}
11327
11328static __inline__ vector unsigned short __ATTRS_o_ai
11329vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11330  return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11331}
11332
11333/* vec_vsubsws */
11334
11335static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11336                                                      vector int __b) {
11337  return __builtin_altivec_vsubsws(__a, __b);
11338}
11339
11340static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11341                                                      vector int __b) {
11342  return __builtin_altivec_vsubsws((vector int)__a, __b);
11343}
11344
11345static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11346                                                      vector bool int __b) {
11347  return __builtin_altivec_vsubsws(__a, (vector int)__b);
11348}
11349
11350/* vec_vsubuws */
11351
11352static __inline__ vector unsigned int __ATTRS_o_ai
11353vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11354  return __builtin_altivec_vsubuws(__a, __b);
11355}
11356
11357static __inline__ vector unsigned int __ATTRS_o_ai
11358vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11359  return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11360}
11361
11362static __inline__ vector unsigned int __ATTRS_o_ai
11363vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11364  return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11365}
11366
11367#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11368/* vec_vsubuqm */
11369
11370static __inline__ vector signed __int128 __ATTRS_o_ai
11371vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11372  return __a - __b;
11373}
11374
11375static __inline__ vector unsigned __int128 __ATTRS_o_ai
11376vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11377  return __a - __b;
11378}
11379
11380/* vec_vsubeuqm */
11381
11382
11383static __inline__ vector signed __int128 __ATTRS_o_ai
11384vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11385             vector signed __int128 __c) {
11386  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11387}
11388
11389static __inline__ vector unsigned __int128 __ATTRS_o_ai
11390vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11391             vector unsigned __int128 __c) {
11392  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11393}
11394
11395static __inline__ vector signed __int128 __ATTRS_o_ai
11396vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11397             vector signed __int128 __c) {
11398  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11399}
11400
11401static __inline__ vector unsigned __int128 __ATTRS_o_ai
11402vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11403             vector unsigned __int128 __c) {
11404  return __builtin_altivec_vsubeuqm(__a, __b, __c);
11405}
11406
11407/* vec_vsubcuq */
11408
11409static __inline__ vector signed __int128 __ATTRS_o_ai
11410vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11411  return __builtin_altivec_vsubcuq(__a, __b);
11412}
11413
11414static __inline__ vector unsigned __int128 __ATTRS_o_ai
11415vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11416  return __builtin_altivec_vsubcuq(__a, __b);
11417}
11418
11419/* vec_vsubecuq */
11420
11421static __inline__ vector signed __int128 __ATTRS_o_ai
11422vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11423             vector signed __int128 __c) {
11424  return __builtin_altivec_vsubecuq(__a, __b, __c);
11425}
11426
11427static __inline__ vector unsigned __int128 __ATTRS_o_ai
11428vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11429             vector unsigned __int128 __c) {
11430  return __builtin_altivec_vsubecuq(__a, __b, __c);
11431}
11432
11433static __inline__ vector signed int __ATTRS_o_ai
11434vec_subec(vector signed int __a, vector signed int __b,
11435             vector signed int __c) {
11436  return vec_addec(__a, ~__b, __c);
11437}
11438
11439static __inline__ vector unsigned int __ATTRS_o_ai
11440vec_subec(vector unsigned int __a, vector unsigned int __b,
11441             vector unsigned int __c) {
11442  return vec_addec(__a, ~__b, __c);
11443}
11444
11445static __inline__ vector signed __int128 __ATTRS_o_ai
11446vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11447             vector signed __int128 __c) {
11448  return __builtin_altivec_vsubecuq(__a, __b, __c);
11449}
11450
11451static __inline__ vector unsigned __int128 __ATTRS_o_ai
11452vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11453             vector unsigned __int128 __c) {
11454  return __builtin_altivec_vsubecuq(__a, __b, __c);
11455}
11456#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11457
11458static __inline__ vector signed int __ATTRS_o_ai
11459vec_sube(vector signed int __a, vector signed int __b,
11460         vector signed int __c) {
11461  vector signed int __mask = {1, 1, 1, 1};
11462  vector signed int __carry = __c & __mask;
11463  return vec_adde(__a, ~__b, __carry);
11464}
11465
11466static __inline__ vector unsigned int __ATTRS_o_ai
11467vec_sube(vector unsigned int __a, vector unsigned int __b,
11468         vector unsigned int __c) {
11469  vector unsigned int __mask = {1, 1, 1, 1};
11470  vector unsigned int __carry = __c & __mask;
11471  return vec_adde(__a, ~__b, __carry);
11472}
11473/* vec_sum4s */
11474
11475static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11476                                                    vector int __b) {
11477  return __builtin_altivec_vsum4sbs(__a, __b);
11478}
11479
11480static __inline__ vector unsigned int __ATTRS_o_ai
11481vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11482  return __builtin_altivec_vsum4ubs(__a, __b);
11483}
11484
11485static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11486                                                    vector int __b) {
11487  return __builtin_altivec_vsum4shs(__a, __b);
11488}
11489
11490/* vec_vsum4sbs */
11491
11492static __inline__ vector int __attribute__((__always_inline__))
11493vec_vsum4sbs(vector signed char __a, vector int __b) {
11494  return __builtin_altivec_vsum4sbs(__a, __b);
11495}
11496
11497/* vec_vsum4ubs */
11498
11499static __inline__ vector unsigned int __attribute__((__always_inline__))
11500vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11501  return __builtin_altivec_vsum4ubs(__a, __b);
11502}
11503
11504/* vec_vsum4shs */
11505
11506static __inline__ vector int __attribute__((__always_inline__))
11507vec_vsum4shs(vector signed short __a, vector int __b) {
11508  return __builtin_altivec_vsum4shs(__a, __b);
11509}
11510
11511/* vec_sum2s */
11512
11513/* The vsum2sws instruction has a big-endian bias, so that the second
11514   input vector and the result always reference big-endian elements
11515   1 and 3 (little-endian element 0 and 2).  For ease of porting the
11516   programmer wants elements 1 and 3 in both cases, so for little
11517   endian we must perform some permutes.  */
11518
11519static __inline__ vector signed int __attribute__((__always_inline__))
11520vec_sum2s(vector int __a, vector int __b) {
11521#ifdef __LITTLE_ENDIAN__
11522  vector int __c = (vector signed int)vec_perm(
11523      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11524                                       8, 9, 10, 11));
11525  __c = __builtin_altivec_vsum2sws(__a, __c);
11526  return (vector signed int)vec_perm(
11527      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11528                                       8, 9, 10, 11));
11529#else
11530  return __builtin_altivec_vsum2sws(__a, __b);
11531#endif
11532}
11533
11534/* vec_vsum2sws */
11535
11536static __inline__ vector signed int __attribute__((__always_inline__))
11537vec_vsum2sws(vector int __a, vector int __b) {
11538#ifdef __LITTLE_ENDIAN__
11539  vector int __c = (vector signed int)vec_perm(
11540      __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11541                                       8, 9, 10, 11));
11542  __c = __builtin_altivec_vsum2sws(__a, __c);
11543  return (vector signed int)vec_perm(
11544      __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11545                                       8, 9, 10, 11));
11546#else
11547  return __builtin_altivec_vsum2sws(__a, __b);
11548#endif
11549}
11550
11551/* vec_sums */
11552
11553/* The vsumsws instruction has a big-endian bias, so that the second
11554   input vector and the result always reference big-endian element 3
11555   (little-endian element 0).  For ease of porting the programmer
11556   wants element 3 in both cases, so for little endian we must perform
11557   some permutes.  */
11558
11559static __inline__ vector signed int __attribute__((__always_inline__))
11560vec_sums(vector signed int __a, vector signed int __b) {
11561#ifdef __LITTLE_ENDIAN__
11562  __b = (vector signed int)vec_splat(__b, 3);
11563  __b = __builtin_altivec_vsumsws(__a, __b);
11564  return (vector signed int)(0, 0, 0, __b[0]);
11565#else
11566  return __builtin_altivec_vsumsws(__a, __b);
11567#endif
11568}
11569
11570/* vec_vsumsws */
11571
11572static __inline__ vector signed int __attribute__((__always_inline__))
11573vec_vsumsws(vector signed int __a, vector signed int __b) {
11574#ifdef __LITTLE_ENDIAN__
11575  __b = (vector signed int)vec_splat(__b, 3);
11576  __b = __builtin_altivec_vsumsws(__a, __b);
11577  return (vector signed int)(0, 0, 0, __b[0]);
11578#else
11579  return __builtin_altivec_vsumsws(__a, __b);
11580#endif
11581}
11582
11583/* vec_trunc */
11584
11585static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11586#ifdef __VSX__
11587  return __builtin_vsx_xvrspiz(__a);
11588#else
11589  return __builtin_altivec_vrfiz(__a);
11590#endif
11591}
11592
11593#ifdef __VSX__
11594static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11595  return __builtin_vsx_xvrdpiz(__a);
11596}
11597#endif
11598
11599/* vec_vrfiz */
11600
11601static __inline__ vector float __attribute__((__always_inline__))
11602vec_vrfiz(vector float __a) {
11603  return __builtin_altivec_vrfiz(__a);
11604}
11605
11606/* vec_unpackh */
11607
11608/* The vector unpack instructions all have a big-endian bias, so for
11609   little endian we must reverse the meanings of "high" and "low."  */
11610
11611static __inline__ vector short __ATTRS_o_ai
11612vec_unpackh(vector signed char __a) {
11613#ifdef __LITTLE_ENDIAN__
11614  return __builtin_altivec_vupklsb((vector char)__a);
11615#else
11616  return __builtin_altivec_vupkhsb((vector char)__a);
11617#endif
11618}
11619
11620static __inline__ vector bool short __ATTRS_o_ai
11621vec_unpackh(vector bool char __a) {
11622#ifdef __LITTLE_ENDIAN__
11623  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11624#else
11625  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11626#endif
11627}
11628
11629static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11630#ifdef __LITTLE_ENDIAN__
11631  return __builtin_altivec_vupklsh(__a);
11632#else
11633  return __builtin_altivec_vupkhsh(__a);
11634#endif
11635}
11636
11637static __inline__ vector bool int __ATTRS_o_ai
11638vec_unpackh(vector bool short __a) {
11639#ifdef __LITTLE_ENDIAN__
11640  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11641#else
11642  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11643#endif
11644}
11645
11646static __inline__ vector unsigned int __ATTRS_o_ai
11647vec_unpackh(vector pixel __a) {
11648#ifdef __LITTLE_ENDIAN__
11649  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11650#else
11651  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11652#endif
11653}
11654
11655#ifdef __POWER8_VECTOR__
11656static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11657#ifdef __LITTLE_ENDIAN__
11658  return __builtin_altivec_vupklsw(__a);
11659#else
11660  return __builtin_altivec_vupkhsw(__a);
11661#endif
11662}
11663
11664static __inline__ vector bool long long __ATTRS_o_ai
11665vec_unpackh(vector bool int __a) {
11666#ifdef __LITTLE_ENDIAN__
11667  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11668#else
11669  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11670#endif
11671}
11672
11673static __inline__ vector double __ATTRS_o_ai
11674vec_unpackh(vector float __a) {
11675  return (vector double)(__a[0], __a[1]);
11676}
11677#endif
11678
11679/* vec_vupkhsb */
11680
11681static __inline__ vector short __ATTRS_o_ai
11682vec_vupkhsb(vector signed char __a) {
11683#ifdef __LITTLE_ENDIAN__
11684  return __builtin_altivec_vupklsb((vector char)__a);
11685#else
11686  return __builtin_altivec_vupkhsb((vector char)__a);
11687#endif
11688}
11689
11690static __inline__ vector bool short __ATTRS_o_ai
11691vec_vupkhsb(vector bool char __a) {
11692#ifdef __LITTLE_ENDIAN__
11693  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11694#else
11695  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11696#endif
11697}
11698
11699/* vec_vupkhsh */
11700
11701static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11702#ifdef __LITTLE_ENDIAN__
11703  return __builtin_altivec_vupklsh(__a);
11704#else
11705  return __builtin_altivec_vupkhsh(__a);
11706#endif
11707}
11708
11709static __inline__ vector bool int __ATTRS_o_ai
11710vec_vupkhsh(vector bool short __a) {
11711#ifdef __LITTLE_ENDIAN__
11712  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11713#else
11714  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11715#endif
11716}
11717
11718static __inline__ vector unsigned int __ATTRS_o_ai
11719vec_vupkhsh(vector pixel __a) {
11720#ifdef __LITTLE_ENDIAN__
11721  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11722#else
11723  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11724#endif
11725}
11726
11727/* vec_vupkhsw */
11728
11729#ifdef __POWER8_VECTOR__
11730static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11731#ifdef __LITTLE_ENDIAN__
11732  return __builtin_altivec_vupklsw(__a);
11733#else
11734  return __builtin_altivec_vupkhsw(__a);
11735#endif
11736}
11737
11738static __inline__ vector bool long long __ATTRS_o_ai
11739vec_vupkhsw(vector bool int __a) {
11740#ifdef __LITTLE_ENDIAN__
11741  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11742#else
11743  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11744#endif
11745}
11746#endif
11747
11748/* vec_unpackl */
11749
11750static __inline__ vector short __ATTRS_o_ai
11751vec_unpackl(vector signed char __a) {
11752#ifdef __LITTLE_ENDIAN__
11753  return __builtin_altivec_vupkhsb((vector char)__a);
11754#else
11755  return __builtin_altivec_vupklsb((vector char)__a);
11756#endif
11757}
11758
11759static __inline__ vector bool short __ATTRS_o_ai
11760vec_unpackl(vector bool char __a) {
11761#ifdef __LITTLE_ENDIAN__
11762  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11763#else
11764  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11765#endif
11766}
11767
11768static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11769#ifdef __LITTLE_ENDIAN__
11770  return __builtin_altivec_vupkhsh(__a);
11771#else
11772  return __builtin_altivec_vupklsh(__a);
11773#endif
11774}
11775
11776static __inline__ vector bool int __ATTRS_o_ai
11777vec_unpackl(vector bool short __a) {
11778#ifdef __LITTLE_ENDIAN__
11779  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11780#else
11781  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11782#endif
11783}
11784
11785static __inline__ vector unsigned int __ATTRS_o_ai
11786vec_unpackl(vector pixel __a) {
11787#ifdef __LITTLE_ENDIAN__
11788  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11789#else
11790  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11791#endif
11792}
11793
11794#ifdef __POWER8_VECTOR__
11795static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11796#ifdef __LITTLE_ENDIAN__
11797  return __builtin_altivec_vupkhsw(__a);
11798#else
11799  return __builtin_altivec_vupklsw(__a);
11800#endif
11801}
11802
11803static __inline__ vector bool long long __ATTRS_o_ai
11804vec_unpackl(vector bool int __a) {
11805#ifdef __LITTLE_ENDIAN__
11806  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11807#else
11808  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11809#endif
11810}
11811
11812static __inline__ vector double __ATTRS_o_ai
11813vec_unpackl(vector float __a) {
11814  return (vector double)(__a[2], __a[3]);
11815}
11816#endif
11817
11818/* vec_vupklsb */
11819
11820static __inline__ vector short __ATTRS_o_ai
11821vec_vupklsb(vector signed char __a) {
11822#ifdef __LITTLE_ENDIAN__
11823  return __builtin_altivec_vupkhsb((vector char)__a);
11824#else
11825  return __builtin_altivec_vupklsb((vector char)__a);
11826#endif
11827}
11828
11829static __inline__ vector bool short __ATTRS_o_ai
11830vec_vupklsb(vector bool char __a) {
11831#ifdef __LITTLE_ENDIAN__
11832  return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11833#else
11834  return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11835#endif
11836}
11837
11838/* vec_vupklsh */
11839
11840static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11841#ifdef __LITTLE_ENDIAN__
11842  return __builtin_altivec_vupkhsh(__a);
11843#else
11844  return __builtin_altivec_vupklsh(__a);
11845#endif
11846}
11847
11848static __inline__ vector bool int __ATTRS_o_ai
11849vec_vupklsh(vector bool short __a) {
11850#ifdef __LITTLE_ENDIAN__
11851  return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11852#else
11853  return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11854#endif
11855}
11856
11857static __inline__ vector unsigned int __ATTRS_o_ai
11858vec_vupklsh(vector pixel __a) {
11859#ifdef __LITTLE_ENDIAN__
11860  return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11861#else
11862  return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11863#endif
11864}
11865
11866/* vec_vupklsw */
11867
11868#ifdef __POWER8_VECTOR__
11869static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11870#ifdef __LITTLE_ENDIAN__
11871  return __builtin_altivec_vupkhsw(__a);
11872#else
11873  return __builtin_altivec_vupklsw(__a);
11874#endif
11875}
11876
11877static __inline__ vector bool long long __ATTRS_o_ai
11878vec_vupklsw(vector bool int __a) {
11879#ifdef __LITTLE_ENDIAN__
11880  return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11881#else
11882  return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11883#endif
11884}
11885#endif
11886
11887/* vec_vsx_ld */
11888
11889#ifdef __VSX__
11890
11891static __inline__ vector bool int __ATTRS_o_ai
11892vec_vsx_ld(int __a, const vector bool int *__b) {
11893  return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11894}
11895
11896static __inline__ vector signed int __ATTRS_o_ai
11897vec_vsx_ld(int __a, const vector signed int *__b) {
11898  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11899}
11900
11901static __inline__ vector signed int __ATTRS_o_ai
11902vec_vsx_ld(int __a, const signed int *__b) {
11903  return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11904}
11905
11906static __inline__ vector unsigned int __ATTRS_o_ai
11907vec_vsx_ld(int __a, const vector unsigned int *__b) {
11908  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11909}
11910
11911static __inline__ vector unsigned int __ATTRS_o_ai
11912vec_vsx_ld(int __a, const unsigned int *__b) {
11913  return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11914}
11915
11916static __inline__ vector float __ATTRS_o_ai
11917vec_vsx_ld(int __a, const vector float *__b) {
11918  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11919}
11920
11921static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11922                                                       const float *__b) {
11923  return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11924}
11925
11926static __inline__ vector signed long long __ATTRS_o_ai
11927vec_vsx_ld(int __a, const vector signed long long *__b) {
11928  return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11929}
11930
11931static __inline__ vector unsigned long long __ATTRS_o_ai
11932vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11933  return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11934}
11935
11936static __inline__ vector double __ATTRS_o_ai
11937vec_vsx_ld(int __a, const vector double *__b) {
11938  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11939}
11940
11941static __inline__ vector double __ATTRS_o_ai
11942vec_vsx_ld(int __a, const double *__b) {
11943  return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11944}
11945
11946static __inline__ vector bool short __ATTRS_o_ai
11947vec_vsx_ld(int __a, const vector bool short *__b) {
11948  return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11949}
11950
11951static __inline__ vector signed short __ATTRS_o_ai
11952vec_vsx_ld(int __a, const vector signed short *__b) {
11953  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11954}
11955
11956static __inline__ vector signed short __ATTRS_o_ai
11957vec_vsx_ld(int __a, const signed short *__b) {
11958  return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11959}
11960
11961static __inline__ vector unsigned short __ATTRS_o_ai
11962vec_vsx_ld(int __a, const vector unsigned short *__b) {
11963  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11964}
11965
11966static __inline__ vector unsigned short __ATTRS_o_ai
11967vec_vsx_ld(int __a, const unsigned short *__b) {
11968  return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11969}
11970
11971static __inline__ vector bool char __ATTRS_o_ai
11972vec_vsx_ld(int __a, const vector bool char *__b) {
11973  return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11974}
11975
11976static __inline__ vector signed char __ATTRS_o_ai
11977vec_vsx_ld(int __a, const vector signed char *__b) {
11978  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11979}
11980
11981static __inline__ vector signed char __ATTRS_o_ai
11982vec_vsx_ld(int __a, const signed char *__b) {
11983  return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11984}
11985
11986static __inline__ vector unsigned char __ATTRS_o_ai
11987vec_vsx_ld(int __a, const vector unsigned char *__b) {
11988  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11989}
11990
11991static __inline__ vector unsigned char __ATTRS_o_ai
11992vec_vsx_ld(int __a, const unsigned char *__b) {
11993  return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11994}
11995
11996#endif
11997
11998/* vec_vsx_st */
11999
12000#ifdef __VSX__
12001
12002static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12003                                               vector bool int *__c) {
12004  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12005}
12006
12007static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12008                                               signed int *__c) {
12009  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12010}
12011
12012static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12013                                               unsigned int *__c) {
12014  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12015}
12016
12017static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12018                                               vector signed int *__c) {
12019  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12020}
12021
12022static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12023                                               signed int *__c) {
12024  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12025}
12026
12027static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12028                                               vector unsigned int *__c) {
12029  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12030}
12031
12032static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12033                                               unsigned int *__c) {
12034  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12035}
12036
12037static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12038                                               vector float *__c) {
12039  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12040}
12041
12042static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12043                                               float *__c) {
12044  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12045}
12046
12047static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12048                                               int __b,
12049                                               vector signed long long *__c) {
12050  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12051}
12052
12053static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12054                                               int __b,
12055                                               vector unsigned long long *__c) {
12056  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12057}
12058
12059static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12060                                               vector double *__c) {
12061  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12062}
12063
12064static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12065                                               double *__c) {
12066  __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12067}
12068
12069static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12070                                               vector bool short *__c) {
12071  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12072}
12073
12074static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12075                                               signed short *__c) {
12076  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12077}
12078
12079static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12080                                               unsigned short *__c) {
12081  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12082}
12083static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12084                                               vector signed short *__c) {
12085  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12086}
12087
12088static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12089                                               signed short *__c) {
12090  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12091}
12092
12093static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12094                                               int __b,
12095                                               vector unsigned short *__c) {
12096  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12097}
12098
12099static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12100                                               int __b, unsigned short *__c) {
12101  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12102}
12103
12104static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12105                                               vector bool char *__c) {
12106  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12107}
12108
12109static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12110                                               signed char *__c) {
12111  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12112}
12113
12114static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12115                                               unsigned char *__c) {
12116  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12117}
12118
12119static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12120                                               vector signed char *__c) {
12121  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12122}
12123
12124static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12125                                               signed char *__c) {
12126  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12127}
12128
12129static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12130                                               int __b,
12131                                               vector unsigned char *__c) {
12132  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12133}
12134
12135static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12136                                               int __b, unsigned char *__c) {
12137  __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12138}
12139
12140#endif
12141
12142#ifdef __VSX__
12143#define vec_xxpermdi __builtin_vsx_xxpermdi
12144#define vec_xxsldwi __builtin_vsx_xxsldwi
12145#endif
12146
12147/* vec_xor */
12148
12149#define __builtin_altivec_vxor vec_xor
12150
12151static __inline__ vector signed char __ATTRS_o_ai
12152vec_xor(vector signed char __a, vector signed char __b) {
12153  return __a ^ __b;
12154}
12155
12156static __inline__ vector signed char __ATTRS_o_ai
12157vec_xor(vector bool char __a, vector signed char __b) {
12158  return (vector signed char)__a ^ __b;
12159}
12160
12161static __inline__ vector signed char __ATTRS_o_ai
12162vec_xor(vector signed char __a, vector bool char __b) {
12163  return __a ^ (vector signed char)__b;
12164}
12165
12166static __inline__ vector unsigned char __ATTRS_o_ai
12167vec_xor(vector unsigned char __a, vector unsigned char __b) {
12168  return __a ^ __b;
12169}
12170
12171static __inline__ vector unsigned char __ATTRS_o_ai
12172vec_xor(vector bool char __a, vector unsigned char __b) {
12173  return (vector unsigned char)__a ^ __b;
12174}
12175
12176static __inline__ vector unsigned char __ATTRS_o_ai
12177vec_xor(vector unsigned char __a, vector bool char __b) {
12178  return __a ^ (vector unsigned char)__b;
12179}
12180
12181static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12182                                                        vector bool char __b) {
12183  return __a ^ __b;
12184}
12185
12186static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12187                                                    vector short __b) {
12188  return __a ^ __b;
12189}
12190
12191static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12192                                                    vector short __b) {
12193  return (vector short)__a ^ __b;
12194}
12195
12196static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12197                                                    vector bool short __b) {
12198  return __a ^ (vector short)__b;
12199}
12200
12201static __inline__ vector unsigned short __ATTRS_o_ai
12202vec_xor(vector unsigned short __a, vector unsigned short __b) {
12203  return __a ^ __b;
12204}
12205
12206static __inline__ vector unsigned short __ATTRS_o_ai
12207vec_xor(vector bool short __a, vector unsigned short __b) {
12208  return (vector unsigned short)__a ^ __b;
12209}
12210
12211static __inline__ vector unsigned short __ATTRS_o_ai
12212vec_xor(vector unsigned short __a, vector bool short __b) {
12213  return __a ^ (vector unsigned short)__b;
12214}
12215
12216static __inline__ vector bool short __ATTRS_o_ai
12217vec_xor(vector bool short __a, vector bool short __b) {
12218  return __a ^ __b;
12219}
12220
12221static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12222                                                  vector int __b) {
12223  return __a ^ __b;
12224}
12225
12226static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12227                                                  vector int __b) {
12228  return (vector int)__a ^ __b;
12229}
12230
12231static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12232                                                  vector bool int __b) {
12233  return __a ^ (vector int)__b;
12234}
12235
12236static __inline__ vector unsigned int __ATTRS_o_ai
12237vec_xor(vector unsigned int __a, vector unsigned int __b) {
12238  return __a ^ __b;
12239}
12240
12241static __inline__ vector unsigned int __ATTRS_o_ai
12242vec_xor(vector bool int __a, vector unsigned int __b) {
12243  return (vector unsigned int)__a ^ __b;
12244}
12245
12246static __inline__ vector unsigned int __ATTRS_o_ai
12247vec_xor(vector unsigned int __a, vector bool int __b) {
12248  return __a ^ (vector unsigned int)__b;
12249}
12250
12251static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12252                                                       vector bool int __b) {
12253  return __a ^ __b;
12254}
12255
12256static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12257                                                    vector float __b) {
12258  vector unsigned int __res =
12259      (vector unsigned int)__a ^ (vector unsigned int)__b;
12260  return (vector float)__res;
12261}
12262
12263static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12264                                                    vector float __b) {
12265  vector unsigned int __res =
12266      (vector unsigned int)__a ^ (vector unsigned int)__b;
12267  return (vector float)__res;
12268}
12269
12270static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12271                                                    vector bool int __b) {
12272  vector unsigned int __res =
12273      (vector unsigned int)__a ^ (vector unsigned int)__b;
12274  return (vector float)__res;
12275}
12276
12277#ifdef __VSX__
12278static __inline__ vector signed long long __ATTRS_o_ai
12279vec_xor(vector signed long long __a, vector signed long long __b) {
12280  return __a ^ __b;
12281}
12282
12283static __inline__ vector signed long long __ATTRS_o_ai
12284vec_xor(vector bool long long __a, vector signed long long __b) {
12285  return (vector signed long long)__a ^ __b;
12286}
12287
12288static __inline__ vector signed long long __ATTRS_o_ai
12289vec_xor(vector signed long long __a, vector bool long long __b) {
12290  return __a ^ (vector signed long long)__b;
12291}
12292
12293static __inline__ vector unsigned long long __ATTRS_o_ai
12294vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12295  return __a ^ __b;
12296}
12297
12298static __inline__ vector unsigned long long __ATTRS_o_ai
12299vec_xor(vector bool long long __a, vector unsigned long long __b) {
12300  return (vector unsigned long long)__a ^ __b;
12301}
12302
12303static __inline__ vector unsigned long long __ATTRS_o_ai
12304vec_xor(vector unsigned long long __a, vector bool long long __b) {
12305  return __a ^ (vector unsigned long long)__b;
12306}
12307
12308static __inline__ vector bool long long __ATTRS_o_ai
12309vec_xor(vector bool long long __a, vector bool long long __b) {
12310  return __a ^ __b;
12311}
12312
12313static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12314                                                     vector double __b) {
12315  return (vector double)((vector unsigned long long)__a ^
12316                         (vector unsigned long long)__b);
12317}
12318
12319static __inline__ vector double __ATTRS_o_ai
12320vec_xor(vector double __a, vector bool long long __b) {
12321  return (vector double)((vector unsigned long long)__a ^
12322                         (vector unsigned long long)__b);
12323}
12324
12325static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12326                                                     vector double __b) {
12327  return (vector double)((vector unsigned long long)__a ^
12328                         (vector unsigned long long)__b);
12329}
12330#endif
12331
12332/* vec_vxor */
12333
12334static __inline__ vector signed char __ATTRS_o_ai
12335vec_vxor(vector signed char __a, vector signed char __b) {
12336  return __a ^ __b;
12337}
12338
12339static __inline__ vector signed char __ATTRS_o_ai
12340vec_vxor(vector bool char __a, vector signed char __b) {
12341  return (vector signed char)__a ^ __b;
12342}
12343
12344static __inline__ vector signed char __ATTRS_o_ai
12345vec_vxor(vector signed char __a, vector bool char __b) {
12346  return __a ^ (vector signed char)__b;
12347}
12348
12349static __inline__ vector unsigned char __ATTRS_o_ai
12350vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12351  return __a ^ __b;
12352}
12353
12354static __inline__ vector unsigned char __ATTRS_o_ai
12355vec_vxor(vector bool char __a, vector unsigned char __b) {
12356  return (vector unsigned char)__a ^ __b;
12357}
12358
12359static __inline__ vector unsigned char __ATTRS_o_ai
12360vec_vxor(vector unsigned char __a, vector bool char __b) {
12361  return __a ^ (vector unsigned char)__b;
12362}
12363
12364static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12365                                                         vector bool char __b) {
12366  return __a ^ __b;
12367}
12368
12369static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12370                                                     vector short __b) {
12371  return __a ^ __b;
12372}
12373
12374static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12375                                                     vector short __b) {
12376  return (vector short)__a ^ __b;
12377}
12378
12379static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12380                                                     vector bool short __b) {
12381  return __a ^ (vector short)__b;
12382}
12383
12384static __inline__ vector unsigned short __ATTRS_o_ai
12385vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12386  return __a ^ __b;
12387}
12388
12389static __inline__ vector unsigned short __ATTRS_o_ai
12390vec_vxor(vector bool short __a, vector unsigned short __b) {
12391  return (vector unsigned short)__a ^ __b;
12392}
12393
12394static __inline__ vector unsigned short __ATTRS_o_ai
12395vec_vxor(vector unsigned short __a, vector bool short __b) {
12396  return __a ^ (vector unsigned short)__b;
12397}
12398
12399static __inline__ vector bool short __ATTRS_o_ai
12400vec_vxor(vector bool short __a, vector bool short __b) {
12401  return __a ^ __b;
12402}
12403
12404static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12405                                                   vector int __b) {
12406  return __a ^ __b;
12407}
12408
12409static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12410                                                   vector int __b) {
12411  return (vector int)__a ^ __b;
12412}
12413
12414static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12415                                                   vector bool int __b) {
12416  return __a ^ (vector int)__b;
12417}
12418
12419static __inline__ vector unsigned int __ATTRS_o_ai
12420vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12421  return __a ^ __b;
12422}
12423
12424static __inline__ vector unsigned int __ATTRS_o_ai
12425vec_vxor(vector bool int __a, vector unsigned int __b) {
12426  return (vector unsigned int)__a ^ __b;
12427}
12428
12429static __inline__ vector unsigned int __ATTRS_o_ai
12430vec_vxor(vector unsigned int __a, vector bool int __b) {
12431  return __a ^ (vector unsigned int)__b;
12432}
12433
12434static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12435                                                        vector bool int __b) {
12436  return __a ^ __b;
12437}
12438
12439static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12440                                                     vector float __b) {
12441  vector unsigned int __res =
12442      (vector unsigned int)__a ^ (vector unsigned int)__b;
12443  return (vector float)__res;
12444}
12445
12446static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12447                                                     vector float __b) {
12448  vector unsigned int __res =
12449      (vector unsigned int)__a ^ (vector unsigned int)__b;
12450  return (vector float)__res;
12451}
12452
12453static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12454                                                     vector bool int __b) {
12455  vector unsigned int __res =
12456      (vector unsigned int)__a ^ (vector unsigned int)__b;
12457  return (vector float)__res;
12458}
12459
12460#ifdef __VSX__
12461static __inline__ vector signed long long __ATTRS_o_ai
12462vec_vxor(vector signed long long __a, vector signed long long __b) {
12463  return __a ^ __b;
12464}
12465
12466static __inline__ vector signed long long __ATTRS_o_ai
12467vec_vxor(vector bool long long __a, vector signed long long __b) {
12468  return (vector signed long long)__a ^ __b;
12469}
12470
12471static __inline__ vector signed long long __ATTRS_o_ai
12472vec_vxor(vector signed long long __a, vector bool long long __b) {
12473  return __a ^ (vector signed long long)__b;
12474}
12475
12476static __inline__ vector unsigned long long __ATTRS_o_ai
12477vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12478  return __a ^ __b;
12479}
12480
12481static __inline__ vector unsigned long long __ATTRS_o_ai
12482vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12483  return (vector unsigned long long)__a ^ __b;
12484}
12485
12486static __inline__ vector unsigned long long __ATTRS_o_ai
12487vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12488  return __a ^ (vector unsigned long long)__b;
12489}
12490
12491static __inline__ vector bool long long __ATTRS_o_ai
12492vec_vxor(vector bool long long __a, vector bool long long __b) {
12493  return __a ^ __b;
12494}
12495#endif
12496
12497/* ------------------------ extensions for CBEA ----------------------------- */
12498
12499/* vec_extract */
12500
12501static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12502                                                       int __b) {
12503  return __a[__b];
12504}
12505
12506static __inline__ unsigned char __ATTRS_o_ai
12507vec_extract(vector unsigned char __a, int __b) {
12508  return __a[__b];
12509}
12510
12511static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12512                                                         int __b) {
12513  return __a[__b];
12514}
12515
12516static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12517                                                        int __b) {
12518  return __a[__b];
12519}
12520
12521static __inline__ unsigned short __ATTRS_o_ai
12522vec_extract(vector unsigned short __a, int __b) {
12523  return __a[__b];
12524}
12525
12526static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12527                                                          int __b) {
12528  return __a[__b];
12529}
12530
12531static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12532                                                      int __b) {
12533  return __a[__b];
12534}
12535
12536static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12537                                                        int __b) {
12538  return __a[__b];
12539}
12540
12541static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12542                                                        int __b) {
12543  return __a[__b];
12544}
12545
12546#ifdef __VSX__
12547static __inline__ signed long long __ATTRS_o_ai
12548vec_extract(vector signed long long __a, int __b) {
12549  return __a[__b];
12550}
12551
12552static __inline__ unsigned long long __ATTRS_o_ai
12553vec_extract(vector unsigned long long __a, int __b) {
12554  return __a[__b];
12555}
12556
12557static __inline__ unsigned long long __ATTRS_o_ai
12558vec_extract(vector bool long long __a, int __b) {
12559  return __a[__b];
12560}
12561
12562static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12563  return __a[__b];
12564}
12565#endif
12566
12567static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12568  return __a[__b];
12569}
12570
12571#ifdef __POWER9_VECTOR__
12572
12573#define vec_insert4b __builtin_vsx_insertword
12574#define vec_extract4b __builtin_vsx_extractuword
12575
12576/* vec_extract_exp */
12577
12578static __inline__ vector unsigned int __ATTRS_o_ai
12579vec_extract_exp(vector float __a) {
12580  return __builtin_vsx_xvxexpsp(__a);
12581}
12582
12583static __inline__ vector unsigned long long __ATTRS_o_ai
12584vec_extract_exp(vector double __a) {
12585  return __builtin_vsx_xvxexpdp(__a);
12586}
12587
12588/* vec_extract_sig */
12589
12590static __inline__ vector unsigned int __ATTRS_o_ai
12591vec_extract_sig(vector float __a) {
12592  return __builtin_vsx_xvxsigsp(__a);
12593}
12594
12595static __inline__ vector unsigned long long __ATTRS_o_ai
12596vec_extract_sig (vector double __a) {
12597  return __builtin_vsx_xvxsigdp(__a);
12598}
12599
12600static __inline__ vector float __ATTRS_o_ai
12601vec_extract_fp32_from_shorth(vector unsigned short __a) {
12602  vector unsigned short __b =
12603#ifdef __LITTLE_ENDIAN__
12604            __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12605#else
12606            __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12607#endif
12608  return __builtin_vsx_xvcvhpsp(__b);
12609}
12610
12611static __inline__ vector float __ATTRS_o_ai
12612vec_extract_fp32_from_shortl(vector unsigned short __a) {
12613  vector unsigned short __b =
12614#ifdef __LITTLE_ENDIAN__
12615            __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12616#else
12617            __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12618#endif
12619  return __builtin_vsx_xvcvhpsp(__b);
12620}
12621#endif /* __POWER9_VECTOR__ */
12622
12623/* vec_insert */
12624
12625static __inline__ vector signed char __ATTRS_o_ai
12626vec_insert(signed char __a, vector signed char __b, int __c) {
12627  __b[__c] = __a;
12628  return __b;
12629}
12630
12631static __inline__ vector unsigned char __ATTRS_o_ai
12632vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12633  __b[__c] = __a;
12634  return __b;
12635}
12636
12637static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12638                                                           vector bool char __b,
12639                                                           int __c) {
12640  __b[__c] = __a;
12641  return __b;
12642}
12643
12644static __inline__ vector signed short __ATTRS_o_ai
12645vec_insert(signed short __a, vector signed short __b, int __c) {
12646  __b[__c] = __a;
12647  return __b;
12648}
12649
12650static __inline__ vector unsigned short __ATTRS_o_ai
12651vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12652  __b[__c] = __a;
12653  return __b;
12654}
12655
12656static __inline__ vector bool short __ATTRS_o_ai
12657vec_insert(unsigned short __a, vector bool short __b, int __c) {
12658  __b[__c] = __a;
12659  return __b;
12660}
12661
12662static __inline__ vector signed int __ATTRS_o_ai
12663vec_insert(signed int __a, vector signed int __b, int __c) {
12664  __b[__c] = __a;
12665  return __b;
12666}
12667
12668static __inline__ vector unsigned int __ATTRS_o_ai
12669vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12670  __b[__c] = __a;
12671  return __b;
12672}
12673
12674static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12675                                                          vector bool int __b,
12676                                                          int __c) {
12677  __b[__c] = __a;
12678  return __b;
12679}
12680
12681#ifdef __VSX__
12682static __inline__ vector signed long long __ATTRS_o_ai
12683vec_insert(signed long long __a, vector signed long long __b, int __c) {
12684  __b[__c] = __a;
12685  return __b;
12686}
12687
12688static __inline__ vector unsigned long long __ATTRS_o_ai
12689vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12690  __b[__c] = __a;
12691  return __b;
12692}
12693
12694static __inline__ vector bool long long __ATTRS_o_ai
12695vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12696  __b[__c] = __a;
12697  return __b;
12698}
12699static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12700                                                        vector double __b,
12701                                                        int __c) {
12702  __b[__c] = __a;
12703  return __b;
12704}
12705#endif
12706
12707static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12708                                                       vector float __b,
12709                                                       int __c) {
12710  __b[__c] = __a;
12711  return __b;
12712}
12713
12714/* vec_lvlx */
12715
12716static __inline__ vector signed char __ATTRS_o_ai
12717vec_lvlx(int __a, const signed char *__b) {
12718  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12719                  vec_lvsl(__a, __b));
12720}
12721
12722static __inline__ vector signed char __ATTRS_o_ai
12723vec_lvlx(int __a, const vector signed char *__b) {
12724  return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12725                  vec_lvsl(__a, (unsigned char *)__b));
12726}
12727
12728static __inline__ vector unsigned char __ATTRS_o_ai
12729vec_lvlx(int __a, const unsigned char *__b) {
12730  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12731                  vec_lvsl(__a, __b));
12732}
12733
12734static __inline__ vector unsigned char __ATTRS_o_ai
12735vec_lvlx(int __a, const vector unsigned char *__b) {
12736  return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12737                  vec_lvsl(__a, (unsigned char *)__b));
12738}
12739
12740static __inline__ vector bool char __ATTRS_o_ai
12741vec_lvlx(int __a, const vector bool char *__b) {
12742  return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12743                  vec_lvsl(__a, (unsigned char *)__b));
12744}
12745
12746static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12747                                                     const short *__b) {
12748  return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12749}
12750
12751static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12752                                                     const vector short *__b) {
12753  return vec_perm(vec_ld(__a, __b), (vector short)(0),
12754                  vec_lvsl(__a, (unsigned char *)__b));
12755}
12756
12757static __inline__ vector unsigned short __ATTRS_o_ai
12758vec_lvlx(int __a, const unsigned short *__b) {
12759  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12760                  vec_lvsl(__a, __b));
12761}
12762
12763static __inline__ vector unsigned short __ATTRS_o_ai
12764vec_lvlx(int __a, const vector unsigned short *__b) {
12765  return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12766                  vec_lvsl(__a, (unsigned char *)__b));
12767}
12768
12769static __inline__ vector bool short __ATTRS_o_ai
12770vec_lvlx(int __a, const vector bool short *__b) {
12771  return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12772                  vec_lvsl(__a, (unsigned char *)__b));
12773}
12774
12775static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12776                                                     const vector pixel *__b) {
12777  return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12778                  vec_lvsl(__a, (unsigned char *)__b));
12779}
12780
12781static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12782  return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12783}
12784
12785static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12786                                                   const vector int *__b) {
12787  return vec_perm(vec_ld(__a, __b), (vector int)(0),
12788                  vec_lvsl(__a, (unsigned char *)__b));
12789}
12790
12791static __inline__ vector unsigned int __ATTRS_o_ai
12792vec_lvlx(int __a, const unsigned int *__b) {
12793  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12794                  vec_lvsl(__a, __b));
12795}
12796
12797static __inline__ vector unsigned int __ATTRS_o_ai
12798vec_lvlx(int __a, const vector unsigned int *__b) {
12799  return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12800                  vec_lvsl(__a, (unsigned char *)__b));
12801}
12802
12803static __inline__ vector bool int __ATTRS_o_ai
12804vec_lvlx(int __a, const vector bool int *__b) {
12805  return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12806                  vec_lvsl(__a, (unsigned char *)__b));
12807}
12808
12809static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12810                                                     const float *__b) {
12811  return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12812}
12813
12814static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12815                                                     const vector float *__b) {
12816  return vec_perm(vec_ld(__a, __b), (vector float)(0),
12817                  vec_lvsl(__a, (unsigned char *)__b));
12818}
12819
12820/* vec_lvlxl */
12821
12822static __inline__ vector signed char __ATTRS_o_ai
12823vec_lvlxl(int __a, const signed char *__b) {
12824  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12825                  vec_lvsl(__a, __b));
12826}
12827
12828static __inline__ vector signed char __ATTRS_o_ai
12829vec_lvlxl(int __a, const vector signed char *__b) {
12830  return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12831                  vec_lvsl(__a, (unsigned char *)__b));
12832}
12833
12834static __inline__ vector unsigned char __ATTRS_o_ai
12835vec_lvlxl(int __a, const unsigned char *__b) {
12836  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12837                  vec_lvsl(__a, __b));
12838}
12839
12840static __inline__ vector unsigned char __ATTRS_o_ai
12841vec_lvlxl(int __a, const vector unsigned char *__b) {
12842  return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12843                  vec_lvsl(__a, (unsigned char *)__b));
12844}
12845
12846static __inline__ vector bool char __ATTRS_o_ai
12847vec_lvlxl(int __a, const vector bool char *__b) {
12848  return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12849                  vec_lvsl(__a, (unsigned char *)__b));
12850}
12851
12852static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12853                                                      const short *__b) {
12854  return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12855}
12856
12857static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12858                                                      const vector short *__b) {
12859  return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12860                  vec_lvsl(__a, (unsigned char *)__b));
12861}
12862
12863static __inline__ vector unsigned short __ATTRS_o_ai
12864vec_lvlxl(int __a, const unsigned short *__b) {
12865  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12866                  vec_lvsl(__a, __b));
12867}
12868
12869static __inline__ vector unsigned short __ATTRS_o_ai
12870vec_lvlxl(int __a, const vector unsigned short *__b) {
12871  return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12872                  vec_lvsl(__a, (unsigned char *)__b));
12873}
12874
12875static __inline__ vector bool short __ATTRS_o_ai
12876vec_lvlxl(int __a, const vector bool short *__b) {
12877  return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12878                  vec_lvsl(__a, (unsigned char *)__b));
12879}
12880
12881static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12882                                                      const vector pixel *__b) {
12883  return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12884                  vec_lvsl(__a, (unsigned char *)__b));
12885}
12886
12887static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12888  return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12889}
12890
12891static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12892                                                    const vector int *__b) {
12893  return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12894                  vec_lvsl(__a, (unsigned char *)__b));
12895}
12896
12897static __inline__ vector unsigned int __ATTRS_o_ai
12898vec_lvlxl(int __a, const unsigned int *__b) {
12899  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12900                  vec_lvsl(__a, __b));
12901}
12902
12903static __inline__ vector unsigned int __ATTRS_o_ai
12904vec_lvlxl(int __a, const vector unsigned int *__b) {
12905  return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12906                  vec_lvsl(__a, (unsigned char *)__b));
12907}
12908
12909static __inline__ vector bool int __ATTRS_o_ai
12910vec_lvlxl(int __a, const vector bool int *__b) {
12911  return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12912                  vec_lvsl(__a, (unsigned char *)__b));
12913}
12914
12915static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12916                                                      const float *__b) {
12917  return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12918}
12919
12920static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12921                                                      vector float *__b) {
12922  return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12923                  vec_lvsl(__a, (unsigned char *)__b));
12924}
12925
12926/* vec_lvrx */
12927
12928static __inline__ vector signed char __ATTRS_o_ai
12929vec_lvrx(int __a, const signed char *__b) {
12930  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12931                  vec_lvsl(__a, __b));
12932}
12933
12934static __inline__ vector signed char __ATTRS_o_ai
12935vec_lvrx(int __a, const vector signed char *__b) {
12936  return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12937                  vec_lvsl(__a, (unsigned char *)__b));
12938}
12939
12940static __inline__ vector unsigned char __ATTRS_o_ai
12941vec_lvrx(int __a, const unsigned char *__b) {
12942  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12943                  vec_lvsl(__a, __b));
12944}
12945
12946static __inline__ vector unsigned char __ATTRS_o_ai
12947vec_lvrx(int __a, const vector unsigned char *__b) {
12948  return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12949                  vec_lvsl(__a, (unsigned char *)__b));
12950}
12951
12952static __inline__ vector bool char __ATTRS_o_ai
12953vec_lvrx(int __a, const vector bool char *__b) {
12954  return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12955                  vec_lvsl(__a, (unsigned char *)__b));
12956}
12957
12958static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12959                                                     const short *__b) {
12960  return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12961}
12962
12963static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12964                                                     const vector short *__b) {
12965  return vec_perm((vector short)(0), vec_ld(__a, __b),
12966                  vec_lvsl(__a, (unsigned char *)__b));
12967}
12968
12969static __inline__ vector unsigned short __ATTRS_o_ai
12970vec_lvrx(int __a, const unsigned short *__b) {
12971  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12972                  vec_lvsl(__a, __b));
12973}
12974
12975static __inline__ vector unsigned short __ATTRS_o_ai
12976vec_lvrx(int __a, const vector unsigned short *__b) {
12977  return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12978                  vec_lvsl(__a, (unsigned char *)__b));
12979}
12980
12981static __inline__ vector bool short __ATTRS_o_ai
12982vec_lvrx(int __a, const vector bool short *__b) {
12983  return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12984                  vec_lvsl(__a, (unsigned char *)__b));
12985}
12986
12987static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12988                                                     const vector pixel *__b) {
12989  return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12990                  vec_lvsl(__a, (unsigned char *)__b));
12991}
12992
12993static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
12994  return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12995}
12996
12997static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
12998                                                   const vector int *__b) {
12999  return vec_perm((vector int)(0), vec_ld(__a, __b),
13000                  vec_lvsl(__a, (unsigned char *)__b));
13001}
13002
13003static __inline__ vector unsigned int __ATTRS_o_ai
13004vec_lvrx(int __a, const unsigned int *__b) {
13005  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13006                  vec_lvsl(__a, __b));
13007}
13008
13009static __inline__ vector unsigned int __ATTRS_o_ai
13010vec_lvrx(int __a, const vector unsigned int *__b) {
13011  return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13012                  vec_lvsl(__a, (unsigned char *)__b));
13013}
13014
13015static __inline__ vector bool int __ATTRS_o_ai
13016vec_lvrx(int __a, const vector bool int *__b) {
13017  return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13018                  vec_lvsl(__a, (unsigned char *)__b));
13019}
13020
13021static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13022                                                     const float *__b) {
13023  return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13024}
13025
13026static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13027                                                     const vector float *__b) {
13028  return vec_perm((vector float)(0), vec_ld(__a, __b),
13029                  vec_lvsl(__a, (unsigned char *)__b));
13030}
13031
13032/* vec_lvrxl */
13033
13034static __inline__ vector signed char __ATTRS_o_ai
13035vec_lvrxl(int __a, const signed char *__b) {
13036  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13037                  vec_lvsl(__a, __b));
13038}
13039
13040static __inline__ vector signed char __ATTRS_o_ai
13041vec_lvrxl(int __a, const vector signed char *__b) {
13042  return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13043                  vec_lvsl(__a, (unsigned char *)__b));
13044}
13045
13046static __inline__ vector unsigned char __ATTRS_o_ai
13047vec_lvrxl(int __a, const unsigned char *__b) {
13048  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13049                  vec_lvsl(__a, __b));
13050}
13051
13052static __inline__ vector unsigned char __ATTRS_o_ai
13053vec_lvrxl(int __a, const vector unsigned char *__b) {
13054  return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13055                  vec_lvsl(__a, (unsigned char *)__b));
13056}
13057
13058static __inline__ vector bool char __ATTRS_o_ai
13059vec_lvrxl(int __a, const vector bool char *__b) {
13060  return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13061                  vec_lvsl(__a, (unsigned char *)__b));
13062}
13063
13064static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13065                                                      const short *__b) {
13066  return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13067}
13068
13069static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13070                                                      const vector short *__b) {
13071  return vec_perm((vector short)(0), vec_ldl(__a, __b),
13072                  vec_lvsl(__a, (unsigned char *)__b));
13073}
13074
13075static __inline__ vector unsigned short __ATTRS_o_ai
13076vec_lvrxl(int __a, const unsigned short *__b) {
13077  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13078                  vec_lvsl(__a, __b));
13079}
13080
13081static __inline__ vector unsigned short __ATTRS_o_ai
13082vec_lvrxl(int __a, const vector unsigned short *__b) {
13083  return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13084                  vec_lvsl(__a, (unsigned char *)__b));
13085}
13086
13087static __inline__ vector bool short __ATTRS_o_ai
13088vec_lvrxl(int __a, const vector bool short *__b) {
13089  return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13090                  vec_lvsl(__a, (unsigned char *)__b));
13091}
13092
13093static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13094                                                      const vector pixel *__b) {
13095  return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13096                  vec_lvsl(__a, (unsigned char *)__b));
13097}
13098
13099static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13100  return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13101}
13102
13103static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13104                                                    const vector int *__b) {
13105  return vec_perm((vector int)(0), vec_ldl(__a, __b),
13106                  vec_lvsl(__a, (unsigned char *)__b));
13107}
13108
13109static __inline__ vector unsigned int __ATTRS_o_ai
13110vec_lvrxl(int __a, const unsigned int *__b) {
13111  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13112                  vec_lvsl(__a, __b));
13113}
13114
13115static __inline__ vector unsigned int __ATTRS_o_ai
13116vec_lvrxl(int __a, const vector unsigned int *__b) {
13117  return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13118                  vec_lvsl(__a, (unsigned char *)__b));
13119}
13120
13121static __inline__ vector bool int __ATTRS_o_ai
13122vec_lvrxl(int __a, const vector bool int *__b) {
13123  return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13124                  vec_lvsl(__a, (unsigned char *)__b));
13125}
13126
13127static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13128                                                      const float *__b) {
13129  return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13130}
13131
13132static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13133                                                      const vector float *__b) {
13134  return vec_perm((vector float)(0), vec_ldl(__a, __b),
13135                  vec_lvsl(__a, (unsigned char *)__b));
13136}
13137
13138/* vec_stvlx */
13139
13140static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13141                                              signed char *__c) {
13142  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13143                __c);
13144}
13145
13146static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13147                                              vector signed char *__c) {
13148  return vec_st(
13149      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13150      __b, __c);
13151}
13152
13153static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13154                                              unsigned char *__c) {
13155  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13156                __c);
13157}
13158
13159static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13160                                              vector unsigned char *__c) {
13161  return vec_st(
13162      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13163      __b, __c);
13164}
13165
13166static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13167                                              vector bool char *__c) {
13168  return vec_st(
13169      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13170      __b, __c);
13171}
13172
13173static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13174                                              short *__c) {
13175  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13176                __c);
13177}
13178
13179static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13180                                              vector short *__c) {
13181  return vec_st(
13182      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13183      __b, __c);
13184}
13185
13186static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13187                                              int __b, unsigned short *__c) {
13188  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13189                __c);
13190}
13191
13192static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13193                                              int __b,
13194                                              vector unsigned short *__c) {
13195  return vec_st(
13196      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13197      __b, __c);
13198}
13199
13200static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13201                                              vector bool short *__c) {
13202  return vec_st(
13203      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13204      __b, __c);
13205}
13206
13207static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13208                                              vector pixel *__c) {
13209  return vec_st(
13210      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13211      __b, __c);
13212}
13213
13214static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13215                                              int *__c) {
13216  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13217                __c);
13218}
13219
13220static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13221                                              vector int *__c) {
13222  return vec_st(
13223      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13224      __b, __c);
13225}
13226
13227static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13228                                              unsigned int *__c) {
13229  return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13230                __c);
13231}
13232
13233static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13234                                              vector unsigned int *__c) {
13235  return vec_st(
13236      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13237      __b, __c);
13238}
13239
13240static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13241                                              vector bool int *__c) {
13242  return vec_st(
13243      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13244      __b, __c);
13245}
13246
13247static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13248                                              vector float *__c) {
13249  return vec_st(
13250      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13251      __b, __c);
13252}
13253
13254/* vec_stvlxl */
13255
13256static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13257                                               signed char *__c) {
13258  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13259                 __c);
13260}
13261
13262static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13263                                               vector signed char *__c) {
13264  return vec_stl(
13265      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13266      __b, __c);
13267}
13268
13269static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13270                                               int __b, unsigned char *__c) {
13271  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13272                 __c);
13273}
13274
13275static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13276                                               int __b,
13277                                               vector unsigned char *__c) {
13278  return vec_stl(
13279      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13280      __b, __c);
13281}
13282
13283static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13284                                               vector bool char *__c) {
13285  return vec_stl(
13286      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13287      __b, __c);
13288}
13289
13290static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13291                                               short *__c) {
13292  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13293                 __c);
13294}
13295
13296static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13297                                               vector short *__c) {
13298  return vec_stl(
13299      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13300      __b, __c);
13301}
13302
13303static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13304                                               int __b, unsigned short *__c) {
13305  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13306                 __c);
13307}
13308
13309static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13310                                               int __b,
13311                                               vector unsigned short *__c) {
13312  return vec_stl(
13313      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13314      __b, __c);
13315}
13316
13317static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13318                                               vector bool short *__c) {
13319  return vec_stl(
13320      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13321      __b, __c);
13322}
13323
13324static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13325                                               vector pixel *__c) {
13326  return vec_stl(
13327      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13328      __b, __c);
13329}
13330
13331static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13332                                               int *__c) {
13333  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13334                 __c);
13335}
13336
13337static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13338                                               vector int *__c) {
13339  return vec_stl(
13340      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13341      __b, __c);
13342}
13343
13344static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13345                                               unsigned int *__c) {
13346  return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13347                 __c);
13348}
13349
13350static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13351                                               vector unsigned int *__c) {
13352  return vec_stl(
13353      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13354      __b, __c);
13355}
13356
13357static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13358                                               vector bool int *__c) {
13359  return vec_stl(
13360      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13361      __b, __c);
13362}
13363
13364static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13365                                               vector float *__c) {
13366  return vec_stl(
13367      vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13368      __b, __c);
13369}
13370
13371/* vec_stvrx */
13372
13373static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13374                                              signed char *__c) {
13375  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13376                __c);
13377}
13378
13379static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13380                                              vector signed char *__c) {
13381  return vec_st(
13382      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13383      __b, __c);
13384}
13385
13386static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13387                                              unsigned char *__c) {
13388  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13389                __c);
13390}
13391
13392static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13393                                              vector unsigned char *__c) {
13394  return vec_st(
13395      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13396      __b, __c);
13397}
13398
13399static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13400                                              vector bool char *__c) {
13401  return vec_st(
13402      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13403      __b, __c);
13404}
13405
13406static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13407                                              short *__c) {
13408  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13409                __c);
13410}
13411
13412static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13413                                              vector short *__c) {
13414  return vec_st(
13415      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13416      __b, __c);
13417}
13418
13419static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13420                                              int __b, unsigned short *__c) {
13421  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13422                __c);
13423}
13424
13425static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13426                                              int __b,
13427                                              vector unsigned short *__c) {
13428  return vec_st(
13429      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13430      __b, __c);
13431}
13432
13433static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13434                                              vector bool short *__c) {
13435  return vec_st(
13436      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13437      __b, __c);
13438}
13439
13440static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13441                                              vector pixel *__c) {
13442  return vec_st(
13443      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13444      __b, __c);
13445}
13446
13447static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13448                                              int *__c) {
13449  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13450                __c);
13451}
13452
13453static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13454                                              vector int *__c) {
13455  return vec_st(
13456      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13457      __b, __c);
13458}
13459
13460static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13461                                              unsigned int *__c) {
13462  return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13463                __c);
13464}
13465
13466static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13467                                              vector unsigned int *__c) {
13468  return vec_st(
13469      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13470      __b, __c);
13471}
13472
13473static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13474                                              vector bool int *__c) {
13475  return vec_st(
13476      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13477      __b, __c);
13478}
13479
13480static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13481                                              vector float *__c) {
13482  return vec_st(
13483      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13484      __b, __c);
13485}
13486
13487/* vec_stvrxl */
13488
13489static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13490                                               signed char *__c) {
13491  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13492                 __c);
13493}
13494
13495static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13496                                               vector signed char *__c) {
13497  return vec_stl(
13498      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13499      __b, __c);
13500}
13501
13502static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13503                                               int __b, unsigned char *__c) {
13504  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13505                 __c);
13506}
13507
13508static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13509                                               int __b,
13510                                               vector unsigned char *__c) {
13511  return vec_stl(
13512      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13513      __b, __c);
13514}
13515
13516static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13517                                               vector bool char *__c) {
13518  return vec_stl(
13519      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13520      __b, __c);
13521}
13522
13523static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13524                                               short *__c) {
13525  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13526                 __c);
13527}
13528
13529static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13530                                               vector short *__c) {
13531  return vec_stl(
13532      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13533      __b, __c);
13534}
13535
13536static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13537                                               int __b, unsigned short *__c) {
13538  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13539                 __c);
13540}
13541
13542static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13543                                               int __b,
13544                                               vector unsigned short *__c) {
13545  return vec_stl(
13546      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13547      __b, __c);
13548}
13549
13550static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13551                                               vector bool short *__c) {
13552  return vec_stl(
13553      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13554      __b, __c);
13555}
13556
13557static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13558                                               vector pixel *__c) {
13559  return vec_stl(
13560      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13561      __b, __c);
13562}
13563
13564static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13565                                               int *__c) {
13566  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13567                 __c);
13568}
13569
13570static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13571                                               vector int *__c) {
13572  return vec_stl(
13573      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13574      __b, __c);
13575}
13576
13577static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13578                                               unsigned int *__c) {
13579  return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13580                 __c);
13581}
13582
13583static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13584                                               vector unsigned int *__c) {
13585  return vec_stl(
13586      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13587      __b, __c);
13588}
13589
13590static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13591                                               vector bool int *__c) {
13592  return vec_stl(
13593      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13594      __b, __c);
13595}
13596
13597static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13598                                               vector float *__c) {
13599  return vec_stl(
13600      vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13601      __b, __c);
13602}
13603
13604/* vec_promote */
13605
13606static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13607                                                              int __b) {
13608  vector signed char __res = (vector signed char)(0);
13609  __res[__b] = __a;
13610  return __res;
13611}
13612
13613static __inline__ vector unsigned char __ATTRS_o_ai
13614vec_promote(unsigned char __a, int __b) {
13615  vector unsigned char __res = (vector unsigned char)(0);
13616  __res[__b] = __a;
13617  return __res;
13618}
13619
13620static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13621  vector short __res = (vector short)(0);
13622  __res[__b] = __a;
13623  return __res;
13624}
13625
13626static __inline__ vector unsigned short __ATTRS_o_ai
13627vec_promote(unsigned short __a, int __b) {
13628  vector unsigned short __res = (vector unsigned short)(0);
13629  __res[__b] = __a;
13630  return __res;
13631}
13632
13633static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13634  vector int __res = (vector int)(0);
13635  __res[__b] = __a;
13636  return __res;
13637}
13638
13639static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13640                                                               int __b) {
13641  vector unsigned int __res = (vector unsigned int)(0);
13642  __res[__b] = __a;
13643  return __res;
13644}
13645
13646static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13647  vector float __res = (vector float)(0);
13648  __res[__b] = __a;
13649  return __res;
13650}
13651
13652/* vec_splats */
13653
13654static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13655  return (vector signed char)(__a);
13656}
13657
13658static __inline__ vector unsigned char __ATTRS_o_ai
13659vec_splats(unsigned char __a) {
13660  return (vector unsigned char)(__a);
13661}
13662
13663static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13664  return (vector short)(__a);
13665}
13666
13667static __inline__ vector unsigned short __ATTRS_o_ai
13668vec_splats(unsigned short __a) {
13669  return (vector unsigned short)(__a);
13670}
13671
13672static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13673  return (vector int)(__a);
13674}
13675
13676static __inline__ vector unsigned int __ATTRS_o_ai
13677vec_splats(unsigned int __a) {
13678  return (vector unsigned int)(__a);
13679}
13680
13681#ifdef __VSX__
13682static __inline__ vector signed long long __ATTRS_o_ai
13683vec_splats(signed long long __a) {
13684  return (vector signed long long)(__a);
13685}
13686
13687static __inline__ vector unsigned long long __ATTRS_o_ai
13688vec_splats(unsigned long long __a) {
13689  return (vector unsigned long long)(__a);
13690}
13691
13692#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13693static __inline__ vector signed __int128 __ATTRS_o_ai
13694vec_splats(signed __int128 __a) {
13695  return (vector signed __int128)(__a);
13696}
13697
13698static __inline__ vector unsigned __int128 __ATTRS_o_ai
13699vec_splats(unsigned __int128 __a) {
13700  return (vector unsigned __int128)(__a);
13701}
13702
13703#endif
13704
13705static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13706  return (vector double)(__a);
13707}
13708#endif
13709
13710static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13711  return (vector float)(__a);
13712}
13713
13714/* ----------------------------- predicates --------------------------------- */
13715
13716/* vec_all_eq */
13717
13718static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13719                                              vector signed char __b) {
13720  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13721                                      (vector char)__b);
13722}
13723
13724static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13725                                              vector bool char __b) {
13726  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13727                                      (vector char)__b);
13728}
13729
13730static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13731                                              vector unsigned char __b) {
13732  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13733                                      (vector char)__b);
13734}
13735
13736static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13737                                              vector bool char __b) {
13738  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13739                                      (vector char)__b);
13740}
13741
13742static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13743                                              vector signed char __b) {
13744  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13745                                      (vector char)__b);
13746}
13747
13748static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13749                                              vector unsigned char __b) {
13750  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13751                                      (vector char)__b);
13752}
13753
13754static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13755                                              vector bool char __b) {
13756  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13757                                      (vector char)__b);
13758}
13759
13760static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13761                                              vector short __b) {
13762  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13763}
13764
13765static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13766                                              vector bool short __b) {
13767  return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13768}
13769
13770static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13771                                              vector unsigned short __b) {
13772  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13773                                      (vector short)__b);
13774}
13775
13776static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13777                                              vector bool short __b) {
13778  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13779                                      (vector short)__b);
13780}
13781
13782static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13783                                              vector short __b) {
13784  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13785                                      (vector short)__b);
13786}
13787
13788static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13789                                              vector unsigned short __b) {
13790  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13791                                      (vector short)__b);
13792}
13793
13794static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13795                                              vector bool short __b) {
13796  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13797                                      (vector short)__b);
13798}
13799
13800static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13801                                              vector pixel __b) {
13802  return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13803                                      (vector short)__b);
13804}
13805
13806static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13807  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13808}
13809
13810static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13811                                              vector bool int __b) {
13812  return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13813}
13814
13815static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13816                                              vector unsigned int __b) {
13817  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13818                                      (vector int)__b);
13819}
13820
13821static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13822                                              vector bool int __b) {
13823  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13824                                      (vector int)__b);
13825}
13826
13827static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13828                                              vector int __b) {
13829  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13830                                      (vector int)__b);
13831}
13832
13833static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13834                                              vector unsigned int __b) {
13835  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13836                                      (vector int)__b);
13837}
13838
13839static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13840                                              vector bool int __b) {
13841  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13842                                      (vector int)__b);
13843}
13844
13845#ifdef __POWER8_VECTOR__
13846static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13847                                              vector signed long long __b) {
13848  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13849}
13850
13851static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13852                                              vector bool long long __b) {
13853  return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13854}
13855
13856static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13857                                              vector unsigned long long __b) {
13858  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13859                                      (vector long long)__b);
13860}
13861
13862static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13863                                              vector bool long long __b) {
13864  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13865                                      (vector long long)__b);
13866}
13867
13868static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13869                                              vector long long __b) {
13870  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13871                                      (vector long long)__b);
13872}
13873
13874static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13875                                              vector unsigned long long __b) {
13876  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13877                                      (vector long long)__b);
13878}
13879
13880static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13881                                              vector bool long long __b) {
13882  return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13883                                      (vector long long)__b);
13884}
13885#endif
13886
13887static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13888                                              vector float __b) {
13889#ifdef __VSX__
13890  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13891#else
13892  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13893#endif
13894}
13895
13896#ifdef __VSX__
13897static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13898                                              vector double __b) {
13899  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13900}
13901#endif
13902
13903/* vec_all_ge */
13904
13905static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13906                                              vector signed char __b) {
13907  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13908}
13909
13910static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13911                                              vector bool char __b) {
13912  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13913}
13914
13915static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13916                                              vector unsigned char __b) {
13917  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13918}
13919
13920static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13921                                              vector bool char __b) {
13922  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13923}
13924
13925static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13926                                              vector signed char __b) {
13927  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13928                                      (vector unsigned char)__a);
13929}
13930
13931static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13932                                              vector unsigned char __b) {
13933  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13934}
13935
13936static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13937                                              vector bool 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 short __a,
13943                                              vector short __b) {
13944  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13945}
13946
13947static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13948                                              vector bool short __b) {
13949  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13950}
13951
13952static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13953                                              vector unsigned short __b) {
13954  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13955}
13956
13957static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13958                                              vector bool short __b) {
13959  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13960                                      __a);
13961}
13962
13963static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13964                                              vector short __b) {
13965  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13966                                      (vector unsigned short)__a);
13967}
13968
13969static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13970                                              vector unsigned short __b) {
13971  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13972                                      (vector unsigned short)__a);
13973}
13974
13975static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13976                                              vector bool short __b) {
13977  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13978                                      (vector unsigned short)__a);
13979}
13980
13981static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13982  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13983}
13984
13985static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13986                                              vector bool int __b) {
13987  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13988}
13989
13990static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13991                                              vector unsigned int __b) {
13992  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13993}
13994
13995static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13996                                              vector bool int __b) {
13997  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
13998}
13999
14000static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14001                                              vector int __b) {
14002  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14003                                      (vector unsigned int)__a);
14004}
14005
14006static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14007                                              vector unsigned int __b) {
14008  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14009}
14010
14011static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14012                                              vector bool int __b) {
14013  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14014                                      (vector unsigned int)__a);
14015}
14016
14017#ifdef __POWER8_VECTOR__
14018static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14019                                              vector signed long long __b) {
14020  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14021}
14022static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14023                                              vector bool long long __b) {
14024  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14025                                      __a);
14026}
14027
14028static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14029                                              vector unsigned long long __b) {
14030  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14031}
14032
14033static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14034                                              vector bool long long __b) {
14035  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14036                                      __a);
14037}
14038
14039static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14040                                              vector signed long long __b) {
14041  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14042                                      (vector unsigned long long)__a);
14043}
14044
14045static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14046                                              vector unsigned long long __b) {
14047  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14048                                      (vector unsigned long long)__a);
14049}
14050
14051static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14052                                              vector bool long long __b) {
14053  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14054                                      (vector unsigned long long)__a);
14055}
14056#endif
14057
14058static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14059                                              vector float __b) {
14060#ifdef __VSX__
14061  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14062#else
14063  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14064#endif
14065}
14066
14067#ifdef __VSX__
14068static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14069                                              vector double __b) {
14070  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14071}
14072#endif
14073
14074/* vec_all_gt */
14075
14076static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14077                                              vector signed char __b) {
14078  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14079}
14080
14081static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14082                                              vector bool char __b) {
14083  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14084}
14085
14086static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14087                                              vector unsigned char __b) {
14088  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14089}
14090
14091static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14092                                              vector bool char __b) {
14093  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14094}
14095
14096static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14097                                              vector signed char __b) {
14098  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14099                                      (vector unsigned char)__b);
14100}
14101
14102static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14103                                              vector unsigned char __b) {
14104  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14105}
14106
14107static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14108                                              vector bool 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 short __a,
14114                                              vector short __b) {
14115  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14116}
14117
14118static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14119                                              vector bool short __b) {
14120  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14121}
14122
14123static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14124                                              vector unsigned short __b) {
14125  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14126}
14127
14128static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14129                                              vector bool short __b) {
14130  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14131                                      (vector unsigned short)__b);
14132}
14133
14134static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14135                                              vector short __b) {
14136  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14137                                      (vector unsigned short)__b);
14138}
14139
14140static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14141                                              vector unsigned short __b) {
14142  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14143                                      __b);
14144}
14145
14146static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14147                                              vector bool short __b) {
14148  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14149                                      (vector unsigned short)__b);
14150}
14151
14152static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14153  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14154}
14155
14156static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14157                                              vector bool int __b) {
14158  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14159}
14160
14161static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14162                                              vector unsigned int __b) {
14163  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14164}
14165
14166static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14167                                              vector bool int __b) {
14168  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14169}
14170
14171static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14172                                              vector int __b) {
14173  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14174                                      (vector unsigned int)__b);
14175}
14176
14177static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14178                                              vector unsigned int __b) {
14179  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14180}
14181
14182static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14183                                              vector bool int __b) {
14184  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14185                                      (vector unsigned int)__b);
14186}
14187
14188#ifdef __POWER8_VECTOR__
14189static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14190                                              vector signed long long __b) {
14191  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14192}
14193static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14194                                              vector bool long long __b) {
14195  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14196                                      (vector signed long long)__b);
14197}
14198
14199static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14200                                              vector unsigned long long __b) {
14201  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14202}
14203
14204static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14205                                              vector bool long long __b) {
14206  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14207                                      (vector unsigned long long)__b);
14208}
14209
14210static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14211                                              vector signed long long __b) {
14212  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14213                                      (vector unsigned long long)__b);
14214}
14215
14216static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14217                                              vector unsigned long long __b) {
14218  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14219                                      __b);
14220}
14221
14222static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14223                                              vector bool long long __b) {
14224  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14225                                      (vector unsigned long long)__b);
14226}
14227#endif
14228
14229static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14230                                              vector float __b) {
14231#ifdef __VSX__
14232  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14233#else
14234  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14235#endif
14236}
14237
14238#ifdef __VSX__
14239static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14240                                              vector double __b) {
14241  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14242}
14243#endif
14244
14245/* vec_all_in */
14246
14247static __inline__ int __attribute__((__always_inline__))
14248vec_all_in(vector float __a, vector float __b) {
14249  return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14250}
14251
14252/* vec_all_le */
14253
14254static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14255                                              vector signed char __b) {
14256  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14257}
14258
14259static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14260                                              vector bool char __b) {
14261  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14262}
14263
14264static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14265                                              vector unsigned char __b) {
14266  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14267}
14268
14269static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14270                                              vector bool char __b) {
14271  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14272}
14273
14274static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14275                                              vector signed char __b) {
14276  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14277                                      (vector unsigned char)__b);
14278}
14279
14280static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14281                                              vector unsigned char __b) {
14282  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14283}
14284
14285static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14286                                              vector bool 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 short __a,
14292                                              vector short __b) {
14293  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14294}
14295
14296static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14297                                              vector bool short __b) {
14298  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14299}
14300
14301static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14302                                              vector unsigned short __b) {
14303  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14304}
14305
14306static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14307                                              vector bool short __b) {
14308  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14309                                      (vector unsigned short)__b);
14310}
14311
14312static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14313                                              vector short __b) {
14314  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14315                                      (vector unsigned short)__b);
14316}
14317
14318static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14319                                              vector unsigned short __b) {
14320  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14321                                      __b);
14322}
14323
14324static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14325                                              vector bool short __b) {
14326  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14327                                      (vector unsigned short)__b);
14328}
14329
14330static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14331  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14332}
14333
14334static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14335                                              vector bool int __b) {
14336  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14337}
14338
14339static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14340                                              vector unsigned int __b) {
14341  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14342}
14343
14344static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14345                                              vector bool int __b) {
14346  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14347}
14348
14349static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14350                                              vector int __b) {
14351  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14352                                      (vector unsigned int)__b);
14353}
14354
14355static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14356                                              vector unsigned int __b) {
14357  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14358}
14359
14360static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14361                                              vector bool int __b) {
14362  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14363                                      (vector unsigned int)__b);
14364}
14365
14366#ifdef __POWER8_VECTOR__
14367static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14368                                              vector signed long long __b) {
14369  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14370}
14371
14372static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14373                                              vector unsigned long long __b) {
14374  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14375}
14376
14377static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14378                                              vector bool long long __b) {
14379  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14380                                      (vector signed long long)__b);
14381}
14382
14383static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14384                                              vector bool long long __b) {
14385  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14386                                      (vector unsigned long long)__b);
14387}
14388
14389static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14390                                              vector signed long long __b) {
14391  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14392                                      (vector unsigned long long)__b);
14393}
14394
14395static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14396                                              vector unsigned long long __b) {
14397  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14398                                      __b);
14399}
14400
14401static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14402                                              vector bool long long __b) {
14403  return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14404                                      (vector unsigned long long)__b);
14405}
14406#endif
14407
14408static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14409                                              vector float __b) {
14410#ifdef __VSX__
14411  return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14412#else
14413  return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14414#endif
14415}
14416
14417#ifdef __VSX__
14418static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14419                                              vector double __b) {
14420  return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14421}
14422#endif
14423
14424/* vec_all_lt */
14425
14426static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14427                                              vector signed char __b) {
14428  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14429}
14430
14431static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14432                                              vector bool char __b) {
14433  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14434}
14435
14436static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14437                                              vector unsigned char __b) {
14438  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14439}
14440
14441static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14442                                              vector bool char __b) {
14443  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14444}
14445
14446static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14447                                              vector signed char __b) {
14448  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14449                                      (vector unsigned char)__a);
14450}
14451
14452static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14453                                              vector unsigned char __b) {
14454  return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14455}
14456
14457static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14458                                              vector bool 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 short __a,
14464                                              vector short __b) {
14465  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14466}
14467
14468static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14469                                              vector bool short __b) {
14470  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14471}
14472
14473static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14474                                              vector unsigned short __b) {
14475  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14476}
14477
14478static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14479                                              vector bool short __b) {
14480  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14481                                      __a);
14482}
14483
14484static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14485                                              vector short __b) {
14486  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14487                                      (vector unsigned short)__a);
14488}
14489
14490static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14491                                              vector unsigned short __b) {
14492  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14493                                      (vector unsigned short)__a);
14494}
14495
14496static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14497                                              vector bool short __b) {
14498  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14499                                      (vector unsigned short)__a);
14500}
14501
14502static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14503  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14504}
14505
14506static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14507                                              vector bool int __b) {
14508  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14509}
14510
14511static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14512                                              vector unsigned int __b) {
14513  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14514}
14515
14516static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14517                                              vector bool int __b) {
14518  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14519}
14520
14521static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14522                                              vector int __b) {
14523  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14524                                      (vector unsigned int)__a);
14525}
14526
14527static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14528                                              vector unsigned int __b) {
14529  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14530}
14531
14532static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14533                                              vector bool int __b) {
14534  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14535                                      (vector unsigned int)__a);
14536}
14537
14538#ifdef __POWER8_VECTOR__
14539static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14540                                              vector signed long long __b) {
14541  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14542}
14543
14544static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14545                                              vector unsigned long long __b) {
14546  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14547}
14548
14549static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14550                                              vector bool long long __b) {
14551  return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14552                                      __a);
14553}
14554
14555static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14556                                              vector bool long long __b) {
14557  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14558                                      __a);
14559}
14560
14561static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14562                                              vector signed long long __b) {
14563  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14564                                      (vector unsigned long long)__a);
14565}
14566
14567static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14568                                              vector unsigned long long __b) {
14569  return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14570                                      (vector unsigned long long)__a);
14571}
14572
14573static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14574                                              vector bool long long __b) {
14575  return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14576                                      (vector unsigned long long)__a);
14577}
14578#endif
14579
14580static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14581                                              vector float __b) {
14582#ifdef __VSX__
14583  return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14584#else
14585  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14586#endif
14587}
14588
14589#ifdef __VSX__
14590static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14591                                              vector double __b) {
14592  return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14593}
14594#endif
14595
14596/* vec_all_nan */
14597
14598static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14599#ifdef __VSX__
14600  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14601#else
14602  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14603#endif
14604}
14605
14606#ifdef __VSX__
14607static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14608  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14609}
14610#endif
14611
14612/* vec_all_ne */
14613
14614static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14615                                              vector signed char __b) {
14616  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14617                                      (vector char)__b);
14618}
14619
14620static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14621                                              vector bool char __b) {
14622  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14623                                      (vector char)__b);
14624}
14625
14626static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14627                                              vector unsigned char __b) {
14628  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14629                                      (vector char)__b);
14630}
14631
14632static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14633                                              vector bool char __b) {
14634  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14635                                      (vector char)__b);
14636}
14637
14638static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14639                                              vector signed char __b) {
14640  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14641                                      (vector char)__b);
14642}
14643
14644static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14645                                              vector unsigned char __b) {
14646  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14647                                      (vector char)__b);
14648}
14649
14650static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14651                                              vector bool char __b) {
14652  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14653                                      (vector char)__b);
14654}
14655
14656static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14657                                              vector short __b) {
14658  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14659}
14660
14661static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14662                                              vector bool short __b) {
14663  return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14664}
14665
14666static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14667                                              vector unsigned short __b) {
14668  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14669                                      (vector short)__b);
14670}
14671
14672static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14673                                              vector bool short __b) {
14674  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14675                                      (vector short)__b);
14676}
14677
14678static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14679                                              vector short __b) {
14680  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14681                                      (vector short)__b);
14682}
14683
14684static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14685                                              vector unsigned short __b) {
14686  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14687                                      (vector short)__b);
14688}
14689
14690static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14691                                              vector bool short __b) {
14692  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14693                                      (vector short)__b);
14694}
14695
14696static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
14697                                              vector pixel __b) {
14698  return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14699                                      (vector short)__b);
14700}
14701
14702static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14703  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14704}
14705
14706static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14707                                              vector bool int __b) {
14708  return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14709}
14710
14711static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14712                                              vector unsigned int __b) {
14713  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14714                                      (vector int)__b);
14715}
14716
14717static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14718                                              vector bool int __b) {
14719  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14720                                      (vector int)__b);
14721}
14722
14723static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14724                                              vector int __b) {
14725  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14726                                      (vector int)__b);
14727}
14728
14729static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14730                                              vector unsigned int __b) {
14731  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14732                                      (vector int)__b);
14733}
14734
14735static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14736                                              vector bool int __b) {
14737  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14738                                      (vector int)__b);
14739}
14740
14741#ifdef __POWER8_VECTOR__
14742static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14743                                              vector signed long long __b) {
14744  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14745}
14746
14747static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14748                                              vector unsigned long long __b) {
14749  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14750                                      (vector long long)__b);
14751}
14752
14753static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14754                                              vector bool long long __b) {
14755  return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14756                                      (vector signed long long)__b);
14757}
14758
14759static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14760                                              vector bool long long __b) {
14761  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14762                                      (vector signed long long)__b);
14763}
14764
14765static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14766                                              vector signed long long __b) {
14767  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14768                                      (vector signed long long)__b);
14769}
14770
14771static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14772                                              vector unsigned long long __b) {
14773  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14774                                      (vector signed long long)__b);
14775}
14776
14777static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14778                                              vector bool long long __b) {
14779  return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14780                                      (vector signed long long)__b);
14781}
14782#endif
14783
14784static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14785                                              vector float __b) {
14786#ifdef __VSX__
14787  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
14788#else
14789  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14790#endif
14791}
14792
14793#ifdef __VSX__
14794static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14795                                              vector double __b) {
14796  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14797}
14798#endif
14799
14800/* vec_all_nge */
14801
14802static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14803                                               vector float __b) {
14804#ifdef __VSX__
14805  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14806#else
14807  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14808#endif
14809}
14810
14811#ifdef __VSX__
14812static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14813                                               vector double __b) {
14814  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14815}
14816#endif
14817
14818/* vec_all_ngt */
14819
14820static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14821                                               vector float __b) {
14822#ifdef __VSX__
14823  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14824#else
14825  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14826#endif
14827}
14828
14829#ifdef __VSX__
14830static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14831                                               vector double __b) {
14832  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14833}
14834#endif
14835
14836/* vec_all_nle */
14837
14838static __inline__ int __attribute__((__always_inline__))
14839vec_all_nle(vector float __a, vector float __b) {
14840  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14841}
14842
14843/* vec_all_nlt */
14844
14845static __inline__ int __attribute__((__always_inline__))
14846vec_all_nlt(vector float __a, vector float __b) {
14847  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14848}
14849
14850/* vec_all_numeric */
14851
14852static __inline__ int __attribute__((__always_inline__))
14853vec_all_numeric(vector float __a) {
14854  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14855}
14856
14857/* vec_any_eq */
14858
14859static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14860                                              vector signed char __b) {
14861  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14862                                      (vector char)__b);
14863}
14864
14865static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14866                                              vector bool char __b) {
14867  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14868                                      (vector char)__b);
14869}
14870
14871static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14872                                              vector unsigned char __b) {
14873  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14874                                      (vector char)__b);
14875}
14876
14877static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14878                                              vector bool char __b) {
14879  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14880                                      (vector char)__b);
14881}
14882
14883static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14884                                              vector signed char __b) {
14885  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14886                                      (vector char)__b);
14887}
14888
14889static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14890                                              vector unsigned char __b) {
14891  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14892                                      (vector char)__b);
14893}
14894
14895static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14896                                              vector bool char __b) {
14897  return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14898                                      (vector char)__b);
14899}
14900
14901static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14902                                              vector short __b) {
14903  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14904}
14905
14906static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14907                                              vector bool short __b) {
14908  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14909}
14910
14911static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14912                                              vector unsigned short __b) {
14913  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14914                                      (vector short)__b);
14915}
14916
14917static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14918                                              vector bool short __b) {
14919  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14920                                      (vector short)__b);
14921}
14922
14923static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14924                                              vector short __b) {
14925  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14926                                      (vector short)__b);
14927}
14928
14929static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14930                                              vector unsigned short __b) {
14931  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14932                                      (vector short)__b);
14933}
14934
14935static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14936                                              vector bool short __b) {
14937  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14938                                      (vector short)__b);
14939}
14940
14941static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14942                                              vector pixel __b) {
14943  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14944                                      (vector short)__b);
14945}
14946
14947static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14948  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14949}
14950
14951static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14952                                              vector bool int __b) {
14953  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14954}
14955
14956static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14957                                              vector unsigned int __b) {
14958  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14959                                      (vector int)__b);
14960}
14961
14962static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14963                                              vector bool int __b) {
14964  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14965                                      (vector int)__b);
14966}
14967
14968static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14969                                              vector int __b) {
14970  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14971                                      (vector int)__b);
14972}
14973
14974static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14975                                              vector unsigned int __b) {
14976  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14977                                      (vector int)__b);
14978}
14979
14980static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14981                                              vector bool int __b) {
14982  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14983                                      (vector int)__b);
14984}
14985
14986#ifdef __POWER8_VECTOR__
14987static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14988                                              vector signed long long __b) {
14989  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14990}
14991
14992static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14993                                              vector unsigned long long __b) {
14994  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
14995                                      (vector long long)__b);
14996}
14997
14998static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14999                                              vector bool long long __b) {
15000  return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15001                                      (vector signed long long)__b);
15002}
15003
15004static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15005                                              vector bool long long __b) {
15006  return __builtin_altivec_vcmpequd_p(
15007      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15008}
15009
15010static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15011                                              vector signed long long __b) {
15012  return __builtin_altivec_vcmpequd_p(
15013      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15014}
15015
15016static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15017                                              vector unsigned long long __b) {
15018  return __builtin_altivec_vcmpequd_p(
15019      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15020}
15021
15022static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15023                                              vector bool long long __b) {
15024  return __builtin_altivec_vcmpequd_p(
15025      __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15026}
15027#endif
15028
15029static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15030                                              vector float __b) {
15031#ifdef __VSX__
15032  return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15033#else
15034  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15035#endif
15036}
15037
15038#ifdef __VSX__
15039static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15040                                              vector double __b) {
15041  return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15042}
15043#endif
15044
15045/* vec_any_ge */
15046
15047static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15048                                              vector signed char __b) {
15049  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15050}
15051
15052static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15053                                              vector bool char __b) {
15054  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15055                                      __a);
15056}
15057
15058static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15059                                              vector unsigned char __b) {
15060  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15061}
15062
15063static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15064                                              vector bool char __b) {
15065  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15066                                      __a);
15067}
15068
15069static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15070                                              vector signed char __b) {
15071  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15072                                      (vector unsigned char)__a);
15073}
15074
15075static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15076                                              vector unsigned char __b) {
15077  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15078                                      (vector unsigned char)__a);
15079}
15080
15081static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15082                                              vector bool char __b) {
15083  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15084                                      (vector unsigned char)__a);
15085}
15086
15087static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15088                                              vector short __b) {
15089  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15090}
15091
15092static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15093                                              vector bool short __b) {
15094  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15095}
15096
15097static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15098                                              vector unsigned short __b) {
15099  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15100}
15101
15102static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15103                                              vector bool short __b) {
15104  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15105                                      __a);
15106}
15107
15108static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15109                                              vector short __b) {
15110  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15111                                      (vector unsigned short)__a);
15112}
15113
15114static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15115                                              vector unsigned short __b) {
15116  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15117                                      (vector unsigned short)__a);
15118}
15119
15120static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15121                                              vector bool short __b) {
15122  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15123                                      (vector unsigned short)__a);
15124}
15125
15126static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15127  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15128}
15129
15130static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15131                                              vector bool int __b) {
15132  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15133}
15134
15135static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15136                                              vector unsigned int __b) {
15137  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15138}
15139
15140static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15141                                              vector bool int __b) {
15142  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15143                                      __a);
15144}
15145
15146static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15147                                              vector int __b) {
15148  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15149                                      (vector unsigned int)__a);
15150}
15151
15152static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15153                                              vector unsigned int __b) {
15154  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15155                                      (vector unsigned int)__a);
15156}
15157
15158static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15159                                              vector bool int __b) {
15160  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15161                                      (vector unsigned int)__a);
15162}
15163
15164#ifdef __POWER8_VECTOR__
15165static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15166                                              vector signed long long __b) {
15167  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15168}
15169
15170static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15171                                              vector unsigned long long __b) {
15172  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15173}
15174
15175static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15176                                              vector bool long long __b) {
15177  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15178                                      (vector signed long long)__b, __a);
15179}
15180
15181static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15182                                              vector bool long long __b) {
15183  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15184                                      (vector unsigned long long)__b, __a);
15185}
15186
15187static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15188                                              vector signed long long __b) {
15189  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15190                                      (vector unsigned long long)__b,
15191                                      (vector unsigned long long)__a);
15192}
15193
15194static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15195                                              vector unsigned long long __b) {
15196  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15197                                      (vector unsigned long long)__a);
15198}
15199
15200static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15201                                              vector bool long long __b) {
15202  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15203                                      (vector unsigned long long)__b,
15204                                      (vector unsigned long long)__a);
15205}
15206#endif
15207
15208static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15209                                              vector float __b) {
15210#ifdef __VSX__
15211  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15212#else
15213  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15214#endif
15215}
15216
15217#ifdef __VSX__
15218static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15219                                              vector double __b) {
15220  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15221}
15222#endif
15223
15224/* vec_any_gt */
15225
15226static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15227                                              vector signed char __b) {
15228  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15229}
15230
15231static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15232                                              vector bool char __b) {
15233  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15234                                      (vector signed char)__b);
15235}
15236
15237static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15238                                              vector unsigned char __b) {
15239  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15240}
15241
15242static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15243                                              vector bool char __b) {
15244  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15245                                      (vector unsigned char)__b);
15246}
15247
15248static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15249                                              vector signed char __b) {
15250  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15251                                      (vector unsigned char)__b);
15252}
15253
15254static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15255                                              vector unsigned char __b) {
15256  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15257                                      __b);
15258}
15259
15260static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15261                                              vector bool char __b) {
15262  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15263                                      (vector unsigned char)__b);
15264}
15265
15266static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15267                                              vector short __b) {
15268  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15269}
15270
15271static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15272                                              vector bool short __b) {
15273  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15274}
15275
15276static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15277                                              vector unsigned short __b) {
15278  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15279}
15280
15281static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15282                                              vector bool short __b) {
15283  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15284                                      (vector unsigned short)__b);
15285}
15286
15287static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15288                                              vector short __b) {
15289  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15290                                      (vector unsigned short)__b);
15291}
15292
15293static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15294                                              vector unsigned short __b) {
15295  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15296                                      __b);
15297}
15298
15299static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15300                                              vector bool short __b) {
15301  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15302                                      (vector unsigned short)__b);
15303}
15304
15305static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15306  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15307}
15308
15309static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15310                                              vector bool int __b) {
15311  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15312}
15313
15314static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15315                                              vector unsigned int __b) {
15316  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15317}
15318
15319static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15320                                              vector bool int __b) {
15321  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15322                                      (vector unsigned int)__b);
15323}
15324
15325static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15326                                              vector int __b) {
15327  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15328                                      (vector unsigned int)__b);
15329}
15330
15331static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15332                                              vector unsigned int __b) {
15333  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15334                                      __b);
15335}
15336
15337static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15338                                              vector bool int __b) {
15339  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15340                                      (vector unsigned int)__b);
15341}
15342
15343#ifdef __POWER8_VECTOR__
15344static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15345                                              vector signed long long __b) {
15346  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15347}
15348
15349static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15350                                              vector unsigned long long __b) {
15351  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15352}
15353
15354static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15355                                              vector bool long long __b) {
15356  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15357                                      (vector signed long long)__b);
15358}
15359
15360static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15361                                              vector bool long long __b) {
15362  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15363                                      (vector unsigned long long)__b);
15364}
15365
15366static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15367                                              vector signed long long __b) {
15368  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15369                                      (vector unsigned long long)__a,
15370                                      (vector unsigned long long)__b);
15371}
15372
15373static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15374                                              vector unsigned long long __b) {
15375  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15376                                      (vector unsigned long long)__a, __b);
15377}
15378
15379static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15380                                              vector bool long long __b) {
15381  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15382                                      (vector unsigned long long)__a,
15383                                      (vector unsigned long long)__b);
15384}
15385#endif
15386
15387static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15388                                              vector float __b) {
15389#ifdef __VSX__
15390  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15391#else
15392  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15393#endif
15394}
15395
15396#ifdef __VSX__
15397static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15398                                              vector double __b) {
15399  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15400}
15401#endif
15402
15403/* vec_any_le */
15404
15405static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15406                                              vector signed char __b) {
15407  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15408}
15409
15410static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15411                                              vector bool char __b) {
15412  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15413                                      (vector signed char)__b);
15414}
15415
15416static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15417                                              vector unsigned char __b) {
15418  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15419}
15420
15421static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15422                                              vector bool char __b) {
15423  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15424                                      (vector unsigned char)__b);
15425}
15426
15427static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15428                                              vector signed char __b) {
15429  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15430                                      (vector unsigned char)__b);
15431}
15432
15433static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15434                                              vector unsigned char __b) {
15435  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15436                                      __b);
15437}
15438
15439static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15440                                              vector bool char __b) {
15441  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15442                                      (vector unsigned char)__b);
15443}
15444
15445static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15446                                              vector short __b) {
15447  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15448}
15449
15450static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15451                                              vector bool short __b) {
15452  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15453}
15454
15455static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15456                                              vector unsigned short __b) {
15457  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15458}
15459
15460static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15461                                              vector bool short __b) {
15462  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15463                                      (vector unsigned short)__b);
15464}
15465
15466static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15467                                              vector short __b) {
15468  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15469                                      (vector unsigned short)__b);
15470}
15471
15472static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15473                                              vector unsigned short __b) {
15474  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15475                                      __b);
15476}
15477
15478static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15479                                              vector bool short __b) {
15480  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15481                                      (vector unsigned short)__b);
15482}
15483
15484static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15485  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15486}
15487
15488static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15489                                              vector bool int __b) {
15490  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15491}
15492
15493static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15494                                              vector unsigned int __b) {
15495  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15496}
15497
15498static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15499                                              vector bool int __b) {
15500  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15501                                      (vector unsigned int)__b);
15502}
15503
15504static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15505                                              vector int __b) {
15506  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15507                                      (vector unsigned int)__b);
15508}
15509
15510static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15511                                              vector unsigned int __b) {
15512  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15513                                      __b);
15514}
15515
15516static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15517                                              vector bool int __b) {
15518  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15519                                      (vector unsigned int)__b);
15520}
15521
15522#ifdef __POWER8_VECTOR__
15523static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15524                                              vector signed long long __b) {
15525  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15526}
15527
15528static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15529                                              vector unsigned long long __b) {
15530  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15531}
15532
15533static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15534                                              vector bool long long __b) {
15535  return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15536                                      (vector signed long long)__b);
15537}
15538
15539static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15540                                              vector bool long long __b) {
15541  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15542                                      (vector unsigned long long)__b);
15543}
15544
15545static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15546                                              vector signed long long __b) {
15547  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15548                                      (vector unsigned long long)__a,
15549                                      (vector unsigned long long)__b);
15550}
15551
15552static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15553                                              vector unsigned long long __b) {
15554  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15555                                      (vector unsigned long long)__a, __b);
15556}
15557
15558static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15559                                              vector bool long long __b) {
15560  return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15561                                      (vector unsigned long long)__a,
15562                                      (vector unsigned long long)__b);
15563}
15564#endif
15565
15566static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15567                                              vector float __b) {
15568#ifdef __VSX__
15569  return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15570#else
15571  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15572#endif
15573}
15574
15575#ifdef __VSX__
15576static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15577                                              vector double __b) {
15578  return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15579}
15580#endif
15581
15582/* vec_any_lt */
15583
15584static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15585                                              vector signed char __b) {
15586  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15587}
15588
15589static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15590                                              vector bool char __b) {
15591  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15592                                      __a);
15593}
15594
15595static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15596                                              vector unsigned char __b) {
15597  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15598}
15599
15600static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15601                                              vector bool char __b) {
15602  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15603                                      __a);
15604}
15605
15606static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15607                                              vector signed char __b) {
15608  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15609                                      (vector unsigned char)__a);
15610}
15611
15612static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15613                                              vector unsigned char __b) {
15614  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15615                                      (vector unsigned char)__a);
15616}
15617
15618static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15619                                              vector bool char __b) {
15620  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15621                                      (vector unsigned char)__a);
15622}
15623
15624static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15625                                              vector short __b) {
15626  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15627}
15628
15629static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15630                                              vector bool short __b) {
15631  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15632}
15633
15634static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15635                                              vector unsigned short __b) {
15636  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15637}
15638
15639static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15640                                              vector bool short __b) {
15641  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15642                                      __a);
15643}
15644
15645static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15646                                              vector short __b) {
15647  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15648                                      (vector unsigned short)__a);
15649}
15650
15651static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15652                                              vector unsigned short __b) {
15653  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15654                                      (vector unsigned short)__a);
15655}
15656
15657static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15658                                              vector bool short __b) {
15659  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15660                                      (vector unsigned short)__a);
15661}
15662
15663static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15664  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15665}
15666
15667static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15668                                              vector bool int __b) {
15669  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15670}
15671
15672static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15673                                              vector unsigned int __b) {
15674  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15675}
15676
15677static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15678                                              vector bool int __b) {
15679  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15680                                      __a);
15681}
15682
15683static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15684                                              vector int __b) {
15685  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15686                                      (vector unsigned int)__a);
15687}
15688
15689static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15690                                              vector unsigned int __b) {
15691  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15692                                      (vector unsigned int)__a);
15693}
15694
15695static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15696                                              vector bool int __b) {
15697  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15698                                      (vector unsigned int)__a);
15699}
15700
15701#ifdef __POWER8_VECTOR__
15702static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15703                                              vector signed long long __b) {
15704  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15705}
15706
15707static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15708                                              vector unsigned long long __b) {
15709  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15710}
15711
15712static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15713                                              vector bool long long __b) {
15714  return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15715                                      (vector signed long long)__b, __a);
15716}
15717
15718static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15719                                              vector bool long long __b) {
15720  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15721                                      (vector unsigned long long)__b, __a);
15722}
15723
15724static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15725                                              vector signed long long __b) {
15726  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15727                                      (vector unsigned long long)__b,
15728                                      (vector unsigned long long)__a);
15729}
15730
15731static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15732                                              vector unsigned long long __b) {
15733  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15734                                      (vector unsigned long long)__a);
15735}
15736
15737static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15738                                              vector bool long long __b) {
15739  return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15740                                      (vector unsigned long long)__b,
15741                                      (vector unsigned long long)__a);
15742}
15743#endif
15744
15745static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15746                                              vector float __b) {
15747#ifdef __VSX__
15748  return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15749#else
15750  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15751#endif
15752}
15753
15754#ifdef __VSX__
15755static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15756                                              vector double __b) {
15757  return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15758}
15759#endif
15760
15761/* vec_any_nan */
15762
15763static __inline__ int __attribute__((__always_inline__))
15764vec_any_nan(vector float __a) {
15765  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15766}
15767
15768/* vec_any_ne */
15769
15770static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15771                                              vector signed char __b) {
15772  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15773                                      (vector char)__b);
15774}
15775
15776static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15777                                              vector bool char __b) {
15778  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15779                                      (vector char)__b);
15780}
15781
15782static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15783                                              vector unsigned char __b) {
15784  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15785                                      (vector char)__b);
15786}
15787
15788static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15789                                              vector bool char __b) {
15790  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15791                                      (vector char)__b);
15792}
15793
15794static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15795                                              vector signed char __b) {
15796  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15797                                      (vector char)__b);
15798}
15799
15800static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15801                                              vector unsigned char __b) {
15802  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15803                                      (vector char)__b);
15804}
15805
15806static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15807                                              vector bool char __b) {
15808  return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15809                                      (vector char)__b);
15810}
15811
15812static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15813                                              vector short __b) {
15814  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15815}
15816
15817static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15818                                              vector bool short __b) {
15819  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15820}
15821
15822static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15823                                              vector unsigned short __b) {
15824  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15825                                      (vector short)__b);
15826}
15827
15828static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15829                                              vector bool short __b) {
15830  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15831                                      (vector short)__b);
15832}
15833
15834static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15835                                              vector short __b) {
15836  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15837                                      (vector short)__b);
15838}
15839
15840static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15841                                              vector unsigned short __b) {
15842  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15843                                      (vector short)__b);
15844}
15845
15846static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15847                                              vector bool short __b) {
15848  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15849                                      (vector short)__b);
15850}
15851
15852static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15853                                              vector pixel __b) {
15854  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15855                                      (vector short)__b);
15856}
15857
15858static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15859  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15860}
15861
15862static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15863                                              vector bool int __b) {
15864  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15865}
15866
15867static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15868                                              vector unsigned int __b) {
15869  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15870                                      (vector int)__b);
15871}
15872
15873static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15874                                              vector bool int __b) {
15875  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15876                                      (vector int)__b);
15877}
15878
15879static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15880                                              vector int __b) {
15881  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15882                                      (vector int)__b);
15883}
15884
15885static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15886                                              vector unsigned int __b) {
15887  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15888                                      (vector int)__b);
15889}
15890
15891static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15892                                              vector bool int __b) {
15893  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15894                                      (vector int)__b);
15895}
15896
15897#ifdef __POWER8_VECTOR__
15898static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15899                                              vector signed long long __b) {
15900  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15901}
15902
15903static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15904                                              vector unsigned long long __b) {
15905  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15906                                      (vector long long)__b);
15907}
15908
15909static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15910                                              vector bool long long __b) {
15911  return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15912                                      (vector signed long long)__b);
15913}
15914
15915static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15916                                              vector bool long long __b) {
15917  return __builtin_altivec_vcmpequd_p(
15918      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15919}
15920
15921static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15922                                              vector signed long long __b) {
15923  return __builtin_altivec_vcmpequd_p(
15924      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15925}
15926
15927static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15928                                              vector unsigned long long __b) {
15929  return __builtin_altivec_vcmpequd_p(
15930      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15931}
15932
15933static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15934                                              vector bool long long __b) {
15935  return __builtin_altivec_vcmpequd_p(
15936      __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15937}
15938#endif
15939
15940static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15941                                              vector float __b) {
15942#ifdef __VSX__
15943  return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15944#else
15945  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15946#endif
15947}
15948
15949#ifdef __VSX__
15950static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15951                                              vector double __b) {
15952  return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15953}
15954#endif
15955
15956/* vec_any_nge */
15957
15958static __inline__ int __attribute__((__always_inline__))
15959vec_any_nge(vector float __a, vector float __b) {
15960  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15961}
15962
15963/* vec_any_ngt */
15964
15965static __inline__ int __attribute__((__always_inline__))
15966vec_any_ngt(vector float __a, vector float __b) {
15967  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15968}
15969
15970/* vec_any_nle */
15971
15972static __inline__ int __attribute__((__always_inline__))
15973vec_any_nle(vector float __a, vector float __b) {
15974  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15975}
15976
15977/* vec_any_nlt */
15978
15979static __inline__ int __attribute__((__always_inline__))
15980vec_any_nlt(vector float __a, vector float __b) {
15981  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15982}
15983
15984/* vec_any_numeric */
15985
15986static __inline__ int __attribute__((__always_inline__))
15987vec_any_numeric(vector float __a) {
15988  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15989}
15990
15991/* vec_any_out */
15992
15993static __inline__ int __attribute__((__always_inline__))
15994vec_any_out(vector float __a, vector float __b) {
15995  return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
15996}
15997
15998/* Power 8 Crypto functions
15999Note: We diverge from the current GCC implementation with regard
16000to cryptography and related functions as follows:
16001- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16002- The remaining ones are only available on Power8 and up so
16003  require -mpower8-vector
16004The justification for this is that export requirements require that
16005Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16006support). As a result, we need to be able to turn off support for those.
16007The remaining ones (currently controlled by -mcrypto for GCC) still
16008need to be provided on compliant hardware even if Vector.Crypto is not
16009provided.
16010*/
16011#ifdef __CRYPTO__
16012#define vec_sbox_be __builtin_altivec_crypto_vsbox
16013#define vec_cipher_be __builtin_altivec_crypto_vcipher
16014#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16015#define vec_ncipher_be __builtin_altivec_crypto_vncipher
16016#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16017
16018static __inline__ vector unsigned long long __attribute__((__always_inline__))
16019__builtin_crypto_vsbox(vector unsigned long long __a) {
16020  return __builtin_altivec_crypto_vsbox(__a);
16021}
16022
16023static __inline__ vector unsigned long long __attribute__((__always_inline__))
16024__builtin_crypto_vcipher(vector unsigned long long __a,
16025                         vector unsigned long long __b) {
16026  return __builtin_altivec_crypto_vcipher(__a, __b);
16027}
16028
16029static __inline__ vector unsigned long long __attribute__((__always_inline__))
16030__builtin_crypto_vcipherlast(vector unsigned long long __a,
16031                             vector unsigned long long __b) {
16032  return __builtin_altivec_crypto_vcipherlast(__a, __b);
16033}
16034
16035static __inline__ vector unsigned long long __attribute__((__always_inline__))
16036__builtin_crypto_vncipher(vector unsigned long long __a,
16037                          vector unsigned long long __b) {
16038  return __builtin_altivec_crypto_vncipher(__a, __b);
16039}
16040
16041static __inline__ vector unsigned long long __attribute__((__always_inline__))
16042__builtin_crypto_vncipherlast(vector unsigned long long __a,
16043                              vector unsigned long long __b) {
16044  return __builtin_altivec_crypto_vncipherlast(__a, __b);
16045}
16046
16047#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16048#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16049
16050#define vec_shasigma_be(X, Y, Z)                                               \
16051  _Generic((X), vector unsigned int                                            \
16052           : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16053           : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16054#endif
16055
16056#ifdef __POWER8_VECTOR__
16057static __inline__ vector bool char __ATTRS_o_ai
16058vec_permxor(vector bool char __a, vector bool char __b,
16059            vector bool char __c) {
16060  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16061}
16062
16063static __inline__ vector signed char __ATTRS_o_ai
16064vec_permxor(vector signed char __a, vector signed char __b,
16065            vector signed char __c) {
16066  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16067}
16068
16069static __inline__ vector unsigned char __ATTRS_o_ai
16070vec_permxor(vector unsigned char __a, vector unsigned char __b,
16071            vector unsigned char __c) {
16072  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16073}
16074
16075static __inline__ vector unsigned char __ATTRS_o_ai
16076__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16077                          vector unsigned char __c) {
16078  return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16079}
16080
16081static __inline__ vector unsigned short __ATTRS_o_ai
16082__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16083                          vector unsigned short __c) {
16084  return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16085      (vector unsigned char)__a, (vector unsigned char)__b,
16086      (vector unsigned char)__c);
16087}
16088
16089static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16090    vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16091  return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16092      (vector unsigned char)__a, (vector unsigned char)__b,
16093      (vector unsigned char)__c);
16094}
16095
16096static __inline__ vector unsigned long long __ATTRS_o_ai
16097__builtin_crypto_vpermxor(vector unsigned long long __a,
16098                          vector unsigned long long __b,
16099                          vector unsigned long long __c) {
16100  return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16101      (vector unsigned char)__a, (vector unsigned char)__b,
16102      (vector unsigned char)__c);
16103}
16104
16105static __inline__ vector unsigned char __ATTRS_o_ai
16106__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16107  return __builtin_altivec_crypto_vpmsumb(__a, __b);
16108}
16109
16110static __inline__ vector unsigned short __ATTRS_o_ai
16111__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16112  return __builtin_altivec_crypto_vpmsumh(__a, __b);
16113}
16114
16115static __inline__ vector unsigned int __ATTRS_o_ai
16116__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16117  return __builtin_altivec_crypto_vpmsumw(__a, __b);
16118}
16119
16120static __inline__ vector unsigned long long __ATTRS_o_ai
16121__builtin_crypto_vpmsumb(vector unsigned long long __a,
16122                         vector unsigned long long __b) {
16123  return __builtin_altivec_crypto_vpmsumd(__a, __b);
16124}
16125
16126static __inline__ vector signed char __ATTRS_o_ai
16127vec_vgbbd(vector signed char __a) {
16128  return __builtin_altivec_vgbbd((vector unsigned char)__a);
16129}
16130
16131#define vec_pmsum_be __builtin_crypto_vpmsumb
16132#define vec_gb __builtin_altivec_vgbbd
16133
16134static __inline__ vector unsigned char __ATTRS_o_ai
16135vec_vgbbd(vector unsigned char __a) {
16136  return __builtin_altivec_vgbbd(__a);
16137}
16138
16139static __inline__ vector long long __ATTRS_o_ai
16140vec_vbpermq(vector signed char __a, vector signed char __b) {
16141  return __builtin_altivec_vbpermq((vector unsigned char)__a,
16142                                   (vector unsigned char)__b);
16143}
16144
16145static __inline__ vector long long __ATTRS_o_ai
16146vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16147  return __builtin_altivec_vbpermq(__a, __b);
16148}
16149
16150#ifdef __powerpc64__
16151static __inline__ vector unsigned long long __attribute__((__always_inline__))
16152vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16153  return __builtin_altivec_vbpermq((vector unsigned char)__a,
16154                                   (vector unsigned char)__b);
16155}
16156#endif
16157#endif
16158
16159
16160/* vec_reve */
16161
16162static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16163  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16164                                 5, 4, 3, 2, 1, 0);
16165}
16166
16167static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16168  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16169                                 5, 4, 3, 2, 1, 0);
16170}
16171
16172static inline __ATTRS_o_ai vector unsigned char
16173vec_reve(vector unsigned char __a) {
16174  return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16175                                 5, 4, 3, 2, 1, 0);
16176}
16177
16178static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16179  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16180}
16181
16182static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16183  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16184}
16185
16186static inline __ATTRS_o_ai vector unsigned int
16187vec_reve(vector unsigned int __a) {
16188  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16189}
16190
16191static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16192  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16193}
16194
16195static inline __ATTRS_o_ai vector signed short
16196vec_reve(vector signed short __a) {
16197  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16198}
16199
16200static inline __ATTRS_o_ai vector unsigned short
16201vec_reve(vector unsigned short __a) {
16202  return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16203}
16204
16205static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16206  return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16207}
16208
16209#ifdef __VSX__
16210static inline __ATTRS_o_ai vector bool long long
16211vec_reve(vector bool long long __a) {
16212  return __builtin_shufflevector(__a, __a, 1, 0);
16213}
16214
16215static inline __ATTRS_o_ai vector signed long long
16216vec_reve(vector signed long long __a) {
16217  return __builtin_shufflevector(__a, __a, 1, 0);
16218}
16219
16220static inline __ATTRS_o_ai vector unsigned long long
16221vec_reve(vector unsigned long long __a) {
16222  return __builtin_shufflevector(__a, __a, 1, 0);
16223}
16224
16225static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16226  return __builtin_shufflevector(__a, __a, 1, 0);
16227}
16228#endif
16229
16230/* vec_revb */
16231static __inline__ vector bool char __ATTRS_o_ai
16232vec_revb(vector bool char __a) {
16233  return __a;
16234}
16235
16236static __inline__ vector signed char __ATTRS_o_ai
16237vec_revb(vector signed char __a) {
16238  return __a;
16239}
16240
16241static __inline__ vector unsigned char __ATTRS_o_ai
16242vec_revb(vector unsigned char __a) {
16243  return __a;
16244}
16245
16246static __inline__ vector bool short __ATTRS_o_ai
16247vec_revb(vector bool short __a) {
16248  vector unsigned char __indices =
16249      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16250  return vec_perm(__a, __a, __indices);
16251}
16252
16253static __inline__ vector signed short __ATTRS_o_ai
16254vec_revb(vector signed short __a) {
16255  vector unsigned char __indices =
16256      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16257  return vec_perm(__a, __a, __indices);
16258}
16259
16260static __inline__ vector unsigned short __ATTRS_o_ai
16261vec_revb(vector unsigned short __a) {
16262  vector unsigned char __indices =
16263     { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16264  return vec_perm(__a, __a, __indices);
16265}
16266
16267static __inline__ vector bool int __ATTRS_o_ai
16268vec_revb(vector bool int __a) {
16269  vector unsigned char __indices =
16270      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16271  return vec_perm(__a, __a, __indices);
16272}
16273
16274static __inline__ vector signed int __ATTRS_o_ai
16275vec_revb(vector signed int __a) {
16276  vector unsigned char __indices =
16277      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16278  return vec_perm(__a, __a, __indices);
16279}
16280
16281static __inline__ vector unsigned int __ATTRS_o_ai
16282vec_revb(vector unsigned int __a) {
16283  vector unsigned char __indices =
16284      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16285  return vec_perm(__a, __a, __indices);
16286}
16287
16288static __inline__ vector float __ATTRS_o_ai
16289vec_revb(vector float __a) {
16290 vector unsigned char __indices =
16291      { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16292 return vec_perm(__a, __a, __indices);
16293}
16294
16295#ifdef __VSX__
16296static __inline__ vector bool long long __ATTRS_o_ai
16297vec_revb(vector bool long long __a) {
16298  vector unsigned char __indices =
16299      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16300  return vec_perm(__a, __a, __indices);
16301}
16302
16303static __inline__ vector signed long long __ATTRS_o_ai
16304vec_revb(vector signed long long __a) {
16305  vector unsigned char __indices =
16306      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16307  return vec_perm(__a, __a, __indices);
16308}
16309
16310static __inline__ vector unsigned long long __ATTRS_o_ai
16311vec_revb(vector unsigned long long __a) {
16312  vector unsigned char __indices =
16313      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16314  return vec_perm(__a, __a, __indices);
16315}
16316
16317static __inline__ vector double __ATTRS_o_ai
16318vec_revb(vector double __a) {
16319  vector unsigned char __indices =
16320      { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16321  return vec_perm(__a, __a, __indices);
16322}
16323#endif /* End __VSX__ */
16324
16325#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16326static __inline__ vector signed __int128 __ATTRS_o_ai
16327vec_revb(vector signed __int128 __a) {
16328  vector unsigned char __indices =
16329      { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16330  return (vector signed __int128)vec_perm((vector signed int)__a,
16331                                          (vector signed int)__a,
16332                                           __indices);
16333}
16334
16335static __inline__ vector unsigned __int128 __ATTRS_o_ai
16336vec_revb(vector unsigned __int128 __a) {
16337  vector unsigned char __indices =
16338      { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16339  return (vector unsigned __int128)vec_perm((vector signed int)__a,
16340                                            (vector signed int)__a,
16341                                             __indices);
16342}
16343#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16344
16345/* vec_xl */
16346
16347typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
16348typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
16349typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
16350typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
16351typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
16352typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
16353typedef vector float unaligned_vec_float __attribute__((aligned(1)));
16354
16355static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16356                                                     signed char *__ptr) {
16357  return *(unaligned_vec_schar *)(__ptr + __offset);
16358}
16359
16360static inline __ATTRS_o_ai vector unsigned char
16361vec_xl(signed long long __offset, unsigned char *__ptr) {
16362  return *(unaligned_vec_uchar*)(__ptr + __offset);
16363}
16364
16365static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16366                                                      signed short *__ptr) {
16367  signed char *__addr = (signed char *)__ptr + __offset;
16368  return *(unaligned_vec_sshort *)__addr;
16369}
16370
16371static inline __ATTRS_o_ai vector unsigned short
16372vec_xl(signed long long __offset, unsigned short *__ptr) {
16373  signed char *__addr = (signed char *)__ptr + __offset;
16374  return *(unaligned_vec_ushort *)__addr;
16375}
16376
16377static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16378                                                    signed int *__ptr) {
16379  signed char *__addr = (signed char *)__ptr + __offset;
16380  return *(unaligned_vec_sint *)__addr;
16381}
16382
16383static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16384                                                      unsigned int *__ptr) {
16385  signed char *__addr = (signed char *)__ptr + __offset;
16386  return *(unaligned_vec_uint *)__addr;
16387}
16388
16389static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16390                                               float *__ptr) {
16391  signed char *__addr = (signed char *)__ptr + __offset;
16392  return *(unaligned_vec_float *)__addr;
16393}
16394
16395#ifdef __VSX__
16396typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
16397typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
16398typedef vector double unaligned_vec_double __attribute__((aligned(1)));
16399
16400static inline __ATTRS_o_ai vector signed long long
16401vec_xl(signed long long __offset, signed long long *__ptr) {
16402  signed char *__addr = (signed char *)__ptr + __offset;
16403  return *(unaligned_vec_sll *)__addr;
16404}
16405
16406static inline __ATTRS_o_ai vector unsigned long long
16407vec_xl(signed long long __offset, unsigned long long *__ptr) {
16408  signed char *__addr = (signed char *)__ptr + __offset;
16409  return *(unaligned_vec_ull *)__addr;
16410}
16411
16412static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16413                                                double *__ptr) {
16414  signed char *__addr = (signed char *)__ptr + __offset;
16415  return *(unaligned_vec_double *)__addr;
16416}
16417#endif
16418
16419#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16420typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
16421typedef vector unsigned __int128 unaligned_vec_ui128
16422    __attribute__((aligned(1)));
16423static inline __ATTRS_o_ai vector signed __int128
16424vec_xl(signed long long __offset, signed __int128 *__ptr) {
16425  signed char *__addr = (signed char *)__ptr + __offset;
16426  return *(unaligned_vec_si128 *)__addr;
16427}
16428
16429static inline __ATTRS_o_ai vector unsigned __int128
16430vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16431  signed char *__addr = (signed char *)__ptr + __offset;
16432  return *(unaligned_vec_ui128 *)__addr;
16433}
16434#endif
16435
16436/* vec_xl_be */
16437
16438#ifdef __LITTLE_ENDIAN__
16439static __inline__ vector signed char __ATTRS_o_ai
16440vec_xl_be(signed long long __offset, signed char *__ptr) {
16441  vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16442  return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16443                                 13, 12, 11, 10, 9, 8);
16444}
16445
16446static __inline__ vector unsigned char __ATTRS_o_ai
16447vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16448  vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16449  return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16450                                 13, 12, 11, 10, 9, 8);
16451}
16452
16453static __inline__ vector signed short  __ATTRS_o_ai
16454vec_xl_be(signed long long __offset, signed short *__ptr) {
16455  vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16456  return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16457}
16458
16459static __inline__ vector unsigned short __ATTRS_o_ai
16460vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16461  vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16462  return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16463}
16464
16465static __inline__ vector signed int __ATTRS_o_ai
16466vec_xl_be(signed long long  __offset, signed int *__ptr) {
16467  return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16468}
16469
16470static __inline__ vector unsigned int __ATTRS_o_ai
16471vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16472  return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16473}
16474
16475static __inline__ vector float __ATTRS_o_ai
16476vec_xl_be(signed long long  __offset, float *__ptr) {
16477  return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16478}
16479
16480#ifdef __VSX__
16481static __inline__ vector signed long long __ATTRS_o_ai
16482vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16483  return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16484}
16485
16486static __inline__ vector unsigned long long __ATTRS_o_ai
16487vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16488  return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16489}
16490
16491static __inline__ vector double __ATTRS_o_ai
16492vec_xl_be(signed long long  __offset, double *__ptr) {
16493  return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16494}
16495#endif
16496
16497#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16498static __inline__ vector signed __int128 __ATTRS_o_ai
16499vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16500  return vec_xl(__offset, __ptr);
16501}
16502
16503static __inline__ vector unsigned __int128 __ATTRS_o_ai
16504vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16505  return vec_xl(__offset, __ptr);
16506}
16507#endif
16508#else
16509  #define vec_xl_be vec_xl
16510#endif
16511
16512/* vec_xst */
16513
16514static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16515                                        signed long long __offset,
16516                                        signed char *__ptr) {
16517  *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
16518}
16519
16520static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16521                                        signed long long __offset,
16522                                        unsigned char *__ptr) {
16523  *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
16524}
16525
16526static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16527                                        signed long long __offset,
16528                                        signed short *__ptr) {
16529  signed char *__addr = (signed char *)__ptr + __offset;
16530  *(unaligned_vec_sshort *)__addr = __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  signed char *__addr = (signed char *)__ptr + __offset;
16537  *(unaligned_vec_ushort *)__addr = __vec;
16538}
16539
16540static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16541                                        signed long long __offset,
16542                                        signed int *__ptr) {
16543  signed char *__addr = (signed char *)__ptr + __offset;
16544  *(unaligned_vec_sint *)__addr = __vec;
16545}
16546
16547static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16548                                        signed long long __offset,
16549                                        unsigned int *__ptr) {
16550  signed char *__addr = (signed char *)__ptr + __offset;
16551  *(unaligned_vec_uint *)__addr = __vec;
16552}
16553
16554static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16555                                        signed long long __offset,
16556                                        float *__ptr) {
16557  signed char *__addr = (signed char *)__ptr + __offset;
16558  *(unaligned_vec_float *)__addr = __vec;
16559}
16560
16561#ifdef __VSX__
16562static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16563                                        signed long long __offset,
16564                                        signed long long *__ptr) {
16565  signed char *__addr = (signed char *)__ptr + __offset;
16566  *(unaligned_vec_sll *)__addr = __vec;
16567}
16568
16569static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16570                                        signed long long __offset,
16571                                        unsigned long long *__ptr) {
16572  signed char *__addr = (signed char *)__ptr + __offset;
16573  *(unaligned_vec_ull *)__addr = __vec;
16574}
16575
16576static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16577                                        signed long long __offset,
16578                                        double *__ptr) {
16579  signed char *__addr = (signed char *)__ptr + __offset;
16580  *(unaligned_vec_double *)__addr = __vec;
16581}
16582#endif
16583
16584#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16585static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16586                                        signed long long __offset,
16587                                        signed __int128 *__ptr) {
16588  signed char *__addr = (signed char *)__ptr + __offset;
16589  *(unaligned_vec_si128 *)__addr = __vec;
16590}
16591
16592static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16593                                        signed long long __offset,
16594                                        unsigned __int128 *__ptr) {
16595  signed char *__addr = (signed char *)__ptr + __offset;
16596  *(unaligned_vec_ui128 *)__addr = __vec;
16597}
16598#endif
16599
16600/* vec_xst_be */
16601
16602#ifdef __LITTLE_ENDIAN__
16603static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16604                                               signed long long  __offset,
16605                                               signed char *__ptr) {
16606  vector signed char __tmp =
16607     __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16608                             13, 12, 11, 10, 9, 8);
16609  typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16610  __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16611}
16612
16613static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16614                                               signed long long  __offset,
16615                                               unsigned char *__ptr) {
16616  vector unsigned char __tmp =
16617     __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16618                             13, 12, 11, 10, 9, 8);
16619  typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16620  __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16621}
16622
16623static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16624                                               signed long long  __offset,
16625                                               signed short *__ptr) {
16626  vector signed short __tmp =
16627     __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16628  typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16629  __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16630}
16631
16632static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16633                                               signed long long  __offset,
16634                                               unsigned short *__ptr) {
16635  vector unsigned short __tmp =
16636     __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16637  typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16638  __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16639}
16640
16641static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16642                                               signed long long  __offset,
16643                                               signed int *__ptr) {
16644  __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16645}
16646
16647static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16648                                               signed long long  __offset,
16649                                               unsigned int *__ptr) {
16650  __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
16651}
16652
16653static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16654                                               signed long long  __offset,
16655                                               float *__ptr) {
16656  __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
16657}
16658
16659#ifdef __VSX__
16660static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16661                                               signed long long  __offset,
16662                                               signed long long *__ptr) {
16663  __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16664}
16665
16666static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16667                                               signed long long  __offset,
16668                                               unsigned long long *__ptr) {
16669  __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16670}
16671
16672static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16673                                               signed long long  __offset,
16674                                               double *__ptr) {
16675  __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16676}
16677#endif
16678
16679#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16680static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16681                                               signed long long  __offset,
16682                                               signed __int128 *__ptr) {
16683  vec_xst(__vec, __offset, __ptr);
16684}
16685
16686static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16687                                               signed long long  __offset,
16688                                               unsigned __int128 *__ptr) {
16689  vec_xst(__vec, __offset, __ptr);
16690}
16691#endif
16692#else
16693  #define vec_xst_be vec_xst
16694#endif
16695
16696#ifdef __POWER9_VECTOR__
16697#define vec_test_data_class(__a, __b)                                          \
16698  _Generic(                                                                    \
16699      (__a), vector float                                                      \
16700      : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)),  \
16701        vector double                                                          \
16702      : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a),   \
16703                                                       (__b)))
16704
16705#endif /* #ifdef __POWER9_VECTOR__ */
16706
16707static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16708  return -__a;
16709}
16710
16711#ifdef __VSX__
16712static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16713  return -__a;
16714}
16715
16716#endif
16717
16718#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16719static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16720  return -__a;
16721}
16722#endif
16723
16724static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16725  return -__a;
16726}
16727
16728static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16729  return -__a;
16730}
16731
16732static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16733  return -__a;
16734}
16735
16736static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16737  return - vec_abs(__a);
16738}
16739
16740#ifdef __VSX__
16741static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16742  return - vec_abs(__a);
16743}
16744
16745#endif
16746
16747#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16748static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16749  return __builtin_altivec_vminsd(__a, -__a);
16750}
16751#endif
16752
16753static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16754  return __builtin_altivec_vminsw(__a, -__a);
16755}
16756
16757static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16758  return __builtin_altivec_vminsh(__a, -__a);
16759}
16760
16761static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16762  return __builtin_altivec_vminsb(__a, -__a);
16763}
16764#undef __ATTRS_o_ai
16765
16766#endif /* __ALTIVEC_H */
16767