]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/lib/Headers/altivec.h
MFC r355940:
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / lib / Headers / altivec.h
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
48 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
49     vector signed char __a, vector signed char __b, vector unsigned char __c);
50
51 static __inline__ vector unsigned char __ATTRS_o_ai
52 vec_perm(vector unsigned char __a, vector unsigned char __b,
53          vector unsigned char __c);
54
55 static __inline__ vector bool char __ATTRS_o_ai
56 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
57
58 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
59                                                      vector signed short __b,
60                                                      vector unsigned char __c);
61
62 static __inline__ vector unsigned short __ATTRS_o_ai
63 vec_perm(vector unsigned short __a, vector unsigned short __b,
64          vector unsigned char __c);
65
66 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
67     vector bool short __a, vector bool short __b, vector unsigned char __c);
68
69 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
70                                                      vector pixel __b,
71                                                      vector unsigned char __c);
72
73 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
74                                                    vector signed int __b,
75                                                    vector unsigned char __c);
76
77 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
78     vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
79
80 static __inline__ vector bool int __ATTRS_o_ai
81 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
82
83 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
84                                                      vector float __b,
85                                                      vector unsigned char __c);
86
87 #ifdef __VSX__
88 static __inline__ vector long long __ATTRS_o_ai
89 vec_perm(vector signed long long __a, vector signed long long __b,
90          vector unsigned char __c);
91
92 static __inline__ vector unsigned long long __ATTRS_o_ai
93 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
94          vector unsigned char __c);
95
96 static __inline__ vector bool long long __ATTRS_o_ai
97 vec_perm(vector bool long long __a, vector bool long long __b,
98          vector unsigned char __c);
99
100 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
101                                                       vector double __b,
102                                                       vector unsigned char __c);
103 #endif
104
105 static __inline__ vector unsigned char __ATTRS_o_ai
106 vec_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
114 static __inline__ vector signed char __ATTRS_o_ai
115 vec_abs(vector signed char __a) {
116   return __builtin_altivec_vmaxsb(__a, -__a);
117 }
118
119 static __inline__ vector signed short __ATTRS_o_ai
120 vec_abs(vector signed short __a) {
121   return __builtin_altivec_vmaxsh(__a, -__a);
122 }
123
124 static __inline__ vector signed int __ATTRS_o_ai
125 vec_abs(vector signed int __a) {
126   return __builtin_altivec_vmaxsw(__a, -__a);
127 }
128
129 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
130 static __inline__ vector signed long long __ATTRS_o_ai
131 vec_abs(vector signed long long __a) {
132   return __builtin_altivec_vmaxsd(__a, -__a);
133 }
134 #endif
135
136 static __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__
147 static __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
157 static __inline__ vector signed char __ATTRS_o_ai
158 vec_abss(vector signed char __a) {
159   return __builtin_altivec_vmaxsb(
160       __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
161 }
162
163 static __inline__ vector signed short __ATTRS_o_ai
164 vec_abss(vector signed short __a) {
165   return __builtin_altivec_vmaxsh(
166       __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
167 }
168
169 static __inline__ vector signed int __ATTRS_o_ai
170 vec_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
178 static __inline__ vector unsigned char __ATTRS_o_ai
179 vec_absd(vector unsigned char __a, vector unsigned char __b) {
180   return __builtin_altivec_vabsdub(__a, __b);
181 }
182
183 static __inline__ vector unsigned short __ATTRS_o_ai
184 vec_absd(vector unsigned short __a, vector unsigned short __b) {
185   return __builtin_altivec_vabsduh(__a, __b);
186 }
187
188 static __inline__ vector unsigned int __ATTRS_o_ai
189 vec_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
197 static __inline__ vector signed char __ATTRS_o_ai
198 vec_add(vector signed char __a, vector signed char __b) {
199   return __a + __b;
200 }
201
202 static __inline__ vector signed char __ATTRS_o_ai
203 vec_add(vector bool char __a, vector signed char __b) {
204   return (vector signed char)__a + __b;
205 }
206
207 static __inline__ vector signed char __ATTRS_o_ai
208 vec_add(vector signed char __a, vector bool char __b) {
209   return __a + (vector signed char)__b;
210 }
211
212 static __inline__ vector unsigned char __ATTRS_o_ai
213 vec_add(vector unsigned char __a, vector unsigned char __b) {
214   return __a + __b;
215 }
216
217 static __inline__ vector unsigned char __ATTRS_o_ai
218 vec_add(vector bool char __a, vector unsigned char __b) {
219   return (vector unsigned char)__a + __b;
220 }
221
222 static __inline__ vector unsigned char __ATTRS_o_ai
223 vec_add(vector unsigned char __a, vector bool char __b) {
224   return __a + (vector unsigned char)__b;
225 }
226
227 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
228                                                     vector short __b) {
229   return __a + __b;
230 }
231
232 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
233                                                     vector short __b) {
234   return (vector short)__a + __b;
235 }
236
237 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
238                                                     vector bool short __b) {
239   return __a + (vector short)__b;
240 }
241
242 static __inline__ vector unsigned short __ATTRS_o_ai
243 vec_add(vector unsigned short __a, vector unsigned short __b) {
244   return __a + __b;
245 }
246
247 static __inline__ vector unsigned short __ATTRS_o_ai
248 vec_add(vector bool short __a, vector unsigned short __b) {
249   return (vector unsigned short)__a + __b;
250 }
251
252 static __inline__ vector unsigned short __ATTRS_o_ai
253 vec_add(vector unsigned short __a, vector bool short __b) {
254   return __a + (vector unsigned short)__b;
255 }
256
257 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
258                                                   vector int __b) {
259   return __a + __b;
260 }
261
262 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
263                                                   vector int __b) {
264   return (vector int)__a + __b;
265 }
266
267 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
268                                                   vector bool int __b) {
269   return __a + (vector int)__b;
270 }
271
272 static __inline__ vector unsigned int __ATTRS_o_ai
273 vec_add(vector unsigned int __a, vector unsigned int __b) {
274   return __a + __b;
275 }
276
277 static __inline__ vector unsigned int __ATTRS_o_ai
278 vec_add(vector bool int __a, vector unsigned int __b) {
279   return (vector unsigned int)__a + __b;
280 }
281
282 static __inline__ vector unsigned int __ATTRS_o_ai
283 vec_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__)
288 static __inline__ vector signed long long __ATTRS_o_ai
289 vec_add(vector signed long long __a, vector signed long long __b) {
290   return __a + __b;
291 }
292
293 static __inline__ vector unsigned long long __ATTRS_o_ai
294 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
295   return __a + __b;
296 }
297
298 static __inline__ vector signed __int128 __ATTRS_o_ai
299 vec_add(vector signed __int128 __a, vector signed __int128 __b) {
300   return __a + __b;
301 }
302
303 static __inline__ vector unsigned __int128 __ATTRS_o_ai
304 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
305   return __a + __b;
306 }
307 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
308
309 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
310                                                     vector float __b) {
311   return __a + __b;
312 }
313
314 #ifdef __VSX__
315 static __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__)
324 static __inline__ vector signed __int128 __ATTRS_o_ai
325 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
326          vector signed __int128 __c) {
327   return __builtin_altivec_vaddeuqm(__a, __b, __c);
328 }
329
330 static __inline__ vector unsigned __int128 __ATTRS_o_ai
331 vec_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
337 static __inline__ vector signed int __ATTRS_o_ai
338 vec_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
345 static __inline__ vector unsigned int __ATTRS_o_ai
346 vec_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__)
356 static __inline__ vector signed __int128 __ATTRS_o_ai
357 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
358           vector signed __int128 __c) {
359   return __builtin_altivec_vaddecuq(__a, __b, __c);
360 }
361
362 static __inline__ vector unsigned __int128 __ATTRS_o_ai
363 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
364           vector unsigned __int128 __c) {
365   return __builtin_altivec_vaddecuq(__a, __b, __c);
366 }
367
368 static __inline__ vector signed int __ATTRS_o_ai
369 vec_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
391 static __inline__ vector unsigned int __ATTRS_o_ai
392 vec_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
417 static __inline__ vector signed char __ATTRS_o_ai
418 vec_vaddubm(vector signed char __a, vector signed char __b) {
419   return __a + __b;
420 }
421
422 static __inline__ vector signed char __ATTRS_o_ai
423 vec_vaddubm(vector bool char __a, vector signed char __b) {
424   return (vector signed char)__a + __b;
425 }
426
427 static __inline__ vector signed char __ATTRS_o_ai
428 vec_vaddubm(vector signed char __a, vector bool char __b) {
429   return __a + (vector signed char)__b;
430 }
431
432 static __inline__ vector unsigned char __ATTRS_o_ai
433 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
434   return __a + __b;
435 }
436
437 static __inline__ vector unsigned char __ATTRS_o_ai
438 vec_vaddubm(vector bool char __a, vector unsigned char __b) {
439   return (vector unsigned char)__a + __b;
440 }
441
442 static __inline__ vector unsigned char __ATTRS_o_ai
443 vec_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
451 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
452                                                         vector short __b) {
453   return __a + __b;
454 }
455
456 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
457                                                         vector short __b) {
458   return (vector short)__a + __b;
459 }
460
461 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
462                                                         vector bool short __b) {
463   return __a + (vector short)__b;
464 }
465
466 static __inline__ vector unsigned short __ATTRS_o_ai
467 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
468   return __a + __b;
469 }
470
471 static __inline__ vector unsigned short __ATTRS_o_ai
472 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
473   return (vector unsigned short)__a + __b;
474 }
475
476 static __inline__ vector unsigned short __ATTRS_o_ai
477 vec_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
485 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
486                                                       vector int __b) {
487   return __a + __b;
488 }
489
490 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
491                                                       vector int __b) {
492   return (vector int)__a + __b;
493 }
494
495 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
496                                                       vector bool int __b) {
497   return __a + (vector int)__b;
498 }
499
500 static __inline__ vector unsigned int __ATTRS_o_ai
501 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
502   return __a + __b;
503 }
504
505 static __inline__ vector unsigned int __ATTRS_o_ai
506 vec_vadduwm(vector bool int __a, vector unsigned int __b) {
507   return (vector unsigned int)__a + __b;
508 }
509
510 static __inline__ vector unsigned int __ATTRS_o_ai
511 vec_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
519 static __inline__ vector float __attribute__((__always_inline__))
520 vec_vaddfp(vector float __a, vector float __b) {
521   return __a + __b;
522 }
523
524 /* vec_addc */
525
526 static __inline__ vector signed int __ATTRS_o_ai
527 vec_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
532 static __inline__ vector unsigned int __ATTRS_o_ai
533 vec_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__)
538 static __inline__ vector signed __int128 __ATTRS_o_ai
539 vec_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
544 static __inline__ vector unsigned __int128 __ATTRS_o_ai
545 vec_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
552 static __inline__ vector unsigned int __attribute__((__always_inline__))
553 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
554   return __builtin_altivec_vaddcuw(__a, __b);
555 }
556
557 /* vec_adds */
558
559 static __inline__ vector signed char __ATTRS_o_ai
560 vec_adds(vector signed char __a, vector signed char __b) {
561   return __builtin_altivec_vaddsbs(__a, __b);
562 }
563
564 static __inline__ vector signed char __ATTRS_o_ai
565 vec_adds(vector bool char __a, vector signed char __b) {
566   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
567 }
568
569 static __inline__ vector signed char __ATTRS_o_ai
570 vec_adds(vector signed char __a, vector bool char __b) {
571   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
572 }
573
574 static __inline__ vector unsigned char __ATTRS_o_ai
575 vec_adds(vector unsigned char __a, vector unsigned char __b) {
576   return __builtin_altivec_vaddubs(__a, __b);
577 }
578
579 static __inline__ vector unsigned char __ATTRS_o_ai
580 vec_adds(vector bool char __a, vector unsigned char __b) {
581   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
582 }
583
584 static __inline__ vector unsigned char __ATTRS_o_ai
585 vec_adds(vector unsigned char __a, vector bool char __b) {
586   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
587 }
588
589 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
590                                                      vector short __b) {
591   return __builtin_altivec_vaddshs(__a, __b);
592 }
593
594 static __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
599 static __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
604 static __inline__ vector unsigned short __ATTRS_o_ai
605 vec_adds(vector unsigned short __a, vector unsigned short __b) {
606   return __builtin_altivec_vadduhs(__a, __b);
607 }
608
609 static __inline__ vector unsigned short __ATTRS_o_ai
610 vec_adds(vector bool short __a, vector unsigned short __b) {
611   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
612 }
613
614 static __inline__ vector unsigned short __ATTRS_o_ai
615 vec_adds(vector unsigned short __a, vector bool short __b) {
616   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
617 }
618
619 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
620                                                    vector int __b) {
621   return __builtin_altivec_vaddsws(__a, __b);
622 }
623
624 static __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
629 static __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
634 static __inline__ vector unsigned int __ATTRS_o_ai
635 vec_adds(vector unsigned int __a, vector unsigned int __b) {
636   return __builtin_altivec_vadduws(__a, __b);
637 }
638
639 static __inline__ vector unsigned int __ATTRS_o_ai
640 vec_adds(vector bool int __a, vector unsigned int __b) {
641   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
642 }
643
644 static __inline__ vector unsigned int __ATTRS_o_ai
645 vec_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
651 static __inline__ vector signed char __ATTRS_o_ai
652 vec_vaddsbs(vector signed char __a, vector signed char __b) {
653   return __builtin_altivec_vaddsbs(__a, __b);
654 }
655
656 static __inline__ vector signed char __ATTRS_o_ai
657 vec_vaddsbs(vector bool char __a, vector signed char __b) {
658   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
659 }
660
661 static __inline__ vector signed char __ATTRS_o_ai
662 vec_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
668 static __inline__ vector unsigned char __ATTRS_o_ai
669 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
670   return __builtin_altivec_vaddubs(__a, __b);
671 }
672
673 static __inline__ vector unsigned char __ATTRS_o_ai
674 vec_vaddubs(vector bool char __a, vector unsigned char __b) {
675   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
676 }
677
678 static __inline__ vector unsigned char __ATTRS_o_ai
679 vec_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
685 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
686                                                         vector short __b) {
687   return __builtin_altivec_vaddshs(__a, __b);
688 }
689
690 static __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
695 static __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
702 static __inline__ vector unsigned short __ATTRS_o_ai
703 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
704   return __builtin_altivec_vadduhs(__a, __b);
705 }
706
707 static __inline__ vector unsigned short __ATTRS_o_ai
708 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
709   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
710 }
711
712 static __inline__ vector unsigned short __ATTRS_o_ai
713 vec_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
719 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
720                                                       vector int __b) {
721   return __builtin_altivec_vaddsws(__a, __b);
722 }
723
724 static __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
729 static __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
736 static __inline__ vector unsigned int __ATTRS_o_ai
737 vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
738   return __builtin_altivec_vadduws(__a, __b);
739 }
740
741 static __inline__ vector unsigned int __ATTRS_o_ai
742 vec_vadduws(vector bool int __a, vector unsigned int __b) {
743   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
744 }
745
746 static __inline__ vector unsigned int __ATTRS_o_ai
747 vec_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
754 static __inline__ vector signed __int128 __ATTRS_o_ai
755 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
756   return __a + __b;
757 }
758
759 static __inline__ vector unsigned __int128 __ATTRS_o_ai
760 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
761   return __a + __b;
762 }
763
764 /* vec_vaddeuqm */
765
766 static __inline__ vector signed __int128 __ATTRS_o_ai
767 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
768              vector signed __int128 __c) {
769   return __builtin_altivec_vaddeuqm(__a, __b, __c);
770 }
771
772 static __inline__ vector unsigned __int128 __ATTRS_o_ai
773 vec_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
780 static __inline__ vector signed __int128 __ATTRS_o_ai
781 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
782   return __builtin_altivec_vaddcuq(__a, __b);
783 }
784
785 static __inline__ vector unsigned __int128 __ATTRS_o_ai
786 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
787   return __builtin_altivec_vaddcuq(__a, __b);
788 }
789
790 /* vec_vaddecuq */
791
792 static __inline__ vector signed __int128 __ATTRS_o_ai
793 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
794              vector signed __int128 __c) {
795   return __builtin_altivec_vaddecuq(__a, __b, __c);
796 }
797
798 static __inline__ vector unsigned __int128 __ATTRS_o_ai
799 vec_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
809 static __inline__ vector signed char __ATTRS_o_ai
810 vec_and(vector signed char __a, vector signed char __b) {
811   return __a & __b;
812 }
813
814 static __inline__ vector signed char __ATTRS_o_ai
815 vec_and(vector bool char __a, vector signed char __b) {
816   return (vector signed char)__a & __b;
817 }
818
819 static __inline__ vector signed char __ATTRS_o_ai
820 vec_and(vector signed char __a, vector bool char __b) {
821   return __a & (vector signed char)__b;
822 }
823
824 static __inline__ vector unsigned char __ATTRS_o_ai
825 vec_and(vector unsigned char __a, vector unsigned char __b) {
826   return __a & __b;
827 }
828
829 static __inline__ vector unsigned char __ATTRS_o_ai
830 vec_and(vector bool char __a, vector unsigned char __b) {
831   return (vector unsigned char)__a & __b;
832 }
833
834 static __inline__ vector unsigned char __ATTRS_o_ai
835 vec_and(vector unsigned char __a, vector bool char __b) {
836   return __a & (vector unsigned char)__b;
837 }
838
839 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
840                                                         vector bool char __b) {
841   return __a & __b;
842 }
843
844 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
845                                                     vector short __b) {
846   return __a & __b;
847 }
848
849 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
850                                                     vector short __b) {
851   return (vector short)__a & __b;
852 }
853
854 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
855                                                     vector bool short __b) {
856   return __a & (vector short)__b;
857 }
858
859 static __inline__ vector unsigned short __ATTRS_o_ai
860 vec_and(vector unsigned short __a, vector unsigned short __b) {
861   return __a & __b;
862 }
863
864 static __inline__ vector unsigned short __ATTRS_o_ai
865 vec_and(vector bool short __a, vector unsigned short __b) {
866   return (vector unsigned short)__a & __b;
867 }
868
869 static __inline__ vector unsigned short __ATTRS_o_ai
870 vec_and(vector unsigned short __a, vector bool short __b) {
871   return __a & (vector unsigned short)__b;
872 }
873
874 static __inline__ vector bool short __ATTRS_o_ai
875 vec_and(vector bool short __a, vector bool short __b) {
876   return __a & __b;
877 }
878
879 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
880                                                   vector int __b) {
881   return __a & __b;
882 }
883
884 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
885                                                   vector int __b) {
886   return (vector int)__a & __b;
887 }
888
889 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
890                                                   vector bool int __b) {
891   return __a & (vector int)__b;
892 }
893
894 static __inline__ vector unsigned int __ATTRS_o_ai
895 vec_and(vector unsigned int __a, vector unsigned int __b) {
896   return __a & __b;
897 }
898
899 static __inline__ vector unsigned int __ATTRS_o_ai
900 vec_and(vector bool int __a, vector unsigned int __b) {
901   return (vector unsigned int)__a & __b;
902 }
903
904 static __inline__ vector unsigned int __ATTRS_o_ai
905 vec_and(vector unsigned int __a, vector bool int __b) {
906   return __a & (vector unsigned int)__b;
907 }
908
909 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
910                                                        vector bool int __b) {
911   return __a & __b;
912 }
913
914 static __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
921 static __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
928 static __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__
936 static __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
943 static __inline__ vector double __ATTRS_o_ai
944 vec_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
950 static __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
957 static __inline__ vector signed long long __ATTRS_o_ai
958 vec_and(vector signed long long __a, vector signed long long __b) {
959   return __a & __b;
960 }
961
962 static __inline__ vector signed long long __ATTRS_o_ai
963 vec_and(vector bool long long __a, vector signed long long __b) {
964   return (vector signed long long)__a & __b;
965 }
966
967 static __inline__ vector signed long long __ATTRS_o_ai
968 vec_and(vector signed long long __a, vector bool long long __b) {
969   return __a & (vector signed long long)__b;
970 }
971
972 static __inline__ vector unsigned long long __ATTRS_o_ai
973 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
974   return __a & __b;
975 }
976
977 static __inline__ vector unsigned long long __ATTRS_o_ai
978 vec_and(vector bool long long __a, vector unsigned long long __b) {
979   return (vector unsigned long long)__a & __b;
980 }
981
982 static __inline__ vector unsigned long long __ATTRS_o_ai
983 vec_and(vector unsigned long long __a, vector bool long long __b) {
984   return __a & (vector unsigned long long)__b;
985 }
986
987 static __inline__ vector bool long long __ATTRS_o_ai
988 vec_and(vector bool long long __a, vector bool long long __b) {
989   return __a & __b;
990 }
991 #endif
992
993 /* vec_vand */
994
995 static __inline__ vector signed char __ATTRS_o_ai
996 vec_vand(vector signed char __a, vector signed char __b) {
997   return __a & __b;
998 }
999
1000 static __inline__ vector signed char __ATTRS_o_ai
1001 vec_vand(vector bool char __a, vector signed char __b) {
1002   return (vector signed char)__a & __b;
1003 }
1004
1005 static __inline__ vector signed char __ATTRS_o_ai
1006 vec_vand(vector signed char __a, vector bool char __b) {
1007   return __a & (vector signed char)__b;
1008 }
1009
1010 static __inline__ vector unsigned char __ATTRS_o_ai
1011 vec_vand(vector unsigned char __a, vector unsigned char __b) {
1012   return __a & __b;
1013 }
1014
1015 static __inline__ vector unsigned char __ATTRS_o_ai
1016 vec_vand(vector bool char __a, vector unsigned char __b) {
1017   return (vector unsigned char)__a & __b;
1018 }
1019
1020 static __inline__ vector unsigned char __ATTRS_o_ai
1021 vec_vand(vector unsigned char __a, vector bool char __b) {
1022   return __a & (vector unsigned char)__b;
1023 }
1024
1025 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1026                                                          vector bool char __b) {
1027   return __a & __b;
1028 }
1029
1030 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1031                                                      vector short __b) {
1032   return __a & __b;
1033 }
1034
1035 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1036                                                      vector short __b) {
1037   return (vector short)__a & __b;
1038 }
1039
1040 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1041                                                      vector bool short __b) {
1042   return __a & (vector short)__b;
1043 }
1044
1045 static __inline__ vector unsigned short __ATTRS_o_ai
1046 vec_vand(vector unsigned short __a, vector unsigned short __b) {
1047   return __a & __b;
1048 }
1049
1050 static __inline__ vector unsigned short __ATTRS_o_ai
1051 vec_vand(vector bool short __a, vector unsigned short __b) {
1052   return (vector unsigned short)__a & __b;
1053 }
1054
1055 static __inline__ vector unsigned short __ATTRS_o_ai
1056 vec_vand(vector unsigned short __a, vector bool short __b) {
1057   return __a & (vector unsigned short)__b;
1058 }
1059
1060 static __inline__ vector bool short __ATTRS_o_ai
1061 vec_vand(vector bool short __a, vector bool short __b) {
1062   return __a & __b;
1063 }
1064
1065 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1066                                                    vector int __b) {
1067   return __a & __b;
1068 }
1069
1070 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1071                                                    vector int __b) {
1072   return (vector int)__a & __b;
1073 }
1074
1075 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1076                                                    vector bool int __b) {
1077   return __a & (vector int)__b;
1078 }
1079
1080 static __inline__ vector unsigned int __ATTRS_o_ai
1081 vec_vand(vector unsigned int __a, vector unsigned int __b) {
1082   return __a & __b;
1083 }
1084
1085 static __inline__ vector unsigned int __ATTRS_o_ai
1086 vec_vand(vector bool int __a, vector unsigned int __b) {
1087   return (vector unsigned int)__a & __b;
1088 }
1089
1090 static __inline__ vector unsigned int __ATTRS_o_ai
1091 vec_vand(vector unsigned int __a, vector bool int __b) {
1092   return __a & (vector unsigned int)__b;
1093 }
1094
1095 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1096                                                         vector bool int __b) {
1097   return __a & __b;
1098 }
1099
1100 static __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
1107 static __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
1114 static __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__
1122 static __inline__ vector signed long long __ATTRS_o_ai
1123 vec_vand(vector signed long long __a, vector signed long long __b) {
1124   return __a & __b;
1125 }
1126
1127 static __inline__ vector signed long long __ATTRS_o_ai
1128 vec_vand(vector bool long long __a, vector signed long long __b) {
1129   return (vector signed long long)__a & __b;
1130 }
1131
1132 static __inline__ vector signed long long __ATTRS_o_ai
1133 vec_vand(vector signed long long __a, vector bool long long __b) {
1134   return __a & (vector signed long long)__b;
1135 }
1136
1137 static __inline__ vector unsigned long long __ATTRS_o_ai
1138 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1139   return __a & __b;
1140 }
1141
1142 static __inline__ vector unsigned long long __ATTRS_o_ai
1143 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1144   return (vector unsigned long long)__a & __b;
1145 }
1146
1147 static __inline__ vector unsigned long long __ATTRS_o_ai
1148 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1149   return __a & (vector unsigned long long)__b;
1150 }
1151
1152 static __inline__ vector bool long long __ATTRS_o_ai
1153 vec_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
1162 static __inline__ vector signed char __ATTRS_o_ai
1163 vec_andc(vector signed char __a, vector signed char __b) {
1164   return __a & ~__b;
1165 }
1166
1167 static __inline__ vector signed char __ATTRS_o_ai
1168 vec_andc(vector bool char __a, vector signed char __b) {
1169   return (vector signed char)__a & ~__b;
1170 }
1171
1172 static __inline__ vector signed char __ATTRS_o_ai
1173 vec_andc(vector signed char __a, vector bool char __b) {
1174   return __a & ~(vector signed char)__b;
1175 }
1176
1177 static __inline__ vector unsigned char __ATTRS_o_ai
1178 vec_andc(vector unsigned char __a, vector unsigned char __b) {
1179   return __a & ~__b;
1180 }
1181
1182 static __inline__ vector unsigned char __ATTRS_o_ai
1183 vec_andc(vector bool char __a, vector unsigned char __b) {
1184   return (vector unsigned char)__a & ~__b;
1185 }
1186
1187 static __inline__ vector unsigned char __ATTRS_o_ai
1188 vec_andc(vector unsigned char __a, vector bool char __b) {
1189   return __a & ~(vector unsigned char)__b;
1190 }
1191
1192 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1193                                                          vector bool char __b) {
1194   return __a & ~__b;
1195 }
1196
1197 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1198                                                      vector short __b) {
1199   return __a & ~__b;
1200 }
1201
1202 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1203                                                      vector short __b) {
1204   return (vector short)__a & ~__b;
1205 }
1206
1207 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1208                                                      vector bool short __b) {
1209   return __a & ~(vector short)__b;
1210 }
1211
1212 static __inline__ vector unsigned short __ATTRS_o_ai
1213 vec_andc(vector unsigned short __a, vector unsigned short __b) {
1214   return __a & ~__b;
1215 }
1216
1217 static __inline__ vector unsigned short __ATTRS_o_ai
1218 vec_andc(vector bool short __a, vector unsigned short __b) {
1219   return (vector unsigned short)__a & ~__b;
1220 }
1221
1222 static __inline__ vector unsigned short __ATTRS_o_ai
1223 vec_andc(vector unsigned short __a, vector bool short __b) {
1224   return __a & ~(vector unsigned short)__b;
1225 }
1226
1227 static __inline__ vector bool short __ATTRS_o_ai
1228 vec_andc(vector bool short __a, vector bool short __b) {
1229   return __a & ~__b;
1230 }
1231
1232 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1233                                                    vector int __b) {
1234   return __a & ~__b;
1235 }
1236
1237 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1238                                                    vector int __b) {
1239   return (vector int)__a & ~__b;
1240 }
1241
1242 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1243                                                    vector bool int __b) {
1244   return __a & ~(vector int)__b;
1245 }
1246
1247 static __inline__ vector unsigned int __ATTRS_o_ai
1248 vec_andc(vector unsigned int __a, vector unsigned int __b) {
1249   return __a & ~__b;
1250 }
1251
1252 static __inline__ vector unsigned int __ATTRS_o_ai
1253 vec_andc(vector bool int __a, vector unsigned int __b) {
1254   return (vector unsigned int)__a & ~__b;
1255 }
1256
1257 static __inline__ vector unsigned int __ATTRS_o_ai
1258 vec_andc(vector unsigned int __a, vector bool int __b) {
1259   return __a & ~(vector unsigned int)__b;
1260 }
1261
1262 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1263                                                         vector bool int __b) {
1264   return __a & ~__b;
1265 }
1266
1267 static __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
1274 static __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
1281 static __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__
1289 static __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
1296 static __inline__ vector double __ATTRS_o_ai
1297 vec_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
1303 static __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
1310 static __inline__ vector signed long long __ATTRS_o_ai
1311 vec_andc(vector signed long long __a, vector signed long long __b) {
1312   return __a & ~__b;
1313 }
1314
1315 static __inline__ vector signed long long __ATTRS_o_ai
1316 vec_andc(vector bool long long __a, vector signed long long __b) {
1317   return (vector signed long long)__a & ~__b;
1318 }
1319
1320 static __inline__ vector signed long long __ATTRS_o_ai
1321 vec_andc(vector signed long long __a, vector bool long long __b) {
1322   return __a & ~(vector signed long long)__b;
1323 }
1324
1325 static __inline__ vector unsigned long long __ATTRS_o_ai
1326 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1327   return __a & ~__b;
1328 }
1329
1330 static __inline__ vector unsigned long long __ATTRS_o_ai
1331 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1332   return (vector unsigned long long)__a & ~__b;
1333 }
1334
1335 static __inline__ vector unsigned long long __ATTRS_o_ai
1336 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1337   return __a & ~(vector unsigned long long)__b;
1338 }
1339
1340 static __inline__ vector bool long long __ATTRS_o_ai
1341 vec_andc(vector bool long long __a, vector bool long long __b) {
1342   return __a & ~__b;
1343 }
1344 #endif
1345
1346 /* vec_vandc */
1347
1348 static __inline__ vector signed char __ATTRS_o_ai
1349 vec_vandc(vector signed char __a, vector signed char __b) {
1350   return __a & ~__b;
1351 }
1352
1353 static __inline__ vector signed char __ATTRS_o_ai
1354 vec_vandc(vector bool char __a, vector signed char __b) {
1355   return (vector signed char)__a & ~__b;
1356 }
1357
1358 static __inline__ vector signed char __ATTRS_o_ai
1359 vec_vandc(vector signed char __a, vector bool char __b) {
1360   return __a & ~(vector signed char)__b;
1361 }
1362
1363 static __inline__ vector unsigned char __ATTRS_o_ai
1364 vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1365   return __a & ~__b;
1366 }
1367
1368 static __inline__ vector unsigned char __ATTRS_o_ai
1369 vec_vandc(vector bool char __a, vector unsigned char __b) {
1370   return (vector unsigned char)__a & ~__b;
1371 }
1372
1373 static __inline__ vector unsigned char __ATTRS_o_ai
1374 vec_vandc(vector unsigned char __a, vector bool char __b) {
1375   return __a & ~(vector unsigned char)__b;
1376 }
1377
1378 static __inline__ vector bool char __ATTRS_o_ai
1379 vec_vandc(vector bool char __a, vector bool char __b) {
1380   return __a & ~__b;
1381 }
1382
1383 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1384                                                       vector short __b) {
1385   return __a & ~__b;
1386 }
1387
1388 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1389                                                       vector short __b) {
1390   return (vector short)__a & ~__b;
1391 }
1392
1393 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1394                                                       vector bool short __b) {
1395   return __a & ~(vector short)__b;
1396 }
1397
1398 static __inline__ vector unsigned short __ATTRS_o_ai
1399 vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1400   return __a & ~__b;
1401 }
1402
1403 static __inline__ vector unsigned short __ATTRS_o_ai
1404 vec_vandc(vector bool short __a, vector unsigned short __b) {
1405   return (vector unsigned short)__a & ~__b;
1406 }
1407
1408 static __inline__ vector unsigned short __ATTRS_o_ai
1409 vec_vandc(vector unsigned short __a, vector bool short __b) {
1410   return __a & ~(vector unsigned short)__b;
1411 }
1412
1413 static __inline__ vector bool short __ATTRS_o_ai
1414 vec_vandc(vector bool short __a, vector bool short __b) {
1415   return __a & ~__b;
1416 }
1417
1418 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1419                                                     vector int __b) {
1420   return __a & ~__b;
1421 }
1422
1423 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1424                                                     vector int __b) {
1425   return (vector int)__a & ~__b;
1426 }
1427
1428 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1429                                                     vector bool int __b) {
1430   return __a & ~(vector int)__b;
1431 }
1432
1433 static __inline__ vector unsigned int __ATTRS_o_ai
1434 vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1435   return __a & ~__b;
1436 }
1437
1438 static __inline__ vector unsigned int __ATTRS_o_ai
1439 vec_vandc(vector bool int __a, vector unsigned int __b) {
1440   return (vector unsigned int)__a & ~__b;
1441 }
1442
1443 static __inline__ vector unsigned int __ATTRS_o_ai
1444 vec_vandc(vector unsigned int __a, vector bool int __b) {
1445   return __a & ~(vector unsigned int)__b;
1446 }
1447
1448 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1449                                                          vector bool int __b) {
1450   return __a & ~__b;
1451 }
1452
1453 static __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
1460 static __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
1467 static __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__
1475 static __inline__ vector signed long long __ATTRS_o_ai
1476 vec_vandc(vector signed long long __a, vector signed long long __b) {
1477   return __a & ~__b;
1478 }
1479
1480 static __inline__ vector signed long long __ATTRS_o_ai
1481 vec_vandc(vector bool long long __a, vector signed long long __b) {
1482   return (vector signed long long)__a & ~__b;
1483 }
1484
1485 static __inline__ vector signed long long __ATTRS_o_ai
1486 vec_vandc(vector signed long long __a, vector bool long long __b) {
1487   return __a & ~(vector signed long long)__b;
1488 }
1489
1490 static __inline__ vector unsigned long long __ATTRS_o_ai
1491 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1492   return __a & ~__b;
1493 }
1494
1495 static __inline__ vector unsigned long long __ATTRS_o_ai
1496 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1497   return (vector unsigned long long)__a & ~__b;
1498 }
1499
1500 static __inline__ vector unsigned long long __ATTRS_o_ai
1501 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1502   return __a & ~(vector unsigned long long)__b;
1503 }
1504
1505 static __inline__ vector bool long long __ATTRS_o_ai
1506 vec_vandc(vector bool long long __a, vector bool long long __b) {
1507   return __a & ~__b;
1508 }
1509 #endif
1510
1511 /* vec_avg */
1512
1513 static __inline__ vector signed char __ATTRS_o_ai
1514 vec_avg(vector signed char __a, vector signed char __b) {
1515   return __builtin_altivec_vavgsb(__a, __b);
1516 }
1517
1518 static __inline__ vector unsigned char __ATTRS_o_ai
1519 vec_avg(vector unsigned char __a, vector unsigned char __b) {
1520   return __builtin_altivec_vavgub(__a, __b);
1521 }
1522
1523 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1524                                                     vector short __b) {
1525   return __builtin_altivec_vavgsh(__a, __b);
1526 }
1527
1528 static __inline__ vector unsigned short __ATTRS_o_ai
1529 vec_avg(vector unsigned short __a, vector unsigned short __b) {
1530   return __builtin_altivec_vavguh(__a, __b);
1531 }
1532
1533 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1534                                                   vector int __b) {
1535   return __builtin_altivec_vavgsw(__a, __b);
1536 }
1537
1538 static __inline__ vector unsigned int __ATTRS_o_ai
1539 vec_avg(vector unsigned int __a, vector unsigned int __b) {
1540   return __builtin_altivec_vavguw(__a, __b);
1541 }
1542
1543 /* vec_vavgsb */
1544
1545 static __inline__ vector signed char __attribute__((__always_inline__))
1546 vec_vavgsb(vector signed char __a, vector signed char __b) {
1547   return __builtin_altivec_vavgsb(__a, __b);
1548 }
1549
1550 /* vec_vavgub */
1551
1552 static __inline__ vector unsigned char __attribute__((__always_inline__))
1553 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1554   return __builtin_altivec_vavgub(__a, __b);
1555 }
1556
1557 /* vec_vavgsh */
1558
1559 static __inline__ vector short __attribute__((__always_inline__))
1560 vec_vavgsh(vector short __a, vector short __b) {
1561   return __builtin_altivec_vavgsh(__a, __b);
1562 }
1563
1564 /* vec_vavguh */
1565
1566 static __inline__ vector unsigned short __attribute__((__always_inline__))
1567 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1568   return __builtin_altivec_vavguh(__a, __b);
1569 }
1570
1571 /* vec_vavgsw */
1572
1573 static __inline__ vector int __attribute__((__always_inline__))
1574 vec_vavgsw(vector int __a, vector int __b) {
1575   return __builtin_altivec_vavgsw(__a, __b);
1576 }
1577
1578 /* vec_vavguw */
1579
1580 static __inline__ vector unsigned int __attribute__((__always_inline__))
1581 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1582   return __builtin_altivec_vavguw(__a, __b);
1583 }
1584
1585 /* vec_ceil */
1586
1587 static __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__
1596 static __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
1603 static __inline__ vector float __attribute__((__always_inline__))
1604 vec_vrfip(vector float __a) {
1605   return __builtin_altivec_vrfip(__a);
1606 }
1607
1608 /* vec_cmpb */
1609
1610 static __inline__ vector int __attribute__((__always_inline__))
1611 vec_cmpb(vector float __a, vector float __b) {
1612   return __builtin_altivec_vcmpbfp(__a, __b);
1613 }
1614
1615 /* vec_vcmpbfp */
1616
1617 static __inline__ vector int __attribute__((__always_inline__))
1618 vec_vcmpbfp(vector float __a, vector float __b) {
1619   return __builtin_altivec_vcmpbfp(__a, __b);
1620 }
1621
1622 /* vec_cmpeq */
1623
1624 static __inline__ vector bool char __ATTRS_o_ai
1625 vec_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
1630 static __inline__ vector bool char __ATTRS_o_ai
1631 vec_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
1636 static __inline__ vector bool char __ATTRS_o_ai
1637 vec_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
1642 static __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
1647 static __inline__ vector bool short __ATTRS_o_ai
1648 vec_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
1653 static __inline__ vector bool short __ATTRS_o_ai
1654 vec_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
1659 static __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
1664 static __inline__ vector bool int __ATTRS_o_ai
1665 vec_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
1670 static __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__
1677 static __inline__ vector bool long long __ATTRS_o_ai
1678 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1679   return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1680 }
1681
1682 static __inline__ vector bool long long __ATTRS_o_ai
1683 vec_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
1688 static __inline__ vector bool long long __ATTRS_o_ai
1689 vec_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
1696 static __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__
1706 static __inline__ vector bool long long __ATTRS_o_ai
1707 vec_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
1715 static __inline__ vector bool char __ATTRS_o_ai
1716 vec_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
1721 static __inline__ vector bool char __ATTRS_o_ai
1722 vec_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
1727 static __inline__ vector bool char __ATTRS_o_ai
1728 vec_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
1733 static __inline__ vector bool short __ATTRS_o_ai
1734 vec_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
1739 static __inline__ vector bool short __ATTRS_o_ai
1740 vec_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
1745 static __inline__ vector bool short __ATTRS_o_ai
1746 vec_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
1751 static __inline__ vector bool int __ATTRS_o_ai
1752 vec_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
1757 static __inline__ vector bool int __ATTRS_o_ai
1758 vec_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
1763 static __inline__ vector bool int __ATTRS_o_ai
1764 vec_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
1769 static __inline__ vector bool long long __ATTRS_o_ai
1770 vec_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
1775 static __inline__ vector bool long long __ATTRS_o_ai
1776 vec_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
1781 static __inline__ vector bool long long __ATTRS_o_ai
1782 vec_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
1787 static __inline__ vector bool int __ATTRS_o_ai
1788 vec_cmpne(vector float __a, vector float __b) {
1789   return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1790                                                     (vector int)__b);
1791 }
1792
1793 static __inline__ vector bool long long __ATTRS_o_ai
1794 vec_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
1801 static __inline__ vector bool char __ATTRS_o_ai
1802 vec_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
1807 static __inline__ vector bool char __ATTRS_o_ai
1808 vec_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
1813 static __inline__ vector bool short __ATTRS_o_ai
1814 vec_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
1819 static __inline__ vector bool short __ATTRS_o_ai
1820 vec_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
1825 static __inline__ vector bool int __ATTRS_o_ai
1826 vec_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
1831 static __inline__ vector bool int __ATTRS_o_ai
1832 vec_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
1837 static __inline__ signed int __ATTRS_o_ai
1838 vec_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
1846 static __inline__ signed int __ATTRS_o_ai
1847 vec_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
1855 static __inline__ signed int __ATTRS_o_ai
1856 vec_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
1864 static __inline__ signed int __ATTRS_o_ai
1865 vec_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
1873 static __inline__ vector unsigned int __ATTRS_o_ai
1874 vec_parity_lsbb(vector unsigned int __a) {
1875   return __builtin_altivec_vprtybw(__a);
1876 }
1877
1878 static __inline__ vector unsigned int __ATTRS_o_ai
1879 vec_parity_lsbb(vector signed int __a) {
1880   return __builtin_altivec_vprtybw(__a);
1881 }
1882
1883 static __inline__ vector unsigned __int128 __ATTRS_o_ai
1884 vec_parity_lsbb(vector unsigned __int128 __a) {
1885   return __builtin_altivec_vprtybq(__a);
1886 }
1887
1888 static __inline__ vector unsigned __int128 __ATTRS_o_ai
1889 vec_parity_lsbb(vector signed __int128 __a) {
1890   return __builtin_altivec_vprtybq(__a);
1891 }
1892
1893 static __inline__ vector unsigned long long __ATTRS_o_ai
1894 vec_parity_lsbb(vector unsigned long long __a) {
1895   return __builtin_altivec_vprtybd(__a);
1896 }
1897
1898 static __inline__ vector unsigned long long __ATTRS_o_ai
1899 vec_parity_lsbb(vector signed long long __a) {
1900   return __builtin_altivec_vprtybd(__a);
1901 }
1902
1903 #endif
1904
1905 /* vec_cmpgt */
1906
1907 static __inline__ vector bool char __ATTRS_o_ai
1908 vec_cmpgt(vector signed char __a, vector signed char __b) {
1909   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1910 }
1911
1912 static __inline__ vector bool char __ATTRS_o_ai
1913 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1914   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1915 }
1916
1917 static __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
1922 static __inline__ vector bool short __ATTRS_o_ai
1923 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1924   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1925 }
1926
1927 static __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
1932 static __inline__ vector bool int __ATTRS_o_ai
1933 vec_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__
1938 static __inline__ vector bool long long __ATTRS_o_ai
1939 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1940   return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1941 }
1942
1943 static __inline__ vector bool long long __ATTRS_o_ai
1944 vec_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
1949 static __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__
1959 static __inline__ vector bool long long __ATTRS_o_ai
1960 vec_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
1967 static __inline__ vector bool char __ATTRS_o_ai
1968 vec_cmpge(vector signed char __a, vector signed char __b) {
1969   return ~(vec_cmpgt(__b, __a));
1970 }
1971
1972 static __inline__ vector bool char __ATTRS_o_ai
1973 vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1974   return ~(vec_cmpgt(__b, __a));
1975 }
1976
1977 static __inline__ vector bool short __ATTRS_o_ai
1978 vec_cmpge(vector signed short __a, vector signed short __b) {
1979   return ~(vec_cmpgt(__b, __a));
1980 }
1981
1982 static __inline__ vector bool short __ATTRS_o_ai
1983 vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1984   return ~(vec_cmpgt(__b, __a));
1985 }
1986
1987 static __inline__ vector bool int __ATTRS_o_ai
1988 vec_cmpge(vector signed int __a, vector signed int __b) {
1989   return ~(vec_cmpgt(__b, __a));
1990 }
1991
1992 static __inline__ vector bool int __ATTRS_o_ai
1993 vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1994   return ~(vec_cmpgt(__b, __a));
1995 }
1996
1997 static __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__
2007 static __inline__ vector bool long long __ATTRS_o_ai
2008 vec_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__
2014 static __inline__ vector bool long long __ATTRS_o_ai
2015 vec_cmpge(vector signed long long __a, vector signed long long __b) {
2016   return ~(vec_cmpgt(__b, __a));
2017 }
2018
2019 static __inline__ vector bool long long __ATTRS_o_ai
2020 vec_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
2027 static __inline__ vector bool int __attribute__((__always_inline__))
2028 vec_vcmpgefp(vector float __a, vector float __b) {
2029   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2030 }
2031
2032 /* vec_vcmpgtsb */
2033
2034 static __inline__ vector bool char __attribute__((__always_inline__))
2035 vec_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
2041 static __inline__ vector bool char __attribute__((__always_inline__))
2042 vec_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
2048 static __inline__ vector bool short __attribute__((__always_inline__))
2049 vec_vcmpgtsh(vector short __a, vector short __b) {
2050   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2051 }
2052
2053 /* vec_vcmpgtuh */
2054
2055 static __inline__ vector bool short __attribute__((__always_inline__))
2056 vec_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
2062 static __inline__ vector bool int __attribute__((__always_inline__))
2063 vec_vcmpgtsw(vector int __a, vector int __b) {
2064   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2065 }
2066
2067 /* vec_vcmpgtuw */
2068
2069 static __inline__ vector bool int __attribute__((__always_inline__))
2070 vec_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
2076 static __inline__ vector bool int __attribute__((__always_inline__))
2077 vec_vcmpgtfp(vector float __a, vector float __b) {
2078   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2079 }
2080
2081 /* vec_cmple */
2082
2083 static __inline__ vector bool char __ATTRS_o_ai
2084 vec_cmple(vector signed char __a, vector signed char __b) {
2085   return vec_cmpge(__b, __a);
2086 }
2087
2088 static __inline__ vector bool char __ATTRS_o_ai
2089 vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2090   return vec_cmpge(__b, __a);
2091 }
2092
2093 static __inline__ vector bool short __ATTRS_o_ai
2094 vec_cmple(vector signed short __a, vector signed short __b) {
2095   return vec_cmpge(__b, __a);
2096 }
2097
2098 static __inline__ vector bool short __ATTRS_o_ai
2099 vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2100   return vec_cmpge(__b, __a);
2101 }
2102
2103 static __inline__ vector bool int __ATTRS_o_ai
2104 vec_cmple(vector signed int __a, vector signed int __b) {
2105   return vec_cmpge(__b, __a);
2106 }
2107
2108 static __inline__ vector bool int __ATTRS_o_ai
2109 vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2110   return vec_cmpge(__b, __a);
2111 }
2112
2113 static __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__
2119 static __inline__ vector bool long long __ATTRS_o_ai
2120 vec_cmple(vector double __a, vector double __b) {
2121   return vec_cmpge(__b, __a);
2122 }
2123 #endif
2124
2125 #ifdef __POWER8_VECTOR__
2126 static __inline__ vector bool long long __ATTRS_o_ai
2127 vec_cmple(vector signed long long __a, vector signed long long __b) {
2128   return vec_cmpge(__b, __a);
2129 }
2130
2131 static __inline__ vector bool long long __ATTRS_o_ai
2132 vec_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
2139 static __inline__ vector bool char __ATTRS_o_ai
2140 vec_cmplt(vector signed char __a, vector signed char __b) {
2141   return vec_cmpgt(__b, __a);
2142 }
2143
2144 static __inline__ vector bool char __ATTRS_o_ai
2145 vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2146   return vec_cmpgt(__b, __a);
2147 }
2148
2149 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2150                                                            vector short __b) {
2151   return vec_cmpgt(__b, __a);
2152 }
2153
2154 static __inline__ vector bool short __ATTRS_o_ai
2155 vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2156   return vec_cmpgt(__b, __a);
2157 }
2158
2159 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2160                                                          vector int __b) {
2161   return vec_cmpgt(__b, __a);
2162 }
2163
2164 static __inline__ vector bool int __ATTRS_o_ai
2165 vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2166   return vec_cmpgt(__b, __a);
2167 }
2168
2169 static __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__
2175 static __inline__ vector bool long long __ATTRS_o_ai
2176 vec_cmplt(vector double __a, vector double __b) {
2177   return vec_cmpgt(__b, __a);
2178 }
2179 #endif
2180
2181 #ifdef __POWER8_VECTOR__
2182 static __inline__ vector bool long long __ATTRS_o_ai
2183 vec_cmplt(vector signed long long __a, vector signed long long __b) {
2184   return vec_cmpgt(__b, __a);
2185 }
2186
2187 static __inline__ vector bool long long __ATTRS_o_ai
2188 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2189   return vec_cmpgt(__b, __a);
2190 }
2191
2192 /* vec_popcnt */
2193
2194 static __inline__ vector signed char __ATTRS_o_ai
2195 vec_popcnt(vector signed char __a) {
2196   return __builtin_altivec_vpopcntb(__a);
2197 }
2198 static __inline__ vector unsigned char __ATTRS_o_ai
2199 vec_popcnt(vector unsigned char __a) {
2200   return __builtin_altivec_vpopcntb(__a);
2201 }
2202 static __inline__ vector signed short __ATTRS_o_ai
2203 vec_popcnt(vector signed short __a) {
2204   return __builtin_altivec_vpopcnth(__a);
2205 }
2206 static __inline__ vector unsigned short __ATTRS_o_ai
2207 vec_popcnt(vector unsigned short __a) {
2208   return __builtin_altivec_vpopcnth(__a);
2209 }
2210 static __inline__ vector signed int __ATTRS_o_ai
2211 vec_popcnt(vector signed int __a) {
2212   return __builtin_altivec_vpopcntw(__a);
2213 }
2214 static __inline__ vector unsigned int __ATTRS_o_ai
2215 vec_popcnt(vector unsigned int __a) {
2216   return __builtin_altivec_vpopcntw(__a);
2217 }
2218 static __inline__ vector signed long long __ATTRS_o_ai
2219 vec_popcnt(vector signed long long __a) {
2220   return __builtin_altivec_vpopcntd(__a);
2221 }
2222 static __inline__ vector unsigned long long __ATTRS_o_ai
2223 vec_popcnt(vector unsigned long long __a) {
2224   return __builtin_altivec_vpopcntd(__a);
2225 }
2226
2227 /* vec_cntlz */
2228
2229 static __inline__ vector signed char __ATTRS_o_ai
2230 vec_cntlz(vector signed char __a) {
2231   return __builtin_altivec_vclzb(__a);
2232 }
2233 static __inline__ vector unsigned char __ATTRS_o_ai
2234 vec_cntlz(vector unsigned char __a) {
2235   return __builtin_altivec_vclzb(__a);
2236 }
2237 static __inline__ vector signed short __ATTRS_o_ai
2238 vec_cntlz(vector signed short __a) {
2239   return __builtin_altivec_vclzh(__a);
2240 }
2241 static __inline__ vector unsigned short __ATTRS_o_ai
2242 vec_cntlz(vector unsigned short __a) {
2243   return __builtin_altivec_vclzh(__a);
2244 }
2245 static __inline__ vector signed int __ATTRS_o_ai
2246 vec_cntlz(vector signed int __a) {
2247   return __builtin_altivec_vclzw(__a);
2248 }
2249 static __inline__ vector unsigned int __ATTRS_o_ai
2250 vec_cntlz(vector unsigned int __a) {
2251   return __builtin_altivec_vclzw(__a);
2252 }
2253 static __inline__ vector signed long long __ATTRS_o_ai
2254 vec_cntlz(vector signed long long __a) {
2255   return __builtin_altivec_vclzd(__a);
2256 }
2257 static __inline__ vector unsigned long long __ATTRS_o_ai
2258 vec_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
2267 static __inline__ vector signed char __ATTRS_o_ai
2268 vec_cnttz(vector signed char __a) {
2269   return __builtin_altivec_vctzb(__a);
2270 }
2271 static __inline__ vector unsigned char __ATTRS_o_ai
2272 vec_cnttz(vector unsigned char __a) {
2273   return __builtin_altivec_vctzb(__a);
2274 }
2275 static __inline__ vector signed short __ATTRS_o_ai
2276 vec_cnttz(vector signed short __a) {
2277   return __builtin_altivec_vctzh(__a);
2278 }
2279 static __inline__ vector unsigned short __ATTRS_o_ai
2280 vec_cnttz(vector unsigned short __a) {
2281   return __builtin_altivec_vctzh(__a);
2282 }
2283 static __inline__ vector signed int __ATTRS_o_ai
2284 vec_cnttz(vector signed int __a) {
2285   return __builtin_altivec_vctzw(__a);
2286 }
2287 static __inline__ vector unsigned int __ATTRS_o_ai
2288 vec_cnttz(vector unsigned int __a) {
2289   return __builtin_altivec_vctzw(__a);
2290 }
2291 static __inline__ vector signed long long __ATTRS_o_ai
2292 vec_cnttz(vector signed long long __a) {
2293   return __builtin_altivec_vctzd(__a);
2294 }
2295 static __inline__ vector unsigned long long __ATTRS_o_ai
2296 vec_cnttz(vector unsigned long long __a) {
2297   return __builtin_altivec_vctzd(__a);
2298 }
2299
2300 /* vec_first_match_index */
2301
2302 static __inline__ unsigned __ATTRS_o_ai
2303 vec_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
2316 static __inline__ unsigned __ATTRS_o_ai
2317 vec_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
2330 static __inline__ unsigned __ATTRS_o_ai
2331 vec_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
2344 static __inline__ unsigned __ATTRS_o_ai
2345 vec_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
2358 static __inline__ unsigned __ATTRS_o_ai
2359 vec_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
2372 static __inline__ unsigned __ATTRS_o_ai
2373 vec_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
2388 static __inline__ unsigned __ATTRS_o_ai
2389 vec_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
2411 static __inline__ unsigned __ATTRS_o_ai
2412 vec_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
2431 static __inline__ unsigned __ATTRS_o_ai
2432 vec_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
2450 static __inline__ unsigned __ATTRS_o_ai
2451 vec_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
2470 static __inline__ unsigned __ATTRS_o_ai
2471 vec_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
2488 static __inline__ unsigned __ATTRS_o_ai
2489 vec_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
2509 static __inline__ unsigned __ATTRS_o_ai
2510 vec_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
2523 static __inline__ unsigned __ATTRS_o_ai
2524 vec_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
2537 static __inline__ unsigned __ATTRS_o_ai
2538 vec_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
2551 static __inline__ unsigned __ATTRS_o_ai
2552 vec_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
2565 static __inline__ unsigned __ATTRS_o_ai
2566 vec_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
2579 static __inline__ unsigned __ATTRS_o_ai
2580 vec_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
2595 static __inline__ unsigned __ATTRS_o_ai
2596 vec_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
2610 static __inline__ unsigned __ATTRS_o_ai
2611 vec_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
2625 static __inline__ unsigned __ATTRS_o_ai
2626 vec_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
2640 static __inline__ unsigned __ATTRS_o_ai
2641 vec_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
2655 static __inline__ unsigned __ATTRS_o_ai
2656 vec_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
2669 static __inline__ unsigned __ATTRS_o_ai
2670 vec_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
2684 static __inline__ vector double  __ATTRS_o_ai
2685 vec_insert_exp(vector double __a, vector unsigned long long __b) {
2686   return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2687 }
2688
2689 static __inline__ vector double  __ATTRS_o_ai
2690 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2691   return __builtin_vsx_xviexpdp(__a,__b);
2692 }
2693
2694 static __inline__ vector float  __ATTRS_o_ai
2695 vec_insert_exp(vector float __a, vector unsigned int __b) {
2696   return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2697 }
2698
2699 static __inline__ vector float  __ATTRS_o_ai
2700 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2701   return __builtin_vsx_xviexpsp(__a,__b);
2702 }
2703
2704 #if defined(__powerpc64__)
2705 static __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
2710 static __inline__ vector unsigned char __ATTRS_o_ai
2711 vec_xl_len(unsigned char *__a, size_t __b) {
2712   return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
2713 }
2714
2715 static __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
2720 static __inline__ vector unsigned short __ATTRS_o_ai
2721 vec_xl_len(unsigned short *__a, size_t __b) {
2722   return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
2723 }
2724
2725 static __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
2730 static __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
2735 static __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
2739 static __inline__ vector signed __int128 __ATTRS_o_ai
2740 vec_xl_len(signed __int128 *__a, size_t __b) {
2741   return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2742 }
2743
2744 static __inline__ vector unsigned __int128 __ATTRS_o_ai
2745 vec_xl_len(unsigned __int128 *__a, size_t __b) {
2746   return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2747 }
2748
2749 static __inline__ vector signed long long __ATTRS_o_ai
2750 vec_xl_len(signed long long *__a, size_t __b) {
2751   return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
2752 }
2753
2754 static __inline__ vector unsigned long long __ATTRS_o_ai
2755 vec_xl_len(unsigned long long *__a, size_t __b) {
2756   return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
2757 }
2758
2759 static __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
2764 static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
2765                                                           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
2778 static __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
2784 static __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
2789 static __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
2794 static __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
2800 static __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
2805 static __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
2810 static __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
2815 static __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
2821 static __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
2827 static __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
2833 static __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
2839 static __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
2844 static __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__
2863 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2864                                                       vector float __b) {
2865   return __builtin_vsx_xvcpsgnsp(__a, __b);
2866 }
2867
2868 static __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((__a), (__b)),              \
2880              vector unsigned int                                               \
2881            : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)),  \
2882              vector unsigned long long                                         \
2883            : (__builtin_convertvector((vector unsigned long long)(__a),        \
2884                                       vector double) *                         \
2885               (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2886                                                          << 52)),              \
2887              vector signed long long                                           \
2888            : (__builtin_convertvector((vector signed long long)(__a),          \
2889                                       vector double) *                         \
2890               (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2891                                                          << 52)))
2892 #else
2893 #define vec_ctf(__a, __b)                                                      \
2894   _Generic((__a), vector int                                                   \
2895            : (vector float)__builtin_altivec_vcfsx((__a), (__b)),              \
2896              vector unsigned int                                               \
2897            : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)))
2898 #endif
2899
2900 /* vec_vcfsx */
2901
2902 #define vec_vcfux __builtin_altivec_vcfux
2903
2904 /* vec_vcfux */
2905
2906 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
2907
2908 /* vec_cts */
2909
2910 #ifdef __VSX__
2911 #define vec_cts(__a, __b)                                                      \
2912   _Generic((__a), vector float                                                 \
2913            : __builtin_altivec_vctsxs((__a), (__b)), vector double             \
2914            : __extension__({                                                   \
2915              vector double __ret =                                             \
2916                  (__a) *                                                       \
2917                  (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
2918                                                             << 52);            \
2919              __builtin_convertvector(__ret, vector signed long long);          \
2920            }))
2921 #else
2922 #define vec_cts __builtin_altivec_vctsxs
2923 #endif
2924
2925 /* vec_vctsxs */
2926
2927 #define vec_vctsxs __builtin_altivec_vctsxs
2928
2929 /* vec_ctu */
2930
2931 #ifdef __VSX__
2932 #define vec_ctu(__a, __b)                                                      \
2933   _Generic((__a), vector float                                                 \
2934            : __builtin_altivec_vctuxs((__a), (__b)), vector double             \
2935            : __extension__({                                                   \
2936              vector double __ret =                                             \
2937                  (__a) *                                                       \
2938                  (vector double)(vector unsigned long long)((0x3ffULL + __b)   \
2939                                                             << 52);            \
2940              __builtin_convertvector(__ret, vector unsigned long long);        \
2941            }))
2942 #else
2943 #define vec_ctu __builtin_altivec_vctuxs
2944 #endif
2945
2946 /* vec_vctuxs */
2947
2948 #define vec_vctuxs __builtin_altivec_vctuxs
2949
2950 /* vec_signed */
2951
2952 static __inline__ vector signed int __ATTRS_o_ai
2953 vec_sld(vector signed int, vector signed int, unsigned const int __c);
2954
2955 static __inline__ vector signed int __ATTRS_o_ai
2956 vec_signed(vector float __a) {
2957   return __builtin_convertvector(__a, vector signed int);
2958 }
2959
2960 #ifdef __VSX__
2961 static __inline__ vector signed long long __ATTRS_o_ai
2962 vec_signed(vector double __a) {
2963   return __builtin_convertvector(__a, vector signed long long);
2964 }
2965
2966 static __inline__ vector signed int __attribute__((__always_inline__))
2967 vec_signed2(vector double __a, vector double __b) {
2968   return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
2969 }
2970
2971 static __inline__ vector signed int __ATTRS_o_ai
2972 vec_signede(vector double __a) {
2973 #ifdef __LITTLE_ENDIAN__
2974   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2975   return vec_sld(__ret, __ret, 12);
2976 #else
2977   return __builtin_vsx_xvcvdpsxws(__a);
2978 #endif
2979 }
2980
2981 static __inline__ vector signed int __ATTRS_o_ai
2982 vec_signedo(vector double __a) {
2983 #ifdef __LITTLE_ENDIAN__
2984   return __builtin_vsx_xvcvdpsxws(__a);
2985 #else
2986   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2987   return vec_sld(__ret, __ret, 12);
2988 #endif
2989 }
2990 #endif
2991
2992 /* vec_unsigned */
2993
2994 static __inline__ vector unsigned int __ATTRS_o_ai
2995 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
2996
2997 static __inline__ vector unsigned int __ATTRS_o_ai
2998 vec_unsigned(vector float __a) {
2999   return __builtin_convertvector(__a, vector unsigned int);
3000 }
3001
3002 #ifdef __VSX__
3003 static __inline__ vector unsigned long long __ATTRS_o_ai
3004 vec_unsigned(vector double __a) {
3005   return __builtin_convertvector(__a, vector unsigned long long);
3006 }
3007
3008 static __inline__ vector unsigned int __attribute__((__always_inline__))
3009 vec_unsigned2(vector double __a, vector double __b) {
3010   return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3011 }
3012
3013 static __inline__ vector unsigned int __ATTRS_o_ai
3014 vec_unsignede(vector double __a) {
3015 #ifdef __LITTLE_ENDIAN__
3016   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3017   return vec_sld(__ret, __ret, 12);
3018 #else
3019   return __builtin_vsx_xvcvdpuxws(__a);
3020 #endif
3021 }
3022
3023 static __inline__ vector unsigned int __ATTRS_o_ai
3024 vec_unsignedo(vector double __a) {
3025 #ifdef __LITTLE_ENDIAN__
3026   return __builtin_vsx_xvcvdpuxws(__a);
3027 #else
3028   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3029   return vec_sld(__ret, __ret, 12);
3030 #endif
3031 }
3032 #endif
3033
3034 /* vec_float */
3035
3036 static __inline__ vector float __ATTRS_o_ai
3037 vec_sld(vector float, vector float, unsigned const int __c);
3038
3039 static __inline__ vector float __ATTRS_o_ai
3040 vec_float(vector signed int __a) {
3041   return __builtin_convertvector(__a, vector float);
3042 }
3043
3044 static __inline__ vector float __ATTRS_o_ai
3045 vec_float(vector unsigned int __a) {
3046   return __builtin_convertvector(__a, vector float);
3047 }
3048
3049 #ifdef __VSX__
3050 static __inline__ vector float __ATTRS_o_ai
3051 vec_float2(vector signed long long __a, vector signed long long __b) {
3052   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3053 }
3054
3055 static __inline__ vector float __ATTRS_o_ai
3056 vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3057   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3058 }
3059
3060 static __inline__ vector float __ATTRS_o_ai
3061 vec_float2(vector double __a, vector double __b) {
3062   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3063 }
3064
3065 static __inline__ vector float __ATTRS_o_ai
3066 vec_floate(vector signed long long __a) {
3067 #ifdef __LITTLE_ENDIAN__
3068   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3069   return vec_sld(__ret, __ret, 12);
3070 #else
3071   return __builtin_vsx_xvcvsxdsp(__a);
3072 #endif
3073 }
3074
3075 static __inline__ vector float __ATTRS_o_ai
3076 vec_floate(vector unsigned long long __a) {
3077 #ifdef __LITTLE_ENDIAN__
3078   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3079   return vec_sld(__ret, __ret, 12);
3080 #else
3081   return __builtin_vsx_xvcvuxdsp(__a);
3082 #endif
3083 }
3084
3085 static __inline__ vector float __ATTRS_o_ai
3086 vec_floate(vector double __a) {
3087 #ifdef __LITTLE_ENDIAN__
3088   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3089   return vec_sld(__ret, __ret, 12);
3090 #else
3091   return __builtin_vsx_xvcvdpsp(__a);
3092 #endif
3093 }
3094
3095 static __inline__ vector float __ATTRS_o_ai
3096 vec_floato(vector signed long long __a) {
3097 #ifdef __LITTLE_ENDIAN__
3098   return __builtin_vsx_xvcvsxdsp(__a);
3099 #else
3100   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3101   return vec_sld(__ret, __ret, 12);
3102 #endif
3103 }
3104
3105 static __inline__ vector float __ATTRS_o_ai
3106 vec_floato(vector unsigned long long __a) {
3107 #ifdef __LITTLE_ENDIAN__
3108   return __builtin_vsx_xvcvuxdsp(__a);
3109 #else
3110   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3111   return vec_sld(__ret, __ret, 12);
3112 #endif
3113 }
3114
3115 static __inline__ vector float __ATTRS_o_ai
3116 vec_floato(vector double __a) {
3117 #ifdef __LITTLE_ENDIAN__
3118   return __builtin_vsx_xvcvdpsp(__a);
3119 #else
3120   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3121   return vec_sld(__ret, __ret, 12);
3122 #endif
3123 }
3124 #endif
3125
3126 /* vec_double */
3127
3128 #ifdef __VSX__
3129 static __inline__ vector double __ATTRS_o_ai
3130 vec_double(vector signed long long __a) {
3131   return __builtin_convertvector(__a, vector double);
3132 }
3133
3134 static __inline__ vector double __ATTRS_o_ai
3135 vec_double(vector unsigned long long __a) {
3136   return __builtin_convertvector(__a, vector double);
3137 }
3138
3139 static __inline__ vector double __ATTRS_o_ai
3140 vec_doublee(vector signed int __a) {
3141 #ifdef __LITTLE_ENDIAN__
3142   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3143 #else
3144   return __builtin_vsx_xvcvsxwdp(__a);
3145 #endif
3146 }
3147
3148 static __inline__ vector double __ATTRS_o_ai
3149 vec_doublee(vector unsigned int __a) {
3150 #ifdef __LITTLE_ENDIAN__
3151   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3152 #else
3153   return __builtin_vsx_xvcvuxwdp(__a);
3154 #endif
3155 }
3156
3157 static __inline__ vector double __ATTRS_o_ai
3158 vec_doublee(vector float __a) {
3159 #ifdef __LITTLE_ENDIAN__
3160   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3161 #else
3162   return __builtin_vsx_xvcvspdp(__a);
3163 #endif
3164 }
3165
3166 static __inline__ vector double __ATTRS_o_ai
3167 vec_doubleh(vector signed int __a) {
3168   vector double __ret = {__a[0], __a[1]};
3169   return __ret;
3170 }
3171
3172 static __inline__ vector double __ATTRS_o_ai
3173 vec_doubleh(vector unsigned int __a) {
3174   vector double __ret = {__a[0], __a[1]};
3175   return __ret;
3176 }
3177
3178 static __inline__ vector double __ATTRS_o_ai
3179 vec_doubleh(vector float __a) {
3180   vector double __ret = {__a[0], __a[1]};
3181   return __ret;
3182 }
3183
3184 static __inline__ vector double __ATTRS_o_ai
3185 vec_doublel(vector signed int __a) {
3186   vector double __ret = {__a[2], __a[3]};
3187   return __ret;
3188 }
3189
3190 static __inline__ vector double __ATTRS_o_ai
3191 vec_doublel(vector unsigned int __a) {
3192   vector double __ret = {__a[2], __a[3]};
3193   return __ret;
3194 }
3195
3196 static __inline__ vector double __ATTRS_o_ai
3197 vec_doublel(vector float __a) {
3198   vector double __ret = {__a[2], __a[3]};
3199   return __ret;
3200 }
3201
3202 static __inline__ vector double __ATTRS_o_ai
3203 vec_doubleo(vector signed int __a) {
3204 #ifdef __LITTLE_ENDIAN__
3205   return __builtin_vsx_xvcvsxwdp(__a);
3206 #else
3207   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3208 #endif
3209 }
3210
3211 static __inline__ vector double __ATTRS_o_ai
3212 vec_doubleo(vector unsigned int __a) {
3213 #ifdef __LITTLE_ENDIAN__
3214   return __builtin_vsx_xvcvuxwdp(__a);
3215 #else
3216   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3217 #endif
3218 }
3219
3220 static __inline__ vector double __ATTRS_o_ai
3221 vec_doubleo(vector float __a) {
3222 #ifdef __LITTLE_ENDIAN__
3223   return __builtin_vsx_xvcvspdp(__a);
3224 #else
3225   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3226 #endif
3227 }
3228 #endif
3229
3230 /* vec_div */
3231
3232 /* Integer vector divides (vectors are scalarized, elements divided
3233    and the vectors reassembled).
3234 */
3235 static __inline__ vector signed char __ATTRS_o_ai
3236 vec_div(vector signed char __a, vector signed char __b) {
3237   return __a / __b;
3238 }
3239
3240 static __inline__ vector unsigned char __ATTRS_o_ai
3241 vec_div(vector unsigned char __a, vector unsigned char __b) {
3242   return __a / __b;
3243 }
3244
3245 static __inline__ vector signed short __ATTRS_o_ai
3246 vec_div(vector signed short __a, vector signed short __b) {
3247   return __a / __b;
3248 }
3249
3250 static __inline__ vector unsigned short __ATTRS_o_ai
3251 vec_div(vector unsigned short __a, vector unsigned short __b) {
3252   return __a / __b;
3253 }
3254
3255 static __inline__ vector signed int __ATTRS_o_ai
3256 vec_div(vector signed int __a, vector signed int __b) {
3257   return __a / __b;
3258 }
3259
3260 static __inline__ vector unsigned int __ATTRS_o_ai
3261 vec_div(vector unsigned int __a, vector unsigned int __b) {
3262   return __a / __b;
3263 }
3264
3265 #ifdef __VSX__
3266 static __inline__ vector signed long long __ATTRS_o_ai
3267 vec_div(vector signed long long __a, vector signed long long __b) {
3268   return __a / __b;
3269 }
3270
3271 static __inline__ vector unsigned long long __ATTRS_o_ai
3272 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3273   return __a / __b;
3274 }
3275
3276 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3277                                                     vector float __b) {
3278   return __a / __b;
3279 }
3280
3281 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3282                                                      vector double __b) {
3283   return __a / __b;
3284 }
3285 #endif
3286
3287 /* vec_dss */
3288
3289 static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
3290   __builtin_altivec_dss(__a);
3291 }
3292
3293 /* vec_dssall */
3294
3295 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3296   __builtin_altivec_dssall();
3297 }
3298
3299 /* vec_dst */
3300 #define vec_dst(__PTR, __CW, __STR) \
3301   __extension__(                    \
3302       { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
3303
3304 /* vec_dstst */
3305 #define vec_dstst(__PTR, __CW, __STR) \
3306   __extension__(                      \
3307       { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
3308
3309 /* vec_dststt */
3310 #define vec_dststt(__PTR, __CW, __STR) \
3311   __extension__(                       \
3312       { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
3313
3314 /* vec_dstt */
3315 #define vec_dstt(__PTR, __CW, __STR) \
3316   __extension__(                     \
3317       { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
3318
3319 /* vec_eqv */
3320
3321 #ifdef __POWER8_VECTOR__
3322 static __inline__ vector signed char __ATTRS_o_ai
3323 vec_eqv(vector signed char __a, vector signed char __b) {
3324   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3325                                                   (vector unsigned int)__b);
3326 }
3327
3328 static __inline__ vector unsigned char __ATTRS_o_ai
3329 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3330   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3331                                                     (vector unsigned int)__b);
3332 }
3333
3334 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3335                                                         vector bool char __b) {
3336   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3337                                                 (vector unsigned int)__b);
3338 }
3339
3340 static __inline__ vector signed short __ATTRS_o_ai
3341 vec_eqv(vector signed short __a, vector signed short __b) {
3342   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3343                                                    (vector unsigned int)__b);
3344 }
3345
3346 static __inline__ vector unsigned short __ATTRS_o_ai
3347 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3348   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3349                                                      (vector unsigned int)__b);
3350 }
3351
3352 static __inline__ vector bool short __ATTRS_o_ai
3353 vec_eqv(vector bool short __a, vector bool short __b) {
3354   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3355                                                  (vector unsigned int)__b);
3356 }
3357
3358 static __inline__ vector signed int __ATTRS_o_ai
3359 vec_eqv(vector signed int __a, vector signed int __b) {
3360   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3361                                                  (vector unsigned int)__b);
3362 }
3363
3364 static __inline__ vector unsigned int __ATTRS_o_ai
3365 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3366   return __builtin_vsx_xxleqv(__a, __b);
3367 }
3368
3369 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3370                                                        vector bool int __b) {
3371   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3372                                                (vector unsigned int)__b);
3373 }
3374
3375 static __inline__ vector signed long long __ATTRS_o_ai
3376 vec_eqv(vector signed long long __a, vector signed long long __b) {
3377   return (vector signed long long)__builtin_vsx_xxleqv(
3378       (vector unsigned int)__a, (vector unsigned int)__b);
3379 }
3380
3381 static __inline__ vector unsigned long long __ATTRS_o_ai
3382 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3383   return (vector unsigned long long)__builtin_vsx_xxleqv(
3384       (vector unsigned int)__a, (vector unsigned int)__b);
3385 }
3386
3387 static __inline__ vector bool long long __ATTRS_o_ai
3388 vec_eqv(vector bool long long __a, vector bool long long __b) {
3389   return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3390                                                      (vector unsigned int)__b);
3391 }
3392
3393 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3394                                                     vector float __b) {
3395   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3396                                             (vector unsigned int)__b);
3397 }
3398
3399 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3400                                                      vector double __b) {
3401   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3402                                              (vector unsigned int)__b);
3403 }
3404 #endif
3405
3406 /* vec_expte */
3407
3408 static __inline__ vector float __attribute__((__always_inline__))
3409 vec_expte(vector float __a) {
3410   return __builtin_altivec_vexptefp(__a);
3411 }
3412
3413 /* vec_vexptefp */
3414
3415 static __inline__ vector float __attribute__((__always_inline__))
3416 vec_vexptefp(vector float __a) {
3417   return __builtin_altivec_vexptefp(__a);
3418 }
3419
3420 /* vec_floor */
3421
3422 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3423 #ifdef __VSX__
3424   return __builtin_vsx_xvrspim(__a);
3425 #else
3426   return __builtin_altivec_vrfim(__a);
3427 #endif
3428 }
3429
3430 #ifdef __VSX__
3431 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3432   return __builtin_vsx_xvrdpim(__a);
3433 }
3434 #endif
3435
3436 /* vec_vrfim */
3437
3438 static __inline__ vector float __attribute__((__always_inline__))
3439 vec_vrfim(vector float __a) {
3440   return __builtin_altivec_vrfim(__a);
3441 }
3442
3443 /* vec_ld */
3444
3445 static __inline__ vector signed char __ATTRS_o_ai
3446 vec_ld(int __a, const vector signed char *__b) {
3447   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3448 }
3449
3450 static __inline__ vector signed char __ATTRS_o_ai
3451 vec_ld(int __a, const signed char *__b) {
3452   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3453 }
3454
3455 static __inline__ vector unsigned char __ATTRS_o_ai
3456 vec_ld(int __a, const vector unsigned char *__b) {
3457   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3458 }
3459
3460 static __inline__ vector unsigned char __ATTRS_o_ai
3461 vec_ld(int __a, const unsigned char *__b) {
3462   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3463 }
3464
3465 static __inline__ vector bool char __ATTRS_o_ai
3466 vec_ld(int __a, const vector bool char *__b) {
3467   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3468 }
3469
3470 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3471                                                    const vector short *__b) {
3472   return (vector short)__builtin_altivec_lvx(__a, __b);
3473 }
3474
3475 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3476   return (vector short)__builtin_altivec_lvx(__a, __b);
3477 }
3478
3479 static __inline__ vector unsigned short __ATTRS_o_ai
3480 vec_ld(int __a, const vector unsigned short *__b) {
3481   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3482 }
3483
3484 static __inline__ vector unsigned short __ATTRS_o_ai
3485 vec_ld(int __a, const unsigned short *__b) {
3486   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3487 }
3488
3489 static __inline__ vector bool short __ATTRS_o_ai
3490 vec_ld(int __a, const vector bool short *__b) {
3491   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3492 }
3493
3494 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3495                                                    const vector pixel *__b) {
3496   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3497 }
3498
3499 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3500                                                  const vector int *__b) {
3501   return (vector int)__builtin_altivec_lvx(__a, __b);
3502 }
3503
3504 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3505   return (vector int)__builtin_altivec_lvx(__a, __b);
3506 }
3507
3508 static __inline__ vector unsigned int __ATTRS_o_ai
3509 vec_ld(int __a, const vector unsigned int *__b) {
3510   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3511 }
3512
3513 static __inline__ vector unsigned int __ATTRS_o_ai
3514 vec_ld(int __a, const unsigned int *__b) {
3515   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3516 }
3517
3518 static __inline__ vector bool int __ATTRS_o_ai
3519 vec_ld(int __a, const vector bool int *__b) {
3520   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3521 }
3522
3523 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3524                                                    const vector float *__b) {
3525   return (vector float)__builtin_altivec_lvx(__a, __b);
3526 }
3527
3528 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3529   return (vector float)__builtin_altivec_lvx(__a, __b);
3530 }
3531
3532 /* vec_lvx */
3533
3534 static __inline__ vector signed char __ATTRS_o_ai
3535 vec_lvx(int __a, const vector signed char *__b) {
3536   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3537 }
3538
3539 static __inline__ vector signed char __ATTRS_o_ai
3540 vec_lvx(int __a, const signed char *__b) {
3541   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3542 }
3543
3544 static __inline__ vector unsigned char __ATTRS_o_ai
3545 vec_lvx(int __a, const vector unsigned char *__b) {
3546   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3547 }
3548
3549 static __inline__ vector unsigned char __ATTRS_o_ai
3550 vec_lvx(int __a, const unsigned char *__b) {
3551   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3552 }
3553
3554 static __inline__ vector bool char __ATTRS_o_ai
3555 vec_lvx(int __a, const vector bool char *__b) {
3556   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3557 }
3558
3559 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3560                                                     const vector short *__b) {
3561   return (vector short)__builtin_altivec_lvx(__a, __b);
3562 }
3563
3564 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3565   return (vector short)__builtin_altivec_lvx(__a, __b);
3566 }
3567
3568 static __inline__ vector unsigned short __ATTRS_o_ai
3569 vec_lvx(int __a, const vector unsigned short *__b) {
3570   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3571 }
3572
3573 static __inline__ vector unsigned short __ATTRS_o_ai
3574 vec_lvx(int __a, const unsigned short *__b) {
3575   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3576 }
3577
3578 static __inline__ vector bool short __ATTRS_o_ai
3579 vec_lvx(int __a, const vector bool short *__b) {
3580   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3581 }
3582
3583 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3584                                                     const vector pixel *__b) {
3585   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3586 }
3587
3588 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3589                                                   const vector int *__b) {
3590   return (vector int)__builtin_altivec_lvx(__a, __b);
3591 }
3592
3593 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3594   return (vector int)__builtin_altivec_lvx(__a, __b);
3595 }
3596
3597 static __inline__ vector unsigned int __ATTRS_o_ai
3598 vec_lvx(int __a, const vector unsigned int *__b) {
3599   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3600 }
3601
3602 static __inline__ vector unsigned int __ATTRS_o_ai
3603 vec_lvx(int __a, const unsigned int *__b) {
3604   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3605 }
3606
3607 static __inline__ vector bool int __ATTRS_o_ai
3608 vec_lvx(int __a, const vector bool int *__b) {
3609   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3610 }
3611
3612 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3613                                                     const vector float *__b) {
3614   return (vector float)__builtin_altivec_lvx(__a, __b);
3615 }
3616
3617 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3618   return (vector float)__builtin_altivec_lvx(__a, __b);
3619 }
3620
3621 /* vec_lde */
3622
3623 static __inline__ vector signed char __ATTRS_o_ai
3624 vec_lde(int __a, const signed char *__b) {
3625   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3626 }
3627
3628 static __inline__ vector unsigned char __ATTRS_o_ai
3629 vec_lde(int __a, const unsigned char *__b) {
3630   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3631 }
3632
3633 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3634   return (vector short)__builtin_altivec_lvehx(__a, __b);
3635 }
3636
3637 static __inline__ vector unsigned short __ATTRS_o_ai
3638 vec_lde(int __a, const unsigned short *__b) {
3639   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3640 }
3641
3642 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3643   return (vector int)__builtin_altivec_lvewx(__a, __b);
3644 }
3645
3646 static __inline__ vector unsigned int __ATTRS_o_ai
3647 vec_lde(int __a, const unsigned int *__b) {
3648   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3649 }
3650
3651 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3652   return (vector float)__builtin_altivec_lvewx(__a, __b);
3653 }
3654
3655 /* vec_lvebx */
3656
3657 static __inline__ vector signed char __ATTRS_o_ai
3658 vec_lvebx(int __a, const signed char *__b) {
3659   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3660 }
3661
3662 static __inline__ vector unsigned char __ATTRS_o_ai
3663 vec_lvebx(int __a, const unsigned char *__b) {
3664   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3665 }
3666
3667 /* vec_lvehx */
3668
3669 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3670                                                       const short *__b) {
3671   return (vector short)__builtin_altivec_lvehx(__a, __b);
3672 }
3673
3674 static __inline__ vector unsigned short __ATTRS_o_ai
3675 vec_lvehx(int __a, const unsigned short *__b) {
3676   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3677 }
3678
3679 /* vec_lvewx */
3680
3681 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3682   return (vector int)__builtin_altivec_lvewx(__a, __b);
3683 }
3684
3685 static __inline__ vector unsigned int __ATTRS_o_ai
3686 vec_lvewx(int __a, const unsigned int *__b) {
3687   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3688 }
3689
3690 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3691                                                       const float *__b) {
3692   return (vector float)__builtin_altivec_lvewx(__a, __b);
3693 }
3694
3695 /* vec_ldl */
3696
3697 static __inline__ vector signed char __ATTRS_o_ai
3698 vec_ldl(int __a, const vector signed char *__b) {
3699   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3700 }
3701
3702 static __inline__ vector signed char __ATTRS_o_ai
3703 vec_ldl(int __a, const signed char *__b) {
3704   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3705 }
3706
3707 static __inline__ vector unsigned char __ATTRS_o_ai
3708 vec_ldl(int __a, const vector unsigned char *__b) {
3709   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3710 }
3711
3712 static __inline__ vector unsigned char __ATTRS_o_ai
3713 vec_ldl(int __a, const unsigned char *__b) {
3714   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3715 }
3716
3717 static __inline__ vector bool char __ATTRS_o_ai
3718 vec_ldl(int __a, const vector bool char *__b) {
3719   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3720 }
3721
3722 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3723                                                     const vector short *__b) {
3724   return (vector short)__builtin_altivec_lvxl(__a, __b);
3725 }
3726
3727 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3728   return (vector short)__builtin_altivec_lvxl(__a, __b);
3729 }
3730
3731 static __inline__ vector unsigned short __ATTRS_o_ai
3732 vec_ldl(int __a, const vector unsigned short *__b) {
3733   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3734 }
3735
3736 static __inline__ vector unsigned short __ATTRS_o_ai
3737 vec_ldl(int __a, const unsigned short *__b) {
3738   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3739 }
3740
3741 static __inline__ vector bool short __ATTRS_o_ai
3742 vec_ldl(int __a, const vector bool short *__b) {
3743   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3744 }
3745
3746 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3747                                                     const vector pixel *__b) {
3748   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3749 }
3750
3751 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3752                                                   const vector int *__b) {
3753   return (vector int)__builtin_altivec_lvxl(__a, __b);
3754 }
3755
3756 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3757   return (vector int)__builtin_altivec_lvxl(__a, __b);
3758 }
3759
3760 static __inline__ vector unsigned int __ATTRS_o_ai
3761 vec_ldl(int __a, const vector unsigned int *__b) {
3762   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3763 }
3764
3765 static __inline__ vector unsigned int __ATTRS_o_ai
3766 vec_ldl(int __a, const unsigned int *__b) {
3767   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3768 }
3769
3770 static __inline__ vector bool int __ATTRS_o_ai
3771 vec_ldl(int __a, const vector bool int *__b) {
3772   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3773 }
3774
3775 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3776                                                     const vector float *__b) {
3777   return (vector float)__builtin_altivec_lvxl(__a, __b);
3778 }
3779
3780 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3781   return (vector float)__builtin_altivec_lvxl(__a, __b);
3782 }
3783
3784 /* vec_lvxl */
3785
3786 static __inline__ vector signed char __ATTRS_o_ai
3787 vec_lvxl(int __a, const vector signed char *__b) {
3788   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3789 }
3790
3791 static __inline__ vector signed char __ATTRS_o_ai
3792 vec_lvxl(int __a, const signed char *__b) {
3793   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3794 }
3795
3796 static __inline__ vector unsigned char __ATTRS_o_ai
3797 vec_lvxl(int __a, const vector unsigned char *__b) {
3798   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3799 }
3800
3801 static __inline__ vector unsigned char __ATTRS_o_ai
3802 vec_lvxl(int __a, const unsigned char *__b) {
3803   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3804 }
3805
3806 static __inline__ vector bool char __ATTRS_o_ai
3807 vec_lvxl(int __a, const vector bool char *__b) {
3808   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3809 }
3810
3811 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3812                                                      const vector short *__b) {
3813   return (vector short)__builtin_altivec_lvxl(__a, __b);
3814 }
3815
3816 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3817                                                      const short *__b) {
3818   return (vector short)__builtin_altivec_lvxl(__a, __b);
3819 }
3820
3821 static __inline__ vector unsigned short __ATTRS_o_ai
3822 vec_lvxl(int __a, const vector unsigned short *__b) {
3823   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3824 }
3825
3826 static __inline__ vector unsigned short __ATTRS_o_ai
3827 vec_lvxl(int __a, const unsigned short *__b) {
3828   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3829 }
3830
3831 static __inline__ vector bool short __ATTRS_o_ai
3832 vec_lvxl(int __a, const vector bool short *__b) {
3833   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3834 }
3835
3836 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3837                                                      const vector pixel *__b) {
3838   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3839 }
3840
3841 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3842                                                    const vector int *__b) {
3843   return (vector int)__builtin_altivec_lvxl(__a, __b);
3844 }
3845
3846 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3847   return (vector int)__builtin_altivec_lvxl(__a, __b);
3848 }
3849
3850 static __inline__ vector unsigned int __ATTRS_o_ai
3851 vec_lvxl(int __a, const vector unsigned int *__b) {
3852   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3853 }
3854
3855 static __inline__ vector unsigned int __ATTRS_o_ai
3856 vec_lvxl(int __a, const unsigned int *__b) {
3857   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3858 }
3859
3860 static __inline__ vector bool int __ATTRS_o_ai
3861 vec_lvxl(int __a, const vector bool int *__b) {
3862   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3863 }
3864
3865 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3866                                                      const vector float *__b) {
3867   return (vector float)__builtin_altivec_lvxl(__a, __b);
3868 }
3869
3870 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3871                                                      const float *__b) {
3872   return (vector float)__builtin_altivec_lvxl(__a, __b);
3873 }
3874
3875 /* vec_loge */
3876
3877 static __inline__ vector float __attribute__((__always_inline__))
3878 vec_loge(vector float __a) {
3879   return __builtin_altivec_vlogefp(__a);
3880 }
3881
3882 /* vec_vlogefp */
3883
3884 static __inline__ vector float __attribute__((__always_inline__))
3885 vec_vlogefp(vector float __a) {
3886   return __builtin_altivec_vlogefp(__a);
3887 }
3888
3889 /* vec_lvsl */
3890
3891 #ifdef __LITTLE_ENDIAN__
3892 static __inline__ vector unsigned char __ATTRS_o_ai
3893     __attribute__((__deprecated__("use assignment for unaligned little endian \
3894 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3895   vector unsigned char mask =
3896       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3897   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3898                                   7,  6,  5,  4,  3,  2,  1, 0};
3899   return vec_perm(mask, mask, reverse);
3900 }
3901 #else
3902 static __inline__ vector unsigned char __ATTRS_o_ai
3903 vec_lvsl(int __a, const signed char *__b) {
3904   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3905 }
3906 #endif
3907
3908 #ifdef __LITTLE_ENDIAN__
3909 static __inline__ vector unsigned char __ATTRS_o_ai
3910     __attribute__((__deprecated__("use assignment for unaligned little endian \
3911 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3912   vector unsigned char mask =
3913       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3914   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3915                                   7,  6,  5,  4,  3,  2,  1, 0};
3916   return vec_perm(mask, mask, reverse);
3917 }
3918 #else
3919 static __inline__ vector unsigned char __ATTRS_o_ai
3920 vec_lvsl(int __a, const unsigned char *__b) {
3921   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3922 }
3923 #endif
3924
3925 #ifdef __LITTLE_ENDIAN__
3926 static __inline__ vector unsigned char __ATTRS_o_ai
3927     __attribute__((__deprecated__("use assignment for unaligned little endian \
3928 loads/stores"))) vec_lvsl(int __a, const short *__b) {
3929   vector unsigned char mask =
3930       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3931   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3932                                   7,  6,  5,  4,  3,  2,  1, 0};
3933   return vec_perm(mask, mask, reverse);
3934 }
3935 #else
3936 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3937                                                              const short *__b) {
3938   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3939 }
3940 #endif
3941
3942 #ifdef __LITTLE_ENDIAN__
3943 static __inline__ vector unsigned char __ATTRS_o_ai
3944     __attribute__((__deprecated__("use assignment for unaligned little endian \
3945 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3946   vector unsigned char mask =
3947       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3948   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3949                                   7,  6,  5,  4,  3,  2,  1, 0};
3950   return vec_perm(mask, mask, reverse);
3951 }
3952 #else
3953 static __inline__ vector unsigned char __ATTRS_o_ai
3954 vec_lvsl(int __a, const unsigned short *__b) {
3955   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3956 }
3957 #endif
3958
3959 #ifdef __LITTLE_ENDIAN__
3960 static __inline__ vector unsigned char __ATTRS_o_ai
3961     __attribute__((__deprecated__("use assignment for unaligned little endian \
3962 loads/stores"))) vec_lvsl(int __a, const int *__b) {
3963   vector unsigned char mask =
3964       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3965   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3966                                   7,  6,  5,  4,  3,  2,  1, 0};
3967   return vec_perm(mask, mask, reverse);
3968 }
3969 #else
3970 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3971                                                              const int *__b) {
3972   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3973 }
3974 #endif
3975
3976 #ifdef __LITTLE_ENDIAN__
3977 static __inline__ vector unsigned char __ATTRS_o_ai
3978     __attribute__((__deprecated__("use assignment for unaligned little endian \
3979 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
3980   vector unsigned char mask =
3981       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3982   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3983                                   7,  6,  5,  4,  3,  2,  1, 0};
3984   return vec_perm(mask, mask, reverse);
3985 }
3986 #else
3987 static __inline__ vector unsigned char __ATTRS_o_ai
3988 vec_lvsl(int __a, const unsigned int *__b) {
3989   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3990 }
3991 #endif
3992
3993 #ifdef __LITTLE_ENDIAN__
3994 static __inline__ vector unsigned char __ATTRS_o_ai
3995     __attribute__((__deprecated__("use assignment for unaligned little endian \
3996 loads/stores"))) vec_lvsl(int __a, const float *__b) {
3997   vector unsigned char mask =
3998       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3999   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4000                                   7,  6,  5,  4,  3,  2,  1, 0};
4001   return vec_perm(mask, mask, reverse);
4002 }
4003 #else
4004 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4005                                                              const float *__b) {
4006   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4007 }
4008 #endif
4009
4010 /* vec_lvsr */
4011
4012 #ifdef __LITTLE_ENDIAN__
4013 static __inline__ vector unsigned char __ATTRS_o_ai
4014     __attribute__((__deprecated__("use assignment for unaligned little endian \
4015 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4016   vector unsigned char mask =
4017       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4018   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4019                                   7,  6,  5,  4,  3,  2,  1, 0};
4020   return vec_perm(mask, mask, reverse);
4021 }
4022 #else
4023 static __inline__ vector unsigned char __ATTRS_o_ai
4024 vec_lvsr(int __a, const signed char *__b) {
4025   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4026 }
4027 #endif
4028
4029 #ifdef __LITTLE_ENDIAN__
4030 static __inline__ vector unsigned char __ATTRS_o_ai
4031     __attribute__((__deprecated__("use assignment for unaligned little endian \
4032 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4033   vector unsigned char mask =
4034       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4035   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4036                                   7,  6,  5,  4,  3,  2,  1, 0};
4037   return vec_perm(mask, mask, reverse);
4038 }
4039 #else
4040 static __inline__ vector unsigned char __ATTRS_o_ai
4041 vec_lvsr(int __a, const unsigned char *__b) {
4042   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4043 }
4044 #endif
4045
4046 #ifdef __LITTLE_ENDIAN__
4047 static __inline__ vector unsigned char __ATTRS_o_ai
4048     __attribute__((__deprecated__("use assignment for unaligned little endian \
4049 loads/stores"))) vec_lvsr(int __a, const short *__b) {
4050   vector unsigned char mask =
4051       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4052   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4053                                   7,  6,  5,  4,  3,  2,  1, 0};
4054   return vec_perm(mask, mask, reverse);
4055 }
4056 #else
4057 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4058                                                              const short *__b) {
4059   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4060 }
4061 #endif
4062
4063 #ifdef __LITTLE_ENDIAN__
4064 static __inline__ vector unsigned char __ATTRS_o_ai
4065     __attribute__((__deprecated__("use assignment for unaligned little endian \
4066 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4067   vector unsigned char mask =
4068       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4069   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4070                                   7,  6,  5,  4,  3,  2,  1, 0};
4071   return vec_perm(mask, mask, reverse);
4072 }
4073 #else
4074 static __inline__ vector unsigned char __ATTRS_o_ai
4075 vec_lvsr(int __a, const unsigned short *__b) {
4076   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4077 }
4078 #endif
4079
4080 #ifdef __LITTLE_ENDIAN__
4081 static __inline__ vector unsigned char __ATTRS_o_ai
4082     __attribute__((__deprecated__("use assignment for unaligned little endian \
4083 loads/stores"))) vec_lvsr(int __a, const int *__b) {
4084   vector unsigned char mask =
4085       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4086   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4087                                   7,  6,  5,  4,  3,  2,  1, 0};
4088   return vec_perm(mask, mask, reverse);
4089 }
4090 #else
4091 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4092                                                              const int *__b) {
4093   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4094 }
4095 #endif
4096
4097 #ifdef __LITTLE_ENDIAN__
4098 static __inline__ vector unsigned char __ATTRS_o_ai
4099     __attribute__((__deprecated__("use assignment for unaligned little endian \
4100 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4101   vector unsigned char mask =
4102       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4103   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4104                                   7,  6,  5,  4,  3,  2,  1, 0};
4105   return vec_perm(mask, mask, reverse);
4106 }
4107 #else
4108 static __inline__ vector unsigned char __ATTRS_o_ai
4109 vec_lvsr(int __a, const unsigned int *__b) {
4110   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4111 }
4112 #endif
4113
4114 #ifdef __LITTLE_ENDIAN__
4115 static __inline__ vector unsigned char __ATTRS_o_ai
4116     __attribute__((__deprecated__("use assignment for unaligned little endian \
4117 loads/stores"))) vec_lvsr(int __a, const float *__b) {
4118   vector unsigned char mask =
4119       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4120   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4121                                   7,  6,  5,  4,  3,  2,  1, 0};
4122   return vec_perm(mask, mask, reverse);
4123 }
4124 #else
4125 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4126                                                              const float *__b) {
4127   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4128 }
4129 #endif
4130
4131 /* vec_madd */
4132 static __inline__ vector signed short __ATTRS_o_ai
4133 vec_mladd(vector signed short, vector signed short, vector signed short);
4134 static __inline__ vector signed short __ATTRS_o_ai
4135 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4136 static __inline__ vector signed short __ATTRS_o_ai
4137 vec_mladd(vector unsigned short, vector signed short, vector signed short);
4138 static __inline__ vector unsigned short __ATTRS_o_ai
4139 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4140
4141 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4142     vector signed short __a, vector signed short __b, vector signed short __c) {
4143   return vec_mladd(__a, __b, __c);
4144 }
4145
4146 static __inline__ vector signed short __ATTRS_o_ai
4147 vec_madd(vector signed short __a, vector unsigned short __b,
4148          vector unsigned short __c) {
4149   return vec_mladd(__a, __b, __c);
4150 }
4151
4152 static __inline__ vector signed short __ATTRS_o_ai
4153 vec_madd(vector unsigned short __a, vector signed short __b,
4154          vector signed short __c) {
4155   return vec_mladd(__a, __b, __c);
4156 }
4157
4158 static __inline__ vector unsigned short __ATTRS_o_ai
4159 vec_madd(vector unsigned short __a, vector unsigned short __b,
4160          vector unsigned short __c) {
4161   return vec_mladd(__a, __b, __c);
4162 }
4163
4164 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4165                                                      vector float __b,
4166                                                      vector float __c) {
4167 #ifdef __VSX__
4168   return __builtin_vsx_xvmaddasp(__a, __b, __c);
4169 #else
4170   return __builtin_altivec_vmaddfp(__a, __b, __c);
4171 #endif
4172 }
4173
4174 #ifdef __VSX__
4175 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4176                                                       vector double __b,
4177                                                       vector double __c) {
4178   return __builtin_vsx_xvmaddadp(__a, __b, __c);
4179 }
4180 #endif
4181
4182 /* vec_vmaddfp */
4183
4184 static __inline__ vector float __attribute__((__always_inline__))
4185 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4186   return __builtin_altivec_vmaddfp(__a, __b, __c);
4187 }
4188
4189 /* vec_madds */
4190
4191 static __inline__ vector signed short __attribute__((__always_inline__))
4192 vec_madds(vector signed short __a, vector signed short __b,
4193           vector signed short __c) {
4194   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4195 }
4196
4197 /* vec_vmhaddshs */
4198 static __inline__ vector signed short __attribute__((__always_inline__))
4199 vec_vmhaddshs(vector signed short __a, vector signed short __b,
4200               vector signed short __c) {
4201   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4202 }
4203
4204 /* vec_msub */
4205
4206 #ifdef __VSX__
4207 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4208                                                      vector float __b,
4209                                                      vector float __c) {
4210   return __builtin_vsx_xvmsubasp(__a, __b, __c);
4211 }
4212
4213 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4214                                                       vector double __b,
4215                                                       vector double __c) {
4216   return __builtin_vsx_xvmsubadp(__a, __b, __c);
4217 }
4218 #endif
4219
4220 /* vec_max */
4221
4222 static __inline__ vector signed char __ATTRS_o_ai
4223 vec_max(vector signed char __a, vector signed char __b) {
4224   return __builtin_altivec_vmaxsb(__a, __b);
4225 }
4226
4227 static __inline__ vector signed char __ATTRS_o_ai
4228 vec_max(vector bool char __a, vector signed char __b) {
4229   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4230 }
4231
4232 static __inline__ vector signed char __ATTRS_o_ai
4233 vec_max(vector signed char __a, vector bool char __b) {
4234   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4235 }
4236
4237 static __inline__ vector unsigned char __ATTRS_o_ai
4238 vec_max(vector unsigned char __a, vector unsigned char __b) {
4239   return __builtin_altivec_vmaxub(__a, __b);
4240 }
4241
4242 static __inline__ vector unsigned char __ATTRS_o_ai
4243 vec_max(vector bool char __a, vector unsigned char __b) {
4244   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4245 }
4246
4247 static __inline__ vector unsigned char __ATTRS_o_ai
4248 vec_max(vector unsigned char __a, vector bool char __b) {
4249   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4250 }
4251
4252 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4253                                                     vector short __b) {
4254   return __builtin_altivec_vmaxsh(__a, __b);
4255 }
4256
4257 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4258                                                     vector short __b) {
4259   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4260 }
4261
4262 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4263                                                     vector bool short __b) {
4264   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4265 }
4266
4267 static __inline__ vector unsigned short __ATTRS_o_ai
4268 vec_max(vector unsigned short __a, vector unsigned short __b) {
4269   return __builtin_altivec_vmaxuh(__a, __b);
4270 }
4271
4272 static __inline__ vector unsigned short __ATTRS_o_ai
4273 vec_max(vector bool short __a, vector unsigned short __b) {
4274   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4275 }
4276
4277 static __inline__ vector unsigned short __ATTRS_o_ai
4278 vec_max(vector unsigned short __a, vector bool short __b) {
4279   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4280 }
4281
4282 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4283                                                   vector int __b) {
4284   return __builtin_altivec_vmaxsw(__a, __b);
4285 }
4286
4287 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4288                                                   vector int __b) {
4289   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4290 }
4291
4292 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4293                                                   vector bool int __b) {
4294   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4295 }
4296
4297 static __inline__ vector unsigned int __ATTRS_o_ai
4298 vec_max(vector unsigned int __a, vector unsigned int __b) {
4299   return __builtin_altivec_vmaxuw(__a, __b);
4300 }
4301
4302 static __inline__ vector unsigned int __ATTRS_o_ai
4303 vec_max(vector bool int __a, vector unsigned int __b) {
4304   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4305 }
4306
4307 static __inline__ vector unsigned int __ATTRS_o_ai
4308 vec_max(vector unsigned int __a, vector bool int __b) {
4309   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4310 }
4311
4312 #ifdef __POWER8_VECTOR__
4313 static __inline__ vector signed long long __ATTRS_o_ai
4314 vec_max(vector signed long long __a, vector signed long long __b) {
4315   return __builtin_altivec_vmaxsd(__a, __b);
4316 }
4317
4318 static __inline__ vector signed long long __ATTRS_o_ai
4319 vec_max(vector bool long long __a, vector signed long long __b) {
4320   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4321 }
4322
4323 static __inline__ vector signed long long __ATTRS_o_ai
4324 vec_max(vector signed long long __a, vector bool long long __b) {
4325   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4326 }
4327
4328 static __inline__ vector unsigned long long __ATTRS_o_ai
4329 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4330   return __builtin_altivec_vmaxud(__a, __b);
4331 }
4332
4333 static __inline__ vector unsigned long long __ATTRS_o_ai
4334 vec_max(vector bool long long __a, vector unsigned long long __b) {
4335   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4336 }
4337
4338 static __inline__ vector unsigned long long __ATTRS_o_ai
4339 vec_max(vector unsigned long long __a, vector bool long long __b) {
4340   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4341 }
4342 #endif
4343
4344 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4345                                                     vector float __b) {
4346 #ifdef __VSX__
4347   return __builtin_vsx_xvmaxsp(__a, __b);
4348 #else
4349   return __builtin_altivec_vmaxfp(__a, __b);
4350 #endif
4351 }
4352
4353 #ifdef __VSX__
4354 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4355                                                      vector double __b) {
4356   return __builtin_vsx_xvmaxdp(__a, __b);
4357 }
4358 #endif
4359
4360 /* vec_vmaxsb */
4361
4362 static __inline__ vector signed char __ATTRS_o_ai
4363 vec_vmaxsb(vector signed char __a, vector signed char __b) {
4364   return __builtin_altivec_vmaxsb(__a, __b);
4365 }
4366
4367 static __inline__ vector signed char __ATTRS_o_ai
4368 vec_vmaxsb(vector bool char __a, vector signed char __b) {
4369   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4370 }
4371
4372 static __inline__ vector signed char __ATTRS_o_ai
4373 vec_vmaxsb(vector signed char __a, vector bool char __b) {
4374   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4375 }
4376
4377 /* vec_vmaxub */
4378
4379 static __inline__ vector unsigned char __ATTRS_o_ai
4380 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4381   return __builtin_altivec_vmaxub(__a, __b);
4382 }
4383
4384 static __inline__ vector unsigned char __ATTRS_o_ai
4385 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4386   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4387 }
4388
4389 static __inline__ vector unsigned char __ATTRS_o_ai
4390 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4391   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4392 }
4393
4394 /* vec_vmaxsh */
4395
4396 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4397                                                        vector short __b) {
4398   return __builtin_altivec_vmaxsh(__a, __b);
4399 }
4400
4401 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4402                                                        vector short __b) {
4403   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4404 }
4405
4406 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4407                                                        vector bool short __b) {
4408   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4409 }
4410
4411 /* vec_vmaxuh */
4412
4413 static __inline__ vector unsigned short __ATTRS_o_ai
4414 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4415   return __builtin_altivec_vmaxuh(__a, __b);
4416 }
4417
4418 static __inline__ vector unsigned short __ATTRS_o_ai
4419 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4420   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4421 }
4422
4423 static __inline__ vector unsigned short __ATTRS_o_ai
4424 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4425   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4426 }
4427
4428 /* vec_vmaxsw */
4429
4430 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4431                                                      vector int __b) {
4432   return __builtin_altivec_vmaxsw(__a, __b);
4433 }
4434
4435 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4436                                                      vector int __b) {
4437   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4438 }
4439
4440 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4441                                                      vector bool int __b) {
4442   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4443 }
4444
4445 /* vec_vmaxuw */
4446
4447 static __inline__ vector unsigned int __ATTRS_o_ai
4448 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4449   return __builtin_altivec_vmaxuw(__a, __b);
4450 }
4451
4452 static __inline__ vector unsigned int __ATTRS_o_ai
4453 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4454   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4455 }
4456
4457 static __inline__ vector unsigned int __ATTRS_o_ai
4458 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4459   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4460 }
4461
4462 /* vec_vmaxfp */
4463
4464 static __inline__ vector float __attribute__((__always_inline__))
4465 vec_vmaxfp(vector float __a, vector float __b) {
4466 #ifdef __VSX__
4467   return __builtin_vsx_xvmaxsp(__a, __b);
4468 #else
4469   return __builtin_altivec_vmaxfp(__a, __b);
4470 #endif
4471 }
4472
4473 /* vec_mergeh */
4474
4475 static __inline__ vector signed char __ATTRS_o_ai
4476 vec_mergeh(vector signed char __a, vector signed char __b) {
4477   return vec_perm(__a, __b,
4478                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4479                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4480                                          0x06, 0x16, 0x07, 0x17));
4481 }
4482
4483 static __inline__ vector unsigned char __ATTRS_o_ai
4484 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4485   return vec_perm(__a, __b,
4486                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4487                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4488                                          0x06, 0x16, 0x07, 0x17));
4489 }
4490
4491 static __inline__ vector bool char __ATTRS_o_ai
4492 vec_mergeh(vector bool char __a, vector bool char __b) {
4493   return vec_perm(__a, __b,
4494                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4495                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4496                                          0x06, 0x16, 0x07, 0x17));
4497 }
4498
4499 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4500                                                        vector short __b) {
4501   return vec_perm(__a, __b,
4502                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4503                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4504                                          0x06, 0x07, 0x16, 0x17));
4505 }
4506
4507 static __inline__ vector unsigned short __ATTRS_o_ai
4508 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4509   return vec_perm(__a, __b,
4510                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4511                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4512                                          0x06, 0x07, 0x16, 0x17));
4513 }
4514
4515 static __inline__ vector bool short __ATTRS_o_ai
4516 vec_mergeh(vector bool short __a, vector bool short __b) {
4517   return vec_perm(__a, __b,
4518                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4519                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4520                                          0x06, 0x07, 0x16, 0x17));
4521 }
4522
4523 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4524                                                        vector pixel __b) {
4525   return vec_perm(__a, __b,
4526                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4527                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4528                                          0x06, 0x07, 0x16, 0x17));
4529 }
4530
4531 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4532                                                      vector int __b) {
4533   return vec_perm(__a, __b,
4534                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4535                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4536                                          0x14, 0x15, 0x16, 0x17));
4537 }
4538
4539 static __inline__ vector unsigned int __ATTRS_o_ai
4540 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4541   return vec_perm(__a, __b,
4542                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4543                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4544                                          0x14, 0x15, 0x16, 0x17));
4545 }
4546
4547 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4548                                                           vector bool int __b) {
4549   return vec_perm(__a, __b,
4550                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4551                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4552                                          0x14, 0x15, 0x16, 0x17));
4553 }
4554
4555 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4556                                                        vector float __b) {
4557   return vec_perm(__a, __b,
4558                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4559                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4560                                          0x14, 0x15, 0x16, 0x17));
4561 }
4562
4563 #ifdef __VSX__
4564 static __inline__ vector signed long long __ATTRS_o_ai
4565 vec_mergeh(vector signed long long __a, vector signed long long __b) {
4566   return vec_perm(__a, __b,
4567                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4568                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4569                                          0x14, 0x15, 0x16, 0x17));
4570 }
4571
4572 static __inline__ vector signed long long __ATTRS_o_ai
4573 vec_mergeh(vector signed long long __a, vector bool long long __b) {
4574   return vec_perm(__a, (vector signed long long)__b,
4575                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4576                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4577                                          0x14, 0x15, 0x16, 0x17));
4578 }
4579
4580 static __inline__ vector signed long long __ATTRS_o_ai
4581 vec_mergeh(vector bool long long __a, vector signed long long __b) {
4582   return vec_perm((vector signed long long)__a, __b,
4583                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4584                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4585                                          0x14, 0x15, 0x16, 0x17));
4586 }
4587
4588 static __inline__ vector unsigned long long __ATTRS_o_ai
4589 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4590   return vec_perm(__a, __b,
4591                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4592                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4593                                          0x14, 0x15, 0x16, 0x17));
4594 }
4595
4596 static __inline__ vector unsigned long long __ATTRS_o_ai
4597 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4598   return vec_perm(__a, (vector unsigned long long)__b,
4599                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4600                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4601                                          0x14, 0x15, 0x16, 0x17));
4602 }
4603
4604 static __inline__ vector unsigned long long __ATTRS_o_ai
4605 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4606   return vec_perm((vector unsigned long long)__a, __b,
4607                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4608                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4609                                          0x14, 0x15, 0x16, 0x17));
4610 }
4611
4612 static __inline__ vector bool long long __ATTRS_o_ai
4613 vec_mergeh(vector bool long long __a, vector bool long long __b) {
4614   return vec_perm(__a, __b,
4615                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4616                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4617                                          0x14, 0x15, 0x16, 0x17));
4618 }
4619
4620 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4621                                                         vector double __b) {
4622   return vec_perm(__a, __b,
4623                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4624                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4625                                          0x14, 0x15, 0x16, 0x17));
4626 }
4627 static __inline__ vector double __ATTRS_o_ai
4628 vec_mergeh(vector double __a, vector bool long long __b) {
4629   return vec_perm(__a, (vector double)__b,
4630                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4631                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4632                                          0x14, 0x15, 0x16, 0x17));
4633 }
4634 static __inline__ vector double __ATTRS_o_ai
4635 vec_mergeh(vector bool long long __a, vector double __b) {
4636   return vec_perm((vector double)__a, __b,
4637                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4638                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4639                                          0x14, 0x15, 0x16, 0x17));
4640 }
4641 #endif
4642
4643 /* vec_vmrghb */
4644
4645 #define __builtin_altivec_vmrghb vec_vmrghb
4646
4647 static __inline__ vector signed char __ATTRS_o_ai
4648 vec_vmrghb(vector signed char __a, vector signed char __b) {
4649   return vec_perm(__a, __b,
4650                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4651                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4652                                          0x06, 0x16, 0x07, 0x17));
4653 }
4654
4655 static __inline__ vector unsigned char __ATTRS_o_ai
4656 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4657   return vec_perm(__a, __b,
4658                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4659                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4660                                          0x06, 0x16, 0x07, 0x17));
4661 }
4662
4663 static __inline__ vector bool char __ATTRS_o_ai
4664 vec_vmrghb(vector bool char __a, vector bool char __b) {
4665   return vec_perm(__a, __b,
4666                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4667                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4668                                          0x06, 0x16, 0x07, 0x17));
4669 }
4670
4671 /* vec_vmrghh */
4672
4673 #define __builtin_altivec_vmrghh vec_vmrghh
4674
4675 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4676                                                        vector short __b) {
4677   return vec_perm(__a, __b,
4678                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4679                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4680                                          0x06, 0x07, 0x16, 0x17));
4681 }
4682
4683 static __inline__ vector unsigned short __ATTRS_o_ai
4684 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4685   return vec_perm(__a, __b,
4686                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4687                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4688                                          0x06, 0x07, 0x16, 0x17));
4689 }
4690
4691 static __inline__ vector bool short __ATTRS_o_ai
4692 vec_vmrghh(vector bool short __a, vector bool short __b) {
4693   return vec_perm(__a, __b,
4694                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4695                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4696                                          0x06, 0x07, 0x16, 0x17));
4697 }
4698
4699 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4700                                                        vector pixel __b) {
4701   return vec_perm(__a, __b,
4702                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4703                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4704                                          0x06, 0x07, 0x16, 0x17));
4705 }
4706
4707 /* vec_vmrghw */
4708
4709 #define __builtin_altivec_vmrghw vec_vmrghw
4710
4711 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4712                                                      vector int __b) {
4713   return vec_perm(__a, __b,
4714                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4715                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4716                                          0x14, 0x15, 0x16, 0x17));
4717 }
4718
4719 static __inline__ vector unsigned int __ATTRS_o_ai
4720 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4721   return vec_perm(__a, __b,
4722                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4723                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4724                                          0x14, 0x15, 0x16, 0x17));
4725 }
4726
4727 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4728                                                           vector bool int __b) {
4729   return vec_perm(__a, __b,
4730                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4731                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4732                                          0x14, 0x15, 0x16, 0x17));
4733 }
4734
4735 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4736                                                        vector float __b) {
4737   return vec_perm(__a, __b,
4738                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4739                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4740                                          0x14, 0x15, 0x16, 0x17));
4741 }
4742
4743 /* vec_mergel */
4744
4745 static __inline__ vector signed char __ATTRS_o_ai
4746 vec_mergel(vector signed char __a, vector signed char __b) {
4747   return vec_perm(__a, __b,
4748                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4749                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4750                                          0x0E, 0x1E, 0x0F, 0x1F));
4751 }
4752
4753 static __inline__ vector unsigned char __ATTRS_o_ai
4754 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4755   return vec_perm(__a, __b,
4756                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4757                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4758                                          0x0E, 0x1E, 0x0F, 0x1F));
4759 }
4760
4761 static __inline__ vector bool char __ATTRS_o_ai
4762 vec_mergel(vector bool char __a, vector bool char __b) {
4763   return vec_perm(__a, __b,
4764                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4765                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4766                                          0x0E, 0x1E, 0x0F, 0x1F));
4767 }
4768
4769 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4770                                                        vector short __b) {
4771   return vec_perm(__a, __b,
4772                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4773                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4774                                          0x0E, 0x0F, 0x1E, 0x1F));
4775 }
4776
4777 static __inline__ vector unsigned short __ATTRS_o_ai
4778 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4779   return vec_perm(__a, __b,
4780                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4781                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4782                                          0x0E, 0x0F, 0x1E, 0x1F));
4783 }
4784
4785 static __inline__ vector bool short __ATTRS_o_ai
4786 vec_mergel(vector bool short __a, vector bool short __b) {
4787   return vec_perm(__a, __b,
4788                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4789                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4790                                          0x0E, 0x0F, 0x1E, 0x1F));
4791 }
4792
4793 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4794                                                        vector pixel __b) {
4795   return vec_perm(__a, __b,
4796                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4797                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4798                                          0x0E, 0x0F, 0x1E, 0x1F));
4799 }
4800
4801 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4802                                                      vector int __b) {
4803   return vec_perm(__a, __b,
4804                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4805                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4806                                          0x1C, 0x1D, 0x1E, 0x1F));
4807 }
4808
4809 static __inline__ vector unsigned int __ATTRS_o_ai
4810 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4811   return vec_perm(__a, __b,
4812                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4813                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4814                                          0x1C, 0x1D, 0x1E, 0x1F));
4815 }
4816
4817 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4818                                                           vector bool int __b) {
4819   return vec_perm(__a, __b,
4820                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4821                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4822                                          0x1C, 0x1D, 0x1E, 0x1F));
4823 }
4824
4825 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4826                                                        vector float __b) {
4827   return vec_perm(__a, __b,
4828                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4829                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4830                                          0x1C, 0x1D, 0x1E, 0x1F));
4831 }
4832
4833 #ifdef __VSX__
4834 static __inline__ vector signed long long __ATTRS_o_ai
4835 vec_mergel(vector signed long long __a, vector signed long long __b) {
4836   return vec_perm(__a, __b,
4837                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4838                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4839                                          0x1C, 0x1D, 0x1E, 0x1F));
4840 }
4841 static __inline__ vector signed long long __ATTRS_o_ai
4842 vec_mergel(vector signed long long __a, vector bool long long __b) {
4843   return vec_perm(__a, (vector signed long long)__b,
4844                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4845                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4846                                          0x1C, 0x1D, 0x1E, 0x1F));
4847 }
4848 static __inline__ vector signed long long __ATTRS_o_ai
4849 vec_mergel(vector bool long long __a, vector signed long long __b) {
4850   return vec_perm((vector signed long long)__a, __b,
4851                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4852                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4853                                          0x1C, 0x1D, 0x1E, 0x1F));
4854 }
4855 static __inline__ vector unsigned long long __ATTRS_o_ai
4856 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4857   return vec_perm(__a, __b,
4858                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4859                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4860                                          0x1C, 0x1D, 0x1E, 0x1F));
4861 }
4862 static __inline__ vector unsigned long long __ATTRS_o_ai
4863 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4864   return vec_perm(__a, (vector unsigned long long)__b,
4865                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4866                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4867                                          0x1C, 0x1D, 0x1E, 0x1F));
4868 }
4869 static __inline__ vector unsigned long long __ATTRS_o_ai
4870 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4871   return vec_perm((vector unsigned long long)__a, __b,
4872                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4873                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4874                                          0x1C, 0x1D, 0x1E, 0x1F));
4875 }
4876 static __inline__ vector bool long long __ATTRS_o_ai
4877 vec_mergel(vector bool long long __a, vector bool long long __b) {
4878   return vec_perm(__a, __b,
4879                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4880                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4881                                          0x1C, 0x1D, 0x1E, 0x1F));
4882 }
4883 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4884                                                         vector double __b) {
4885   return vec_perm(__a, __b,
4886                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4887                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4888                                          0x1C, 0x1D, 0x1E, 0x1F));
4889 }
4890 static __inline__ vector double __ATTRS_o_ai
4891 vec_mergel(vector double __a, vector bool long long __b) {
4892   return vec_perm(__a, (vector double)__b,
4893                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4894                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4895                                          0x1C, 0x1D, 0x1E, 0x1F));
4896 }
4897 static __inline__ vector double __ATTRS_o_ai
4898 vec_mergel(vector bool long long __a, vector double __b) {
4899   return vec_perm((vector double)__a, __b,
4900                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4901                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4902                                          0x1C, 0x1D, 0x1E, 0x1F));
4903 }
4904 #endif
4905
4906 /* vec_vmrglb */
4907
4908 #define __builtin_altivec_vmrglb vec_vmrglb
4909
4910 static __inline__ vector signed char __ATTRS_o_ai
4911 vec_vmrglb(vector signed char __a, vector signed char __b) {
4912   return vec_perm(__a, __b,
4913                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4914                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4915                                          0x0E, 0x1E, 0x0F, 0x1F));
4916 }
4917
4918 static __inline__ vector unsigned char __ATTRS_o_ai
4919 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4920   return vec_perm(__a, __b,
4921                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4922                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4923                                          0x0E, 0x1E, 0x0F, 0x1F));
4924 }
4925
4926 static __inline__ vector bool char __ATTRS_o_ai
4927 vec_vmrglb(vector bool char __a, vector bool char __b) {
4928   return vec_perm(__a, __b,
4929                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4930                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4931                                          0x0E, 0x1E, 0x0F, 0x1F));
4932 }
4933
4934 /* vec_vmrglh */
4935
4936 #define __builtin_altivec_vmrglh vec_vmrglh
4937
4938 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4939                                                        vector short __b) {
4940   return vec_perm(__a, __b,
4941                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4942                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4943                                          0x0E, 0x0F, 0x1E, 0x1F));
4944 }
4945
4946 static __inline__ vector unsigned short __ATTRS_o_ai
4947 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4948   return vec_perm(__a, __b,
4949                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4950                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4951                                          0x0E, 0x0F, 0x1E, 0x1F));
4952 }
4953
4954 static __inline__ vector bool short __ATTRS_o_ai
4955 vec_vmrglh(vector bool short __a, vector bool short __b) {
4956   return vec_perm(__a, __b,
4957                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4958                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4959                                          0x0E, 0x0F, 0x1E, 0x1F));
4960 }
4961
4962 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4963                                                        vector pixel __b) {
4964   return vec_perm(__a, __b,
4965                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4966                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4967                                          0x0E, 0x0F, 0x1E, 0x1F));
4968 }
4969
4970 /* vec_vmrglw */
4971
4972 #define __builtin_altivec_vmrglw vec_vmrglw
4973
4974 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4975                                                      vector int __b) {
4976   return vec_perm(__a, __b,
4977                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4978                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4979                                          0x1C, 0x1D, 0x1E, 0x1F));
4980 }
4981
4982 static __inline__ vector unsigned int __ATTRS_o_ai
4983 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
4984   return vec_perm(__a, __b,
4985                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4986                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4987                                          0x1C, 0x1D, 0x1E, 0x1F));
4988 }
4989
4990 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
4991                                                           vector bool int __b) {
4992   return vec_perm(__a, __b,
4993                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4994                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4995                                          0x1C, 0x1D, 0x1E, 0x1F));
4996 }
4997
4998 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
4999                                                        vector float __b) {
5000   return vec_perm(__a, __b,
5001                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5002                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5003                                          0x1C, 0x1D, 0x1E, 0x1F));
5004 }
5005
5006 #ifdef __POWER8_VECTOR__
5007 /* vec_mergee */
5008
5009 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5010                                                           vector bool int __b) {
5011   return vec_perm(__a, __b,
5012                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5013                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5014                                          0x18, 0x19, 0x1A, 0x1B));
5015 }
5016
5017 static __inline__ vector signed int __ATTRS_o_ai
5018 vec_mergee(vector signed int __a, vector signed int __b) {
5019   return vec_perm(__a, __b,
5020                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5021                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5022                                          0x18, 0x19, 0x1A, 0x1B));
5023 }
5024
5025 static __inline__ vector unsigned int __ATTRS_o_ai
5026 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5027   return vec_perm(__a, __b,
5028                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5029                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5030                                          0x18, 0x19, 0x1A, 0x1B));
5031 }
5032
5033 static __inline__ vector bool long long __ATTRS_o_ai
5034 vec_mergee(vector bool long long __a, vector bool long long __b) {
5035   return vec_mergeh(__a, __b);
5036 }
5037
5038 static __inline__ vector signed long long __ATTRS_o_ai
5039 vec_mergee(vector signed long long __a, vector signed long long __b) {
5040   return vec_mergeh(__a, __b);
5041 }
5042
5043 static __inline__ vector unsigned long long __ATTRS_o_ai
5044 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5045   return vec_mergeh(__a, __b);
5046 }
5047
5048 static __inline__ vector float __ATTRS_o_ai
5049 vec_mergee(vector float __a, vector float __b) {
5050   return vec_perm(__a, __b,
5051                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5052                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5053                                          0x18, 0x19, 0x1A, 0x1B));
5054 }
5055
5056 static __inline__ vector double __ATTRS_o_ai
5057 vec_mergee(vector double __a, vector double __b) {
5058   return vec_mergeh(__a, __b);
5059 }
5060
5061 /* vec_mergeo */
5062
5063 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5064                                                           vector bool int __b) {
5065   return vec_perm(__a, __b,
5066                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5067                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5068                                          0x1C, 0x1D, 0x1E, 0x1F));
5069 }
5070
5071 static __inline__ vector signed int __ATTRS_o_ai
5072 vec_mergeo(vector signed int __a, vector signed int __b) {
5073   return vec_perm(__a, __b,
5074                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5075                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5076                                          0x1C, 0x1D, 0x1E, 0x1F));
5077 }
5078
5079 static __inline__ vector unsigned int __ATTRS_o_ai
5080 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5081   return vec_perm(__a, __b,
5082                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5083                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5084                                          0x1C, 0x1D, 0x1E, 0x1F));
5085 }
5086
5087 static __inline__ vector bool long long __ATTRS_o_ai
5088 vec_mergeo(vector bool long long __a, vector bool long long __b) {
5089   return vec_mergel(__a, __b);
5090 }
5091
5092 static __inline__ vector signed long long __ATTRS_o_ai
5093 vec_mergeo(vector signed long long __a, vector signed long long __b) {
5094   return vec_mergel(__a, __b);
5095 }
5096
5097 static __inline__ vector unsigned long long __ATTRS_o_ai
5098 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5099   return vec_mergel(__a, __b);
5100 }
5101
5102 static __inline__ vector float __ATTRS_o_ai
5103 vec_mergeo(vector float __a, vector float __b) {
5104   return vec_perm(__a, __b,
5105                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5106                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5107                                          0x1C, 0x1D, 0x1E, 0x1F));
5108 }
5109
5110 static __inline__ vector double __ATTRS_o_ai
5111 vec_mergeo(vector double __a, vector double __b) {
5112   return vec_mergel(__a, __b);
5113 }
5114
5115 #endif
5116
5117 /* vec_mfvscr */
5118
5119 static __inline__ vector unsigned short __attribute__((__always_inline__))
5120 vec_mfvscr(void) {
5121   return __builtin_altivec_mfvscr();
5122 }
5123
5124 /* vec_min */
5125
5126 static __inline__ vector signed char __ATTRS_o_ai
5127 vec_min(vector signed char __a, vector signed char __b) {
5128   return __builtin_altivec_vminsb(__a, __b);
5129 }
5130
5131 static __inline__ vector signed char __ATTRS_o_ai
5132 vec_min(vector bool char __a, vector signed char __b) {
5133   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5134 }
5135
5136 static __inline__ vector signed char __ATTRS_o_ai
5137 vec_min(vector signed char __a, vector bool char __b) {
5138   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5139 }
5140
5141 static __inline__ vector unsigned char __ATTRS_o_ai
5142 vec_min(vector unsigned char __a, vector unsigned char __b) {
5143   return __builtin_altivec_vminub(__a, __b);
5144 }
5145
5146 static __inline__ vector unsigned char __ATTRS_o_ai
5147 vec_min(vector bool char __a, vector unsigned char __b) {
5148   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5149 }
5150
5151 static __inline__ vector unsigned char __ATTRS_o_ai
5152 vec_min(vector unsigned char __a, vector bool char __b) {
5153   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5154 }
5155
5156 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5157                                                     vector short __b) {
5158   return __builtin_altivec_vminsh(__a, __b);
5159 }
5160
5161 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5162                                                     vector short __b) {
5163   return __builtin_altivec_vminsh((vector short)__a, __b);
5164 }
5165
5166 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5167                                                     vector bool short __b) {
5168   return __builtin_altivec_vminsh(__a, (vector short)__b);
5169 }
5170
5171 static __inline__ vector unsigned short __ATTRS_o_ai
5172 vec_min(vector unsigned short __a, vector unsigned short __b) {
5173   return __builtin_altivec_vminuh(__a, __b);
5174 }
5175
5176 static __inline__ vector unsigned short __ATTRS_o_ai
5177 vec_min(vector bool short __a, vector unsigned short __b) {
5178   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5179 }
5180
5181 static __inline__ vector unsigned short __ATTRS_o_ai
5182 vec_min(vector unsigned short __a, vector bool short __b) {
5183   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5184 }
5185
5186 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5187                                                   vector int __b) {
5188   return __builtin_altivec_vminsw(__a, __b);
5189 }
5190
5191 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5192                                                   vector int __b) {
5193   return __builtin_altivec_vminsw((vector int)__a, __b);
5194 }
5195
5196 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5197                                                   vector bool int __b) {
5198   return __builtin_altivec_vminsw(__a, (vector int)__b);
5199 }
5200
5201 static __inline__ vector unsigned int __ATTRS_o_ai
5202 vec_min(vector unsigned int __a, vector unsigned int __b) {
5203   return __builtin_altivec_vminuw(__a, __b);
5204 }
5205
5206 static __inline__ vector unsigned int __ATTRS_o_ai
5207 vec_min(vector bool int __a, vector unsigned int __b) {
5208   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5209 }
5210
5211 static __inline__ vector unsigned int __ATTRS_o_ai
5212 vec_min(vector unsigned int __a, vector bool int __b) {
5213   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5214 }
5215
5216 #ifdef __POWER8_VECTOR__
5217 static __inline__ vector signed long long __ATTRS_o_ai
5218 vec_min(vector signed long long __a, vector signed long long __b) {
5219   return __builtin_altivec_vminsd(__a, __b);
5220 }
5221
5222 static __inline__ vector signed long long __ATTRS_o_ai
5223 vec_min(vector bool long long __a, vector signed long long __b) {
5224   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5225 }
5226
5227 static __inline__ vector signed long long __ATTRS_o_ai
5228 vec_min(vector signed long long __a, vector bool long long __b) {
5229   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5230 }
5231
5232 static __inline__ vector unsigned long long __ATTRS_o_ai
5233 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5234   return __builtin_altivec_vminud(__a, __b);
5235 }
5236
5237 static __inline__ vector unsigned long long __ATTRS_o_ai
5238 vec_min(vector bool long long __a, vector unsigned long long __b) {
5239   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5240 }
5241
5242 static __inline__ vector unsigned long long __ATTRS_o_ai
5243 vec_min(vector unsigned long long __a, vector bool long long __b) {
5244   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5245 }
5246 #endif
5247
5248 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5249                                                     vector float __b) {
5250 #ifdef __VSX__
5251   return __builtin_vsx_xvminsp(__a, __b);
5252 #else
5253   return __builtin_altivec_vminfp(__a, __b);
5254 #endif
5255 }
5256
5257 #ifdef __VSX__
5258 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5259                                                      vector double __b) {
5260   return __builtin_vsx_xvmindp(__a, __b);
5261 }
5262 #endif
5263
5264 /* vec_vminsb */
5265
5266 static __inline__ vector signed char __ATTRS_o_ai
5267 vec_vminsb(vector signed char __a, vector signed char __b) {
5268   return __builtin_altivec_vminsb(__a, __b);
5269 }
5270
5271 static __inline__ vector signed char __ATTRS_o_ai
5272 vec_vminsb(vector bool char __a, vector signed char __b) {
5273   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5274 }
5275
5276 static __inline__ vector signed char __ATTRS_o_ai
5277 vec_vminsb(vector signed char __a, vector bool char __b) {
5278   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5279 }
5280
5281 /* vec_vminub */
5282
5283 static __inline__ vector unsigned char __ATTRS_o_ai
5284 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5285   return __builtin_altivec_vminub(__a, __b);
5286 }
5287
5288 static __inline__ vector unsigned char __ATTRS_o_ai
5289 vec_vminub(vector bool char __a, vector unsigned char __b) {
5290   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5291 }
5292
5293 static __inline__ vector unsigned char __ATTRS_o_ai
5294 vec_vminub(vector unsigned char __a, vector bool char __b) {
5295   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5296 }
5297
5298 /* vec_vminsh */
5299
5300 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5301                                                        vector short __b) {
5302   return __builtin_altivec_vminsh(__a, __b);
5303 }
5304
5305 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5306                                                        vector short __b) {
5307   return __builtin_altivec_vminsh((vector short)__a, __b);
5308 }
5309
5310 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5311                                                        vector bool short __b) {
5312   return __builtin_altivec_vminsh(__a, (vector short)__b);
5313 }
5314
5315 /* vec_vminuh */
5316
5317 static __inline__ vector unsigned short __ATTRS_o_ai
5318 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5319   return __builtin_altivec_vminuh(__a, __b);
5320 }
5321
5322 static __inline__ vector unsigned short __ATTRS_o_ai
5323 vec_vminuh(vector bool short __a, vector unsigned short __b) {
5324   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5325 }
5326
5327 static __inline__ vector unsigned short __ATTRS_o_ai
5328 vec_vminuh(vector unsigned short __a, vector bool short __b) {
5329   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5330 }
5331
5332 /* vec_vminsw */
5333
5334 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5335                                                      vector int __b) {
5336   return __builtin_altivec_vminsw(__a, __b);
5337 }
5338
5339 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5340                                                      vector int __b) {
5341   return __builtin_altivec_vminsw((vector int)__a, __b);
5342 }
5343
5344 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5345                                                      vector bool int __b) {
5346   return __builtin_altivec_vminsw(__a, (vector int)__b);
5347 }
5348
5349 /* vec_vminuw */
5350
5351 static __inline__ vector unsigned int __ATTRS_o_ai
5352 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5353   return __builtin_altivec_vminuw(__a, __b);
5354 }
5355
5356 static __inline__ vector unsigned int __ATTRS_o_ai
5357 vec_vminuw(vector bool int __a, vector unsigned int __b) {
5358   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5359 }
5360
5361 static __inline__ vector unsigned int __ATTRS_o_ai
5362 vec_vminuw(vector unsigned int __a, vector bool int __b) {
5363   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5364 }
5365
5366 /* vec_vminfp */
5367
5368 static __inline__ vector float __attribute__((__always_inline__))
5369 vec_vminfp(vector float __a, vector float __b) {
5370 #ifdef __VSX__
5371   return __builtin_vsx_xvminsp(__a, __b);
5372 #else
5373   return __builtin_altivec_vminfp(__a, __b);
5374 #endif
5375 }
5376
5377 /* vec_mladd */
5378
5379 #define __builtin_altivec_vmladduhm vec_mladd
5380
5381 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5382                                                       vector short __b,
5383                                                       vector short __c) {
5384   return __a * __b + __c;
5385 }
5386
5387 static __inline__ vector short __ATTRS_o_ai vec_mladd(
5388     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5389   return __a * (vector short)__b + (vector short)__c;
5390 }
5391
5392 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5393                                                       vector short __b,
5394                                                       vector short __c) {
5395   return (vector short)__a * __b + __c;
5396 }
5397
5398 static __inline__ vector unsigned short __ATTRS_o_ai
5399 vec_mladd(vector unsigned short __a, vector unsigned short __b,
5400           vector unsigned short __c) {
5401   return __a * __b + __c;
5402 }
5403
5404 /* vec_vmladduhm */
5405
5406 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5407                                                           vector short __b,
5408                                                           vector short __c) {
5409   return __a * __b + __c;
5410 }
5411
5412 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5413     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5414   return __a * (vector short)__b + (vector short)__c;
5415 }
5416
5417 static __inline__ vector short __ATTRS_o_ai
5418 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5419   return (vector short)__a * __b + __c;
5420 }
5421
5422 static __inline__ vector unsigned short __ATTRS_o_ai
5423 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5424               vector unsigned short __c) {
5425   return __a * __b + __c;
5426 }
5427
5428 /* vec_mradds */
5429
5430 static __inline__ vector short __attribute__((__always_inline__))
5431 vec_mradds(vector short __a, vector short __b, vector short __c) {
5432   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5433 }
5434
5435 /* vec_vmhraddshs */
5436
5437 static __inline__ vector short __attribute__((__always_inline__))
5438 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5439   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5440 }
5441
5442 /* vec_msum */
5443
5444 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5445                                                    vector unsigned char __b,
5446                                                    vector int __c) {
5447   return __builtin_altivec_vmsummbm(__a, __b, __c);
5448 }
5449
5450 static __inline__ vector unsigned int __ATTRS_o_ai
5451 vec_msum(vector unsigned char __a, vector unsigned char __b,
5452          vector unsigned int __c) {
5453   return __builtin_altivec_vmsumubm(__a, __b, __c);
5454 }
5455
5456 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5457                                                    vector short __b,
5458                                                    vector int __c) {
5459   return __builtin_altivec_vmsumshm(__a, __b, __c);
5460 }
5461
5462 static __inline__ vector unsigned int __ATTRS_o_ai
5463 vec_msum(vector unsigned short __a, vector unsigned short __b,
5464          vector unsigned int __c) {
5465   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5466 }
5467
5468 /* vec_vmsummbm */
5469
5470 static __inline__ vector int __attribute__((__always_inline__))
5471 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5472   return __builtin_altivec_vmsummbm(__a, __b, __c);
5473 }
5474
5475 /* vec_vmsumubm */
5476
5477 static __inline__ vector unsigned int __attribute__((__always_inline__))
5478 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5479              vector unsigned int __c) {
5480   return __builtin_altivec_vmsumubm(__a, __b, __c);
5481 }
5482
5483 /* vec_vmsumshm */
5484
5485 static __inline__ vector int __attribute__((__always_inline__))
5486 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5487   return __builtin_altivec_vmsumshm(__a, __b, __c);
5488 }
5489
5490 /* vec_vmsumuhm */
5491
5492 static __inline__ vector unsigned int __attribute__((__always_inline__))
5493 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5494              vector unsigned int __c) {
5495   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5496 }
5497
5498 /* vec_msums */
5499
5500 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5501                                                     vector short __b,
5502                                                     vector int __c) {
5503   return __builtin_altivec_vmsumshs(__a, __b, __c);
5504 }
5505
5506 static __inline__ vector unsigned int __ATTRS_o_ai
5507 vec_msums(vector unsigned short __a, vector unsigned short __b,
5508           vector unsigned int __c) {
5509   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5510 }
5511
5512 /* vec_vmsumshs */
5513
5514 static __inline__ vector int __attribute__((__always_inline__))
5515 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5516   return __builtin_altivec_vmsumshs(__a, __b, __c);
5517 }
5518
5519 /* vec_vmsumuhs */
5520
5521 static __inline__ vector unsigned int __attribute__((__always_inline__))
5522 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5523              vector unsigned int __c) {
5524   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5525 }
5526
5527 /* vec_mtvscr */
5528
5529 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5530   __builtin_altivec_mtvscr((vector int)__a);
5531 }
5532
5533 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5534   __builtin_altivec_mtvscr((vector int)__a);
5535 }
5536
5537 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5538   __builtin_altivec_mtvscr((vector int)__a);
5539 }
5540
5541 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5542   __builtin_altivec_mtvscr((vector int)__a);
5543 }
5544
5545 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5546   __builtin_altivec_mtvscr((vector int)__a);
5547 }
5548
5549 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5550   __builtin_altivec_mtvscr((vector int)__a);
5551 }
5552
5553 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5554   __builtin_altivec_mtvscr((vector int)__a);
5555 }
5556
5557 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5558   __builtin_altivec_mtvscr((vector int)__a);
5559 }
5560
5561 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5562   __builtin_altivec_mtvscr((vector int)__a);
5563 }
5564
5565 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5566   __builtin_altivec_mtvscr((vector int)__a);
5567 }
5568
5569 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5570   __builtin_altivec_mtvscr((vector int)__a);
5571 }
5572
5573 /* vec_mul */
5574
5575 /* Integer vector multiplication will involve multiplication of the odd/even
5576    elements separately, then truncating the results and moving to the
5577    result vector.
5578 */
5579 static __inline__ vector signed char __ATTRS_o_ai
5580 vec_mul(vector signed char __a, vector signed char __b) {
5581   return __a * __b;
5582 }
5583
5584 static __inline__ vector unsigned char __ATTRS_o_ai
5585 vec_mul(vector unsigned char __a, vector unsigned char __b) {
5586   return __a * __b;
5587 }
5588
5589 static __inline__ vector signed short __ATTRS_o_ai
5590 vec_mul(vector signed short __a, vector signed short __b) {
5591   return __a * __b;
5592 }
5593
5594 static __inline__ vector unsigned short __ATTRS_o_ai
5595 vec_mul(vector unsigned short __a, vector unsigned short __b) {
5596   return __a * __b;
5597 }
5598
5599 static __inline__ vector signed int __ATTRS_o_ai
5600 vec_mul(vector signed int __a, vector signed int __b) {
5601   return __a * __b;
5602 }
5603
5604 static __inline__ vector unsigned int __ATTRS_o_ai
5605 vec_mul(vector unsigned int __a, vector unsigned int __b) {
5606   return __a * __b;
5607 }
5608
5609 #ifdef __VSX__
5610 static __inline__ vector signed long long __ATTRS_o_ai
5611 vec_mul(vector signed long long __a, vector signed long long __b) {
5612   return __a * __b;
5613 }
5614
5615 static __inline__ vector unsigned long long __ATTRS_o_ai
5616 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5617   return __a * __b;
5618 }
5619 #endif
5620
5621 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5622                                                     vector float __b) {
5623   return __a * __b;
5624 }
5625
5626 #ifdef __VSX__
5627 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5628                                                      vector double __b) {
5629   return __a * __b;
5630 }
5631 #endif
5632
5633 /* The vmulos* and vmules* instructions have a big endian bias, so
5634    we must reverse the meaning of "even" and "odd" for little endian.  */
5635
5636 /* vec_mule */
5637
5638 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5639                                                      vector signed char __b) {
5640 #ifdef __LITTLE_ENDIAN__
5641   return __builtin_altivec_vmulosb(__a, __b);
5642 #else
5643   return __builtin_altivec_vmulesb(__a, __b);
5644 #endif
5645 }
5646
5647 static __inline__ vector unsigned short __ATTRS_o_ai
5648 vec_mule(vector unsigned char __a, vector unsigned char __b) {
5649 #ifdef __LITTLE_ENDIAN__
5650   return __builtin_altivec_vmuloub(__a, __b);
5651 #else
5652   return __builtin_altivec_vmuleub(__a, __b);
5653 #endif
5654 }
5655
5656 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5657                                                    vector short __b) {
5658 #ifdef __LITTLE_ENDIAN__
5659   return __builtin_altivec_vmulosh(__a, __b);
5660 #else
5661   return __builtin_altivec_vmulesh(__a, __b);
5662 #endif
5663 }
5664
5665 static __inline__ vector unsigned int __ATTRS_o_ai
5666 vec_mule(vector unsigned short __a, vector unsigned short __b) {
5667 #ifdef __LITTLE_ENDIAN__
5668   return __builtin_altivec_vmulouh(__a, __b);
5669 #else
5670   return __builtin_altivec_vmuleuh(__a, __b);
5671 #endif
5672 }
5673
5674 #ifdef __POWER8_VECTOR__
5675 static __inline__ vector signed long long __ATTRS_o_ai
5676 vec_mule(vector signed int __a, vector signed int __b) {
5677 #ifdef __LITTLE_ENDIAN__
5678   return __builtin_altivec_vmulosw(__a, __b);
5679 #else
5680   return __builtin_altivec_vmulesw(__a, __b);
5681 #endif
5682 }
5683
5684 static __inline__ vector unsigned long long __ATTRS_o_ai
5685 vec_mule(vector unsigned int __a, vector unsigned int __b) {
5686 #ifdef __LITTLE_ENDIAN__
5687   return __builtin_altivec_vmulouw(__a, __b);
5688 #else
5689   return __builtin_altivec_vmuleuw(__a, __b);
5690 #endif
5691 }
5692 #endif
5693
5694 /* vec_vmulesb */
5695
5696 static __inline__ vector short __attribute__((__always_inline__))
5697 vec_vmulesb(vector signed char __a, vector signed char __b) {
5698 #ifdef __LITTLE_ENDIAN__
5699   return __builtin_altivec_vmulosb(__a, __b);
5700 #else
5701   return __builtin_altivec_vmulesb(__a, __b);
5702 #endif
5703 }
5704
5705 /* vec_vmuleub */
5706
5707 static __inline__ vector unsigned short __attribute__((__always_inline__))
5708 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5709 #ifdef __LITTLE_ENDIAN__
5710   return __builtin_altivec_vmuloub(__a, __b);
5711 #else
5712   return __builtin_altivec_vmuleub(__a, __b);
5713 #endif
5714 }
5715
5716 /* vec_vmulesh */
5717
5718 static __inline__ vector int __attribute__((__always_inline__))
5719 vec_vmulesh(vector short __a, vector short __b) {
5720 #ifdef __LITTLE_ENDIAN__
5721   return __builtin_altivec_vmulosh(__a, __b);
5722 #else
5723   return __builtin_altivec_vmulesh(__a, __b);
5724 #endif
5725 }
5726
5727 /* vec_vmuleuh */
5728
5729 static __inline__ vector unsigned int __attribute__((__always_inline__))
5730 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5731 #ifdef __LITTLE_ENDIAN__
5732   return __builtin_altivec_vmulouh(__a, __b);
5733 #else
5734   return __builtin_altivec_vmuleuh(__a, __b);
5735 #endif
5736 }
5737
5738 /* vec_mulo */
5739
5740 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5741                                                      vector signed char __b) {
5742 #ifdef __LITTLE_ENDIAN__
5743   return __builtin_altivec_vmulesb(__a, __b);
5744 #else
5745   return __builtin_altivec_vmulosb(__a, __b);
5746 #endif
5747 }
5748
5749 static __inline__ vector unsigned short __ATTRS_o_ai
5750 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5751 #ifdef __LITTLE_ENDIAN__
5752   return __builtin_altivec_vmuleub(__a, __b);
5753 #else
5754   return __builtin_altivec_vmuloub(__a, __b);
5755 #endif
5756 }
5757
5758 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5759                                                    vector short __b) {
5760 #ifdef __LITTLE_ENDIAN__
5761   return __builtin_altivec_vmulesh(__a, __b);
5762 #else
5763   return __builtin_altivec_vmulosh(__a, __b);
5764 #endif
5765 }
5766
5767 static __inline__ vector unsigned int __ATTRS_o_ai
5768 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5769 #ifdef __LITTLE_ENDIAN__
5770   return __builtin_altivec_vmuleuh(__a, __b);
5771 #else
5772   return __builtin_altivec_vmulouh(__a, __b);
5773 #endif
5774 }
5775
5776 #ifdef __POWER8_VECTOR__
5777 static __inline__ vector signed long long __ATTRS_o_ai
5778 vec_mulo(vector signed int __a, vector signed int __b) {
5779 #ifdef __LITTLE_ENDIAN__
5780   return __builtin_altivec_vmulesw(__a, __b);
5781 #else
5782   return __builtin_altivec_vmulosw(__a, __b);
5783 #endif
5784 }
5785
5786 static __inline__ vector unsigned long long __ATTRS_o_ai
5787 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5788 #ifdef __LITTLE_ENDIAN__
5789   return __builtin_altivec_vmuleuw(__a, __b);
5790 #else
5791   return __builtin_altivec_vmulouw(__a, __b);
5792 #endif
5793 }
5794 #endif
5795
5796 /* vec_vmulosb */
5797
5798 static __inline__ vector short __attribute__((__always_inline__))
5799 vec_vmulosb(vector signed char __a, vector signed char __b) {
5800 #ifdef __LITTLE_ENDIAN__
5801   return __builtin_altivec_vmulesb(__a, __b);
5802 #else
5803   return __builtin_altivec_vmulosb(__a, __b);
5804 #endif
5805 }
5806
5807 /* vec_vmuloub */
5808
5809 static __inline__ vector unsigned short __attribute__((__always_inline__))
5810 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5811 #ifdef __LITTLE_ENDIAN__
5812   return __builtin_altivec_vmuleub(__a, __b);
5813 #else
5814   return __builtin_altivec_vmuloub(__a, __b);
5815 #endif
5816 }
5817
5818 /* vec_vmulosh */
5819
5820 static __inline__ vector int __attribute__((__always_inline__))
5821 vec_vmulosh(vector short __a, vector short __b) {
5822 #ifdef __LITTLE_ENDIAN__
5823   return __builtin_altivec_vmulesh(__a, __b);
5824 #else
5825   return __builtin_altivec_vmulosh(__a, __b);
5826 #endif
5827 }
5828
5829 /* vec_vmulouh */
5830
5831 static __inline__ vector unsigned int __attribute__((__always_inline__))
5832 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5833 #ifdef __LITTLE_ENDIAN__
5834   return __builtin_altivec_vmuleuh(__a, __b);
5835 #else
5836   return __builtin_altivec_vmulouh(__a, __b);
5837 #endif
5838 }
5839
5840 /*  vec_nand */
5841
5842 #ifdef __POWER8_VECTOR__
5843 static __inline__ vector signed char __ATTRS_o_ai
5844 vec_nand(vector signed char __a, vector signed char __b) {
5845   return ~(__a & __b);
5846 }
5847
5848 static __inline__ vector signed char __ATTRS_o_ai
5849 vec_nand(vector signed char __a, vector bool char __b) {
5850   return ~(__a & __b);
5851 }
5852
5853 static __inline__ vector signed char __ATTRS_o_ai
5854 vec_nand(vector bool char __a, vector signed char __b) {
5855   return ~(__a & __b);
5856 }
5857
5858 static __inline__ vector unsigned char __ATTRS_o_ai
5859 vec_nand(vector unsigned char __a, vector unsigned char __b) {
5860   return ~(__a & __b);
5861 }
5862
5863 static __inline__ vector unsigned char __ATTRS_o_ai
5864 vec_nand(vector unsigned char __a, vector bool char __b) {
5865   return ~(__a & __b);
5866 }
5867
5868 static __inline__ vector unsigned char __ATTRS_o_ai
5869 vec_nand(vector bool char __a, vector unsigned char __b) {
5870   return ~(__a & __b);
5871 }
5872
5873 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5874                                                          vector bool char __b) {
5875   return ~(__a & __b);
5876 }
5877
5878 static __inline__ vector signed short __ATTRS_o_ai
5879 vec_nand(vector signed short __a, vector signed short __b) {
5880   return ~(__a & __b);
5881 }
5882
5883 static __inline__ vector signed short __ATTRS_o_ai
5884 vec_nand(vector signed short __a, vector bool short __b) {
5885   return ~(__a & __b);
5886 }
5887
5888 static __inline__ vector signed short __ATTRS_o_ai
5889 vec_nand(vector bool short __a, vector signed short __b) {
5890   return ~(__a & __b);
5891 }
5892
5893 static __inline__ vector unsigned short __ATTRS_o_ai
5894 vec_nand(vector unsigned short __a, vector unsigned short __b) {
5895   return ~(__a & __b);
5896 }
5897
5898 static __inline__ vector unsigned short __ATTRS_o_ai
5899 vec_nand(vector unsigned short __a, vector bool short __b) {
5900   return ~(__a & __b);
5901 }
5902
5903 static __inline__ vector bool short __ATTRS_o_ai
5904 vec_nand(vector bool short __a, vector bool short __b) {
5905   return ~(__a & __b);
5906 }
5907
5908 static __inline__ vector signed int __ATTRS_o_ai
5909 vec_nand(vector signed int __a, vector signed int __b) {
5910   return ~(__a & __b);
5911 }
5912
5913 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5914                                                           vector bool int __b) {
5915   return ~(__a & __b);
5916 }
5917
5918 static __inline__ vector signed int __ATTRS_o_ai
5919 vec_nand(vector bool int __a, vector signed int __b) {
5920   return ~(__a & __b);
5921 }
5922
5923 static __inline__ vector unsigned int __ATTRS_o_ai
5924 vec_nand(vector unsigned int __a, vector unsigned int __b) {
5925   return ~(__a & __b);
5926 }
5927
5928 static __inline__ vector unsigned int __ATTRS_o_ai
5929 vec_nand(vector unsigned int __a, vector bool int __b) {
5930   return ~(__a & __b);
5931 }
5932
5933 static __inline__ vector unsigned int __ATTRS_o_ai
5934 vec_nand(vector bool int __a, vector unsigned int __b) {
5935   return ~(__a & __b);
5936 }
5937
5938 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5939                                                         vector bool int __b) {
5940   return ~(__a & __b);
5941 }
5942
5943 static __inline__ vector float __ATTRS_o_ai
5944 vec_nand(vector float __a, vector float __b) {
5945   return (vector float)(~((vector unsigned int)__a &
5946                           (vector unsigned int)__b));
5947 }
5948
5949 static __inline__ vector signed long long __ATTRS_o_ai
5950 vec_nand(vector signed long long __a, vector signed long long __b) {
5951   return ~(__a & __b);
5952 }
5953
5954 static __inline__ vector signed long long __ATTRS_o_ai
5955 vec_nand(vector signed long long __a, vector bool long long __b) {
5956   return ~(__a & __b);
5957 }
5958
5959 static __inline__ vector signed long long __ATTRS_o_ai
5960 vec_nand(vector bool long long __a, vector signed long long __b) {
5961   return ~(__a & __b);
5962 }
5963
5964 static __inline__ vector unsigned long long __ATTRS_o_ai
5965 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5966   return ~(__a & __b);
5967 }
5968
5969 static __inline__ vector unsigned long long __ATTRS_o_ai
5970 vec_nand(vector unsigned long long __a, vector bool long long __b) {
5971   return ~(__a & __b);
5972 }
5973
5974 static __inline__ vector unsigned long long __ATTRS_o_ai
5975 vec_nand(vector bool long long __a, vector unsigned long long __b) {
5976   return ~(__a & __b);
5977 }
5978
5979 static __inline__ vector bool long long __ATTRS_o_ai
5980 vec_nand(vector bool long long __a, vector bool long long __b) {
5981   return ~(__a & __b);
5982 }
5983
5984 static __inline__ vector double __ATTRS_o_ai
5985 vec_nand(vector double __a, vector double __b) {
5986   return (vector double)(~((vector unsigned long long)__a &
5987                            (vector unsigned long long)__b));
5988 }
5989
5990 #endif
5991
5992 /* vec_nmadd */
5993
5994 #ifdef __VSX__
5995 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
5996                                                       vector float __b,
5997                                                       vector float __c) {
5998   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
5999 }
6000
6001 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6002                                                        vector double __b,
6003                                                        vector double __c) {
6004   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6005 }
6006 #endif
6007
6008 /* vec_nmsub */
6009
6010 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6011                                                       vector float __b,
6012                                                       vector float __c) {
6013 #ifdef __VSX__
6014   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6015 #else
6016   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6017 #endif
6018 }
6019
6020 #ifdef __VSX__
6021 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6022                                                        vector double __b,
6023                                                        vector double __c) {
6024   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6025 }
6026 #endif
6027
6028 /* vec_vnmsubfp */
6029
6030 static __inline__ vector float __attribute__((__always_inline__))
6031 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6032   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6033 }
6034
6035 /* vec_nor */
6036
6037 #define __builtin_altivec_vnor vec_nor
6038
6039 static __inline__ vector signed char __ATTRS_o_ai
6040 vec_nor(vector signed char __a, vector signed char __b) {
6041   return ~(__a | __b);
6042 }
6043
6044 static __inline__ vector unsigned char __ATTRS_o_ai
6045 vec_nor(vector unsigned char __a, vector unsigned char __b) {
6046   return ~(__a | __b);
6047 }
6048
6049 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6050                                                         vector bool char __b) {
6051   return ~(__a | __b);
6052 }
6053
6054 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6055                                                     vector short __b) {
6056   return ~(__a | __b);
6057 }
6058
6059 static __inline__ vector unsigned short __ATTRS_o_ai
6060 vec_nor(vector unsigned short __a, vector unsigned short __b) {
6061   return ~(__a | __b);
6062 }
6063
6064 static __inline__ vector bool short __ATTRS_o_ai
6065 vec_nor(vector bool short __a, vector bool short __b) {
6066   return ~(__a | __b);
6067 }
6068
6069 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6070                                                   vector int __b) {
6071   return ~(__a | __b);
6072 }
6073
6074 static __inline__ vector unsigned int __ATTRS_o_ai
6075 vec_nor(vector unsigned int __a, vector unsigned int __b) {
6076   return ~(__a | __b);
6077 }
6078
6079 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6080                                                        vector bool int __b) {
6081   return ~(__a | __b);
6082 }
6083
6084 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6085                                                     vector float __b) {
6086   vector unsigned int __res =
6087       ~((vector unsigned int)__a | (vector unsigned int)__b);
6088   return (vector float)__res;
6089 }
6090
6091 #ifdef __VSX__
6092 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6093                                                      vector double __b) {
6094   vector unsigned long long __res =
6095       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6096   return (vector double)__res;
6097 }
6098 #endif
6099
6100 /* vec_vnor */
6101
6102 static __inline__ vector signed char __ATTRS_o_ai
6103 vec_vnor(vector signed char __a, vector signed char __b) {
6104   return ~(__a | __b);
6105 }
6106
6107 static __inline__ vector unsigned char __ATTRS_o_ai
6108 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6109   return ~(__a | __b);
6110 }
6111
6112 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6113                                                          vector bool char __b) {
6114   return ~(__a | __b);
6115 }
6116
6117 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6118                                                      vector short __b) {
6119   return ~(__a | __b);
6120 }
6121
6122 static __inline__ vector unsigned short __ATTRS_o_ai
6123 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6124   return ~(__a | __b);
6125 }
6126
6127 static __inline__ vector bool short __ATTRS_o_ai
6128 vec_vnor(vector bool short __a, vector bool short __b) {
6129   return ~(__a | __b);
6130 }
6131
6132 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6133                                                    vector int __b) {
6134   return ~(__a | __b);
6135 }
6136
6137 static __inline__ vector unsigned int __ATTRS_o_ai
6138 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6139   return ~(__a | __b);
6140 }
6141
6142 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6143                                                         vector bool int __b) {
6144   return ~(__a | __b);
6145 }
6146
6147 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6148                                                      vector float __b) {
6149   vector unsigned int __res =
6150       ~((vector unsigned int)__a | (vector unsigned int)__b);
6151   return (vector float)__res;
6152 }
6153
6154 #ifdef __VSX__
6155 static __inline__ vector signed long long __ATTRS_o_ai
6156 vec_nor(vector signed long long __a, vector signed long long __b) {
6157   return ~(__a | __b);
6158 }
6159
6160 static __inline__ vector unsigned long long __ATTRS_o_ai
6161 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6162   return ~(__a | __b);
6163 }
6164
6165 static __inline__ vector bool long long __ATTRS_o_ai
6166 vec_nor(vector bool long long __a, vector bool long long __b) {
6167   return ~(__a | __b);
6168 }
6169 #endif
6170
6171 /* vec_or */
6172
6173 #define __builtin_altivec_vor vec_or
6174
6175 static __inline__ vector signed char __ATTRS_o_ai
6176 vec_or(vector signed char __a, vector signed char __b) {
6177   return __a | __b;
6178 }
6179
6180 static __inline__ vector signed char __ATTRS_o_ai
6181 vec_or(vector bool char __a, vector signed char __b) {
6182   return (vector signed char)__a | __b;
6183 }
6184
6185 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6186                                                          vector bool char __b) {
6187   return __a | (vector signed char)__b;
6188 }
6189
6190 static __inline__ vector unsigned char __ATTRS_o_ai
6191 vec_or(vector unsigned char __a, vector unsigned char __b) {
6192   return __a | __b;
6193 }
6194
6195 static __inline__ vector unsigned char __ATTRS_o_ai
6196 vec_or(vector bool char __a, vector unsigned char __b) {
6197   return (vector unsigned char)__a | __b;
6198 }
6199
6200 static __inline__ vector unsigned char __ATTRS_o_ai
6201 vec_or(vector unsigned char __a, vector bool char __b) {
6202   return __a | (vector unsigned char)__b;
6203 }
6204
6205 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6206                                                        vector bool char __b) {
6207   return __a | __b;
6208 }
6209
6210 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6211                                                    vector short __b) {
6212   return __a | __b;
6213 }
6214
6215 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6216                                                    vector short __b) {
6217   return (vector short)__a | __b;
6218 }
6219
6220 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6221                                                    vector bool short __b) {
6222   return __a | (vector short)__b;
6223 }
6224
6225 static __inline__ vector unsigned short __ATTRS_o_ai
6226 vec_or(vector unsigned short __a, vector unsigned short __b) {
6227   return __a | __b;
6228 }
6229
6230 static __inline__ vector unsigned short __ATTRS_o_ai
6231 vec_or(vector bool short __a, vector unsigned short __b) {
6232   return (vector unsigned short)__a | __b;
6233 }
6234
6235 static __inline__ vector unsigned short __ATTRS_o_ai
6236 vec_or(vector unsigned short __a, vector bool short __b) {
6237   return __a | (vector unsigned short)__b;
6238 }
6239
6240 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6241                                                         vector bool short __b) {
6242   return __a | __b;
6243 }
6244
6245 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6246                                                  vector int __b) {
6247   return __a | __b;
6248 }
6249
6250 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6251                                                  vector int __b) {
6252   return (vector int)__a | __b;
6253 }
6254
6255 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6256                                                  vector bool int __b) {
6257   return __a | (vector int)__b;
6258 }
6259
6260 static __inline__ vector unsigned int __ATTRS_o_ai
6261 vec_or(vector unsigned int __a, vector unsigned int __b) {
6262   return __a | __b;
6263 }
6264
6265 static __inline__ vector unsigned int __ATTRS_o_ai
6266 vec_or(vector bool int __a, vector unsigned int __b) {
6267   return (vector unsigned int)__a | __b;
6268 }
6269
6270 static __inline__ vector unsigned int __ATTRS_o_ai
6271 vec_or(vector unsigned int __a, vector bool int __b) {
6272   return __a | (vector unsigned int)__b;
6273 }
6274
6275 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6276                                                       vector bool int __b) {
6277   return __a | __b;
6278 }
6279
6280 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6281                                                    vector float __b) {
6282   vector unsigned int __res =
6283       (vector unsigned int)__a | (vector unsigned int)__b;
6284   return (vector float)__res;
6285 }
6286
6287 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6288                                                    vector float __b) {
6289   vector unsigned int __res =
6290       (vector unsigned int)__a | (vector unsigned int)__b;
6291   return (vector float)__res;
6292 }
6293
6294 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6295                                                    vector bool int __b) {
6296   vector unsigned int __res =
6297       (vector unsigned int)__a | (vector unsigned int)__b;
6298   return (vector float)__res;
6299 }
6300
6301 #ifdef __VSX__
6302 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6303                                                     vector double __b) {
6304   return (vector unsigned long long)__a | (vector unsigned long long)__b;
6305 }
6306
6307 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6308                                                     vector bool long long __b) {
6309   return (vector unsigned long long)__a | (vector unsigned long long)__b;
6310 }
6311
6312 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6313                                                     vector double __b) {
6314   vector unsigned long long __res =
6315       (vector unsigned long long)__a | (vector unsigned long long)__b;
6316   return (vector double)__res;
6317 }
6318
6319 static __inline__ vector signed long long __ATTRS_o_ai
6320 vec_or(vector signed long long __a, vector signed long long __b) {
6321   return __a | __b;
6322 }
6323
6324 static __inline__ vector signed long long __ATTRS_o_ai
6325 vec_or(vector bool long long __a, vector signed long long __b) {
6326   return (vector signed long long)__a | __b;
6327 }
6328
6329 static __inline__ vector signed long long __ATTRS_o_ai
6330 vec_or(vector signed long long __a, vector bool long long __b) {
6331   return __a | (vector signed long long)__b;
6332 }
6333
6334 static __inline__ vector unsigned long long __ATTRS_o_ai
6335 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6336   return __a | __b;
6337 }
6338
6339 static __inline__ vector unsigned long long __ATTRS_o_ai
6340 vec_or(vector bool long long __a, vector unsigned long long __b) {
6341   return (vector unsigned long long)__a | __b;
6342 }
6343
6344 static __inline__ vector unsigned long long __ATTRS_o_ai
6345 vec_or(vector unsigned long long __a, vector bool long long __b) {
6346   return __a | (vector unsigned long long)__b;
6347 }
6348
6349 static __inline__ vector bool long long __ATTRS_o_ai
6350 vec_or(vector bool long long __a, vector bool long long __b) {
6351   return __a | __b;
6352 }
6353 #endif
6354
6355 #ifdef __POWER8_VECTOR__
6356 static __inline__ vector signed char __ATTRS_o_ai
6357 vec_orc(vector signed char __a, vector signed char __b) {
6358   return __a | ~__b;
6359 }
6360
6361 static __inline__ vector signed char __ATTRS_o_ai
6362 vec_orc(vector signed char __a, vector bool char __b) {
6363   return __a | ~__b;
6364 }
6365
6366 static __inline__ vector signed char __ATTRS_o_ai
6367 vec_orc(vector bool char __a, vector signed char __b) {
6368   return __a | ~__b;
6369 }
6370
6371 static __inline__ vector unsigned char __ATTRS_o_ai
6372 vec_orc(vector unsigned char __a, vector unsigned char __b) {
6373   return __a | ~__b;
6374 }
6375
6376 static __inline__ vector unsigned char __ATTRS_o_ai
6377 vec_orc(vector unsigned char __a, vector bool char __b) {
6378   return __a | ~__b;
6379 }
6380
6381 static __inline__ vector unsigned char __ATTRS_o_ai
6382 vec_orc(vector bool char __a, vector unsigned char __b) {
6383   return __a | ~__b;
6384 }
6385
6386 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6387                                                         vector bool char __b) {
6388   return __a | ~__b;
6389 }
6390
6391 static __inline__ vector signed short __ATTRS_o_ai
6392 vec_orc(vector signed short __a, vector signed short __b) {
6393   return __a | ~__b;
6394 }
6395
6396 static __inline__ vector signed short __ATTRS_o_ai
6397 vec_orc(vector signed short __a, vector bool short __b) {
6398   return __a | ~__b;
6399 }
6400
6401 static __inline__ vector signed short __ATTRS_o_ai
6402 vec_orc(vector bool short __a, vector signed short __b) {
6403   return __a | ~__b;
6404 }
6405
6406 static __inline__ vector unsigned short __ATTRS_o_ai
6407 vec_orc(vector unsigned short __a, vector unsigned short __b) {
6408   return __a | ~__b;
6409 }
6410
6411 static __inline__ vector unsigned short __ATTRS_o_ai
6412 vec_orc(vector unsigned short __a, vector bool short __b) {
6413   return __a | ~__b;
6414 }
6415
6416 static __inline__ vector unsigned short __ATTRS_o_ai
6417 vec_orc(vector bool short __a, vector unsigned short __b) {
6418   return __a | ~__b;
6419 }
6420
6421 static __inline__ vector bool short __ATTRS_o_ai
6422 vec_orc(vector bool short __a, vector bool short __b) {
6423   return __a | ~__b;
6424 }
6425
6426 static __inline__ vector signed int __ATTRS_o_ai
6427 vec_orc(vector signed int __a, vector signed int __b) {
6428   return __a | ~__b;
6429 }
6430
6431 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6432                                                          vector bool int __b) {
6433   return __a | ~__b;
6434 }
6435
6436 static __inline__ vector signed int __ATTRS_o_ai
6437 vec_orc(vector bool int __a, vector signed int __b) {
6438   return __a | ~__b;
6439 }
6440
6441 static __inline__ vector unsigned int __ATTRS_o_ai
6442 vec_orc(vector unsigned int __a, vector unsigned int __b) {
6443   return __a | ~__b;
6444 }
6445
6446 static __inline__ vector unsigned int __ATTRS_o_ai
6447 vec_orc(vector unsigned int __a, vector bool int __b) {
6448   return __a | ~__b;
6449 }
6450
6451 static __inline__ vector unsigned int __ATTRS_o_ai
6452 vec_orc(vector bool int __a, vector unsigned int __b) {
6453   return __a | ~__b;
6454 }
6455
6456 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6457                                                        vector bool int __b) {
6458   return __a | ~__b;
6459 }
6460
6461 static __inline__ vector float __ATTRS_o_ai
6462 vec_orc(vector bool int __a, vector float __b) {
6463  return (vector float)(__a | ~(vector unsigned int)__b);
6464 }
6465
6466 static __inline__ vector float __ATTRS_o_ai
6467 vec_orc(vector float __a, vector bool int __b) {
6468   return (vector float)((vector unsigned int)__a | ~__b);
6469 }
6470
6471 static __inline__ vector signed long long __ATTRS_o_ai
6472 vec_orc(vector signed long long __a, vector signed long long __b) {
6473   return __a | ~__b;
6474 }
6475
6476 static __inline__ vector signed long long __ATTRS_o_ai
6477 vec_orc(vector signed long long __a, vector bool long long __b) {
6478   return __a | ~__b;
6479 }
6480
6481 static __inline__ vector signed long long __ATTRS_o_ai
6482 vec_orc(vector bool long long __a, vector signed long long __b) {
6483   return __a | ~__b;
6484 }
6485
6486 static __inline__ vector unsigned long long __ATTRS_o_ai
6487 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6488   return __a | ~__b;
6489 }
6490
6491 static __inline__ vector unsigned long long __ATTRS_o_ai
6492 vec_orc(vector unsigned long long __a, vector bool long long __b) {
6493   return __a | ~__b;
6494 }
6495
6496 static __inline__ vector unsigned long long __ATTRS_o_ai
6497 vec_orc(vector bool long long __a, vector unsigned long long __b) {
6498   return __a | ~__b;
6499 }
6500
6501 static __inline__ vector bool long long __ATTRS_o_ai
6502 vec_orc(vector bool long long __a, vector bool long long __b) {
6503   return __a | ~__b;
6504 }
6505
6506 static __inline__ vector double __ATTRS_o_ai
6507 vec_orc(vector double __a, vector bool long long __b) {
6508   return (vector double)((vector unsigned long long)__a | ~__b);
6509 }
6510
6511 static __inline__ vector double __ATTRS_o_ai
6512 vec_orc(vector bool long long __a, vector double __b) {
6513   return (vector double)(__a | ~(vector unsigned long long)__b);
6514 }
6515 #endif
6516
6517 /* vec_vor */
6518
6519 static __inline__ vector signed char __ATTRS_o_ai
6520 vec_vor(vector signed char __a, vector signed char __b) {
6521   return __a | __b;
6522 }
6523
6524 static __inline__ vector signed char __ATTRS_o_ai
6525 vec_vor(vector bool char __a, vector signed char __b) {
6526   return (vector signed char)__a | __b;
6527 }
6528
6529 static __inline__ vector signed char __ATTRS_o_ai
6530 vec_vor(vector signed char __a, vector bool char __b) {
6531   return __a | (vector signed char)__b;
6532 }
6533
6534 static __inline__ vector unsigned char __ATTRS_o_ai
6535 vec_vor(vector unsigned char __a, vector unsigned char __b) {
6536   return __a | __b;
6537 }
6538
6539 static __inline__ vector unsigned char __ATTRS_o_ai
6540 vec_vor(vector bool char __a, vector unsigned char __b) {
6541   return (vector unsigned char)__a | __b;
6542 }
6543
6544 static __inline__ vector unsigned char __ATTRS_o_ai
6545 vec_vor(vector unsigned char __a, vector bool char __b) {
6546   return __a | (vector unsigned char)__b;
6547 }
6548
6549 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6550                                                         vector bool char __b) {
6551   return __a | __b;
6552 }
6553
6554 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6555                                                     vector short __b) {
6556   return __a | __b;
6557 }
6558
6559 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6560                                                     vector short __b) {
6561   return (vector short)__a | __b;
6562 }
6563
6564 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6565                                                     vector bool short __b) {
6566   return __a | (vector short)__b;
6567 }
6568
6569 static __inline__ vector unsigned short __ATTRS_o_ai
6570 vec_vor(vector unsigned short __a, vector unsigned short __b) {
6571   return __a | __b;
6572 }
6573
6574 static __inline__ vector unsigned short __ATTRS_o_ai
6575 vec_vor(vector bool short __a, vector unsigned short __b) {
6576   return (vector unsigned short)__a | __b;
6577 }
6578
6579 static __inline__ vector unsigned short __ATTRS_o_ai
6580 vec_vor(vector unsigned short __a, vector bool short __b) {
6581   return __a | (vector unsigned short)__b;
6582 }
6583
6584 static __inline__ vector bool short __ATTRS_o_ai
6585 vec_vor(vector bool short __a, vector bool short __b) {
6586   return __a | __b;
6587 }
6588
6589 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6590                                                   vector int __b) {
6591   return __a | __b;
6592 }
6593
6594 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6595                                                   vector int __b) {
6596   return (vector int)__a | __b;
6597 }
6598
6599 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6600                                                   vector bool int __b) {
6601   return __a | (vector int)__b;
6602 }
6603
6604 static __inline__ vector unsigned int __ATTRS_o_ai
6605 vec_vor(vector unsigned int __a, vector unsigned int __b) {
6606   return __a | __b;
6607 }
6608
6609 static __inline__ vector unsigned int __ATTRS_o_ai
6610 vec_vor(vector bool int __a, vector unsigned int __b) {
6611   return (vector unsigned int)__a | __b;
6612 }
6613
6614 static __inline__ vector unsigned int __ATTRS_o_ai
6615 vec_vor(vector unsigned int __a, vector bool int __b) {
6616   return __a | (vector unsigned int)__b;
6617 }
6618
6619 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6620                                                        vector bool int __b) {
6621   return __a | __b;
6622 }
6623
6624 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6625                                                     vector float __b) {
6626   vector unsigned int __res =
6627       (vector unsigned int)__a | (vector unsigned int)__b;
6628   return (vector float)__res;
6629 }
6630
6631 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6632                                                     vector float __b) {
6633   vector unsigned int __res =
6634       (vector unsigned int)__a | (vector unsigned int)__b;
6635   return (vector float)__res;
6636 }
6637
6638 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6639                                                     vector bool int __b) {
6640   vector unsigned int __res =
6641       (vector unsigned int)__a | (vector unsigned int)__b;
6642   return (vector float)__res;
6643 }
6644
6645 #ifdef __VSX__
6646 static __inline__ vector signed long long __ATTRS_o_ai
6647 vec_vor(vector signed long long __a, vector signed long long __b) {
6648   return __a | __b;
6649 }
6650
6651 static __inline__ vector signed long long __ATTRS_o_ai
6652 vec_vor(vector bool long long __a, vector signed long long __b) {
6653   return (vector signed long long)__a | __b;
6654 }
6655
6656 static __inline__ vector signed long long __ATTRS_o_ai
6657 vec_vor(vector signed long long __a, vector bool long long __b) {
6658   return __a | (vector signed long long)__b;
6659 }
6660
6661 static __inline__ vector unsigned long long __ATTRS_o_ai
6662 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6663   return __a | __b;
6664 }
6665
6666 static __inline__ vector unsigned long long __ATTRS_o_ai
6667 vec_vor(vector bool long long __a, vector unsigned long long __b) {
6668   return (vector unsigned long long)__a | __b;
6669 }
6670
6671 static __inline__ vector unsigned long long __ATTRS_o_ai
6672 vec_vor(vector unsigned long long __a, vector bool long long __b) {
6673   return __a | (vector unsigned long long)__b;
6674 }
6675
6676 static __inline__ vector bool long long __ATTRS_o_ai
6677 vec_vor(vector bool long long __a, vector bool long long __b) {
6678   return __a | __b;
6679 }
6680 #endif
6681
6682 /* vec_pack */
6683
6684 /* The various vector pack instructions have a big-endian bias, so for
6685    little endian we must handle reversed element numbering.  */
6686
6687 static __inline__ vector signed char __ATTRS_o_ai
6688 vec_pack(vector signed short __a, vector signed short __b) {
6689 #ifdef __LITTLE_ENDIAN__
6690   return (vector signed char)vec_perm(
6691       __a, __b,
6692       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6693                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6694 #else
6695   return (vector signed char)vec_perm(
6696       __a, __b,
6697       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6698                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6699 #endif
6700 }
6701
6702 static __inline__ vector unsigned char __ATTRS_o_ai
6703 vec_pack(vector unsigned short __a, vector unsigned short __b) {
6704 #ifdef __LITTLE_ENDIAN__
6705   return (vector unsigned char)vec_perm(
6706       __a, __b,
6707       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6708                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6709 #else
6710   return (vector unsigned char)vec_perm(
6711       __a, __b,
6712       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6713                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6714 #endif
6715 }
6716
6717 static __inline__ vector bool char __ATTRS_o_ai
6718 vec_pack(vector bool short __a, vector bool short __b) {
6719 #ifdef __LITTLE_ENDIAN__
6720   return (vector bool char)vec_perm(
6721       __a, __b,
6722       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6723                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6724 #else
6725   return (vector bool char)vec_perm(
6726       __a, __b,
6727       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6728                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6729 #endif
6730 }
6731
6732 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6733                                                      vector int __b) {
6734 #ifdef __LITTLE_ENDIAN__
6735   return (vector short)vec_perm(
6736       __a, __b,
6737       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6738                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6739 #else
6740   return (vector short)vec_perm(
6741       __a, __b,
6742       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6743                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6744 #endif
6745 }
6746
6747 static __inline__ vector unsigned short __ATTRS_o_ai
6748 vec_pack(vector unsigned int __a, vector unsigned int __b) {
6749 #ifdef __LITTLE_ENDIAN__
6750   return (vector unsigned short)vec_perm(
6751       __a, __b,
6752       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6753                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6754 #else
6755   return (vector unsigned short)vec_perm(
6756       __a, __b,
6757       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6758                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6759 #endif
6760 }
6761
6762 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6763                                                           vector bool int __b) {
6764 #ifdef __LITTLE_ENDIAN__
6765   return (vector bool short)vec_perm(
6766       __a, __b,
6767       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6768                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6769 #else
6770   return (vector bool short)vec_perm(
6771       __a, __b,
6772       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6773                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6774 #endif
6775 }
6776
6777 #ifdef __VSX__
6778 static __inline__ vector signed int __ATTRS_o_ai
6779 vec_pack(vector signed long long __a, vector signed long long __b) {
6780 #ifdef __LITTLE_ENDIAN__
6781   return (vector signed int)vec_perm(
6782       __a, __b,
6783       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6784                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6785 #else
6786   return (vector signed int)vec_perm(
6787       __a, __b,
6788       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6789                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6790 #endif
6791 }
6792 static __inline__ vector unsigned int __ATTRS_o_ai
6793 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6794 #ifdef __LITTLE_ENDIAN__
6795   return (vector unsigned int)vec_perm(
6796       __a, __b,
6797       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6798                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6799 #else
6800   return (vector unsigned int)vec_perm(
6801       __a, __b,
6802       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6803                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6804 #endif
6805 }
6806
6807 static __inline__ vector bool int __ATTRS_o_ai
6808 vec_pack(vector bool long long __a, vector bool long long __b) {
6809 #ifdef __LITTLE_ENDIAN__
6810   return (vector bool int)vec_perm(
6811       __a, __b,
6812       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6813                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6814 #else
6815   return (vector bool int)vec_perm(
6816       __a, __b,
6817       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6818                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6819 #endif
6820 }
6821
6822 static __inline__ vector float __ATTRS_o_ai
6823 vec_pack(vector double __a, vector double __b) {
6824   return (vector float) (__a[0], __a[1], __b[0], __b[1]);
6825 }
6826 #endif
6827
6828 #ifdef __POWER9_VECTOR__
6829 static __inline__ vector unsigned short __ATTRS_o_ai
6830 vec_pack_to_short_fp32(vector float __a, vector float __b) {
6831   vector float __resa = __builtin_vsx_xvcvsphp(__a);
6832   vector float __resb = __builtin_vsx_xvcvsphp(__b);
6833 #ifdef __LITTLE_ENDIAN__
6834   return (vector unsigned short)vec_mergee(__resa, __resb);
6835 #else
6836   return (vector unsigned short)vec_mergeo(__resa, __resb);
6837 #endif
6838 }
6839
6840 #endif
6841 /* vec_vpkuhum */
6842
6843 #define __builtin_altivec_vpkuhum vec_vpkuhum
6844
6845 static __inline__ vector signed char __ATTRS_o_ai
6846 vec_vpkuhum(vector signed short __a, vector signed short __b) {
6847 #ifdef __LITTLE_ENDIAN__
6848   return (vector signed char)vec_perm(
6849       __a, __b,
6850       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6851                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6852 #else
6853   return (vector signed char)vec_perm(
6854       __a, __b,
6855       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6856                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6857 #endif
6858 }
6859
6860 static __inline__ vector unsigned char __ATTRS_o_ai
6861 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6862 #ifdef __LITTLE_ENDIAN__
6863   return (vector unsigned char)vec_perm(
6864       __a, __b,
6865       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6866                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6867 #else
6868   return (vector unsigned char)vec_perm(
6869       __a, __b,
6870       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6871                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6872 #endif
6873 }
6874
6875 static __inline__ vector bool char __ATTRS_o_ai
6876 vec_vpkuhum(vector bool short __a, vector bool short __b) {
6877 #ifdef __LITTLE_ENDIAN__
6878   return (vector bool char)vec_perm(
6879       __a, __b,
6880       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6881                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6882 #else
6883   return (vector bool char)vec_perm(
6884       __a, __b,
6885       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6886                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6887 #endif
6888 }
6889
6890 /* vec_vpkuwum */
6891
6892 #define __builtin_altivec_vpkuwum vec_vpkuwum
6893
6894 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6895                                                         vector int __b) {
6896 #ifdef __LITTLE_ENDIAN__
6897   return (vector short)vec_perm(
6898       __a, __b,
6899       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6900                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6901 #else
6902   return (vector short)vec_perm(
6903       __a, __b,
6904       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6905                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6906 #endif
6907 }
6908
6909 static __inline__ vector unsigned short __ATTRS_o_ai
6910 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6911 #ifdef __LITTLE_ENDIAN__
6912   return (vector unsigned short)vec_perm(
6913       __a, __b,
6914       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6915                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6916 #else
6917   return (vector unsigned short)vec_perm(
6918       __a, __b,
6919       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6920                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6921 #endif
6922 }
6923
6924 static __inline__ vector bool short __ATTRS_o_ai
6925 vec_vpkuwum(vector bool int __a, vector bool int __b) {
6926 #ifdef __LITTLE_ENDIAN__
6927   return (vector bool short)vec_perm(
6928       __a, __b,
6929       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6930                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6931 #else
6932   return (vector bool short)vec_perm(
6933       __a, __b,
6934       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6935                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6936 #endif
6937 }
6938
6939 /* vec_vpkudum */
6940
6941 #ifdef __POWER8_VECTOR__
6942 #define __builtin_altivec_vpkudum vec_vpkudum
6943
6944 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6945                                                       vector long long __b) {
6946 #ifdef __LITTLE_ENDIAN__
6947   return (vector int)vec_perm(
6948       __a, __b,
6949       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6950                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6951 #else
6952   return (vector int)vec_perm(
6953       __a, __b,
6954       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6955                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6956 #endif
6957 }
6958
6959 static __inline__ vector unsigned int __ATTRS_o_ai
6960 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6961 #ifdef __LITTLE_ENDIAN__
6962   return (vector unsigned int)vec_perm(
6963       __a, __b,
6964       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6965                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6966 #else
6967   return (vector unsigned int)vec_perm(
6968       __a, __b,
6969       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6970                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6971 #endif
6972 }
6973
6974 static __inline__ vector bool int __ATTRS_o_ai
6975 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6976 #ifdef __LITTLE_ENDIAN__
6977   return (vector bool int)vec_perm(
6978       (vector long long)__a, (vector long long)__b,
6979       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6980                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6981 #else
6982   return (vector bool int)vec_perm(
6983       (vector long long)__a, (vector long long)__b,
6984       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6985                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6986 #endif
6987 }
6988 #endif
6989
6990 /* vec_packpx */
6991
6992 static __inline__ vector pixel __attribute__((__always_inline__))
6993 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
6994 #ifdef __LITTLE_ENDIAN__
6995   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
6996 #else
6997   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
6998 #endif
6999 }
7000
7001 /* vec_vpkpx */
7002
7003 static __inline__ vector pixel __attribute__((__always_inline__))
7004 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7005 #ifdef __LITTLE_ENDIAN__
7006   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7007 #else
7008   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7009 #endif
7010 }
7011
7012 /* vec_packs */
7013
7014 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7015                                                             vector short __b) {
7016 #ifdef __LITTLE_ENDIAN__
7017   return __builtin_altivec_vpkshss(__b, __a);
7018 #else
7019   return __builtin_altivec_vpkshss(__a, __b);
7020 #endif
7021 }
7022
7023 static __inline__ vector unsigned char __ATTRS_o_ai
7024 vec_packs(vector unsigned short __a, vector unsigned short __b) {
7025 #ifdef __LITTLE_ENDIAN__
7026   return __builtin_altivec_vpkuhus(__b, __a);
7027 #else
7028   return __builtin_altivec_vpkuhus(__a, __b);
7029 #endif
7030 }
7031
7032 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7033                                                              vector int __b) {
7034 #ifdef __LITTLE_ENDIAN__
7035   return __builtin_altivec_vpkswss(__b, __a);
7036 #else
7037   return __builtin_altivec_vpkswss(__a, __b);
7038 #endif
7039 }
7040
7041 static __inline__ vector unsigned short __ATTRS_o_ai
7042 vec_packs(vector unsigned int __a, vector unsigned int __b) {
7043 #ifdef __LITTLE_ENDIAN__
7044   return __builtin_altivec_vpkuwus(__b, __a);
7045 #else
7046   return __builtin_altivec_vpkuwus(__a, __b);
7047 #endif
7048 }
7049
7050 #ifdef __POWER8_VECTOR__
7051 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7052                                                     vector long long __b) {
7053 #ifdef __LITTLE_ENDIAN__
7054   return __builtin_altivec_vpksdss(__b, __a);
7055 #else
7056   return __builtin_altivec_vpksdss(__a, __b);
7057 #endif
7058 }
7059
7060 static __inline__ vector unsigned int __ATTRS_o_ai
7061 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7062 #ifdef __LITTLE_ENDIAN__
7063   return __builtin_altivec_vpkudus(__b, __a);
7064 #else
7065   return __builtin_altivec_vpkudus(__a, __b);
7066 #endif
7067 }
7068 #endif
7069
7070 /* vec_vpkshss */
7071
7072 static __inline__ vector signed char __attribute__((__always_inline__))
7073 vec_vpkshss(vector short __a, vector short __b) {
7074 #ifdef __LITTLE_ENDIAN__
7075   return __builtin_altivec_vpkshss(__b, __a);
7076 #else
7077   return __builtin_altivec_vpkshss(__a, __b);
7078 #endif
7079 }
7080
7081 /* vec_vpksdss */
7082
7083 #ifdef __POWER8_VECTOR__
7084 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7085                                                       vector long long __b) {
7086 #ifdef __LITTLE_ENDIAN__
7087   return __builtin_altivec_vpksdss(__b, __a);
7088 #else
7089   return __builtin_altivec_vpksdss(__a, __b);
7090 #endif
7091 }
7092 #endif
7093
7094 /* vec_vpkuhus */
7095
7096 static __inline__ vector unsigned char __attribute__((__always_inline__))
7097 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7098 #ifdef __LITTLE_ENDIAN__
7099   return __builtin_altivec_vpkuhus(__b, __a);
7100 #else
7101   return __builtin_altivec_vpkuhus(__a, __b);
7102 #endif
7103 }
7104
7105 /* vec_vpkudus */
7106
7107 #ifdef __POWER8_VECTOR__
7108 static __inline__ vector unsigned int __attribute__((__always_inline__))
7109 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7110 #ifdef __LITTLE_ENDIAN__
7111   return __builtin_altivec_vpkudus(__b, __a);
7112 #else
7113   return __builtin_altivec_vpkudus(__a, __b);
7114 #endif
7115 }
7116 #endif
7117
7118 /* vec_vpkswss */
7119
7120 static __inline__ vector signed short __attribute__((__always_inline__))
7121 vec_vpkswss(vector int __a, vector int __b) {
7122 #ifdef __LITTLE_ENDIAN__
7123   return __builtin_altivec_vpkswss(__b, __a);
7124 #else
7125   return __builtin_altivec_vpkswss(__a, __b);
7126 #endif
7127 }
7128
7129 /* vec_vpkuwus */
7130
7131 static __inline__ vector unsigned short __attribute__((__always_inline__))
7132 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7133 #ifdef __LITTLE_ENDIAN__
7134   return __builtin_altivec_vpkuwus(__b, __a);
7135 #else
7136   return __builtin_altivec_vpkuwus(__a, __b);
7137 #endif
7138 }
7139
7140 /* vec_packsu */
7141
7142 static __inline__ vector unsigned char __ATTRS_o_ai
7143 vec_packsu(vector short __a, vector short __b) {
7144 #ifdef __LITTLE_ENDIAN__
7145   return __builtin_altivec_vpkshus(__b, __a);
7146 #else
7147   return __builtin_altivec_vpkshus(__a, __b);
7148 #endif
7149 }
7150
7151 static __inline__ vector unsigned char __ATTRS_o_ai
7152 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7153 #ifdef __LITTLE_ENDIAN__
7154   return __builtin_altivec_vpkuhus(__b, __a);
7155 #else
7156   return __builtin_altivec_vpkuhus(__a, __b);
7157 #endif
7158 }
7159
7160 static __inline__ vector unsigned short __ATTRS_o_ai
7161 vec_packsu(vector int __a, vector int __b) {
7162 #ifdef __LITTLE_ENDIAN__
7163   return __builtin_altivec_vpkswus(__b, __a);
7164 #else
7165   return __builtin_altivec_vpkswus(__a, __b);
7166 #endif
7167 }
7168
7169 static __inline__ vector unsigned short __ATTRS_o_ai
7170 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7171 #ifdef __LITTLE_ENDIAN__
7172   return __builtin_altivec_vpkuwus(__b, __a);
7173 #else
7174   return __builtin_altivec_vpkuwus(__a, __b);
7175 #endif
7176 }
7177
7178 #ifdef __POWER8_VECTOR__
7179 static __inline__ vector unsigned int __ATTRS_o_ai
7180 vec_packsu(vector long long __a, vector long long __b) {
7181 #ifdef __LITTLE_ENDIAN__
7182   return __builtin_altivec_vpksdus(__b, __a);
7183 #else
7184   return __builtin_altivec_vpksdus(__a, __b);
7185 #endif
7186 }
7187
7188 static __inline__ vector unsigned int __ATTRS_o_ai
7189 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7190 #ifdef __LITTLE_ENDIAN__
7191   return __builtin_altivec_vpkudus(__b, __a);
7192 #else
7193   return __builtin_altivec_vpkudus(__a, __b);
7194 #endif
7195 }
7196 #endif
7197
7198 /* vec_vpkshus */
7199
7200 static __inline__ vector unsigned char __ATTRS_o_ai
7201 vec_vpkshus(vector short __a, vector short __b) {
7202 #ifdef __LITTLE_ENDIAN__
7203   return __builtin_altivec_vpkshus(__b, __a);
7204 #else
7205   return __builtin_altivec_vpkshus(__a, __b);
7206 #endif
7207 }
7208
7209 static __inline__ vector unsigned char __ATTRS_o_ai
7210 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7211 #ifdef __LITTLE_ENDIAN__
7212   return __builtin_altivec_vpkuhus(__b, __a);
7213 #else
7214   return __builtin_altivec_vpkuhus(__a, __b);
7215 #endif
7216 }
7217
7218 /* vec_vpkswus */
7219
7220 static __inline__ vector unsigned short __ATTRS_o_ai
7221 vec_vpkswus(vector int __a, vector int __b) {
7222 #ifdef __LITTLE_ENDIAN__
7223   return __builtin_altivec_vpkswus(__b, __a);
7224 #else
7225   return __builtin_altivec_vpkswus(__a, __b);
7226 #endif
7227 }
7228
7229 static __inline__ vector unsigned short __ATTRS_o_ai
7230 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7231 #ifdef __LITTLE_ENDIAN__
7232   return __builtin_altivec_vpkuwus(__b, __a);
7233 #else
7234   return __builtin_altivec_vpkuwus(__a, __b);
7235 #endif
7236 }
7237
7238 /* vec_vpksdus */
7239
7240 #ifdef __POWER8_VECTOR__
7241 static __inline__ vector unsigned int __ATTRS_o_ai
7242 vec_vpksdus(vector long long __a, vector long long __b) {
7243 #ifdef __LITTLE_ENDIAN__
7244   return __builtin_altivec_vpksdus(__b, __a);
7245 #else
7246   return __builtin_altivec_vpksdus(__a, __b);
7247 #endif
7248 }
7249 #endif
7250
7251 /* vec_perm */
7252
7253 // The vperm instruction is defined architecturally with a big-endian bias.
7254 // For little endian, we swap the input operands and invert the permute
7255 // control vector.  Only the rightmost 5 bits matter, so we could use
7256 // a vector of all 31s instead of all 255s to perform the inversion.
7257 // However, when the PCV is not a constant, using 255 has an advantage
7258 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
7259 // later, possibly a vec_nand).
7260
7261 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7262     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7263 #ifdef __LITTLE_ENDIAN__
7264   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7265                               255, 255, 255, 255, 255, 255, 255, 255};
7266   __d = vec_xor(__c, __d);
7267   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7268                                                          (vector int)__a, __d);
7269 #else
7270   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7271                                                          (vector int)__b, __c);
7272 #endif
7273 }
7274
7275 static __inline__ vector unsigned char __ATTRS_o_ai
7276 vec_perm(vector unsigned char __a, vector unsigned char __b,
7277          vector unsigned char __c) {
7278 #ifdef __LITTLE_ENDIAN__
7279   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7280                               255, 255, 255, 255, 255, 255, 255, 255};
7281   __d = vec_xor(__c, __d);
7282   return (vector unsigned char)__builtin_altivec_vperm_4si(
7283       (vector int)__b, (vector int)__a, __d);
7284 #else
7285   return (vector unsigned char)__builtin_altivec_vperm_4si(
7286       (vector int)__a, (vector int)__b, __c);
7287 #endif
7288 }
7289
7290 static __inline__ vector bool char __ATTRS_o_ai
7291 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7292 #ifdef __LITTLE_ENDIAN__
7293   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7294                               255, 255, 255, 255, 255, 255, 255, 255};
7295   __d = vec_xor(__c, __d);
7296   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7297                                                        (vector int)__a, __d);
7298 #else
7299   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7300                                                        (vector int)__b, __c);
7301 #endif
7302 }
7303
7304 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7305                                                      vector signed short __b,
7306                                                      vector unsigned char __c) {
7307 #ifdef __LITTLE_ENDIAN__
7308   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7309                               255, 255, 255, 255, 255, 255, 255, 255};
7310   __d = vec_xor(__c, __d);
7311   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7312                                                           (vector int)__a, __d);
7313 #else
7314   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7315                                                           (vector int)__b, __c);
7316 #endif
7317 }
7318
7319 static __inline__ vector unsigned short __ATTRS_o_ai
7320 vec_perm(vector unsigned short __a, vector unsigned short __b,
7321          vector unsigned char __c) {
7322 #ifdef __LITTLE_ENDIAN__
7323   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7324                               255, 255, 255, 255, 255, 255, 255, 255};
7325   __d = vec_xor(__c, __d);
7326   return (vector unsigned short)__builtin_altivec_vperm_4si(
7327       (vector int)__b, (vector int)__a, __d);
7328 #else
7329   return (vector unsigned short)__builtin_altivec_vperm_4si(
7330       (vector int)__a, (vector int)__b, __c);
7331 #endif
7332 }
7333
7334 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7335     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7336 #ifdef __LITTLE_ENDIAN__
7337   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7338                               255, 255, 255, 255, 255, 255, 255, 255};
7339   __d = vec_xor(__c, __d);
7340   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7341                                                         (vector int)__a, __d);
7342 #else
7343   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7344                                                         (vector int)__b, __c);
7345 #endif
7346 }
7347
7348 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7349                                                      vector pixel __b,
7350                                                      vector unsigned char __c) {
7351 #ifdef __LITTLE_ENDIAN__
7352   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7353                               255, 255, 255, 255, 255, 255, 255, 255};
7354   __d = vec_xor(__c, __d);
7355   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7356                                                    (vector int)__a, __d);
7357 #else
7358   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7359                                                    (vector int)__b, __c);
7360 #endif
7361 }
7362
7363 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7364                                                    vector signed int __b,
7365                                                    vector unsigned char __c) {
7366 #ifdef __LITTLE_ENDIAN__
7367   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7368                               255, 255, 255, 255, 255, 255, 255, 255};
7369   __d = vec_xor(__c, __d);
7370   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7371 #else
7372   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7373 #endif
7374 }
7375
7376 static __inline__ vector unsigned int __ATTRS_o_ai
7377 vec_perm(vector unsigned int __a, vector unsigned int __b,
7378          vector unsigned char __c) {
7379 #ifdef __LITTLE_ENDIAN__
7380   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7381                               255, 255, 255, 255, 255, 255, 255, 255};
7382   __d = vec_xor(__c, __d);
7383   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7384                                                           (vector int)__a, __d);
7385 #else
7386   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7387                                                           (vector int)__b, __c);
7388 #endif
7389 }
7390
7391 static __inline__ vector bool int __ATTRS_o_ai
7392 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7393 #ifdef __LITTLE_ENDIAN__
7394   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7395                               255, 255, 255, 255, 255, 255, 255, 255};
7396   __d = vec_xor(__c, __d);
7397   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7398                                                       (vector int)__a, __d);
7399 #else
7400   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7401                                                       (vector int)__b, __c);
7402 #endif
7403 }
7404
7405 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7406                                                      vector float __b,
7407                                                      vector unsigned char __c) {
7408 #ifdef __LITTLE_ENDIAN__
7409   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7410                               255, 255, 255, 255, 255, 255, 255, 255};
7411   __d = vec_xor(__c, __d);
7412   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7413                                                    (vector int)__a, __d);
7414 #else
7415   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7416                                                    (vector int)__b, __c);
7417 #endif
7418 }
7419
7420 #ifdef __VSX__
7421 static __inline__ vector long long __ATTRS_o_ai
7422 vec_perm(vector signed long long __a, vector signed long long __b,
7423          vector unsigned char __c) {
7424 #ifdef __LITTLE_ENDIAN__
7425   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7426                               255, 255, 255, 255, 255, 255, 255, 255};
7427   __d = vec_xor(__c, __d);
7428   return (vector signed long long)__builtin_altivec_vperm_4si(
7429       (vector int)__b, (vector int)__a, __d);
7430 #else
7431   return (vector signed long long)__builtin_altivec_vperm_4si(
7432       (vector int)__a, (vector int)__b, __c);
7433 #endif
7434 }
7435
7436 static __inline__ vector unsigned long long __ATTRS_o_ai
7437 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7438          vector unsigned char __c) {
7439 #ifdef __LITTLE_ENDIAN__
7440   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7441                               255, 255, 255, 255, 255, 255, 255, 255};
7442   __d = vec_xor(__c, __d);
7443   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7444       (vector int)__b, (vector int)__a, __d);
7445 #else
7446   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7447       (vector int)__a, (vector int)__b, __c);
7448 #endif
7449 }
7450
7451 static __inline__ vector bool long long __ATTRS_o_ai
7452 vec_perm(vector bool long long __a, vector bool long long __b,
7453          vector unsigned char __c) {
7454 #ifdef __LITTLE_ENDIAN__
7455   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7456                               255, 255, 255, 255, 255, 255, 255, 255};
7457   __d = vec_xor(__c, __d);
7458   return (vector bool long long)__builtin_altivec_vperm_4si(
7459       (vector int)__b, (vector int)__a, __d);
7460 #else
7461   return (vector bool long long)__builtin_altivec_vperm_4si(
7462       (vector int)__a, (vector int)__b, __c);
7463 #endif
7464 }
7465
7466 static __inline__ vector double __ATTRS_o_ai
7467 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7468 #ifdef __LITTLE_ENDIAN__
7469   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7470                               255, 255, 255, 255, 255, 255, 255, 255};
7471   __d = vec_xor(__c, __d);
7472   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7473                                                     (vector int)__a, __d);
7474 #else
7475   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7476                                                     (vector int)__b, __c);
7477 #endif
7478 }
7479 #endif
7480
7481 /* vec_vperm */
7482
7483 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7484     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7485   return vec_perm(__a, __b, __c);
7486 }
7487
7488 static __inline__ vector unsigned char __ATTRS_o_ai
7489 vec_vperm(vector unsigned char __a, vector unsigned char __b,
7490           vector unsigned char __c) {
7491   return vec_perm(__a, __b, __c);
7492 }
7493
7494 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7495     vector bool char __a, vector bool char __b, vector unsigned char __c) {
7496   return vec_perm(__a, __b, __c);
7497 }
7498
7499 static __inline__ vector short __ATTRS_o_ai
7500 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7501   return vec_perm(__a, __b, __c);
7502 }
7503
7504 static __inline__ vector unsigned short __ATTRS_o_ai
7505 vec_vperm(vector unsigned short __a, vector unsigned short __b,
7506           vector unsigned char __c) {
7507   return vec_perm(__a, __b, __c);
7508 }
7509
7510 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7511     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7512   return vec_perm(__a, __b, __c);
7513 }
7514
7515 static __inline__ vector pixel __ATTRS_o_ai
7516 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7517   return vec_perm(__a, __b, __c);
7518 }
7519
7520 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7521                                                     vector int __b,
7522                                                     vector unsigned char __c) {
7523   return vec_perm(__a, __b, __c);
7524 }
7525
7526 static __inline__ vector unsigned int __ATTRS_o_ai
7527 vec_vperm(vector unsigned int __a, vector unsigned int __b,
7528           vector unsigned char __c) {
7529   return vec_perm(__a, __b, __c);
7530 }
7531
7532 static __inline__ vector bool int __ATTRS_o_ai
7533 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7534   return vec_perm(__a, __b, __c);
7535 }
7536
7537 static __inline__ vector float __ATTRS_o_ai
7538 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7539   return vec_perm(__a, __b, __c);
7540 }
7541
7542 #ifdef __VSX__
7543 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7544     vector long long __a, vector long long __b, vector unsigned char __c) {
7545   return vec_perm(__a, __b, __c);
7546 }
7547
7548 static __inline__ vector unsigned long long __ATTRS_o_ai
7549 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7550           vector unsigned char __c) {
7551   return vec_perm(__a, __b, __c);
7552 }
7553
7554 static __inline__ vector double __ATTRS_o_ai
7555 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7556   return vec_perm(__a, __b, __c);
7557 }
7558 #endif
7559
7560 /* vec_re */
7561
7562 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7563 #ifdef __VSX__
7564   return __builtin_vsx_xvresp(__a);
7565 #else
7566   return __builtin_altivec_vrefp(__a);
7567 #endif
7568 }
7569
7570 #ifdef __VSX__
7571 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7572   return __builtin_vsx_xvredp(__a);
7573 }
7574 #endif
7575
7576 /* vec_vrefp */
7577
7578 static __inline__ vector float __attribute__((__always_inline__))
7579 vec_vrefp(vector float __a) {
7580   return __builtin_altivec_vrefp(__a);
7581 }
7582
7583 /* vec_rl */
7584
7585 static __inline__ vector signed char __ATTRS_o_ai
7586 vec_rl(vector signed char __a, vector unsigned char __b) {
7587   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7588 }
7589
7590 static __inline__ vector unsigned char __ATTRS_o_ai
7591 vec_rl(vector unsigned char __a, vector unsigned char __b) {
7592   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7593 }
7594
7595 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7596                                                    vector unsigned short __b) {
7597   return __builtin_altivec_vrlh(__a, __b);
7598 }
7599
7600 static __inline__ vector unsigned short __ATTRS_o_ai
7601 vec_rl(vector unsigned short __a, vector unsigned short __b) {
7602   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7603 }
7604
7605 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7606                                                  vector unsigned int __b) {
7607   return __builtin_altivec_vrlw(__a, __b);
7608 }
7609
7610 static __inline__ vector unsigned int __ATTRS_o_ai
7611 vec_rl(vector unsigned int __a, vector unsigned int __b) {
7612   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7613 }
7614
7615 #ifdef __POWER8_VECTOR__
7616 static __inline__ vector signed long long __ATTRS_o_ai
7617 vec_rl(vector signed long long __a, vector unsigned long long __b) {
7618   return __builtin_altivec_vrld(__a, __b);
7619 }
7620
7621 static __inline__ vector unsigned long long __ATTRS_o_ai
7622 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7623   return __builtin_altivec_vrld(__a, __b);
7624 }
7625 #endif
7626
7627 /* vec_rlmi */
7628 #ifdef __POWER9_VECTOR__
7629 static __inline__ vector unsigned int __ATTRS_o_ai
7630 vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7631          vector unsigned int __c) {
7632   return __builtin_altivec_vrlwmi(__a, __c, __b);
7633 }
7634
7635 static __inline__ vector unsigned long long __ATTRS_o_ai
7636 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7637          vector unsigned long long __c) {
7638   return __builtin_altivec_vrldmi(__a, __c, __b);
7639 }
7640
7641 /* vec_rlnm */
7642 static __inline__ vector unsigned int __ATTRS_o_ai
7643 vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7644          vector unsigned int __c) {
7645   vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
7646   return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7647 }
7648
7649 static __inline__ vector unsigned long long __ATTRS_o_ai
7650 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7651          vector unsigned long long __c) {
7652   vector unsigned long long OneByte = { 0x8, 0x8 };
7653   return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7654 }
7655 #endif
7656
7657 /* vec_vrlb */
7658
7659 static __inline__ vector signed char __ATTRS_o_ai
7660 vec_vrlb(vector signed char __a, vector unsigned char __b) {
7661   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7662 }
7663
7664 static __inline__ vector unsigned char __ATTRS_o_ai
7665 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7666   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7667 }
7668
7669 /* vec_vrlh */
7670
7671 static __inline__ vector short __ATTRS_o_ai
7672 vec_vrlh(vector short __a, vector unsigned short __b) {
7673   return __builtin_altivec_vrlh(__a, __b);
7674 }
7675
7676 static __inline__ vector unsigned short __ATTRS_o_ai
7677 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7678   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7679 }
7680
7681 /* vec_vrlw */
7682
7683 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7684                                                    vector unsigned int __b) {
7685   return __builtin_altivec_vrlw(__a, __b);
7686 }
7687
7688 static __inline__ vector unsigned int __ATTRS_o_ai
7689 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7690   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7691 }
7692
7693 /* vec_round */
7694
7695 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7696 #ifdef __VSX__
7697   return __builtin_vsx_xvrspi(__a);
7698 #else
7699   return __builtin_altivec_vrfin(__a);
7700 #endif
7701 }
7702
7703 #ifdef __VSX__
7704 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7705   return __builtin_vsx_xvrdpi(__a);
7706 }
7707
7708 /* vec_rint */
7709
7710 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7711   return __builtin_vsx_xvrspic(__a);
7712 }
7713
7714 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7715   return __builtin_vsx_xvrdpic(__a);
7716 }
7717
7718 /* vec_nearbyint */
7719
7720 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7721   return __builtin_vsx_xvrspi(__a);
7722 }
7723
7724 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7725   return __builtin_vsx_xvrdpi(__a);
7726 }
7727 #endif
7728
7729 /* vec_vrfin */
7730
7731 static __inline__ vector float __attribute__((__always_inline__))
7732 vec_vrfin(vector float __a) {
7733   return __builtin_altivec_vrfin(__a);
7734 }
7735
7736 /* vec_sqrt */
7737
7738 #ifdef __VSX__
7739 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7740   return __builtin_vsx_xvsqrtsp(__a);
7741 }
7742
7743 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7744   return __builtin_vsx_xvsqrtdp(__a);
7745 }
7746 #endif
7747
7748 /* vec_rsqrte */
7749
7750 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7751 #ifdef __VSX__
7752   return __builtin_vsx_xvrsqrtesp(__a);
7753 #else
7754   return __builtin_altivec_vrsqrtefp(__a);
7755 #endif
7756 }
7757
7758 #ifdef __VSX__
7759 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7760   return __builtin_vsx_xvrsqrtedp(__a);
7761 }
7762 #endif
7763
7764 /* vec_vrsqrtefp */
7765
7766 static __inline__ __vector float __attribute__((__always_inline__))
7767 vec_vrsqrtefp(vector float __a) {
7768   return __builtin_altivec_vrsqrtefp(__a);
7769 }
7770
7771 /* vec_sel */
7772
7773 #define __builtin_altivec_vsel_4si vec_sel
7774
7775 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7776     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7777   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7778 }
7779
7780 static __inline__ vector signed char __ATTRS_o_ai
7781 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7782   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7783 }
7784
7785 static __inline__ vector unsigned char __ATTRS_o_ai
7786 vec_sel(vector unsigned char __a, vector unsigned char __b,
7787         vector unsigned char __c) {
7788   return (__a & ~__c) | (__b & __c);
7789 }
7790
7791 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7792     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7793   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7794 }
7795
7796 static __inline__ vector bool char __ATTRS_o_ai
7797 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7798   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7799 }
7800
7801 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7802                                                         vector bool char __b,
7803                                                         vector bool char __c) {
7804   return (__a & ~__c) | (__b & __c);
7805 }
7806
7807 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7808                                                     vector short __b,
7809                                                     vector unsigned short __c) {
7810   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7811 }
7812
7813 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7814                                                     vector short __b,
7815                                                     vector bool short __c) {
7816   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7817 }
7818
7819 static __inline__ vector unsigned short __ATTRS_o_ai
7820 vec_sel(vector unsigned short __a, vector unsigned short __b,
7821         vector unsigned short __c) {
7822   return (__a & ~__c) | (__b & __c);
7823 }
7824
7825 static __inline__ vector unsigned short __ATTRS_o_ai
7826 vec_sel(vector unsigned short __a, vector unsigned short __b,
7827         vector bool short __c) {
7828   return (__a & ~(vector unsigned short)__c) |
7829          (__b & (vector unsigned short)__c);
7830 }
7831
7832 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7833     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7834   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7835 }
7836
7837 static __inline__ vector bool short __ATTRS_o_ai
7838 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7839   return (__a & ~__c) | (__b & __c);
7840 }
7841
7842 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7843                                                   vector int __b,
7844                                                   vector unsigned int __c) {
7845   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7846 }
7847
7848 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7849                                                   vector int __b,
7850                                                   vector bool int __c) {
7851   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7852 }
7853
7854 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7855     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7856   return (__a & ~__c) | (__b & __c);
7857 }
7858
7859 static __inline__ vector unsigned int __ATTRS_o_ai
7860 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7861   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7862 }
7863
7864 static __inline__ vector bool int __ATTRS_o_ai
7865 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7866   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7867 }
7868
7869 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7870                                                        vector bool int __b,
7871                                                        vector bool int __c) {
7872   return (__a & ~__c) | (__b & __c);
7873 }
7874
7875 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7876                                                     vector float __b,
7877                                                     vector unsigned int __c) {
7878   vector int __res = ((vector int)__a & ~(vector int)__c) |
7879                      ((vector int)__b & (vector int)__c);
7880   return (vector float)__res;
7881 }
7882
7883 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7884                                                     vector float __b,
7885                                                     vector bool int __c) {
7886   vector int __res = ((vector int)__a & ~(vector int)__c) |
7887                      ((vector int)__b & (vector int)__c);
7888   return (vector float)__res;
7889 }
7890
7891 #ifdef __VSX__
7892 static __inline__ vector double __ATTRS_o_ai
7893 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7894   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7895                            ((vector long long)__b & (vector long long)__c);
7896   return (vector double)__res;
7897 }
7898
7899 static __inline__ vector double __ATTRS_o_ai
7900 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7901   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7902                            ((vector long long)__b & (vector long long)__c);
7903   return (vector double)__res;
7904 }
7905 #endif
7906
7907 /* vec_vsel */
7908
7909 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7910     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7911   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7912 }
7913
7914 static __inline__ vector signed char __ATTRS_o_ai
7915 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7916   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7917 }
7918
7919 static __inline__ vector unsigned char __ATTRS_o_ai
7920 vec_vsel(vector unsigned char __a, vector unsigned char __b,
7921          vector unsigned char __c) {
7922   return (__a & ~__c) | (__b & __c);
7923 }
7924
7925 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7926     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7927   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7928 }
7929
7930 static __inline__ vector bool char __ATTRS_o_ai
7931 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7932   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7933 }
7934
7935 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7936                                                          vector bool char __b,
7937                                                          vector bool char __c) {
7938   return (__a & ~__c) | (__b & __c);
7939 }
7940
7941 static __inline__ vector short __ATTRS_o_ai
7942 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7943   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7944 }
7945
7946 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7947                                                      vector short __b,
7948                                                      vector bool short __c) {
7949   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7950 }
7951
7952 static __inline__ vector unsigned short __ATTRS_o_ai
7953 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7954          vector unsigned short __c) {
7955   return (__a & ~__c) | (__b & __c);
7956 }
7957
7958 static __inline__ vector unsigned short __ATTRS_o_ai
7959 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7960          vector bool short __c) {
7961   return (__a & ~(vector unsigned short)__c) |
7962          (__b & (vector unsigned short)__c);
7963 }
7964
7965 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7966     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7967   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7968 }
7969
7970 static __inline__ vector bool short __ATTRS_o_ai
7971 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7972   return (__a & ~__c) | (__b & __c);
7973 }
7974
7975 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7976                                                    vector int __b,
7977                                                    vector unsigned int __c) {
7978   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7979 }
7980
7981 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7982                                                    vector int __b,
7983                                                    vector bool int __c) {
7984   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7985 }
7986
7987 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7988     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7989   return (__a & ~__c) | (__b & __c);
7990 }
7991
7992 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7993     vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7994   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7995 }
7996
7997 static __inline__ vector bool int __ATTRS_o_ai
7998 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7999   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8000 }
8001
8002 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8003                                                         vector bool int __b,
8004                                                         vector bool int __c) {
8005   return (__a & ~__c) | (__b & __c);
8006 }
8007
8008 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8009                                                      vector float __b,
8010                                                      vector unsigned int __c) {
8011   vector int __res = ((vector int)__a & ~(vector int)__c) |
8012                      ((vector int)__b & (vector int)__c);
8013   return (vector float)__res;
8014 }
8015
8016 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8017                                                      vector float __b,
8018                                                      vector bool int __c) {
8019   vector int __res = ((vector int)__a & ~(vector int)__c) |
8020                      ((vector int)__b & (vector int)__c);
8021   return (vector float)__res;
8022 }
8023
8024 /* vec_sl */
8025
8026 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8027 // than the length of __a.
8028 static __inline__ vector unsigned char __ATTRS_o_ai
8029 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8030   return __a << (__b %
8031                  (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8032 }
8033
8034 static __inline__ vector signed char __ATTRS_o_ai
8035 vec_sl(vector signed char __a, vector unsigned char __b) {
8036   return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8037 }
8038
8039 static __inline__ vector unsigned short __ATTRS_o_ai
8040 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8041   return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8042                                                __CHAR_BIT__));
8043 }
8044
8045 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8046                                                    vector unsigned short __b) {
8047   return (vector short)vec_sl((vector unsigned short)__a, __b);
8048 }
8049
8050 static __inline__ vector unsigned int __ATTRS_o_ai
8051 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8052   return __a << (__b %
8053                  (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8054 }
8055
8056 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8057                                                  vector unsigned int __b) {
8058   return (vector int)vec_sl((vector unsigned int)__a, __b);
8059 }
8060
8061 #ifdef __POWER8_VECTOR__
8062 static __inline__ vector unsigned long long __ATTRS_o_ai
8063 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8064   return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8065                                                    __CHAR_BIT__));
8066 }
8067
8068 static __inline__ vector long long __ATTRS_o_ai
8069 vec_sl(vector long long __a, vector unsigned long long __b) {
8070   return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8071 }
8072 #endif
8073
8074 /* vec_vslb */
8075
8076 #define __builtin_altivec_vslb vec_vslb
8077
8078 static __inline__ vector signed char __ATTRS_o_ai
8079 vec_vslb(vector signed char __a, vector unsigned char __b) {
8080   return vec_sl(__a, __b);
8081 }
8082
8083 static __inline__ vector unsigned char __ATTRS_o_ai
8084 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8085   return vec_sl(__a, __b);
8086 }
8087
8088 /* vec_vslh */
8089
8090 #define __builtin_altivec_vslh vec_vslh
8091
8092 static __inline__ vector short __ATTRS_o_ai
8093 vec_vslh(vector short __a, vector unsigned short __b) {
8094   return vec_sl(__a, __b);
8095 }
8096
8097 static __inline__ vector unsigned short __ATTRS_o_ai
8098 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8099   return vec_sl(__a, __b);
8100 }
8101
8102 /* vec_vslw */
8103
8104 #define __builtin_altivec_vslw vec_vslw
8105
8106 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8107                                                    vector unsigned int __b) {
8108   return vec_sl(__a, __b);
8109 }
8110
8111 static __inline__ vector unsigned int __ATTRS_o_ai
8112 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8113   return vec_sl(__a, __b);
8114 }
8115
8116 /* vec_sld */
8117
8118 #define __builtin_altivec_vsldoi_4si vec_sld
8119
8120 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8121     vector signed char __a, vector signed char __b, unsigned const int __c) {
8122   unsigned char __d = __c & 0x0F;
8123 #ifdef __LITTLE_ENDIAN__
8124   return vec_perm(
8125       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8126                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8127                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8128                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8129 #else
8130   return vec_perm(
8131       __a, __b,
8132       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8133                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8134                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8135 #endif
8136 }
8137
8138 static __inline__ vector unsigned char __ATTRS_o_ai
8139 vec_sld(vector unsigned char __a, vector unsigned char __b,
8140         unsigned const int __c) {
8141   unsigned char __d = __c & 0x0F;
8142 #ifdef __LITTLE_ENDIAN__
8143   return vec_perm(
8144       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8145                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8146                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8147                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8148 #else
8149   return vec_perm(
8150       __a, __b,
8151       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8152                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8153                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8154 #endif
8155 }
8156
8157 static __inline__ vector bool char __ATTRS_o_ai
8158 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8159   unsigned char __d = __c & 0x0F;
8160 #ifdef __LITTLE_ENDIAN__
8161   return vec_perm(
8162       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8163                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8164                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8165                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8166 #else
8167   return vec_perm(
8168       __a, __b,
8169       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8170                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8171                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8172 #endif
8173 }
8174
8175 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8176     vector signed short __a, vector signed short __b, unsigned const int __c) {
8177   unsigned char __d = __c & 0x0F;
8178 #ifdef __LITTLE_ENDIAN__
8179   return vec_perm(
8180       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8181                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8182                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8183                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8184 #else
8185   return vec_perm(
8186       __a, __b,
8187       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8188                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8189                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8190 #endif
8191 }
8192
8193 static __inline__ vector unsigned short __ATTRS_o_ai
8194 vec_sld(vector unsigned short __a, vector unsigned short __b,
8195         unsigned const int __c) {
8196   unsigned char __d = __c & 0x0F;
8197 #ifdef __LITTLE_ENDIAN__
8198   return vec_perm(
8199       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8200                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8201                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8202                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8203 #else
8204   return vec_perm(
8205       __a, __b,
8206       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8207                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8208                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8209 #endif
8210 }
8211
8212 static __inline__ vector bool short __ATTRS_o_ai
8213 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8214   unsigned char __d = __c & 0x0F;
8215 #ifdef __LITTLE_ENDIAN__
8216   return vec_perm(
8217       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8218                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8219                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8220                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8221 #else
8222   return vec_perm(
8223       __a, __b,
8224       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8225                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8226                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8227 #endif
8228 }
8229
8230 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8231                                                     vector pixel __b,
8232                                                     unsigned const int __c) {
8233   unsigned char __d = __c & 0x0F;
8234 #ifdef __LITTLE_ENDIAN__
8235   return vec_perm(
8236       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8237                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8238                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8239                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8240 #else
8241   return vec_perm(
8242       __a, __b,
8243       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8244                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8245                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8246 #endif
8247 }
8248
8249 static __inline__ vector signed int __ATTRS_o_ai
8250 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8251   unsigned char __d = __c & 0x0F;
8252 #ifdef __LITTLE_ENDIAN__
8253   return vec_perm(
8254       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8255                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8256                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8257                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8258 #else
8259   return vec_perm(
8260       __a, __b,
8261       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8262                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8263                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8264 #endif
8265 }
8266
8267 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8268     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8269   unsigned char __d = __c & 0x0F;
8270 #ifdef __LITTLE_ENDIAN__
8271   return vec_perm(
8272       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8273                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8274                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8275                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8276 #else
8277   return vec_perm(
8278       __a, __b,
8279       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8280                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8281                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8282 #endif
8283 }
8284
8285 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8286                                                        vector bool int __b,
8287                                                        unsigned const int __c) {
8288   unsigned char __d = __c & 0x0F;
8289 #ifdef __LITTLE_ENDIAN__
8290   return vec_perm(
8291       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8292                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8293                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8294                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8295 #else
8296   return vec_perm(
8297       __a, __b,
8298       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8299                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8300                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8301 #endif
8302 }
8303
8304 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8305                                                     vector float __b,
8306                                                     unsigned const int __c) {
8307   unsigned char __d = __c & 0x0F;
8308 #ifdef __LITTLE_ENDIAN__
8309   return vec_perm(
8310       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8311                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8312                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8313                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8314 #else
8315   return vec_perm(
8316       __a, __b,
8317       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8318                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8319                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8320 #endif
8321 }
8322
8323 #ifdef __VSX__
8324 static __inline__ vector bool long long __ATTRS_o_ai
8325 vec_sld(vector bool long long __a, vector bool long long __b,
8326         unsigned const int __c) {
8327   unsigned char __d = __c & 0x0F;
8328 #ifdef __LITTLE_ENDIAN__
8329   return vec_perm(
8330       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8331                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8332                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8333                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8334 #else
8335   return vec_perm(
8336       __a, __b,
8337       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8338                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8339                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8340 #endif
8341 }
8342
8343 static __inline__ vector signed long long __ATTRS_o_ai
8344 vec_sld(vector signed long long __a, vector signed long long __b,
8345         unsigned const int __c) {
8346   unsigned char __d = __c & 0x0F;
8347 #ifdef __LITTLE_ENDIAN__
8348   return vec_perm(
8349       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8350                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8351                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8352                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8353 #else
8354   return vec_perm(
8355       __a, __b,
8356       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8357                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8358                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8359 #endif
8360 }
8361
8362 static __inline__ vector unsigned long long __ATTRS_o_ai
8363 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8364         unsigned const int __c) {
8365   unsigned char __d = __c & 0x0F;
8366 #ifdef __LITTLE_ENDIAN__
8367   return vec_perm(
8368       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8369                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8370                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8371                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8372 #else
8373   return vec_perm(
8374       __a, __b,
8375       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8376                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8377                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8378 #endif
8379 }
8380
8381 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8382                                                      vector double __b,
8383                                                      unsigned const int __c) {
8384   unsigned char __d = __c & 0x0F;
8385 #ifdef __LITTLE_ENDIAN__
8386   return vec_perm(
8387       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8388                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8389                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8390                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8391 #else
8392   return vec_perm(
8393       __a, __b,
8394       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8395                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8396                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8397 #endif
8398 }
8399 #endif
8400
8401 /* vec_sldw */
8402 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8403     vector signed char __a, vector signed char __b, unsigned const int __c) {
8404   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8405 }
8406
8407 static __inline__ vector unsigned char __ATTRS_o_ai
8408 vec_sldw(vector unsigned char __a, vector unsigned char __b,
8409          unsigned const int __c) {
8410   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8411 }
8412
8413 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8414     vector signed short __a, vector signed short __b, unsigned const int __c) {
8415   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8416 }
8417
8418 static __inline__ vector unsigned short __ATTRS_o_ai
8419 vec_sldw(vector unsigned short __a, vector unsigned short __b,
8420          unsigned const int __c) {
8421   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8422 }
8423
8424 static __inline__ vector signed int __ATTRS_o_ai
8425 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8426   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8427 }
8428
8429 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8430     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8431   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8432 }
8433
8434 #ifdef __VSX__
8435 static __inline__ vector signed long long __ATTRS_o_ai
8436 vec_sldw(vector signed long long __a, vector signed long long __b,
8437          unsigned const int __c) {
8438   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8439 }
8440
8441 static __inline__ vector unsigned long long __ATTRS_o_ai
8442 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8443          unsigned const int __c) {
8444   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8445 }
8446 #endif
8447
8448 #ifdef __POWER9_VECTOR__
8449 /* vec_slv */
8450 static __inline__ vector unsigned char __ATTRS_o_ai
8451 vec_slv(vector unsigned char __a, vector unsigned char __b) {
8452   return __builtin_altivec_vslv(__a, __b);
8453 }
8454
8455 /* vec_srv */
8456 static __inline__ vector unsigned char __ATTRS_o_ai
8457 vec_srv(vector unsigned char __a, vector unsigned char __b) {
8458   return __builtin_altivec_vsrv(__a, __b);
8459 }
8460 #endif
8461
8462 /* vec_vsldoi */
8463
8464 static __inline__ vector signed char __ATTRS_o_ai
8465 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8466   unsigned char __d = __c & 0x0F;
8467 #ifdef __LITTLE_ENDIAN__
8468   return vec_perm(
8469       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8470                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8471                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8472                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8473 #else
8474   return vec_perm(
8475       __a, __b,
8476       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8477                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8478                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8479 #endif
8480 }
8481
8482 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8483     vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8484   unsigned char __d = __c & 0x0F;
8485 #ifdef __LITTLE_ENDIAN__
8486   return vec_perm(
8487       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8488                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8489                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8490                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8491 #else
8492   return vec_perm(
8493       __a, __b,
8494       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8495                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8496                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8497 #endif
8498 }
8499
8500 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8501                                                        vector short __b,
8502                                                        unsigned char __c) {
8503   unsigned char __d = __c & 0x0F;
8504 #ifdef __LITTLE_ENDIAN__
8505   return vec_perm(
8506       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8507                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8508                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8509                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8510 #else
8511   return vec_perm(
8512       __a, __b,
8513       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8514                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8515                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8516 #endif
8517 }
8518
8519 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8520     vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8521   unsigned char __d = __c & 0x0F;
8522 #ifdef __LITTLE_ENDIAN__
8523   return vec_perm(
8524       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8525                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8526                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8527                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8528 #else
8529   return vec_perm(
8530       __a, __b,
8531       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8532                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8533                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8534 #endif
8535 }
8536
8537 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8538                                                        vector pixel __b,
8539                                                        unsigned char __c) {
8540   unsigned char __d = __c & 0x0F;
8541 #ifdef __LITTLE_ENDIAN__
8542   return vec_perm(
8543       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8544                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8545                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8546                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8547 #else
8548   return vec_perm(
8549       __a, __b,
8550       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8551                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8552                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8553 #endif
8554 }
8555
8556 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8557                                                      vector int __b,
8558                                                      unsigned char __c) {
8559   unsigned char __d = __c & 0x0F;
8560 #ifdef __LITTLE_ENDIAN__
8561   return vec_perm(
8562       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8563                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8564                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8565                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8566 #else
8567   return vec_perm(
8568       __a, __b,
8569       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8570                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8571                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8572 #endif
8573 }
8574
8575 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8576     vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8577   unsigned char __d = __c & 0x0F;
8578 #ifdef __LITTLE_ENDIAN__
8579   return vec_perm(
8580       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8581                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8582                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8583                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8584 #else
8585   return vec_perm(
8586       __a, __b,
8587       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8588                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8589                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8590 #endif
8591 }
8592
8593 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8594                                                        vector float __b,
8595                                                        unsigned char __c) {
8596   unsigned char __d = __c & 0x0F;
8597 #ifdef __LITTLE_ENDIAN__
8598   return vec_perm(
8599       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8600                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8601                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8602                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8603 #else
8604   return vec_perm(
8605       __a, __b,
8606       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8607                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8608                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8609 #endif
8610 }
8611
8612 /* vec_sll */
8613
8614 static __inline__ vector signed char __ATTRS_o_ai
8615 vec_sll(vector signed char __a, vector unsigned char __b) {
8616   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8617                                                    (vector int)__b);
8618 }
8619
8620 static __inline__ vector signed char __ATTRS_o_ai
8621 vec_sll(vector signed char __a, vector unsigned short __b) {
8622   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8623                                                    (vector int)__b);
8624 }
8625
8626 static __inline__ vector signed char __ATTRS_o_ai
8627 vec_sll(vector signed char __a, vector unsigned int __b) {
8628   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8629                                                    (vector int)__b);
8630 }
8631
8632 static __inline__ vector unsigned char __ATTRS_o_ai
8633 vec_sll(vector unsigned char __a, vector unsigned char __b) {
8634   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8635                                                      (vector int)__b);
8636 }
8637
8638 static __inline__ vector unsigned char __ATTRS_o_ai
8639 vec_sll(vector unsigned char __a, vector unsigned short __b) {
8640   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8641                                                      (vector int)__b);
8642 }
8643
8644 static __inline__ vector unsigned char __ATTRS_o_ai
8645 vec_sll(vector unsigned char __a, vector unsigned int __b) {
8646   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8647                                                      (vector int)__b);
8648 }
8649
8650 static __inline__ vector bool char __ATTRS_o_ai
8651 vec_sll(vector bool char __a, vector unsigned char __b) {
8652   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8653                                                  (vector int)__b);
8654 }
8655
8656 static __inline__ vector bool char __ATTRS_o_ai
8657 vec_sll(vector bool char __a, vector unsigned short __b) {
8658   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8659                                                  (vector int)__b);
8660 }
8661
8662 static __inline__ vector bool char __ATTRS_o_ai
8663 vec_sll(vector bool char __a, vector unsigned int __b) {
8664   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8665                                                  (vector int)__b);
8666 }
8667
8668 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8669                                                     vector unsigned char __b) {
8670   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8671 }
8672
8673 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8674                                                     vector unsigned short __b) {
8675   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8676 }
8677
8678 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8679                                                     vector unsigned int __b) {
8680   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8681 }
8682
8683 static __inline__ vector unsigned short __ATTRS_o_ai
8684 vec_sll(vector unsigned short __a, vector unsigned char __b) {
8685   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8686                                                       (vector int)__b);
8687 }
8688
8689 static __inline__ vector unsigned short __ATTRS_o_ai
8690 vec_sll(vector unsigned short __a, vector unsigned short __b) {
8691   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8692                                                       (vector int)__b);
8693 }
8694
8695 static __inline__ vector unsigned short __ATTRS_o_ai
8696 vec_sll(vector unsigned short __a, vector unsigned int __b) {
8697   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8698                                                       (vector int)__b);
8699 }
8700
8701 static __inline__ vector bool short __ATTRS_o_ai
8702 vec_sll(vector bool short __a, vector unsigned char __b) {
8703   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8704                                                   (vector int)__b);
8705 }
8706
8707 static __inline__ vector bool short __ATTRS_o_ai
8708 vec_sll(vector bool short __a, vector unsigned short __b) {
8709   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8710                                                   (vector int)__b);
8711 }
8712
8713 static __inline__ vector bool short __ATTRS_o_ai
8714 vec_sll(vector bool short __a, vector unsigned int __b) {
8715   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8716                                                   (vector int)__b);
8717 }
8718
8719 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8720                                                     vector unsigned char __b) {
8721   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8722 }
8723
8724 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8725                                                     vector unsigned short __b) {
8726   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8727 }
8728
8729 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8730                                                     vector unsigned int __b) {
8731   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8732 }
8733
8734 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8735                                                   vector unsigned char __b) {
8736   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8737 }
8738
8739 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8740                                                   vector unsigned short __b) {
8741   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8742 }
8743
8744 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8745                                                   vector unsigned int __b) {
8746   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8747 }
8748
8749 static __inline__ vector unsigned int __ATTRS_o_ai
8750 vec_sll(vector unsigned int __a, vector unsigned char __b) {
8751   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8752                                                     (vector int)__b);
8753 }
8754
8755 static __inline__ vector unsigned int __ATTRS_o_ai
8756 vec_sll(vector unsigned int __a, vector unsigned short __b) {
8757   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8758                                                     (vector int)__b);
8759 }
8760
8761 static __inline__ vector unsigned int __ATTRS_o_ai
8762 vec_sll(vector unsigned int __a, vector unsigned int __b) {
8763   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8764                                                     (vector int)__b);
8765 }
8766
8767 static __inline__ vector bool int __ATTRS_o_ai
8768 vec_sll(vector bool int __a, vector unsigned char __b) {
8769   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8770                                                 (vector int)__b);
8771 }
8772
8773 static __inline__ vector bool int __ATTRS_o_ai
8774 vec_sll(vector bool int __a, vector unsigned short __b) {
8775   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8776                                                 (vector int)__b);
8777 }
8778
8779 static __inline__ vector bool int __ATTRS_o_ai
8780 vec_sll(vector bool int __a, vector unsigned int __b) {
8781   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8782                                                 (vector int)__b);
8783 }
8784
8785 #ifdef __VSX__
8786 static __inline__ vector signed long long __ATTRS_o_ai
8787 vec_sll(vector signed long long __a, vector unsigned char __b) {
8788   return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8789                                                         (vector int)__b);
8790 }
8791
8792 static __inline__ vector unsigned long long __ATTRS_o_ai
8793 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8794   return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8795                                                           (vector int)__b);
8796 }
8797 #endif
8798
8799 /* vec_vsl */
8800
8801 static __inline__ vector signed char __ATTRS_o_ai
8802 vec_vsl(vector signed char __a, vector unsigned char __b) {
8803   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8804                                                    (vector int)__b);
8805 }
8806
8807 static __inline__ vector signed char __ATTRS_o_ai
8808 vec_vsl(vector signed char __a, vector unsigned short __b) {
8809   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8810                                                    (vector int)__b);
8811 }
8812
8813 static __inline__ vector signed char __ATTRS_o_ai
8814 vec_vsl(vector signed char __a, vector unsigned int __b) {
8815   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8816                                                    (vector int)__b);
8817 }
8818
8819 static __inline__ vector unsigned char __ATTRS_o_ai
8820 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8821   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8822                                                      (vector int)__b);
8823 }
8824
8825 static __inline__ vector unsigned char __ATTRS_o_ai
8826 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8827   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8828                                                      (vector int)__b);
8829 }
8830
8831 static __inline__ vector unsigned char __ATTRS_o_ai
8832 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8833   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8834                                                      (vector int)__b);
8835 }
8836
8837 static __inline__ vector bool char __ATTRS_o_ai
8838 vec_vsl(vector bool char __a, vector unsigned char __b) {
8839   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8840                                                  (vector int)__b);
8841 }
8842
8843 static __inline__ vector bool char __ATTRS_o_ai
8844 vec_vsl(vector bool char __a, vector unsigned short __b) {
8845   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8846                                                  (vector int)__b);
8847 }
8848
8849 static __inline__ vector bool char __ATTRS_o_ai
8850 vec_vsl(vector bool char __a, vector unsigned int __b) {
8851   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8852                                                  (vector int)__b);
8853 }
8854
8855 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8856                                                     vector unsigned char __b) {
8857   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8858 }
8859
8860 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8861                                                     vector unsigned short __b) {
8862   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8863 }
8864
8865 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8866                                                     vector unsigned int __b) {
8867   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8868 }
8869
8870 static __inline__ vector unsigned short __ATTRS_o_ai
8871 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8872   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8873                                                       (vector int)__b);
8874 }
8875
8876 static __inline__ vector unsigned short __ATTRS_o_ai
8877 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8878   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8879                                                       (vector int)__b);
8880 }
8881
8882 static __inline__ vector unsigned short __ATTRS_o_ai
8883 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8884   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8885                                                       (vector int)__b);
8886 }
8887
8888 static __inline__ vector bool short __ATTRS_o_ai
8889 vec_vsl(vector bool short __a, vector unsigned char __b) {
8890   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8891                                                   (vector int)__b);
8892 }
8893
8894 static __inline__ vector bool short __ATTRS_o_ai
8895 vec_vsl(vector bool short __a, vector unsigned short __b) {
8896   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8897                                                   (vector int)__b);
8898 }
8899
8900 static __inline__ vector bool short __ATTRS_o_ai
8901 vec_vsl(vector bool short __a, vector unsigned int __b) {
8902   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8903                                                   (vector int)__b);
8904 }
8905
8906 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8907                                                     vector unsigned char __b) {
8908   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8909 }
8910
8911 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8912                                                     vector unsigned short __b) {
8913   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8914 }
8915
8916 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8917                                                     vector unsigned int __b) {
8918   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8919 }
8920
8921 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8922                                                   vector unsigned char __b) {
8923   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8924 }
8925
8926 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8927                                                   vector unsigned short __b) {
8928   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8929 }
8930
8931 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8932                                                   vector unsigned int __b) {
8933   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8934 }
8935
8936 static __inline__ vector unsigned int __ATTRS_o_ai
8937 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8938   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8939                                                     (vector int)__b);
8940 }
8941
8942 static __inline__ vector unsigned int __ATTRS_o_ai
8943 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8944   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8945                                                     (vector int)__b);
8946 }
8947
8948 static __inline__ vector unsigned int __ATTRS_o_ai
8949 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8950   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8951                                                     (vector int)__b);
8952 }
8953
8954 static __inline__ vector bool int __ATTRS_o_ai
8955 vec_vsl(vector bool int __a, vector unsigned char __b) {
8956   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8957                                                 (vector int)__b);
8958 }
8959
8960 static __inline__ vector bool int __ATTRS_o_ai
8961 vec_vsl(vector bool int __a, vector unsigned short __b) {
8962   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8963                                                 (vector int)__b);
8964 }
8965
8966 static __inline__ vector bool int __ATTRS_o_ai
8967 vec_vsl(vector bool int __a, vector unsigned int __b) {
8968   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8969                                                 (vector int)__b);
8970 }
8971
8972 /* vec_slo */
8973
8974 static __inline__ vector signed char __ATTRS_o_ai
8975 vec_slo(vector signed char __a, vector signed char __b) {
8976   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8977                                                     (vector int)__b);
8978 }
8979
8980 static __inline__ vector signed char __ATTRS_o_ai
8981 vec_slo(vector signed char __a, vector unsigned char __b) {
8982   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8983                                                     (vector int)__b);
8984 }
8985
8986 static __inline__ vector unsigned char __ATTRS_o_ai
8987 vec_slo(vector unsigned char __a, vector signed char __b) {
8988   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8989                                                       (vector int)__b);
8990 }
8991
8992 static __inline__ vector unsigned char __ATTRS_o_ai
8993 vec_slo(vector unsigned char __a, vector unsigned char __b) {
8994   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8995                                                       (vector int)__b);
8996 }
8997
8998 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
8999                                                     vector signed char __b) {
9000   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9001 }
9002
9003 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9004                                                     vector unsigned char __b) {
9005   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9006 }
9007
9008 static __inline__ vector unsigned short __ATTRS_o_ai
9009 vec_slo(vector unsigned short __a, vector signed char __b) {
9010   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9011                                                        (vector int)__b);
9012 }
9013
9014 static __inline__ vector unsigned short __ATTRS_o_ai
9015 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9016   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9017                                                        (vector int)__b);
9018 }
9019
9020 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9021                                                     vector signed char __b) {
9022   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9023 }
9024
9025 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9026                                                     vector unsigned char __b) {
9027   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9028 }
9029
9030 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9031                                                   vector signed char __b) {
9032   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9033 }
9034
9035 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9036                                                   vector unsigned char __b) {
9037   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9038 }
9039
9040 static __inline__ vector unsigned int __ATTRS_o_ai
9041 vec_slo(vector unsigned int __a, vector signed char __b) {
9042   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9043                                                      (vector int)__b);
9044 }
9045
9046 static __inline__ vector unsigned int __ATTRS_o_ai
9047 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9048   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9049                                                      (vector int)__b);
9050 }
9051
9052 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9053                                                     vector signed char __b) {
9054   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9055 }
9056
9057 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9058                                                     vector unsigned char __b) {
9059   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9060 }
9061
9062 #ifdef __VSX__
9063 static __inline__ vector signed long long __ATTRS_o_ai
9064 vec_slo(vector signed long long __a, vector signed char __b) {
9065   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9066                                                          (vector int)__b);
9067 }
9068
9069 static __inline__ vector signed long long __ATTRS_o_ai
9070 vec_slo(vector signed long long __a, vector unsigned char __b) {
9071   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9072                                                          (vector int)__b);
9073 }
9074
9075 static __inline__ vector unsigned long long __ATTRS_o_ai
9076 vec_slo(vector unsigned long long __a, vector signed char __b) {
9077   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9078                                                            (vector int)__b);
9079 }
9080
9081 static __inline__ vector unsigned long long __ATTRS_o_ai
9082 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9083   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9084                                                            (vector int)__b);
9085 }
9086 #endif
9087
9088 /* vec_vslo */
9089
9090 static __inline__ vector signed char __ATTRS_o_ai
9091 vec_vslo(vector signed char __a, vector signed char __b) {
9092   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9093                                                     (vector int)__b);
9094 }
9095
9096 static __inline__ vector signed char __ATTRS_o_ai
9097 vec_vslo(vector signed char __a, vector unsigned char __b) {
9098   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9099                                                     (vector int)__b);
9100 }
9101
9102 static __inline__ vector unsigned char __ATTRS_o_ai
9103 vec_vslo(vector unsigned char __a, vector signed char __b) {
9104   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9105                                                       (vector int)__b);
9106 }
9107
9108 static __inline__ vector unsigned char __ATTRS_o_ai
9109 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9110   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9111                                                       (vector int)__b);
9112 }
9113
9114 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9115                                                      vector signed char __b) {
9116   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9117 }
9118
9119 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9120                                                      vector unsigned char __b) {
9121   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9122 }
9123
9124 static __inline__ vector unsigned short __ATTRS_o_ai
9125 vec_vslo(vector unsigned short __a, vector signed char __b) {
9126   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9127                                                        (vector int)__b);
9128 }
9129
9130 static __inline__ vector unsigned short __ATTRS_o_ai
9131 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9132   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9133                                                        (vector int)__b);
9134 }
9135
9136 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9137                                                      vector signed char __b) {
9138   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9139 }
9140
9141 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9142                                                      vector unsigned char __b) {
9143   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9144 }
9145
9146 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9147                                                    vector signed char __b) {
9148   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9149 }
9150
9151 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9152                                                    vector unsigned char __b) {
9153   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9154 }
9155
9156 static __inline__ vector unsigned int __ATTRS_o_ai
9157 vec_vslo(vector unsigned int __a, vector signed char __b) {
9158   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9159                                                      (vector int)__b);
9160 }
9161
9162 static __inline__ vector unsigned int __ATTRS_o_ai
9163 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9164   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9165                                                      (vector int)__b);
9166 }
9167
9168 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9169                                                      vector signed char __b) {
9170   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9171 }
9172
9173 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9174                                                      vector unsigned char __b) {
9175   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9176 }
9177
9178 /* vec_splat */
9179
9180 static __inline__ vector signed char __ATTRS_o_ai
9181 vec_splat(vector signed char __a, unsigned const int __b) {
9182   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9183 }
9184
9185 static __inline__ vector unsigned char __ATTRS_o_ai
9186 vec_splat(vector unsigned char __a, unsigned const int __b) {
9187   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9188 }
9189
9190 static __inline__ vector bool char __ATTRS_o_ai
9191 vec_splat(vector bool char __a, unsigned const int __b) {
9192   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9193 }
9194
9195 static __inline__ vector signed short __ATTRS_o_ai
9196 vec_splat(vector signed short __a, unsigned const int __b) {
9197   unsigned char b0 = (__b & 0x07) * 2;
9198   unsigned char b1 = b0 + 1;
9199   return vec_perm(__a, __a,
9200                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9201                                          b0, b1, b0, b1, b0, b1));
9202 }
9203
9204 static __inline__ vector unsigned short __ATTRS_o_ai
9205 vec_splat(vector unsigned short __a, unsigned const int __b) {
9206   unsigned char b0 = (__b & 0x07) * 2;
9207   unsigned char b1 = b0 + 1;
9208   return vec_perm(__a, __a,
9209                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9210                                          b0, b1, b0, b1, b0, b1));
9211 }
9212
9213 static __inline__ vector bool short __ATTRS_o_ai
9214 vec_splat(vector bool short __a, unsigned const int __b) {
9215   unsigned char b0 = (__b & 0x07) * 2;
9216   unsigned char b1 = b0 + 1;
9217   return vec_perm(__a, __a,
9218                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9219                                          b0, b1, b0, b1, b0, b1));
9220 }
9221
9222 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9223                                                       unsigned const int __b) {
9224   unsigned char b0 = (__b & 0x07) * 2;
9225   unsigned char b1 = b0 + 1;
9226   return vec_perm(__a, __a,
9227                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9228                                          b0, b1, b0, b1, b0, b1));
9229 }
9230
9231 static __inline__ vector signed int __ATTRS_o_ai
9232 vec_splat(vector signed int __a, unsigned const int __b) {
9233   unsigned char b0 = (__b & 0x03) * 4;
9234   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9235   return vec_perm(__a, __a,
9236                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9237                                          b2, b3, b0, b1, b2, b3));
9238 }
9239
9240 static __inline__ vector unsigned int __ATTRS_o_ai
9241 vec_splat(vector unsigned int __a, unsigned const int __b) {
9242   unsigned char b0 = (__b & 0x03) * 4;
9243   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9244   return vec_perm(__a, __a,
9245                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9246                                          b2, b3, b0, b1, b2, b3));
9247 }
9248
9249 static __inline__ vector bool int __ATTRS_o_ai
9250 vec_splat(vector bool int __a, unsigned const int __b) {
9251   unsigned char b0 = (__b & 0x03) * 4;
9252   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9253   return vec_perm(__a, __a,
9254                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9255                                          b2, b3, b0, b1, b2, b3));
9256 }
9257
9258 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9259                                                       unsigned const int __b) {
9260   unsigned char b0 = (__b & 0x03) * 4;
9261   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9262   return vec_perm(__a, __a,
9263                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9264                                          b2, b3, b0, b1, b2, b3));
9265 }
9266
9267 #ifdef __VSX__
9268 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9269                                                        unsigned const int __b) {
9270   unsigned char b0 = (__b & 0x01) * 8;
9271   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9272                 b6 = b0 + 6, b7 = b0 + 7;
9273   return vec_perm(__a, __a,
9274                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9275                                          b2, b3, b4, b5, b6, b7));
9276 }
9277 static __inline__ vector bool long long __ATTRS_o_ai
9278 vec_splat(vector bool long long __a, unsigned const int __b) {
9279   unsigned char b0 = (__b & 0x01) * 8;
9280   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9281                 b6 = b0 + 6, b7 = b0 + 7;
9282   return vec_perm(__a, __a,
9283                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9284                                          b2, b3, b4, b5, b6, b7));
9285 }
9286 static __inline__ vector signed long long __ATTRS_o_ai
9287 vec_splat(vector signed long long __a, unsigned const int __b) {
9288   unsigned char b0 = (__b & 0x01) * 8;
9289   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9290                 b6 = b0 + 6, b7 = b0 + 7;
9291   return vec_perm(__a, __a,
9292                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9293                                          b2, b3, b4, b5, b6, b7));
9294 }
9295 static __inline__ vector unsigned long long __ATTRS_o_ai
9296 vec_splat(vector unsigned long long __a, unsigned const int __b) {
9297   unsigned char b0 = (__b & 0x01) * 8;
9298   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9299                 b6 = b0 + 6, b7 = b0 + 7;
9300   return vec_perm(__a, __a,
9301                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9302                                          b2, b3, b4, b5, b6, b7));
9303 }
9304 #endif
9305
9306 /* vec_vspltb */
9307
9308 #define __builtin_altivec_vspltb vec_vspltb
9309
9310 static __inline__ vector signed char __ATTRS_o_ai
9311 vec_vspltb(vector signed char __a, unsigned char __b) {
9312   return vec_perm(__a, __a, (vector unsigned char)(__b));
9313 }
9314
9315 static __inline__ vector unsigned char __ATTRS_o_ai
9316 vec_vspltb(vector unsigned char __a, unsigned char __b) {
9317   return vec_perm(__a, __a, (vector unsigned char)(__b));
9318 }
9319
9320 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9321                                                            unsigned char __b) {
9322   return vec_perm(__a, __a, (vector unsigned char)(__b));
9323 }
9324
9325 /* vec_vsplth */
9326
9327 #define __builtin_altivec_vsplth vec_vsplth
9328
9329 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9330                                                        unsigned char __b) {
9331   __b *= 2;
9332   unsigned char b1 = __b + 1;
9333   return vec_perm(__a, __a,
9334                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9335                                          __b, b1, __b, b1, __b, b1, __b, b1));
9336 }
9337
9338 static __inline__ vector unsigned short __ATTRS_o_ai
9339 vec_vsplth(vector unsigned short __a, unsigned char __b) {
9340   __b *= 2;
9341   unsigned char b1 = __b + 1;
9342   return vec_perm(__a, __a,
9343                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9344                                          __b, b1, __b, b1, __b, b1, __b, b1));
9345 }
9346
9347 static __inline__ vector bool short __ATTRS_o_ai
9348 vec_vsplth(vector bool short __a, unsigned char __b) {
9349   __b *= 2;
9350   unsigned char b1 = __b + 1;
9351   return vec_perm(__a, __a,
9352                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9353                                          __b, b1, __b, b1, __b, b1, __b, b1));
9354 }
9355
9356 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9357                                                        unsigned char __b) {
9358   __b *= 2;
9359   unsigned char b1 = __b + 1;
9360   return vec_perm(__a, __a,
9361                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9362                                          __b, b1, __b, b1, __b, b1, __b, b1));
9363 }
9364
9365 /* vec_vspltw */
9366
9367 #define __builtin_altivec_vspltw vec_vspltw
9368
9369 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9370                                                      unsigned char __b) {
9371   __b *= 4;
9372   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9373   return vec_perm(__a, __a,
9374                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9375                                          b1, b2, b3, __b, b1, b2, b3));
9376 }
9377
9378 static __inline__ vector unsigned int __ATTRS_o_ai
9379 vec_vspltw(vector unsigned int __a, unsigned char __b) {
9380   __b *= 4;
9381   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9382   return vec_perm(__a, __a,
9383                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9384                                          b1, b2, b3, __b, b1, b2, b3));
9385 }
9386
9387 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9388                                                           unsigned char __b) {
9389   __b *= 4;
9390   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9391   return vec_perm(__a, __a,
9392                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9393                                          b1, b2, b3, __b, b1, b2, b3));
9394 }
9395
9396 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9397                                                        unsigned char __b) {
9398   __b *= 4;
9399   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9400   return vec_perm(__a, __a,
9401                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9402                                          b1, b2, b3, __b, b1, b2, b3));
9403 }
9404
9405 /* vec_splat_s8 */
9406
9407 #define __builtin_altivec_vspltisb vec_splat_s8
9408
9409 // FIXME: parameter should be treated as 5-bit signed literal
9410 static __inline__ vector signed char __ATTRS_o_ai
9411 vec_splat_s8(signed char __a) {
9412   return (vector signed char)(__a);
9413 }
9414
9415 /* vec_vspltisb */
9416
9417 // FIXME: parameter should be treated as 5-bit signed literal
9418 static __inline__ vector signed char __ATTRS_o_ai
9419 vec_vspltisb(signed char __a) {
9420   return (vector signed char)(__a);
9421 }
9422
9423 /* vec_splat_s16 */
9424
9425 #define __builtin_altivec_vspltish vec_splat_s16
9426
9427 // FIXME: parameter should be treated as 5-bit signed literal
9428 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9429   return (vector short)(__a);
9430 }
9431
9432 /* vec_vspltish */
9433
9434 // FIXME: parameter should be treated as 5-bit signed literal
9435 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9436   return (vector short)(__a);
9437 }
9438
9439 /* vec_splat_s32 */
9440
9441 #define __builtin_altivec_vspltisw vec_splat_s32
9442
9443 // FIXME: parameter should be treated as 5-bit signed literal
9444 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9445   return (vector int)(__a);
9446 }
9447
9448 /* vec_vspltisw */
9449
9450 // FIXME: parameter should be treated as 5-bit signed literal
9451 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9452   return (vector int)(__a);
9453 }
9454
9455 /* vec_splat_u8 */
9456
9457 // FIXME: parameter should be treated as 5-bit signed literal
9458 static __inline__ vector unsigned char __ATTRS_o_ai
9459 vec_splat_u8(unsigned char __a) {
9460   return (vector unsigned char)(__a);
9461 }
9462
9463 /* vec_splat_u16 */
9464
9465 // FIXME: parameter should be treated as 5-bit signed literal
9466 static __inline__ vector unsigned short __ATTRS_o_ai
9467 vec_splat_u16(signed char __a) {
9468   return (vector unsigned short)(__a);
9469 }
9470
9471 /* vec_splat_u32 */
9472
9473 // FIXME: parameter should be treated as 5-bit signed literal
9474 static __inline__ vector unsigned int __ATTRS_o_ai
9475 vec_splat_u32(signed char __a) {
9476   return (vector unsigned int)(__a);
9477 }
9478
9479 /* vec_sr */
9480
9481 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
9482 // than the length of __a.
9483 static __inline__ vector unsigned char __ATTRS_o_ai
9484 vec_sr(vector unsigned char __a, vector unsigned char __b) {
9485   return __a >>
9486          (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
9487 }
9488
9489 static __inline__ vector signed char __ATTRS_o_ai
9490 vec_sr(vector signed char __a, vector unsigned char __b) {
9491   return (vector signed char)vec_sr((vector unsigned char)__a, __b);
9492 }
9493
9494 static __inline__ vector unsigned short __ATTRS_o_ai
9495 vec_sr(vector unsigned short __a, vector unsigned short __b) {
9496   return __a >>
9497          (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
9498 }
9499
9500 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
9501                                                    vector unsigned short __b) {
9502   return (vector short)vec_sr((vector unsigned short)__a, __b);
9503 }
9504
9505 static __inline__ vector unsigned int __ATTRS_o_ai
9506 vec_sr(vector unsigned int __a, vector unsigned int __b) {
9507   return __a >>
9508          (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
9509 }
9510
9511 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
9512                                                  vector unsigned int __b) {
9513   return (vector int)vec_sr((vector unsigned int)__a, __b);
9514 }
9515
9516 #ifdef __POWER8_VECTOR__
9517 static __inline__ vector unsigned long long __ATTRS_o_ai
9518 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9519   return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
9520                                                    __CHAR_BIT__));
9521 }
9522
9523 static __inline__ vector long long __ATTRS_o_ai
9524 vec_sr(vector long long __a, vector unsigned long long __b) {
9525   return (vector long long)vec_sr((vector unsigned long long)__a, __b);
9526 }
9527 #endif
9528
9529 /* vec_vsrb */
9530
9531 #define __builtin_altivec_vsrb vec_vsrb
9532
9533 static __inline__ vector signed char __ATTRS_o_ai
9534 vec_vsrb(vector signed char __a, vector unsigned char __b) {
9535   return vec_sr(__a, __b);
9536 }
9537
9538 static __inline__ vector unsigned char __ATTRS_o_ai
9539 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9540   return vec_sr(__a, __b);
9541 }
9542
9543 /* vec_vsrh */
9544
9545 #define __builtin_altivec_vsrh vec_vsrh
9546
9547 static __inline__ vector short __ATTRS_o_ai
9548 vec_vsrh(vector short __a, vector unsigned short __b) {
9549   return vec_sr(__a, __b);
9550 }
9551
9552 static __inline__ vector unsigned short __ATTRS_o_ai
9553 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9554   return vec_sr(__a, __b);
9555 }
9556
9557 /* vec_vsrw */
9558
9559 #define __builtin_altivec_vsrw vec_vsrw
9560
9561 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9562                                                    vector unsigned int __b) {
9563   return vec_sr(__a, __b);
9564 }
9565
9566 static __inline__ vector unsigned int __ATTRS_o_ai
9567 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9568   return vec_sr(__a, __b);
9569 }
9570
9571 /* vec_sra */
9572
9573 static __inline__ vector signed char __ATTRS_o_ai
9574 vec_sra(vector signed char __a, vector unsigned char __b) {
9575   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9576 }
9577
9578 static __inline__ vector unsigned char __ATTRS_o_ai
9579 vec_sra(vector unsigned char __a, vector unsigned char __b) {
9580   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9581 }
9582
9583 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9584                                                     vector unsigned short __b) {
9585   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9586 }
9587
9588 static __inline__ vector unsigned short __ATTRS_o_ai
9589 vec_sra(vector unsigned short __a, vector unsigned short __b) {
9590   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9591 }
9592
9593 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9594                                                   vector unsigned int __b) {
9595   return __builtin_altivec_vsraw(__a, __b);
9596 }
9597
9598 static __inline__ vector unsigned int __ATTRS_o_ai
9599 vec_sra(vector unsigned int __a, vector unsigned int __b) {
9600   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9601 }
9602
9603 #ifdef __POWER8_VECTOR__
9604 static __inline__ vector signed long long __ATTRS_o_ai
9605 vec_sra(vector signed long long __a, vector unsigned long long __b) {
9606   return __a >> __b;
9607 }
9608
9609 static __inline__ vector unsigned long long __ATTRS_o_ai
9610 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9611   return (vector unsigned long long)((vector signed long long)__a >> __b);
9612 }
9613 #endif
9614
9615 /* vec_vsrab */
9616
9617 static __inline__ vector signed char __ATTRS_o_ai
9618 vec_vsrab(vector signed char __a, vector unsigned char __b) {
9619   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9620 }
9621
9622 static __inline__ vector unsigned char __ATTRS_o_ai
9623 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9624   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9625 }
9626
9627 /* vec_vsrah */
9628
9629 static __inline__ vector short __ATTRS_o_ai
9630 vec_vsrah(vector short __a, vector unsigned short __b) {
9631   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9632 }
9633
9634 static __inline__ vector unsigned short __ATTRS_o_ai
9635 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9636   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9637 }
9638
9639 /* vec_vsraw */
9640
9641 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9642                                                     vector unsigned int __b) {
9643   return __builtin_altivec_vsraw(__a, __b);
9644 }
9645
9646 static __inline__ vector unsigned int __ATTRS_o_ai
9647 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9648   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9649 }
9650
9651 /* vec_srl */
9652
9653 static __inline__ vector signed char __ATTRS_o_ai
9654 vec_srl(vector signed char __a, vector unsigned char __b) {
9655   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9656                                                    (vector int)__b);
9657 }
9658
9659 static __inline__ vector signed char __ATTRS_o_ai
9660 vec_srl(vector signed char __a, vector unsigned short __b) {
9661   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9662                                                    (vector int)__b);
9663 }
9664
9665 static __inline__ vector signed char __ATTRS_o_ai
9666 vec_srl(vector signed char __a, vector unsigned int __b) {
9667   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9668                                                    (vector int)__b);
9669 }
9670
9671 static __inline__ vector unsigned char __ATTRS_o_ai
9672 vec_srl(vector unsigned char __a, vector unsigned char __b) {
9673   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9674                                                      (vector int)__b);
9675 }
9676
9677 static __inline__ vector unsigned char __ATTRS_o_ai
9678 vec_srl(vector unsigned char __a, vector unsigned short __b) {
9679   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9680                                                      (vector int)__b);
9681 }
9682
9683 static __inline__ vector unsigned char __ATTRS_o_ai
9684 vec_srl(vector unsigned char __a, vector unsigned int __b) {
9685   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9686                                                      (vector int)__b);
9687 }
9688
9689 static __inline__ vector bool char __ATTRS_o_ai
9690 vec_srl(vector bool char __a, vector unsigned char __b) {
9691   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9692                                                  (vector int)__b);
9693 }
9694
9695 static __inline__ vector bool char __ATTRS_o_ai
9696 vec_srl(vector bool char __a, vector unsigned short __b) {
9697   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9698                                                  (vector int)__b);
9699 }
9700
9701 static __inline__ vector bool char __ATTRS_o_ai
9702 vec_srl(vector bool char __a, vector unsigned int __b) {
9703   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9704                                                  (vector int)__b);
9705 }
9706
9707 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9708                                                     vector unsigned char __b) {
9709   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9710 }
9711
9712 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9713                                                     vector unsigned short __b) {
9714   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9715 }
9716
9717 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9718                                                     vector unsigned int __b) {
9719   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9720 }
9721
9722 static __inline__ vector unsigned short __ATTRS_o_ai
9723 vec_srl(vector unsigned short __a, vector unsigned char __b) {
9724   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9725                                                       (vector int)__b);
9726 }
9727
9728 static __inline__ vector unsigned short __ATTRS_o_ai
9729 vec_srl(vector unsigned short __a, vector unsigned short __b) {
9730   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9731                                                       (vector int)__b);
9732 }
9733
9734 static __inline__ vector unsigned short __ATTRS_o_ai
9735 vec_srl(vector unsigned short __a, vector unsigned int __b) {
9736   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9737                                                       (vector int)__b);
9738 }
9739
9740 static __inline__ vector bool short __ATTRS_o_ai
9741 vec_srl(vector bool short __a, vector unsigned char __b) {
9742   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9743                                                   (vector int)__b);
9744 }
9745
9746 static __inline__ vector bool short __ATTRS_o_ai
9747 vec_srl(vector bool short __a, vector unsigned short __b) {
9748   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9749                                                   (vector int)__b);
9750 }
9751
9752 static __inline__ vector bool short __ATTRS_o_ai
9753 vec_srl(vector bool short __a, vector unsigned int __b) {
9754   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9755                                                   (vector int)__b);
9756 }
9757
9758 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9759                                                     vector unsigned char __b) {
9760   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9761 }
9762
9763 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9764                                                     vector unsigned short __b) {
9765   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9766 }
9767
9768 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9769                                                     vector unsigned int __b) {
9770   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9771 }
9772
9773 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9774                                                   vector unsigned char __b) {
9775   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9776 }
9777
9778 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9779                                                   vector unsigned short __b) {
9780   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9781 }
9782
9783 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9784                                                   vector unsigned int __b) {
9785   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9786 }
9787
9788 static __inline__ vector unsigned int __ATTRS_o_ai
9789 vec_srl(vector unsigned int __a, vector unsigned char __b) {
9790   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9791                                                     (vector int)__b);
9792 }
9793
9794 static __inline__ vector unsigned int __ATTRS_o_ai
9795 vec_srl(vector unsigned int __a, vector unsigned short __b) {
9796   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9797                                                     (vector int)__b);
9798 }
9799
9800 static __inline__ vector unsigned int __ATTRS_o_ai
9801 vec_srl(vector unsigned int __a, vector unsigned int __b) {
9802   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9803                                                     (vector int)__b);
9804 }
9805
9806 static __inline__ vector bool int __ATTRS_o_ai
9807 vec_srl(vector bool int __a, vector unsigned char __b) {
9808   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9809                                                 (vector int)__b);
9810 }
9811
9812 static __inline__ vector bool int __ATTRS_o_ai
9813 vec_srl(vector bool int __a, vector unsigned short __b) {
9814   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9815                                                 (vector int)__b);
9816 }
9817
9818 static __inline__ vector bool int __ATTRS_o_ai
9819 vec_srl(vector bool int __a, vector unsigned int __b) {
9820   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9821                                                 (vector int)__b);
9822 }
9823
9824 #ifdef __VSX__
9825 static __inline__ vector signed long long __ATTRS_o_ai
9826 vec_srl(vector signed long long __a, vector unsigned char __b) {
9827   return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9828                                                         (vector int)__b);
9829 }
9830
9831 static __inline__ vector unsigned long long __ATTRS_o_ai
9832 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9833   return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9834                                                           (vector int)__b);
9835 }
9836 #endif
9837
9838 /* vec_vsr */
9839
9840 static __inline__ vector signed char __ATTRS_o_ai
9841 vec_vsr(vector signed char __a, vector unsigned char __b) {
9842   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9843                                                    (vector int)__b);
9844 }
9845
9846 static __inline__ vector signed char __ATTRS_o_ai
9847 vec_vsr(vector signed char __a, vector unsigned short __b) {
9848   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9849                                                    (vector int)__b);
9850 }
9851
9852 static __inline__ vector signed char __ATTRS_o_ai
9853 vec_vsr(vector signed char __a, vector unsigned int __b) {
9854   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9855                                                    (vector int)__b);
9856 }
9857
9858 static __inline__ vector unsigned char __ATTRS_o_ai
9859 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9860   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9861                                                      (vector int)__b);
9862 }
9863
9864 static __inline__ vector unsigned char __ATTRS_o_ai
9865 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9866   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9867                                                      (vector int)__b);
9868 }
9869
9870 static __inline__ vector unsigned char __ATTRS_o_ai
9871 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9872   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9873                                                      (vector int)__b);
9874 }
9875
9876 static __inline__ vector bool char __ATTRS_o_ai
9877 vec_vsr(vector bool char __a, vector unsigned char __b) {
9878   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9879                                                  (vector int)__b);
9880 }
9881
9882 static __inline__ vector bool char __ATTRS_o_ai
9883 vec_vsr(vector bool char __a, vector unsigned short __b) {
9884   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9885                                                  (vector int)__b);
9886 }
9887
9888 static __inline__ vector bool char __ATTRS_o_ai
9889 vec_vsr(vector bool char __a, vector unsigned int __b) {
9890   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9891                                                  (vector int)__b);
9892 }
9893
9894 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9895                                                     vector unsigned char __b) {
9896   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9897 }
9898
9899 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9900                                                     vector unsigned short __b) {
9901   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9902 }
9903
9904 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9905                                                     vector unsigned int __b) {
9906   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9907 }
9908
9909 static __inline__ vector unsigned short __ATTRS_o_ai
9910 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9911   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9912                                                       (vector int)__b);
9913 }
9914
9915 static __inline__ vector unsigned short __ATTRS_o_ai
9916 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9917   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9918                                                       (vector int)__b);
9919 }
9920
9921 static __inline__ vector unsigned short __ATTRS_o_ai
9922 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9923   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9924                                                       (vector int)__b);
9925 }
9926
9927 static __inline__ vector bool short __ATTRS_o_ai
9928 vec_vsr(vector bool short __a, vector unsigned char __b) {
9929   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9930                                                   (vector int)__b);
9931 }
9932
9933 static __inline__ vector bool short __ATTRS_o_ai
9934 vec_vsr(vector bool short __a, vector unsigned short __b) {
9935   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9936                                                   (vector int)__b);
9937 }
9938
9939 static __inline__ vector bool short __ATTRS_o_ai
9940 vec_vsr(vector bool short __a, vector unsigned int __b) {
9941   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9942                                                   (vector int)__b);
9943 }
9944
9945 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9946                                                     vector unsigned char __b) {
9947   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9948 }
9949
9950 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9951                                                     vector unsigned short __b) {
9952   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9953 }
9954
9955 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9956                                                     vector unsigned int __b) {
9957   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9958 }
9959
9960 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9961                                                   vector unsigned char __b) {
9962   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9963 }
9964
9965 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9966                                                   vector unsigned short __b) {
9967   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9968 }
9969
9970 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9971                                                   vector unsigned int __b) {
9972   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9973 }
9974
9975 static __inline__ vector unsigned int __ATTRS_o_ai
9976 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9977   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9978                                                     (vector int)__b);
9979 }
9980
9981 static __inline__ vector unsigned int __ATTRS_o_ai
9982 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9983   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9984                                                     (vector int)__b);
9985 }
9986
9987 static __inline__ vector unsigned int __ATTRS_o_ai
9988 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
9989   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9990                                                     (vector int)__b);
9991 }
9992
9993 static __inline__ vector bool int __ATTRS_o_ai
9994 vec_vsr(vector bool int __a, vector unsigned char __b) {
9995   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9996                                                 (vector int)__b);
9997 }
9998
9999 static __inline__ vector bool int __ATTRS_o_ai
10000 vec_vsr(vector bool int __a, vector unsigned short __b) {
10001   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10002                                                 (vector int)__b);
10003 }
10004
10005 static __inline__ vector bool int __ATTRS_o_ai
10006 vec_vsr(vector bool int __a, vector unsigned int __b) {
10007   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10008                                                 (vector int)__b);
10009 }
10010
10011 /* vec_sro */
10012
10013 static __inline__ vector signed char __ATTRS_o_ai
10014 vec_sro(vector signed char __a, vector signed char __b) {
10015   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10016                                                     (vector int)__b);
10017 }
10018
10019 static __inline__ vector signed char __ATTRS_o_ai
10020 vec_sro(vector signed char __a, vector unsigned char __b) {
10021   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10022                                                     (vector int)__b);
10023 }
10024
10025 static __inline__ vector unsigned char __ATTRS_o_ai
10026 vec_sro(vector unsigned char __a, vector signed char __b) {
10027   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10028                                                       (vector int)__b);
10029 }
10030
10031 static __inline__ vector unsigned char __ATTRS_o_ai
10032 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10033   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10034                                                       (vector int)__b);
10035 }
10036
10037 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10038                                                     vector signed char __b) {
10039   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10040 }
10041
10042 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10043                                                     vector unsigned char __b) {
10044   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10045 }
10046
10047 static __inline__ vector unsigned short __ATTRS_o_ai
10048 vec_sro(vector unsigned short __a, vector signed char __b) {
10049   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10050                                                        (vector int)__b);
10051 }
10052
10053 static __inline__ vector unsigned short __ATTRS_o_ai
10054 vec_sro(vector unsigned short __a, vector unsigned char __b) {
10055   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10056                                                        (vector int)__b);
10057 }
10058
10059 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10060                                                     vector signed char __b) {
10061   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10062 }
10063
10064 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10065                                                     vector unsigned char __b) {
10066   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10067 }
10068
10069 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10070                                                   vector signed char __b) {
10071   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10072 }
10073
10074 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10075                                                   vector unsigned char __b) {
10076   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10077 }
10078
10079 static __inline__ vector unsigned int __ATTRS_o_ai
10080 vec_sro(vector unsigned int __a, vector signed char __b) {
10081   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10082                                                      (vector int)__b);
10083 }
10084
10085 static __inline__ vector unsigned int __ATTRS_o_ai
10086 vec_sro(vector unsigned int __a, vector unsigned char __b) {
10087   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10088                                                      (vector int)__b);
10089 }
10090
10091 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10092                                                     vector signed char __b) {
10093   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10094 }
10095
10096 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10097                                                     vector unsigned char __b) {
10098   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10099 }
10100
10101 #ifdef __VSX__
10102 static __inline__ vector signed long long __ATTRS_o_ai
10103 vec_sro(vector signed long long __a, vector signed char __b) {
10104   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10105                                                          (vector int)__b);
10106 }
10107
10108 static __inline__ vector signed long long __ATTRS_o_ai
10109 vec_sro(vector signed long long __a, vector unsigned char __b) {
10110   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10111                                                          (vector int)__b);
10112 }
10113
10114 static __inline__ vector unsigned long long __ATTRS_o_ai
10115 vec_sro(vector unsigned long long __a, vector signed char __b) {
10116   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10117                                                            (vector int)__b);
10118 }
10119
10120 static __inline__ vector unsigned long long __ATTRS_o_ai
10121 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10122   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10123                                                            (vector int)__b);
10124 }
10125 #endif
10126
10127 /* vec_vsro */
10128
10129 static __inline__ vector signed char __ATTRS_o_ai
10130 vec_vsro(vector signed char __a, vector signed char __b) {
10131   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10132                                                     (vector int)__b);
10133 }
10134
10135 static __inline__ vector signed char __ATTRS_o_ai
10136 vec_vsro(vector signed char __a, vector unsigned char __b) {
10137   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10138                                                     (vector int)__b);
10139 }
10140
10141 static __inline__ vector unsigned char __ATTRS_o_ai
10142 vec_vsro(vector unsigned char __a, vector signed char __b) {
10143   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10144                                                       (vector int)__b);
10145 }
10146
10147 static __inline__ vector unsigned char __ATTRS_o_ai
10148 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10149   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10150                                                       (vector int)__b);
10151 }
10152
10153 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10154                                                      vector signed char __b) {
10155   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10156 }
10157
10158 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10159                                                      vector unsigned char __b) {
10160   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10161 }
10162
10163 static __inline__ vector unsigned short __ATTRS_o_ai
10164 vec_vsro(vector unsigned short __a, vector signed char __b) {
10165   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10166                                                        (vector int)__b);
10167 }
10168
10169 static __inline__ vector unsigned short __ATTRS_o_ai
10170 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10171   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10172                                                        (vector int)__b);
10173 }
10174
10175 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10176                                                      vector signed char __b) {
10177   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10178 }
10179
10180 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10181                                                      vector unsigned char __b) {
10182   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10183 }
10184
10185 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10186                                                    vector signed char __b) {
10187   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10188 }
10189
10190 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10191                                                    vector unsigned char __b) {
10192   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10193 }
10194
10195 static __inline__ vector unsigned int __ATTRS_o_ai
10196 vec_vsro(vector unsigned int __a, vector signed char __b) {
10197   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10198                                                      (vector int)__b);
10199 }
10200
10201 static __inline__ vector unsigned int __ATTRS_o_ai
10202 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10203   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10204                                                      (vector int)__b);
10205 }
10206
10207 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10208                                                      vector signed char __b) {
10209   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10210 }
10211
10212 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10213                                                      vector unsigned char __b) {
10214   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10215 }
10216
10217 /* vec_st */
10218
10219 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10220                                            vector signed char *__c) {
10221   __builtin_altivec_stvx((vector int)__a, __b, __c);
10222 }
10223
10224 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10225                                            signed char *__c) {
10226   __builtin_altivec_stvx((vector int)__a, __b, __c);
10227 }
10228
10229 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10230                                            vector unsigned char *__c) {
10231   __builtin_altivec_stvx((vector int)__a, __b, __c);
10232 }
10233
10234 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10235                                            unsigned char *__c) {
10236   __builtin_altivec_stvx((vector int)__a, __b, __c);
10237 }
10238
10239 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10240                                            signed char *__c) {
10241   __builtin_altivec_stvx((vector int)__a, __b, __c);
10242 }
10243
10244 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10245                                            unsigned char *__c) {
10246   __builtin_altivec_stvx((vector int)__a, __b, __c);
10247 }
10248
10249 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10250                                            vector bool char *__c) {
10251   __builtin_altivec_stvx((vector int)__a, __b, __c);
10252 }
10253
10254 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10255                                            vector short *__c) {
10256   __builtin_altivec_stvx((vector int)__a, __b, __c);
10257 }
10258
10259 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10260                                            short *__c) {
10261   __builtin_altivec_stvx((vector int)__a, __b, __c);
10262 }
10263
10264 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10265                                            vector unsigned short *__c) {
10266   __builtin_altivec_stvx((vector int)__a, __b, __c);
10267 }
10268
10269 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10270                                            unsigned short *__c) {
10271   __builtin_altivec_stvx((vector int)__a, __b, __c);
10272 }
10273
10274 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10275                                            short *__c) {
10276   __builtin_altivec_stvx((vector int)__a, __b, __c);
10277 }
10278
10279 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10280                                            unsigned short *__c) {
10281   __builtin_altivec_stvx((vector int)__a, __b, __c);
10282 }
10283
10284 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10285                                            vector bool short *__c) {
10286   __builtin_altivec_stvx((vector int)__a, __b, __c);
10287 }
10288
10289 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10290                                            short *__c) {
10291   __builtin_altivec_stvx((vector int)__a, __b, __c);
10292 }
10293
10294 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10295                                            unsigned short *__c) {
10296   __builtin_altivec_stvx((vector int)__a, __b, __c);
10297 }
10298
10299 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10300                                            vector pixel *__c) {
10301   __builtin_altivec_stvx((vector int)__a, __b, __c);
10302 }
10303
10304 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10305                                            vector int *__c) {
10306   __builtin_altivec_stvx(__a, __b, __c);
10307 }
10308
10309 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10310   __builtin_altivec_stvx(__a, __b, __c);
10311 }
10312
10313 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10314                                            vector unsigned int *__c) {
10315   __builtin_altivec_stvx((vector int)__a, __b, __c);
10316 }
10317
10318 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10319                                            unsigned int *__c) {
10320   __builtin_altivec_stvx((vector int)__a, __b, __c);
10321 }
10322
10323 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10324                                            int *__c) {
10325   __builtin_altivec_stvx((vector int)__a, __b, __c);
10326 }
10327
10328 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10329                                            unsigned int *__c) {
10330   __builtin_altivec_stvx((vector int)__a, __b, __c);
10331 }
10332
10333 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10334                                            vector bool int *__c) {
10335   __builtin_altivec_stvx((vector int)__a, __b, __c);
10336 }
10337
10338 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10339                                            vector float *__c) {
10340   __builtin_altivec_stvx((vector int)__a, __b, __c);
10341 }
10342
10343 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10344                                            float *__c) {
10345   __builtin_altivec_stvx((vector int)__a, __b, __c);
10346 }
10347
10348 /* vec_stvx */
10349
10350 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10351                                              vector signed char *__c) {
10352   __builtin_altivec_stvx((vector int)__a, __b, __c);
10353 }
10354
10355 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10356                                              signed char *__c) {
10357   __builtin_altivec_stvx((vector int)__a, __b, __c);
10358 }
10359
10360 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10361                                              vector unsigned char *__c) {
10362   __builtin_altivec_stvx((vector int)__a, __b, __c);
10363 }
10364
10365 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10366                                              unsigned char *__c) {
10367   __builtin_altivec_stvx((vector int)__a, __b, __c);
10368 }
10369
10370 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10371                                              signed char *__c) {
10372   __builtin_altivec_stvx((vector int)__a, __b, __c);
10373 }
10374
10375 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10376                                              unsigned char *__c) {
10377   __builtin_altivec_stvx((vector int)__a, __b, __c);
10378 }
10379
10380 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10381                                              vector bool char *__c) {
10382   __builtin_altivec_stvx((vector int)__a, __b, __c);
10383 }
10384
10385 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10386                                              vector short *__c) {
10387   __builtin_altivec_stvx((vector int)__a, __b, __c);
10388 }
10389
10390 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10391                                              short *__c) {
10392   __builtin_altivec_stvx((vector int)__a, __b, __c);
10393 }
10394
10395 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10396                                              vector unsigned short *__c) {
10397   __builtin_altivec_stvx((vector int)__a, __b, __c);
10398 }
10399
10400 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10401                                              unsigned short *__c) {
10402   __builtin_altivec_stvx((vector int)__a, __b, __c);
10403 }
10404
10405 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10406                                              short *__c) {
10407   __builtin_altivec_stvx((vector int)__a, __b, __c);
10408 }
10409
10410 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10411                                              unsigned short *__c) {
10412   __builtin_altivec_stvx((vector int)__a, __b, __c);
10413 }
10414
10415 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10416                                              vector bool short *__c) {
10417   __builtin_altivec_stvx((vector int)__a, __b, __c);
10418 }
10419
10420 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10421                                              short *__c) {
10422   __builtin_altivec_stvx((vector int)__a, __b, __c);
10423 }
10424
10425 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10426                                              unsigned short *__c) {
10427   __builtin_altivec_stvx((vector int)__a, __b, __c);
10428 }
10429
10430 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10431                                              vector pixel *__c) {
10432   __builtin_altivec_stvx((vector int)__a, __b, __c);
10433 }
10434
10435 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10436                                              vector int *__c) {
10437   __builtin_altivec_stvx(__a, __b, __c);
10438 }
10439
10440 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10441                                              int *__c) {
10442   __builtin_altivec_stvx(__a, __b, __c);
10443 }
10444
10445 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10446                                              vector unsigned int *__c) {
10447   __builtin_altivec_stvx((vector int)__a, __b, __c);
10448 }
10449
10450 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10451                                              unsigned int *__c) {
10452   __builtin_altivec_stvx((vector int)__a, __b, __c);
10453 }
10454
10455 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10456                                              int *__c) {
10457   __builtin_altivec_stvx((vector int)__a, __b, __c);
10458 }
10459
10460 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10461                                              unsigned int *__c) {
10462   __builtin_altivec_stvx((vector int)__a, __b, __c);
10463 }
10464
10465 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10466                                              vector bool int *__c) {
10467   __builtin_altivec_stvx((vector int)__a, __b, __c);
10468 }
10469
10470 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10471                                              vector float *__c) {
10472   __builtin_altivec_stvx((vector int)__a, __b, __c);
10473 }
10474
10475 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10476                                              float *__c) {
10477   __builtin_altivec_stvx((vector int)__a, __b, __c);
10478 }
10479
10480 /* vec_ste */
10481
10482 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10483                                             signed char *__c) {
10484   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10485 }
10486
10487 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10488                                             unsigned char *__c) {
10489   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10490 }
10491
10492 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10493                                             signed char *__c) {
10494   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10495 }
10496
10497 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10498                                             unsigned char *__c) {
10499   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10500 }
10501
10502 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10503                                             short *__c) {
10504   __builtin_altivec_stvehx(__a, __b, __c);
10505 }
10506
10507 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10508                                             unsigned short *__c) {
10509   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10510 }
10511
10512 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10513                                             short *__c) {
10514   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10515 }
10516
10517 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10518                                             unsigned short *__c) {
10519   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10520 }
10521
10522 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10523                                             short *__c) {
10524   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10525 }
10526
10527 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10528                                             unsigned short *__c) {
10529   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10530 }
10531
10532 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10533   __builtin_altivec_stvewx(__a, __b, __c);
10534 }
10535
10536 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10537                                             unsigned int *__c) {
10538   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10539 }
10540
10541 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10542                                             int *__c) {
10543   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10544 }
10545
10546 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10547                                             unsigned int *__c) {
10548   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10549 }
10550
10551 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10552                                             float *__c) {
10553   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10554 }
10555
10556 /* vec_stvebx */
10557
10558 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10559                                                signed char *__c) {
10560   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10561 }
10562
10563 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10564                                                int __b, unsigned char *__c) {
10565   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10566 }
10567
10568 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10569                                                signed char *__c) {
10570   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10571 }
10572
10573 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10574                                                unsigned char *__c) {
10575   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10576 }
10577
10578 /* vec_stvehx */
10579
10580 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10581                                                short *__c) {
10582   __builtin_altivec_stvehx(__a, __b, __c);
10583 }
10584
10585 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10586                                                int __b, unsigned short *__c) {
10587   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10588 }
10589
10590 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10591                                                short *__c) {
10592   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10593 }
10594
10595 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10596                                                unsigned short *__c) {
10597   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10598 }
10599
10600 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10601                                                short *__c) {
10602   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10603 }
10604
10605 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10606                                                unsigned short *__c) {
10607   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10608 }
10609
10610 /* vec_stvewx */
10611
10612 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10613                                                int *__c) {
10614   __builtin_altivec_stvewx(__a, __b, __c);
10615 }
10616
10617 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10618                                                unsigned int *__c) {
10619   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10620 }
10621
10622 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10623                                                int *__c) {
10624   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10625 }
10626
10627 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10628                                                unsigned int *__c) {
10629   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10630 }
10631
10632 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10633                                                float *__c) {
10634   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10635 }
10636
10637 /* vec_stl */
10638
10639 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10640                                             vector signed char *__c) {
10641   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10642 }
10643
10644 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10645                                             signed char *__c) {
10646   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10647 }
10648
10649 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10650                                             vector unsigned char *__c) {
10651   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10652 }
10653
10654 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10655                                             unsigned char *__c) {
10656   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10657 }
10658
10659 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10660                                             signed char *__c) {
10661   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10662 }
10663
10664 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10665                                             unsigned char *__c) {
10666   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10667 }
10668
10669 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10670                                             vector bool char *__c) {
10671   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10672 }
10673
10674 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10675                                             vector short *__c) {
10676   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10677 }
10678
10679 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10680                                             short *__c) {
10681   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10682 }
10683
10684 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10685                                             vector unsigned short *__c) {
10686   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10687 }
10688
10689 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10690                                             unsigned short *__c) {
10691   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10692 }
10693
10694 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10695                                             short *__c) {
10696   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10697 }
10698
10699 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10700                                             unsigned short *__c) {
10701   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10702 }
10703
10704 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10705                                             vector bool short *__c) {
10706   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10707 }
10708
10709 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10710                                             short *__c) {
10711   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10712 }
10713
10714 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10715                                             unsigned short *__c) {
10716   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10717 }
10718
10719 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10720                                             vector pixel *__c) {
10721   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10722 }
10723
10724 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10725                                             vector int *__c) {
10726   __builtin_altivec_stvxl(__a, __b, __c);
10727 }
10728
10729 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10730   __builtin_altivec_stvxl(__a, __b, __c);
10731 }
10732
10733 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10734                                             vector unsigned int *__c) {
10735   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10736 }
10737
10738 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10739                                             unsigned int *__c) {
10740   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10741 }
10742
10743 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10744                                             int *__c) {
10745   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10746 }
10747
10748 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10749                                             unsigned int *__c) {
10750   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10751 }
10752
10753 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10754                                             vector bool int *__c) {
10755   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10756 }
10757
10758 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10759                                             vector float *__c) {
10760   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10761 }
10762
10763 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10764                                             float *__c) {
10765   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10766 }
10767
10768 /* vec_stvxl */
10769
10770 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10771                                               vector signed char *__c) {
10772   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10773 }
10774
10775 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10776                                               signed char *__c) {
10777   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10778 }
10779
10780 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10781                                               vector unsigned char *__c) {
10782   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10783 }
10784
10785 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10786                                               unsigned char *__c) {
10787   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10788 }
10789
10790 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10791                                               signed char *__c) {
10792   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10793 }
10794
10795 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10796                                               unsigned char *__c) {
10797   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10798 }
10799
10800 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10801                                               vector bool char *__c) {
10802   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10803 }
10804
10805 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10806                                               vector short *__c) {
10807   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10808 }
10809
10810 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10811                                               short *__c) {
10812   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10813 }
10814
10815 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10816                                               int __b,
10817                                               vector unsigned short *__c) {
10818   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10819 }
10820
10821 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10822                                               int __b, unsigned short *__c) {
10823   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10824 }
10825
10826 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10827                                               short *__c) {
10828   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10829 }
10830
10831 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10832                                               unsigned short *__c) {
10833   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10834 }
10835
10836 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10837                                               vector bool short *__c) {
10838   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10839 }
10840
10841 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10842                                               short *__c) {
10843   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10844 }
10845
10846 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10847                                               unsigned short *__c) {
10848   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10849 }
10850
10851 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10852                                               vector pixel *__c) {
10853   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10854 }
10855
10856 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10857                                               vector int *__c) {
10858   __builtin_altivec_stvxl(__a, __b, __c);
10859 }
10860
10861 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10862                                               int *__c) {
10863   __builtin_altivec_stvxl(__a, __b, __c);
10864 }
10865
10866 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10867                                               vector unsigned int *__c) {
10868   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10869 }
10870
10871 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10872                                               unsigned int *__c) {
10873   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10874 }
10875
10876 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10877                                               int *__c) {
10878   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10879 }
10880
10881 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10882                                               unsigned int *__c) {
10883   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10884 }
10885
10886 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10887                                               vector bool int *__c) {
10888   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10889 }
10890
10891 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10892                                               vector float *__c) {
10893   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10894 }
10895
10896 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10897                                               float *__c) {
10898   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10899 }
10900
10901 /* vec_sub */
10902
10903 static __inline__ vector signed char __ATTRS_o_ai
10904 vec_sub(vector signed char __a, vector signed char __b) {
10905   return __a - __b;
10906 }
10907
10908 static __inline__ vector signed char __ATTRS_o_ai
10909 vec_sub(vector bool char __a, vector signed char __b) {
10910   return (vector signed char)__a - __b;
10911 }
10912
10913 static __inline__ vector signed char __ATTRS_o_ai
10914 vec_sub(vector signed char __a, vector bool char __b) {
10915   return __a - (vector signed char)__b;
10916 }
10917
10918 static __inline__ vector unsigned char __ATTRS_o_ai
10919 vec_sub(vector unsigned char __a, vector unsigned char __b) {
10920   return __a - __b;
10921 }
10922
10923 static __inline__ vector unsigned char __ATTRS_o_ai
10924 vec_sub(vector bool char __a, vector unsigned char __b) {
10925   return (vector unsigned char)__a - __b;
10926 }
10927
10928 static __inline__ vector unsigned char __ATTRS_o_ai
10929 vec_sub(vector unsigned char __a, vector bool char __b) {
10930   return __a - (vector unsigned char)__b;
10931 }
10932
10933 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10934                                                     vector short __b) {
10935   return __a - __b;
10936 }
10937
10938 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10939                                                     vector short __b) {
10940   return (vector short)__a - __b;
10941 }
10942
10943 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10944                                                     vector bool short __b) {
10945   return __a - (vector short)__b;
10946 }
10947
10948 static __inline__ vector unsigned short __ATTRS_o_ai
10949 vec_sub(vector unsigned short __a, vector unsigned short __b) {
10950   return __a - __b;
10951 }
10952
10953 static __inline__ vector unsigned short __ATTRS_o_ai
10954 vec_sub(vector bool short __a, vector unsigned short __b) {
10955   return (vector unsigned short)__a - __b;
10956 }
10957
10958 static __inline__ vector unsigned short __ATTRS_o_ai
10959 vec_sub(vector unsigned short __a, vector bool short __b) {
10960   return __a - (vector unsigned short)__b;
10961 }
10962
10963 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10964                                                   vector int __b) {
10965   return __a - __b;
10966 }
10967
10968 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10969                                                   vector int __b) {
10970   return (vector int)__a - __b;
10971 }
10972
10973 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10974                                                   vector bool int __b) {
10975   return __a - (vector int)__b;
10976 }
10977
10978 static __inline__ vector unsigned int __ATTRS_o_ai
10979 vec_sub(vector unsigned int __a, vector unsigned int __b) {
10980   return __a - __b;
10981 }
10982
10983 static __inline__ vector unsigned int __ATTRS_o_ai
10984 vec_sub(vector bool int __a, vector unsigned int __b) {
10985   return (vector unsigned int)__a - __b;
10986 }
10987
10988 static __inline__ vector unsigned int __ATTRS_o_ai
10989 vec_sub(vector unsigned int __a, vector bool int __b) {
10990   return __a - (vector unsigned int)__b;
10991 }
10992
10993 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10994 static __inline__ vector signed __int128 __ATTRS_o_ai
10995 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
10996   return __a - __b;
10997 }
10998
10999 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11000 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11001   return __a - __b;
11002 }
11003 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11004
11005 #ifdef __VSX__
11006 static __inline__ vector signed long long __ATTRS_o_ai
11007 vec_sub(vector signed long long __a, vector signed long long __b) {
11008   return __a - __b;
11009 }
11010
11011 static __inline__ vector unsigned long long __ATTRS_o_ai
11012 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11013   return __a - __b;
11014 }
11015
11016 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11017                                                      vector double __b) {
11018   return __a - __b;
11019 }
11020 #endif
11021
11022 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11023                                                     vector float __b) {
11024   return __a - __b;
11025 }
11026
11027 /* vec_vsububm */
11028
11029 #define __builtin_altivec_vsububm vec_vsububm
11030
11031 static __inline__ vector signed char __ATTRS_o_ai
11032 vec_vsububm(vector signed char __a, vector signed char __b) {
11033   return __a - __b;
11034 }
11035
11036 static __inline__ vector signed char __ATTRS_o_ai
11037 vec_vsububm(vector bool char __a, vector signed char __b) {
11038   return (vector signed char)__a - __b;
11039 }
11040
11041 static __inline__ vector signed char __ATTRS_o_ai
11042 vec_vsububm(vector signed char __a, vector bool char __b) {
11043   return __a - (vector signed char)__b;
11044 }
11045
11046 static __inline__ vector unsigned char __ATTRS_o_ai
11047 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11048   return __a - __b;
11049 }
11050
11051 static __inline__ vector unsigned char __ATTRS_o_ai
11052 vec_vsububm(vector bool char __a, vector unsigned char __b) {
11053   return (vector unsigned char)__a - __b;
11054 }
11055
11056 static __inline__ vector unsigned char __ATTRS_o_ai
11057 vec_vsububm(vector unsigned char __a, vector bool char __b) {
11058   return __a - (vector unsigned char)__b;
11059 }
11060
11061 /* vec_vsubuhm */
11062
11063 #define __builtin_altivec_vsubuhm vec_vsubuhm
11064
11065 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11066                                                         vector short __b) {
11067   return __a - __b;
11068 }
11069
11070 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11071                                                         vector short __b) {
11072   return (vector short)__a - __b;
11073 }
11074
11075 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11076                                                         vector bool short __b) {
11077   return __a - (vector short)__b;
11078 }
11079
11080 static __inline__ vector unsigned short __ATTRS_o_ai
11081 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11082   return __a - __b;
11083 }
11084
11085 static __inline__ vector unsigned short __ATTRS_o_ai
11086 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11087   return (vector unsigned short)__a - __b;
11088 }
11089
11090 static __inline__ vector unsigned short __ATTRS_o_ai
11091 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11092   return __a - (vector unsigned short)__b;
11093 }
11094
11095 /* vec_vsubuwm */
11096
11097 #define __builtin_altivec_vsubuwm vec_vsubuwm
11098
11099 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11100                                                       vector int __b) {
11101   return __a - __b;
11102 }
11103
11104 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11105                                                       vector int __b) {
11106   return (vector int)__a - __b;
11107 }
11108
11109 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11110                                                       vector bool int __b) {
11111   return __a - (vector int)__b;
11112 }
11113
11114 static __inline__ vector unsigned int __ATTRS_o_ai
11115 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11116   return __a - __b;
11117 }
11118
11119 static __inline__ vector unsigned int __ATTRS_o_ai
11120 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11121   return (vector unsigned int)__a - __b;
11122 }
11123
11124 static __inline__ vector unsigned int __ATTRS_o_ai
11125 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11126   return __a - (vector unsigned int)__b;
11127 }
11128
11129 /* vec_vsubfp */
11130
11131 #define __builtin_altivec_vsubfp vec_vsubfp
11132
11133 static __inline__ vector float __attribute__((__always_inline__))
11134 vec_vsubfp(vector float __a, vector float __b) {
11135   return __a - __b;
11136 }
11137
11138 /* vec_subc */
11139
11140 static __inline__ vector signed int __ATTRS_o_ai
11141 vec_subc(vector signed int __a, vector signed int __b) {
11142   return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11143                                                       (vector unsigned int) __b);
11144 }
11145
11146 static __inline__ vector unsigned int __ATTRS_o_ai
11147 vec_subc(vector unsigned int __a, vector unsigned int __b) {
11148   return __builtin_altivec_vsubcuw(__a, __b);
11149 }
11150
11151 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11152 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11153 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11154   return __builtin_altivec_vsubcuq(__a, __b);
11155 }
11156
11157 static __inline__ vector signed __int128 __ATTRS_o_ai
11158 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11159   return __builtin_altivec_vsubcuq(__a, __b);
11160 }
11161 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11162
11163 /* vec_vsubcuw */
11164
11165 static __inline__ vector unsigned int __attribute__((__always_inline__))
11166 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11167   return __builtin_altivec_vsubcuw(__a, __b);
11168 }
11169
11170 /* vec_subs */
11171
11172 static __inline__ vector signed char __ATTRS_o_ai
11173 vec_subs(vector signed char __a, vector signed char __b) {
11174   return __builtin_altivec_vsubsbs(__a, __b);
11175 }
11176
11177 static __inline__ vector signed char __ATTRS_o_ai
11178 vec_subs(vector bool char __a, vector signed char __b) {
11179   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11180 }
11181
11182 static __inline__ vector signed char __ATTRS_o_ai
11183 vec_subs(vector signed char __a, vector bool char __b) {
11184   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11185 }
11186
11187 static __inline__ vector unsigned char __ATTRS_o_ai
11188 vec_subs(vector unsigned char __a, vector unsigned char __b) {
11189   return __builtin_altivec_vsububs(__a, __b);
11190 }
11191
11192 static __inline__ vector unsigned char __ATTRS_o_ai
11193 vec_subs(vector bool char __a, vector unsigned char __b) {
11194   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11195 }
11196
11197 static __inline__ vector unsigned char __ATTRS_o_ai
11198 vec_subs(vector unsigned char __a, vector bool char __b) {
11199   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11200 }
11201
11202 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11203                                                      vector short __b) {
11204   return __builtin_altivec_vsubshs(__a, __b);
11205 }
11206
11207 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11208                                                      vector short __b) {
11209   return __builtin_altivec_vsubshs((vector short)__a, __b);
11210 }
11211
11212 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11213                                                      vector bool short __b) {
11214   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11215 }
11216
11217 static __inline__ vector unsigned short __ATTRS_o_ai
11218 vec_subs(vector unsigned short __a, vector unsigned short __b) {
11219   return __builtin_altivec_vsubuhs(__a, __b);
11220 }
11221
11222 static __inline__ vector unsigned short __ATTRS_o_ai
11223 vec_subs(vector bool short __a, vector unsigned short __b) {
11224   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11225 }
11226
11227 static __inline__ vector unsigned short __ATTRS_o_ai
11228 vec_subs(vector unsigned short __a, vector bool short __b) {
11229   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11230 }
11231
11232 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11233                                                    vector int __b) {
11234   return __builtin_altivec_vsubsws(__a, __b);
11235 }
11236
11237 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11238                                                    vector int __b) {
11239   return __builtin_altivec_vsubsws((vector int)__a, __b);
11240 }
11241
11242 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11243                                                    vector bool int __b) {
11244   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11245 }
11246
11247 static __inline__ vector unsigned int __ATTRS_o_ai
11248 vec_subs(vector unsigned int __a, vector unsigned int __b) {
11249   return __builtin_altivec_vsubuws(__a, __b);
11250 }
11251
11252 static __inline__ vector unsigned int __ATTRS_o_ai
11253 vec_subs(vector bool int __a, vector unsigned int __b) {
11254   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11255 }
11256
11257 static __inline__ vector unsigned int __ATTRS_o_ai
11258 vec_subs(vector unsigned int __a, vector bool int __b) {
11259   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11260 }
11261
11262 /* vec_vsubsbs */
11263
11264 static __inline__ vector signed char __ATTRS_o_ai
11265 vec_vsubsbs(vector signed char __a, vector signed char __b) {
11266   return __builtin_altivec_vsubsbs(__a, __b);
11267 }
11268
11269 static __inline__ vector signed char __ATTRS_o_ai
11270 vec_vsubsbs(vector bool char __a, vector signed char __b) {
11271   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11272 }
11273
11274 static __inline__ vector signed char __ATTRS_o_ai
11275 vec_vsubsbs(vector signed char __a, vector bool char __b) {
11276   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11277 }
11278
11279 /* vec_vsububs */
11280
11281 static __inline__ vector unsigned char __ATTRS_o_ai
11282 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11283   return __builtin_altivec_vsububs(__a, __b);
11284 }
11285
11286 static __inline__ vector unsigned char __ATTRS_o_ai
11287 vec_vsububs(vector bool char __a, vector unsigned char __b) {
11288   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11289 }
11290
11291 static __inline__ vector unsigned char __ATTRS_o_ai
11292 vec_vsububs(vector unsigned char __a, vector bool char __b) {
11293   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11294 }
11295
11296 /* vec_vsubshs */
11297
11298 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11299                                                         vector short __b) {
11300   return __builtin_altivec_vsubshs(__a, __b);
11301 }
11302
11303 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11304                                                         vector short __b) {
11305   return __builtin_altivec_vsubshs((vector short)__a, __b);
11306 }
11307
11308 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11309                                                         vector bool short __b) {
11310   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11311 }
11312
11313 /* vec_vsubuhs */
11314
11315 static __inline__ vector unsigned short __ATTRS_o_ai
11316 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11317   return __builtin_altivec_vsubuhs(__a, __b);
11318 }
11319
11320 static __inline__ vector unsigned short __ATTRS_o_ai
11321 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11322   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11323 }
11324
11325 static __inline__ vector unsigned short __ATTRS_o_ai
11326 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11327   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11328 }
11329
11330 /* vec_vsubsws */
11331
11332 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11333                                                       vector int __b) {
11334   return __builtin_altivec_vsubsws(__a, __b);
11335 }
11336
11337 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11338                                                       vector int __b) {
11339   return __builtin_altivec_vsubsws((vector int)__a, __b);
11340 }
11341
11342 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11343                                                       vector bool int __b) {
11344   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11345 }
11346
11347 /* vec_vsubuws */
11348
11349 static __inline__ vector unsigned int __ATTRS_o_ai
11350 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11351   return __builtin_altivec_vsubuws(__a, __b);
11352 }
11353
11354 static __inline__ vector unsigned int __ATTRS_o_ai
11355 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11356   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11357 }
11358
11359 static __inline__ vector unsigned int __ATTRS_o_ai
11360 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11361   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11362 }
11363
11364 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11365 /* vec_vsubuqm */
11366
11367 static __inline__ vector signed __int128 __ATTRS_o_ai
11368 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11369   return __a - __b;
11370 }
11371
11372 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11373 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11374   return __a - __b;
11375 }
11376
11377 /* vec_vsubeuqm */
11378
11379
11380 static __inline__ vector signed __int128 __ATTRS_o_ai
11381 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11382              vector signed __int128 __c) {
11383   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11384 }
11385
11386 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11387 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11388              vector unsigned __int128 __c) {
11389   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11390 }
11391
11392 static __inline__ vector signed __int128 __ATTRS_o_ai
11393 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11394              vector signed __int128 __c) {
11395   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11396 }
11397
11398 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11399 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11400              vector unsigned __int128 __c) {
11401   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11402 }
11403
11404 /* vec_vsubcuq */
11405
11406 static __inline__ vector signed __int128 __ATTRS_o_ai
11407 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11408   return __builtin_altivec_vsubcuq(__a, __b);
11409 }
11410
11411 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11412 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11413   return __builtin_altivec_vsubcuq(__a, __b);
11414 }
11415
11416 /* vec_vsubecuq */
11417
11418 static __inline__ vector signed __int128 __ATTRS_o_ai
11419 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11420              vector signed __int128 __c) {
11421   return __builtin_altivec_vsubecuq(__a, __b, __c);
11422 }
11423
11424 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11425 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11426              vector unsigned __int128 __c) {
11427   return __builtin_altivec_vsubecuq(__a, __b, __c);
11428 }
11429
11430 static __inline__ vector signed int __ATTRS_o_ai
11431 vec_subec(vector signed int __a, vector signed int __b,
11432              vector signed int __c) {
11433   return vec_addec(__a, ~__b, __c);
11434 }
11435
11436 static __inline__ vector unsigned int __ATTRS_o_ai
11437 vec_subec(vector unsigned int __a, vector unsigned int __b,
11438              vector unsigned int __c) {
11439   return vec_addec(__a, ~__b, __c);
11440 }
11441
11442 static __inline__ vector signed __int128 __ATTRS_o_ai
11443 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11444              vector signed __int128 __c) {
11445   return __builtin_altivec_vsubecuq(__a, __b, __c);
11446 }
11447
11448 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11449 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11450              vector unsigned __int128 __c) {
11451   return __builtin_altivec_vsubecuq(__a, __b, __c);
11452 }
11453 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11454
11455 static __inline__ vector signed int __ATTRS_o_ai
11456 vec_sube(vector signed int __a, vector signed int __b,
11457          vector signed int __c) {
11458   vector signed int __mask = {1, 1, 1, 1};
11459   vector signed int __carry = __c & __mask;
11460   return vec_adde(__a, ~__b, __carry);
11461 }
11462
11463 static __inline__ vector unsigned int __ATTRS_o_ai
11464 vec_sube(vector unsigned int __a, vector unsigned int __b,
11465          vector unsigned int __c) {
11466   vector unsigned int __mask = {1, 1, 1, 1};
11467   vector unsigned int __carry = __c & __mask;
11468   return vec_adde(__a, ~__b, __carry);
11469 }
11470 /* vec_sum4s */
11471
11472 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11473                                                     vector int __b) {
11474   return __builtin_altivec_vsum4sbs(__a, __b);
11475 }
11476
11477 static __inline__ vector unsigned int __ATTRS_o_ai
11478 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11479   return __builtin_altivec_vsum4ubs(__a, __b);
11480 }
11481
11482 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11483                                                     vector int __b) {
11484   return __builtin_altivec_vsum4shs(__a, __b);
11485 }
11486
11487 /* vec_vsum4sbs */
11488
11489 static __inline__ vector int __attribute__((__always_inline__))
11490 vec_vsum4sbs(vector signed char __a, vector int __b) {
11491   return __builtin_altivec_vsum4sbs(__a, __b);
11492 }
11493
11494 /* vec_vsum4ubs */
11495
11496 static __inline__ vector unsigned int __attribute__((__always_inline__))
11497 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11498   return __builtin_altivec_vsum4ubs(__a, __b);
11499 }
11500
11501 /* vec_vsum4shs */
11502
11503 static __inline__ vector int __attribute__((__always_inline__))
11504 vec_vsum4shs(vector signed short __a, vector int __b) {
11505   return __builtin_altivec_vsum4shs(__a, __b);
11506 }
11507
11508 /* vec_sum2s */
11509
11510 /* The vsum2sws instruction has a big-endian bias, so that the second
11511    input vector and the result always reference big-endian elements
11512    1 and 3 (little-endian element 0 and 2).  For ease of porting the
11513    programmer wants elements 1 and 3 in both cases, so for little
11514    endian we must perform some permutes.  */
11515
11516 static __inline__ vector signed int __attribute__((__always_inline__))
11517 vec_sum2s(vector int __a, vector int __b) {
11518 #ifdef __LITTLE_ENDIAN__
11519   vector int __c = (vector signed int)vec_perm(
11520       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11521                                        8, 9, 10, 11));
11522   __c = __builtin_altivec_vsum2sws(__a, __c);
11523   return (vector signed int)vec_perm(
11524       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11525                                        8, 9, 10, 11));
11526 #else
11527   return __builtin_altivec_vsum2sws(__a, __b);
11528 #endif
11529 }
11530
11531 /* vec_vsum2sws */
11532
11533 static __inline__ vector signed int __attribute__((__always_inline__))
11534 vec_vsum2sws(vector int __a, vector int __b) {
11535 #ifdef __LITTLE_ENDIAN__
11536   vector int __c = (vector signed int)vec_perm(
11537       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11538                                        8, 9, 10, 11));
11539   __c = __builtin_altivec_vsum2sws(__a, __c);
11540   return (vector signed int)vec_perm(
11541       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11542                                        8, 9, 10, 11));
11543 #else
11544   return __builtin_altivec_vsum2sws(__a, __b);
11545 #endif
11546 }
11547
11548 /* vec_sums */
11549
11550 /* The vsumsws instruction has a big-endian bias, so that the second
11551    input vector and the result always reference big-endian element 3
11552    (little-endian element 0).  For ease of porting the programmer
11553    wants element 3 in both cases, so for little endian we must perform
11554    some permutes.  */
11555
11556 static __inline__ vector signed int __attribute__((__always_inline__))
11557 vec_sums(vector signed int __a, vector signed int __b) {
11558 #ifdef __LITTLE_ENDIAN__
11559   __b = (vector signed int)vec_splat(__b, 3);
11560   __b = __builtin_altivec_vsumsws(__a, __b);
11561   return (vector signed int)(0, 0, 0, __b[0]);
11562 #else
11563   return __builtin_altivec_vsumsws(__a, __b);
11564 #endif
11565 }
11566
11567 /* vec_vsumsws */
11568
11569 static __inline__ vector signed int __attribute__((__always_inline__))
11570 vec_vsumsws(vector signed int __a, vector signed int __b) {
11571 #ifdef __LITTLE_ENDIAN__
11572   __b = (vector signed int)vec_splat(__b, 3);
11573   __b = __builtin_altivec_vsumsws(__a, __b);
11574   return (vector signed int)(0, 0, 0, __b[0]);
11575 #else
11576   return __builtin_altivec_vsumsws(__a, __b);
11577 #endif
11578 }
11579
11580 /* vec_trunc */
11581
11582 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11583 #ifdef __VSX__
11584   return __builtin_vsx_xvrspiz(__a);
11585 #else
11586   return __builtin_altivec_vrfiz(__a);
11587 #endif
11588 }
11589
11590 #ifdef __VSX__
11591 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11592   return __builtin_vsx_xvrdpiz(__a);
11593 }
11594 #endif
11595
11596 /* vec_vrfiz */
11597
11598 static __inline__ vector float __attribute__((__always_inline__))
11599 vec_vrfiz(vector float __a) {
11600   return __builtin_altivec_vrfiz(__a);
11601 }
11602
11603 /* vec_unpackh */
11604
11605 /* The vector unpack instructions all have a big-endian bias, so for
11606    little endian we must reverse the meanings of "high" and "low."  */
11607
11608 static __inline__ vector short __ATTRS_o_ai
11609 vec_unpackh(vector signed char __a) {
11610 #ifdef __LITTLE_ENDIAN__
11611   return __builtin_altivec_vupklsb((vector char)__a);
11612 #else
11613   return __builtin_altivec_vupkhsb((vector char)__a);
11614 #endif
11615 }
11616
11617 static __inline__ vector bool short __ATTRS_o_ai
11618 vec_unpackh(vector bool char __a) {
11619 #ifdef __LITTLE_ENDIAN__
11620   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11621 #else
11622   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11623 #endif
11624 }
11625
11626 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11627 #ifdef __LITTLE_ENDIAN__
11628   return __builtin_altivec_vupklsh(__a);
11629 #else
11630   return __builtin_altivec_vupkhsh(__a);
11631 #endif
11632 }
11633
11634 static __inline__ vector bool int __ATTRS_o_ai
11635 vec_unpackh(vector bool short __a) {
11636 #ifdef __LITTLE_ENDIAN__
11637   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11638 #else
11639   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11640 #endif
11641 }
11642
11643 static __inline__ vector unsigned int __ATTRS_o_ai
11644 vec_unpackh(vector pixel __a) {
11645 #ifdef __LITTLE_ENDIAN__
11646   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11647 #else
11648   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11649 #endif
11650 }
11651
11652 #ifdef __POWER8_VECTOR__
11653 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11654 #ifdef __LITTLE_ENDIAN__
11655   return __builtin_altivec_vupklsw(__a);
11656 #else
11657   return __builtin_altivec_vupkhsw(__a);
11658 #endif
11659 }
11660
11661 static __inline__ vector bool long long __ATTRS_o_ai
11662 vec_unpackh(vector bool int __a) {
11663 #ifdef __LITTLE_ENDIAN__
11664   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11665 #else
11666   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11667 #endif
11668 }
11669
11670 static __inline__ vector double __ATTRS_o_ai
11671 vec_unpackh(vector float __a) {
11672   return (vector double)(__a[0], __a[1]);
11673 }
11674 #endif
11675
11676 /* vec_vupkhsb */
11677
11678 static __inline__ vector short __ATTRS_o_ai
11679 vec_vupkhsb(vector signed char __a) {
11680 #ifdef __LITTLE_ENDIAN__
11681   return __builtin_altivec_vupklsb((vector char)__a);
11682 #else
11683   return __builtin_altivec_vupkhsb((vector char)__a);
11684 #endif
11685 }
11686
11687 static __inline__ vector bool short __ATTRS_o_ai
11688 vec_vupkhsb(vector bool char __a) {
11689 #ifdef __LITTLE_ENDIAN__
11690   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11691 #else
11692   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11693 #endif
11694 }
11695
11696 /* vec_vupkhsh */
11697
11698 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11699 #ifdef __LITTLE_ENDIAN__
11700   return __builtin_altivec_vupklsh(__a);
11701 #else
11702   return __builtin_altivec_vupkhsh(__a);
11703 #endif
11704 }
11705
11706 static __inline__ vector bool int __ATTRS_o_ai
11707 vec_vupkhsh(vector bool short __a) {
11708 #ifdef __LITTLE_ENDIAN__
11709   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11710 #else
11711   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11712 #endif
11713 }
11714
11715 static __inline__ vector unsigned int __ATTRS_o_ai
11716 vec_vupkhsh(vector pixel __a) {
11717 #ifdef __LITTLE_ENDIAN__
11718   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11719 #else
11720   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11721 #endif
11722 }
11723
11724 /* vec_vupkhsw */
11725
11726 #ifdef __POWER8_VECTOR__
11727 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11728 #ifdef __LITTLE_ENDIAN__
11729   return __builtin_altivec_vupklsw(__a);
11730 #else
11731   return __builtin_altivec_vupkhsw(__a);
11732 #endif
11733 }
11734
11735 static __inline__ vector bool long long __ATTRS_o_ai
11736 vec_vupkhsw(vector bool int __a) {
11737 #ifdef __LITTLE_ENDIAN__
11738   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11739 #else
11740   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11741 #endif
11742 }
11743 #endif
11744
11745 /* vec_unpackl */
11746
11747 static __inline__ vector short __ATTRS_o_ai
11748 vec_unpackl(vector signed char __a) {
11749 #ifdef __LITTLE_ENDIAN__
11750   return __builtin_altivec_vupkhsb((vector char)__a);
11751 #else
11752   return __builtin_altivec_vupklsb((vector char)__a);
11753 #endif
11754 }
11755
11756 static __inline__ vector bool short __ATTRS_o_ai
11757 vec_unpackl(vector bool char __a) {
11758 #ifdef __LITTLE_ENDIAN__
11759   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11760 #else
11761   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11762 #endif
11763 }
11764
11765 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11766 #ifdef __LITTLE_ENDIAN__
11767   return __builtin_altivec_vupkhsh(__a);
11768 #else
11769   return __builtin_altivec_vupklsh(__a);
11770 #endif
11771 }
11772
11773 static __inline__ vector bool int __ATTRS_o_ai
11774 vec_unpackl(vector bool short __a) {
11775 #ifdef __LITTLE_ENDIAN__
11776   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11777 #else
11778   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11779 #endif
11780 }
11781
11782 static __inline__ vector unsigned int __ATTRS_o_ai
11783 vec_unpackl(vector pixel __a) {
11784 #ifdef __LITTLE_ENDIAN__
11785   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11786 #else
11787   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11788 #endif
11789 }
11790
11791 #ifdef __POWER8_VECTOR__
11792 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11793 #ifdef __LITTLE_ENDIAN__
11794   return __builtin_altivec_vupkhsw(__a);
11795 #else
11796   return __builtin_altivec_vupklsw(__a);
11797 #endif
11798 }
11799
11800 static __inline__ vector bool long long __ATTRS_o_ai
11801 vec_unpackl(vector bool int __a) {
11802 #ifdef __LITTLE_ENDIAN__
11803   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11804 #else
11805   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11806 #endif
11807 }
11808
11809 static __inline__ vector double __ATTRS_o_ai
11810 vec_unpackl(vector float __a) {
11811   return (vector double)(__a[2], __a[3]);
11812 }
11813 #endif
11814
11815 /* vec_vupklsb */
11816
11817 static __inline__ vector short __ATTRS_o_ai
11818 vec_vupklsb(vector signed char __a) {
11819 #ifdef __LITTLE_ENDIAN__
11820   return __builtin_altivec_vupkhsb((vector char)__a);
11821 #else
11822   return __builtin_altivec_vupklsb((vector char)__a);
11823 #endif
11824 }
11825
11826 static __inline__ vector bool short __ATTRS_o_ai
11827 vec_vupklsb(vector bool char __a) {
11828 #ifdef __LITTLE_ENDIAN__
11829   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11830 #else
11831   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11832 #endif
11833 }
11834
11835 /* vec_vupklsh */
11836
11837 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11838 #ifdef __LITTLE_ENDIAN__
11839   return __builtin_altivec_vupkhsh(__a);
11840 #else
11841   return __builtin_altivec_vupklsh(__a);
11842 #endif
11843 }
11844
11845 static __inline__ vector bool int __ATTRS_o_ai
11846 vec_vupklsh(vector bool short __a) {
11847 #ifdef __LITTLE_ENDIAN__
11848   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11849 #else
11850   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11851 #endif
11852 }
11853
11854 static __inline__ vector unsigned int __ATTRS_o_ai
11855 vec_vupklsh(vector pixel __a) {
11856 #ifdef __LITTLE_ENDIAN__
11857   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11858 #else
11859   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11860 #endif
11861 }
11862
11863 /* vec_vupklsw */
11864
11865 #ifdef __POWER8_VECTOR__
11866 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11867 #ifdef __LITTLE_ENDIAN__
11868   return __builtin_altivec_vupkhsw(__a);
11869 #else
11870   return __builtin_altivec_vupklsw(__a);
11871 #endif
11872 }
11873
11874 static __inline__ vector bool long long __ATTRS_o_ai
11875 vec_vupklsw(vector bool int __a) {
11876 #ifdef __LITTLE_ENDIAN__
11877   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11878 #else
11879   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11880 #endif
11881 }
11882 #endif
11883
11884 /* vec_vsx_ld */
11885
11886 #ifdef __VSX__
11887
11888 static __inline__ vector bool int __ATTRS_o_ai
11889 vec_vsx_ld(int __a, const vector bool int *__b) {
11890   return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11891 }
11892
11893 static __inline__ vector signed int __ATTRS_o_ai
11894 vec_vsx_ld(int __a, const vector signed int *__b) {
11895   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11896 }
11897
11898 static __inline__ vector signed int __ATTRS_o_ai
11899 vec_vsx_ld(int __a, const signed int *__b) {
11900   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11901 }
11902
11903 static __inline__ vector unsigned int __ATTRS_o_ai
11904 vec_vsx_ld(int __a, const vector unsigned int *__b) {
11905   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11906 }
11907
11908 static __inline__ vector unsigned int __ATTRS_o_ai
11909 vec_vsx_ld(int __a, const unsigned int *__b) {
11910   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11911 }
11912
11913 static __inline__ vector float __ATTRS_o_ai
11914 vec_vsx_ld(int __a, const vector float *__b) {
11915   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11916 }
11917
11918 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11919                                                        const float *__b) {
11920   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11921 }
11922
11923 static __inline__ vector signed long long __ATTRS_o_ai
11924 vec_vsx_ld(int __a, const vector signed long long *__b) {
11925   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11926 }
11927
11928 static __inline__ vector unsigned long long __ATTRS_o_ai
11929 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11930   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11931 }
11932
11933 static __inline__ vector double __ATTRS_o_ai
11934 vec_vsx_ld(int __a, const vector double *__b) {
11935   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11936 }
11937
11938 static __inline__ vector double __ATTRS_o_ai
11939 vec_vsx_ld(int __a, const double *__b) {
11940   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11941 }
11942
11943 static __inline__ vector bool short __ATTRS_o_ai
11944 vec_vsx_ld(int __a, const vector bool short *__b) {
11945   return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11946 }
11947
11948 static __inline__ vector signed short __ATTRS_o_ai
11949 vec_vsx_ld(int __a, const vector signed short *__b) {
11950   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11951 }
11952
11953 static __inline__ vector signed short __ATTRS_o_ai
11954 vec_vsx_ld(int __a, const signed short *__b) {
11955   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11956 }
11957
11958 static __inline__ vector unsigned short __ATTRS_o_ai
11959 vec_vsx_ld(int __a, const vector unsigned short *__b) {
11960   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11961 }
11962
11963 static __inline__ vector unsigned short __ATTRS_o_ai
11964 vec_vsx_ld(int __a, const unsigned short *__b) {
11965   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11966 }
11967
11968 static __inline__ vector bool char __ATTRS_o_ai
11969 vec_vsx_ld(int __a, const vector bool char *__b) {
11970   return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11971 }
11972
11973 static __inline__ vector signed char __ATTRS_o_ai
11974 vec_vsx_ld(int __a, const vector signed char *__b) {
11975   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11976 }
11977
11978 static __inline__ vector signed char __ATTRS_o_ai
11979 vec_vsx_ld(int __a, const signed char *__b) {
11980   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11981 }
11982
11983 static __inline__ vector unsigned char __ATTRS_o_ai
11984 vec_vsx_ld(int __a, const vector unsigned char *__b) {
11985   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11986 }
11987
11988 static __inline__ vector unsigned char __ATTRS_o_ai
11989 vec_vsx_ld(int __a, const unsigned char *__b) {
11990   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11991 }
11992
11993 #endif
11994
11995 /* vec_vsx_st */
11996
11997 #ifdef __VSX__
11998
11999 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12000                                                vector bool int *__c) {
12001   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12002 }
12003
12004 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12005                                                signed int *__c) {
12006   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12007 }
12008
12009 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12010                                                unsigned int *__c) {
12011   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12012 }
12013
12014 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12015                                                vector signed int *__c) {
12016   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12017 }
12018
12019 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12020                                                signed int *__c) {
12021   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12022 }
12023
12024 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12025                                                vector unsigned int *__c) {
12026   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12027 }
12028
12029 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12030                                                unsigned int *__c) {
12031   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12032 }
12033
12034 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12035                                                vector float *__c) {
12036   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12037 }
12038
12039 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12040                                                float *__c) {
12041   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12042 }
12043
12044 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12045                                                int __b,
12046                                                vector signed long long *__c) {
12047   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12048 }
12049
12050 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12051                                                int __b,
12052                                                vector unsigned long long *__c) {
12053   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12054 }
12055
12056 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12057                                                vector double *__c) {
12058   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12059 }
12060
12061 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12062                                                double *__c) {
12063   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12064 }
12065
12066 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12067                                                vector bool short *__c) {
12068   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12069 }
12070
12071 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12072                                                signed short *__c) {
12073   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12074 }
12075
12076 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12077                                                unsigned short *__c) {
12078   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12079 }
12080 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12081                                                vector signed short *__c) {
12082   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12083 }
12084
12085 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12086                                                signed short *__c) {
12087   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12088 }
12089
12090 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12091                                                int __b,
12092                                                vector unsigned short *__c) {
12093   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12094 }
12095
12096 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12097                                                int __b, unsigned short *__c) {
12098   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12099 }
12100
12101 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12102                                                vector bool char *__c) {
12103   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12104 }
12105
12106 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12107                                                signed char *__c) {
12108   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12109 }
12110
12111 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12112                                                unsigned char *__c) {
12113   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12114 }
12115
12116 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12117                                                vector signed char *__c) {
12118   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12119 }
12120
12121 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12122                                                signed char *__c) {
12123   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12124 }
12125
12126 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12127                                                int __b,
12128                                                vector unsigned char *__c) {
12129   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12130 }
12131
12132 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12133                                                int __b, unsigned char *__c) {
12134   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12135 }
12136
12137 #endif
12138
12139 #ifdef __VSX__
12140 #define vec_xxpermdi __builtin_vsx_xxpermdi
12141 #define vec_xxsldwi __builtin_vsx_xxsldwi
12142 #endif
12143
12144 /* vec_xor */
12145
12146 #define __builtin_altivec_vxor vec_xor
12147
12148 static __inline__ vector signed char __ATTRS_o_ai
12149 vec_xor(vector signed char __a, vector signed char __b) {
12150   return __a ^ __b;
12151 }
12152
12153 static __inline__ vector signed char __ATTRS_o_ai
12154 vec_xor(vector bool char __a, vector signed char __b) {
12155   return (vector signed char)__a ^ __b;
12156 }
12157
12158 static __inline__ vector signed char __ATTRS_o_ai
12159 vec_xor(vector signed char __a, vector bool char __b) {
12160   return __a ^ (vector signed char)__b;
12161 }
12162
12163 static __inline__ vector unsigned char __ATTRS_o_ai
12164 vec_xor(vector unsigned char __a, vector unsigned char __b) {
12165   return __a ^ __b;
12166 }
12167
12168 static __inline__ vector unsigned char __ATTRS_o_ai
12169 vec_xor(vector bool char __a, vector unsigned char __b) {
12170   return (vector unsigned char)__a ^ __b;
12171 }
12172
12173 static __inline__ vector unsigned char __ATTRS_o_ai
12174 vec_xor(vector unsigned char __a, vector bool char __b) {
12175   return __a ^ (vector unsigned char)__b;
12176 }
12177
12178 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12179                                                         vector bool char __b) {
12180   return __a ^ __b;
12181 }
12182
12183 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12184                                                     vector short __b) {
12185   return __a ^ __b;
12186 }
12187
12188 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12189                                                     vector short __b) {
12190   return (vector short)__a ^ __b;
12191 }
12192
12193 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12194                                                     vector bool short __b) {
12195   return __a ^ (vector short)__b;
12196 }
12197
12198 static __inline__ vector unsigned short __ATTRS_o_ai
12199 vec_xor(vector unsigned short __a, vector unsigned short __b) {
12200   return __a ^ __b;
12201 }
12202
12203 static __inline__ vector unsigned short __ATTRS_o_ai
12204 vec_xor(vector bool short __a, vector unsigned short __b) {
12205   return (vector unsigned short)__a ^ __b;
12206 }
12207
12208 static __inline__ vector unsigned short __ATTRS_o_ai
12209 vec_xor(vector unsigned short __a, vector bool short __b) {
12210   return __a ^ (vector unsigned short)__b;
12211 }
12212
12213 static __inline__ vector bool short __ATTRS_o_ai
12214 vec_xor(vector bool short __a, vector bool short __b) {
12215   return __a ^ __b;
12216 }
12217
12218 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12219                                                   vector int __b) {
12220   return __a ^ __b;
12221 }
12222
12223 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12224                                                   vector int __b) {
12225   return (vector int)__a ^ __b;
12226 }
12227
12228 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12229                                                   vector bool int __b) {
12230   return __a ^ (vector int)__b;
12231 }
12232
12233 static __inline__ vector unsigned int __ATTRS_o_ai
12234 vec_xor(vector unsigned int __a, vector unsigned int __b) {
12235   return __a ^ __b;
12236 }
12237
12238 static __inline__ vector unsigned int __ATTRS_o_ai
12239 vec_xor(vector bool int __a, vector unsigned int __b) {
12240   return (vector unsigned int)__a ^ __b;
12241 }
12242
12243 static __inline__ vector unsigned int __ATTRS_o_ai
12244 vec_xor(vector unsigned int __a, vector bool int __b) {
12245   return __a ^ (vector unsigned int)__b;
12246 }
12247
12248 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12249                                                        vector bool int __b) {
12250   return __a ^ __b;
12251 }
12252
12253 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12254                                                     vector float __b) {
12255   vector unsigned int __res =
12256       (vector unsigned int)__a ^ (vector unsigned int)__b;
12257   return (vector float)__res;
12258 }
12259
12260 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12261                                                     vector float __b) {
12262   vector unsigned int __res =
12263       (vector unsigned int)__a ^ (vector unsigned int)__b;
12264   return (vector float)__res;
12265 }
12266
12267 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12268                                                     vector bool int __b) {
12269   vector unsigned int __res =
12270       (vector unsigned int)__a ^ (vector unsigned int)__b;
12271   return (vector float)__res;
12272 }
12273
12274 #ifdef __VSX__
12275 static __inline__ vector signed long long __ATTRS_o_ai
12276 vec_xor(vector signed long long __a, vector signed long long __b) {
12277   return __a ^ __b;
12278 }
12279
12280 static __inline__ vector signed long long __ATTRS_o_ai
12281 vec_xor(vector bool long long __a, vector signed long long __b) {
12282   return (vector signed long long)__a ^ __b;
12283 }
12284
12285 static __inline__ vector signed long long __ATTRS_o_ai
12286 vec_xor(vector signed long long __a, vector bool long long __b) {
12287   return __a ^ (vector signed long long)__b;
12288 }
12289
12290 static __inline__ vector unsigned long long __ATTRS_o_ai
12291 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12292   return __a ^ __b;
12293 }
12294
12295 static __inline__ vector unsigned long long __ATTRS_o_ai
12296 vec_xor(vector bool long long __a, vector unsigned long long __b) {
12297   return (vector unsigned long long)__a ^ __b;
12298 }
12299
12300 static __inline__ vector unsigned long long __ATTRS_o_ai
12301 vec_xor(vector unsigned long long __a, vector bool long long __b) {
12302   return __a ^ (vector unsigned long long)__b;
12303 }
12304
12305 static __inline__ vector bool long long __ATTRS_o_ai
12306 vec_xor(vector bool long long __a, vector bool long long __b) {
12307   return __a ^ __b;
12308 }
12309
12310 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12311                                                      vector double __b) {
12312   return (vector double)((vector unsigned long long)__a ^
12313                          (vector unsigned long long)__b);
12314 }
12315
12316 static __inline__ vector double __ATTRS_o_ai
12317 vec_xor(vector double __a, vector bool long long __b) {
12318   return (vector double)((vector unsigned long long)__a ^
12319                          (vector unsigned long long)__b);
12320 }
12321
12322 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12323                                                      vector double __b) {
12324   return (vector double)((vector unsigned long long)__a ^
12325                          (vector unsigned long long)__b);
12326 }
12327 #endif
12328
12329 /* vec_vxor */
12330
12331 static __inline__ vector signed char __ATTRS_o_ai
12332 vec_vxor(vector signed char __a, vector signed char __b) {
12333   return __a ^ __b;
12334 }
12335
12336 static __inline__ vector signed char __ATTRS_o_ai
12337 vec_vxor(vector bool char __a, vector signed char __b) {
12338   return (vector signed char)__a ^ __b;
12339 }
12340
12341 static __inline__ vector signed char __ATTRS_o_ai
12342 vec_vxor(vector signed char __a, vector bool char __b) {
12343   return __a ^ (vector signed char)__b;
12344 }
12345
12346 static __inline__ vector unsigned char __ATTRS_o_ai
12347 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12348   return __a ^ __b;
12349 }
12350
12351 static __inline__ vector unsigned char __ATTRS_o_ai
12352 vec_vxor(vector bool char __a, vector unsigned char __b) {
12353   return (vector unsigned char)__a ^ __b;
12354 }
12355
12356 static __inline__ vector unsigned char __ATTRS_o_ai
12357 vec_vxor(vector unsigned char __a, vector bool char __b) {
12358   return __a ^ (vector unsigned char)__b;
12359 }
12360
12361 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12362                                                          vector bool char __b) {
12363   return __a ^ __b;
12364 }
12365
12366 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12367                                                      vector short __b) {
12368   return __a ^ __b;
12369 }
12370
12371 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12372                                                      vector short __b) {
12373   return (vector short)__a ^ __b;
12374 }
12375
12376 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12377                                                      vector bool short __b) {
12378   return __a ^ (vector short)__b;
12379 }
12380
12381 static __inline__ vector unsigned short __ATTRS_o_ai
12382 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12383   return __a ^ __b;
12384 }
12385
12386 static __inline__ vector unsigned short __ATTRS_o_ai
12387 vec_vxor(vector bool short __a, vector unsigned short __b) {
12388   return (vector unsigned short)__a ^ __b;
12389 }
12390
12391 static __inline__ vector unsigned short __ATTRS_o_ai
12392 vec_vxor(vector unsigned short __a, vector bool short __b) {
12393   return __a ^ (vector unsigned short)__b;
12394 }
12395
12396 static __inline__ vector bool short __ATTRS_o_ai
12397 vec_vxor(vector bool short __a, vector bool short __b) {
12398   return __a ^ __b;
12399 }
12400
12401 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12402                                                    vector int __b) {
12403   return __a ^ __b;
12404 }
12405
12406 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12407                                                    vector int __b) {
12408   return (vector int)__a ^ __b;
12409 }
12410
12411 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12412                                                    vector bool int __b) {
12413   return __a ^ (vector int)__b;
12414 }
12415
12416 static __inline__ vector unsigned int __ATTRS_o_ai
12417 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12418   return __a ^ __b;
12419 }
12420
12421 static __inline__ vector unsigned int __ATTRS_o_ai
12422 vec_vxor(vector bool int __a, vector unsigned int __b) {
12423   return (vector unsigned int)__a ^ __b;
12424 }
12425
12426 static __inline__ vector unsigned int __ATTRS_o_ai
12427 vec_vxor(vector unsigned int __a, vector bool int __b) {
12428   return __a ^ (vector unsigned int)__b;
12429 }
12430
12431 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12432                                                         vector bool int __b) {
12433   return __a ^ __b;
12434 }
12435
12436 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12437                                                      vector float __b) {
12438   vector unsigned int __res =
12439       (vector unsigned int)__a ^ (vector unsigned int)__b;
12440   return (vector float)__res;
12441 }
12442
12443 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12444                                                      vector float __b) {
12445   vector unsigned int __res =
12446       (vector unsigned int)__a ^ (vector unsigned int)__b;
12447   return (vector float)__res;
12448 }
12449
12450 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12451                                                      vector bool int __b) {
12452   vector unsigned int __res =
12453       (vector unsigned int)__a ^ (vector unsigned int)__b;
12454   return (vector float)__res;
12455 }
12456
12457 #ifdef __VSX__
12458 static __inline__ vector signed long long __ATTRS_o_ai
12459 vec_vxor(vector signed long long __a, vector signed long long __b) {
12460   return __a ^ __b;
12461 }
12462
12463 static __inline__ vector signed long long __ATTRS_o_ai
12464 vec_vxor(vector bool long long __a, vector signed long long __b) {
12465   return (vector signed long long)__a ^ __b;
12466 }
12467
12468 static __inline__ vector signed long long __ATTRS_o_ai
12469 vec_vxor(vector signed long long __a, vector bool long long __b) {
12470   return __a ^ (vector signed long long)__b;
12471 }
12472
12473 static __inline__ vector unsigned long long __ATTRS_o_ai
12474 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12475   return __a ^ __b;
12476 }
12477
12478 static __inline__ vector unsigned long long __ATTRS_o_ai
12479 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12480   return (vector unsigned long long)__a ^ __b;
12481 }
12482
12483 static __inline__ vector unsigned long long __ATTRS_o_ai
12484 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12485   return __a ^ (vector unsigned long long)__b;
12486 }
12487
12488 static __inline__ vector bool long long __ATTRS_o_ai
12489 vec_vxor(vector bool long long __a, vector bool long long __b) {
12490   return __a ^ __b;
12491 }
12492 #endif
12493
12494 /* ------------------------ extensions for CBEA ----------------------------- */
12495
12496 /* vec_extract */
12497
12498 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12499                                                        int __b) {
12500   return __a[__b];
12501 }
12502
12503 static __inline__ unsigned char __ATTRS_o_ai
12504 vec_extract(vector unsigned char __a, int __b) {
12505   return __a[__b];
12506 }
12507
12508 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12509                                                          int __b) {
12510   return __a[__b];
12511 }
12512
12513 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12514                                                         int __b) {
12515   return __a[__b];
12516 }
12517
12518 static __inline__ unsigned short __ATTRS_o_ai
12519 vec_extract(vector unsigned short __a, int __b) {
12520   return __a[__b];
12521 }
12522
12523 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12524                                                           int __b) {
12525   return __a[__b];
12526 }
12527
12528 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12529                                                       int __b) {
12530   return __a[__b];
12531 }
12532
12533 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12534                                                         int __b) {
12535   return __a[__b];
12536 }
12537
12538 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12539                                                         int __b) {
12540   return __a[__b];
12541 }
12542
12543 #ifdef __VSX__
12544 static __inline__ signed long long __ATTRS_o_ai
12545 vec_extract(vector signed long long __a, int __b) {
12546   return __a[__b];
12547 }
12548
12549 static __inline__ unsigned long long __ATTRS_o_ai
12550 vec_extract(vector unsigned long long __a, int __b) {
12551   return __a[__b];
12552 }
12553
12554 static __inline__ unsigned long long __ATTRS_o_ai
12555 vec_extract(vector bool long long __a, int __b) {
12556   return __a[__b];
12557 }
12558
12559 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12560   return __a[__b];
12561 }
12562 #endif
12563
12564 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12565   return __a[__b];
12566 }
12567
12568 #ifdef __POWER9_VECTOR__
12569
12570 #define vec_insert4b __builtin_vsx_insertword
12571 #define vec_extract4b __builtin_vsx_extractuword
12572
12573 /* vec_extract_exp */
12574
12575 static __inline__ vector unsigned int __ATTRS_o_ai
12576 vec_extract_exp(vector float __a) {
12577   return __builtin_vsx_xvxexpsp(__a);
12578 }
12579
12580 static __inline__ vector unsigned long long __ATTRS_o_ai
12581 vec_extract_exp(vector double __a) {
12582   return __builtin_vsx_xvxexpdp(__a);
12583 }
12584
12585 /* vec_extract_sig */
12586
12587 static __inline__ vector unsigned int __ATTRS_o_ai
12588 vec_extract_sig(vector float __a) {
12589   return __builtin_vsx_xvxsigsp(__a);
12590 }
12591
12592 static __inline__ vector unsigned long long __ATTRS_o_ai
12593 vec_extract_sig (vector double __a) {
12594   return __builtin_vsx_xvxsigdp(__a);
12595 }
12596
12597 static __inline__ vector float __ATTRS_o_ai
12598 vec_extract_fp32_from_shorth(vector unsigned short __a) {
12599   vector unsigned short __b =
12600 #ifdef __LITTLE_ENDIAN__
12601             __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12602 #else
12603             __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12604 #endif
12605   return __builtin_vsx_xvcvhpsp(__b);
12606 }
12607
12608 static __inline__ vector float __ATTRS_o_ai
12609 vec_extract_fp32_from_shortl(vector unsigned short __a) {
12610   vector unsigned short __b =
12611 #ifdef __LITTLE_ENDIAN__
12612             __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12613 #else
12614             __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12615 #endif
12616   return __builtin_vsx_xvcvhpsp(__b);
12617 }
12618 #endif /* __POWER9_VECTOR__ */
12619
12620 /* vec_insert */
12621
12622 static __inline__ vector signed char __ATTRS_o_ai
12623 vec_insert(signed char __a, vector signed char __b, int __c) {
12624   __b[__c] = __a;
12625   return __b;
12626 }
12627
12628 static __inline__ vector unsigned char __ATTRS_o_ai
12629 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12630   __b[__c] = __a;
12631   return __b;
12632 }
12633
12634 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12635                                                            vector bool char __b,
12636                                                            int __c) {
12637   __b[__c] = __a;
12638   return __b;
12639 }
12640
12641 static __inline__ vector signed short __ATTRS_o_ai
12642 vec_insert(signed short __a, vector signed short __b, int __c) {
12643   __b[__c] = __a;
12644   return __b;
12645 }
12646
12647 static __inline__ vector unsigned short __ATTRS_o_ai
12648 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12649   __b[__c] = __a;
12650   return __b;
12651 }
12652
12653 static __inline__ vector bool short __ATTRS_o_ai
12654 vec_insert(unsigned short __a, vector bool short __b, int __c) {
12655   __b[__c] = __a;
12656   return __b;
12657 }
12658
12659 static __inline__ vector signed int __ATTRS_o_ai
12660 vec_insert(signed int __a, vector signed int __b, int __c) {
12661   __b[__c] = __a;
12662   return __b;
12663 }
12664
12665 static __inline__ vector unsigned int __ATTRS_o_ai
12666 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12667   __b[__c] = __a;
12668   return __b;
12669 }
12670
12671 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12672                                                           vector bool int __b,
12673                                                           int __c) {
12674   __b[__c] = __a;
12675   return __b;
12676 }
12677
12678 #ifdef __VSX__
12679 static __inline__ vector signed long long __ATTRS_o_ai
12680 vec_insert(signed long long __a, vector signed long long __b, int __c) {
12681   __b[__c] = __a;
12682   return __b;
12683 }
12684
12685 static __inline__ vector unsigned long long __ATTRS_o_ai
12686 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12687   __b[__c] = __a;
12688   return __b;
12689 }
12690
12691 static __inline__ vector bool long long __ATTRS_o_ai
12692 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12693   __b[__c] = __a;
12694   return __b;
12695 }
12696 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12697                                                         vector double __b,
12698                                                         int __c) {
12699   __b[__c] = __a;
12700   return __b;
12701 }
12702 #endif
12703
12704 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12705                                                        vector float __b,
12706                                                        int __c) {
12707   __b[__c] = __a;
12708   return __b;
12709 }
12710
12711 /* vec_lvlx */
12712
12713 static __inline__ vector signed char __ATTRS_o_ai
12714 vec_lvlx(int __a, const signed char *__b) {
12715   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12716                   vec_lvsl(__a, __b));
12717 }
12718
12719 static __inline__ vector signed char __ATTRS_o_ai
12720 vec_lvlx(int __a, const vector signed char *__b) {
12721   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12722                   vec_lvsl(__a, (unsigned char *)__b));
12723 }
12724
12725 static __inline__ vector unsigned char __ATTRS_o_ai
12726 vec_lvlx(int __a, const unsigned char *__b) {
12727   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12728                   vec_lvsl(__a, __b));
12729 }
12730
12731 static __inline__ vector unsigned char __ATTRS_o_ai
12732 vec_lvlx(int __a, const vector unsigned char *__b) {
12733   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12734                   vec_lvsl(__a, (unsigned char *)__b));
12735 }
12736
12737 static __inline__ vector bool char __ATTRS_o_ai
12738 vec_lvlx(int __a, const vector bool char *__b) {
12739   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12740                   vec_lvsl(__a, (unsigned char *)__b));
12741 }
12742
12743 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12744                                                      const short *__b) {
12745   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12746 }
12747
12748 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12749                                                      const vector short *__b) {
12750   return vec_perm(vec_ld(__a, __b), (vector short)(0),
12751                   vec_lvsl(__a, (unsigned char *)__b));
12752 }
12753
12754 static __inline__ vector unsigned short __ATTRS_o_ai
12755 vec_lvlx(int __a, const unsigned short *__b) {
12756   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12757                   vec_lvsl(__a, __b));
12758 }
12759
12760 static __inline__ vector unsigned short __ATTRS_o_ai
12761 vec_lvlx(int __a, const vector unsigned short *__b) {
12762   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12763                   vec_lvsl(__a, (unsigned char *)__b));
12764 }
12765
12766 static __inline__ vector bool short __ATTRS_o_ai
12767 vec_lvlx(int __a, const vector bool short *__b) {
12768   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12769                   vec_lvsl(__a, (unsigned char *)__b));
12770 }
12771
12772 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12773                                                      const vector pixel *__b) {
12774   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12775                   vec_lvsl(__a, (unsigned char *)__b));
12776 }
12777
12778 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12779   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12780 }
12781
12782 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12783                                                    const vector int *__b) {
12784   return vec_perm(vec_ld(__a, __b), (vector int)(0),
12785                   vec_lvsl(__a, (unsigned char *)__b));
12786 }
12787
12788 static __inline__ vector unsigned int __ATTRS_o_ai
12789 vec_lvlx(int __a, const unsigned int *__b) {
12790   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12791                   vec_lvsl(__a, __b));
12792 }
12793
12794 static __inline__ vector unsigned int __ATTRS_o_ai
12795 vec_lvlx(int __a, const vector unsigned int *__b) {
12796   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12797                   vec_lvsl(__a, (unsigned char *)__b));
12798 }
12799
12800 static __inline__ vector bool int __ATTRS_o_ai
12801 vec_lvlx(int __a, const vector bool int *__b) {
12802   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12803                   vec_lvsl(__a, (unsigned char *)__b));
12804 }
12805
12806 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12807                                                      const float *__b) {
12808   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12809 }
12810
12811 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12812                                                      const vector float *__b) {
12813   return vec_perm(vec_ld(__a, __b), (vector float)(0),
12814                   vec_lvsl(__a, (unsigned char *)__b));
12815 }
12816
12817 /* vec_lvlxl */
12818
12819 static __inline__ vector signed char __ATTRS_o_ai
12820 vec_lvlxl(int __a, const signed char *__b) {
12821   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12822                   vec_lvsl(__a, __b));
12823 }
12824
12825 static __inline__ vector signed char __ATTRS_o_ai
12826 vec_lvlxl(int __a, const vector signed char *__b) {
12827   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12828                   vec_lvsl(__a, (unsigned char *)__b));
12829 }
12830
12831 static __inline__ vector unsigned char __ATTRS_o_ai
12832 vec_lvlxl(int __a, const unsigned char *__b) {
12833   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12834                   vec_lvsl(__a, __b));
12835 }
12836
12837 static __inline__ vector unsigned char __ATTRS_o_ai
12838 vec_lvlxl(int __a, const vector unsigned char *__b) {
12839   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12840                   vec_lvsl(__a, (unsigned char *)__b));
12841 }
12842
12843 static __inline__ vector bool char __ATTRS_o_ai
12844 vec_lvlxl(int __a, const vector bool char *__b) {
12845   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12846                   vec_lvsl(__a, (unsigned char *)__b));
12847 }
12848
12849 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12850                                                       const short *__b) {
12851   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12852 }
12853
12854 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12855                                                       const vector short *__b) {
12856   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12857                   vec_lvsl(__a, (unsigned char *)__b));
12858 }
12859
12860 static __inline__ vector unsigned short __ATTRS_o_ai
12861 vec_lvlxl(int __a, const unsigned short *__b) {
12862   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12863                   vec_lvsl(__a, __b));
12864 }
12865
12866 static __inline__ vector unsigned short __ATTRS_o_ai
12867 vec_lvlxl(int __a, const vector unsigned short *__b) {
12868   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12869                   vec_lvsl(__a, (unsigned char *)__b));
12870 }
12871
12872 static __inline__ vector bool short __ATTRS_o_ai
12873 vec_lvlxl(int __a, const vector bool short *__b) {
12874   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12875                   vec_lvsl(__a, (unsigned char *)__b));
12876 }
12877
12878 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12879                                                       const vector pixel *__b) {
12880   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12881                   vec_lvsl(__a, (unsigned char *)__b));
12882 }
12883
12884 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12885   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12886 }
12887
12888 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12889                                                     const vector int *__b) {
12890   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12891                   vec_lvsl(__a, (unsigned char *)__b));
12892 }
12893
12894 static __inline__ vector unsigned int __ATTRS_o_ai
12895 vec_lvlxl(int __a, const unsigned int *__b) {
12896   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12897                   vec_lvsl(__a, __b));
12898 }
12899
12900 static __inline__ vector unsigned int __ATTRS_o_ai
12901 vec_lvlxl(int __a, const vector unsigned int *__b) {
12902   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12903                   vec_lvsl(__a, (unsigned char *)__b));
12904 }
12905
12906 static __inline__ vector bool int __ATTRS_o_ai
12907 vec_lvlxl(int __a, const vector bool int *__b) {
12908   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12909                   vec_lvsl(__a, (unsigned char *)__b));
12910 }
12911
12912 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12913                                                       const float *__b) {
12914   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12915 }
12916
12917 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12918                                                       vector float *__b) {
12919   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12920                   vec_lvsl(__a, (unsigned char *)__b));
12921 }
12922
12923 /* vec_lvrx */
12924
12925 static __inline__ vector signed char __ATTRS_o_ai
12926 vec_lvrx(int __a, const signed char *__b) {
12927   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12928                   vec_lvsl(__a, __b));
12929 }
12930
12931 static __inline__ vector signed char __ATTRS_o_ai
12932 vec_lvrx(int __a, const vector signed char *__b) {
12933   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12934                   vec_lvsl(__a, (unsigned char *)__b));
12935 }
12936
12937 static __inline__ vector unsigned char __ATTRS_o_ai
12938 vec_lvrx(int __a, const unsigned char *__b) {
12939   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12940                   vec_lvsl(__a, __b));
12941 }
12942
12943 static __inline__ vector unsigned char __ATTRS_o_ai
12944 vec_lvrx(int __a, const vector unsigned char *__b) {
12945   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12946                   vec_lvsl(__a, (unsigned char *)__b));
12947 }
12948
12949 static __inline__ vector bool char __ATTRS_o_ai
12950 vec_lvrx(int __a, const vector bool char *__b) {
12951   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12952                   vec_lvsl(__a, (unsigned char *)__b));
12953 }
12954
12955 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12956                                                      const short *__b) {
12957   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12958 }
12959
12960 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12961                                                      const vector short *__b) {
12962   return vec_perm((vector short)(0), vec_ld(__a, __b),
12963                   vec_lvsl(__a, (unsigned char *)__b));
12964 }
12965
12966 static __inline__ vector unsigned short __ATTRS_o_ai
12967 vec_lvrx(int __a, const unsigned short *__b) {
12968   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12969                   vec_lvsl(__a, __b));
12970 }
12971
12972 static __inline__ vector unsigned short __ATTRS_o_ai
12973 vec_lvrx(int __a, const vector unsigned short *__b) {
12974   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12975                   vec_lvsl(__a, (unsigned char *)__b));
12976 }
12977
12978 static __inline__ vector bool short __ATTRS_o_ai
12979 vec_lvrx(int __a, const vector bool short *__b) {
12980   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12981                   vec_lvsl(__a, (unsigned char *)__b));
12982 }
12983
12984 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12985                                                      const vector pixel *__b) {
12986   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12987                   vec_lvsl(__a, (unsigned char *)__b));
12988 }
12989
12990 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
12991   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12992 }
12993
12994 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
12995                                                    const vector int *__b) {
12996   return vec_perm((vector int)(0), vec_ld(__a, __b),
12997                   vec_lvsl(__a, (unsigned char *)__b));
12998 }
12999
13000 static __inline__ vector unsigned int __ATTRS_o_ai
13001 vec_lvrx(int __a, const unsigned int *__b) {
13002   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13003                   vec_lvsl(__a, __b));
13004 }
13005
13006 static __inline__ vector unsigned int __ATTRS_o_ai
13007 vec_lvrx(int __a, const vector unsigned int *__b) {
13008   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13009                   vec_lvsl(__a, (unsigned char *)__b));
13010 }
13011
13012 static __inline__ vector bool int __ATTRS_o_ai
13013 vec_lvrx(int __a, const vector bool int *__b) {
13014   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13015                   vec_lvsl(__a, (unsigned char *)__b));
13016 }
13017
13018 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13019                                                      const float *__b) {
13020   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13021 }
13022
13023 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13024                                                      const vector float *__b) {
13025   return vec_perm((vector float)(0), vec_ld(__a, __b),
13026                   vec_lvsl(__a, (unsigned char *)__b));
13027 }
13028
13029 /* vec_lvrxl */
13030
13031 static __inline__ vector signed char __ATTRS_o_ai
13032 vec_lvrxl(int __a, const signed char *__b) {
13033   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13034                   vec_lvsl(__a, __b));
13035 }
13036
13037 static __inline__ vector signed char __ATTRS_o_ai
13038 vec_lvrxl(int __a, const vector signed char *__b) {
13039   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13040                   vec_lvsl(__a, (unsigned char *)__b));
13041 }
13042
13043 static __inline__ vector unsigned char __ATTRS_o_ai
13044 vec_lvrxl(int __a, const unsigned char *__b) {
13045   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13046                   vec_lvsl(__a, __b));
13047 }
13048
13049 static __inline__ vector unsigned char __ATTRS_o_ai
13050 vec_lvrxl(int __a, const vector unsigned char *__b) {
13051   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13052                   vec_lvsl(__a, (unsigned char *)__b));
13053 }
13054
13055 static __inline__ vector bool char __ATTRS_o_ai
13056 vec_lvrxl(int __a, const vector bool char *__b) {
13057   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13058                   vec_lvsl(__a, (unsigned char *)__b));
13059 }
13060
13061 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13062                                                       const short *__b) {
13063   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13064 }
13065
13066 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13067                                                       const vector short *__b) {
13068   return vec_perm((vector short)(0), vec_ldl(__a, __b),
13069                   vec_lvsl(__a, (unsigned char *)__b));
13070 }
13071
13072 static __inline__ vector unsigned short __ATTRS_o_ai
13073 vec_lvrxl(int __a, const unsigned short *__b) {
13074   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13075                   vec_lvsl(__a, __b));
13076 }
13077
13078 static __inline__ vector unsigned short __ATTRS_o_ai
13079 vec_lvrxl(int __a, const vector unsigned short *__b) {
13080   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13081                   vec_lvsl(__a, (unsigned char *)__b));
13082 }
13083
13084 static __inline__ vector bool short __ATTRS_o_ai
13085 vec_lvrxl(int __a, const vector bool short *__b) {
13086   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13087                   vec_lvsl(__a, (unsigned char *)__b));
13088 }
13089
13090 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13091                                                       const vector pixel *__b) {
13092   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13093                   vec_lvsl(__a, (unsigned char *)__b));
13094 }
13095
13096 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13097   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13098 }
13099
13100 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13101                                                     const vector int *__b) {
13102   return vec_perm((vector int)(0), vec_ldl(__a, __b),
13103                   vec_lvsl(__a, (unsigned char *)__b));
13104 }
13105
13106 static __inline__ vector unsigned int __ATTRS_o_ai
13107 vec_lvrxl(int __a, const unsigned int *__b) {
13108   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13109                   vec_lvsl(__a, __b));
13110 }
13111
13112 static __inline__ vector unsigned int __ATTRS_o_ai
13113 vec_lvrxl(int __a, const vector unsigned int *__b) {
13114   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13115                   vec_lvsl(__a, (unsigned char *)__b));
13116 }
13117
13118 static __inline__ vector bool int __ATTRS_o_ai
13119 vec_lvrxl(int __a, const vector bool int *__b) {
13120   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13121                   vec_lvsl(__a, (unsigned char *)__b));
13122 }
13123
13124 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13125                                                       const float *__b) {
13126   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13127 }
13128
13129 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13130                                                       const vector float *__b) {
13131   return vec_perm((vector float)(0), vec_ldl(__a, __b),
13132                   vec_lvsl(__a, (unsigned char *)__b));
13133 }
13134
13135 /* vec_stvlx */
13136
13137 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13138                                               signed char *__c) {
13139   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13140                 __c);
13141 }
13142
13143 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13144                                               vector signed char *__c) {
13145   return vec_st(
13146       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13147       __b, __c);
13148 }
13149
13150 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13151                                               unsigned char *__c) {
13152   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13153                 __c);
13154 }
13155
13156 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13157                                               vector unsigned char *__c) {
13158   return vec_st(
13159       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13160       __b, __c);
13161 }
13162
13163 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13164                                               vector bool char *__c) {
13165   return vec_st(
13166       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13167       __b, __c);
13168 }
13169
13170 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13171                                               short *__c) {
13172   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13173                 __c);
13174 }
13175
13176 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13177                                               vector short *__c) {
13178   return vec_st(
13179       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13180       __b, __c);
13181 }
13182
13183 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13184                                               int __b, unsigned short *__c) {
13185   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13186                 __c);
13187 }
13188
13189 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13190                                               int __b,
13191                                               vector unsigned short *__c) {
13192   return vec_st(
13193       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13194       __b, __c);
13195 }
13196
13197 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13198                                               vector bool short *__c) {
13199   return vec_st(
13200       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13201       __b, __c);
13202 }
13203
13204 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13205                                               vector pixel *__c) {
13206   return vec_st(
13207       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13208       __b, __c);
13209 }
13210
13211 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13212                                               int *__c) {
13213   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13214                 __c);
13215 }
13216
13217 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13218                                               vector int *__c) {
13219   return vec_st(
13220       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13221       __b, __c);
13222 }
13223
13224 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13225                                               unsigned int *__c) {
13226   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13227                 __c);
13228 }
13229
13230 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13231                                               vector unsigned int *__c) {
13232   return vec_st(
13233       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13234       __b, __c);
13235 }
13236
13237 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13238                                               vector bool int *__c) {
13239   return vec_st(
13240       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13241       __b, __c);
13242 }
13243
13244 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13245                                               vector float *__c) {
13246   return vec_st(
13247       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13248       __b, __c);
13249 }
13250
13251 /* vec_stvlxl */
13252
13253 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13254                                                signed char *__c) {
13255   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13256                  __c);
13257 }
13258
13259 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13260                                                vector signed char *__c) {
13261   return vec_stl(
13262       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13263       __b, __c);
13264 }
13265
13266 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13267                                                int __b, unsigned char *__c) {
13268   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13269                  __c);
13270 }
13271
13272 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13273                                                int __b,
13274                                                vector unsigned char *__c) {
13275   return vec_stl(
13276       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13277       __b, __c);
13278 }
13279
13280 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13281                                                vector bool char *__c) {
13282   return vec_stl(
13283       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13284       __b, __c);
13285 }
13286
13287 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13288                                                short *__c) {
13289   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13290                  __c);
13291 }
13292
13293 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13294                                                vector short *__c) {
13295   return vec_stl(
13296       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13297       __b, __c);
13298 }
13299
13300 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13301                                                int __b, unsigned short *__c) {
13302   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13303                  __c);
13304 }
13305
13306 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13307                                                int __b,
13308                                                vector unsigned short *__c) {
13309   return vec_stl(
13310       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13311       __b, __c);
13312 }
13313
13314 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13315                                                vector bool short *__c) {
13316   return vec_stl(
13317       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13318       __b, __c);
13319 }
13320
13321 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13322                                                vector pixel *__c) {
13323   return vec_stl(
13324       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13325       __b, __c);
13326 }
13327
13328 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13329                                                int *__c) {
13330   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13331                  __c);
13332 }
13333
13334 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13335                                                vector int *__c) {
13336   return vec_stl(
13337       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13338       __b, __c);
13339 }
13340
13341 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13342                                                unsigned int *__c) {
13343   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13344                  __c);
13345 }
13346
13347 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13348                                                vector unsigned int *__c) {
13349   return vec_stl(
13350       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13351       __b, __c);
13352 }
13353
13354 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13355                                                vector bool int *__c) {
13356   return vec_stl(
13357       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13358       __b, __c);
13359 }
13360
13361 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13362                                                vector float *__c) {
13363   return vec_stl(
13364       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13365       __b, __c);
13366 }
13367
13368 /* vec_stvrx */
13369
13370 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13371                                               signed char *__c) {
13372   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13373                 __c);
13374 }
13375
13376 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13377                                               vector signed char *__c) {
13378   return vec_st(
13379       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13380       __b, __c);
13381 }
13382
13383 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13384                                               unsigned char *__c) {
13385   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13386                 __c);
13387 }
13388
13389 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13390                                               vector unsigned char *__c) {
13391   return vec_st(
13392       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13393       __b, __c);
13394 }
13395
13396 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13397                                               vector bool char *__c) {
13398   return vec_st(
13399       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13400       __b, __c);
13401 }
13402
13403 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13404                                               short *__c) {
13405   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13406                 __c);
13407 }
13408
13409 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13410                                               vector short *__c) {
13411   return vec_st(
13412       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13413       __b, __c);
13414 }
13415
13416 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13417                                               int __b, unsigned short *__c) {
13418   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13419                 __c);
13420 }
13421
13422 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13423                                               int __b,
13424                                               vector unsigned short *__c) {
13425   return vec_st(
13426       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13427       __b, __c);
13428 }
13429
13430 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13431                                               vector bool short *__c) {
13432   return vec_st(
13433       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13434       __b, __c);
13435 }
13436
13437 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13438                                               vector pixel *__c) {
13439   return vec_st(
13440       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13441       __b, __c);
13442 }
13443
13444 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13445                                               int *__c) {
13446   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13447                 __c);
13448 }
13449
13450 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13451                                               vector int *__c) {
13452   return vec_st(
13453       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13454       __b, __c);
13455 }
13456
13457 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13458                                               unsigned int *__c) {
13459   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13460                 __c);
13461 }
13462
13463 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13464                                               vector unsigned int *__c) {
13465   return vec_st(
13466       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13467       __b, __c);
13468 }
13469
13470 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13471                                               vector bool int *__c) {
13472   return vec_st(
13473       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13474       __b, __c);
13475 }
13476
13477 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13478                                               vector float *__c) {
13479   return vec_st(
13480       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13481       __b, __c);
13482 }
13483
13484 /* vec_stvrxl */
13485
13486 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13487                                                signed char *__c) {
13488   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13489                  __c);
13490 }
13491
13492 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13493                                                vector signed char *__c) {
13494   return vec_stl(
13495       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13496       __b, __c);
13497 }
13498
13499 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13500                                                int __b, unsigned char *__c) {
13501   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13502                  __c);
13503 }
13504
13505 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13506                                                int __b,
13507                                                vector unsigned char *__c) {
13508   return vec_stl(
13509       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13510       __b, __c);
13511 }
13512
13513 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13514                                                vector bool char *__c) {
13515   return vec_stl(
13516       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13517       __b, __c);
13518 }
13519
13520 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13521                                                short *__c) {
13522   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13523                  __c);
13524 }
13525
13526 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13527                                                vector short *__c) {
13528   return vec_stl(
13529       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13530       __b, __c);
13531 }
13532
13533 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13534                                                int __b, unsigned short *__c) {
13535   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13536                  __c);
13537 }
13538
13539 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13540                                                int __b,
13541                                                vector unsigned short *__c) {
13542   return vec_stl(
13543       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13544       __b, __c);
13545 }
13546
13547 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13548                                                vector bool short *__c) {
13549   return vec_stl(
13550       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13551       __b, __c);
13552 }
13553
13554 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13555                                                vector pixel *__c) {
13556   return vec_stl(
13557       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13558       __b, __c);
13559 }
13560
13561 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13562                                                int *__c) {
13563   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13564                  __c);
13565 }
13566
13567 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13568                                                vector int *__c) {
13569   return vec_stl(
13570       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13571       __b, __c);
13572 }
13573
13574 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13575                                                unsigned int *__c) {
13576   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13577                  __c);
13578 }
13579
13580 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13581                                                vector unsigned int *__c) {
13582   return vec_stl(
13583       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13584       __b, __c);
13585 }
13586
13587 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13588                                                vector bool int *__c) {
13589   return vec_stl(
13590       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13591       __b, __c);
13592 }
13593
13594 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13595                                                vector float *__c) {
13596   return vec_stl(
13597       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13598       __b, __c);
13599 }
13600
13601 /* vec_promote */
13602
13603 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13604                                                               int __b) {
13605   vector signed char __res = (vector signed char)(0);
13606   __res[__b] = __a;
13607   return __res;
13608 }
13609
13610 static __inline__ vector unsigned char __ATTRS_o_ai
13611 vec_promote(unsigned char __a, int __b) {
13612   vector unsigned char __res = (vector unsigned char)(0);
13613   __res[__b] = __a;
13614   return __res;
13615 }
13616
13617 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13618   vector short __res = (vector short)(0);
13619   __res[__b] = __a;
13620   return __res;
13621 }
13622
13623 static __inline__ vector unsigned short __ATTRS_o_ai
13624 vec_promote(unsigned short __a, int __b) {
13625   vector unsigned short __res = (vector unsigned short)(0);
13626   __res[__b] = __a;
13627   return __res;
13628 }
13629
13630 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13631   vector int __res = (vector int)(0);
13632   __res[__b] = __a;
13633   return __res;
13634 }
13635
13636 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13637                                                                int __b) {
13638   vector unsigned int __res = (vector unsigned int)(0);
13639   __res[__b] = __a;
13640   return __res;
13641 }
13642
13643 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13644   vector float __res = (vector float)(0);
13645   __res[__b] = __a;
13646   return __res;
13647 }
13648
13649 /* vec_splats */
13650
13651 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13652   return (vector signed char)(__a);
13653 }
13654
13655 static __inline__ vector unsigned char __ATTRS_o_ai
13656 vec_splats(unsigned char __a) {
13657   return (vector unsigned char)(__a);
13658 }
13659
13660 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13661   return (vector short)(__a);
13662 }
13663
13664 static __inline__ vector unsigned short __ATTRS_o_ai
13665 vec_splats(unsigned short __a) {
13666   return (vector unsigned short)(__a);
13667 }
13668
13669 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13670   return (vector int)(__a);
13671 }
13672
13673 static __inline__ vector unsigned int __ATTRS_o_ai
13674 vec_splats(unsigned int __a) {
13675   return (vector unsigned int)(__a);
13676 }
13677
13678 #ifdef __VSX__
13679 static __inline__ vector signed long long __ATTRS_o_ai
13680 vec_splats(signed long long __a) {
13681   return (vector signed long long)(__a);
13682 }
13683
13684 static __inline__ vector unsigned long long __ATTRS_o_ai
13685 vec_splats(unsigned long long __a) {
13686   return (vector unsigned long long)(__a);
13687 }
13688
13689 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13690 static __inline__ vector signed __int128 __ATTRS_o_ai
13691 vec_splats(signed __int128 __a) {
13692   return (vector signed __int128)(__a);
13693 }
13694
13695 static __inline__ vector unsigned __int128 __ATTRS_o_ai
13696 vec_splats(unsigned __int128 __a) {
13697   return (vector unsigned __int128)(__a);
13698 }
13699
13700 #endif
13701
13702 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13703   return (vector double)(__a);
13704 }
13705 #endif
13706
13707 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13708   return (vector float)(__a);
13709 }
13710
13711 /* ----------------------------- predicates --------------------------------- */
13712
13713 /* vec_all_eq */
13714
13715 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13716                                               vector signed char __b) {
13717   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13718                                       (vector char)__b);
13719 }
13720
13721 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13722                                               vector bool char __b) {
13723   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13724                                       (vector char)__b);
13725 }
13726
13727 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13728                                               vector unsigned char __b) {
13729   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13730                                       (vector char)__b);
13731 }
13732
13733 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13734                                               vector bool char __b) {
13735   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13736                                       (vector char)__b);
13737 }
13738
13739 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13740                                               vector signed char __b) {
13741   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13742                                       (vector char)__b);
13743 }
13744
13745 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13746                                               vector unsigned char __b) {
13747   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13748                                       (vector char)__b);
13749 }
13750
13751 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13752                                               vector bool char __b) {
13753   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13754                                       (vector char)__b);
13755 }
13756
13757 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13758                                               vector short __b) {
13759   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13760 }
13761
13762 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13763                                               vector bool short __b) {
13764   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13765 }
13766
13767 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13768                                               vector unsigned short __b) {
13769   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13770                                       (vector short)__b);
13771 }
13772
13773 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13774                                               vector bool short __b) {
13775   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13776                                       (vector short)__b);
13777 }
13778
13779 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13780                                               vector short __b) {
13781   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13782                                       (vector short)__b);
13783 }
13784
13785 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13786                                               vector unsigned short __b) {
13787   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13788                                       (vector short)__b);
13789 }
13790
13791 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13792                                               vector bool short __b) {
13793   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13794                                       (vector short)__b);
13795 }
13796
13797 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13798                                               vector pixel __b) {
13799   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13800                                       (vector short)__b);
13801 }
13802
13803 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13804   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13805 }
13806
13807 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13808                                               vector bool int __b) {
13809   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13810 }
13811
13812 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13813                                               vector unsigned int __b) {
13814   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13815                                       (vector int)__b);
13816 }
13817
13818 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13819                                               vector bool int __b) {
13820   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13821                                       (vector int)__b);
13822 }
13823
13824 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13825                                               vector int __b) {
13826   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13827                                       (vector int)__b);
13828 }
13829
13830 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13831                                               vector unsigned int __b) {
13832   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13833                                       (vector int)__b);
13834 }
13835
13836 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13837                                               vector bool int __b) {
13838   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13839                                       (vector int)__b);
13840 }
13841
13842 #ifdef __POWER8_VECTOR__
13843 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13844                                               vector signed long long __b) {
13845   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13846 }
13847
13848 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13849                                               vector bool long long __b) {
13850   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13851 }
13852
13853 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13854                                               vector unsigned long long __b) {
13855   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13856                                       (vector long long)__b);
13857 }
13858
13859 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13860                                               vector bool long long __b) {
13861   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13862                                       (vector long long)__b);
13863 }
13864
13865 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13866                                               vector long long __b) {
13867   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13868                                       (vector long long)__b);
13869 }
13870
13871 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13872                                               vector unsigned long long __b) {
13873   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13874                                       (vector long long)__b);
13875 }
13876
13877 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13878                                               vector bool long long __b) {
13879   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13880                                       (vector long long)__b);
13881 }
13882 #endif
13883
13884 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13885                                               vector float __b) {
13886 #ifdef __VSX__
13887   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13888 #else
13889   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13890 #endif
13891 }
13892
13893 #ifdef __VSX__
13894 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13895                                               vector double __b) {
13896   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13897 }
13898 #endif
13899
13900 /* vec_all_ge */
13901
13902 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13903                                               vector signed char __b) {
13904   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13905 }
13906
13907 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13908                                               vector bool char __b) {
13909   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13910 }
13911
13912 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13913                                               vector unsigned char __b) {
13914   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13915 }
13916
13917 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13918                                               vector bool char __b) {
13919   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13920 }
13921
13922 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13923                                               vector signed char __b) {
13924   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13925                                       (vector unsigned char)__a);
13926 }
13927
13928 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13929                                               vector unsigned char __b) {
13930   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13931 }
13932
13933 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13934                                               vector bool char __b) {
13935   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13936                                       (vector unsigned char)__a);
13937 }
13938
13939 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13940                                               vector short __b) {
13941   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13942 }
13943
13944 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13945                                               vector bool short __b) {
13946   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13947 }
13948
13949 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13950                                               vector unsigned short __b) {
13951   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13952 }
13953
13954 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13955                                               vector bool short __b) {
13956   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13957                                       __a);
13958 }
13959
13960 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13961                                               vector short __b) {
13962   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13963                                       (vector unsigned short)__a);
13964 }
13965
13966 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13967                                               vector unsigned short __b) {
13968   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13969                                       (vector unsigned short)__a);
13970 }
13971
13972 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13973                                               vector bool short __b) {
13974   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13975                                       (vector unsigned short)__a);
13976 }
13977
13978 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13979   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13980 }
13981
13982 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13983                                               vector bool int __b) {
13984   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13985 }
13986
13987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13988                                               vector unsigned int __b) {
13989   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13990 }
13991
13992 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13993                                               vector bool int __b) {
13994   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
13995 }
13996
13997 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
13998                                               vector int __b) {
13999   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14000                                       (vector unsigned int)__a);
14001 }
14002
14003 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14004                                               vector unsigned int __b) {
14005   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14006 }
14007
14008 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14009                                               vector bool int __b) {
14010   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14011                                       (vector unsigned int)__a);
14012 }
14013
14014 #ifdef __POWER8_VECTOR__
14015 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14016                                               vector signed long long __b) {
14017   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14018 }
14019 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14020                                               vector bool long long __b) {
14021   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14022                                       __a);
14023 }
14024
14025 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14026                                               vector unsigned long long __b) {
14027   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14028 }
14029
14030 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14031                                               vector bool long long __b) {
14032   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14033                                       __a);
14034 }
14035
14036 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14037                                               vector signed long long __b) {
14038   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14039                                       (vector unsigned long long)__a);
14040 }
14041
14042 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14043                                               vector unsigned long long __b) {
14044   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14045                                       (vector unsigned long long)__a);
14046 }
14047
14048 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14049                                               vector bool long long __b) {
14050   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14051                                       (vector unsigned long long)__a);
14052 }
14053 #endif
14054
14055 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14056                                               vector float __b) {
14057 #ifdef __VSX__
14058   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14059 #else
14060   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14061 #endif
14062 }
14063
14064 #ifdef __VSX__
14065 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14066                                               vector double __b) {
14067   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14068 }
14069 #endif
14070
14071 /* vec_all_gt */
14072
14073 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14074                                               vector signed char __b) {
14075   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14076 }
14077
14078 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14079                                               vector bool char __b) {
14080   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14081 }
14082
14083 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14084                                               vector unsigned char __b) {
14085   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14086 }
14087
14088 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14089                                               vector bool char __b) {
14090   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14091 }
14092
14093 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14094                                               vector signed char __b) {
14095   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14096                                       (vector unsigned char)__b);
14097 }
14098
14099 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14100                                               vector unsigned char __b) {
14101   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14102 }
14103
14104 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14105                                               vector bool char __b) {
14106   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14107                                       (vector unsigned char)__b);
14108 }
14109
14110 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14111                                               vector short __b) {
14112   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14113 }
14114
14115 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14116                                               vector bool short __b) {
14117   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14118 }
14119
14120 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14121                                               vector unsigned short __b) {
14122   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14123 }
14124
14125 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14126                                               vector bool short __b) {
14127   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14128                                       (vector unsigned short)__b);
14129 }
14130
14131 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14132                                               vector short __b) {
14133   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14134                                       (vector unsigned short)__b);
14135 }
14136
14137 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14138                                               vector unsigned short __b) {
14139   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14140                                       __b);
14141 }
14142
14143 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14144                                               vector bool short __b) {
14145   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14146                                       (vector unsigned short)__b);
14147 }
14148
14149 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14150   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14151 }
14152
14153 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14154                                               vector bool int __b) {
14155   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14156 }
14157
14158 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14159                                               vector unsigned int __b) {
14160   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14161 }
14162
14163 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14164                                               vector bool int __b) {
14165   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14166 }
14167
14168 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14169                                               vector int __b) {
14170   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14171                                       (vector unsigned int)__b);
14172 }
14173
14174 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14175                                               vector unsigned int __b) {
14176   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14177 }
14178
14179 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14180                                               vector bool int __b) {
14181   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14182                                       (vector unsigned int)__b);
14183 }
14184
14185 #ifdef __POWER8_VECTOR__
14186 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14187                                               vector signed long long __b) {
14188   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14189 }
14190 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14191                                               vector bool long long __b) {
14192   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14193                                       (vector signed long long)__b);
14194 }
14195
14196 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14197                                               vector unsigned long long __b) {
14198   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14199 }
14200
14201 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14202                                               vector bool long long __b) {
14203   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14204                                       (vector unsigned long long)__b);
14205 }
14206
14207 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14208                                               vector signed long long __b) {
14209   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14210                                       (vector unsigned long long)__b);
14211 }
14212
14213 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14214                                               vector unsigned long long __b) {
14215   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14216                                       __b);
14217 }
14218
14219 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14220                                               vector bool long long __b) {
14221   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14222                                       (vector unsigned long long)__b);
14223 }
14224 #endif
14225
14226 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14227                                               vector float __b) {
14228 #ifdef __VSX__
14229   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14230 #else
14231   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14232 #endif
14233 }
14234
14235 #ifdef __VSX__
14236 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14237                                               vector double __b) {
14238   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14239 }
14240 #endif
14241
14242 /* vec_all_in */
14243
14244 static __inline__ int __attribute__((__always_inline__))
14245 vec_all_in(vector float __a, vector float __b) {
14246   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14247 }
14248
14249 /* vec_all_le */
14250
14251 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14252                                               vector signed char __b) {
14253   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14254 }
14255
14256 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14257                                               vector bool char __b) {
14258   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14259 }
14260
14261 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14262                                               vector unsigned char __b) {
14263   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14264 }
14265
14266 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14267                                               vector bool char __b) {
14268   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14269 }
14270
14271 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14272                                               vector signed char __b) {
14273   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14274                                       (vector unsigned char)__b);
14275 }
14276
14277 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14278                                               vector unsigned char __b) {
14279   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14280 }
14281
14282 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14283                                               vector bool char __b) {
14284   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14285                                       (vector unsigned char)__b);
14286 }
14287
14288 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14289                                               vector short __b) {
14290   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14291 }
14292
14293 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14294                                               vector bool short __b) {
14295   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14296 }
14297
14298 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14299                                               vector unsigned short __b) {
14300   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14301 }
14302
14303 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14304                                               vector bool short __b) {
14305   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14306                                       (vector unsigned short)__b);
14307 }
14308
14309 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14310                                               vector short __b) {
14311   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14312                                       (vector unsigned short)__b);
14313 }
14314
14315 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14316                                               vector unsigned short __b) {
14317   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14318                                       __b);
14319 }
14320
14321 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14322                                               vector bool short __b) {
14323   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14324                                       (vector unsigned short)__b);
14325 }
14326
14327 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14328   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14329 }
14330
14331 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14332                                               vector bool int __b) {
14333   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14334 }
14335
14336 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14337                                               vector unsigned int __b) {
14338   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14339 }
14340
14341 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14342                                               vector bool int __b) {
14343   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14344 }
14345
14346 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14347                                               vector int __b) {
14348   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14349                                       (vector unsigned int)__b);
14350 }
14351
14352 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14353                                               vector unsigned int __b) {
14354   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14355 }
14356
14357 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14358                                               vector bool int __b) {
14359   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14360                                       (vector unsigned int)__b);
14361 }
14362
14363 #ifdef __POWER8_VECTOR__
14364 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14365                                               vector signed long long __b) {
14366   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14367 }
14368
14369 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14370                                               vector unsigned long long __b) {
14371   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14372 }
14373
14374 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14375                                               vector bool long long __b) {
14376   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14377                                       (vector signed long long)__b);
14378 }
14379
14380 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14381                                               vector bool long long __b) {
14382   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14383                                       (vector unsigned long long)__b);
14384 }
14385
14386 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14387                                               vector signed long long __b) {
14388   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14389                                       (vector unsigned long long)__b);
14390 }
14391
14392 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14393                                               vector unsigned long long __b) {
14394   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14395                                       __b);
14396 }
14397
14398 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14399                                               vector bool long long __b) {
14400   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14401                                       (vector unsigned long long)__b);
14402 }
14403 #endif
14404
14405 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14406                                               vector float __b) {
14407 #ifdef __VSX__
14408   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14409 #else
14410   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14411 #endif
14412 }
14413
14414 #ifdef __VSX__
14415 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14416                                               vector double __b) {
14417   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14418 }
14419 #endif
14420
14421 /* vec_all_lt */
14422
14423 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14424                                               vector signed char __b) {
14425   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14426 }
14427
14428 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14429                                               vector bool char __b) {
14430   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14431 }
14432
14433 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14434                                               vector unsigned char __b) {
14435   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14436 }
14437
14438 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14439                                               vector bool char __b) {
14440   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14441 }
14442
14443 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14444                                               vector signed char __b) {
14445   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14446                                       (vector unsigned char)__a);
14447 }
14448
14449 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14450                                               vector unsigned char __b) {
14451   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14452 }
14453
14454 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14455                                               vector bool char __b) {
14456   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14457                                       (vector unsigned char)__a);
14458 }
14459
14460 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14461                                               vector short __b) {
14462   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14463 }
14464
14465 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14466                                               vector bool short __b) {
14467   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14468 }
14469
14470 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14471                                               vector unsigned short __b) {
14472   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14473 }
14474
14475 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14476                                               vector bool short __b) {
14477   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14478                                       __a);
14479 }
14480
14481 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14482                                               vector short __b) {
14483   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14484                                       (vector unsigned short)__a);
14485 }
14486
14487 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14488                                               vector unsigned short __b) {
14489   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14490                                       (vector unsigned short)__a);
14491 }
14492
14493 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14494                                               vector bool short __b) {
14495   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14496                                       (vector unsigned short)__a);
14497 }
14498
14499 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14500   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14501 }
14502
14503 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14504                                               vector bool int __b) {
14505   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14506 }
14507
14508 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14509                                               vector unsigned int __b) {
14510   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14511 }
14512
14513 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14514                                               vector bool int __b) {
14515   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14516 }
14517
14518 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14519                                               vector int __b) {
14520   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14521                                       (vector unsigned int)__a);
14522 }
14523
14524 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14525                                               vector unsigned int __b) {
14526   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14527 }
14528
14529 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14530                                               vector bool int __b) {
14531   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14532                                       (vector unsigned int)__a);
14533 }
14534
14535 #ifdef __POWER8_VECTOR__
14536 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14537                                               vector signed long long __b) {
14538   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14539 }
14540
14541 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14542                                               vector unsigned long long __b) {
14543   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14544 }
14545
14546 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14547                                               vector bool long long __b) {
14548   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14549                                       __a);
14550 }
14551
14552 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14553                                               vector bool long long __b) {
14554   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14555                                       __a);
14556 }
14557
14558 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14559                                               vector signed long long __b) {
14560   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14561                                       (vector unsigned long long)__a);
14562 }
14563
14564 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14565                                               vector unsigned long long __b) {
14566   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14567                                       (vector unsigned long long)__a);
14568 }
14569
14570 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14571                                               vector bool long long __b) {
14572   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14573                                       (vector unsigned long long)__a);
14574 }
14575 #endif
14576
14577 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14578                                               vector float __b) {
14579 #ifdef __VSX__
14580   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14581 #else
14582   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14583 #endif
14584 }
14585
14586 #ifdef __VSX__
14587 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14588                                               vector double __b) {
14589   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14590 }
14591 #endif
14592
14593 /* vec_all_nan */
14594
14595 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14596 #ifdef __VSX__
14597   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14598 #else
14599   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14600 #endif
14601 }
14602
14603 #ifdef __VSX__
14604 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14605   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14606 }
14607 #endif
14608
14609 /* vec_all_ne */
14610
14611 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14612                                               vector signed char __b) {
14613   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14614                                       (vector char)__b);
14615 }
14616
14617 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14618                                               vector bool char __b) {
14619   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14620                                       (vector char)__b);
14621 }
14622
14623 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14624                                               vector unsigned char __b) {
14625   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14626                                       (vector char)__b);
14627 }
14628
14629 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14630                                               vector bool char __b) {
14631   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14632                                       (vector char)__b);
14633 }
14634
14635 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14636                                               vector signed char __b) {
14637   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14638                                       (vector char)__b);
14639 }
14640
14641 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14642                                               vector unsigned char __b) {
14643   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14644                                       (vector char)__b);
14645 }
14646
14647 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14648                                               vector bool char __b) {
14649   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14650                                       (vector char)__b);
14651 }
14652
14653 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14654                                               vector short __b) {
14655   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14656 }
14657
14658 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14659                                               vector bool short __b) {
14660   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14661 }
14662
14663 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14664                                               vector unsigned short __b) {
14665   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14666                                       (vector short)__b);
14667 }
14668
14669 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14670                                               vector bool short __b) {
14671   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14672                                       (vector short)__b);
14673 }
14674
14675 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14676                                               vector short __b) {
14677   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14678                                       (vector short)__b);
14679 }
14680
14681 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14682                                               vector unsigned short __b) {
14683   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14684                                       (vector short)__b);
14685 }
14686
14687 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14688                                               vector bool short __b) {
14689   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14690                                       (vector short)__b);
14691 }
14692
14693 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
14694                                               vector pixel __b) {
14695   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14696                                       (vector short)__b);
14697 }
14698
14699 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14700   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14701 }
14702
14703 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14704                                               vector bool int __b) {
14705   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14706 }
14707
14708 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14709                                               vector unsigned int __b) {
14710   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14711                                       (vector int)__b);
14712 }
14713
14714 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14715                                               vector bool int __b) {
14716   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14717                                       (vector int)__b);
14718 }
14719
14720 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14721                                               vector int __b) {
14722   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14723                                       (vector int)__b);
14724 }
14725
14726 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14727                                               vector unsigned int __b) {
14728   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14729                                       (vector int)__b);
14730 }
14731
14732 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14733                                               vector bool int __b) {
14734   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14735                                       (vector int)__b);
14736 }
14737
14738 #ifdef __POWER8_VECTOR__
14739 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14740                                               vector signed long long __b) {
14741   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14742 }
14743
14744 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14745                                               vector unsigned long long __b) {
14746   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14747                                       (vector long long)__b);
14748 }
14749
14750 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14751                                               vector bool long long __b) {
14752   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14753                                       (vector signed long long)__b);
14754 }
14755
14756 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14757                                               vector bool long long __b) {
14758   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14759                                       (vector signed long long)__b);
14760 }
14761
14762 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14763                                               vector signed long long __b) {
14764   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14765                                       (vector signed long long)__b);
14766 }
14767
14768 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14769                                               vector unsigned long long __b) {
14770   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14771                                       (vector signed long long)__b);
14772 }
14773
14774 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14775                                               vector bool long long __b) {
14776   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14777                                       (vector signed long long)__b);
14778 }
14779 #endif
14780
14781 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14782                                               vector float __b) {
14783 #ifdef __VSX__
14784   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14785 #else
14786   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14787 #endif
14788 }
14789
14790 #ifdef __VSX__
14791 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14792                                               vector double __b) {
14793   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14794 }
14795 #endif
14796
14797 /* vec_all_nge */
14798
14799 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14800                                                vector float __b) {
14801 #ifdef __VSX__
14802   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14803 #else
14804   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14805 #endif
14806 }
14807
14808 #ifdef __VSX__
14809 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14810                                                vector double __b) {
14811   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14812 }
14813 #endif
14814
14815 /* vec_all_ngt */
14816
14817 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14818                                                vector float __b) {
14819 #ifdef __VSX__
14820   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14821 #else
14822   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14823 #endif
14824 }
14825
14826 #ifdef __VSX__
14827 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14828                                                vector double __b) {
14829   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14830 }
14831 #endif
14832
14833 /* vec_all_nle */
14834
14835 static __inline__ int __attribute__((__always_inline__))
14836 vec_all_nle(vector float __a, vector float __b) {
14837   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14838 }
14839
14840 /* vec_all_nlt */
14841
14842 static __inline__ int __attribute__((__always_inline__))
14843 vec_all_nlt(vector float __a, vector float __b) {
14844   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14845 }
14846
14847 /* vec_all_numeric */
14848
14849 static __inline__ int __attribute__((__always_inline__))
14850 vec_all_numeric(vector float __a) {
14851   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14852 }
14853
14854 /* vec_any_eq */
14855
14856 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14857                                               vector signed char __b) {
14858   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14859                                       (vector char)__b);
14860 }
14861
14862 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14863                                               vector bool char __b) {
14864   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14865                                       (vector char)__b);
14866 }
14867
14868 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14869                                               vector unsigned char __b) {
14870   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14871                                       (vector char)__b);
14872 }
14873
14874 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14875                                               vector bool char __b) {
14876   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14877                                       (vector char)__b);
14878 }
14879
14880 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14881                                               vector signed char __b) {
14882   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14883                                       (vector char)__b);
14884 }
14885
14886 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14887                                               vector unsigned char __b) {
14888   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14889                                       (vector char)__b);
14890 }
14891
14892 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14893                                               vector bool char __b) {
14894   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14895                                       (vector char)__b);
14896 }
14897
14898 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14899                                               vector short __b) {
14900   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14901 }
14902
14903 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14904                                               vector bool short __b) {
14905   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14906 }
14907
14908 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14909                                               vector unsigned short __b) {
14910   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14911                                       (vector short)__b);
14912 }
14913
14914 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14915                                               vector bool short __b) {
14916   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14917                                       (vector short)__b);
14918 }
14919
14920 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14921                                               vector short __b) {
14922   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14923                                       (vector short)__b);
14924 }
14925
14926 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14927                                               vector unsigned short __b) {
14928   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14929                                       (vector short)__b);
14930 }
14931
14932 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14933                                               vector bool short __b) {
14934   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14935                                       (vector short)__b);
14936 }
14937
14938 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14939                                               vector pixel __b) {
14940   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14941                                       (vector short)__b);
14942 }
14943
14944 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14945   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14946 }
14947
14948 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14949                                               vector bool int __b) {
14950   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14951 }
14952
14953 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14954                                               vector unsigned int __b) {
14955   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14956                                       (vector int)__b);
14957 }
14958
14959 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14960                                               vector bool int __b) {
14961   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14962                                       (vector int)__b);
14963 }
14964
14965 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14966                                               vector int __b) {
14967   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14968                                       (vector int)__b);
14969 }
14970
14971 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14972                                               vector unsigned int __b) {
14973   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14974                                       (vector int)__b);
14975 }
14976
14977 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14978                                               vector bool int __b) {
14979   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14980                                       (vector int)__b);
14981 }
14982
14983 #ifdef __POWER8_VECTOR__
14984 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14985                                               vector signed long long __b) {
14986   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14987 }
14988
14989 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14990                                               vector unsigned long long __b) {
14991   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
14992                                       (vector long long)__b);
14993 }
14994
14995 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14996                                               vector bool long long __b) {
14997   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
14998                                       (vector signed long long)__b);
14999 }
15000
15001 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15002                                               vector bool long long __b) {
15003   return __builtin_altivec_vcmpequd_p(
15004       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15005 }
15006
15007 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15008                                               vector signed long long __b) {
15009   return __builtin_altivec_vcmpequd_p(
15010       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15011 }
15012
15013 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15014                                               vector unsigned long long __b) {
15015   return __builtin_altivec_vcmpequd_p(
15016       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15017 }
15018
15019 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15020                                               vector bool long long __b) {
15021   return __builtin_altivec_vcmpequd_p(
15022       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15023 }
15024 #endif
15025
15026 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15027                                               vector float __b) {
15028 #ifdef __VSX__
15029   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15030 #else
15031   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15032 #endif
15033 }
15034
15035 #ifdef __VSX__
15036 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15037                                               vector double __b) {
15038   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15039 }
15040 #endif
15041
15042 /* vec_any_ge */
15043
15044 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15045                                               vector signed char __b) {
15046   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15047 }
15048
15049 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15050                                               vector bool char __b) {
15051   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15052                                       __a);
15053 }
15054
15055 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15056                                               vector unsigned char __b) {
15057   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15058 }
15059
15060 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15061                                               vector bool char __b) {
15062   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15063                                       __a);
15064 }
15065
15066 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15067                                               vector signed char __b) {
15068   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15069                                       (vector unsigned char)__a);
15070 }
15071
15072 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15073                                               vector unsigned char __b) {
15074   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15075                                       (vector unsigned char)__a);
15076 }
15077
15078 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15079                                               vector bool char __b) {
15080   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15081                                       (vector unsigned char)__a);
15082 }
15083
15084 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15085                                               vector short __b) {
15086   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15087 }
15088
15089 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15090                                               vector bool short __b) {
15091   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15092 }
15093
15094 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15095                                               vector unsigned short __b) {
15096   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15097 }
15098
15099 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15100                                               vector bool short __b) {
15101   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15102                                       __a);
15103 }
15104
15105 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15106                                               vector short __b) {
15107   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15108                                       (vector unsigned short)__a);
15109 }
15110
15111 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15112                                               vector unsigned short __b) {
15113   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15114                                       (vector unsigned short)__a);
15115 }
15116
15117 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15118                                               vector bool short __b) {
15119   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15120                                       (vector unsigned short)__a);
15121 }
15122
15123 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15124   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15125 }
15126
15127 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15128                                               vector bool int __b) {
15129   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15130 }
15131
15132 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15133                                               vector unsigned int __b) {
15134   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15135 }
15136
15137 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15138                                               vector bool int __b) {
15139   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15140                                       __a);
15141 }
15142
15143 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15144                                               vector int __b) {
15145   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15146                                       (vector unsigned int)__a);
15147 }
15148
15149 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15150                                               vector unsigned int __b) {
15151   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15152                                       (vector unsigned int)__a);
15153 }
15154
15155 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15156                                               vector bool int __b) {
15157   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15158                                       (vector unsigned int)__a);
15159 }
15160
15161 #ifdef __POWER8_VECTOR__
15162 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15163                                               vector signed long long __b) {
15164   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15165 }
15166
15167 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15168                                               vector unsigned long long __b) {
15169   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15170 }
15171
15172 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15173                                               vector bool long long __b) {
15174   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15175                                       (vector signed long long)__b, __a);
15176 }
15177
15178 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15179                                               vector bool long long __b) {
15180   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15181                                       (vector unsigned long long)__b, __a);
15182 }
15183
15184 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15185                                               vector signed long long __b) {
15186   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15187                                       (vector unsigned long long)__b,
15188                                       (vector unsigned long long)__a);
15189 }
15190
15191 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15192                                               vector unsigned long long __b) {
15193   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15194                                       (vector unsigned long long)__a);
15195 }
15196
15197 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15198                                               vector bool long long __b) {
15199   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15200                                       (vector unsigned long long)__b,
15201                                       (vector unsigned long long)__a);
15202 }
15203 #endif
15204
15205 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15206                                               vector float __b) {
15207 #ifdef __VSX__
15208   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15209 #else
15210   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15211 #endif
15212 }
15213
15214 #ifdef __VSX__
15215 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15216                                               vector double __b) {
15217   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15218 }
15219 #endif
15220
15221 /* vec_any_gt */
15222
15223 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15224                                               vector signed char __b) {
15225   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15226 }
15227
15228 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15229                                               vector bool char __b) {
15230   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15231                                       (vector signed char)__b);
15232 }
15233
15234 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15235                                               vector unsigned char __b) {
15236   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15237 }
15238
15239 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15240                                               vector bool char __b) {
15241   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15242                                       (vector unsigned char)__b);
15243 }
15244
15245 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15246                                               vector signed char __b) {
15247   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15248                                       (vector unsigned char)__b);
15249 }
15250
15251 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15252                                               vector unsigned char __b) {
15253   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15254                                       __b);
15255 }
15256
15257 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15258                                               vector bool char __b) {
15259   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15260                                       (vector unsigned char)__b);
15261 }
15262
15263 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15264                                               vector short __b) {
15265   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15266 }
15267
15268 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15269                                               vector bool short __b) {
15270   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15271 }
15272
15273 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15274                                               vector unsigned short __b) {
15275   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15276 }
15277
15278 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15279                                               vector bool short __b) {
15280   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15281                                       (vector unsigned short)__b);
15282 }
15283
15284 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15285                                               vector short __b) {
15286   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15287                                       (vector unsigned short)__b);
15288 }
15289
15290 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15291                                               vector unsigned short __b) {
15292   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15293                                       __b);
15294 }
15295
15296 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15297                                               vector bool short __b) {
15298   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15299                                       (vector unsigned short)__b);
15300 }
15301
15302 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15303   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15304 }
15305
15306 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15307                                               vector bool int __b) {
15308   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15309 }
15310
15311 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15312                                               vector unsigned int __b) {
15313   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15314 }
15315
15316 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15317                                               vector bool int __b) {
15318   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15319                                       (vector unsigned int)__b);
15320 }
15321
15322 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15323                                               vector int __b) {
15324   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15325                                       (vector unsigned int)__b);
15326 }
15327
15328 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15329                                               vector unsigned int __b) {
15330   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15331                                       __b);
15332 }
15333
15334 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15335                                               vector bool int __b) {
15336   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15337                                       (vector unsigned int)__b);
15338 }
15339
15340 #ifdef __POWER8_VECTOR__
15341 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15342                                               vector signed long long __b) {
15343   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15344 }
15345
15346 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15347                                               vector unsigned long long __b) {
15348   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15349 }
15350
15351 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15352                                               vector bool long long __b) {
15353   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15354                                       (vector signed long long)__b);
15355 }
15356
15357 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15358                                               vector bool long long __b) {
15359   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15360                                       (vector unsigned long long)__b);
15361 }
15362
15363 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15364                                               vector signed long long __b) {
15365   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15366                                       (vector unsigned long long)__a,
15367                                       (vector unsigned long long)__b);
15368 }
15369
15370 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15371                                               vector unsigned long long __b) {
15372   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15373                                       (vector unsigned long long)__a, __b);
15374 }
15375
15376 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15377                                               vector bool long long __b) {
15378   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15379                                       (vector unsigned long long)__a,
15380                                       (vector unsigned long long)__b);
15381 }
15382 #endif
15383
15384 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15385                                               vector float __b) {
15386 #ifdef __VSX__
15387   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15388 #else
15389   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15390 #endif
15391 }
15392
15393 #ifdef __VSX__
15394 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15395                                               vector double __b) {
15396   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15397 }
15398 #endif
15399
15400 /* vec_any_le */
15401
15402 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15403                                               vector signed char __b) {
15404   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15405 }
15406
15407 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15408                                               vector bool char __b) {
15409   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15410                                       (vector signed char)__b);
15411 }
15412
15413 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15414                                               vector unsigned char __b) {
15415   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15416 }
15417
15418 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15419                                               vector bool char __b) {
15420   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15421                                       (vector unsigned char)__b);
15422 }
15423
15424 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15425                                               vector signed char __b) {
15426   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15427                                       (vector unsigned char)__b);
15428 }
15429
15430 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15431                                               vector unsigned char __b) {
15432   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15433                                       __b);
15434 }
15435
15436 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15437                                               vector bool char __b) {
15438   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15439                                       (vector unsigned char)__b);
15440 }
15441
15442 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15443                                               vector short __b) {
15444   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15445 }
15446
15447 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15448                                               vector bool short __b) {
15449   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15450 }
15451
15452 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15453                                               vector unsigned short __b) {
15454   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15455 }
15456
15457 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15458                                               vector bool short __b) {
15459   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15460                                       (vector unsigned short)__b);
15461 }
15462
15463 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15464                                               vector short __b) {
15465   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15466                                       (vector unsigned short)__b);
15467 }
15468
15469 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15470                                               vector unsigned short __b) {
15471   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15472                                       __b);
15473 }
15474
15475 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15476                                               vector bool short __b) {
15477   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15478                                       (vector unsigned short)__b);
15479 }
15480
15481 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15482   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15483 }
15484
15485 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15486                                               vector bool int __b) {
15487   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15488 }
15489
15490 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15491                                               vector unsigned int __b) {
15492   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15493 }
15494
15495 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15496                                               vector bool int __b) {
15497   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15498                                       (vector unsigned int)__b);
15499 }
15500
15501 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15502                                               vector int __b) {
15503   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15504                                       (vector unsigned int)__b);
15505 }
15506
15507 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15508                                               vector unsigned int __b) {
15509   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15510                                       __b);
15511 }
15512
15513 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15514                                               vector bool int __b) {
15515   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15516                                       (vector unsigned int)__b);
15517 }
15518
15519 #ifdef __POWER8_VECTOR__
15520 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15521                                               vector signed long long __b) {
15522   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15523 }
15524
15525 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15526                                               vector unsigned long long __b) {
15527   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15528 }
15529
15530 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15531                                               vector bool long long __b) {
15532   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15533                                       (vector signed long long)__b);
15534 }
15535
15536 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15537                                               vector bool long long __b) {
15538   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15539                                       (vector unsigned long long)__b);
15540 }
15541
15542 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15543                                               vector signed long long __b) {
15544   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15545                                       (vector unsigned long long)__a,
15546                                       (vector unsigned long long)__b);
15547 }
15548
15549 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15550                                               vector unsigned long long __b) {
15551   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15552                                       (vector unsigned long long)__a, __b);
15553 }
15554
15555 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15556                                               vector bool long long __b) {
15557   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15558                                       (vector unsigned long long)__a,
15559                                       (vector unsigned long long)__b);
15560 }
15561 #endif
15562
15563 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15564                                               vector float __b) {
15565 #ifdef __VSX__
15566   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15567 #else
15568   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15569 #endif
15570 }
15571
15572 #ifdef __VSX__
15573 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15574                                               vector double __b) {
15575   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15576 }
15577 #endif
15578
15579 /* vec_any_lt */
15580
15581 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15582                                               vector signed char __b) {
15583   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15584 }
15585
15586 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15587                                               vector bool char __b) {
15588   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15589                                       __a);
15590 }
15591
15592 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15593                                               vector unsigned char __b) {
15594   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15595 }
15596
15597 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15598                                               vector bool char __b) {
15599   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15600                                       __a);
15601 }
15602
15603 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15604                                               vector signed char __b) {
15605   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15606                                       (vector unsigned char)__a);
15607 }
15608
15609 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15610                                               vector unsigned char __b) {
15611   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15612                                       (vector unsigned char)__a);
15613 }
15614
15615 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15616                                               vector bool char __b) {
15617   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15618                                       (vector unsigned char)__a);
15619 }
15620
15621 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15622                                               vector short __b) {
15623   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15624 }
15625
15626 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15627                                               vector bool short __b) {
15628   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15629 }
15630
15631 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15632                                               vector unsigned short __b) {
15633   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15634 }
15635
15636 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15637                                               vector bool short __b) {
15638   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15639                                       __a);
15640 }
15641
15642 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15643                                               vector short __b) {
15644   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15645                                       (vector unsigned short)__a);
15646 }
15647
15648 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15649                                               vector unsigned short __b) {
15650   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15651                                       (vector unsigned short)__a);
15652 }
15653
15654 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15655                                               vector bool short __b) {
15656   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15657                                       (vector unsigned short)__a);
15658 }
15659
15660 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15661   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15662 }
15663
15664 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15665                                               vector bool int __b) {
15666   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15667 }
15668
15669 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15670                                               vector unsigned int __b) {
15671   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15672 }
15673
15674 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15675                                               vector bool int __b) {
15676   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15677                                       __a);
15678 }
15679
15680 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15681                                               vector int __b) {
15682   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15683                                       (vector unsigned int)__a);
15684 }
15685
15686 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15687                                               vector unsigned int __b) {
15688   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15689                                       (vector unsigned int)__a);
15690 }
15691
15692 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15693                                               vector bool int __b) {
15694   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15695                                       (vector unsigned int)__a);
15696 }
15697
15698 #ifdef __POWER8_VECTOR__
15699 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15700                                               vector signed long long __b) {
15701   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15702 }
15703
15704 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15705                                               vector unsigned long long __b) {
15706   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15707 }
15708
15709 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15710                                               vector bool long long __b) {
15711   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15712                                       (vector signed long long)__b, __a);
15713 }
15714
15715 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15716                                               vector bool long long __b) {
15717   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15718                                       (vector unsigned long long)__b, __a);
15719 }
15720
15721 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15722                                               vector signed long long __b) {
15723   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15724                                       (vector unsigned long long)__b,
15725                                       (vector unsigned long long)__a);
15726 }
15727
15728 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15729                                               vector unsigned long long __b) {
15730   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15731                                       (vector unsigned long long)__a);
15732 }
15733
15734 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15735                                               vector bool long long __b) {
15736   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15737                                       (vector unsigned long long)__b,
15738                                       (vector unsigned long long)__a);
15739 }
15740 #endif
15741
15742 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15743                                               vector float __b) {
15744 #ifdef __VSX__
15745   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15746 #else
15747   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15748 #endif
15749 }
15750
15751 #ifdef __VSX__
15752 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15753                                               vector double __b) {
15754   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15755 }
15756 #endif
15757
15758 /* vec_any_nan */
15759
15760 static __inline__ int __attribute__((__always_inline__))
15761 vec_any_nan(vector float __a) {
15762   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15763 }
15764
15765 /* vec_any_ne */
15766
15767 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15768                                               vector signed char __b) {
15769   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15770                                       (vector char)__b);
15771 }
15772
15773 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15774                                               vector bool char __b) {
15775   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15776                                       (vector char)__b);
15777 }
15778
15779 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15780                                               vector unsigned char __b) {
15781   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15782                                       (vector char)__b);
15783 }
15784
15785 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15786                                               vector bool char __b) {
15787   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15788                                       (vector char)__b);
15789 }
15790
15791 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15792                                               vector signed char __b) {
15793   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15794                                       (vector char)__b);
15795 }
15796
15797 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15798                                               vector unsigned char __b) {
15799   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15800                                       (vector char)__b);
15801 }
15802
15803 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15804                                               vector bool char __b) {
15805   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15806                                       (vector char)__b);
15807 }
15808
15809 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15810                                               vector short __b) {
15811   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15812 }
15813
15814 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15815                                               vector bool short __b) {
15816   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15817 }
15818
15819 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15820                                               vector unsigned short __b) {
15821   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15822                                       (vector short)__b);
15823 }
15824
15825 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15826                                               vector bool short __b) {
15827   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15828                                       (vector short)__b);
15829 }
15830
15831 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15832                                               vector short __b) {
15833   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15834                                       (vector short)__b);
15835 }
15836
15837 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15838                                               vector unsigned short __b) {
15839   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15840                                       (vector short)__b);
15841 }
15842
15843 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15844                                               vector bool short __b) {
15845   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15846                                       (vector short)__b);
15847 }
15848
15849 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15850                                               vector pixel __b) {
15851   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15852                                       (vector short)__b);
15853 }
15854
15855 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15856   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15857 }
15858
15859 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15860                                               vector bool int __b) {
15861   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15862 }
15863
15864 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15865                                               vector unsigned int __b) {
15866   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15867                                       (vector int)__b);
15868 }
15869
15870 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15871                                               vector bool int __b) {
15872   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15873                                       (vector int)__b);
15874 }
15875
15876 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15877                                               vector int __b) {
15878   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15879                                       (vector int)__b);
15880 }
15881
15882 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15883                                               vector unsigned int __b) {
15884   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15885                                       (vector int)__b);
15886 }
15887
15888 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15889                                               vector bool int __b) {
15890   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15891                                       (vector int)__b);
15892 }
15893
15894 #ifdef __POWER8_VECTOR__
15895 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15896                                               vector signed long long __b) {
15897   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15898 }
15899
15900 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15901                                               vector unsigned long long __b) {
15902   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15903                                       (vector long long)__b);
15904 }
15905
15906 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15907                                               vector bool long long __b) {
15908   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15909                                       (vector signed long long)__b);
15910 }
15911
15912 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15913                                               vector bool long long __b) {
15914   return __builtin_altivec_vcmpequd_p(
15915       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15916 }
15917
15918 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15919                                               vector signed long long __b) {
15920   return __builtin_altivec_vcmpequd_p(
15921       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15922 }
15923
15924 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15925                                               vector unsigned long long __b) {
15926   return __builtin_altivec_vcmpequd_p(
15927       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15928 }
15929
15930 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15931                                               vector bool long long __b) {
15932   return __builtin_altivec_vcmpequd_p(
15933       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15934 }
15935 #endif
15936
15937 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15938                                               vector float __b) {
15939 #ifdef __VSX__
15940   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15941 #else
15942   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15943 #endif
15944 }
15945
15946 #ifdef __VSX__
15947 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15948                                               vector double __b) {
15949   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15950 }
15951 #endif
15952
15953 /* vec_any_nge */
15954
15955 static __inline__ int __attribute__((__always_inline__))
15956 vec_any_nge(vector float __a, vector float __b) {
15957   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15958 }
15959
15960 /* vec_any_ngt */
15961
15962 static __inline__ int __attribute__((__always_inline__))
15963 vec_any_ngt(vector float __a, vector float __b) {
15964   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15965 }
15966
15967 /* vec_any_nle */
15968
15969 static __inline__ int __attribute__((__always_inline__))
15970 vec_any_nle(vector float __a, vector float __b) {
15971   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15972 }
15973
15974 /* vec_any_nlt */
15975
15976 static __inline__ int __attribute__((__always_inline__))
15977 vec_any_nlt(vector float __a, vector float __b) {
15978   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15979 }
15980
15981 /* vec_any_numeric */
15982
15983 static __inline__ int __attribute__((__always_inline__))
15984 vec_any_numeric(vector float __a) {
15985   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15986 }
15987
15988 /* vec_any_out */
15989
15990 static __inline__ int __attribute__((__always_inline__))
15991 vec_any_out(vector float __a, vector float __b) {
15992   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
15993 }
15994
15995 /* Power 8 Crypto functions
15996 Note: We diverge from the current GCC implementation with regard
15997 to cryptography and related functions as follows:
15998 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
15999 - The remaining ones are only available on Power8 and up so
16000   require -mpower8-vector
16001 The justification for this is that export requirements require that
16002 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16003 support). As a result, we need to be able to turn off support for those.
16004 The remaining ones (currently controlled by -mcrypto for GCC) still
16005 need to be provided on compliant hardware even if Vector.Crypto is not
16006 provided.
16007 */
16008 #ifdef __CRYPTO__
16009 #define vec_sbox_be __builtin_altivec_crypto_vsbox
16010 #define vec_cipher_be __builtin_altivec_crypto_vcipher
16011 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16012 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
16013 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16014
16015 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16016 __builtin_crypto_vsbox(vector unsigned long long __a) {
16017   return __builtin_altivec_crypto_vsbox(__a);
16018 }
16019
16020 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16021 __builtin_crypto_vcipher(vector unsigned long long __a,
16022                          vector unsigned long long __b) {
16023   return __builtin_altivec_crypto_vcipher(__a, __b);
16024 }
16025
16026 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16027 __builtin_crypto_vcipherlast(vector unsigned long long __a,
16028                              vector unsigned long long __b) {
16029   return __builtin_altivec_crypto_vcipherlast(__a, __b);
16030 }
16031
16032 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16033 __builtin_crypto_vncipher(vector unsigned long long __a,
16034                           vector unsigned long long __b) {
16035   return __builtin_altivec_crypto_vncipher(__a, __b);
16036 }
16037
16038 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16039 __builtin_crypto_vncipherlast(vector unsigned long long __a,
16040                               vector unsigned long long __b) {
16041   return __builtin_altivec_crypto_vncipherlast(__a, __b);
16042 }
16043
16044 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16045 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16046
16047 #define vec_shasigma_be(X, Y, Z)                                               \
16048   _Generic((X), vector unsigned int                                            \
16049            : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16050            : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16051 #endif
16052
16053 #ifdef __POWER8_VECTOR__
16054 static __inline__ vector bool char __ATTRS_o_ai
16055 vec_permxor(vector bool char __a, vector bool char __b,
16056             vector bool char __c) {
16057   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16058 }
16059
16060 static __inline__ vector signed char __ATTRS_o_ai
16061 vec_permxor(vector signed char __a, vector signed char __b,
16062             vector signed char __c) {
16063   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16064 }
16065
16066 static __inline__ vector unsigned char __ATTRS_o_ai
16067 vec_permxor(vector unsigned char __a, vector unsigned char __b,
16068             vector unsigned char __c) {
16069   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16070 }
16071
16072 static __inline__ vector unsigned char __ATTRS_o_ai
16073 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16074                           vector unsigned char __c) {
16075   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16076 }
16077
16078 static __inline__ vector unsigned short __ATTRS_o_ai
16079 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16080                           vector unsigned short __c) {
16081   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16082       (vector unsigned char)__a, (vector unsigned char)__b,
16083       (vector unsigned char)__c);
16084 }
16085
16086 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16087     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16088   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16089       (vector unsigned char)__a, (vector unsigned char)__b,
16090       (vector unsigned char)__c);
16091 }
16092
16093 static __inline__ vector unsigned long long __ATTRS_o_ai
16094 __builtin_crypto_vpermxor(vector unsigned long long __a,
16095                           vector unsigned long long __b,
16096                           vector unsigned long long __c) {
16097   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16098       (vector unsigned char)__a, (vector unsigned char)__b,
16099       (vector unsigned char)__c);
16100 }
16101
16102 static __inline__ vector unsigned char __ATTRS_o_ai
16103 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16104   return __builtin_altivec_crypto_vpmsumb(__a, __b);
16105 }
16106
16107 static __inline__ vector unsigned short __ATTRS_o_ai
16108 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16109   return __builtin_altivec_crypto_vpmsumh(__a, __b);
16110 }
16111
16112 static __inline__ vector unsigned int __ATTRS_o_ai
16113 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16114   return __builtin_altivec_crypto_vpmsumw(__a, __b);
16115 }
16116
16117 static __inline__ vector unsigned long long __ATTRS_o_ai
16118 __builtin_crypto_vpmsumb(vector unsigned long long __a,
16119                          vector unsigned long long __b) {
16120   return __builtin_altivec_crypto_vpmsumd(__a, __b);
16121 }
16122
16123 static __inline__ vector signed char __ATTRS_o_ai
16124 vec_vgbbd(vector signed char __a) {
16125   return __builtin_altivec_vgbbd((vector unsigned char)__a);
16126 }
16127
16128 #define vec_pmsum_be __builtin_crypto_vpmsumb
16129 #define vec_gb __builtin_altivec_vgbbd
16130
16131 static __inline__ vector unsigned char __ATTRS_o_ai
16132 vec_vgbbd(vector unsigned char __a) {
16133   return __builtin_altivec_vgbbd(__a);
16134 }
16135
16136 static __inline__ vector long long __ATTRS_o_ai
16137 vec_vbpermq(vector signed char __a, vector signed char __b) {
16138   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16139                                    (vector unsigned char)__b);
16140 }
16141
16142 static __inline__ vector long long __ATTRS_o_ai
16143 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16144   return __builtin_altivec_vbpermq(__a, __b);
16145 }
16146
16147 #ifdef __powerpc64__
16148 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16149 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16150   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16151                                    (vector unsigned char)__b);
16152 }
16153 #endif
16154 #endif
16155
16156
16157 /* vec_reve */
16158
16159 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16160   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16161                                  5, 4, 3, 2, 1, 0);
16162 }
16163
16164 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16165   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16166                                  5, 4, 3, 2, 1, 0);
16167 }
16168
16169 static inline __ATTRS_o_ai vector unsigned char
16170 vec_reve(vector unsigned char __a) {
16171   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16172                                  5, 4, 3, 2, 1, 0);
16173 }
16174
16175 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16176   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16177 }
16178
16179 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16180   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16181 }
16182
16183 static inline __ATTRS_o_ai vector unsigned int
16184 vec_reve(vector unsigned int __a) {
16185   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16186 }
16187
16188 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16189   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16190 }
16191
16192 static inline __ATTRS_o_ai vector signed short
16193 vec_reve(vector signed short __a) {
16194   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16195 }
16196
16197 static inline __ATTRS_o_ai vector unsigned short
16198 vec_reve(vector unsigned short __a) {
16199   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16200 }
16201
16202 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16203   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16204 }
16205
16206 #ifdef __VSX__
16207 static inline __ATTRS_o_ai vector bool long long
16208 vec_reve(vector bool long long __a) {
16209   return __builtin_shufflevector(__a, __a, 1, 0);
16210 }
16211
16212 static inline __ATTRS_o_ai vector signed long long
16213 vec_reve(vector signed long long __a) {
16214   return __builtin_shufflevector(__a, __a, 1, 0);
16215 }
16216
16217 static inline __ATTRS_o_ai vector unsigned long long
16218 vec_reve(vector unsigned long long __a) {
16219   return __builtin_shufflevector(__a, __a, 1, 0);
16220 }
16221
16222 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16223   return __builtin_shufflevector(__a, __a, 1, 0);
16224 }
16225 #endif
16226
16227 /* vec_revb */
16228 static __inline__ vector bool char __ATTRS_o_ai
16229 vec_revb(vector bool char __a) {
16230   return __a;
16231 }
16232
16233 static __inline__ vector signed char __ATTRS_o_ai
16234 vec_revb(vector signed char __a) {
16235   return __a;
16236 }
16237
16238 static __inline__ vector unsigned char __ATTRS_o_ai
16239 vec_revb(vector unsigned char __a) {
16240   return __a;
16241 }
16242
16243 static __inline__ vector bool short __ATTRS_o_ai
16244 vec_revb(vector bool short __a) {
16245   vector unsigned char __indices =
16246       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16247   return vec_perm(__a, __a, __indices);
16248 }
16249
16250 static __inline__ vector signed short __ATTRS_o_ai
16251 vec_revb(vector signed short __a) {
16252   vector unsigned char __indices =
16253       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16254   return vec_perm(__a, __a, __indices);
16255 }
16256
16257 static __inline__ vector unsigned short __ATTRS_o_ai
16258 vec_revb(vector unsigned short __a) {
16259   vector unsigned char __indices =
16260      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16261   return vec_perm(__a, __a, __indices);
16262 }
16263
16264 static __inline__ vector bool int __ATTRS_o_ai
16265 vec_revb(vector bool int __a) {
16266   vector unsigned char __indices =
16267       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16268   return vec_perm(__a, __a, __indices);
16269 }
16270
16271 static __inline__ vector signed int __ATTRS_o_ai
16272 vec_revb(vector signed int __a) {
16273   vector unsigned char __indices =
16274       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16275   return vec_perm(__a, __a, __indices);
16276 }
16277
16278 static __inline__ vector unsigned int __ATTRS_o_ai
16279 vec_revb(vector unsigned int __a) {
16280   vector unsigned char __indices =
16281       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16282   return vec_perm(__a, __a, __indices);
16283 }
16284
16285 static __inline__ vector float __ATTRS_o_ai
16286 vec_revb(vector float __a) {
16287  vector unsigned char __indices =
16288       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16289  return vec_perm(__a, __a, __indices);
16290 }
16291
16292 #ifdef __VSX__
16293 static __inline__ vector bool long long __ATTRS_o_ai
16294 vec_revb(vector bool long long __a) {
16295   vector unsigned char __indices =
16296       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16297   return vec_perm(__a, __a, __indices);
16298 }
16299
16300 static __inline__ vector signed long long __ATTRS_o_ai
16301 vec_revb(vector signed long long __a) {
16302   vector unsigned char __indices =
16303       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16304   return vec_perm(__a, __a, __indices);
16305 }
16306
16307 static __inline__ vector unsigned long long __ATTRS_o_ai
16308 vec_revb(vector unsigned long long __a) {
16309   vector unsigned char __indices =
16310       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16311   return vec_perm(__a, __a, __indices);
16312 }
16313
16314 static __inline__ vector double __ATTRS_o_ai
16315 vec_revb(vector double __a) {
16316   vector unsigned char __indices =
16317       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16318   return vec_perm(__a, __a, __indices);
16319 }
16320 #endif /* End __VSX__ */
16321
16322 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16323 static __inline__ vector signed __int128 __ATTRS_o_ai
16324 vec_revb(vector signed __int128 __a) {
16325   vector unsigned char __indices =
16326       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16327   return (vector signed __int128)vec_perm((vector signed int)__a,
16328                                           (vector signed int)__a,
16329                                            __indices);
16330 }
16331
16332 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16333 vec_revb(vector unsigned __int128 __a) {
16334   vector unsigned char __indices =
16335       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16336   return (vector unsigned __int128)vec_perm((vector signed int)__a,
16337                                             (vector signed int)__a,
16338                                              __indices);
16339 }
16340 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16341
16342 /* vec_xl */
16343
16344 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
16345 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
16346 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
16347 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
16348 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
16349 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
16350 typedef vector float unaligned_vec_float __attribute__((aligned(1)));
16351
16352 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16353                                                      signed char *__ptr) {
16354   return *(unaligned_vec_schar *)(__ptr + __offset);
16355 }
16356
16357 static inline __ATTRS_o_ai vector unsigned char
16358 vec_xl(signed long long __offset, unsigned char *__ptr) {
16359   return *(unaligned_vec_uchar*)(__ptr + __offset);
16360 }
16361
16362 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16363                                                       signed short *__ptr) {
16364   return *(unaligned_vec_sshort *)(__ptr + __offset);
16365 }
16366
16367 static inline __ATTRS_o_ai vector unsigned short
16368 vec_xl(signed long long __offset, unsigned short *__ptr) {
16369   return *(unaligned_vec_ushort *)(__ptr + __offset);
16370 }
16371
16372 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16373                                                     signed int *__ptr) {
16374   return *(unaligned_vec_sint *)(__ptr + __offset);
16375 }
16376
16377 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16378                                                       unsigned int *__ptr) {
16379   return *(unaligned_vec_uint *)(__ptr + __offset);
16380 }
16381
16382 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16383                                                float *__ptr) {
16384   return *(unaligned_vec_float *)(__ptr + __offset);
16385 }
16386
16387 #ifdef __VSX__
16388 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
16389 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
16390 typedef vector double unaligned_vec_double __attribute__((aligned(1)));
16391
16392 static inline __ATTRS_o_ai vector signed long long
16393 vec_xl(signed long long __offset, signed long long *__ptr) {
16394   return *(unaligned_vec_sll *)(__ptr + __offset);
16395 }
16396
16397 static inline __ATTRS_o_ai vector unsigned long long
16398 vec_xl(signed long long __offset, unsigned long long *__ptr) {
16399   return *(unaligned_vec_ull *)(__ptr + __offset);
16400 }
16401
16402 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16403                                                 double *__ptr) {
16404   return *(unaligned_vec_double *)(__ptr + __offset);
16405 }
16406 #endif
16407
16408 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16409 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
16410 typedef vector unsigned __int128 unaligned_vec_ui128
16411     __attribute__((aligned(1)));
16412 static inline __ATTRS_o_ai vector signed __int128
16413 vec_xl(signed long long __offset, signed __int128 *__ptr) {
16414   return *(unaligned_vec_si128 *)(__ptr + __offset);
16415 }
16416
16417 static inline __ATTRS_o_ai vector unsigned __int128
16418 vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16419   return *(unaligned_vec_ui128 *)(__ptr + __offset);
16420 }
16421 #endif
16422
16423 /* vec_xl_be */
16424
16425 #ifdef __LITTLE_ENDIAN__
16426 static __inline__ vector signed char __ATTRS_o_ai
16427 vec_xl_be(signed long long __offset, signed char *__ptr) {
16428   vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16429   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16430                                  13, 12, 11, 10, 9, 8);
16431 }
16432
16433 static __inline__ vector unsigned char __ATTRS_o_ai
16434 vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16435   vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16436   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16437                                  13, 12, 11, 10, 9, 8);
16438 }
16439
16440 static __inline__ vector signed short  __ATTRS_o_ai
16441 vec_xl_be(signed long long __offset, signed short *__ptr) {
16442   vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16443   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16444 }
16445
16446 static __inline__ vector unsigned short __ATTRS_o_ai
16447 vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16448   vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16449   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16450 }
16451
16452 static __inline__ vector signed int __ATTRS_o_ai
16453 vec_xl_be(signed long long  __offset, signed int *__ptr) {
16454   return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16455 }
16456
16457 static __inline__ vector unsigned int __ATTRS_o_ai
16458 vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16459   return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16460 }
16461
16462 static __inline__ vector float __ATTRS_o_ai
16463 vec_xl_be(signed long long  __offset, float *__ptr) {
16464   return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16465 }
16466
16467 #ifdef __VSX__
16468 static __inline__ vector signed long long __ATTRS_o_ai
16469 vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16470   return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16471 }
16472
16473 static __inline__ vector unsigned long long __ATTRS_o_ai
16474 vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16475   return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16476 }
16477
16478 static __inline__ vector double __ATTRS_o_ai
16479 vec_xl_be(signed long long  __offset, double *__ptr) {
16480   return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16481 }
16482 #endif
16483
16484 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16485 static __inline__ vector signed __int128 __ATTRS_o_ai
16486 vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16487   return vec_xl(__offset, __ptr);
16488 }
16489
16490 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16491 vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16492   return vec_xl(__offset, __ptr);
16493 }
16494 #endif
16495 #else
16496   #define vec_xl_be vec_xl
16497 #endif
16498
16499 /* vec_xst */
16500
16501 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16502                                         signed long long __offset,
16503                                         signed char *__ptr) {
16504   *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
16505 }
16506
16507 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16508                                         signed long long __offset,
16509                                         unsigned char *__ptr) {
16510   *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
16511 }
16512
16513 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16514                                         signed long long __offset,
16515                                         signed short *__ptr) {
16516   *(unaligned_vec_sshort *)(__ptr + __offset) = __vec;
16517 }
16518
16519 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
16520                                         signed long long __offset,
16521                                         unsigned short *__ptr) {
16522   *(unaligned_vec_ushort *)(__ptr + __offset) = __vec;
16523 }
16524
16525 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16526                                         signed long long __offset,
16527                                         signed int *__ptr) {
16528   *(unaligned_vec_sint *)(__ptr + __offset) = __vec;
16529 }
16530
16531 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16532                                         signed long long __offset,
16533                                         unsigned int *__ptr) {
16534   *(unaligned_vec_uint *)(__ptr + __offset) = __vec;
16535 }
16536
16537 static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16538                                         signed long long __offset,
16539                                         float *__ptr) {
16540   *(unaligned_vec_float *)(__ptr + __offset) = __vec;
16541 }
16542
16543 #ifdef __VSX__
16544 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16545                                         signed long long __offset,
16546                                         signed long long *__ptr) {
16547   *(unaligned_vec_sll *)(__ptr + __offset) = __vec;
16548 }
16549
16550 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16551                                         signed long long __offset,
16552                                         unsigned long long *__ptr) {
16553   *(unaligned_vec_ull *)(__ptr + __offset) = __vec;
16554 }
16555
16556 static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16557                                         signed long long __offset,
16558                                         double *__ptr) {
16559   *(unaligned_vec_double *)(__ptr + __offset) = __vec;
16560 }
16561 #endif
16562
16563 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16564 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16565                                         signed long long __offset,
16566                                         signed __int128 *__ptr) {
16567   *(unaligned_vec_si128 *)(__ptr + __offset) = __vec;
16568 }
16569
16570 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16571                                         signed long long __offset,
16572                                         unsigned __int128 *__ptr) {
16573   *(unaligned_vec_ui128 *)(__ptr + __offset) = __vec;
16574 }
16575 #endif
16576
16577 /* vec_xst_be */
16578
16579 #ifdef __LITTLE_ENDIAN__
16580 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16581                                                signed long long  __offset,
16582                                                signed char *__ptr) {
16583   vector signed char __tmp =
16584      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16585                              13, 12, 11, 10, 9, 8);
16586   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16587 }
16588
16589 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16590                                                signed long long  __offset,
16591                                                unsigned char *__ptr) {
16592   vector unsigned char __tmp =
16593      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16594                              13, 12, 11, 10, 9, 8);
16595   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16596 }
16597
16598 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16599                                                signed long long  __offset,
16600                                                signed short *__ptr) {
16601   vector signed short __tmp =
16602      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16603   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16604 }
16605
16606 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16607                                                signed long long  __offset,
16608                                                unsigned short *__ptr) {
16609   vector unsigned short __tmp =
16610      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16611   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16612 }
16613
16614 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16615                                                signed long long  __offset,
16616                                                signed int *__ptr) {
16617   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16618 }
16619
16620 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16621                                                signed long long  __offset,
16622                                                unsigned int *__ptr) {
16623   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16624 }
16625
16626 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16627                                                signed long long  __offset,
16628                                                float *__ptr) {
16629   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16630 }
16631
16632 #ifdef __VSX__
16633 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16634                                                signed long long  __offset,
16635                                                signed long long *__ptr) {
16636   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16637 }
16638
16639 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16640                                                signed long long  __offset,
16641                                                unsigned long long *__ptr) {
16642   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16643 }
16644
16645 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16646                                                signed long long  __offset,
16647                                                double *__ptr) {
16648   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16649 }
16650 #endif
16651
16652 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16653 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16654                                                signed long long  __offset,
16655                                                signed __int128 *__ptr) {
16656   vec_xst(__vec, __offset, __ptr);
16657 }
16658
16659 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16660                                                signed long long  __offset,
16661                                                unsigned __int128 *__ptr) {
16662   vec_xst(__vec, __offset, __ptr);
16663 }
16664 #endif
16665 #else
16666   #define vec_xst_be vec_xst
16667 #endif
16668
16669 #ifdef __POWER9_VECTOR__
16670 #define vec_test_data_class(__a, __b)                                      \
16671         _Generic((__a),                                                    \
16672            vector float:                                                   \
16673              (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)),       \
16674            vector double:                                                  \
16675              (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b))  \
16676         )
16677
16678 #endif /* #ifdef __POWER9_VECTOR__ */
16679
16680 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16681   return -__a;
16682 }
16683
16684 #ifdef __VSX__
16685 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16686   return -__a;
16687 }
16688
16689 #endif
16690
16691 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16692 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16693   return -__a;
16694 }
16695 #endif
16696
16697 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16698   return -__a;
16699 }
16700
16701 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16702   return -__a;
16703 }
16704
16705 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16706   return -__a;
16707 }
16708
16709 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16710   return - vec_abs(__a);
16711 }
16712
16713 #ifdef __VSX__
16714 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16715   return - vec_abs(__a);
16716 }
16717
16718 #endif
16719
16720 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16721 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16722   return __builtin_altivec_vminsd(__a, -__a);
16723 }
16724 #endif
16725
16726 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16727   return __builtin_altivec_vminsw(__a, -__a);
16728 }
16729
16730 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16731   return __builtin_altivec_vminsh(__a, -__a);
16732 }
16733
16734 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16735   return __builtin_altivec_vminsb(__a, -__a);
16736 }
16737 #undef __ATTRS_o_ai
16738
16739 #endif /* __ALTIVEC_H */