]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/Headers/altivec.h
Vendor import of stripped clang trunk r375505, the last commit before
[FreeBSD/FreeBSD.git] / 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 unsigned char __ATTRS_o_ai
2765 vec_xl_len_r(unsigned char *__a, size_t __b) {
2766   vector unsigned char __res =
2767       (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
2768 #ifdef __LITTLE_ENDIAN__
2769   vector unsigned char __mask =
2770       (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
2771   __res = (vector unsigned char)__builtin_altivec_vperm_4si(
2772       (vector int)__res, (vector int)__res, __mask);
2773 #endif
2774   return __res;
2775 }
2776
2777 // vec_xst_len
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((vector int)(__a), (__b)),  \
2880              vector unsigned int                                               \
2881            : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
2882                                                    (__b)),                     \
2883              vector unsigned long long                                         \
2884            : (__builtin_convertvector((vector unsigned long long)(__a),        \
2885                                       vector double) *                         \
2886               (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2887                                                          << 52)),              \
2888              vector signed long long                                           \
2889            : (__builtin_convertvector((vector signed long long)(__a),          \
2890                                       vector double) *                         \
2891               (vector double)(vector unsigned long long)((0x3ffULL - (__b))    \
2892                                                          << 52)))
2893 #else
2894 #define vec_ctf(__a, __b)                                                      \
2895   _Generic((__a), vector int                                                   \
2896            : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)),  \
2897              vector unsigned int                                               \
2898            : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \
2899                                                    (__b)))
2900 #endif
2901
2902 /* vec_vcfsx */
2903
2904 #define vec_vcfux __builtin_altivec_vcfux
2905
2906 /* vec_vcfux */
2907
2908 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
2909
2910 /* vec_cts */
2911
2912 #ifdef __VSX__
2913 #define vec_cts(__a, __b)                                                      \
2914   _Generic((__a), vector float                                                 \
2915            : __builtin_altivec_vctsxs((vector float)(__a), (__b)),             \
2916              vector double                                                     \
2917            : __extension__({                                                   \
2918              vector double __ret =                                             \
2919                  (vector double)(__a) *                                        \
2920                  (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
2921                                                             << 52);            \
2922              __builtin_convertvector(__ret, vector signed long long);          \
2923            }))
2924 #else
2925 #define vec_cts __builtin_altivec_vctsxs
2926 #endif
2927
2928 /* vec_vctsxs */
2929
2930 #define vec_vctsxs __builtin_altivec_vctsxs
2931
2932 /* vec_ctu */
2933
2934 #ifdef __VSX__
2935 #define vec_ctu(__a, __b)                                                      \
2936   _Generic((__a), vector float                                                 \
2937            : __builtin_altivec_vctuxs((vector float)(__a), (__b)),             \
2938              vector double                                                     \
2939            : __extension__({                                                   \
2940              vector double __ret =                                             \
2941                  (vector double)(__a) *                                        \
2942                  (vector double)(vector unsigned long long)((0x3ffULL + __b)   \
2943                                                             << 52);            \
2944              __builtin_convertvector(__ret, vector unsigned long long);        \
2945            }))
2946 #else
2947 #define vec_ctu __builtin_altivec_vctuxs
2948 #endif
2949
2950 /* vec_vctuxs */
2951
2952 #define vec_vctuxs __builtin_altivec_vctuxs
2953
2954 /* vec_signed */
2955
2956 static __inline__ vector signed int __ATTRS_o_ai
2957 vec_sld(vector signed int, vector signed int, unsigned const int __c);
2958
2959 static __inline__ vector signed int __ATTRS_o_ai
2960 vec_signed(vector float __a) {
2961   return __builtin_convertvector(__a, vector signed int);
2962 }
2963
2964 #ifdef __VSX__
2965 static __inline__ vector signed long long __ATTRS_o_ai
2966 vec_signed(vector double __a) {
2967   return __builtin_convertvector(__a, vector signed long long);
2968 }
2969
2970 static __inline__ vector signed int __attribute__((__always_inline__))
2971 vec_signed2(vector double __a, vector double __b) {
2972   return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
2973 }
2974
2975 static __inline__ vector signed int __ATTRS_o_ai
2976 vec_signede(vector double __a) {
2977 #ifdef __LITTLE_ENDIAN__
2978   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2979   return vec_sld(__ret, __ret, 12);
2980 #else
2981   return __builtin_vsx_xvcvdpsxws(__a);
2982 #endif
2983 }
2984
2985 static __inline__ vector signed int __ATTRS_o_ai
2986 vec_signedo(vector double __a) {
2987 #ifdef __LITTLE_ENDIAN__
2988   return __builtin_vsx_xvcvdpsxws(__a);
2989 #else
2990   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2991   return vec_sld(__ret, __ret, 12);
2992 #endif
2993 }
2994 #endif
2995
2996 /* vec_unsigned */
2997
2998 static __inline__ vector unsigned int __ATTRS_o_ai
2999 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3000
3001 static __inline__ vector unsigned int __ATTRS_o_ai
3002 vec_unsigned(vector float __a) {
3003   return __builtin_convertvector(__a, vector unsigned int);
3004 }
3005
3006 #ifdef __VSX__
3007 static __inline__ vector unsigned long long __ATTRS_o_ai
3008 vec_unsigned(vector double __a) {
3009   return __builtin_convertvector(__a, vector unsigned long long);
3010 }
3011
3012 static __inline__ vector unsigned int __attribute__((__always_inline__))
3013 vec_unsigned2(vector double __a, vector double __b) {
3014   return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3015 }
3016
3017 static __inline__ vector unsigned int __ATTRS_o_ai
3018 vec_unsignede(vector double __a) {
3019 #ifdef __LITTLE_ENDIAN__
3020   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3021   return vec_sld(__ret, __ret, 12);
3022 #else
3023   return __builtin_vsx_xvcvdpuxws(__a);
3024 #endif
3025 }
3026
3027 static __inline__ vector unsigned int __ATTRS_o_ai
3028 vec_unsignedo(vector double __a) {
3029 #ifdef __LITTLE_ENDIAN__
3030   return __builtin_vsx_xvcvdpuxws(__a);
3031 #else
3032   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3033   return vec_sld(__ret, __ret, 12);
3034 #endif
3035 }
3036 #endif
3037
3038 /* vec_float */
3039
3040 static __inline__ vector float __ATTRS_o_ai
3041 vec_sld(vector float, vector float, unsigned const int __c);
3042
3043 static __inline__ vector float __ATTRS_o_ai
3044 vec_float(vector signed int __a) {
3045   return __builtin_convertvector(__a, vector float);
3046 }
3047
3048 static __inline__ vector float __ATTRS_o_ai
3049 vec_float(vector unsigned int __a) {
3050   return __builtin_convertvector(__a, vector float);
3051 }
3052
3053 #ifdef __VSX__
3054 static __inline__ vector float __ATTRS_o_ai
3055 vec_float2(vector signed long long __a, vector signed long long __b) {
3056   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3057 }
3058
3059 static __inline__ vector float __ATTRS_o_ai
3060 vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3061   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3062 }
3063
3064 static __inline__ vector float __ATTRS_o_ai
3065 vec_float2(vector double __a, vector double __b) {
3066   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3067 }
3068
3069 static __inline__ vector float __ATTRS_o_ai
3070 vec_floate(vector signed long long __a) {
3071 #ifdef __LITTLE_ENDIAN__
3072   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3073   return vec_sld(__ret, __ret, 12);
3074 #else
3075   return __builtin_vsx_xvcvsxdsp(__a);
3076 #endif
3077 }
3078
3079 static __inline__ vector float __ATTRS_o_ai
3080 vec_floate(vector unsigned long long __a) {
3081 #ifdef __LITTLE_ENDIAN__
3082   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3083   return vec_sld(__ret, __ret, 12);
3084 #else
3085   return __builtin_vsx_xvcvuxdsp(__a);
3086 #endif
3087 }
3088
3089 static __inline__ vector float __ATTRS_o_ai
3090 vec_floate(vector double __a) {
3091 #ifdef __LITTLE_ENDIAN__
3092   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3093   return vec_sld(__ret, __ret, 12);
3094 #else
3095   return __builtin_vsx_xvcvdpsp(__a);
3096 #endif
3097 }
3098
3099 static __inline__ vector float __ATTRS_o_ai
3100 vec_floato(vector signed long long __a) {
3101 #ifdef __LITTLE_ENDIAN__
3102   return __builtin_vsx_xvcvsxdsp(__a);
3103 #else
3104   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3105   return vec_sld(__ret, __ret, 12);
3106 #endif
3107 }
3108
3109 static __inline__ vector float __ATTRS_o_ai
3110 vec_floato(vector unsigned long long __a) {
3111 #ifdef __LITTLE_ENDIAN__
3112   return __builtin_vsx_xvcvuxdsp(__a);
3113 #else
3114   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3115   return vec_sld(__ret, __ret, 12);
3116 #endif
3117 }
3118
3119 static __inline__ vector float __ATTRS_o_ai
3120 vec_floato(vector double __a) {
3121 #ifdef __LITTLE_ENDIAN__
3122   return __builtin_vsx_xvcvdpsp(__a);
3123 #else
3124   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3125   return vec_sld(__ret, __ret, 12);
3126 #endif
3127 }
3128 #endif
3129
3130 /* vec_double */
3131
3132 #ifdef __VSX__
3133 static __inline__ vector double __ATTRS_o_ai
3134 vec_double(vector signed long long __a) {
3135   return __builtin_convertvector(__a, vector double);
3136 }
3137
3138 static __inline__ vector double __ATTRS_o_ai
3139 vec_double(vector unsigned long long __a) {
3140   return __builtin_convertvector(__a, vector double);
3141 }
3142
3143 static __inline__ vector double __ATTRS_o_ai
3144 vec_doublee(vector signed int __a) {
3145 #ifdef __LITTLE_ENDIAN__
3146   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3147 #else
3148   return __builtin_vsx_xvcvsxwdp(__a);
3149 #endif
3150 }
3151
3152 static __inline__ vector double __ATTRS_o_ai
3153 vec_doublee(vector unsigned int __a) {
3154 #ifdef __LITTLE_ENDIAN__
3155   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3156 #else
3157   return __builtin_vsx_xvcvuxwdp(__a);
3158 #endif
3159 }
3160
3161 static __inline__ vector double __ATTRS_o_ai
3162 vec_doublee(vector float __a) {
3163 #ifdef __LITTLE_ENDIAN__
3164   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3165 #else
3166   return __builtin_vsx_xvcvspdp(__a);
3167 #endif
3168 }
3169
3170 static __inline__ vector double __ATTRS_o_ai
3171 vec_doubleh(vector signed int __a) {
3172   vector double __ret = {__a[0], __a[1]};
3173   return __ret;
3174 }
3175
3176 static __inline__ vector double __ATTRS_o_ai
3177 vec_doubleh(vector unsigned int __a) {
3178   vector double __ret = {__a[0], __a[1]};
3179   return __ret;
3180 }
3181
3182 static __inline__ vector double __ATTRS_o_ai
3183 vec_doubleh(vector float __a) {
3184   vector double __ret = {__a[0], __a[1]};
3185   return __ret;
3186 }
3187
3188 static __inline__ vector double __ATTRS_o_ai
3189 vec_doublel(vector signed int __a) {
3190   vector double __ret = {__a[2], __a[3]};
3191   return __ret;
3192 }
3193
3194 static __inline__ vector double __ATTRS_o_ai
3195 vec_doublel(vector unsigned int __a) {
3196   vector double __ret = {__a[2], __a[3]};
3197   return __ret;
3198 }
3199
3200 static __inline__ vector double __ATTRS_o_ai
3201 vec_doublel(vector float __a) {
3202   vector double __ret = {__a[2], __a[3]};
3203   return __ret;
3204 }
3205
3206 static __inline__ vector double __ATTRS_o_ai
3207 vec_doubleo(vector signed int __a) {
3208 #ifdef __LITTLE_ENDIAN__
3209   return __builtin_vsx_xvcvsxwdp(__a);
3210 #else
3211   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3212 #endif
3213 }
3214
3215 static __inline__ vector double __ATTRS_o_ai
3216 vec_doubleo(vector unsigned int __a) {
3217 #ifdef __LITTLE_ENDIAN__
3218   return __builtin_vsx_xvcvuxwdp(__a);
3219 #else
3220   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3221 #endif
3222 }
3223
3224 static __inline__ vector double __ATTRS_o_ai
3225 vec_doubleo(vector float __a) {
3226 #ifdef __LITTLE_ENDIAN__
3227   return __builtin_vsx_xvcvspdp(__a);
3228 #else
3229   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3230 #endif
3231 }
3232 #endif
3233
3234 /* vec_div */
3235
3236 /* Integer vector divides (vectors are scalarized, elements divided
3237    and the vectors reassembled).
3238 */
3239 static __inline__ vector signed char __ATTRS_o_ai
3240 vec_div(vector signed char __a, vector signed char __b) {
3241   return __a / __b;
3242 }
3243
3244 static __inline__ vector unsigned char __ATTRS_o_ai
3245 vec_div(vector unsigned char __a, vector unsigned char __b) {
3246   return __a / __b;
3247 }
3248
3249 static __inline__ vector signed short __ATTRS_o_ai
3250 vec_div(vector signed short __a, vector signed short __b) {
3251   return __a / __b;
3252 }
3253
3254 static __inline__ vector unsigned short __ATTRS_o_ai
3255 vec_div(vector unsigned short __a, vector unsigned short __b) {
3256   return __a / __b;
3257 }
3258
3259 static __inline__ vector signed int __ATTRS_o_ai
3260 vec_div(vector signed int __a, vector signed int __b) {
3261   return __a / __b;
3262 }
3263
3264 static __inline__ vector unsigned int __ATTRS_o_ai
3265 vec_div(vector unsigned int __a, vector unsigned int __b) {
3266   return __a / __b;
3267 }
3268
3269 #ifdef __VSX__
3270 static __inline__ vector signed long long __ATTRS_o_ai
3271 vec_div(vector signed long long __a, vector signed long long __b) {
3272   return __a / __b;
3273 }
3274
3275 static __inline__ vector unsigned long long __ATTRS_o_ai
3276 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3277   return __a / __b;
3278 }
3279
3280 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3281                                                     vector float __b) {
3282   return __a / __b;
3283 }
3284
3285 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3286                                                      vector double __b) {
3287   return __a / __b;
3288 }
3289 #endif
3290
3291 /* vec_dss */
3292
3293 #define vec_dss __builtin_altivec_dss
3294
3295 /* vec_dssall */
3296
3297 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3298   __builtin_altivec_dssall();
3299 }
3300
3301 /* vec_dst */
3302 #define vec_dst(__PTR, __CW, __STR) \
3303   __extension__(                    \
3304       { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
3305
3306 /* vec_dstst */
3307 #define vec_dstst(__PTR, __CW, __STR) \
3308   __extension__(                      \
3309       { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
3310
3311 /* vec_dststt */
3312 #define vec_dststt(__PTR, __CW, __STR) \
3313   __extension__(                       \
3314       { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
3315
3316 /* vec_dstt */
3317 #define vec_dstt(__PTR, __CW, __STR) \
3318   __extension__(                     \
3319       { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
3320
3321 /* vec_eqv */
3322
3323 #ifdef __POWER8_VECTOR__
3324 static __inline__ vector signed char __ATTRS_o_ai
3325 vec_eqv(vector signed char __a, vector signed char __b) {
3326   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3327                                                   (vector unsigned int)__b);
3328 }
3329
3330 static __inline__ vector unsigned char __ATTRS_o_ai
3331 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3332   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3333                                                     (vector unsigned int)__b);
3334 }
3335
3336 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3337                                                         vector bool char __b) {
3338   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3339                                                 (vector unsigned int)__b);
3340 }
3341
3342 static __inline__ vector signed short __ATTRS_o_ai
3343 vec_eqv(vector signed short __a, vector signed short __b) {
3344   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3345                                                    (vector unsigned int)__b);
3346 }
3347
3348 static __inline__ vector unsigned short __ATTRS_o_ai
3349 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3350   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3351                                                      (vector unsigned int)__b);
3352 }
3353
3354 static __inline__ vector bool short __ATTRS_o_ai
3355 vec_eqv(vector bool short __a, vector bool short __b) {
3356   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3357                                                  (vector unsigned int)__b);
3358 }
3359
3360 static __inline__ vector signed int __ATTRS_o_ai
3361 vec_eqv(vector signed int __a, vector signed int __b) {
3362   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3363                                                  (vector unsigned int)__b);
3364 }
3365
3366 static __inline__ vector unsigned int __ATTRS_o_ai
3367 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3368   return __builtin_vsx_xxleqv(__a, __b);
3369 }
3370
3371 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3372                                                        vector bool int __b) {
3373   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3374                                                (vector unsigned int)__b);
3375 }
3376
3377 static __inline__ vector signed long long __ATTRS_o_ai
3378 vec_eqv(vector signed long long __a, vector signed long long __b) {
3379   return (vector signed long long)__builtin_vsx_xxleqv(
3380       (vector unsigned int)__a, (vector unsigned int)__b);
3381 }
3382
3383 static __inline__ vector unsigned long long __ATTRS_o_ai
3384 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3385   return (vector unsigned long long)__builtin_vsx_xxleqv(
3386       (vector unsigned int)__a, (vector unsigned int)__b);
3387 }
3388
3389 static __inline__ vector bool long long __ATTRS_o_ai
3390 vec_eqv(vector bool long long __a, vector bool long long __b) {
3391   return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3392                                                      (vector unsigned int)__b);
3393 }
3394
3395 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3396                                                     vector float __b) {
3397   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3398                                             (vector unsigned int)__b);
3399 }
3400
3401 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3402                                                      vector double __b) {
3403   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3404                                              (vector unsigned int)__b);
3405 }
3406 #endif
3407
3408 /* vec_expte */
3409
3410 static __inline__ vector float __attribute__((__always_inline__))
3411 vec_expte(vector float __a) {
3412   return __builtin_altivec_vexptefp(__a);
3413 }
3414
3415 /* vec_vexptefp */
3416
3417 static __inline__ vector float __attribute__((__always_inline__))
3418 vec_vexptefp(vector float __a) {
3419   return __builtin_altivec_vexptefp(__a);
3420 }
3421
3422 /* vec_floor */
3423
3424 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3425 #ifdef __VSX__
3426   return __builtin_vsx_xvrspim(__a);
3427 #else
3428   return __builtin_altivec_vrfim(__a);
3429 #endif
3430 }
3431
3432 #ifdef __VSX__
3433 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3434   return __builtin_vsx_xvrdpim(__a);
3435 }
3436 #endif
3437
3438 /* vec_vrfim */
3439
3440 static __inline__ vector float __attribute__((__always_inline__))
3441 vec_vrfim(vector float __a) {
3442   return __builtin_altivec_vrfim(__a);
3443 }
3444
3445 /* vec_ld */
3446
3447 static __inline__ vector signed char __ATTRS_o_ai
3448 vec_ld(int __a, const vector signed char *__b) {
3449   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3450 }
3451
3452 static __inline__ vector signed char __ATTRS_o_ai
3453 vec_ld(int __a, const signed char *__b) {
3454   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3455 }
3456
3457 static __inline__ vector unsigned char __ATTRS_o_ai
3458 vec_ld(int __a, const vector unsigned char *__b) {
3459   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3460 }
3461
3462 static __inline__ vector unsigned char __ATTRS_o_ai
3463 vec_ld(int __a, const unsigned char *__b) {
3464   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3465 }
3466
3467 static __inline__ vector bool char __ATTRS_o_ai
3468 vec_ld(int __a, const vector bool char *__b) {
3469   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3470 }
3471
3472 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3473                                                    const vector short *__b) {
3474   return (vector short)__builtin_altivec_lvx(__a, __b);
3475 }
3476
3477 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3478   return (vector short)__builtin_altivec_lvx(__a, __b);
3479 }
3480
3481 static __inline__ vector unsigned short __ATTRS_o_ai
3482 vec_ld(int __a, const vector unsigned short *__b) {
3483   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3484 }
3485
3486 static __inline__ vector unsigned short __ATTRS_o_ai
3487 vec_ld(int __a, const unsigned short *__b) {
3488   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3489 }
3490
3491 static __inline__ vector bool short __ATTRS_o_ai
3492 vec_ld(int __a, const vector bool short *__b) {
3493   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3494 }
3495
3496 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3497                                                    const vector pixel *__b) {
3498   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3499 }
3500
3501 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3502                                                  const vector int *__b) {
3503   return (vector int)__builtin_altivec_lvx(__a, __b);
3504 }
3505
3506 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3507   return (vector int)__builtin_altivec_lvx(__a, __b);
3508 }
3509
3510 static __inline__ vector unsigned int __ATTRS_o_ai
3511 vec_ld(int __a, const vector unsigned int *__b) {
3512   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3513 }
3514
3515 static __inline__ vector unsigned int __ATTRS_o_ai
3516 vec_ld(int __a, const unsigned int *__b) {
3517   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3518 }
3519
3520 static __inline__ vector bool int __ATTRS_o_ai
3521 vec_ld(int __a, const vector bool int *__b) {
3522   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3523 }
3524
3525 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3526                                                    const vector float *__b) {
3527   return (vector float)__builtin_altivec_lvx(__a, __b);
3528 }
3529
3530 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3531   return (vector float)__builtin_altivec_lvx(__a, __b);
3532 }
3533
3534 /* vec_lvx */
3535
3536 static __inline__ vector signed char __ATTRS_o_ai
3537 vec_lvx(int __a, const vector signed char *__b) {
3538   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3539 }
3540
3541 static __inline__ vector signed char __ATTRS_o_ai
3542 vec_lvx(int __a, const signed char *__b) {
3543   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3544 }
3545
3546 static __inline__ vector unsigned char __ATTRS_o_ai
3547 vec_lvx(int __a, const vector unsigned char *__b) {
3548   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3549 }
3550
3551 static __inline__ vector unsigned char __ATTRS_o_ai
3552 vec_lvx(int __a, const unsigned char *__b) {
3553   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3554 }
3555
3556 static __inline__ vector bool char __ATTRS_o_ai
3557 vec_lvx(int __a, const vector bool char *__b) {
3558   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3559 }
3560
3561 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3562                                                     const vector short *__b) {
3563   return (vector short)__builtin_altivec_lvx(__a, __b);
3564 }
3565
3566 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3567   return (vector short)__builtin_altivec_lvx(__a, __b);
3568 }
3569
3570 static __inline__ vector unsigned short __ATTRS_o_ai
3571 vec_lvx(int __a, const vector unsigned short *__b) {
3572   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3573 }
3574
3575 static __inline__ vector unsigned short __ATTRS_o_ai
3576 vec_lvx(int __a, const unsigned short *__b) {
3577   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3578 }
3579
3580 static __inline__ vector bool short __ATTRS_o_ai
3581 vec_lvx(int __a, const vector bool short *__b) {
3582   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3583 }
3584
3585 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3586                                                     const vector pixel *__b) {
3587   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3588 }
3589
3590 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3591                                                   const vector int *__b) {
3592   return (vector int)__builtin_altivec_lvx(__a, __b);
3593 }
3594
3595 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3596   return (vector int)__builtin_altivec_lvx(__a, __b);
3597 }
3598
3599 static __inline__ vector unsigned int __ATTRS_o_ai
3600 vec_lvx(int __a, const vector unsigned int *__b) {
3601   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3602 }
3603
3604 static __inline__ vector unsigned int __ATTRS_o_ai
3605 vec_lvx(int __a, const unsigned int *__b) {
3606   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3607 }
3608
3609 static __inline__ vector bool int __ATTRS_o_ai
3610 vec_lvx(int __a, const vector bool int *__b) {
3611   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3612 }
3613
3614 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3615                                                     const vector float *__b) {
3616   return (vector float)__builtin_altivec_lvx(__a, __b);
3617 }
3618
3619 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3620   return (vector float)__builtin_altivec_lvx(__a, __b);
3621 }
3622
3623 /* vec_lde */
3624
3625 static __inline__ vector signed char __ATTRS_o_ai
3626 vec_lde(int __a, const signed char *__b) {
3627   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3628 }
3629
3630 static __inline__ vector unsigned char __ATTRS_o_ai
3631 vec_lde(int __a, const unsigned char *__b) {
3632   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3633 }
3634
3635 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3636   return (vector short)__builtin_altivec_lvehx(__a, __b);
3637 }
3638
3639 static __inline__ vector unsigned short __ATTRS_o_ai
3640 vec_lde(int __a, const unsigned short *__b) {
3641   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3642 }
3643
3644 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3645   return (vector int)__builtin_altivec_lvewx(__a, __b);
3646 }
3647
3648 static __inline__ vector unsigned int __ATTRS_o_ai
3649 vec_lde(int __a, const unsigned int *__b) {
3650   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3651 }
3652
3653 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3654   return (vector float)__builtin_altivec_lvewx(__a, __b);
3655 }
3656
3657 /* vec_lvebx */
3658
3659 static __inline__ vector signed char __ATTRS_o_ai
3660 vec_lvebx(int __a, const signed char *__b) {
3661   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3662 }
3663
3664 static __inline__ vector unsigned char __ATTRS_o_ai
3665 vec_lvebx(int __a, const unsigned char *__b) {
3666   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3667 }
3668
3669 /* vec_lvehx */
3670
3671 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3672                                                       const short *__b) {
3673   return (vector short)__builtin_altivec_lvehx(__a, __b);
3674 }
3675
3676 static __inline__ vector unsigned short __ATTRS_o_ai
3677 vec_lvehx(int __a, const unsigned short *__b) {
3678   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3679 }
3680
3681 /* vec_lvewx */
3682
3683 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3684   return (vector int)__builtin_altivec_lvewx(__a, __b);
3685 }
3686
3687 static __inline__ vector unsigned int __ATTRS_o_ai
3688 vec_lvewx(int __a, const unsigned int *__b) {
3689   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3690 }
3691
3692 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3693                                                       const float *__b) {
3694   return (vector float)__builtin_altivec_lvewx(__a, __b);
3695 }
3696
3697 /* vec_ldl */
3698
3699 static __inline__ vector signed char __ATTRS_o_ai
3700 vec_ldl(int __a, const vector signed char *__b) {
3701   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3702 }
3703
3704 static __inline__ vector signed char __ATTRS_o_ai
3705 vec_ldl(int __a, const signed char *__b) {
3706   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3707 }
3708
3709 static __inline__ vector unsigned char __ATTRS_o_ai
3710 vec_ldl(int __a, const vector unsigned char *__b) {
3711   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3712 }
3713
3714 static __inline__ vector unsigned char __ATTRS_o_ai
3715 vec_ldl(int __a, const unsigned char *__b) {
3716   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3717 }
3718
3719 static __inline__ vector bool char __ATTRS_o_ai
3720 vec_ldl(int __a, const vector bool char *__b) {
3721   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3722 }
3723
3724 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3725                                                     const vector short *__b) {
3726   return (vector short)__builtin_altivec_lvxl(__a, __b);
3727 }
3728
3729 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3730   return (vector short)__builtin_altivec_lvxl(__a, __b);
3731 }
3732
3733 static __inline__ vector unsigned short __ATTRS_o_ai
3734 vec_ldl(int __a, const vector unsigned short *__b) {
3735   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3736 }
3737
3738 static __inline__ vector unsigned short __ATTRS_o_ai
3739 vec_ldl(int __a, const unsigned short *__b) {
3740   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3741 }
3742
3743 static __inline__ vector bool short __ATTRS_o_ai
3744 vec_ldl(int __a, const vector bool short *__b) {
3745   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3746 }
3747
3748 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3749                                                     const vector pixel *__b) {
3750   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3751 }
3752
3753 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3754                                                   const vector int *__b) {
3755   return (vector int)__builtin_altivec_lvxl(__a, __b);
3756 }
3757
3758 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3759   return (vector int)__builtin_altivec_lvxl(__a, __b);
3760 }
3761
3762 static __inline__ vector unsigned int __ATTRS_o_ai
3763 vec_ldl(int __a, const vector unsigned int *__b) {
3764   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3765 }
3766
3767 static __inline__ vector unsigned int __ATTRS_o_ai
3768 vec_ldl(int __a, const unsigned int *__b) {
3769   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3770 }
3771
3772 static __inline__ vector bool int __ATTRS_o_ai
3773 vec_ldl(int __a, const vector bool int *__b) {
3774   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3775 }
3776
3777 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3778                                                     const vector float *__b) {
3779   return (vector float)__builtin_altivec_lvxl(__a, __b);
3780 }
3781
3782 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3783   return (vector float)__builtin_altivec_lvxl(__a, __b);
3784 }
3785
3786 /* vec_lvxl */
3787
3788 static __inline__ vector signed char __ATTRS_o_ai
3789 vec_lvxl(int __a, const vector signed char *__b) {
3790   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3791 }
3792
3793 static __inline__ vector signed char __ATTRS_o_ai
3794 vec_lvxl(int __a, const signed char *__b) {
3795   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3796 }
3797
3798 static __inline__ vector unsigned char __ATTRS_o_ai
3799 vec_lvxl(int __a, const vector unsigned char *__b) {
3800   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3801 }
3802
3803 static __inline__ vector unsigned char __ATTRS_o_ai
3804 vec_lvxl(int __a, const unsigned char *__b) {
3805   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3806 }
3807
3808 static __inline__ vector bool char __ATTRS_o_ai
3809 vec_lvxl(int __a, const vector bool char *__b) {
3810   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3811 }
3812
3813 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3814                                                      const vector short *__b) {
3815   return (vector short)__builtin_altivec_lvxl(__a, __b);
3816 }
3817
3818 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3819                                                      const short *__b) {
3820   return (vector short)__builtin_altivec_lvxl(__a, __b);
3821 }
3822
3823 static __inline__ vector unsigned short __ATTRS_o_ai
3824 vec_lvxl(int __a, const vector unsigned short *__b) {
3825   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3826 }
3827
3828 static __inline__ vector unsigned short __ATTRS_o_ai
3829 vec_lvxl(int __a, const unsigned short *__b) {
3830   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3831 }
3832
3833 static __inline__ vector bool short __ATTRS_o_ai
3834 vec_lvxl(int __a, const vector bool short *__b) {
3835   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3836 }
3837
3838 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3839                                                      const vector pixel *__b) {
3840   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3841 }
3842
3843 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3844                                                    const vector int *__b) {
3845   return (vector int)__builtin_altivec_lvxl(__a, __b);
3846 }
3847
3848 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3849   return (vector int)__builtin_altivec_lvxl(__a, __b);
3850 }
3851
3852 static __inline__ vector unsigned int __ATTRS_o_ai
3853 vec_lvxl(int __a, const vector unsigned int *__b) {
3854   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3855 }
3856
3857 static __inline__ vector unsigned int __ATTRS_o_ai
3858 vec_lvxl(int __a, const unsigned int *__b) {
3859   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3860 }
3861
3862 static __inline__ vector bool int __ATTRS_o_ai
3863 vec_lvxl(int __a, const vector bool int *__b) {
3864   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3865 }
3866
3867 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3868                                                      const vector float *__b) {
3869   return (vector float)__builtin_altivec_lvxl(__a, __b);
3870 }
3871
3872 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3873                                                      const float *__b) {
3874   return (vector float)__builtin_altivec_lvxl(__a, __b);
3875 }
3876
3877 /* vec_loge */
3878
3879 static __inline__ vector float __attribute__((__always_inline__))
3880 vec_loge(vector float __a) {
3881   return __builtin_altivec_vlogefp(__a);
3882 }
3883
3884 /* vec_vlogefp */
3885
3886 static __inline__ vector float __attribute__((__always_inline__))
3887 vec_vlogefp(vector float __a) {
3888   return __builtin_altivec_vlogefp(__a);
3889 }
3890
3891 /* vec_lvsl */
3892
3893 #ifdef __LITTLE_ENDIAN__
3894 static __inline__ vector unsigned char __ATTRS_o_ai
3895     __attribute__((__deprecated__("use assignment for unaligned little endian \
3896 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3897   vector unsigned char mask =
3898       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3899   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3900                                   7,  6,  5,  4,  3,  2,  1, 0};
3901   return vec_perm(mask, mask, reverse);
3902 }
3903 #else
3904 static __inline__ vector unsigned char __ATTRS_o_ai
3905 vec_lvsl(int __a, const signed char *__b) {
3906   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3907 }
3908 #endif
3909
3910 #ifdef __LITTLE_ENDIAN__
3911 static __inline__ vector unsigned char __ATTRS_o_ai
3912     __attribute__((__deprecated__("use assignment for unaligned little endian \
3913 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3914   vector unsigned char mask =
3915       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3916   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3917                                   7,  6,  5,  4,  3,  2,  1, 0};
3918   return vec_perm(mask, mask, reverse);
3919 }
3920 #else
3921 static __inline__ vector unsigned char __ATTRS_o_ai
3922 vec_lvsl(int __a, const unsigned char *__b) {
3923   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3924 }
3925 #endif
3926
3927 #ifdef __LITTLE_ENDIAN__
3928 static __inline__ vector unsigned char __ATTRS_o_ai
3929     __attribute__((__deprecated__("use assignment for unaligned little endian \
3930 loads/stores"))) vec_lvsl(int __a, const short *__b) {
3931   vector unsigned char mask =
3932       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3933   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3934                                   7,  6,  5,  4,  3,  2,  1, 0};
3935   return vec_perm(mask, mask, reverse);
3936 }
3937 #else
3938 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3939                                                              const short *__b) {
3940   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3941 }
3942 #endif
3943
3944 #ifdef __LITTLE_ENDIAN__
3945 static __inline__ vector unsigned char __ATTRS_o_ai
3946     __attribute__((__deprecated__("use assignment for unaligned little endian \
3947 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3948   vector unsigned char mask =
3949       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3950   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3951                                   7,  6,  5,  4,  3,  2,  1, 0};
3952   return vec_perm(mask, mask, reverse);
3953 }
3954 #else
3955 static __inline__ vector unsigned char __ATTRS_o_ai
3956 vec_lvsl(int __a, const unsigned short *__b) {
3957   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3958 }
3959 #endif
3960
3961 #ifdef __LITTLE_ENDIAN__
3962 static __inline__ vector unsigned char __ATTRS_o_ai
3963     __attribute__((__deprecated__("use assignment for unaligned little endian \
3964 loads/stores"))) vec_lvsl(int __a, const int *__b) {
3965   vector unsigned char mask =
3966       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3967   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3968                                   7,  6,  5,  4,  3,  2,  1, 0};
3969   return vec_perm(mask, mask, reverse);
3970 }
3971 #else
3972 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3973                                                              const int *__b) {
3974   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3975 }
3976 #endif
3977
3978 #ifdef __LITTLE_ENDIAN__
3979 static __inline__ vector unsigned char __ATTRS_o_ai
3980     __attribute__((__deprecated__("use assignment for unaligned little endian \
3981 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
3982   vector unsigned char mask =
3983       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3984   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3985                                   7,  6,  5,  4,  3,  2,  1, 0};
3986   return vec_perm(mask, mask, reverse);
3987 }
3988 #else
3989 static __inline__ vector unsigned char __ATTRS_o_ai
3990 vec_lvsl(int __a, const unsigned int *__b) {
3991   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3992 }
3993 #endif
3994
3995 #ifdef __LITTLE_ENDIAN__
3996 static __inline__ vector unsigned char __ATTRS_o_ai
3997     __attribute__((__deprecated__("use assignment for unaligned little endian \
3998 loads/stores"))) vec_lvsl(int __a, const float *__b) {
3999   vector unsigned char mask =
4000       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4001   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4002                                   7,  6,  5,  4,  3,  2,  1, 0};
4003   return vec_perm(mask, mask, reverse);
4004 }
4005 #else
4006 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4007                                                              const float *__b) {
4008   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4009 }
4010 #endif
4011
4012 /* vec_lvsr */
4013
4014 #ifdef __LITTLE_ENDIAN__
4015 static __inline__ vector unsigned char __ATTRS_o_ai
4016     __attribute__((__deprecated__("use assignment for unaligned little endian \
4017 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4018   vector unsigned char mask =
4019       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4020   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4021                                   7,  6,  5,  4,  3,  2,  1, 0};
4022   return vec_perm(mask, mask, reverse);
4023 }
4024 #else
4025 static __inline__ vector unsigned char __ATTRS_o_ai
4026 vec_lvsr(int __a, const signed char *__b) {
4027   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4028 }
4029 #endif
4030
4031 #ifdef __LITTLE_ENDIAN__
4032 static __inline__ vector unsigned char __ATTRS_o_ai
4033     __attribute__((__deprecated__("use assignment for unaligned little endian \
4034 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4035   vector unsigned char mask =
4036       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4037   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4038                                   7,  6,  5,  4,  3,  2,  1, 0};
4039   return vec_perm(mask, mask, reverse);
4040 }
4041 #else
4042 static __inline__ vector unsigned char __ATTRS_o_ai
4043 vec_lvsr(int __a, const unsigned char *__b) {
4044   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4045 }
4046 #endif
4047
4048 #ifdef __LITTLE_ENDIAN__
4049 static __inline__ vector unsigned char __ATTRS_o_ai
4050     __attribute__((__deprecated__("use assignment for unaligned little endian \
4051 loads/stores"))) vec_lvsr(int __a, const short *__b) {
4052   vector unsigned char mask =
4053       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4054   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4055                                   7,  6,  5,  4,  3,  2,  1, 0};
4056   return vec_perm(mask, mask, reverse);
4057 }
4058 #else
4059 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4060                                                              const short *__b) {
4061   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4062 }
4063 #endif
4064
4065 #ifdef __LITTLE_ENDIAN__
4066 static __inline__ vector unsigned char __ATTRS_o_ai
4067     __attribute__((__deprecated__("use assignment for unaligned little endian \
4068 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4069   vector unsigned char mask =
4070       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4071   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4072                                   7,  6,  5,  4,  3,  2,  1, 0};
4073   return vec_perm(mask, mask, reverse);
4074 }
4075 #else
4076 static __inline__ vector unsigned char __ATTRS_o_ai
4077 vec_lvsr(int __a, const unsigned short *__b) {
4078   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4079 }
4080 #endif
4081
4082 #ifdef __LITTLE_ENDIAN__
4083 static __inline__ vector unsigned char __ATTRS_o_ai
4084     __attribute__((__deprecated__("use assignment for unaligned little endian \
4085 loads/stores"))) vec_lvsr(int __a, const int *__b) {
4086   vector unsigned char mask =
4087       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4088   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4089                                   7,  6,  5,  4,  3,  2,  1, 0};
4090   return vec_perm(mask, mask, reverse);
4091 }
4092 #else
4093 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4094                                                              const int *__b) {
4095   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4096 }
4097 #endif
4098
4099 #ifdef __LITTLE_ENDIAN__
4100 static __inline__ vector unsigned char __ATTRS_o_ai
4101     __attribute__((__deprecated__("use assignment for unaligned little endian \
4102 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4103   vector unsigned char mask =
4104       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4105   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4106                                   7,  6,  5,  4,  3,  2,  1, 0};
4107   return vec_perm(mask, mask, reverse);
4108 }
4109 #else
4110 static __inline__ vector unsigned char __ATTRS_o_ai
4111 vec_lvsr(int __a, const unsigned int *__b) {
4112   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4113 }
4114 #endif
4115
4116 #ifdef __LITTLE_ENDIAN__
4117 static __inline__ vector unsigned char __ATTRS_o_ai
4118     __attribute__((__deprecated__("use assignment for unaligned little endian \
4119 loads/stores"))) vec_lvsr(int __a, const float *__b) {
4120   vector unsigned char mask =
4121       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4122   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4123                                   7,  6,  5,  4,  3,  2,  1, 0};
4124   return vec_perm(mask, mask, reverse);
4125 }
4126 #else
4127 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4128                                                              const float *__b) {
4129   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4130 }
4131 #endif
4132
4133 /* vec_madd */
4134 static __inline__ vector signed short __ATTRS_o_ai
4135 vec_mladd(vector signed short, vector signed short, vector signed short);
4136 static __inline__ vector signed short __ATTRS_o_ai
4137 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4138 static __inline__ vector signed short __ATTRS_o_ai
4139 vec_mladd(vector unsigned short, vector signed short, vector signed short);
4140 static __inline__ vector unsigned short __ATTRS_o_ai
4141 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4142
4143 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4144     vector signed short __a, vector signed short __b, vector signed short __c) {
4145   return vec_mladd(__a, __b, __c);
4146 }
4147
4148 static __inline__ vector signed short __ATTRS_o_ai
4149 vec_madd(vector signed short __a, vector unsigned short __b,
4150          vector unsigned short __c) {
4151   return vec_mladd(__a, __b, __c);
4152 }
4153
4154 static __inline__ vector signed short __ATTRS_o_ai
4155 vec_madd(vector unsigned short __a, vector signed short __b,
4156          vector signed short __c) {
4157   return vec_mladd(__a, __b, __c);
4158 }
4159
4160 static __inline__ vector unsigned short __ATTRS_o_ai
4161 vec_madd(vector unsigned short __a, vector unsigned short __b,
4162          vector unsigned short __c) {
4163   return vec_mladd(__a, __b, __c);
4164 }
4165
4166 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4167                                                      vector float __b,
4168                                                      vector float __c) {
4169 #ifdef __VSX__
4170   return __builtin_vsx_xvmaddasp(__a, __b, __c);
4171 #else
4172   return __builtin_altivec_vmaddfp(__a, __b, __c);
4173 #endif
4174 }
4175
4176 #ifdef __VSX__
4177 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4178                                                       vector double __b,
4179                                                       vector double __c) {
4180   return __builtin_vsx_xvmaddadp(__a, __b, __c);
4181 }
4182 #endif
4183
4184 /* vec_vmaddfp */
4185
4186 static __inline__ vector float __attribute__((__always_inline__))
4187 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4188   return __builtin_altivec_vmaddfp(__a, __b, __c);
4189 }
4190
4191 /* vec_madds */
4192
4193 static __inline__ vector signed short __attribute__((__always_inline__))
4194 vec_madds(vector signed short __a, vector signed short __b,
4195           vector signed short __c) {
4196   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4197 }
4198
4199 /* vec_vmhaddshs */
4200 static __inline__ vector signed short __attribute__((__always_inline__))
4201 vec_vmhaddshs(vector signed short __a, vector signed short __b,
4202               vector signed short __c) {
4203   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4204 }
4205
4206 /* vec_msub */
4207
4208 #ifdef __VSX__
4209 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4210                                                      vector float __b,
4211                                                      vector float __c) {
4212   return __builtin_vsx_xvmsubasp(__a, __b, __c);
4213 }
4214
4215 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4216                                                       vector double __b,
4217                                                       vector double __c) {
4218   return __builtin_vsx_xvmsubadp(__a, __b, __c);
4219 }
4220 #endif
4221
4222 /* vec_max */
4223
4224 static __inline__ vector signed char __ATTRS_o_ai
4225 vec_max(vector signed char __a, vector signed char __b) {
4226   return __builtin_altivec_vmaxsb(__a, __b);
4227 }
4228
4229 static __inline__ vector signed char __ATTRS_o_ai
4230 vec_max(vector bool char __a, vector signed char __b) {
4231   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4232 }
4233
4234 static __inline__ vector signed char __ATTRS_o_ai
4235 vec_max(vector signed char __a, vector bool char __b) {
4236   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4237 }
4238
4239 static __inline__ vector unsigned char __ATTRS_o_ai
4240 vec_max(vector unsigned char __a, vector unsigned char __b) {
4241   return __builtin_altivec_vmaxub(__a, __b);
4242 }
4243
4244 static __inline__ vector unsigned char __ATTRS_o_ai
4245 vec_max(vector bool char __a, vector unsigned char __b) {
4246   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4247 }
4248
4249 static __inline__ vector unsigned char __ATTRS_o_ai
4250 vec_max(vector unsigned char __a, vector bool char __b) {
4251   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4252 }
4253
4254 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4255                                                     vector short __b) {
4256   return __builtin_altivec_vmaxsh(__a, __b);
4257 }
4258
4259 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4260                                                     vector short __b) {
4261   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4262 }
4263
4264 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4265                                                     vector bool short __b) {
4266   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4267 }
4268
4269 static __inline__ vector unsigned short __ATTRS_o_ai
4270 vec_max(vector unsigned short __a, vector unsigned short __b) {
4271   return __builtin_altivec_vmaxuh(__a, __b);
4272 }
4273
4274 static __inline__ vector unsigned short __ATTRS_o_ai
4275 vec_max(vector bool short __a, vector unsigned short __b) {
4276   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4277 }
4278
4279 static __inline__ vector unsigned short __ATTRS_o_ai
4280 vec_max(vector unsigned short __a, vector bool short __b) {
4281   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4282 }
4283
4284 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4285                                                   vector int __b) {
4286   return __builtin_altivec_vmaxsw(__a, __b);
4287 }
4288
4289 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4290                                                   vector int __b) {
4291   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4292 }
4293
4294 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4295                                                   vector bool int __b) {
4296   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4297 }
4298
4299 static __inline__ vector unsigned int __ATTRS_o_ai
4300 vec_max(vector unsigned int __a, vector unsigned int __b) {
4301   return __builtin_altivec_vmaxuw(__a, __b);
4302 }
4303
4304 static __inline__ vector unsigned int __ATTRS_o_ai
4305 vec_max(vector bool int __a, vector unsigned int __b) {
4306   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4307 }
4308
4309 static __inline__ vector unsigned int __ATTRS_o_ai
4310 vec_max(vector unsigned int __a, vector bool int __b) {
4311   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4312 }
4313
4314 #ifdef __POWER8_VECTOR__
4315 static __inline__ vector signed long long __ATTRS_o_ai
4316 vec_max(vector signed long long __a, vector signed long long __b) {
4317   return __builtin_altivec_vmaxsd(__a, __b);
4318 }
4319
4320 static __inline__ vector signed long long __ATTRS_o_ai
4321 vec_max(vector bool long long __a, vector signed long long __b) {
4322   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4323 }
4324
4325 static __inline__ vector signed long long __ATTRS_o_ai
4326 vec_max(vector signed long long __a, vector bool long long __b) {
4327   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4328 }
4329
4330 static __inline__ vector unsigned long long __ATTRS_o_ai
4331 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4332   return __builtin_altivec_vmaxud(__a, __b);
4333 }
4334
4335 static __inline__ vector unsigned long long __ATTRS_o_ai
4336 vec_max(vector bool long long __a, vector unsigned long long __b) {
4337   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4338 }
4339
4340 static __inline__ vector unsigned long long __ATTRS_o_ai
4341 vec_max(vector unsigned long long __a, vector bool long long __b) {
4342   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4343 }
4344 #endif
4345
4346 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4347                                                     vector float __b) {
4348 #ifdef __VSX__
4349   return __builtin_vsx_xvmaxsp(__a, __b);
4350 #else
4351   return __builtin_altivec_vmaxfp(__a, __b);
4352 #endif
4353 }
4354
4355 #ifdef __VSX__
4356 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4357                                                      vector double __b) {
4358   return __builtin_vsx_xvmaxdp(__a, __b);
4359 }
4360 #endif
4361
4362 /* vec_vmaxsb */
4363
4364 static __inline__ vector signed char __ATTRS_o_ai
4365 vec_vmaxsb(vector signed char __a, vector signed char __b) {
4366   return __builtin_altivec_vmaxsb(__a, __b);
4367 }
4368
4369 static __inline__ vector signed char __ATTRS_o_ai
4370 vec_vmaxsb(vector bool char __a, vector signed char __b) {
4371   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4372 }
4373
4374 static __inline__ vector signed char __ATTRS_o_ai
4375 vec_vmaxsb(vector signed char __a, vector bool char __b) {
4376   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4377 }
4378
4379 /* vec_vmaxub */
4380
4381 static __inline__ vector unsigned char __ATTRS_o_ai
4382 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4383   return __builtin_altivec_vmaxub(__a, __b);
4384 }
4385
4386 static __inline__ vector unsigned char __ATTRS_o_ai
4387 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4388   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4389 }
4390
4391 static __inline__ vector unsigned char __ATTRS_o_ai
4392 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4393   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4394 }
4395
4396 /* vec_vmaxsh */
4397
4398 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4399                                                        vector short __b) {
4400   return __builtin_altivec_vmaxsh(__a, __b);
4401 }
4402
4403 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4404                                                        vector short __b) {
4405   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4406 }
4407
4408 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4409                                                        vector bool short __b) {
4410   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4411 }
4412
4413 /* vec_vmaxuh */
4414
4415 static __inline__ vector unsigned short __ATTRS_o_ai
4416 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4417   return __builtin_altivec_vmaxuh(__a, __b);
4418 }
4419
4420 static __inline__ vector unsigned short __ATTRS_o_ai
4421 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4422   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4423 }
4424
4425 static __inline__ vector unsigned short __ATTRS_o_ai
4426 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4427   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4428 }
4429
4430 /* vec_vmaxsw */
4431
4432 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4433                                                      vector int __b) {
4434   return __builtin_altivec_vmaxsw(__a, __b);
4435 }
4436
4437 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4438                                                      vector int __b) {
4439   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4440 }
4441
4442 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4443                                                      vector bool int __b) {
4444   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4445 }
4446
4447 /* vec_vmaxuw */
4448
4449 static __inline__ vector unsigned int __ATTRS_o_ai
4450 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4451   return __builtin_altivec_vmaxuw(__a, __b);
4452 }
4453
4454 static __inline__ vector unsigned int __ATTRS_o_ai
4455 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4456   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4457 }
4458
4459 static __inline__ vector unsigned int __ATTRS_o_ai
4460 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4461   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4462 }
4463
4464 /* vec_vmaxfp */
4465
4466 static __inline__ vector float __attribute__((__always_inline__))
4467 vec_vmaxfp(vector float __a, vector float __b) {
4468 #ifdef __VSX__
4469   return __builtin_vsx_xvmaxsp(__a, __b);
4470 #else
4471   return __builtin_altivec_vmaxfp(__a, __b);
4472 #endif
4473 }
4474
4475 /* vec_mergeh */
4476
4477 static __inline__ vector signed char __ATTRS_o_ai
4478 vec_mergeh(vector signed char __a, vector signed char __b) {
4479   return vec_perm(__a, __b,
4480                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4481                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4482                                          0x06, 0x16, 0x07, 0x17));
4483 }
4484
4485 static __inline__ vector unsigned char __ATTRS_o_ai
4486 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4487   return vec_perm(__a, __b,
4488                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4489                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4490                                          0x06, 0x16, 0x07, 0x17));
4491 }
4492
4493 static __inline__ vector bool char __ATTRS_o_ai
4494 vec_mergeh(vector bool char __a, vector bool char __b) {
4495   return vec_perm(__a, __b,
4496                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4497                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4498                                          0x06, 0x16, 0x07, 0x17));
4499 }
4500
4501 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4502                                                        vector short __b) {
4503   return vec_perm(__a, __b,
4504                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4505                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4506                                          0x06, 0x07, 0x16, 0x17));
4507 }
4508
4509 static __inline__ vector unsigned short __ATTRS_o_ai
4510 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4511   return vec_perm(__a, __b,
4512                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4513                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4514                                          0x06, 0x07, 0x16, 0x17));
4515 }
4516
4517 static __inline__ vector bool short __ATTRS_o_ai
4518 vec_mergeh(vector bool short __a, vector bool short __b) {
4519   return vec_perm(__a, __b,
4520                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4521                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4522                                          0x06, 0x07, 0x16, 0x17));
4523 }
4524
4525 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4526                                                        vector pixel __b) {
4527   return vec_perm(__a, __b,
4528                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4529                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4530                                          0x06, 0x07, 0x16, 0x17));
4531 }
4532
4533 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4534                                                      vector int __b) {
4535   return vec_perm(__a, __b,
4536                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4537                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4538                                          0x14, 0x15, 0x16, 0x17));
4539 }
4540
4541 static __inline__ vector unsigned int __ATTRS_o_ai
4542 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4543   return vec_perm(__a, __b,
4544                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4545                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4546                                          0x14, 0x15, 0x16, 0x17));
4547 }
4548
4549 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4550                                                           vector bool int __b) {
4551   return vec_perm(__a, __b,
4552                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4553                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4554                                          0x14, 0x15, 0x16, 0x17));
4555 }
4556
4557 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4558                                                        vector float __b) {
4559   return vec_perm(__a, __b,
4560                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4561                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4562                                          0x14, 0x15, 0x16, 0x17));
4563 }
4564
4565 #ifdef __VSX__
4566 static __inline__ vector signed long long __ATTRS_o_ai
4567 vec_mergeh(vector signed long long __a, vector signed long long __b) {
4568   return vec_perm(__a, __b,
4569                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4570                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4571                                          0x14, 0x15, 0x16, 0x17));
4572 }
4573
4574 static __inline__ vector signed long long __ATTRS_o_ai
4575 vec_mergeh(vector signed long long __a, vector bool long long __b) {
4576   return vec_perm(__a, (vector signed long long)__b,
4577                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4578                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4579                                          0x14, 0x15, 0x16, 0x17));
4580 }
4581
4582 static __inline__ vector signed long long __ATTRS_o_ai
4583 vec_mergeh(vector bool long long __a, vector signed long long __b) {
4584   return vec_perm((vector signed long long)__a, __b,
4585                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4586                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4587                                          0x14, 0x15, 0x16, 0x17));
4588 }
4589
4590 static __inline__ vector unsigned long long __ATTRS_o_ai
4591 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4592   return vec_perm(__a, __b,
4593                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4594                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4595                                          0x14, 0x15, 0x16, 0x17));
4596 }
4597
4598 static __inline__ vector unsigned long long __ATTRS_o_ai
4599 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4600   return vec_perm(__a, (vector unsigned long long)__b,
4601                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4602                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4603                                          0x14, 0x15, 0x16, 0x17));
4604 }
4605
4606 static __inline__ vector unsigned long long __ATTRS_o_ai
4607 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4608   return vec_perm((vector unsigned long long)__a, __b,
4609                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4610                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4611                                          0x14, 0x15, 0x16, 0x17));
4612 }
4613
4614 static __inline__ vector bool long long __ATTRS_o_ai
4615 vec_mergeh(vector bool long long __a, vector bool long long __b) {
4616   return vec_perm(__a, __b,
4617                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4618                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4619                                          0x14, 0x15, 0x16, 0x17));
4620 }
4621
4622 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4623                                                         vector double __b) {
4624   return vec_perm(__a, __b,
4625                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4626                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4627                                          0x14, 0x15, 0x16, 0x17));
4628 }
4629 static __inline__ vector double __ATTRS_o_ai
4630 vec_mergeh(vector double __a, vector bool long long __b) {
4631   return vec_perm(__a, (vector double)__b,
4632                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4633                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4634                                          0x14, 0x15, 0x16, 0x17));
4635 }
4636 static __inline__ vector double __ATTRS_o_ai
4637 vec_mergeh(vector bool long long __a, vector double __b) {
4638   return vec_perm((vector double)__a, __b,
4639                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4640                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4641                                          0x14, 0x15, 0x16, 0x17));
4642 }
4643 #endif
4644
4645 /* vec_vmrghb */
4646
4647 #define __builtin_altivec_vmrghb vec_vmrghb
4648
4649 static __inline__ vector signed char __ATTRS_o_ai
4650 vec_vmrghb(vector signed char __a, vector signed char __b) {
4651   return vec_perm(__a, __b,
4652                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4653                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4654                                          0x06, 0x16, 0x07, 0x17));
4655 }
4656
4657 static __inline__ vector unsigned char __ATTRS_o_ai
4658 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4659   return vec_perm(__a, __b,
4660                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4661                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4662                                          0x06, 0x16, 0x07, 0x17));
4663 }
4664
4665 static __inline__ vector bool char __ATTRS_o_ai
4666 vec_vmrghb(vector bool char __a, vector bool char __b) {
4667   return vec_perm(__a, __b,
4668                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4669                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4670                                          0x06, 0x16, 0x07, 0x17));
4671 }
4672
4673 /* vec_vmrghh */
4674
4675 #define __builtin_altivec_vmrghh vec_vmrghh
4676
4677 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4678                                                        vector short __b) {
4679   return vec_perm(__a, __b,
4680                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4681                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4682                                          0x06, 0x07, 0x16, 0x17));
4683 }
4684
4685 static __inline__ vector unsigned short __ATTRS_o_ai
4686 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4687   return vec_perm(__a, __b,
4688                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4689                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4690                                          0x06, 0x07, 0x16, 0x17));
4691 }
4692
4693 static __inline__ vector bool short __ATTRS_o_ai
4694 vec_vmrghh(vector bool short __a, vector bool short __b) {
4695   return vec_perm(__a, __b,
4696                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4697                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4698                                          0x06, 0x07, 0x16, 0x17));
4699 }
4700
4701 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4702                                                        vector pixel __b) {
4703   return vec_perm(__a, __b,
4704                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4705                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4706                                          0x06, 0x07, 0x16, 0x17));
4707 }
4708
4709 /* vec_vmrghw */
4710
4711 #define __builtin_altivec_vmrghw vec_vmrghw
4712
4713 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4714                                                      vector int __b) {
4715   return vec_perm(__a, __b,
4716                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4717                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4718                                          0x14, 0x15, 0x16, 0x17));
4719 }
4720
4721 static __inline__ vector unsigned int __ATTRS_o_ai
4722 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4723   return vec_perm(__a, __b,
4724                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4725                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4726                                          0x14, 0x15, 0x16, 0x17));
4727 }
4728
4729 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4730                                                           vector bool int __b) {
4731   return vec_perm(__a, __b,
4732                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4733                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4734                                          0x14, 0x15, 0x16, 0x17));
4735 }
4736
4737 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4738                                                        vector float __b) {
4739   return vec_perm(__a, __b,
4740                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4741                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4742                                          0x14, 0x15, 0x16, 0x17));
4743 }
4744
4745 /* vec_mergel */
4746
4747 static __inline__ vector signed char __ATTRS_o_ai
4748 vec_mergel(vector signed char __a, vector signed char __b) {
4749   return vec_perm(__a, __b,
4750                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4751                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4752                                          0x0E, 0x1E, 0x0F, 0x1F));
4753 }
4754
4755 static __inline__ vector unsigned char __ATTRS_o_ai
4756 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4757   return vec_perm(__a, __b,
4758                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4759                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4760                                          0x0E, 0x1E, 0x0F, 0x1F));
4761 }
4762
4763 static __inline__ vector bool char __ATTRS_o_ai
4764 vec_mergel(vector bool char __a, vector bool char __b) {
4765   return vec_perm(__a, __b,
4766                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4767                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4768                                          0x0E, 0x1E, 0x0F, 0x1F));
4769 }
4770
4771 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4772                                                        vector short __b) {
4773   return vec_perm(__a, __b,
4774                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4775                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4776                                          0x0E, 0x0F, 0x1E, 0x1F));
4777 }
4778
4779 static __inline__ vector unsigned short __ATTRS_o_ai
4780 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4781   return vec_perm(__a, __b,
4782                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4783                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4784                                          0x0E, 0x0F, 0x1E, 0x1F));
4785 }
4786
4787 static __inline__ vector bool short __ATTRS_o_ai
4788 vec_mergel(vector bool short __a, vector bool short __b) {
4789   return vec_perm(__a, __b,
4790                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4791                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4792                                          0x0E, 0x0F, 0x1E, 0x1F));
4793 }
4794
4795 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4796                                                        vector pixel __b) {
4797   return vec_perm(__a, __b,
4798                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4799                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4800                                          0x0E, 0x0F, 0x1E, 0x1F));
4801 }
4802
4803 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4804                                                      vector int __b) {
4805   return vec_perm(__a, __b,
4806                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4807                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4808                                          0x1C, 0x1D, 0x1E, 0x1F));
4809 }
4810
4811 static __inline__ vector unsigned int __ATTRS_o_ai
4812 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4813   return vec_perm(__a, __b,
4814                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4815                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4816                                          0x1C, 0x1D, 0x1E, 0x1F));
4817 }
4818
4819 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4820                                                           vector bool int __b) {
4821   return vec_perm(__a, __b,
4822                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4823                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4824                                          0x1C, 0x1D, 0x1E, 0x1F));
4825 }
4826
4827 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4828                                                        vector float __b) {
4829   return vec_perm(__a, __b,
4830                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4831                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4832                                          0x1C, 0x1D, 0x1E, 0x1F));
4833 }
4834
4835 #ifdef __VSX__
4836 static __inline__ vector signed long long __ATTRS_o_ai
4837 vec_mergel(vector signed long long __a, vector signed long long __b) {
4838   return vec_perm(__a, __b,
4839                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4840                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4841                                          0x1C, 0x1D, 0x1E, 0x1F));
4842 }
4843 static __inline__ vector signed long long __ATTRS_o_ai
4844 vec_mergel(vector signed long long __a, vector bool long long __b) {
4845   return vec_perm(__a, (vector signed long long)__b,
4846                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4847                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4848                                          0x1C, 0x1D, 0x1E, 0x1F));
4849 }
4850 static __inline__ vector signed long long __ATTRS_o_ai
4851 vec_mergel(vector bool long long __a, vector signed long long __b) {
4852   return vec_perm((vector signed long long)__a, __b,
4853                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4854                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4855                                          0x1C, 0x1D, 0x1E, 0x1F));
4856 }
4857 static __inline__ vector unsigned long long __ATTRS_o_ai
4858 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4859   return vec_perm(__a, __b,
4860                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4861                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4862                                          0x1C, 0x1D, 0x1E, 0x1F));
4863 }
4864 static __inline__ vector unsigned long long __ATTRS_o_ai
4865 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4866   return vec_perm(__a, (vector unsigned long long)__b,
4867                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4868                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4869                                          0x1C, 0x1D, 0x1E, 0x1F));
4870 }
4871 static __inline__ vector unsigned long long __ATTRS_o_ai
4872 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4873   return vec_perm((vector unsigned long long)__a, __b,
4874                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4875                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4876                                          0x1C, 0x1D, 0x1E, 0x1F));
4877 }
4878 static __inline__ vector bool long long __ATTRS_o_ai
4879 vec_mergel(vector bool long long __a, vector bool long long __b) {
4880   return vec_perm(__a, __b,
4881                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4882                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4883                                          0x1C, 0x1D, 0x1E, 0x1F));
4884 }
4885 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4886                                                         vector double __b) {
4887   return vec_perm(__a, __b,
4888                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4889                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4890                                          0x1C, 0x1D, 0x1E, 0x1F));
4891 }
4892 static __inline__ vector double __ATTRS_o_ai
4893 vec_mergel(vector double __a, vector bool long long __b) {
4894   return vec_perm(__a, (vector double)__b,
4895                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4896                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4897                                          0x1C, 0x1D, 0x1E, 0x1F));
4898 }
4899 static __inline__ vector double __ATTRS_o_ai
4900 vec_mergel(vector bool long long __a, vector double __b) {
4901   return vec_perm((vector double)__a, __b,
4902                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4903                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4904                                          0x1C, 0x1D, 0x1E, 0x1F));
4905 }
4906 #endif
4907
4908 /* vec_vmrglb */
4909
4910 #define __builtin_altivec_vmrglb vec_vmrglb
4911
4912 static __inline__ vector signed char __ATTRS_o_ai
4913 vec_vmrglb(vector signed char __a, vector signed char __b) {
4914   return vec_perm(__a, __b,
4915                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4916                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4917                                          0x0E, 0x1E, 0x0F, 0x1F));
4918 }
4919
4920 static __inline__ vector unsigned char __ATTRS_o_ai
4921 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4922   return vec_perm(__a, __b,
4923                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4924                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4925                                          0x0E, 0x1E, 0x0F, 0x1F));
4926 }
4927
4928 static __inline__ vector bool char __ATTRS_o_ai
4929 vec_vmrglb(vector bool char __a, vector bool char __b) {
4930   return vec_perm(__a, __b,
4931                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4932                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4933                                          0x0E, 0x1E, 0x0F, 0x1F));
4934 }
4935
4936 /* vec_vmrglh */
4937
4938 #define __builtin_altivec_vmrglh vec_vmrglh
4939
4940 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4941                                                        vector short __b) {
4942   return vec_perm(__a, __b,
4943                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4944                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4945                                          0x0E, 0x0F, 0x1E, 0x1F));
4946 }
4947
4948 static __inline__ vector unsigned short __ATTRS_o_ai
4949 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4950   return vec_perm(__a, __b,
4951                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4952                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4953                                          0x0E, 0x0F, 0x1E, 0x1F));
4954 }
4955
4956 static __inline__ vector bool short __ATTRS_o_ai
4957 vec_vmrglh(vector bool short __a, vector bool short __b) {
4958   return vec_perm(__a, __b,
4959                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4960                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4961                                          0x0E, 0x0F, 0x1E, 0x1F));
4962 }
4963
4964 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4965                                                        vector pixel __b) {
4966   return vec_perm(__a, __b,
4967                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4968                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4969                                          0x0E, 0x0F, 0x1E, 0x1F));
4970 }
4971
4972 /* vec_vmrglw */
4973
4974 #define __builtin_altivec_vmrglw vec_vmrglw
4975
4976 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4977                                                      vector int __b) {
4978   return vec_perm(__a, __b,
4979                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4980                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4981                                          0x1C, 0x1D, 0x1E, 0x1F));
4982 }
4983
4984 static __inline__ vector unsigned int __ATTRS_o_ai
4985 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
4986   return vec_perm(__a, __b,
4987                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4988                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4989                                          0x1C, 0x1D, 0x1E, 0x1F));
4990 }
4991
4992 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
4993                                                           vector bool int __b) {
4994   return vec_perm(__a, __b,
4995                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4996                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4997                                          0x1C, 0x1D, 0x1E, 0x1F));
4998 }
4999
5000 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5001                                                        vector float __b) {
5002   return vec_perm(__a, __b,
5003                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5004                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5005                                          0x1C, 0x1D, 0x1E, 0x1F));
5006 }
5007
5008 #ifdef __POWER8_VECTOR__
5009 /* vec_mergee */
5010
5011 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5012                                                           vector bool int __b) {
5013   return vec_perm(__a, __b,
5014                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5015                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5016                                          0x18, 0x19, 0x1A, 0x1B));
5017 }
5018
5019 static __inline__ vector signed int __ATTRS_o_ai
5020 vec_mergee(vector signed int __a, vector signed int __b) {
5021   return vec_perm(__a, __b,
5022                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5023                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5024                                          0x18, 0x19, 0x1A, 0x1B));
5025 }
5026
5027 static __inline__ vector unsigned int __ATTRS_o_ai
5028 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5029   return vec_perm(__a, __b,
5030                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5031                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5032                                          0x18, 0x19, 0x1A, 0x1B));
5033 }
5034
5035 static __inline__ vector bool long long __ATTRS_o_ai
5036 vec_mergee(vector bool long long __a, vector bool long long __b) {
5037   return vec_mergeh(__a, __b);
5038 }
5039
5040 static __inline__ vector signed long long __ATTRS_o_ai
5041 vec_mergee(vector signed long long __a, vector signed long long __b) {
5042   return vec_mergeh(__a, __b);
5043 }
5044
5045 static __inline__ vector unsigned long long __ATTRS_o_ai
5046 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5047   return vec_mergeh(__a, __b);
5048 }
5049
5050 static __inline__ vector float __ATTRS_o_ai
5051 vec_mergee(vector float __a, vector float __b) {
5052   return vec_perm(__a, __b,
5053                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5054                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5055                                          0x18, 0x19, 0x1A, 0x1B));
5056 }
5057
5058 static __inline__ vector double __ATTRS_o_ai
5059 vec_mergee(vector double __a, vector double __b) {
5060   return vec_mergeh(__a, __b);
5061 }
5062
5063 /* vec_mergeo */
5064
5065 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5066                                                           vector bool int __b) {
5067   return vec_perm(__a, __b,
5068                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5069                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5070                                          0x1C, 0x1D, 0x1E, 0x1F));
5071 }
5072
5073 static __inline__ vector signed int __ATTRS_o_ai
5074 vec_mergeo(vector signed int __a, vector signed int __b) {
5075   return vec_perm(__a, __b,
5076                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5077                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5078                                          0x1C, 0x1D, 0x1E, 0x1F));
5079 }
5080
5081 static __inline__ vector unsigned int __ATTRS_o_ai
5082 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5083   return vec_perm(__a, __b,
5084                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5085                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5086                                          0x1C, 0x1D, 0x1E, 0x1F));
5087 }
5088
5089 static __inline__ vector bool long long __ATTRS_o_ai
5090 vec_mergeo(vector bool long long __a, vector bool long long __b) {
5091   return vec_mergel(__a, __b);
5092 }
5093
5094 static __inline__ vector signed long long __ATTRS_o_ai
5095 vec_mergeo(vector signed long long __a, vector signed long long __b) {
5096   return vec_mergel(__a, __b);
5097 }
5098
5099 static __inline__ vector unsigned long long __ATTRS_o_ai
5100 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5101   return vec_mergel(__a, __b);
5102 }
5103
5104 static __inline__ vector float __ATTRS_o_ai
5105 vec_mergeo(vector float __a, vector float __b) {
5106   return vec_perm(__a, __b,
5107                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5108                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5109                                          0x1C, 0x1D, 0x1E, 0x1F));
5110 }
5111
5112 static __inline__ vector double __ATTRS_o_ai
5113 vec_mergeo(vector double __a, vector double __b) {
5114   return vec_mergel(__a, __b);
5115 }
5116
5117 #endif
5118
5119 /* vec_mfvscr */
5120
5121 static __inline__ vector unsigned short __attribute__((__always_inline__))
5122 vec_mfvscr(void) {
5123   return __builtin_altivec_mfvscr();
5124 }
5125
5126 /* vec_min */
5127
5128 static __inline__ vector signed char __ATTRS_o_ai
5129 vec_min(vector signed char __a, vector signed char __b) {
5130   return __builtin_altivec_vminsb(__a, __b);
5131 }
5132
5133 static __inline__ vector signed char __ATTRS_o_ai
5134 vec_min(vector bool char __a, vector signed char __b) {
5135   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5136 }
5137
5138 static __inline__ vector signed char __ATTRS_o_ai
5139 vec_min(vector signed char __a, vector bool char __b) {
5140   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5141 }
5142
5143 static __inline__ vector unsigned char __ATTRS_o_ai
5144 vec_min(vector unsigned char __a, vector unsigned char __b) {
5145   return __builtin_altivec_vminub(__a, __b);
5146 }
5147
5148 static __inline__ vector unsigned char __ATTRS_o_ai
5149 vec_min(vector bool char __a, vector unsigned char __b) {
5150   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5151 }
5152
5153 static __inline__ vector unsigned char __ATTRS_o_ai
5154 vec_min(vector unsigned char __a, vector bool char __b) {
5155   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5156 }
5157
5158 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5159                                                     vector short __b) {
5160   return __builtin_altivec_vminsh(__a, __b);
5161 }
5162
5163 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5164                                                     vector short __b) {
5165   return __builtin_altivec_vminsh((vector short)__a, __b);
5166 }
5167
5168 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5169                                                     vector bool short __b) {
5170   return __builtin_altivec_vminsh(__a, (vector short)__b);
5171 }
5172
5173 static __inline__ vector unsigned short __ATTRS_o_ai
5174 vec_min(vector unsigned short __a, vector unsigned short __b) {
5175   return __builtin_altivec_vminuh(__a, __b);
5176 }
5177
5178 static __inline__ vector unsigned short __ATTRS_o_ai
5179 vec_min(vector bool short __a, vector unsigned short __b) {
5180   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5181 }
5182
5183 static __inline__ vector unsigned short __ATTRS_o_ai
5184 vec_min(vector unsigned short __a, vector bool short __b) {
5185   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5186 }
5187
5188 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5189                                                   vector int __b) {
5190   return __builtin_altivec_vminsw(__a, __b);
5191 }
5192
5193 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5194                                                   vector int __b) {
5195   return __builtin_altivec_vminsw((vector int)__a, __b);
5196 }
5197
5198 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5199                                                   vector bool int __b) {
5200   return __builtin_altivec_vminsw(__a, (vector int)__b);
5201 }
5202
5203 static __inline__ vector unsigned int __ATTRS_o_ai
5204 vec_min(vector unsigned int __a, vector unsigned int __b) {
5205   return __builtin_altivec_vminuw(__a, __b);
5206 }
5207
5208 static __inline__ vector unsigned int __ATTRS_o_ai
5209 vec_min(vector bool int __a, vector unsigned int __b) {
5210   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5211 }
5212
5213 static __inline__ vector unsigned int __ATTRS_o_ai
5214 vec_min(vector unsigned int __a, vector bool int __b) {
5215   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5216 }
5217
5218 #ifdef __POWER8_VECTOR__
5219 static __inline__ vector signed long long __ATTRS_o_ai
5220 vec_min(vector signed long long __a, vector signed long long __b) {
5221   return __builtin_altivec_vminsd(__a, __b);
5222 }
5223
5224 static __inline__ vector signed long long __ATTRS_o_ai
5225 vec_min(vector bool long long __a, vector signed long long __b) {
5226   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5227 }
5228
5229 static __inline__ vector signed long long __ATTRS_o_ai
5230 vec_min(vector signed long long __a, vector bool long long __b) {
5231   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5232 }
5233
5234 static __inline__ vector unsigned long long __ATTRS_o_ai
5235 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5236   return __builtin_altivec_vminud(__a, __b);
5237 }
5238
5239 static __inline__ vector unsigned long long __ATTRS_o_ai
5240 vec_min(vector bool long long __a, vector unsigned long long __b) {
5241   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5242 }
5243
5244 static __inline__ vector unsigned long long __ATTRS_o_ai
5245 vec_min(vector unsigned long long __a, vector bool long long __b) {
5246   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5247 }
5248 #endif
5249
5250 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5251                                                     vector float __b) {
5252 #ifdef __VSX__
5253   return __builtin_vsx_xvminsp(__a, __b);
5254 #else
5255   return __builtin_altivec_vminfp(__a, __b);
5256 #endif
5257 }
5258
5259 #ifdef __VSX__
5260 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5261                                                      vector double __b) {
5262   return __builtin_vsx_xvmindp(__a, __b);
5263 }
5264 #endif
5265
5266 /* vec_vminsb */
5267
5268 static __inline__ vector signed char __ATTRS_o_ai
5269 vec_vminsb(vector signed char __a, vector signed char __b) {
5270   return __builtin_altivec_vminsb(__a, __b);
5271 }
5272
5273 static __inline__ vector signed char __ATTRS_o_ai
5274 vec_vminsb(vector bool char __a, vector signed char __b) {
5275   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5276 }
5277
5278 static __inline__ vector signed char __ATTRS_o_ai
5279 vec_vminsb(vector signed char __a, vector bool char __b) {
5280   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5281 }
5282
5283 /* vec_vminub */
5284
5285 static __inline__ vector unsigned char __ATTRS_o_ai
5286 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5287   return __builtin_altivec_vminub(__a, __b);
5288 }
5289
5290 static __inline__ vector unsigned char __ATTRS_o_ai
5291 vec_vminub(vector bool char __a, vector unsigned char __b) {
5292   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5293 }
5294
5295 static __inline__ vector unsigned char __ATTRS_o_ai
5296 vec_vminub(vector unsigned char __a, vector bool char __b) {
5297   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5298 }
5299
5300 /* vec_vminsh */
5301
5302 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5303                                                        vector short __b) {
5304   return __builtin_altivec_vminsh(__a, __b);
5305 }
5306
5307 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5308                                                        vector short __b) {
5309   return __builtin_altivec_vminsh((vector short)__a, __b);
5310 }
5311
5312 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5313                                                        vector bool short __b) {
5314   return __builtin_altivec_vminsh(__a, (vector short)__b);
5315 }
5316
5317 /* vec_vminuh */
5318
5319 static __inline__ vector unsigned short __ATTRS_o_ai
5320 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5321   return __builtin_altivec_vminuh(__a, __b);
5322 }
5323
5324 static __inline__ vector unsigned short __ATTRS_o_ai
5325 vec_vminuh(vector bool short __a, vector unsigned short __b) {
5326   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5327 }
5328
5329 static __inline__ vector unsigned short __ATTRS_o_ai
5330 vec_vminuh(vector unsigned short __a, vector bool short __b) {
5331   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5332 }
5333
5334 /* vec_vminsw */
5335
5336 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5337                                                      vector int __b) {
5338   return __builtin_altivec_vminsw(__a, __b);
5339 }
5340
5341 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5342                                                      vector int __b) {
5343   return __builtin_altivec_vminsw((vector int)__a, __b);
5344 }
5345
5346 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5347                                                      vector bool int __b) {
5348   return __builtin_altivec_vminsw(__a, (vector int)__b);
5349 }
5350
5351 /* vec_vminuw */
5352
5353 static __inline__ vector unsigned int __ATTRS_o_ai
5354 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5355   return __builtin_altivec_vminuw(__a, __b);
5356 }
5357
5358 static __inline__ vector unsigned int __ATTRS_o_ai
5359 vec_vminuw(vector bool int __a, vector unsigned int __b) {
5360   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5361 }
5362
5363 static __inline__ vector unsigned int __ATTRS_o_ai
5364 vec_vminuw(vector unsigned int __a, vector bool int __b) {
5365   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5366 }
5367
5368 /* vec_vminfp */
5369
5370 static __inline__ vector float __attribute__((__always_inline__))
5371 vec_vminfp(vector float __a, vector float __b) {
5372 #ifdef __VSX__
5373   return __builtin_vsx_xvminsp(__a, __b);
5374 #else
5375   return __builtin_altivec_vminfp(__a, __b);
5376 #endif
5377 }
5378
5379 /* vec_mladd */
5380
5381 #define __builtin_altivec_vmladduhm vec_mladd
5382
5383 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5384                                                       vector short __b,
5385                                                       vector short __c) {
5386   return __a * __b + __c;
5387 }
5388
5389 static __inline__ vector short __ATTRS_o_ai vec_mladd(
5390     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5391   return __a * (vector short)__b + (vector short)__c;
5392 }
5393
5394 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5395                                                       vector short __b,
5396                                                       vector short __c) {
5397   return (vector short)__a * __b + __c;
5398 }
5399
5400 static __inline__ vector unsigned short __ATTRS_o_ai
5401 vec_mladd(vector unsigned short __a, vector unsigned short __b,
5402           vector unsigned short __c) {
5403   return __a * __b + __c;
5404 }
5405
5406 /* vec_vmladduhm */
5407
5408 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5409                                                           vector short __b,
5410                                                           vector short __c) {
5411   return __a * __b + __c;
5412 }
5413
5414 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5415     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5416   return __a * (vector short)__b + (vector short)__c;
5417 }
5418
5419 static __inline__ vector short __ATTRS_o_ai
5420 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5421   return (vector short)__a * __b + __c;
5422 }
5423
5424 static __inline__ vector unsigned short __ATTRS_o_ai
5425 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5426               vector unsigned short __c) {
5427   return __a * __b + __c;
5428 }
5429
5430 /* vec_mradds */
5431
5432 static __inline__ vector short __attribute__((__always_inline__))
5433 vec_mradds(vector short __a, vector short __b, vector short __c) {
5434   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5435 }
5436
5437 /* vec_vmhraddshs */
5438
5439 static __inline__ vector short __attribute__((__always_inline__))
5440 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5441   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5442 }
5443
5444 /* vec_msum */
5445
5446 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5447                                                    vector unsigned char __b,
5448                                                    vector int __c) {
5449   return __builtin_altivec_vmsummbm(__a, __b, __c);
5450 }
5451
5452 static __inline__ vector unsigned int __ATTRS_o_ai
5453 vec_msum(vector unsigned char __a, vector unsigned char __b,
5454          vector unsigned int __c) {
5455   return __builtin_altivec_vmsumubm(__a, __b, __c);
5456 }
5457
5458 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5459                                                    vector short __b,
5460                                                    vector int __c) {
5461   return __builtin_altivec_vmsumshm(__a, __b, __c);
5462 }
5463
5464 static __inline__ vector unsigned int __ATTRS_o_ai
5465 vec_msum(vector unsigned short __a, vector unsigned short __b,
5466          vector unsigned int __c) {
5467   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5468 }
5469
5470 /* vec_vmsummbm */
5471
5472 static __inline__ vector int __attribute__((__always_inline__))
5473 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5474   return __builtin_altivec_vmsummbm(__a, __b, __c);
5475 }
5476
5477 /* vec_vmsumubm */
5478
5479 static __inline__ vector unsigned int __attribute__((__always_inline__))
5480 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5481              vector unsigned int __c) {
5482   return __builtin_altivec_vmsumubm(__a, __b, __c);
5483 }
5484
5485 /* vec_vmsumshm */
5486
5487 static __inline__ vector int __attribute__((__always_inline__))
5488 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5489   return __builtin_altivec_vmsumshm(__a, __b, __c);
5490 }
5491
5492 /* vec_vmsumuhm */
5493
5494 static __inline__ vector unsigned int __attribute__((__always_inline__))
5495 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5496              vector unsigned int __c) {
5497   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5498 }
5499
5500 /* vec_msums */
5501
5502 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5503                                                     vector short __b,
5504                                                     vector int __c) {
5505   return __builtin_altivec_vmsumshs(__a, __b, __c);
5506 }
5507
5508 static __inline__ vector unsigned int __ATTRS_o_ai
5509 vec_msums(vector unsigned short __a, vector unsigned short __b,
5510           vector unsigned int __c) {
5511   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5512 }
5513
5514 /* vec_vmsumshs */
5515
5516 static __inline__ vector int __attribute__((__always_inline__))
5517 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5518   return __builtin_altivec_vmsumshs(__a, __b, __c);
5519 }
5520
5521 /* vec_vmsumuhs */
5522
5523 static __inline__ vector unsigned int __attribute__((__always_inline__))
5524 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5525              vector unsigned int __c) {
5526   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5527 }
5528
5529 /* vec_mtvscr */
5530
5531 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5532   __builtin_altivec_mtvscr((vector int)__a);
5533 }
5534
5535 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5536   __builtin_altivec_mtvscr((vector int)__a);
5537 }
5538
5539 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5540   __builtin_altivec_mtvscr((vector int)__a);
5541 }
5542
5543 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5544   __builtin_altivec_mtvscr((vector int)__a);
5545 }
5546
5547 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5548   __builtin_altivec_mtvscr((vector int)__a);
5549 }
5550
5551 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5552   __builtin_altivec_mtvscr((vector int)__a);
5553 }
5554
5555 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5556   __builtin_altivec_mtvscr((vector int)__a);
5557 }
5558
5559 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5560   __builtin_altivec_mtvscr((vector int)__a);
5561 }
5562
5563 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5564   __builtin_altivec_mtvscr((vector int)__a);
5565 }
5566
5567 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5568   __builtin_altivec_mtvscr((vector int)__a);
5569 }
5570
5571 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5572   __builtin_altivec_mtvscr((vector int)__a);
5573 }
5574
5575 /* vec_mul */
5576
5577 /* Integer vector multiplication will involve multiplication of the odd/even
5578    elements separately, then truncating the results and moving to the
5579    result vector.
5580 */
5581 static __inline__ vector signed char __ATTRS_o_ai
5582 vec_mul(vector signed char __a, vector signed char __b) {
5583   return __a * __b;
5584 }
5585
5586 static __inline__ vector unsigned char __ATTRS_o_ai
5587 vec_mul(vector unsigned char __a, vector unsigned char __b) {
5588   return __a * __b;
5589 }
5590
5591 static __inline__ vector signed short __ATTRS_o_ai
5592 vec_mul(vector signed short __a, vector signed short __b) {
5593   return __a * __b;
5594 }
5595
5596 static __inline__ vector unsigned short __ATTRS_o_ai
5597 vec_mul(vector unsigned short __a, vector unsigned short __b) {
5598   return __a * __b;
5599 }
5600
5601 static __inline__ vector signed int __ATTRS_o_ai
5602 vec_mul(vector signed int __a, vector signed int __b) {
5603   return __a * __b;
5604 }
5605
5606 static __inline__ vector unsigned int __ATTRS_o_ai
5607 vec_mul(vector unsigned int __a, vector unsigned int __b) {
5608   return __a * __b;
5609 }
5610
5611 #ifdef __VSX__
5612 static __inline__ vector signed long long __ATTRS_o_ai
5613 vec_mul(vector signed long long __a, vector signed long long __b) {
5614   return __a * __b;
5615 }
5616
5617 static __inline__ vector unsigned long long __ATTRS_o_ai
5618 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5619   return __a * __b;
5620 }
5621 #endif
5622
5623 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5624                                                     vector float __b) {
5625   return __a * __b;
5626 }
5627
5628 #ifdef __VSX__
5629 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5630                                                      vector double __b) {
5631   return __a * __b;
5632 }
5633 #endif
5634
5635 /* The vmulos* and vmules* instructions have a big endian bias, so
5636    we must reverse the meaning of "even" and "odd" for little endian.  */
5637
5638 /* vec_mule */
5639
5640 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5641                                                      vector signed char __b) {
5642 #ifdef __LITTLE_ENDIAN__
5643   return __builtin_altivec_vmulosb(__a, __b);
5644 #else
5645   return __builtin_altivec_vmulesb(__a, __b);
5646 #endif
5647 }
5648
5649 static __inline__ vector unsigned short __ATTRS_o_ai
5650 vec_mule(vector unsigned char __a, vector unsigned char __b) {
5651 #ifdef __LITTLE_ENDIAN__
5652   return __builtin_altivec_vmuloub(__a, __b);
5653 #else
5654   return __builtin_altivec_vmuleub(__a, __b);
5655 #endif
5656 }
5657
5658 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5659                                                    vector short __b) {
5660 #ifdef __LITTLE_ENDIAN__
5661   return __builtin_altivec_vmulosh(__a, __b);
5662 #else
5663   return __builtin_altivec_vmulesh(__a, __b);
5664 #endif
5665 }
5666
5667 static __inline__ vector unsigned int __ATTRS_o_ai
5668 vec_mule(vector unsigned short __a, vector unsigned short __b) {
5669 #ifdef __LITTLE_ENDIAN__
5670   return __builtin_altivec_vmulouh(__a, __b);
5671 #else
5672   return __builtin_altivec_vmuleuh(__a, __b);
5673 #endif
5674 }
5675
5676 #ifdef __POWER8_VECTOR__
5677 static __inline__ vector signed long long __ATTRS_o_ai
5678 vec_mule(vector signed int __a, vector signed int __b) {
5679 #ifdef __LITTLE_ENDIAN__
5680   return __builtin_altivec_vmulosw(__a, __b);
5681 #else
5682   return __builtin_altivec_vmulesw(__a, __b);
5683 #endif
5684 }
5685
5686 static __inline__ vector unsigned long long __ATTRS_o_ai
5687 vec_mule(vector unsigned int __a, vector unsigned int __b) {
5688 #ifdef __LITTLE_ENDIAN__
5689   return __builtin_altivec_vmulouw(__a, __b);
5690 #else
5691   return __builtin_altivec_vmuleuw(__a, __b);
5692 #endif
5693 }
5694 #endif
5695
5696 /* vec_vmulesb */
5697
5698 static __inline__ vector short __attribute__((__always_inline__))
5699 vec_vmulesb(vector signed char __a, vector signed char __b) {
5700 #ifdef __LITTLE_ENDIAN__
5701   return __builtin_altivec_vmulosb(__a, __b);
5702 #else
5703   return __builtin_altivec_vmulesb(__a, __b);
5704 #endif
5705 }
5706
5707 /* vec_vmuleub */
5708
5709 static __inline__ vector unsigned short __attribute__((__always_inline__))
5710 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5711 #ifdef __LITTLE_ENDIAN__
5712   return __builtin_altivec_vmuloub(__a, __b);
5713 #else
5714   return __builtin_altivec_vmuleub(__a, __b);
5715 #endif
5716 }
5717
5718 /* vec_vmulesh */
5719
5720 static __inline__ vector int __attribute__((__always_inline__))
5721 vec_vmulesh(vector short __a, vector short __b) {
5722 #ifdef __LITTLE_ENDIAN__
5723   return __builtin_altivec_vmulosh(__a, __b);
5724 #else
5725   return __builtin_altivec_vmulesh(__a, __b);
5726 #endif
5727 }
5728
5729 /* vec_vmuleuh */
5730
5731 static __inline__ vector unsigned int __attribute__((__always_inline__))
5732 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5733 #ifdef __LITTLE_ENDIAN__
5734   return __builtin_altivec_vmulouh(__a, __b);
5735 #else
5736   return __builtin_altivec_vmuleuh(__a, __b);
5737 #endif
5738 }
5739
5740 /* vec_mulo */
5741
5742 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5743                                                      vector signed char __b) {
5744 #ifdef __LITTLE_ENDIAN__
5745   return __builtin_altivec_vmulesb(__a, __b);
5746 #else
5747   return __builtin_altivec_vmulosb(__a, __b);
5748 #endif
5749 }
5750
5751 static __inline__ vector unsigned short __ATTRS_o_ai
5752 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5753 #ifdef __LITTLE_ENDIAN__
5754   return __builtin_altivec_vmuleub(__a, __b);
5755 #else
5756   return __builtin_altivec_vmuloub(__a, __b);
5757 #endif
5758 }
5759
5760 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5761                                                    vector short __b) {
5762 #ifdef __LITTLE_ENDIAN__
5763   return __builtin_altivec_vmulesh(__a, __b);
5764 #else
5765   return __builtin_altivec_vmulosh(__a, __b);
5766 #endif
5767 }
5768
5769 static __inline__ vector unsigned int __ATTRS_o_ai
5770 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5771 #ifdef __LITTLE_ENDIAN__
5772   return __builtin_altivec_vmuleuh(__a, __b);
5773 #else
5774   return __builtin_altivec_vmulouh(__a, __b);
5775 #endif
5776 }
5777
5778 #ifdef __POWER8_VECTOR__
5779 static __inline__ vector signed long long __ATTRS_o_ai
5780 vec_mulo(vector signed int __a, vector signed int __b) {
5781 #ifdef __LITTLE_ENDIAN__
5782   return __builtin_altivec_vmulesw(__a, __b);
5783 #else
5784   return __builtin_altivec_vmulosw(__a, __b);
5785 #endif
5786 }
5787
5788 static __inline__ vector unsigned long long __ATTRS_o_ai
5789 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5790 #ifdef __LITTLE_ENDIAN__
5791   return __builtin_altivec_vmuleuw(__a, __b);
5792 #else
5793   return __builtin_altivec_vmulouw(__a, __b);
5794 #endif
5795 }
5796 #endif
5797
5798 /* vec_vmulosb */
5799
5800 static __inline__ vector short __attribute__((__always_inline__))
5801 vec_vmulosb(vector signed char __a, vector signed char __b) {
5802 #ifdef __LITTLE_ENDIAN__
5803   return __builtin_altivec_vmulesb(__a, __b);
5804 #else
5805   return __builtin_altivec_vmulosb(__a, __b);
5806 #endif
5807 }
5808
5809 /* vec_vmuloub */
5810
5811 static __inline__ vector unsigned short __attribute__((__always_inline__))
5812 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5813 #ifdef __LITTLE_ENDIAN__
5814   return __builtin_altivec_vmuleub(__a, __b);
5815 #else
5816   return __builtin_altivec_vmuloub(__a, __b);
5817 #endif
5818 }
5819
5820 /* vec_vmulosh */
5821
5822 static __inline__ vector int __attribute__((__always_inline__))
5823 vec_vmulosh(vector short __a, vector short __b) {
5824 #ifdef __LITTLE_ENDIAN__
5825   return __builtin_altivec_vmulesh(__a, __b);
5826 #else
5827   return __builtin_altivec_vmulosh(__a, __b);
5828 #endif
5829 }
5830
5831 /* vec_vmulouh */
5832
5833 static __inline__ vector unsigned int __attribute__((__always_inline__))
5834 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5835 #ifdef __LITTLE_ENDIAN__
5836   return __builtin_altivec_vmuleuh(__a, __b);
5837 #else
5838   return __builtin_altivec_vmulouh(__a, __b);
5839 #endif
5840 }
5841
5842 /*  vec_nand */
5843
5844 #ifdef __POWER8_VECTOR__
5845 static __inline__ vector signed char __ATTRS_o_ai
5846 vec_nand(vector signed char __a, vector signed char __b) {
5847   return ~(__a & __b);
5848 }
5849
5850 static __inline__ vector signed char __ATTRS_o_ai
5851 vec_nand(vector signed char __a, vector bool char __b) {
5852   return ~(__a & __b);
5853 }
5854
5855 static __inline__ vector signed char __ATTRS_o_ai
5856 vec_nand(vector bool char __a, vector signed char __b) {
5857   return ~(__a & __b);
5858 }
5859
5860 static __inline__ vector unsigned char __ATTRS_o_ai
5861 vec_nand(vector unsigned char __a, vector unsigned char __b) {
5862   return ~(__a & __b);
5863 }
5864
5865 static __inline__ vector unsigned char __ATTRS_o_ai
5866 vec_nand(vector unsigned char __a, vector bool char __b) {
5867   return ~(__a & __b);
5868 }
5869
5870 static __inline__ vector unsigned char __ATTRS_o_ai
5871 vec_nand(vector bool char __a, vector unsigned char __b) {
5872   return ~(__a & __b);
5873 }
5874
5875 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5876                                                          vector bool char __b) {
5877   return ~(__a & __b);
5878 }
5879
5880 static __inline__ vector signed short __ATTRS_o_ai
5881 vec_nand(vector signed short __a, vector signed short __b) {
5882   return ~(__a & __b);
5883 }
5884
5885 static __inline__ vector signed short __ATTRS_o_ai
5886 vec_nand(vector signed short __a, vector bool short __b) {
5887   return ~(__a & __b);
5888 }
5889
5890 static __inline__ vector signed short __ATTRS_o_ai
5891 vec_nand(vector bool short __a, vector signed short __b) {
5892   return ~(__a & __b);
5893 }
5894
5895 static __inline__ vector unsigned short __ATTRS_o_ai
5896 vec_nand(vector unsigned short __a, vector unsigned short __b) {
5897   return ~(__a & __b);
5898 }
5899
5900 static __inline__ vector unsigned short __ATTRS_o_ai
5901 vec_nand(vector unsigned short __a, vector bool short __b) {
5902   return ~(__a & __b);
5903 }
5904
5905 static __inline__ vector bool short __ATTRS_o_ai
5906 vec_nand(vector bool short __a, vector bool short __b) {
5907   return ~(__a & __b);
5908 }
5909
5910 static __inline__ vector signed int __ATTRS_o_ai
5911 vec_nand(vector signed int __a, vector signed int __b) {
5912   return ~(__a & __b);
5913 }
5914
5915 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5916                                                           vector bool int __b) {
5917   return ~(__a & __b);
5918 }
5919
5920 static __inline__ vector signed int __ATTRS_o_ai
5921 vec_nand(vector bool int __a, vector signed int __b) {
5922   return ~(__a & __b);
5923 }
5924
5925 static __inline__ vector unsigned int __ATTRS_o_ai
5926 vec_nand(vector unsigned int __a, vector unsigned int __b) {
5927   return ~(__a & __b);
5928 }
5929
5930 static __inline__ vector unsigned int __ATTRS_o_ai
5931 vec_nand(vector unsigned int __a, vector bool int __b) {
5932   return ~(__a & __b);
5933 }
5934
5935 static __inline__ vector unsigned int __ATTRS_o_ai
5936 vec_nand(vector bool int __a, vector unsigned int __b) {
5937   return ~(__a & __b);
5938 }
5939
5940 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5941                                                         vector bool int __b) {
5942   return ~(__a & __b);
5943 }
5944
5945 static __inline__ vector float __ATTRS_o_ai
5946 vec_nand(vector float __a, vector float __b) {
5947   return (vector float)(~((vector unsigned int)__a &
5948                           (vector unsigned int)__b));
5949 }
5950
5951 static __inline__ vector signed long long __ATTRS_o_ai
5952 vec_nand(vector signed long long __a, vector signed long long __b) {
5953   return ~(__a & __b);
5954 }
5955
5956 static __inline__ vector signed long long __ATTRS_o_ai
5957 vec_nand(vector signed long long __a, vector bool long long __b) {
5958   return ~(__a & __b);
5959 }
5960
5961 static __inline__ vector signed long long __ATTRS_o_ai
5962 vec_nand(vector bool long long __a, vector signed long long __b) {
5963   return ~(__a & __b);
5964 }
5965
5966 static __inline__ vector unsigned long long __ATTRS_o_ai
5967 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5968   return ~(__a & __b);
5969 }
5970
5971 static __inline__ vector unsigned long long __ATTRS_o_ai
5972 vec_nand(vector unsigned long long __a, vector bool long long __b) {
5973   return ~(__a & __b);
5974 }
5975
5976 static __inline__ vector unsigned long long __ATTRS_o_ai
5977 vec_nand(vector bool long long __a, vector unsigned long long __b) {
5978   return ~(__a & __b);
5979 }
5980
5981 static __inline__ vector bool long long __ATTRS_o_ai
5982 vec_nand(vector bool long long __a, vector bool long long __b) {
5983   return ~(__a & __b);
5984 }
5985
5986 static __inline__ vector double __ATTRS_o_ai
5987 vec_nand(vector double __a, vector double __b) {
5988   return (vector double)(~((vector unsigned long long)__a &
5989                            (vector unsigned long long)__b));
5990 }
5991
5992 #endif
5993
5994 /* vec_nmadd */
5995
5996 #ifdef __VSX__
5997 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
5998                                                       vector float __b,
5999                                                       vector float __c) {
6000   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6001 }
6002
6003 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6004                                                        vector double __b,
6005                                                        vector double __c) {
6006   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6007 }
6008 #endif
6009
6010 /* vec_nmsub */
6011
6012 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6013                                                       vector float __b,
6014                                                       vector float __c) {
6015 #ifdef __VSX__
6016   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6017 #else
6018   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6019 #endif
6020 }
6021
6022 #ifdef __VSX__
6023 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6024                                                        vector double __b,
6025                                                        vector double __c) {
6026   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6027 }
6028 #endif
6029
6030 /* vec_vnmsubfp */
6031
6032 static __inline__ vector float __attribute__((__always_inline__))
6033 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6034   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6035 }
6036
6037 /* vec_nor */
6038
6039 #define __builtin_altivec_vnor vec_nor
6040
6041 static __inline__ vector signed char __ATTRS_o_ai
6042 vec_nor(vector signed char __a, vector signed char __b) {
6043   return ~(__a | __b);
6044 }
6045
6046 static __inline__ vector unsigned char __ATTRS_o_ai
6047 vec_nor(vector unsigned char __a, vector unsigned char __b) {
6048   return ~(__a | __b);
6049 }
6050
6051 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6052                                                         vector bool char __b) {
6053   return ~(__a | __b);
6054 }
6055
6056 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6057                                                     vector short __b) {
6058   return ~(__a | __b);
6059 }
6060
6061 static __inline__ vector unsigned short __ATTRS_o_ai
6062 vec_nor(vector unsigned short __a, vector unsigned short __b) {
6063   return ~(__a | __b);
6064 }
6065
6066 static __inline__ vector bool short __ATTRS_o_ai
6067 vec_nor(vector bool short __a, vector bool short __b) {
6068   return ~(__a | __b);
6069 }
6070
6071 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6072                                                   vector int __b) {
6073   return ~(__a | __b);
6074 }
6075
6076 static __inline__ vector unsigned int __ATTRS_o_ai
6077 vec_nor(vector unsigned int __a, vector unsigned int __b) {
6078   return ~(__a | __b);
6079 }
6080
6081 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6082                                                        vector bool int __b) {
6083   return ~(__a | __b);
6084 }
6085
6086 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6087                                                     vector float __b) {
6088   vector unsigned int __res =
6089       ~((vector unsigned int)__a | (vector unsigned int)__b);
6090   return (vector float)__res;
6091 }
6092
6093 #ifdef __VSX__
6094 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6095                                                      vector double __b) {
6096   vector unsigned long long __res =
6097       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6098   return (vector double)__res;
6099 }
6100 #endif
6101
6102 /* vec_vnor */
6103
6104 static __inline__ vector signed char __ATTRS_o_ai
6105 vec_vnor(vector signed char __a, vector signed char __b) {
6106   return ~(__a | __b);
6107 }
6108
6109 static __inline__ vector unsigned char __ATTRS_o_ai
6110 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6111   return ~(__a | __b);
6112 }
6113
6114 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6115                                                          vector bool char __b) {
6116   return ~(__a | __b);
6117 }
6118
6119 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6120                                                      vector short __b) {
6121   return ~(__a | __b);
6122 }
6123
6124 static __inline__ vector unsigned short __ATTRS_o_ai
6125 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6126   return ~(__a | __b);
6127 }
6128
6129 static __inline__ vector bool short __ATTRS_o_ai
6130 vec_vnor(vector bool short __a, vector bool short __b) {
6131   return ~(__a | __b);
6132 }
6133
6134 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6135                                                    vector int __b) {
6136   return ~(__a | __b);
6137 }
6138
6139 static __inline__ vector unsigned int __ATTRS_o_ai
6140 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6141   return ~(__a | __b);
6142 }
6143
6144 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6145                                                         vector bool int __b) {
6146   return ~(__a | __b);
6147 }
6148
6149 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6150                                                      vector float __b) {
6151   vector unsigned int __res =
6152       ~((vector unsigned int)__a | (vector unsigned int)__b);
6153   return (vector float)__res;
6154 }
6155
6156 #ifdef __VSX__
6157 static __inline__ vector signed long long __ATTRS_o_ai
6158 vec_nor(vector signed long long __a, vector signed long long __b) {
6159   return ~(__a | __b);
6160 }
6161
6162 static __inline__ vector unsigned long long __ATTRS_o_ai
6163 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6164   return ~(__a | __b);
6165 }
6166
6167 static __inline__ vector bool long long __ATTRS_o_ai
6168 vec_nor(vector bool long long __a, vector bool long long __b) {
6169   return ~(__a | __b);
6170 }
6171 #endif
6172
6173 /* vec_or */
6174
6175 #define __builtin_altivec_vor vec_or
6176
6177 static __inline__ vector signed char __ATTRS_o_ai
6178 vec_or(vector signed char __a, vector signed char __b) {
6179   return __a | __b;
6180 }
6181
6182 static __inline__ vector signed char __ATTRS_o_ai
6183 vec_or(vector bool char __a, vector signed char __b) {
6184   return (vector signed char)__a | __b;
6185 }
6186
6187 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6188                                                          vector bool char __b) {
6189   return __a | (vector signed char)__b;
6190 }
6191
6192 static __inline__ vector unsigned char __ATTRS_o_ai
6193 vec_or(vector unsigned char __a, vector unsigned char __b) {
6194   return __a | __b;
6195 }
6196
6197 static __inline__ vector unsigned char __ATTRS_o_ai
6198 vec_or(vector bool char __a, vector unsigned char __b) {
6199   return (vector unsigned char)__a | __b;
6200 }
6201
6202 static __inline__ vector unsigned char __ATTRS_o_ai
6203 vec_or(vector unsigned char __a, vector bool char __b) {
6204   return __a | (vector unsigned char)__b;
6205 }
6206
6207 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6208                                                        vector bool char __b) {
6209   return __a | __b;
6210 }
6211
6212 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6213                                                    vector short __b) {
6214   return __a | __b;
6215 }
6216
6217 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6218                                                    vector short __b) {
6219   return (vector short)__a | __b;
6220 }
6221
6222 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6223                                                    vector bool short __b) {
6224   return __a | (vector short)__b;
6225 }
6226
6227 static __inline__ vector unsigned short __ATTRS_o_ai
6228 vec_or(vector unsigned short __a, vector unsigned short __b) {
6229   return __a | __b;
6230 }
6231
6232 static __inline__ vector unsigned short __ATTRS_o_ai
6233 vec_or(vector bool short __a, vector unsigned short __b) {
6234   return (vector unsigned short)__a | __b;
6235 }
6236
6237 static __inline__ vector unsigned short __ATTRS_o_ai
6238 vec_or(vector unsigned short __a, vector bool short __b) {
6239   return __a | (vector unsigned short)__b;
6240 }
6241
6242 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6243                                                         vector bool short __b) {
6244   return __a | __b;
6245 }
6246
6247 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6248                                                  vector int __b) {
6249   return __a | __b;
6250 }
6251
6252 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6253                                                  vector int __b) {
6254   return (vector int)__a | __b;
6255 }
6256
6257 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6258                                                  vector bool int __b) {
6259   return __a | (vector int)__b;
6260 }
6261
6262 static __inline__ vector unsigned int __ATTRS_o_ai
6263 vec_or(vector unsigned int __a, vector unsigned int __b) {
6264   return __a | __b;
6265 }
6266
6267 static __inline__ vector unsigned int __ATTRS_o_ai
6268 vec_or(vector bool int __a, vector unsigned int __b) {
6269   return (vector unsigned int)__a | __b;
6270 }
6271
6272 static __inline__ vector unsigned int __ATTRS_o_ai
6273 vec_or(vector unsigned int __a, vector bool int __b) {
6274   return __a | (vector unsigned int)__b;
6275 }
6276
6277 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6278                                                       vector bool int __b) {
6279   return __a | __b;
6280 }
6281
6282 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6283                                                    vector float __b) {
6284   vector unsigned int __res =
6285       (vector unsigned int)__a | (vector unsigned int)__b;
6286   return (vector float)__res;
6287 }
6288
6289 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6290                                                    vector float __b) {
6291   vector unsigned int __res =
6292       (vector unsigned int)__a | (vector unsigned int)__b;
6293   return (vector float)__res;
6294 }
6295
6296 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6297                                                    vector bool int __b) {
6298   vector unsigned int __res =
6299       (vector unsigned int)__a | (vector unsigned int)__b;
6300   return (vector float)__res;
6301 }
6302
6303 #ifdef __VSX__
6304 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6305                                                     vector double __b) {
6306   return (vector double)((vector unsigned long long)__a |
6307                          (vector unsigned long long)__b);
6308 }
6309
6310 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6311                                                     vector bool long long __b) {
6312   return (vector double)((vector unsigned long long)__a |
6313                          (vector unsigned long long)__b);
6314 }
6315
6316 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6317                                                     vector double __b) {
6318   return (vector double)((vector unsigned long long)__a |
6319                          (vector unsigned long long)__b);
6320 }
6321
6322 static __inline__ vector signed long long __ATTRS_o_ai
6323 vec_or(vector signed long long __a, vector signed long long __b) {
6324   return __a | __b;
6325 }
6326
6327 static __inline__ vector signed long long __ATTRS_o_ai
6328 vec_or(vector bool long long __a, vector signed long long __b) {
6329   return (vector signed long long)__a | __b;
6330 }
6331
6332 static __inline__ vector signed long long __ATTRS_o_ai
6333 vec_or(vector signed long long __a, vector bool long long __b) {
6334   return __a | (vector signed long long)__b;
6335 }
6336
6337 static __inline__ vector unsigned long long __ATTRS_o_ai
6338 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6339   return __a | __b;
6340 }
6341
6342 static __inline__ vector unsigned long long __ATTRS_o_ai
6343 vec_or(vector bool long long __a, vector unsigned long long __b) {
6344   return (vector unsigned long long)__a | __b;
6345 }
6346
6347 static __inline__ vector unsigned long long __ATTRS_o_ai
6348 vec_or(vector unsigned long long __a, vector bool long long __b) {
6349   return __a | (vector unsigned long long)__b;
6350 }
6351
6352 static __inline__ vector bool long long __ATTRS_o_ai
6353 vec_or(vector bool long long __a, vector bool long long __b) {
6354   return __a | __b;
6355 }
6356 #endif
6357
6358 #ifdef __POWER8_VECTOR__
6359 static __inline__ vector signed char __ATTRS_o_ai
6360 vec_orc(vector signed char __a, vector signed char __b) {
6361   return __a | ~__b;
6362 }
6363
6364 static __inline__ vector signed char __ATTRS_o_ai
6365 vec_orc(vector signed char __a, vector bool char __b) {
6366   return __a | ~__b;
6367 }
6368
6369 static __inline__ vector signed char __ATTRS_o_ai
6370 vec_orc(vector bool char __a, vector signed char __b) {
6371   return __a | ~__b;
6372 }
6373
6374 static __inline__ vector unsigned char __ATTRS_o_ai
6375 vec_orc(vector unsigned char __a, vector unsigned char __b) {
6376   return __a | ~__b;
6377 }
6378
6379 static __inline__ vector unsigned char __ATTRS_o_ai
6380 vec_orc(vector unsigned char __a, vector bool char __b) {
6381   return __a | ~__b;
6382 }
6383
6384 static __inline__ vector unsigned char __ATTRS_o_ai
6385 vec_orc(vector bool char __a, vector unsigned char __b) {
6386   return __a | ~__b;
6387 }
6388
6389 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6390                                                         vector bool char __b) {
6391   return __a | ~__b;
6392 }
6393
6394 static __inline__ vector signed short __ATTRS_o_ai
6395 vec_orc(vector signed short __a, vector signed short __b) {
6396   return __a | ~__b;
6397 }
6398
6399 static __inline__ vector signed short __ATTRS_o_ai
6400 vec_orc(vector signed short __a, vector bool short __b) {
6401   return __a | ~__b;
6402 }
6403
6404 static __inline__ vector signed short __ATTRS_o_ai
6405 vec_orc(vector bool short __a, vector signed short __b) {
6406   return __a | ~__b;
6407 }
6408
6409 static __inline__ vector unsigned short __ATTRS_o_ai
6410 vec_orc(vector unsigned short __a, vector unsigned short __b) {
6411   return __a | ~__b;
6412 }
6413
6414 static __inline__ vector unsigned short __ATTRS_o_ai
6415 vec_orc(vector unsigned short __a, vector bool short __b) {
6416   return __a | ~__b;
6417 }
6418
6419 static __inline__ vector unsigned short __ATTRS_o_ai
6420 vec_orc(vector bool short __a, vector unsigned short __b) {
6421   return __a | ~__b;
6422 }
6423
6424 static __inline__ vector bool short __ATTRS_o_ai
6425 vec_orc(vector bool short __a, vector bool short __b) {
6426   return __a | ~__b;
6427 }
6428
6429 static __inline__ vector signed int __ATTRS_o_ai
6430 vec_orc(vector signed int __a, vector signed int __b) {
6431   return __a | ~__b;
6432 }
6433
6434 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6435                                                          vector bool int __b) {
6436   return __a | ~__b;
6437 }
6438
6439 static __inline__ vector signed int __ATTRS_o_ai
6440 vec_orc(vector bool int __a, vector signed int __b) {
6441   return __a | ~__b;
6442 }
6443
6444 static __inline__ vector unsigned int __ATTRS_o_ai
6445 vec_orc(vector unsigned int __a, vector unsigned int __b) {
6446   return __a | ~__b;
6447 }
6448
6449 static __inline__ vector unsigned int __ATTRS_o_ai
6450 vec_orc(vector unsigned int __a, vector bool int __b) {
6451   return __a | ~__b;
6452 }
6453
6454 static __inline__ vector unsigned int __ATTRS_o_ai
6455 vec_orc(vector bool int __a, vector unsigned int __b) {
6456   return __a | ~__b;
6457 }
6458
6459 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6460                                                        vector bool int __b) {
6461   return __a | ~__b;
6462 }
6463
6464 static __inline__ vector float __ATTRS_o_ai
6465 vec_orc(vector bool int __a, vector float __b) {
6466  return (vector float)(__a | ~(vector unsigned int)__b);
6467 }
6468
6469 static __inline__ vector float __ATTRS_o_ai
6470 vec_orc(vector float __a, vector bool int __b) {
6471   return (vector float)((vector unsigned int)__a | ~__b);
6472 }
6473
6474 static __inline__ vector signed long long __ATTRS_o_ai
6475 vec_orc(vector signed long long __a, vector signed long long __b) {
6476   return __a | ~__b;
6477 }
6478
6479 static __inline__ vector signed long long __ATTRS_o_ai
6480 vec_orc(vector signed long long __a, vector bool long long __b) {
6481   return __a | ~__b;
6482 }
6483
6484 static __inline__ vector signed long long __ATTRS_o_ai
6485 vec_orc(vector bool long long __a, vector signed long long __b) {
6486   return __a | ~__b;
6487 }
6488
6489 static __inline__ vector unsigned long long __ATTRS_o_ai
6490 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6491   return __a | ~__b;
6492 }
6493
6494 static __inline__ vector unsigned long long __ATTRS_o_ai
6495 vec_orc(vector unsigned long long __a, vector bool long long __b) {
6496   return __a | ~__b;
6497 }
6498
6499 static __inline__ vector unsigned long long __ATTRS_o_ai
6500 vec_orc(vector bool long long __a, vector unsigned long long __b) {
6501   return __a | ~__b;
6502 }
6503
6504 static __inline__ vector bool long long __ATTRS_o_ai
6505 vec_orc(vector bool long long __a, vector bool long long __b) {
6506   return __a | ~__b;
6507 }
6508
6509 static __inline__ vector double __ATTRS_o_ai
6510 vec_orc(vector double __a, vector bool long long __b) {
6511   return (vector double)((vector unsigned long long)__a | ~__b);
6512 }
6513
6514 static __inline__ vector double __ATTRS_o_ai
6515 vec_orc(vector bool long long __a, vector double __b) {
6516   return (vector double)(__a | ~(vector unsigned long long)__b);
6517 }
6518 #endif
6519
6520 /* vec_vor */
6521
6522 static __inline__ vector signed char __ATTRS_o_ai
6523 vec_vor(vector signed char __a, vector signed char __b) {
6524   return __a | __b;
6525 }
6526
6527 static __inline__ vector signed char __ATTRS_o_ai
6528 vec_vor(vector bool char __a, vector signed char __b) {
6529   return (vector signed char)__a | __b;
6530 }
6531
6532 static __inline__ vector signed char __ATTRS_o_ai
6533 vec_vor(vector signed char __a, vector bool char __b) {
6534   return __a | (vector signed char)__b;
6535 }
6536
6537 static __inline__ vector unsigned char __ATTRS_o_ai
6538 vec_vor(vector unsigned char __a, vector unsigned char __b) {
6539   return __a | __b;
6540 }
6541
6542 static __inline__ vector unsigned char __ATTRS_o_ai
6543 vec_vor(vector bool char __a, vector unsigned char __b) {
6544   return (vector unsigned char)__a | __b;
6545 }
6546
6547 static __inline__ vector unsigned char __ATTRS_o_ai
6548 vec_vor(vector unsigned char __a, vector bool char __b) {
6549   return __a | (vector unsigned char)__b;
6550 }
6551
6552 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6553                                                         vector bool char __b) {
6554   return __a | __b;
6555 }
6556
6557 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6558                                                     vector short __b) {
6559   return __a | __b;
6560 }
6561
6562 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6563                                                     vector short __b) {
6564   return (vector short)__a | __b;
6565 }
6566
6567 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6568                                                     vector bool short __b) {
6569   return __a | (vector short)__b;
6570 }
6571
6572 static __inline__ vector unsigned short __ATTRS_o_ai
6573 vec_vor(vector unsigned short __a, vector unsigned short __b) {
6574   return __a | __b;
6575 }
6576
6577 static __inline__ vector unsigned short __ATTRS_o_ai
6578 vec_vor(vector bool short __a, vector unsigned short __b) {
6579   return (vector unsigned short)__a | __b;
6580 }
6581
6582 static __inline__ vector unsigned short __ATTRS_o_ai
6583 vec_vor(vector unsigned short __a, vector bool short __b) {
6584   return __a | (vector unsigned short)__b;
6585 }
6586
6587 static __inline__ vector bool short __ATTRS_o_ai
6588 vec_vor(vector bool short __a, vector bool short __b) {
6589   return __a | __b;
6590 }
6591
6592 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6593                                                   vector int __b) {
6594   return __a | __b;
6595 }
6596
6597 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6598                                                   vector int __b) {
6599   return (vector int)__a | __b;
6600 }
6601
6602 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6603                                                   vector bool int __b) {
6604   return __a | (vector int)__b;
6605 }
6606
6607 static __inline__ vector unsigned int __ATTRS_o_ai
6608 vec_vor(vector unsigned int __a, vector unsigned int __b) {
6609   return __a | __b;
6610 }
6611
6612 static __inline__ vector unsigned int __ATTRS_o_ai
6613 vec_vor(vector bool int __a, vector unsigned int __b) {
6614   return (vector unsigned int)__a | __b;
6615 }
6616
6617 static __inline__ vector unsigned int __ATTRS_o_ai
6618 vec_vor(vector unsigned int __a, vector bool int __b) {
6619   return __a | (vector unsigned int)__b;
6620 }
6621
6622 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6623                                                        vector bool int __b) {
6624   return __a | __b;
6625 }
6626
6627 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6628                                                     vector float __b) {
6629   vector unsigned int __res =
6630       (vector unsigned int)__a | (vector unsigned int)__b;
6631   return (vector float)__res;
6632 }
6633
6634 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6635                                                     vector float __b) {
6636   vector unsigned int __res =
6637       (vector unsigned int)__a | (vector unsigned int)__b;
6638   return (vector float)__res;
6639 }
6640
6641 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6642                                                     vector bool int __b) {
6643   vector unsigned int __res =
6644       (vector unsigned int)__a | (vector unsigned int)__b;
6645   return (vector float)__res;
6646 }
6647
6648 #ifdef __VSX__
6649 static __inline__ vector signed long long __ATTRS_o_ai
6650 vec_vor(vector signed long long __a, vector signed long long __b) {
6651   return __a | __b;
6652 }
6653
6654 static __inline__ vector signed long long __ATTRS_o_ai
6655 vec_vor(vector bool long long __a, vector signed long long __b) {
6656   return (vector signed long long)__a | __b;
6657 }
6658
6659 static __inline__ vector signed long long __ATTRS_o_ai
6660 vec_vor(vector signed long long __a, vector bool long long __b) {
6661   return __a | (vector signed long long)__b;
6662 }
6663
6664 static __inline__ vector unsigned long long __ATTRS_o_ai
6665 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6666   return __a | __b;
6667 }
6668
6669 static __inline__ vector unsigned long long __ATTRS_o_ai
6670 vec_vor(vector bool long long __a, vector unsigned long long __b) {
6671   return (vector unsigned long long)__a | __b;
6672 }
6673
6674 static __inline__ vector unsigned long long __ATTRS_o_ai
6675 vec_vor(vector unsigned long long __a, vector bool long long __b) {
6676   return __a | (vector unsigned long long)__b;
6677 }
6678
6679 static __inline__ vector bool long long __ATTRS_o_ai
6680 vec_vor(vector bool long long __a, vector bool long long __b) {
6681   return __a | __b;
6682 }
6683 #endif
6684
6685 /* vec_pack */
6686
6687 /* The various vector pack instructions have a big-endian bias, so for
6688    little endian we must handle reversed element numbering.  */
6689
6690 static __inline__ vector signed char __ATTRS_o_ai
6691 vec_pack(vector signed short __a, vector signed short __b) {
6692 #ifdef __LITTLE_ENDIAN__
6693   return (vector signed char)vec_perm(
6694       __a, __b,
6695       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6696                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6697 #else
6698   return (vector signed char)vec_perm(
6699       __a, __b,
6700       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6701                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6702 #endif
6703 }
6704
6705 static __inline__ vector unsigned char __ATTRS_o_ai
6706 vec_pack(vector unsigned short __a, vector unsigned short __b) {
6707 #ifdef __LITTLE_ENDIAN__
6708   return (vector unsigned char)vec_perm(
6709       __a, __b,
6710       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6711                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6712 #else
6713   return (vector unsigned char)vec_perm(
6714       __a, __b,
6715       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6716                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6717 #endif
6718 }
6719
6720 static __inline__ vector bool char __ATTRS_o_ai
6721 vec_pack(vector bool short __a, vector bool short __b) {
6722 #ifdef __LITTLE_ENDIAN__
6723   return (vector bool char)vec_perm(
6724       __a, __b,
6725       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6726                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6727 #else
6728   return (vector bool char)vec_perm(
6729       __a, __b,
6730       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6731                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6732 #endif
6733 }
6734
6735 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6736                                                      vector int __b) {
6737 #ifdef __LITTLE_ENDIAN__
6738   return (vector short)vec_perm(
6739       __a, __b,
6740       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6741                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6742 #else
6743   return (vector short)vec_perm(
6744       __a, __b,
6745       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6746                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6747 #endif
6748 }
6749
6750 static __inline__ vector unsigned short __ATTRS_o_ai
6751 vec_pack(vector unsigned int __a, vector unsigned int __b) {
6752 #ifdef __LITTLE_ENDIAN__
6753   return (vector unsigned short)vec_perm(
6754       __a, __b,
6755       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6756                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6757 #else
6758   return (vector unsigned short)vec_perm(
6759       __a, __b,
6760       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6761                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6762 #endif
6763 }
6764
6765 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6766                                                           vector bool int __b) {
6767 #ifdef __LITTLE_ENDIAN__
6768   return (vector bool short)vec_perm(
6769       __a, __b,
6770       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6771                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6772 #else
6773   return (vector bool short)vec_perm(
6774       __a, __b,
6775       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6776                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6777 #endif
6778 }
6779
6780 #ifdef __VSX__
6781 static __inline__ vector signed int __ATTRS_o_ai
6782 vec_pack(vector signed long long __a, vector signed long long __b) {
6783 #ifdef __LITTLE_ENDIAN__
6784   return (vector signed int)vec_perm(
6785       __a, __b,
6786       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6787                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6788 #else
6789   return (vector signed int)vec_perm(
6790       __a, __b,
6791       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6792                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6793 #endif
6794 }
6795 static __inline__ vector unsigned int __ATTRS_o_ai
6796 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6797 #ifdef __LITTLE_ENDIAN__
6798   return (vector unsigned int)vec_perm(
6799       __a, __b,
6800       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6801                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6802 #else
6803   return (vector unsigned int)vec_perm(
6804       __a, __b,
6805       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6806                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6807 #endif
6808 }
6809
6810 static __inline__ vector bool int __ATTRS_o_ai
6811 vec_pack(vector bool long long __a, vector bool long long __b) {
6812 #ifdef __LITTLE_ENDIAN__
6813   return (vector bool int)vec_perm(
6814       __a, __b,
6815       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6816                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6817 #else
6818   return (vector bool int)vec_perm(
6819       __a, __b,
6820       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6821                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6822 #endif
6823 }
6824
6825 static __inline__ vector float __ATTRS_o_ai
6826 vec_pack(vector double __a, vector double __b) {
6827   return (vector float) (__a[0], __a[1], __b[0], __b[1]);
6828 }
6829 #endif
6830
6831 #ifdef __POWER9_VECTOR__
6832 static __inline__ vector unsigned short __ATTRS_o_ai
6833 vec_pack_to_short_fp32(vector float __a, vector float __b) {
6834   vector float __resa = __builtin_vsx_xvcvsphp(__a);
6835   vector float __resb = __builtin_vsx_xvcvsphp(__b);
6836 #ifdef __LITTLE_ENDIAN__
6837   return (vector unsigned short)vec_mergee(__resa, __resb);
6838 #else
6839   return (vector unsigned short)vec_mergeo(__resa, __resb);
6840 #endif
6841 }
6842
6843 #endif
6844 /* vec_vpkuhum */
6845
6846 #define __builtin_altivec_vpkuhum vec_vpkuhum
6847
6848 static __inline__ vector signed char __ATTRS_o_ai
6849 vec_vpkuhum(vector signed short __a, vector signed short __b) {
6850 #ifdef __LITTLE_ENDIAN__
6851   return (vector signed char)vec_perm(
6852       __a, __b,
6853       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6854                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6855 #else
6856   return (vector signed char)vec_perm(
6857       __a, __b,
6858       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6859                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6860 #endif
6861 }
6862
6863 static __inline__ vector unsigned char __ATTRS_o_ai
6864 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6865 #ifdef __LITTLE_ENDIAN__
6866   return (vector unsigned char)vec_perm(
6867       __a, __b,
6868       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6869                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6870 #else
6871   return (vector unsigned char)vec_perm(
6872       __a, __b,
6873       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6874                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6875 #endif
6876 }
6877
6878 static __inline__ vector bool char __ATTRS_o_ai
6879 vec_vpkuhum(vector bool short __a, vector bool short __b) {
6880 #ifdef __LITTLE_ENDIAN__
6881   return (vector bool char)vec_perm(
6882       __a, __b,
6883       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6884                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6885 #else
6886   return (vector bool char)vec_perm(
6887       __a, __b,
6888       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6889                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6890 #endif
6891 }
6892
6893 /* vec_vpkuwum */
6894
6895 #define __builtin_altivec_vpkuwum vec_vpkuwum
6896
6897 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6898                                                         vector int __b) {
6899 #ifdef __LITTLE_ENDIAN__
6900   return (vector short)vec_perm(
6901       __a, __b,
6902       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6903                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6904 #else
6905   return (vector short)vec_perm(
6906       __a, __b,
6907       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6908                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6909 #endif
6910 }
6911
6912 static __inline__ vector unsigned short __ATTRS_o_ai
6913 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6914 #ifdef __LITTLE_ENDIAN__
6915   return (vector unsigned short)vec_perm(
6916       __a, __b,
6917       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6918                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6919 #else
6920   return (vector unsigned short)vec_perm(
6921       __a, __b,
6922       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6923                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6924 #endif
6925 }
6926
6927 static __inline__ vector bool short __ATTRS_o_ai
6928 vec_vpkuwum(vector bool int __a, vector bool int __b) {
6929 #ifdef __LITTLE_ENDIAN__
6930   return (vector bool short)vec_perm(
6931       __a, __b,
6932       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6933                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6934 #else
6935   return (vector bool short)vec_perm(
6936       __a, __b,
6937       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6938                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6939 #endif
6940 }
6941
6942 /* vec_vpkudum */
6943
6944 #ifdef __POWER8_VECTOR__
6945 #define __builtin_altivec_vpkudum vec_vpkudum
6946
6947 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6948                                                       vector long long __b) {
6949 #ifdef __LITTLE_ENDIAN__
6950   return (vector int)vec_perm(
6951       __a, __b,
6952       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6953                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6954 #else
6955   return (vector int)vec_perm(
6956       __a, __b,
6957       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6958                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6959 #endif
6960 }
6961
6962 static __inline__ vector unsigned int __ATTRS_o_ai
6963 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6964 #ifdef __LITTLE_ENDIAN__
6965   return (vector unsigned int)vec_perm(
6966       __a, __b,
6967       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6968                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6969 #else
6970   return (vector unsigned int)vec_perm(
6971       __a, __b,
6972       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6973                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6974 #endif
6975 }
6976
6977 static __inline__ vector bool int __ATTRS_o_ai
6978 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6979 #ifdef __LITTLE_ENDIAN__
6980   return (vector bool int)vec_perm(
6981       (vector long long)__a, (vector long long)__b,
6982       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6983                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6984 #else
6985   return (vector bool int)vec_perm(
6986       (vector long long)__a, (vector long long)__b,
6987       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6988                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6989 #endif
6990 }
6991 #endif
6992
6993 /* vec_packpx */
6994
6995 static __inline__ vector pixel __attribute__((__always_inline__))
6996 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
6997 #ifdef __LITTLE_ENDIAN__
6998   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
6999 #else
7000   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7001 #endif
7002 }
7003
7004 /* vec_vpkpx */
7005
7006 static __inline__ vector pixel __attribute__((__always_inline__))
7007 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7008 #ifdef __LITTLE_ENDIAN__
7009   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7010 #else
7011   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7012 #endif
7013 }
7014
7015 /* vec_packs */
7016
7017 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7018                                                             vector short __b) {
7019 #ifdef __LITTLE_ENDIAN__
7020   return __builtin_altivec_vpkshss(__b, __a);
7021 #else
7022   return __builtin_altivec_vpkshss(__a, __b);
7023 #endif
7024 }
7025
7026 static __inline__ vector unsigned char __ATTRS_o_ai
7027 vec_packs(vector unsigned short __a, vector unsigned short __b) {
7028 #ifdef __LITTLE_ENDIAN__
7029   return __builtin_altivec_vpkuhus(__b, __a);
7030 #else
7031   return __builtin_altivec_vpkuhus(__a, __b);
7032 #endif
7033 }
7034
7035 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7036                                                              vector int __b) {
7037 #ifdef __LITTLE_ENDIAN__
7038   return __builtin_altivec_vpkswss(__b, __a);
7039 #else
7040   return __builtin_altivec_vpkswss(__a, __b);
7041 #endif
7042 }
7043
7044 static __inline__ vector unsigned short __ATTRS_o_ai
7045 vec_packs(vector unsigned int __a, vector unsigned int __b) {
7046 #ifdef __LITTLE_ENDIAN__
7047   return __builtin_altivec_vpkuwus(__b, __a);
7048 #else
7049   return __builtin_altivec_vpkuwus(__a, __b);
7050 #endif
7051 }
7052
7053 #ifdef __POWER8_VECTOR__
7054 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7055                                                     vector long long __b) {
7056 #ifdef __LITTLE_ENDIAN__
7057   return __builtin_altivec_vpksdss(__b, __a);
7058 #else
7059   return __builtin_altivec_vpksdss(__a, __b);
7060 #endif
7061 }
7062
7063 static __inline__ vector unsigned int __ATTRS_o_ai
7064 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7065 #ifdef __LITTLE_ENDIAN__
7066   return __builtin_altivec_vpkudus(__b, __a);
7067 #else
7068   return __builtin_altivec_vpkudus(__a, __b);
7069 #endif
7070 }
7071 #endif
7072
7073 /* vec_vpkshss */
7074
7075 static __inline__ vector signed char __attribute__((__always_inline__))
7076 vec_vpkshss(vector short __a, vector short __b) {
7077 #ifdef __LITTLE_ENDIAN__
7078   return __builtin_altivec_vpkshss(__b, __a);
7079 #else
7080   return __builtin_altivec_vpkshss(__a, __b);
7081 #endif
7082 }
7083
7084 /* vec_vpksdss */
7085
7086 #ifdef __POWER8_VECTOR__
7087 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7088                                                       vector long long __b) {
7089 #ifdef __LITTLE_ENDIAN__
7090   return __builtin_altivec_vpksdss(__b, __a);
7091 #else
7092   return __builtin_altivec_vpksdss(__a, __b);
7093 #endif
7094 }
7095 #endif
7096
7097 /* vec_vpkuhus */
7098
7099 static __inline__ vector unsigned char __attribute__((__always_inline__))
7100 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7101 #ifdef __LITTLE_ENDIAN__
7102   return __builtin_altivec_vpkuhus(__b, __a);
7103 #else
7104   return __builtin_altivec_vpkuhus(__a, __b);
7105 #endif
7106 }
7107
7108 /* vec_vpkudus */
7109
7110 #ifdef __POWER8_VECTOR__
7111 static __inline__ vector unsigned int __attribute__((__always_inline__))
7112 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7113 #ifdef __LITTLE_ENDIAN__
7114   return __builtin_altivec_vpkudus(__b, __a);
7115 #else
7116   return __builtin_altivec_vpkudus(__a, __b);
7117 #endif
7118 }
7119 #endif
7120
7121 /* vec_vpkswss */
7122
7123 static __inline__ vector signed short __attribute__((__always_inline__))
7124 vec_vpkswss(vector int __a, vector int __b) {
7125 #ifdef __LITTLE_ENDIAN__
7126   return __builtin_altivec_vpkswss(__b, __a);
7127 #else
7128   return __builtin_altivec_vpkswss(__a, __b);
7129 #endif
7130 }
7131
7132 /* vec_vpkuwus */
7133
7134 static __inline__ vector unsigned short __attribute__((__always_inline__))
7135 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7136 #ifdef __LITTLE_ENDIAN__
7137   return __builtin_altivec_vpkuwus(__b, __a);
7138 #else
7139   return __builtin_altivec_vpkuwus(__a, __b);
7140 #endif
7141 }
7142
7143 /* vec_packsu */
7144
7145 static __inline__ vector unsigned char __ATTRS_o_ai
7146 vec_packsu(vector short __a, vector short __b) {
7147 #ifdef __LITTLE_ENDIAN__
7148   return __builtin_altivec_vpkshus(__b, __a);
7149 #else
7150   return __builtin_altivec_vpkshus(__a, __b);
7151 #endif
7152 }
7153
7154 static __inline__ vector unsigned char __ATTRS_o_ai
7155 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7156 #ifdef __LITTLE_ENDIAN__
7157   return __builtin_altivec_vpkuhus(__b, __a);
7158 #else
7159   return __builtin_altivec_vpkuhus(__a, __b);
7160 #endif
7161 }
7162
7163 static __inline__ vector unsigned short __ATTRS_o_ai
7164 vec_packsu(vector int __a, vector int __b) {
7165 #ifdef __LITTLE_ENDIAN__
7166   return __builtin_altivec_vpkswus(__b, __a);
7167 #else
7168   return __builtin_altivec_vpkswus(__a, __b);
7169 #endif
7170 }
7171
7172 static __inline__ vector unsigned short __ATTRS_o_ai
7173 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7174 #ifdef __LITTLE_ENDIAN__
7175   return __builtin_altivec_vpkuwus(__b, __a);
7176 #else
7177   return __builtin_altivec_vpkuwus(__a, __b);
7178 #endif
7179 }
7180
7181 #ifdef __POWER8_VECTOR__
7182 static __inline__ vector unsigned int __ATTRS_o_ai
7183 vec_packsu(vector long long __a, vector long long __b) {
7184 #ifdef __LITTLE_ENDIAN__
7185   return __builtin_altivec_vpksdus(__b, __a);
7186 #else
7187   return __builtin_altivec_vpksdus(__a, __b);
7188 #endif
7189 }
7190
7191 static __inline__ vector unsigned int __ATTRS_o_ai
7192 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7193 #ifdef __LITTLE_ENDIAN__
7194   return __builtin_altivec_vpkudus(__b, __a);
7195 #else
7196   return __builtin_altivec_vpkudus(__a, __b);
7197 #endif
7198 }
7199 #endif
7200
7201 /* vec_vpkshus */
7202
7203 static __inline__ vector unsigned char __ATTRS_o_ai
7204 vec_vpkshus(vector short __a, vector short __b) {
7205 #ifdef __LITTLE_ENDIAN__
7206   return __builtin_altivec_vpkshus(__b, __a);
7207 #else
7208   return __builtin_altivec_vpkshus(__a, __b);
7209 #endif
7210 }
7211
7212 static __inline__ vector unsigned char __ATTRS_o_ai
7213 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7214 #ifdef __LITTLE_ENDIAN__
7215   return __builtin_altivec_vpkuhus(__b, __a);
7216 #else
7217   return __builtin_altivec_vpkuhus(__a, __b);
7218 #endif
7219 }
7220
7221 /* vec_vpkswus */
7222
7223 static __inline__ vector unsigned short __ATTRS_o_ai
7224 vec_vpkswus(vector int __a, vector int __b) {
7225 #ifdef __LITTLE_ENDIAN__
7226   return __builtin_altivec_vpkswus(__b, __a);
7227 #else
7228   return __builtin_altivec_vpkswus(__a, __b);
7229 #endif
7230 }
7231
7232 static __inline__ vector unsigned short __ATTRS_o_ai
7233 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7234 #ifdef __LITTLE_ENDIAN__
7235   return __builtin_altivec_vpkuwus(__b, __a);
7236 #else
7237   return __builtin_altivec_vpkuwus(__a, __b);
7238 #endif
7239 }
7240
7241 /* vec_vpksdus */
7242
7243 #ifdef __POWER8_VECTOR__
7244 static __inline__ vector unsigned int __ATTRS_o_ai
7245 vec_vpksdus(vector long long __a, vector long long __b) {
7246 #ifdef __LITTLE_ENDIAN__
7247   return __builtin_altivec_vpksdus(__b, __a);
7248 #else
7249   return __builtin_altivec_vpksdus(__a, __b);
7250 #endif
7251 }
7252 #endif
7253
7254 /* vec_perm */
7255
7256 // The vperm instruction is defined architecturally with a big-endian bias.
7257 // For little endian, we swap the input operands and invert the permute
7258 // control vector.  Only the rightmost 5 bits matter, so we could use
7259 // a vector of all 31s instead of all 255s to perform the inversion.
7260 // However, when the PCV is not a constant, using 255 has an advantage
7261 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
7262 // later, possibly a vec_nand).
7263
7264 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7265     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7266 #ifdef __LITTLE_ENDIAN__
7267   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7268                               255, 255, 255, 255, 255, 255, 255, 255};
7269   __d = vec_xor(__c, __d);
7270   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7271                                                          (vector int)__a, __d);
7272 #else
7273   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7274                                                          (vector int)__b, __c);
7275 #endif
7276 }
7277
7278 static __inline__ vector unsigned char __ATTRS_o_ai
7279 vec_perm(vector unsigned char __a, vector unsigned char __b,
7280          vector unsigned char __c) {
7281 #ifdef __LITTLE_ENDIAN__
7282   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7283                               255, 255, 255, 255, 255, 255, 255, 255};
7284   __d = vec_xor(__c, __d);
7285   return (vector unsigned char)__builtin_altivec_vperm_4si(
7286       (vector int)__b, (vector int)__a, __d);
7287 #else
7288   return (vector unsigned char)__builtin_altivec_vperm_4si(
7289       (vector int)__a, (vector int)__b, __c);
7290 #endif
7291 }
7292
7293 static __inline__ vector bool char __ATTRS_o_ai
7294 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7295 #ifdef __LITTLE_ENDIAN__
7296   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7297                               255, 255, 255, 255, 255, 255, 255, 255};
7298   __d = vec_xor(__c, __d);
7299   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7300                                                        (vector int)__a, __d);
7301 #else
7302   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7303                                                        (vector int)__b, __c);
7304 #endif
7305 }
7306
7307 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7308                                                      vector signed short __b,
7309                                                      vector unsigned char __c) {
7310 #ifdef __LITTLE_ENDIAN__
7311   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7312                               255, 255, 255, 255, 255, 255, 255, 255};
7313   __d = vec_xor(__c, __d);
7314   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7315                                                           (vector int)__a, __d);
7316 #else
7317   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7318                                                           (vector int)__b, __c);
7319 #endif
7320 }
7321
7322 static __inline__ vector unsigned short __ATTRS_o_ai
7323 vec_perm(vector unsigned short __a, vector unsigned short __b,
7324          vector unsigned char __c) {
7325 #ifdef __LITTLE_ENDIAN__
7326   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7327                               255, 255, 255, 255, 255, 255, 255, 255};
7328   __d = vec_xor(__c, __d);
7329   return (vector unsigned short)__builtin_altivec_vperm_4si(
7330       (vector int)__b, (vector int)__a, __d);
7331 #else
7332   return (vector unsigned short)__builtin_altivec_vperm_4si(
7333       (vector int)__a, (vector int)__b, __c);
7334 #endif
7335 }
7336
7337 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7338     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7339 #ifdef __LITTLE_ENDIAN__
7340   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7341                               255, 255, 255, 255, 255, 255, 255, 255};
7342   __d = vec_xor(__c, __d);
7343   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7344                                                         (vector int)__a, __d);
7345 #else
7346   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7347                                                         (vector int)__b, __c);
7348 #endif
7349 }
7350
7351 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7352                                                      vector pixel __b,
7353                                                      vector unsigned char __c) {
7354 #ifdef __LITTLE_ENDIAN__
7355   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7356                               255, 255, 255, 255, 255, 255, 255, 255};
7357   __d = vec_xor(__c, __d);
7358   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7359                                                    (vector int)__a, __d);
7360 #else
7361   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7362                                                    (vector int)__b, __c);
7363 #endif
7364 }
7365
7366 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7367                                                    vector signed int __b,
7368                                                    vector unsigned char __c) {
7369 #ifdef __LITTLE_ENDIAN__
7370   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7371                               255, 255, 255, 255, 255, 255, 255, 255};
7372   __d = vec_xor(__c, __d);
7373   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7374 #else
7375   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7376 #endif
7377 }
7378
7379 static __inline__ vector unsigned int __ATTRS_o_ai
7380 vec_perm(vector unsigned int __a, vector unsigned int __b,
7381          vector unsigned char __c) {
7382 #ifdef __LITTLE_ENDIAN__
7383   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7384                               255, 255, 255, 255, 255, 255, 255, 255};
7385   __d = vec_xor(__c, __d);
7386   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7387                                                           (vector int)__a, __d);
7388 #else
7389   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7390                                                           (vector int)__b, __c);
7391 #endif
7392 }
7393
7394 static __inline__ vector bool int __ATTRS_o_ai
7395 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7396 #ifdef __LITTLE_ENDIAN__
7397   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7398                               255, 255, 255, 255, 255, 255, 255, 255};
7399   __d = vec_xor(__c, __d);
7400   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7401                                                       (vector int)__a, __d);
7402 #else
7403   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7404                                                       (vector int)__b, __c);
7405 #endif
7406 }
7407
7408 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7409                                                      vector float __b,
7410                                                      vector unsigned char __c) {
7411 #ifdef __LITTLE_ENDIAN__
7412   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7413                               255, 255, 255, 255, 255, 255, 255, 255};
7414   __d = vec_xor(__c, __d);
7415   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7416                                                    (vector int)__a, __d);
7417 #else
7418   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7419                                                    (vector int)__b, __c);
7420 #endif
7421 }
7422
7423 #ifdef __VSX__
7424 static __inline__ vector long long __ATTRS_o_ai
7425 vec_perm(vector signed long long __a, vector signed long long __b,
7426          vector unsigned char __c) {
7427 #ifdef __LITTLE_ENDIAN__
7428   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7429                               255, 255, 255, 255, 255, 255, 255, 255};
7430   __d = vec_xor(__c, __d);
7431   return (vector signed long long)__builtin_altivec_vperm_4si(
7432       (vector int)__b, (vector int)__a, __d);
7433 #else
7434   return (vector signed long long)__builtin_altivec_vperm_4si(
7435       (vector int)__a, (vector int)__b, __c);
7436 #endif
7437 }
7438
7439 static __inline__ vector unsigned long long __ATTRS_o_ai
7440 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7441          vector unsigned char __c) {
7442 #ifdef __LITTLE_ENDIAN__
7443   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7444                               255, 255, 255, 255, 255, 255, 255, 255};
7445   __d = vec_xor(__c, __d);
7446   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7447       (vector int)__b, (vector int)__a, __d);
7448 #else
7449   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7450       (vector int)__a, (vector int)__b, __c);
7451 #endif
7452 }
7453
7454 static __inline__ vector bool long long __ATTRS_o_ai
7455 vec_perm(vector bool long long __a, vector bool long long __b,
7456          vector unsigned char __c) {
7457 #ifdef __LITTLE_ENDIAN__
7458   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7459                               255, 255, 255, 255, 255, 255, 255, 255};
7460   __d = vec_xor(__c, __d);
7461   return (vector bool long long)__builtin_altivec_vperm_4si(
7462       (vector int)__b, (vector int)__a, __d);
7463 #else
7464   return (vector bool long long)__builtin_altivec_vperm_4si(
7465       (vector int)__a, (vector int)__b, __c);
7466 #endif
7467 }
7468
7469 static __inline__ vector double __ATTRS_o_ai
7470 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7471 #ifdef __LITTLE_ENDIAN__
7472   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7473                               255, 255, 255, 255, 255, 255, 255, 255};
7474   __d = vec_xor(__c, __d);
7475   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7476                                                     (vector int)__a, __d);
7477 #else
7478   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7479                                                     (vector int)__b, __c);
7480 #endif
7481 }
7482 #endif
7483
7484 /* vec_vperm */
7485
7486 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7487     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7488   return vec_perm(__a, __b, __c);
7489 }
7490
7491 static __inline__ vector unsigned char __ATTRS_o_ai
7492 vec_vperm(vector unsigned char __a, vector unsigned char __b,
7493           vector unsigned char __c) {
7494   return vec_perm(__a, __b, __c);
7495 }
7496
7497 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7498     vector bool char __a, vector bool char __b, vector unsigned char __c) {
7499   return vec_perm(__a, __b, __c);
7500 }
7501
7502 static __inline__ vector short __ATTRS_o_ai
7503 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7504   return vec_perm(__a, __b, __c);
7505 }
7506
7507 static __inline__ vector unsigned short __ATTRS_o_ai
7508 vec_vperm(vector unsigned short __a, vector unsigned short __b,
7509           vector unsigned char __c) {
7510   return vec_perm(__a, __b, __c);
7511 }
7512
7513 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7514     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7515   return vec_perm(__a, __b, __c);
7516 }
7517
7518 static __inline__ vector pixel __ATTRS_o_ai
7519 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7520   return vec_perm(__a, __b, __c);
7521 }
7522
7523 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7524                                                     vector int __b,
7525                                                     vector unsigned char __c) {
7526   return vec_perm(__a, __b, __c);
7527 }
7528
7529 static __inline__ vector unsigned int __ATTRS_o_ai
7530 vec_vperm(vector unsigned int __a, vector unsigned int __b,
7531           vector unsigned char __c) {
7532   return vec_perm(__a, __b, __c);
7533 }
7534
7535 static __inline__ vector bool int __ATTRS_o_ai
7536 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7537   return vec_perm(__a, __b, __c);
7538 }
7539
7540 static __inline__ vector float __ATTRS_o_ai
7541 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7542   return vec_perm(__a, __b, __c);
7543 }
7544
7545 #ifdef __VSX__
7546 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7547     vector long long __a, vector long long __b, vector unsigned char __c) {
7548   return vec_perm(__a, __b, __c);
7549 }
7550
7551 static __inline__ vector unsigned long long __ATTRS_o_ai
7552 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7553           vector unsigned char __c) {
7554   return vec_perm(__a, __b, __c);
7555 }
7556
7557 static __inline__ vector double __ATTRS_o_ai
7558 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7559   return vec_perm(__a, __b, __c);
7560 }
7561 #endif
7562
7563 /* vec_re */
7564
7565 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7566 #ifdef __VSX__
7567   return __builtin_vsx_xvresp(__a);
7568 #else
7569   return __builtin_altivec_vrefp(__a);
7570 #endif
7571 }
7572
7573 #ifdef __VSX__
7574 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7575   return __builtin_vsx_xvredp(__a);
7576 }
7577 #endif
7578
7579 /* vec_vrefp */
7580
7581 static __inline__ vector float __attribute__((__always_inline__))
7582 vec_vrefp(vector float __a) {
7583   return __builtin_altivec_vrefp(__a);
7584 }
7585
7586 /* vec_rl */
7587
7588 static __inline__ vector signed char __ATTRS_o_ai
7589 vec_rl(vector signed char __a, vector unsigned char __b) {
7590   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7591 }
7592
7593 static __inline__ vector unsigned char __ATTRS_o_ai
7594 vec_rl(vector unsigned char __a, vector unsigned char __b) {
7595   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7596 }
7597
7598 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7599                                                    vector unsigned short __b) {
7600   return __builtin_altivec_vrlh(__a, __b);
7601 }
7602
7603 static __inline__ vector unsigned short __ATTRS_o_ai
7604 vec_rl(vector unsigned short __a, vector unsigned short __b) {
7605   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7606 }
7607
7608 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7609                                                  vector unsigned int __b) {
7610   return __builtin_altivec_vrlw(__a, __b);
7611 }
7612
7613 static __inline__ vector unsigned int __ATTRS_o_ai
7614 vec_rl(vector unsigned int __a, vector unsigned int __b) {
7615   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7616 }
7617
7618 #ifdef __POWER8_VECTOR__
7619 static __inline__ vector signed long long __ATTRS_o_ai
7620 vec_rl(vector signed long long __a, vector unsigned long long __b) {
7621   return __builtin_altivec_vrld(__a, __b);
7622 }
7623
7624 static __inline__ vector unsigned long long __ATTRS_o_ai
7625 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7626   return __builtin_altivec_vrld(__a, __b);
7627 }
7628 #endif
7629
7630 /* vec_rlmi */
7631 #ifdef __POWER9_VECTOR__
7632 static __inline__ vector unsigned int __ATTRS_o_ai
7633 vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7634          vector unsigned int __c) {
7635   return __builtin_altivec_vrlwmi(__a, __c, __b);
7636 }
7637
7638 static __inline__ vector unsigned long long __ATTRS_o_ai
7639 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7640          vector unsigned long long __c) {
7641   return __builtin_altivec_vrldmi(__a, __c, __b);
7642 }
7643
7644 /* vec_rlnm */
7645 static __inline__ vector unsigned int __ATTRS_o_ai
7646 vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7647          vector unsigned int __c) {
7648   vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
7649   return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7650 }
7651
7652 static __inline__ vector unsigned long long __ATTRS_o_ai
7653 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7654          vector unsigned long long __c) {
7655   vector unsigned long long OneByte = { 0x8, 0x8 };
7656   return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7657 }
7658 #endif
7659
7660 /* vec_vrlb */
7661
7662 static __inline__ vector signed char __ATTRS_o_ai
7663 vec_vrlb(vector signed char __a, vector unsigned char __b) {
7664   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7665 }
7666
7667 static __inline__ vector unsigned char __ATTRS_o_ai
7668 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7669   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7670 }
7671
7672 /* vec_vrlh */
7673
7674 static __inline__ vector short __ATTRS_o_ai
7675 vec_vrlh(vector short __a, vector unsigned short __b) {
7676   return __builtin_altivec_vrlh(__a, __b);
7677 }
7678
7679 static __inline__ vector unsigned short __ATTRS_o_ai
7680 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7681   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7682 }
7683
7684 /* vec_vrlw */
7685
7686 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7687                                                    vector unsigned int __b) {
7688   return __builtin_altivec_vrlw(__a, __b);
7689 }
7690
7691 static __inline__ vector unsigned int __ATTRS_o_ai
7692 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7693   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7694 }
7695
7696 /* vec_round */
7697
7698 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7699 #ifdef __VSX__
7700   return __builtin_vsx_xvrspi(__a);
7701 #else
7702   return __builtin_altivec_vrfin(__a);
7703 #endif
7704 }
7705
7706 #ifdef __VSX__
7707 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7708   return __builtin_vsx_xvrdpi(__a);
7709 }
7710
7711 /* vec_rint */
7712
7713 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7714   return __builtin_vsx_xvrspic(__a);
7715 }
7716
7717 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7718   return __builtin_vsx_xvrdpic(__a);
7719 }
7720
7721 /* vec_nearbyint */
7722
7723 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7724   return __builtin_vsx_xvrspi(__a);
7725 }
7726
7727 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7728   return __builtin_vsx_xvrdpi(__a);
7729 }
7730 #endif
7731
7732 /* vec_vrfin */
7733
7734 static __inline__ vector float __attribute__((__always_inline__))
7735 vec_vrfin(vector float __a) {
7736   return __builtin_altivec_vrfin(__a);
7737 }
7738
7739 /* vec_sqrt */
7740
7741 #ifdef __VSX__
7742 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7743   return __builtin_vsx_xvsqrtsp(__a);
7744 }
7745
7746 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7747   return __builtin_vsx_xvsqrtdp(__a);
7748 }
7749 #endif
7750
7751 /* vec_rsqrte */
7752
7753 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7754 #ifdef __VSX__
7755   return __builtin_vsx_xvrsqrtesp(__a);
7756 #else
7757   return __builtin_altivec_vrsqrtefp(__a);
7758 #endif
7759 }
7760
7761 #ifdef __VSX__
7762 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7763   return __builtin_vsx_xvrsqrtedp(__a);
7764 }
7765 #endif
7766
7767 /* vec_vrsqrtefp */
7768
7769 static __inline__ __vector float __attribute__((__always_inline__))
7770 vec_vrsqrtefp(vector float __a) {
7771   return __builtin_altivec_vrsqrtefp(__a);
7772 }
7773
7774 /* vec_sel */
7775
7776 #define __builtin_altivec_vsel_4si vec_sel
7777
7778 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7779     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7780   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7781 }
7782
7783 static __inline__ vector signed char __ATTRS_o_ai
7784 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7785   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7786 }
7787
7788 static __inline__ vector unsigned char __ATTRS_o_ai
7789 vec_sel(vector unsigned char __a, vector unsigned char __b,
7790         vector unsigned char __c) {
7791   return (__a & ~__c) | (__b & __c);
7792 }
7793
7794 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7795     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7796   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7797 }
7798
7799 static __inline__ vector bool char __ATTRS_o_ai
7800 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7801   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7802 }
7803
7804 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7805                                                         vector bool char __b,
7806                                                         vector bool char __c) {
7807   return (__a & ~__c) | (__b & __c);
7808 }
7809
7810 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7811                                                     vector short __b,
7812                                                     vector unsigned short __c) {
7813   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7814 }
7815
7816 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7817                                                     vector short __b,
7818                                                     vector bool short __c) {
7819   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7820 }
7821
7822 static __inline__ vector unsigned short __ATTRS_o_ai
7823 vec_sel(vector unsigned short __a, vector unsigned short __b,
7824         vector unsigned short __c) {
7825   return (__a & ~__c) | (__b & __c);
7826 }
7827
7828 static __inline__ vector unsigned short __ATTRS_o_ai
7829 vec_sel(vector unsigned short __a, vector unsigned short __b,
7830         vector bool short __c) {
7831   return (__a & ~(vector unsigned short)__c) |
7832          (__b & (vector unsigned short)__c);
7833 }
7834
7835 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7836     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7837   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7838 }
7839
7840 static __inline__ vector bool short __ATTRS_o_ai
7841 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7842   return (__a & ~__c) | (__b & __c);
7843 }
7844
7845 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7846                                                   vector int __b,
7847                                                   vector unsigned int __c) {
7848   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7849 }
7850
7851 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7852                                                   vector int __b,
7853                                                   vector bool int __c) {
7854   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7855 }
7856
7857 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7858     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7859   return (__a & ~__c) | (__b & __c);
7860 }
7861
7862 static __inline__ vector unsigned int __ATTRS_o_ai
7863 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7864   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7865 }
7866
7867 static __inline__ vector bool int __ATTRS_o_ai
7868 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7869   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7870 }
7871
7872 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7873                                                        vector bool int __b,
7874                                                        vector bool int __c) {
7875   return (__a & ~__c) | (__b & __c);
7876 }
7877
7878 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7879                                                     vector float __b,
7880                                                     vector unsigned int __c) {
7881   vector int __res = ((vector int)__a & ~(vector int)__c) |
7882                      ((vector int)__b & (vector int)__c);
7883   return (vector float)__res;
7884 }
7885
7886 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7887                                                     vector float __b,
7888                                                     vector bool int __c) {
7889   vector int __res = ((vector int)__a & ~(vector int)__c) |
7890                      ((vector int)__b & (vector int)__c);
7891   return (vector float)__res;
7892 }
7893
7894 #ifdef __VSX__
7895 static __inline__ vector double __ATTRS_o_ai
7896 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7897   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7898                            ((vector long long)__b & (vector long long)__c);
7899   return (vector double)__res;
7900 }
7901
7902 static __inline__ vector double __ATTRS_o_ai
7903 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7904   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7905                            ((vector long long)__b & (vector long long)__c);
7906   return (vector double)__res;
7907 }
7908 #endif
7909
7910 /* vec_vsel */
7911
7912 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7913     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7914   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7915 }
7916
7917 static __inline__ vector signed char __ATTRS_o_ai
7918 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7919   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7920 }
7921
7922 static __inline__ vector unsigned char __ATTRS_o_ai
7923 vec_vsel(vector unsigned char __a, vector unsigned char __b,
7924          vector unsigned char __c) {
7925   return (__a & ~__c) | (__b & __c);
7926 }
7927
7928 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7929     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7930   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7931 }
7932
7933 static __inline__ vector bool char __ATTRS_o_ai
7934 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7935   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7936 }
7937
7938 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7939                                                          vector bool char __b,
7940                                                          vector bool char __c) {
7941   return (__a & ~__c) | (__b & __c);
7942 }
7943
7944 static __inline__ vector short __ATTRS_o_ai
7945 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7946   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7947 }
7948
7949 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7950                                                      vector short __b,
7951                                                      vector bool short __c) {
7952   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7953 }
7954
7955 static __inline__ vector unsigned short __ATTRS_o_ai
7956 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7957          vector unsigned short __c) {
7958   return (__a & ~__c) | (__b & __c);
7959 }
7960
7961 static __inline__ vector unsigned short __ATTRS_o_ai
7962 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7963          vector bool short __c) {
7964   return (__a & ~(vector unsigned short)__c) |
7965          (__b & (vector unsigned short)__c);
7966 }
7967
7968 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7969     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7970   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7971 }
7972
7973 static __inline__ vector bool short __ATTRS_o_ai
7974 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7975   return (__a & ~__c) | (__b & __c);
7976 }
7977
7978 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7979                                                    vector int __b,
7980                                                    vector unsigned int __c) {
7981   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7982 }
7983
7984 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7985                                                    vector int __b,
7986                                                    vector bool int __c) {
7987   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7988 }
7989
7990 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7991     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7992   return (__a & ~__c) | (__b & __c);
7993 }
7994
7995 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
7996     vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7997   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7998 }
7999
8000 static __inline__ vector bool int __ATTRS_o_ai
8001 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8002   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8003 }
8004
8005 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8006                                                         vector bool int __b,
8007                                                         vector bool int __c) {
8008   return (__a & ~__c) | (__b & __c);
8009 }
8010
8011 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8012                                                      vector float __b,
8013                                                      vector unsigned int __c) {
8014   vector int __res = ((vector int)__a & ~(vector int)__c) |
8015                      ((vector int)__b & (vector int)__c);
8016   return (vector float)__res;
8017 }
8018
8019 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8020                                                      vector float __b,
8021                                                      vector bool int __c) {
8022   vector int __res = ((vector int)__a & ~(vector int)__c) |
8023                      ((vector int)__b & (vector int)__c);
8024   return (vector float)__res;
8025 }
8026
8027 /* vec_sl */
8028
8029 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8030 // than the length of __a.
8031 static __inline__ vector unsigned char __ATTRS_o_ai
8032 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8033   return __a << (__b %
8034                  (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8035 }
8036
8037 static __inline__ vector signed char __ATTRS_o_ai
8038 vec_sl(vector signed char __a, vector unsigned char __b) {
8039   return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8040 }
8041
8042 static __inline__ vector unsigned short __ATTRS_o_ai
8043 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8044   return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8045                                                __CHAR_BIT__));
8046 }
8047
8048 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8049                                                    vector unsigned short __b) {
8050   return (vector short)vec_sl((vector unsigned short)__a, __b);
8051 }
8052
8053 static __inline__ vector unsigned int __ATTRS_o_ai
8054 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8055   return __a << (__b %
8056                  (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8057 }
8058
8059 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8060                                                  vector unsigned int __b) {
8061   return (vector int)vec_sl((vector unsigned int)__a, __b);
8062 }
8063
8064 #ifdef __POWER8_VECTOR__
8065 static __inline__ vector unsigned long long __ATTRS_o_ai
8066 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8067   return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8068                                                    __CHAR_BIT__));
8069 }
8070
8071 static __inline__ vector long long __ATTRS_o_ai
8072 vec_sl(vector long long __a, vector unsigned long long __b) {
8073   return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8074 }
8075 #endif
8076
8077 /* vec_vslb */
8078
8079 #define __builtin_altivec_vslb vec_vslb
8080
8081 static __inline__ vector signed char __ATTRS_o_ai
8082 vec_vslb(vector signed char __a, vector unsigned char __b) {
8083   return vec_sl(__a, __b);
8084 }
8085
8086 static __inline__ vector unsigned char __ATTRS_o_ai
8087 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8088   return vec_sl(__a, __b);
8089 }
8090
8091 /* vec_vslh */
8092
8093 #define __builtin_altivec_vslh vec_vslh
8094
8095 static __inline__ vector short __ATTRS_o_ai
8096 vec_vslh(vector short __a, vector unsigned short __b) {
8097   return vec_sl(__a, __b);
8098 }
8099
8100 static __inline__ vector unsigned short __ATTRS_o_ai
8101 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8102   return vec_sl(__a, __b);
8103 }
8104
8105 /* vec_vslw */
8106
8107 #define __builtin_altivec_vslw vec_vslw
8108
8109 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8110                                                    vector unsigned int __b) {
8111   return vec_sl(__a, __b);
8112 }
8113
8114 static __inline__ vector unsigned int __ATTRS_o_ai
8115 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8116   return vec_sl(__a, __b);
8117 }
8118
8119 /* vec_sld */
8120
8121 #define __builtin_altivec_vsldoi_4si vec_sld
8122
8123 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8124     vector signed char __a, vector signed char __b, unsigned const int __c) {
8125   unsigned char __d = __c & 0x0F;
8126 #ifdef __LITTLE_ENDIAN__
8127   return vec_perm(
8128       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8129                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8130                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8131                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8132 #else
8133   return vec_perm(
8134       __a, __b,
8135       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8136                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8137                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8138 #endif
8139 }
8140
8141 static __inline__ vector unsigned char __ATTRS_o_ai
8142 vec_sld(vector unsigned char __a, vector unsigned char __b,
8143         unsigned const int __c) {
8144   unsigned char __d = __c & 0x0F;
8145 #ifdef __LITTLE_ENDIAN__
8146   return vec_perm(
8147       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8148                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8149                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8150                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8151 #else
8152   return vec_perm(
8153       __a, __b,
8154       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8155                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8156                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8157 #endif
8158 }
8159
8160 static __inline__ vector bool char __ATTRS_o_ai
8161 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8162   unsigned char __d = __c & 0x0F;
8163 #ifdef __LITTLE_ENDIAN__
8164   return vec_perm(
8165       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8166                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8167                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8168                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8169 #else
8170   return vec_perm(
8171       __a, __b,
8172       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8173                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8174                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8175 #endif
8176 }
8177
8178 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8179     vector signed short __a, vector signed short __b, unsigned const int __c) {
8180   unsigned char __d = __c & 0x0F;
8181 #ifdef __LITTLE_ENDIAN__
8182   return vec_perm(
8183       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8184                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8185                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8186                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8187 #else
8188   return vec_perm(
8189       __a, __b,
8190       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8191                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8192                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8193 #endif
8194 }
8195
8196 static __inline__ vector unsigned short __ATTRS_o_ai
8197 vec_sld(vector unsigned short __a, vector unsigned short __b,
8198         unsigned const int __c) {
8199   unsigned char __d = __c & 0x0F;
8200 #ifdef __LITTLE_ENDIAN__
8201   return vec_perm(
8202       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8203                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8204                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8205                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8206 #else
8207   return vec_perm(
8208       __a, __b,
8209       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8210                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8211                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8212 #endif
8213 }
8214
8215 static __inline__ vector bool short __ATTRS_o_ai
8216 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8217   unsigned char __d = __c & 0x0F;
8218 #ifdef __LITTLE_ENDIAN__
8219   return vec_perm(
8220       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8221                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8222                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8223                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8224 #else
8225   return vec_perm(
8226       __a, __b,
8227       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8228                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8229                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8230 #endif
8231 }
8232
8233 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8234                                                     vector pixel __b,
8235                                                     unsigned const int __c) {
8236   unsigned char __d = __c & 0x0F;
8237 #ifdef __LITTLE_ENDIAN__
8238   return vec_perm(
8239       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8240                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8241                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8242                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8243 #else
8244   return vec_perm(
8245       __a, __b,
8246       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8247                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8248                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8249 #endif
8250 }
8251
8252 static __inline__ vector signed int __ATTRS_o_ai
8253 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8254   unsigned char __d = __c & 0x0F;
8255 #ifdef __LITTLE_ENDIAN__
8256   return vec_perm(
8257       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8258                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8259                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8260                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8261 #else
8262   return vec_perm(
8263       __a, __b,
8264       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8265                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8266                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8267 #endif
8268 }
8269
8270 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8271     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8272   unsigned char __d = __c & 0x0F;
8273 #ifdef __LITTLE_ENDIAN__
8274   return vec_perm(
8275       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8276                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8277                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8278                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8279 #else
8280   return vec_perm(
8281       __a, __b,
8282       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8283                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8284                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8285 #endif
8286 }
8287
8288 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8289                                                        vector bool int __b,
8290                                                        unsigned const int __c) {
8291   unsigned char __d = __c & 0x0F;
8292 #ifdef __LITTLE_ENDIAN__
8293   return vec_perm(
8294       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8295                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8296                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8297                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8298 #else
8299   return vec_perm(
8300       __a, __b,
8301       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8302                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8303                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8304 #endif
8305 }
8306
8307 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8308                                                     vector float __b,
8309                                                     unsigned const int __c) {
8310   unsigned char __d = __c & 0x0F;
8311 #ifdef __LITTLE_ENDIAN__
8312   return vec_perm(
8313       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8314                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8315                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8316                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8317 #else
8318   return vec_perm(
8319       __a, __b,
8320       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8321                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8322                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8323 #endif
8324 }
8325
8326 #ifdef __VSX__
8327 static __inline__ vector bool long long __ATTRS_o_ai
8328 vec_sld(vector bool long long __a, vector bool long long __b,
8329         unsigned const int __c) {
8330   unsigned char __d = __c & 0x0F;
8331 #ifdef __LITTLE_ENDIAN__
8332   return vec_perm(
8333       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8334                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8335                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8336                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8337 #else
8338   return vec_perm(
8339       __a, __b,
8340       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8341                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8342                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8343 #endif
8344 }
8345
8346 static __inline__ vector signed long long __ATTRS_o_ai
8347 vec_sld(vector signed long long __a, vector signed long long __b,
8348         unsigned const int __c) {
8349   unsigned char __d = __c & 0x0F;
8350 #ifdef __LITTLE_ENDIAN__
8351   return vec_perm(
8352       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8353                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8354                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8355                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8356 #else
8357   return vec_perm(
8358       __a, __b,
8359       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8360                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8361                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8362 #endif
8363 }
8364
8365 static __inline__ vector unsigned long long __ATTRS_o_ai
8366 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8367         unsigned const int __c) {
8368   unsigned char __d = __c & 0x0F;
8369 #ifdef __LITTLE_ENDIAN__
8370   return vec_perm(
8371       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8372                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8373                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8374                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8375 #else
8376   return vec_perm(
8377       __a, __b,
8378       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8379                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8380                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8381 #endif
8382 }
8383
8384 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8385                                                      vector double __b,
8386                                                      unsigned const int __c) {
8387   unsigned char __d = __c & 0x0F;
8388 #ifdef __LITTLE_ENDIAN__
8389   return vec_perm(
8390       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8391                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8392                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8393                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8394 #else
8395   return vec_perm(
8396       __a, __b,
8397       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8398                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8399                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8400 #endif
8401 }
8402 #endif
8403
8404 /* vec_sldw */
8405 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8406     vector signed char __a, vector signed char __b, unsigned const int __c) {
8407   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8408 }
8409
8410 static __inline__ vector unsigned char __ATTRS_o_ai
8411 vec_sldw(vector unsigned char __a, vector unsigned char __b,
8412          unsigned const int __c) {
8413   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8414 }
8415
8416 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8417     vector signed short __a, vector signed short __b, unsigned const int __c) {
8418   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8419 }
8420
8421 static __inline__ vector unsigned short __ATTRS_o_ai
8422 vec_sldw(vector unsigned short __a, vector unsigned short __b,
8423          unsigned const int __c) {
8424   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8425 }
8426
8427 static __inline__ vector signed int __ATTRS_o_ai
8428 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8429   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8430 }
8431
8432 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8433     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8434   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8435 }
8436
8437 #ifdef __VSX__
8438 static __inline__ vector signed long long __ATTRS_o_ai
8439 vec_sldw(vector signed long long __a, vector signed long long __b,
8440          unsigned const int __c) {
8441   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8442 }
8443
8444 static __inline__ vector unsigned long long __ATTRS_o_ai
8445 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8446          unsigned const int __c) {
8447   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8448 }
8449 #endif
8450
8451 #ifdef __POWER9_VECTOR__
8452 /* vec_slv */
8453 static __inline__ vector unsigned char __ATTRS_o_ai
8454 vec_slv(vector unsigned char __a, vector unsigned char __b) {
8455   return __builtin_altivec_vslv(__a, __b);
8456 }
8457
8458 /* vec_srv */
8459 static __inline__ vector unsigned char __ATTRS_o_ai
8460 vec_srv(vector unsigned char __a, vector unsigned char __b) {
8461   return __builtin_altivec_vsrv(__a, __b);
8462 }
8463 #endif
8464
8465 /* vec_vsldoi */
8466
8467 static __inline__ vector signed char __ATTRS_o_ai
8468 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8469   unsigned char __d = __c & 0x0F;
8470 #ifdef __LITTLE_ENDIAN__
8471   return vec_perm(
8472       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8473                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8474                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8475                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8476 #else
8477   return vec_perm(
8478       __a, __b,
8479       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8480                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8481                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8482 #endif
8483 }
8484
8485 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8486     vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8487   unsigned char __d = __c & 0x0F;
8488 #ifdef __LITTLE_ENDIAN__
8489   return vec_perm(
8490       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8491                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8492                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8493                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8494 #else
8495   return vec_perm(
8496       __a, __b,
8497       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8498                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8499                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8500 #endif
8501 }
8502
8503 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8504                                                        vector short __b,
8505                                                        unsigned char __c) {
8506   unsigned char __d = __c & 0x0F;
8507 #ifdef __LITTLE_ENDIAN__
8508   return vec_perm(
8509       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8510                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8511                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8512                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8513 #else
8514   return vec_perm(
8515       __a, __b,
8516       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8517                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8518                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8519 #endif
8520 }
8521
8522 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8523     vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8524   unsigned char __d = __c & 0x0F;
8525 #ifdef __LITTLE_ENDIAN__
8526   return vec_perm(
8527       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8528                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8529                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8530                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8531 #else
8532   return vec_perm(
8533       __a, __b,
8534       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8535                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8536                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8537 #endif
8538 }
8539
8540 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8541                                                        vector pixel __b,
8542                                                        unsigned char __c) {
8543   unsigned char __d = __c & 0x0F;
8544 #ifdef __LITTLE_ENDIAN__
8545   return vec_perm(
8546       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8547                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8548                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8549                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8550 #else
8551   return vec_perm(
8552       __a, __b,
8553       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8554                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8555                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8556 #endif
8557 }
8558
8559 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8560                                                      vector int __b,
8561                                                      unsigned char __c) {
8562   unsigned char __d = __c & 0x0F;
8563 #ifdef __LITTLE_ENDIAN__
8564   return vec_perm(
8565       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8566                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8567                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8568                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8569 #else
8570   return vec_perm(
8571       __a, __b,
8572       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8573                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8574                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8575 #endif
8576 }
8577
8578 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8579     vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8580   unsigned char __d = __c & 0x0F;
8581 #ifdef __LITTLE_ENDIAN__
8582   return vec_perm(
8583       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8584                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8585                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8586                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8587 #else
8588   return vec_perm(
8589       __a, __b,
8590       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8591                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8592                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8593 #endif
8594 }
8595
8596 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8597                                                        vector float __b,
8598                                                        unsigned char __c) {
8599   unsigned char __d = __c & 0x0F;
8600 #ifdef __LITTLE_ENDIAN__
8601   return vec_perm(
8602       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8603                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8604                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8605                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8606 #else
8607   return vec_perm(
8608       __a, __b,
8609       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8610                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8611                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8612 #endif
8613 }
8614
8615 /* vec_sll */
8616
8617 static __inline__ vector signed char __ATTRS_o_ai
8618 vec_sll(vector signed char __a, vector unsigned char __b) {
8619   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8620                                                    (vector int)__b);
8621 }
8622
8623 static __inline__ vector signed char __ATTRS_o_ai
8624 vec_sll(vector signed char __a, vector unsigned short __b) {
8625   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8626                                                    (vector int)__b);
8627 }
8628
8629 static __inline__ vector signed char __ATTRS_o_ai
8630 vec_sll(vector signed char __a, vector unsigned int __b) {
8631   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8632                                                    (vector int)__b);
8633 }
8634
8635 static __inline__ vector unsigned char __ATTRS_o_ai
8636 vec_sll(vector unsigned char __a, vector unsigned char __b) {
8637   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8638                                                      (vector int)__b);
8639 }
8640
8641 static __inline__ vector unsigned char __ATTRS_o_ai
8642 vec_sll(vector unsigned char __a, vector unsigned short __b) {
8643   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8644                                                      (vector int)__b);
8645 }
8646
8647 static __inline__ vector unsigned char __ATTRS_o_ai
8648 vec_sll(vector unsigned char __a, vector unsigned int __b) {
8649   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8650                                                      (vector int)__b);
8651 }
8652
8653 static __inline__ vector bool char __ATTRS_o_ai
8654 vec_sll(vector bool char __a, vector unsigned char __b) {
8655   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8656                                                  (vector int)__b);
8657 }
8658
8659 static __inline__ vector bool char __ATTRS_o_ai
8660 vec_sll(vector bool char __a, vector unsigned short __b) {
8661   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8662                                                  (vector int)__b);
8663 }
8664
8665 static __inline__ vector bool char __ATTRS_o_ai
8666 vec_sll(vector bool char __a, vector unsigned int __b) {
8667   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8668                                                  (vector int)__b);
8669 }
8670
8671 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8672                                                     vector unsigned char __b) {
8673   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8674 }
8675
8676 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8677                                                     vector unsigned short __b) {
8678   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8679 }
8680
8681 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8682                                                     vector unsigned int __b) {
8683   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8684 }
8685
8686 static __inline__ vector unsigned short __ATTRS_o_ai
8687 vec_sll(vector unsigned short __a, vector unsigned char __b) {
8688   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8689                                                       (vector int)__b);
8690 }
8691
8692 static __inline__ vector unsigned short __ATTRS_o_ai
8693 vec_sll(vector unsigned short __a, vector unsigned short __b) {
8694   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8695                                                       (vector int)__b);
8696 }
8697
8698 static __inline__ vector unsigned short __ATTRS_o_ai
8699 vec_sll(vector unsigned short __a, vector unsigned int __b) {
8700   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8701                                                       (vector int)__b);
8702 }
8703
8704 static __inline__ vector bool short __ATTRS_o_ai
8705 vec_sll(vector bool short __a, vector unsigned char __b) {
8706   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8707                                                   (vector int)__b);
8708 }
8709
8710 static __inline__ vector bool short __ATTRS_o_ai
8711 vec_sll(vector bool short __a, vector unsigned short __b) {
8712   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8713                                                   (vector int)__b);
8714 }
8715
8716 static __inline__ vector bool short __ATTRS_o_ai
8717 vec_sll(vector bool short __a, vector unsigned int __b) {
8718   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8719                                                   (vector int)__b);
8720 }
8721
8722 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8723                                                     vector unsigned char __b) {
8724   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8725 }
8726
8727 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8728                                                     vector unsigned short __b) {
8729   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8730 }
8731
8732 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8733                                                     vector unsigned int __b) {
8734   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8735 }
8736
8737 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8738                                                   vector unsigned char __b) {
8739   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8740 }
8741
8742 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8743                                                   vector unsigned short __b) {
8744   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8745 }
8746
8747 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8748                                                   vector unsigned int __b) {
8749   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8750 }
8751
8752 static __inline__ vector unsigned int __ATTRS_o_ai
8753 vec_sll(vector unsigned int __a, vector unsigned char __b) {
8754   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8755                                                     (vector int)__b);
8756 }
8757
8758 static __inline__ vector unsigned int __ATTRS_o_ai
8759 vec_sll(vector unsigned int __a, vector unsigned short __b) {
8760   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8761                                                     (vector int)__b);
8762 }
8763
8764 static __inline__ vector unsigned int __ATTRS_o_ai
8765 vec_sll(vector unsigned int __a, vector unsigned int __b) {
8766   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8767                                                     (vector int)__b);
8768 }
8769
8770 static __inline__ vector bool int __ATTRS_o_ai
8771 vec_sll(vector bool int __a, vector unsigned char __b) {
8772   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8773                                                 (vector int)__b);
8774 }
8775
8776 static __inline__ vector bool int __ATTRS_o_ai
8777 vec_sll(vector bool int __a, vector unsigned short __b) {
8778   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8779                                                 (vector int)__b);
8780 }
8781
8782 static __inline__ vector bool int __ATTRS_o_ai
8783 vec_sll(vector bool int __a, vector unsigned int __b) {
8784   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8785                                                 (vector int)__b);
8786 }
8787
8788 #ifdef __VSX__
8789 static __inline__ vector signed long long __ATTRS_o_ai
8790 vec_sll(vector signed long long __a, vector unsigned char __b) {
8791   return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8792                                                         (vector int)__b);
8793 }
8794
8795 static __inline__ vector unsigned long long __ATTRS_o_ai
8796 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8797   return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8798                                                           (vector int)__b);
8799 }
8800 #endif
8801
8802 /* vec_vsl */
8803
8804 static __inline__ vector signed char __ATTRS_o_ai
8805 vec_vsl(vector signed char __a, vector unsigned char __b) {
8806   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8807                                                    (vector int)__b);
8808 }
8809
8810 static __inline__ vector signed char __ATTRS_o_ai
8811 vec_vsl(vector signed char __a, vector unsigned short __b) {
8812   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8813                                                    (vector int)__b);
8814 }
8815
8816 static __inline__ vector signed char __ATTRS_o_ai
8817 vec_vsl(vector signed char __a, vector unsigned int __b) {
8818   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8819                                                    (vector int)__b);
8820 }
8821
8822 static __inline__ vector unsigned char __ATTRS_o_ai
8823 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8824   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8825                                                      (vector int)__b);
8826 }
8827
8828 static __inline__ vector unsigned char __ATTRS_o_ai
8829 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8830   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8831                                                      (vector int)__b);
8832 }
8833
8834 static __inline__ vector unsigned char __ATTRS_o_ai
8835 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8836   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8837                                                      (vector int)__b);
8838 }
8839
8840 static __inline__ vector bool char __ATTRS_o_ai
8841 vec_vsl(vector bool char __a, vector unsigned char __b) {
8842   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8843                                                  (vector int)__b);
8844 }
8845
8846 static __inline__ vector bool char __ATTRS_o_ai
8847 vec_vsl(vector bool char __a, vector unsigned short __b) {
8848   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8849                                                  (vector int)__b);
8850 }
8851
8852 static __inline__ vector bool char __ATTRS_o_ai
8853 vec_vsl(vector bool char __a, vector unsigned int __b) {
8854   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8855                                                  (vector int)__b);
8856 }
8857
8858 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8859                                                     vector unsigned char __b) {
8860   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8861 }
8862
8863 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8864                                                     vector unsigned short __b) {
8865   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8866 }
8867
8868 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8869                                                     vector unsigned int __b) {
8870   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8871 }
8872
8873 static __inline__ vector unsigned short __ATTRS_o_ai
8874 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8875   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8876                                                       (vector int)__b);
8877 }
8878
8879 static __inline__ vector unsigned short __ATTRS_o_ai
8880 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8881   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8882                                                       (vector int)__b);
8883 }
8884
8885 static __inline__ vector unsigned short __ATTRS_o_ai
8886 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8887   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8888                                                       (vector int)__b);
8889 }
8890
8891 static __inline__ vector bool short __ATTRS_o_ai
8892 vec_vsl(vector bool short __a, vector unsigned char __b) {
8893   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8894                                                   (vector int)__b);
8895 }
8896
8897 static __inline__ vector bool short __ATTRS_o_ai
8898 vec_vsl(vector bool short __a, vector unsigned short __b) {
8899   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8900                                                   (vector int)__b);
8901 }
8902
8903 static __inline__ vector bool short __ATTRS_o_ai
8904 vec_vsl(vector bool short __a, vector unsigned int __b) {
8905   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8906                                                   (vector int)__b);
8907 }
8908
8909 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8910                                                     vector unsigned char __b) {
8911   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8912 }
8913
8914 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8915                                                     vector unsigned short __b) {
8916   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8917 }
8918
8919 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8920                                                     vector unsigned int __b) {
8921   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8922 }
8923
8924 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8925                                                   vector unsigned char __b) {
8926   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8927 }
8928
8929 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8930                                                   vector unsigned short __b) {
8931   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8932 }
8933
8934 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8935                                                   vector unsigned int __b) {
8936   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8937 }
8938
8939 static __inline__ vector unsigned int __ATTRS_o_ai
8940 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8941   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8942                                                     (vector int)__b);
8943 }
8944
8945 static __inline__ vector unsigned int __ATTRS_o_ai
8946 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8947   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8948                                                     (vector int)__b);
8949 }
8950
8951 static __inline__ vector unsigned int __ATTRS_o_ai
8952 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8953   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8954                                                     (vector int)__b);
8955 }
8956
8957 static __inline__ vector bool int __ATTRS_o_ai
8958 vec_vsl(vector bool int __a, vector unsigned char __b) {
8959   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8960                                                 (vector int)__b);
8961 }
8962
8963 static __inline__ vector bool int __ATTRS_o_ai
8964 vec_vsl(vector bool int __a, vector unsigned short __b) {
8965   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8966                                                 (vector int)__b);
8967 }
8968
8969 static __inline__ vector bool int __ATTRS_o_ai
8970 vec_vsl(vector bool int __a, vector unsigned int __b) {
8971   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8972                                                 (vector int)__b);
8973 }
8974
8975 /* vec_slo */
8976
8977 static __inline__ vector signed char __ATTRS_o_ai
8978 vec_slo(vector signed char __a, vector signed char __b) {
8979   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8980                                                     (vector int)__b);
8981 }
8982
8983 static __inline__ vector signed char __ATTRS_o_ai
8984 vec_slo(vector signed char __a, vector unsigned char __b) {
8985   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8986                                                     (vector int)__b);
8987 }
8988
8989 static __inline__ vector unsigned char __ATTRS_o_ai
8990 vec_slo(vector unsigned char __a, vector signed char __b) {
8991   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8992                                                       (vector int)__b);
8993 }
8994
8995 static __inline__ vector unsigned char __ATTRS_o_ai
8996 vec_slo(vector unsigned char __a, vector unsigned char __b) {
8997   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
8998                                                       (vector int)__b);
8999 }
9000
9001 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9002                                                     vector signed char __b) {
9003   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9004 }
9005
9006 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9007                                                     vector unsigned char __b) {
9008   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9009 }
9010
9011 static __inline__ vector unsigned short __ATTRS_o_ai
9012 vec_slo(vector unsigned short __a, vector signed char __b) {
9013   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9014                                                        (vector int)__b);
9015 }
9016
9017 static __inline__ vector unsigned short __ATTRS_o_ai
9018 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9019   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9020                                                        (vector int)__b);
9021 }
9022
9023 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9024                                                     vector signed char __b) {
9025   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9026 }
9027
9028 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9029                                                     vector unsigned char __b) {
9030   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9031 }
9032
9033 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9034                                                   vector signed char __b) {
9035   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9036 }
9037
9038 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9039                                                   vector unsigned char __b) {
9040   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9041 }
9042
9043 static __inline__ vector unsigned int __ATTRS_o_ai
9044 vec_slo(vector unsigned int __a, vector signed char __b) {
9045   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9046                                                      (vector int)__b);
9047 }
9048
9049 static __inline__ vector unsigned int __ATTRS_o_ai
9050 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9051   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9052                                                      (vector int)__b);
9053 }
9054
9055 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9056                                                     vector signed char __b) {
9057   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9058 }
9059
9060 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9061                                                     vector unsigned char __b) {
9062   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9063 }
9064
9065 #ifdef __VSX__
9066 static __inline__ vector signed long long __ATTRS_o_ai
9067 vec_slo(vector signed long long __a, vector signed char __b) {
9068   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9069                                                          (vector int)__b);
9070 }
9071
9072 static __inline__ vector signed long long __ATTRS_o_ai
9073 vec_slo(vector signed long long __a, vector unsigned char __b) {
9074   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9075                                                          (vector int)__b);
9076 }
9077
9078 static __inline__ vector unsigned long long __ATTRS_o_ai
9079 vec_slo(vector unsigned long long __a, vector signed char __b) {
9080   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9081                                                            (vector int)__b);
9082 }
9083
9084 static __inline__ vector unsigned long long __ATTRS_o_ai
9085 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9086   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9087                                                            (vector int)__b);
9088 }
9089 #endif
9090
9091 /* vec_vslo */
9092
9093 static __inline__ vector signed char __ATTRS_o_ai
9094 vec_vslo(vector signed char __a, vector signed char __b) {
9095   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9096                                                     (vector int)__b);
9097 }
9098
9099 static __inline__ vector signed char __ATTRS_o_ai
9100 vec_vslo(vector signed char __a, vector unsigned char __b) {
9101   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9102                                                     (vector int)__b);
9103 }
9104
9105 static __inline__ vector unsigned char __ATTRS_o_ai
9106 vec_vslo(vector unsigned char __a, vector signed char __b) {
9107   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9108                                                       (vector int)__b);
9109 }
9110
9111 static __inline__ vector unsigned char __ATTRS_o_ai
9112 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9113   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9114                                                       (vector int)__b);
9115 }
9116
9117 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9118                                                      vector signed char __b) {
9119   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9120 }
9121
9122 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9123                                                      vector unsigned char __b) {
9124   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9125 }
9126
9127 static __inline__ vector unsigned short __ATTRS_o_ai
9128 vec_vslo(vector unsigned short __a, vector signed char __b) {
9129   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9130                                                        (vector int)__b);
9131 }
9132
9133 static __inline__ vector unsigned short __ATTRS_o_ai
9134 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9135   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9136                                                        (vector int)__b);
9137 }
9138
9139 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9140                                                      vector signed char __b) {
9141   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9142 }
9143
9144 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9145                                                      vector unsigned char __b) {
9146   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9147 }
9148
9149 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9150                                                    vector signed char __b) {
9151   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9152 }
9153
9154 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9155                                                    vector unsigned char __b) {
9156   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9157 }
9158
9159 static __inline__ vector unsigned int __ATTRS_o_ai
9160 vec_vslo(vector unsigned int __a, vector signed char __b) {
9161   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9162                                                      (vector int)__b);
9163 }
9164
9165 static __inline__ vector unsigned int __ATTRS_o_ai
9166 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9167   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9168                                                      (vector int)__b);
9169 }
9170
9171 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9172                                                      vector signed char __b) {
9173   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9174 }
9175
9176 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9177                                                      vector unsigned char __b) {
9178   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9179 }
9180
9181 /* vec_splat */
9182
9183 static __inline__ vector signed char __ATTRS_o_ai
9184 vec_splat(vector signed char __a, unsigned const int __b) {
9185   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9186 }
9187
9188 static __inline__ vector unsigned char __ATTRS_o_ai
9189 vec_splat(vector unsigned char __a, unsigned const int __b) {
9190   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9191 }
9192
9193 static __inline__ vector bool char __ATTRS_o_ai
9194 vec_splat(vector bool char __a, unsigned const int __b) {
9195   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9196 }
9197
9198 static __inline__ vector signed short __ATTRS_o_ai
9199 vec_splat(vector signed short __a, unsigned const int __b) {
9200   unsigned char b0 = (__b & 0x07) * 2;
9201   unsigned char b1 = b0 + 1;
9202   return vec_perm(__a, __a,
9203                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9204                                          b0, b1, b0, b1, b0, b1));
9205 }
9206
9207 static __inline__ vector unsigned short __ATTRS_o_ai
9208 vec_splat(vector unsigned short __a, unsigned const int __b) {
9209   unsigned char b0 = (__b & 0x07) * 2;
9210   unsigned char b1 = b0 + 1;
9211   return vec_perm(__a, __a,
9212                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9213                                          b0, b1, b0, b1, b0, b1));
9214 }
9215
9216 static __inline__ vector bool short __ATTRS_o_ai
9217 vec_splat(vector bool short __a, unsigned const int __b) {
9218   unsigned char b0 = (__b & 0x07) * 2;
9219   unsigned char b1 = b0 + 1;
9220   return vec_perm(__a, __a,
9221                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9222                                          b0, b1, b0, b1, b0, b1));
9223 }
9224
9225 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9226                                                       unsigned const int __b) {
9227   unsigned char b0 = (__b & 0x07) * 2;
9228   unsigned char b1 = b0 + 1;
9229   return vec_perm(__a, __a,
9230                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9231                                          b0, b1, b0, b1, b0, b1));
9232 }
9233
9234 static __inline__ vector signed int __ATTRS_o_ai
9235 vec_splat(vector signed int __a, unsigned const int __b) {
9236   unsigned char b0 = (__b & 0x03) * 4;
9237   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9238   return vec_perm(__a, __a,
9239                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9240                                          b2, b3, b0, b1, b2, b3));
9241 }
9242
9243 static __inline__ vector unsigned int __ATTRS_o_ai
9244 vec_splat(vector unsigned int __a, unsigned const int __b) {
9245   unsigned char b0 = (__b & 0x03) * 4;
9246   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9247   return vec_perm(__a, __a,
9248                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9249                                          b2, b3, b0, b1, b2, b3));
9250 }
9251
9252 static __inline__ vector bool int __ATTRS_o_ai
9253 vec_splat(vector bool int __a, unsigned const int __b) {
9254   unsigned char b0 = (__b & 0x03) * 4;
9255   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9256   return vec_perm(__a, __a,
9257                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9258                                          b2, b3, b0, b1, b2, b3));
9259 }
9260
9261 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9262                                                       unsigned const int __b) {
9263   unsigned char b0 = (__b & 0x03) * 4;
9264   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9265   return vec_perm(__a, __a,
9266                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9267                                          b2, b3, b0, b1, b2, b3));
9268 }
9269
9270 #ifdef __VSX__
9271 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9272                                                        unsigned const int __b) {
9273   unsigned char b0 = (__b & 0x01) * 8;
9274   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9275                 b6 = b0 + 6, b7 = b0 + 7;
9276   return vec_perm(__a, __a,
9277                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9278                                          b2, b3, b4, b5, b6, b7));
9279 }
9280 static __inline__ vector bool long long __ATTRS_o_ai
9281 vec_splat(vector bool long long __a, unsigned const int __b) {
9282   unsigned char b0 = (__b & 0x01) * 8;
9283   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9284                 b6 = b0 + 6, b7 = b0 + 7;
9285   return vec_perm(__a, __a,
9286                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9287                                          b2, b3, b4, b5, b6, b7));
9288 }
9289 static __inline__ vector signed long long __ATTRS_o_ai
9290 vec_splat(vector signed long long __a, unsigned const int __b) {
9291   unsigned char b0 = (__b & 0x01) * 8;
9292   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9293                 b6 = b0 + 6, b7 = b0 + 7;
9294   return vec_perm(__a, __a,
9295                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9296                                          b2, b3, b4, b5, b6, b7));
9297 }
9298 static __inline__ vector unsigned long long __ATTRS_o_ai
9299 vec_splat(vector unsigned long long __a, unsigned const int __b) {
9300   unsigned char b0 = (__b & 0x01) * 8;
9301   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9302                 b6 = b0 + 6, b7 = b0 + 7;
9303   return vec_perm(__a, __a,
9304                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9305                                          b2, b3, b4, b5, b6, b7));
9306 }
9307 #endif
9308
9309 /* vec_vspltb */
9310
9311 #define __builtin_altivec_vspltb vec_vspltb
9312
9313 static __inline__ vector signed char __ATTRS_o_ai
9314 vec_vspltb(vector signed char __a, unsigned char __b) {
9315   return vec_perm(__a, __a, (vector unsigned char)(__b));
9316 }
9317
9318 static __inline__ vector unsigned char __ATTRS_o_ai
9319 vec_vspltb(vector unsigned char __a, unsigned char __b) {
9320   return vec_perm(__a, __a, (vector unsigned char)(__b));
9321 }
9322
9323 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9324                                                            unsigned char __b) {
9325   return vec_perm(__a, __a, (vector unsigned char)(__b));
9326 }
9327
9328 /* vec_vsplth */
9329
9330 #define __builtin_altivec_vsplth vec_vsplth
9331
9332 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9333                                                        unsigned char __b) {
9334   __b *= 2;
9335   unsigned char b1 = __b + 1;
9336   return vec_perm(__a, __a,
9337                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9338                                          __b, b1, __b, b1, __b, b1, __b, b1));
9339 }
9340
9341 static __inline__ vector unsigned short __ATTRS_o_ai
9342 vec_vsplth(vector unsigned short __a, unsigned char __b) {
9343   __b *= 2;
9344   unsigned char b1 = __b + 1;
9345   return vec_perm(__a, __a,
9346                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9347                                          __b, b1, __b, b1, __b, b1, __b, b1));
9348 }
9349
9350 static __inline__ vector bool short __ATTRS_o_ai
9351 vec_vsplth(vector bool short __a, unsigned char __b) {
9352   __b *= 2;
9353   unsigned char b1 = __b + 1;
9354   return vec_perm(__a, __a,
9355                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9356                                          __b, b1, __b, b1, __b, b1, __b, b1));
9357 }
9358
9359 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9360                                                        unsigned char __b) {
9361   __b *= 2;
9362   unsigned char b1 = __b + 1;
9363   return vec_perm(__a, __a,
9364                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9365                                          __b, b1, __b, b1, __b, b1, __b, b1));
9366 }
9367
9368 /* vec_vspltw */
9369
9370 #define __builtin_altivec_vspltw vec_vspltw
9371
9372 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9373                                                      unsigned char __b) {
9374   __b *= 4;
9375   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9376   return vec_perm(__a, __a,
9377                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9378                                          b1, b2, b3, __b, b1, b2, b3));
9379 }
9380
9381 static __inline__ vector unsigned int __ATTRS_o_ai
9382 vec_vspltw(vector unsigned int __a, unsigned char __b) {
9383   __b *= 4;
9384   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9385   return vec_perm(__a, __a,
9386                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9387                                          b1, b2, b3, __b, b1, b2, b3));
9388 }
9389
9390 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9391                                                           unsigned char __b) {
9392   __b *= 4;
9393   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9394   return vec_perm(__a, __a,
9395                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9396                                          b1, b2, b3, __b, b1, b2, b3));
9397 }
9398
9399 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9400                                                        unsigned char __b) {
9401   __b *= 4;
9402   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9403   return vec_perm(__a, __a,
9404                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9405                                          b1, b2, b3, __b, b1, b2, b3));
9406 }
9407
9408 /* vec_splat_s8 */
9409
9410 #define __builtin_altivec_vspltisb vec_splat_s8
9411
9412 // FIXME: parameter should be treated as 5-bit signed literal
9413 static __inline__ vector signed char __ATTRS_o_ai
9414 vec_splat_s8(signed char __a) {
9415   return (vector signed char)(__a);
9416 }
9417
9418 /* vec_vspltisb */
9419
9420 // FIXME: parameter should be treated as 5-bit signed literal
9421 static __inline__ vector signed char __ATTRS_o_ai
9422 vec_vspltisb(signed char __a) {
9423   return (vector signed char)(__a);
9424 }
9425
9426 /* vec_splat_s16 */
9427
9428 #define __builtin_altivec_vspltish vec_splat_s16
9429
9430 // FIXME: parameter should be treated as 5-bit signed literal
9431 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9432   return (vector short)(__a);
9433 }
9434
9435 /* vec_vspltish */
9436
9437 // FIXME: parameter should be treated as 5-bit signed literal
9438 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9439   return (vector short)(__a);
9440 }
9441
9442 /* vec_splat_s32 */
9443
9444 #define __builtin_altivec_vspltisw vec_splat_s32
9445
9446 // FIXME: parameter should be treated as 5-bit signed literal
9447 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9448   return (vector int)(__a);
9449 }
9450
9451 /* vec_vspltisw */
9452
9453 // FIXME: parameter should be treated as 5-bit signed literal
9454 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9455   return (vector int)(__a);
9456 }
9457
9458 /* vec_splat_u8 */
9459
9460 // FIXME: parameter should be treated as 5-bit signed literal
9461 static __inline__ vector unsigned char __ATTRS_o_ai
9462 vec_splat_u8(unsigned char __a) {
9463   return (vector unsigned char)(__a);
9464 }
9465
9466 /* vec_splat_u16 */
9467
9468 // FIXME: parameter should be treated as 5-bit signed literal
9469 static __inline__ vector unsigned short __ATTRS_o_ai
9470 vec_splat_u16(signed char __a) {
9471   return (vector unsigned short)(__a);
9472 }
9473
9474 /* vec_splat_u32 */
9475
9476 // FIXME: parameter should be treated as 5-bit signed literal
9477 static __inline__ vector unsigned int __ATTRS_o_ai
9478 vec_splat_u32(signed char __a) {
9479   return (vector unsigned int)(__a);
9480 }
9481
9482 /* vec_sr */
9483
9484 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
9485 // than the length of __a.
9486 static __inline__ vector unsigned char __ATTRS_o_ai
9487 vec_sr(vector unsigned char __a, vector unsigned char __b) {
9488   return __a >>
9489          (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
9490 }
9491
9492 static __inline__ vector signed char __ATTRS_o_ai
9493 vec_sr(vector signed char __a, vector unsigned char __b) {
9494   return (vector signed char)vec_sr((vector unsigned char)__a, __b);
9495 }
9496
9497 static __inline__ vector unsigned short __ATTRS_o_ai
9498 vec_sr(vector unsigned short __a, vector unsigned short __b) {
9499   return __a >>
9500          (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
9501 }
9502
9503 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
9504                                                    vector unsigned short __b) {
9505   return (vector short)vec_sr((vector unsigned short)__a, __b);
9506 }
9507
9508 static __inline__ vector unsigned int __ATTRS_o_ai
9509 vec_sr(vector unsigned int __a, vector unsigned int __b) {
9510   return __a >>
9511          (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
9512 }
9513
9514 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
9515                                                  vector unsigned int __b) {
9516   return (vector int)vec_sr((vector unsigned int)__a, __b);
9517 }
9518
9519 #ifdef __POWER8_VECTOR__
9520 static __inline__ vector unsigned long long __ATTRS_o_ai
9521 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9522   return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
9523                                                    __CHAR_BIT__));
9524 }
9525
9526 static __inline__ vector long long __ATTRS_o_ai
9527 vec_sr(vector long long __a, vector unsigned long long __b) {
9528   return (vector long long)vec_sr((vector unsigned long long)__a, __b);
9529 }
9530 #endif
9531
9532 /* vec_vsrb */
9533
9534 #define __builtin_altivec_vsrb vec_vsrb
9535
9536 static __inline__ vector signed char __ATTRS_o_ai
9537 vec_vsrb(vector signed char __a, vector unsigned char __b) {
9538   return vec_sr(__a, __b);
9539 }
9540
9541 static __inline__ vector unsigned char __ATTRS_o_ai
9542 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9543   return vec_sr(__a, __b);
9544 }
9545
9546 /* vec_vsrh */
9547
9548 #define __builtin_altivec_vsrh vec_vsrh
9549
9550 static __inline__ vector short __ATTRS_o_ai
9551 vec_vsrh(vector short __a, vector unsigned short __b) {
9552   return vec_sr(__a, __b);
9553 }
9554
9555 static __inline__ vector unsigned short __ATTRS_o_ai
9556 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9557   return vec_sr(__a, __b);
9558 }
9559
9560 /* vec_vsrw */
9561
9562 #define __builtin_altivec_vsrw vec_vsrw
9563
9564 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9565                                                    vector unsigned int __b) {
9566   return vec_sr(__a, __b);
9567 }
9568
9569 static __inline__ vector unsigned int __ATTRS_o_ai
9570 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9571   return vec_sr(__a, __b);
9572 }
9573
9574 /* vec_sra */
9575
9576 static __inline__ vector signed char __ATTRS_o_ai
9577 vec_sra(vector signed char __a, vector unsigned char __b) {
9578   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9579 }
9580
9581 static __inline__ vector unsigned char __ATTRS_o_ai
9582 vec_sra(vector unsigned char __a, vector unsigned char __b) {
9583   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9584 }
9585
9586 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9587                                                     vector unsigned short __b) {
9588   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9589 }
9590
9591 static __inline__ vector unsigned short __ATTRS_o_ai
9592 vec_sra(vector unsigned short __a, vector unsigned short __b) {
9593   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9594 }
9595
9596 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9597                                                   vector unsigned int __b) {
9598   return __builtin_altivec_vsraw(__a, __b);
9599 }
9600
9601 static __inline__ vector unsigned int __ATTRS_o_ai
9602 vec_sra(vector unsigned int __a, vector unsigned int __b) {
9603   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9604 }
9605
9606 #ifdef __POWER8_VECTOR__
9607 static __inline__ vector signed long long __ATTRS_o_ai
9608 vec_sra(vector signed long long __a, vector unsigned long long __b) {
9609   return __a >> __b;
9610 }
9611
9612 static __inline__ vector unsigned long long __ATTRS_o_ai
9613 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9614   return (vector unsigned long long)((vector signed long long)__a >> __b);
9615 }
9616 #endif
9617
9618 /* vec_vsrab */
9619
9620 static __inline__ vector signed char __ATTRS_o_ai
9621 vec_vsrab(vector signed char __a, vector unsigned char __b) {
9622   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9623 }
9624
9625 static __inline__ vector unsigned char __ATTRS_o_ai
9626 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9627   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9628 }
9629
9630 /* vec_vsrah */
9631
9632 static __inline__ vector short __ATTRS_o_ai
9633 vec_vsrah(vector short __a, vector unsigned short __b) {
9634   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9635 }
9636
9637 static __inline__ vector unsigned short __ATTRS_o_ai
9638 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9639   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9640 }
9641
9642 /* vec_vsraw */
9643
9644 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9645                                                     vector unsigned int __b) {
9646   return __builtin_altivec_vsraw(__a, __b);
9647 }
9648
9649 static __inline__ vector unsigned int __ATTRS_o_ai
9650 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9651   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9652 }
9653
9654 /* vec_srl */
9655
9656 static __inline__ vector signed char __ATTRS_o_ai
9657 vec_srl(vector signed char __a, vector unsigned char __b) {
9658   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9659                                                    (vector int)__b);
9660 }
9661
9662 static __inline__ vector signed char __ATTRS_o_ai
9663 vec_srl(vector signed char __a, vector unsigned short __b) {
9664   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9665                                                    (vector int)__b);
9666 }
9667
9668 static __inline__ vector signed char __ATTRS_o_ai
9669 vec_srl(vector signed char __a, vector unsigned int __b) {
9670   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9671                                                    (vector int)__b);
9672 }
9673
9674 static __inline__ vector unsigned char __ATTRS_o_ai
9675 vec_srl(vector unsigned char __a, vector unsigned char __b) {
9676   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9677                                                      (vector int)__b);
9678 }
9679
9680 static __inline__ vector unsigned char __ATTRS_o_ai
9681 vec_srl(vector unsigned char __a, vector unsigned short __b) {
9682   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9683                                                      (vector int)__b);
9684 }
9685
9686 static __inline__ vector unsigned char __ATTRS_o_ai
9687 vec_srl(vector unsigned char __a, vector unsigned int __b) {
9688   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9689                                                      (vector int)__b);
9690 }
9691
9692 static __inline__ vector bool char __ATTRS_o_ai
9693 vec_srl(vector bool char __a, vector unsigned char __b) {
9694   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9695                                                  (vector int)__b);
9696 }
9697
9698 static __inline__ vector bool char __ATTRS_o_ai
9699 vec_srl(vector bool char __a, vector unsigned short __b) {
9700   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9701                                                  (vector int)__b);
9702 }
9703
9704 static __inline__ vector bool char __ATTRS_o_ai
9705 vec_srl(vector bool char __a, vector unsigned int __b) {
9706   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9707                                                  (vector int)__b);
9708 }
9709
9710 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9711                                                     vector unsigned char __b) {
9712   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9713 }
9714
9715 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9716                                                     vector unsigned short __b) {
9717   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9718 }
9719
9720 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9721                                                     vector unsigned int __b) {
9722   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9723 }
9724
9725 static __inline__ vector unsigned short __ATTRS_o_ai
9726 vec_srl(vector unsigned short __a, vector unsigned char __b) {
9727   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9728                                                       (vector int)__b);
9729 }
9730
9731 static __inline__ vector unsigned short __ATTRS_o_ai
9732 vec_srl(vector unsigned short __a, vector unsigned short __b) {
9733   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9734                                                       (vector int)__b);
9735 }
9736
9737 static __inline__ vector unsigned short __ATTRS_o_ai
9738 vec_srl(vector unsigned short __a, vector unsigned int __b) {
9739   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9740                                                       (vector int)__b);
9741 }
9742
9743 static __inline__ vector bool short __ATTRS_o_ai
9744 vec_srl(vector bool short __a, vector unsigned char __b) {
9745   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9746                                                   (vector int)__b);
9747 }
9748
9749 static __inline__ vector bool short __ATTRS_o_ai
9750 vec_srl(vector bool short __a, vector unsigned short __b) {
9751   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9752                                                   (vector int)__b);
9753 }
9754
9755 static __inline__ vector bool short __ATTRS_o_ai
9756 vec_srl(vector bool short __a, vector unsigned int __b) {
9757   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9758                                                   (vector int)__b);
9759 }
9760
9761 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9762                                                     vector unsigned char __b) {
9763   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9764 }
9765
9766 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9767                                                     vector unsigned short __b) {
9768   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9769 }
9770
9771 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9772                                                     vector unsigned int __b) {
9773   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9774 }
9775
9776 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9777                                                   vector unsigned char __b) {
9778   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9779 }
9780
9781 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9782                                                   vector unsigned short __b) {
9783   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9784 }
9785
9786 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9787                                                   vector unsigned int __b) {
9788   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9789 }
9790
9791 static __inline__ vector unsigned int __ATTRS_o_ai
9792 vec_srl(vector unsigned int __a, vector unsigned char __b) {
9793   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9794                                                     (vector int)__b);
9795 }
9796
9797 static __inline__ vector unsigned int __ATTRS_o_ai
9798 vec_srl(vector unsigned int __a, vector unsigned short __b) {
9799   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9800                                                     (vector int)__b);
9801 }
9802
9803 static __inline__ vector unsigned int __ATTRS_o_ai
9804 vec_srl(vector unsigned int __a, vector unsigned int __b) {
9805   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9806                                                     (vector int)__b);
9807 }
9808
9809 static __inline__ vector bool int __ATTRS_o_ai
9810 vec_srl(vector bool int __a, vector unsigned char __b) {
9811   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9812                                                 (vector int)__b);
9813 }
9814
9815 static __inline__ vector bool int __ATTRS_o_ai
9816 vec_srl(vector bool int __a, vector unsigned short __b) {
9817   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9818                                                 (vector int)__b);
9819 }
9820
9821 static __inline__ vector bool int __ATTRS_o_ai
9822 vec_srl(vector bool int __a, vector unsigned int __b) {
9823   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9824                                                 (vector int)__b);
9825 }
9826
9827 #ifdef __VSX__
9828 static __inline__ vector signed long long __ATTRS_o_ai
9829 vec_srl(vector signed long long __a, vector unsigned char __b) {
9830   return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9831                                                         (vector int)__b);
9832 }
9833
9834 static __inline__ vector unsigned long long __ATTRS_o_ai
9835 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9836   return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9837                                                           (vector int)__b);
9838 }
9839 #endif
9840
9841 /* vec_vsr */
9842
9843 static __inline__ vector signed char __ATTRS_o_ai
9844 vec_vsr(vector signed char __a, vector unsigned char __b) {
9845   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9846                                                    (vector int)__b);
9847 }
9848
9849 static __inline__ vector signed char __ATTRS_o_ai
9850 vec_vsr(vector signed char __a, vector unsigned short __b) {
9851   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9852                                                    (vector int)__b);
9853 }
9854
9855 static __inline__ vector signed char __ATTRS_o_ai
9856 vec_vsr(vector signed char __a, vector unsigned int __b) {
9857   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9858                                                    (vector int)__b);
9859 }
9860
9861 static __inline__ vector unsigned char __ATTRS_o_ai
9862 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9863   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9864                                                      (vector int)__b);
9865 }
9866
9867 static __inline__ vector unsigned char __ATTRS_o_ai
9868 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9869   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9870                                                      (vector int)__b);
9871 }
9872
9873 static __inline__ vector unsigned char __ATTRS_o_ai
9874 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9875   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9876                                                      (vector int)__b);
9877 }
9878
9879 static __inline__ vector bool char __ATTRS_o_ai
9880 vec_vsr(vector bool char __a, vector unsigned char __b) {
9881   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9882                                                  (vector int)__b);
9883 }
9884
9885 static __inline__ vector bool char __ATTRS_o_ai
9886 vec_vsr(vector bool char __a, vector unsigned short __b) {
9887   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9888                                                  (vector int)__b);
9889 }
9890
9891 static __inline__ vector bool char __ATTRS_o_ai
9892 vec_vsr(vector bool char __a, vector unsigned int __b) {
9893   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9894                                                  (vector int)__b);
9895 }
9896
9897 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9898                                                     vector unsigned char __b) {
9899   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9900 }
9901
9902 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9903                                                     vector unsigned short __b) {
9904   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9905 }
9906
9907 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9908                                                     vector unsigned int __b) {
9909   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9910 }
9911
9912 static __inline__ vector unsigned short __ATTRS_o_ai
9913 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9914   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9915                                                       (vector int)__b);
9916 }
9917
9918 static __inline__ vector unsigned short __ATTRS_o_ai
9919 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9920   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9921                                                       (vector int)__b);
9922 }
9923
9924 static __inline__ vector unsigned short __ATTRS_o_ai
9925 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9926   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9927                                                       (vector int)__b);
9928 }
9929
9930 static __inline__ vector bool short __ATTRS_o_ai
9931 vec_vsr(vector bool short __a, vector unsigned char __b) {
9932   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9933                                                   (vector int)__b);
9934 }
9935
9936 static __inline__ vector bool short __ATTRS_o_ai
9937 vec_vsr(vector bool short __a, vector unsigned short __b) {
9938   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9939                                                   (vector int)__b);
9940 }
9941
9942 static __inline__ vector bool short __ATTRS_o_ai
9943 vec_vsr(vector bool short __a, vector unsigned int __b) {
9944   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9945                                                   (vector int)__b);
9946 }
9947
9948 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9949                                                     vector unsigned char __b) {
9950   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9951 }
9952
9953 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9954                                                     vector unsigned short __b) {
9955   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9956 }
9957
9958 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9959                                                     vector unsigned int __b) {
9960   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9961 }
9962
9963 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9964                                                   vector unsigned char __b) {
9965   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9966 }
9967
9968 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9969                                                   vector unsigned short __b) {
9970   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9971 }
9972
9973 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9974                                                   vector unsigned int __b) {
9975   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9976 }
9977
9978 static __inline__ vector unsigned int __ATTRS_o_ai
9979 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9980   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9981                                                     (vector int)__b);
9982 }
9983
9984 static __inline__ vector unsigned int __ATTRS_o_ai
9985 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9986   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9987                                                     (vector int)__b);
9988 }
9989
9990 static __inline__ vector unsigned int __ATTRS_o_ai
9991 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
9992   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9993                                                     (vector int)__b);
9994 }
9995
9996 static __inline__ vector bool int __ATTRS_o_ai
9997 vec_vsr(vector bool int __a, vector unsigned char __b) {
9998   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9999                                                 (vector int)__b);
10000 }
10001
10002 static __inline__ vector bool int __ATTRS_o_ai
10003 vec_vsr(vector bool int __a, vector unsigned short __b) {
10004   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10005                                                 (vector int)__b);
10006 }
10007
10008 static __inline__ vector bool int __ATTRS_o_ai
10009 vec_vsr(vector bool int __a, vector unsigned int __b) {
10010   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10011                                                 (vector int)__b);
10012 }
10013
10014 /* vec_sro */
10015
10016 static __inline__ vector signed char __ATTRS_o_ai
10017 vec_sro(vector signed char __a, vector signed char __b) {
10018   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10019                                                     (vector int)__b);
10020 }
10021
10022 static __inline__ vector signed char __ATTRS_o_ai
10023 vec_sro(vector signed char __a, vector unsigned char __b) {
10024   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10025                                                     (vector int)__b);
10026 }
10027
10028 static __inline__ vector unsigned char __ATTRS_o_ai
10029 vec_sro(vector unsigned char __a, vector signed char __b) {
10030   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10031                                                       (vector int)__b);
10032 }
10033
10034 static __inline__ vector unsigned char __ATTRS_o_ai
10035 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10036   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10037                                                       (vector int)__b);
10038 }
10039
10040 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10041                                                     vector signed char __b) {
10042   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10043 }
10044
10045 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10046                                                     vector unsigned char __b) {
10047   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10048 }
10049
10050 static __inline__ vector unsigned short __ATTRS_o_ai
10051 vec_sro(vector unsigned short __a, vector signed char __b) {
10052   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10053                                                        (vector int)__b);
10054 }
10055
10056 static __inline__ vector unsigned short __ATTRS_o_ai
10057 vec_sro(vector unsigned short __a, vector unsigned char __b) {
10058   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10059                                                        (vector int)__b);
10060 }
10061
10062 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10063                                                     vector signed char __b) {
10064   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10065 }
10066
10067 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10068                                                     vector unsigned char __b) {
10069   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10070 }
10071
10072 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10073                                                   vector signed char __b) {
10074   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10075 }
10076
10077 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10078                                                   vector unsigned char __b) {
10079   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10080 }
10081
10082 static __inline__ vector unsigned int __ATTRS_o_ai
10083 vec_sro(vector unsigned int __a, vector signed char __b) {
10084   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10085                                                      (vector int)__b);
10086 }
10087
10088 static __inline__ vector unsigned int __ATTRS_o_ai
10089 vec_sro(vector unsigned int __a, vector unsigned char __b) {
10090   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10091                                                      (vector int)__b);
10092 }
10093
10094 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10095                                                     vector signed char __b) {
10096   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10097 }
10098
10099 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10100                                                     vector unsigned char __b) {
10101   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10102 }
10103
10104 #ifdef __VSX__
10105 static __inline__ vector signed long long __ATTRS_o_ai
10106 vec_sro(vector signed long long __a, vector signed char __b) {
10107   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10108                                                          (vector int)__b);
10109 }
10110
10111 static __inline__ vector signed long long __ATTRS_o_ai
10112 vec_sro(vector signed long long __a, vector unsigned char __b) {
10113   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10114                                                          (vector int)__b);
10115 }
10116
10117 static __inline__ vector unsigned long long __ATTRS_o_ai
10118 vec_sro(vector unsigned long long __a, vector signed char __b) {
10119   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10120                                                            (vector int)__b);
10121 }
10122
10123 static __inline__ vector unsigned long long __ATTRS_o_ai
10124 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10125   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10126                                                            (vector int)__b);
10127 }
10128 #endif
10129
10130 /* vec_vsro */
10131
10132 static __inline__ vector signed char __ATTRS_o_ai
10133 vec_vsro(vector signed char __a, vector signed char __b) {
10134   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10135                                                     (vector int)__b);
10136 }
10137
10138 static __inline__ vector signed char __ATTRS_o_ai
10139 vec_vsro(vector signed char __a, vector unsigned char __b) {
10140   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10141                                                     (vector int)__b);
10142 }
10143
10144 static __inline__ vector unsigned char __ATTRS_o_ai
10145 vec_vsro(vector unsigned char __a, vector signed char __b) {
10146   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10147                                                       (vector int)__b);
10148 }
10149
10150 static __inline__ vector unsigned char __ATTRS_o_ai
10151 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10152   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10153                                                       (vector int)__b);
10154 }
10155
10156 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10157                                                      vector signed char __b) {
10158   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10159 }
10160
10161 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10162                                                      vector unsigned char __b) {
10163   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10164 }
10165
10166 static __inline__ vector unsigned short __ATTRS_o_ai
10167 vec_vsro(vector unsigned short __a, vector signed char __b) {
10168   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10169                                                        (vector int)__b);
10170 }
10171
10172 static __inline__ vector unsigned short __ATTRS_o_ai
10173 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10174   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10175                                                        (vector int)__b);
10176 }
10177
10178 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10179                                                      vector signed char __b) {
10180   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10181 }
10182
10183 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10184                                                      vector unsigned char __b) {
10185   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10186 }
10187
10188 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10189                                                    vector signed char __b) {
10190   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10191 }
10192
10193 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10194                                                    vector unsigned char __b) {
10195   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10196 }
10197
10198 static __inline__ vector unsigned int __ATTRS_o_ai
10199 vec_vsro(vector unsigned int __a, vector signed char __b) {
10200   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10201                                                      (vector int)__b);
10202 }
10203
10204 static __inline__ vector unsigned int __ATTRS_o_ai
10205 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10206   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10207                                                      (vector int)__b);
10208 }
10209
10210 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10211                                                      vector signed char __b) {
10212   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10213 }
10214
10215 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10216                                                      vector unsigned char __b) {
10217   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10218 }
10219
10220 /* vec_st */
10221
10222 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10223                                            vector signed char *__c) {
10224   __builtin_altivec_stvx((vector int)__a, __b, __c);
10225 }
10226
10227 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10228                                            signed char *__c) {
10229   __builtin_altivec_stvx((vector int)__a, __b, __c);
10230 }
10231
10232 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10233                                            vector unsigned char *__c) {
10234   __builtin_altivec_stvx((vector int)__a, __b, __c);
10235 }
10236
10237 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10238                                            unsigned char *__c) {
10239   __builtin_altivec_stvx((vector int)__a, __b, __c);
10240 }
10241
10242 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10243                                            signed char *__c) {
10244   __builtin_altivec_stvx((vector int)__a, __b, __c);
10245 }
10246
10247 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10248                                            unsigned char *__c) {
10249   __builtin_altivec_stvx((vector int)__a, __b, __c);
10250 }
10251
10252 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10253                                            vector bool char *__c) {
10254   __builtin_altivec_stvx((vector int)__a, __b, __c);
10255 }
10256
10257 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10258                                            vector short *__c) {
10259   __builtin_altivec_stvx((vector int)__a, __b, __c);
10260 }
10261
10262 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10263                                            short *__c) {
10264   __builtin_altivec_stvx((vector int)__a, __b, __c);
10265 }
10266
10267 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10268                                            vector unsigned short *__c) {
10269   __builtin_altivec_stvx((vector int)__a, __b, __c);
10270 }
10271
10272 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10273                                            unsigned short *__c) {
10274   __builtin_altivec_stvx((vector int)__a, __b, __c);
10275 }
10276
10277 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10278                                            short *__c) {
10279   __builtin_altivec_stvx((vector int)__a, __b, __c);
10280 }
10281
10282 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10283                                            unsigned short *__c) {
10284   __builtin_altivec_stvx((vector int)__a, __b, __c);
10285 }
10286
10287 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10288                                            vector bool short *__c) {
10289   __builtin_altivec_stvx((vector int)__a, __b, __c);
10290 }
10291
10292 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10293                                            short *__c) {
10294   __builtin_altivec_stvx((vector int)__a, __b, __c);
10295 }
10296
10297 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10298                                            unsigned short *__c) {
10299   __builtin_altivec_stvx((vector int)__a, __b, __c);
10300 }
10301
10302 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10303                                            vector pixel *__c) {
10304   __builtin_altivec_stvx((vector int)__a, __b, __c);
10305 }
10306
10307 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10308                                            vector int *__c) {
10309   __builtin_altivec_stvx(__a, __b, __c);
10310 }
10311
10312 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10313   __builtin_altivec_stvx(__a, __b, __c);
10314 }
10315
10316 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10317                                            vector unsigned int *__c) {
10318   __builtin_altivec_stvx((vector int)__a, __b, __c);
10319 }
10320
10321 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10322                                            unsigned int *__c) {
10323   __builtin_altivec_stvx((vector int)__a, __b, __c);
10324 }
10325
10326 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10327                                            int *__c) {
10328   __builtin_altivec_stvx((vector int)__a, __b, __c);
10329 }
10330
10331 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10332                                            unsigned int *__c) {
10333   __builtin_altivec_stvx((vector int)__a, __b, __c);
10334 }
10335
10336 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10337                                            vector bool int *__c) {
10338   __builtin_altivec_stvx((vector int)__a, __b, __c);
10339 }
10340
10341 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10342                                            vector float *__c) {
10343   __builtin_altivec_stvx((vector int)__a, __b, __c);
10344 }
10345
10346 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10347                                            float *__c) {
10348   __builtin_altivec_stvx((vector int)__a, __b, __c);
10349 }
10350
10351 /* vec_stvx */
10352
10353 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10354                                              vector signed char *__c) {
10355   __builtin_altivec_stvx((vector int)__a, __b, __c);
10356 }
10357
10358 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10359                                              signed char *__c) {
10360   __builtin_altivec_stvx((vector int)__a, __b, __c);
10361 }
10362
10363 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10364                                              vector unsigned char *__c) {
10365   __builtin_altivec_stvx((vector int)__a, __b, __c);
10366 }
10367
10368 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10369                                              unsigned char *__c) {
10370   __builtin_altivec_stvx((vector int)__a, __b, __c);
10371 }
10372
10373 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10374                                              signed char *__c) {
10375   __builtin_altivec_stvx((vector int)__a, __b, __c);
10376 }
10377
10378 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10379                                              unsigned char *__c) {
10380   __builtin_altivec_stvx((vector int)__a, __b, __c);
10381 }
10382
10383 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10384                                              vector bool char *__c) {
10385   __builtin_altivec_stvx((vector int)__a, __b, __c);
10386 }
10387
10388 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10389                                              vector short *__c) {
10390   __builtin_altivec_stvx((vector int)__a, __b, __c);
10391 }
10392
10393 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10394                                              short *__c) {
10395   __builtin_altivec_stvx((vector int)__a, __b, __c);
10396 }
10397
10398 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10399                                              vector unsigned short *__c) {
10400   __builtin_altivec_stvx((vector int)__a, __b, __c);
10401 }
10402
10403 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10404                                              unsigned short *__c) {
10405   __builtin_altivec_stvx((vector int)__a, __b, __c);
10406 }
10407
10408 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10409                                              short *__c) {
10410   __builtin_altivec_stvx((vector int)__a, __b, __c);
10411 }
10412
10413 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10414                                              unsigned short *__c) {
10415   __builtin_altivec_stvx((vector int)__a, __b, __c);
10416 }
10417
10418 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10419                                              vector bool short *__c) {
10420   __builtin_altivec_stvx((vector int)__a, __b, __c);
10421 }
10422
10423 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10424                                              short *__c) {
10425   __builtin_altivec_stvx((vector int)__a, __b, __c);
10426 }
10427
10428 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10429                                              unsigned short *__c) {
10430   __builtin_altivec_stvx((vector int)__a, __b, __c);
10431 }
10432
10433 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10434                                              vector pixel *__c) {
10435   __builtin_altivec_stvx((vector int)__a, __b, __c);
10436 }
10437
10438 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10439                                              vector int *__c) {
10440   __builtin_altivec_stvx(__a, __b, __c);
10441 }
10442
10443 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10444                                              int *__c) {
10445   __builtin_altivec_stvx(__a, __b, __c);
10446 }
10447
10448 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10449                                              vector unsigned int *__c) {
10450   __builtin_altivec_stvx((vector int)__a, __b, __c);
10451 }
10452
10453 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10454                                              unsigned int *__c) {
10455   __builtin_altivec_stvx((vector int)__a, __b, __c);
10456 }
10457
10458 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10459                                              int *__c) {
10460   __builtin_altivec_stvx((vector int)__a, __b, __c);
10461 }
10462
10463 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10464                                              unsigned int *__c) {
10465   __builtin_altivec_stvx((vector int)__a, __b, __c);
10466 }
10467
10468 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10469                                              vector bool int *__c) {
10470   __builtin_altivec_stvx((vector int)__a, __b, __c);
10471 }
10472
10473 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10474                                              vector float *__c) {
10475   __builtin_altivec_stvx((vector int)__a, __b, __c);
10476 }
10477
10478 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10479                                              float *__c) {
10480   __builtin_altivec_stvx((vector int)__a, __b, __c);
10481 }
10482
10483 /* vec_ste */
10484
10485 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10486                                             signed char *__c) {
10487   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10488 }
10489
10490 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10491                                             unsigned char *__c) {
10492   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10493 }
10494
10495 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10496                                             signed char *__c) {
10497   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10498 }
10499
10500 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10501                                             unsigned char *__c) {
10502   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10503 }
10504
10505 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10506                                             short *__c) {
10507   __builtin_altivec_stvehx(__a, __b, __c);
10508 }
10509
10510 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10511                                             unsigned short *__c) {
10512   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10513 }
10514
10515 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10516                                             short *__c) {
10517   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10518 }
10519
10520 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10521                                             unsigned short *__c) {
10522   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10523 }
10524
10525 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10526                                             short *__c) {
10527   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10528 }
10529
10530 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10531                                             unsigned short *__c) {
10532   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10533 }
10534
10535 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10536   __builtin_altivec_stvewx(__a, __b, __c);
10537 }
10538
10539 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10540                                             unsigned int *__c) {
10541   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10542 }
10543
10544 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10545                                             int *__c) {
10546   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10547 }
10548
10549 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10550                                             unsigned int *__c) {
10551   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10552 }
10553
10554 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10555                                             float *__c) {
10556   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10557 }
10558
10559 /* vec_stvebx */
10560
10561 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10562                                                signed char *__c) {
10563   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10564 }
10565
10566 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10567                                                int __b, unsigned char *__c) {
10568   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10569 }
10570
10571 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10572                                                signed char *__c) {
10573   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10574 }
10575
10576 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10577                                                unsigned char *__c) {
10578   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10579 }
10580
10581 /* vec_stvehx */
10582
10583 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10584                                                short *__c) {
10585   __builtin_altivec_stvehx(__a, __b, __c);
10586 }
10587
10588 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10589                                                int __b, unsigned short *__c) {
10590   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10591 }
10592
10593 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10594                                                short *__c) {
10595   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10596 }
10597
10598 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10599                                                unsigned short *__c) {
10600   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10601 }
10602
10603 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10604                                                short *__c) {
10605   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10606 }
10607
10608 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10609                                                unsigned short *__c) {
10610   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10611 }
10612
10613 /* vec_stvewx */
10614
10615 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10616                                                int *__c) {
10617   __builtin_altivec_stvewx(__a, __b, __c);
10618 }
10619
10620 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10621                                                unsigned int *__c) {
10622   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10623 }
10624
10625 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10626                                                int *__c) {
10627   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10628 }
10629
10630 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10631                                                unsigned int *__c) {
10632   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10633 }
10634
10635 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10636                                                float *__c) {
10637   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10638 }
10639
10640 /* vec_stl */
10641
10642 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10643                                             vector signed char *__c) {
10644   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10645 }
10646
10647 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10648                                             signed char *__c) {
10649   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10650 }
10651
10652 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10653                                             vector unsigned char *__c) {
10654   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10655 }
10656
10657 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10658                                             unsigned char *__c) {
10659   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10660 }
10661
10662 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10663                                             signed char *__c) {
10664   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10665 }
10666
10667 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10668                                             unsigned char *__c) {
10669   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10670 }
10671
10672 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10673                                             vector bool char *__c) {
10674   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10675 }
10676
10677 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10678                                             vector short *__c) {
10679   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10680 }
10681
10682 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10683                                             short *__c) {
10684   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10685 }
10686
10687 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10688                                             vector unsigned short *__c) {
10689   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10690 }
10691
10692 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10693                                             unsigned short *__c) {
10694   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10695 }
10696
10697 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10698                                             short *__c) {
10699   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10700 }
10701
10702 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10703                                             unsigned short *__c) {
10704   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10705 }
10706
10707 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10708                                             vector bool short *__c) {
10709   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10710 }
10711
10712 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10713                                             short *__c) {
10714   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10715 }
10716
10717 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10718                                             unsigned short *__c) {
10719   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10720 }
10721
10722 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10723                                             vector pixel *__c) {
10724   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10725 }
10726
10727 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10728                                             vector int *__c) {
10729   __builtin_altivec_stvxl(__a, __b, __c);
10730 }
10731
10732 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10733   __builtin_altivec_stvxl(__a, __b, __c);
10734 }
10735
10736 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10737                                             vector unsigned int *__c) {
10738   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10739 }
10740
10741 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10742                                             unsigned int *__c) {
10743   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10744 }
10745
10746 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10747                                             int *__c) {
10748   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10749 }
10750
10751 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10752                                             unsigned int *__c) {
10753   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10754 }
10755
10756 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10757                                             vector bool int *__c) {
10758   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10759 }
10760
10761 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10762                                             vector float *__c) {
10763   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10764 }
10765
10766 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10767                                             float *__c) {
10768   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10769 }
10770
10771 /* vec_stvxl */
10772
10773 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10774                                               vector signed char *__c) {
10775   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10776 }
10777
10778 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10779                                               signed char *__c) {
10780   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10781 }
10782
10783 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10784                                               vector unsigned char *__c) {
10785   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10786 }
10787
10788 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10789                                               unsigned char *__c) {
10790   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10791 }
10792
10793 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10794                                               signed char *__c) {
10795   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10796 }
10797
10798 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10799                                               unsigned char *__c) {
10800   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10801 }
10802
10803 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10804                                               vector bool char *__c) {
10805   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10806 }
10807
10808 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10809                                               vector short *__c) {
10810   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10811 }
10812
10813 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10814                                               short *__c) {
10815   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10816 }
10817
10818 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10819                                               int __b,
10820                                               vector unsigned short *__c) {
10821   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10822 }
10823
10824 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10825                                               int __b, unsigned short *__c) {
10826   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10827 }
10828
10829 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10830                                               short *__c) {
10831   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10832 }
10833
10834 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10835                                               unsigned short *__c) {
10836   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10837 }
10838
10839 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10840                                               vector bool short *__c) {
10841   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10842 }
10843
10844 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10845                                               short *__c) {
10846   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10847 }
10848
10849 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10850                                               unsigned short *__c) {
10851   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10852 }
10853
10854 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10855                                               vector pixel *__c) {
10856   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10857 }
10858
10859 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10860                                               vector int *__c) {
10861   __builtin_altivec_stvxl(__a, __b, __c);
10862 }
10863
10864 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10865                                               int *__c) {
10866   __builtin_altivec_stvxl(__a, __b, __c);
10867 }
10868
10869 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10870                                               vector unsigned int *__c) {
10871   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10872 }
10873
10874 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10875                                               unsigned int *__c) {
10876   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10877 }
10878
10879 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10880                                               int *__c) {
10881   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10882 }
10883
10884 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10885                                               unsigned int *__c) {
10886   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10887 }
10888
10889 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10890                                               vector bool int *__c) {
10891   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10892 }
10893
10894 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10895                                               vector float *__c) {
10896   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10897 }
10898
10899 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10900                                               float *__c) {
10901   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10902 }
10903
10904 /* vec_sub */
10905
10906 static __inline__ vector signed char __ATTRS_o_ai
10907 vec_sub(vector signed char __a, vector signed char __b) {
10908   return __a - __b;
10909 }
10910
10911 static __inline__ vector signed char __ATTRS_o_ai
10912 vec_sub(vector bool char __a, vector signed char __b) {
10913   return (vector signed char)__a - __b;
10914 }
10915
10916 static __inline__ vector signed char __ATTRS_o_ai
10917 vec_sub(vector signed char __a, vector bool char __b) {
10918   return __a - (vector signed char)__b;
10919 }
10920
10921 static __inline__ vector unsigned char __ATTRS_o_ai
10922 vec_sub(vector unsigned char __a, vector unsigned char __b) {
10923   return __a - __b;
10924 }
10925
10926 static __inline__ vector unsigned char __ATTRS_o_ai
10927 vec_sub(vector bool char __a, vector unsigned char __b) {
10928   return (vector unsigned char)__a - __b;
10929 }
10930
10931 static __inline__ vector unsigned char __ATTRS_o_ai
10932 vec_sub(vector unsigned char __a, vector bool char __b) {
10933   return __a - (vector unsigned char)__b;
10934 }
10935
10936 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10937                                                     vector short __b) {
10938   return __a - __b;
10939 }
10940
10941 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10942                                                     vector short __b) {
10943   return (vector short)__a - __b;
10944 }
10945
10946 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10947                                                     vector bool short __b) {
10948   return __a - (vector short)__b;
10949 }
10950
10951 static __inline__ vector unsigned short __ATTRS_o_ai
10952 vec_sub(vector unsigned short __a, vector unsigned short __b) {
10953   return __a - __b;
10954 }
10955
10956 static __inline__ vector unsigned short __ATTRS_o_ai
10957 vec_sub(vector bool short __a, vector unsigned short __b) {
10958   return (vector unsigned short)__a - __b;
10959 }
10960
10961 static __inline__ vector unsigned short __ATTRS_o_ai
10962 vec_sub(vector unsigned short __a, vector bool short __b) {
10963   return __a - (vector unsigned short)__b;
10964 }
10965
10966 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10967                                                   vector int __b) {
10968   return __a - __b;
10969 }
10970
10971 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10972                                                   vector int __b) {
10973   return (vector int)__a - __b;
10974 }
10975
10976 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10977                                                   vector bool int __b) {
10978   return __a - (vector int)__b;
10979 }
10980
10981 static __inline__ vector unsigned int __ATTRS_o_ai
10982 vec_sub(vector unsigned int __a, vector unsigned int __b) {
10983   return __a - __b;
10984 }
10985
10986 static __inline__ vector unsigned int __ATTRS_o_ai
10987 vec_sub(vector bool int __a, vector unsigned int __b) {
10988   return (vector unsigned int)__a - __b;
10989 }
10990
10991 static __inline__ vector unsigned int __ATTRS_o_ai
10992 vec_sub(vector unsigned int __a, vector bool int __b) {
10993   return __a - (vector unsigned int)__b;
10994 }
10995
10996 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
10997 static __inline__ vector signed __int128 __ATTRS_o_ai
10998 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
10999   return __a - __b;
11000 }
11001
11002 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11003 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11004   return __a - __b;
11005 }
11006 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11007
11008 #ifdef __VSX__
11009 static __inline__ vector signed long long __ATTRS_o_ai
11010 vec_sub(vector signed long long __a, vector signed long long __b) {
11011   return __a - __b;
11012 }
11013
11014 static __inline__ vector unsigned long long __ATTRS_o_ai
11015 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11016   return __a - __b;
11017 }
11018
11019 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11020                                                      vector double __b) {
11021   return __a - __b;
11022 }
11023 #endif
11024
11025 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11026                                                     vector float __b) {
11027   return __a - __b;
11028 }
11029
11030 /* vec_vsububm */
11031
11032 #define __builtin_altivec_vsububm vec_vsububm
11033
11034 static __inline__ vector signed char __ATTRS_o_ai
11035 vec_vsububm(vector signed char __a, vector signed char __b) {
11036   return __a - __b;
11037 }
11038
11039 static __inline__ vector signed char __ATTRS_o_ai
11040 vec_vsububm(vector bool char __a, vector signed char __b) {
11041   return (vector signed char)__a - __b;
11042 }
11043
11044 static __inline__ vector signed char __ATTRS_o_ai
11045 vec_vsububm(vector signed char __a, vector bool char __b) {
11046   return __a - (vector signed char)__b;
11047 }
11048
11049 static __inline__ vector unsigned char __ATTRS_o_ai
11050 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11051   return __a - __b;
11052 }
11053
11054 static __inline__ vector unsigned char __ATTRS_o_ai
11055 vec_vsububm(vector bool char __a, vector unsigned char __b) {
11056   return (vector unsigned char)__a - __b;
11057 }
11058
11059 static __inline__ vector unsigned char __ATTRS_o_ai
11060 vec_vsububm(vector unsigned char __a, vector bool char __b) {
11061   return __a - (vector unsigned char)__b;
11062 }
11063
11064 /* vec_vsubuhm */
11065
11066 #define __builtin_altivec_vsubuhm vec_vsubuhm
11067
11068 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11069                                                         vector short __b) {
11070   return __a - __b;
11071 }
11072
11073 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11074                                                         vector short __b) {
11075   return (vector short)__a - __b;
11076 }
11077
11078 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11079                                                         vector bool short __b) {
11080   return __a - (vector short)__b;
11081 }
11082
11083 static __inline__ vector unsigned short __ATTRS_o_ai
11084 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11085   return __a - __b;
11086 }
11087
11088 static __inline__ vector unsigned short __ATTRS_o_ai
11089 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11090   return (vector unsigned short)__a - __b;
11091 }
11092
11093 static __inline__ vector unsigned short __ATTRS_o_ai
11094 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11095   return __a - (vector unsigned short)__b;
11096 }
11097
11098 /* vec_vsubuwm */
11099
11100 #define __builtin_altivec_vsubuwm vec_vsubuwm
11101
11102 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11103                                                       vector int __b) {
11104   return __a - __b;
11105 }
11106
11107 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11108                                                       vector int __b) {
11109   return (vector int)__a - __b;
11110 }
11111
11112 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11113                                                       vector bool int __b) {
11114   return __a - (vector int)__b;
11115 }
11116
11117 static __inline__ vector unsigned int __ATTRS_o_ai
11118 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11119   return __a - __b;
11120 }
11121
11122 static __inline__ vector unsigned int __ATTRS_o_ai
11123 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11124   return (vector unsigned int)__a - __b;
11125 }
11126
11127 static __inline__ vector unsigned int __ATTRS_o_ai
11128 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11129   return __a - (vector unsigned int)__b;
11130 }
11131
11132 /* vec_vsubfp */
11133
11134 #define __builtin_altivec_vsubfp vec_vsubfp
11135
11136 static __inline__ vector float __attribute__((__always_inline__))
11137 vec_vsubfp(vector float __a, vector float __b) {
11138   return __a - __b;
11139 }
11140
11141 /* vec_subc */
11142
11143 static __inline__ vector signed int __ATTRS_o_ai
11144 vec_subc(vector signed int __a, vector signed int __b) {
11145   return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11146                                                       (vector unsigned int) __b);
11147 }
11148
11149 static __inline__ vector unsigned int __ATTRS_o_ai
11150 vec_subc(vector unsigned int __a, vector unsigned int __b) {
11151   return __builtin_altivec_vsubcuw(__a, __b);
11152 }
11153
11154 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11155 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11156 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11157   return __builtin_altivec_vsubcuq(__a, __b);
11158 }
11159
11160 static __inline__ vector signed __int128 __ATTRS_o_ai
11161 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11162   return __builtin_altivec_vsubcuq(__a, __b);
11163 }
11164 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11165
11166 /* vec_vsubcuw */
11167
11168 static __inline__ vector unsigned int __attribute__((__always_inline__))
11169 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11170   return __builtin_altivec_vsubcuw(__a, __b);
11171 }
11172
11173 /* vec_subs */
11174
11175 static __inline__ vector signed char __ATTRS_o_ai
11176 vec_subs(vector signed char __a, vector signed char __b) {
11177   return __builtin_altivec_vsubsbs(__a, __b);
11178 }
11179
11180 static __inline__ vector signed char __ATTRS_o_ai
11181 vec_subs(vector bool char __a, vector signed char __b) {
11182   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11183 }
11184
11185 static __inline__ vector signed char __ATTRS_o_ai
11186 vec_subs(vector signed char __a, vector bool char __b) {
11187   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11188 }
11189
11190 static __inline__ vector unsigned char __ATTRS_o_ai
11191 vec_subs(vector unsigned char __a, vector unsigned char __b) {
11192   return __builtin_altivec_vsububs(__a, __b);
11193 }
11194
11195 static __inline__ vector unsigned char __ATTRS_o_ai
11196 vec_subs(vector bool char __a, vector unsigned char __b) {
11197   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11198 }
11199
11200 static __inline__ vector unsigned char __ATTRS_o_ai
11201 vec_subs(vector unsigned char __a, vector bool char __b) {
11202   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11203 }
11204
11205 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11206                                                      vector short __b) {
11207   return __builtin_altivec_vsubshs(__a, __b);
11208 }
11209
11210 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11211                                                      vector short __b) {
11212   return __builtin_altivec_vsubshs((vector short)__a, __b);
11213 }
11214
11215 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11216                                                      vector bool short __b) {
11217   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11218 }
11219
11220 static __inline__ vector unsigned short __ATTRS_o_ai
11221 vec_subs(vector unsigned short __a, vector unsigned short __b) {
11222   return __builtin_altivec_vsubuhs(__a, __b);
11223 }
11224
11225 static __inline__ vector unsigned short __ATTRS_o_ai
11226 vec_subs(vector bool short __a, vector unsigned short __b) {
11227   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11228 }
11229
11230 static __inline__ vector unsigned short __ATTRS_o_ai
11231 vec_subs(vector unsigned short __a, vector bool short __b) {
11232   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11233 }
11234
11235 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11236                                                    vector int __b) {
11237   return __builtin_altivec_vsubsws(__a, __b);
11238 }
11239
11240 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11241                                                    vector int __b) {
11242   return __builtin_altivec_vsubsws((vector int)__a, __b);
11243 }
11244
11245 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11246                                                    vector bool int __b) {
11247   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11248 }
11249
11250 static __inline__ vector unsigned int __ATTRS_o_ai
11251 vec_subs(vector unsigned int __a, vector unsigned int __b) {
11252   return __builtin_altivec_vsubuws(__a, __b);
11253 }
11254
11255 static __inline__ vector unsigned int __ATTRS_o_ai
11256 vec_subs(vector bool int __a, vector unsigned int __b) {
11257   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11258 }
11259
11260 static __inline__ vector unsigned int __ATTRS_o_ai
11261 vec_subs(vector unsigned int __a, vector bool int __b) {
11262   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11263 }
11264
11265 /* vec_vsubsbs */
11266
11267 static __inline__ vector signed char __ATTRS_o_ai
11268 vec_vsubsbs(vector signed char __a, vector signed char __b) {
11269   return __builtin_altivec_vsubsbs(__a, __b);
11270 }
11271
11272 static __inline__ vector signed char __ATTRS_o_ai
11273 vec_vsubsbs(vector bool char __a, vector signed char __b) {
11274   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11275 }
11276
11277 static __inline__ vector signed char __ATTRS_o_ai
11278 vec_vsubsbs(vector signed char __a, vector bool char __b) {
11279   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11280 }
11281
11282 /* vec_vsububs */
11283
11284 static __inline__ vector unsigned char __ATTRS_o_ai
11285 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11286   return __builtin_altivec_vsububs(__a, __b);
11287 }
11288
11289 static __inline__ vector unsigned char __ATTRS_o_ai
11290 vec_vsububs(vector bool char __a, vector unsigned char __b) {
11291   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11292 }
11293
11294 static __inline__ vector unsigned char __ATTRS_o_ai
11295 vec_vsububs(vector unsigned char __a, vector bool char __b) {
11296   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11297 }
11298
11299 /* vec_vsubshs */
11300
11301 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11302                                                         vector short __b) {
11303   return __builtin_altivec_vsubshs(__a, __b);
11304 }
11305
11306 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11307                                                         vector short __b) {
11308   return __builtin_altivec_vsubshs((vector short)__a, __b);
11309 }
11310
11311 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11312                                                         vector bool short __b) {
11313   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11314 }
11315
11316 /* vec_vsubuhs */
11317
11318 static __inline__ vector unsigned short __ATTRS_o_ai
11319 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11320   return __builtin_altivec_vsubuhs(__a, __b);
11321 }
11322
11323 static __inline__ vector unsigned short __ATTRS_o_ai
11324 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11325   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11326 }
11327
11328 static __inline__ vector unsigned short __ATTRS_o_ai
11329 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11330   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11331 }
11332
11333 /* vec_vsubsws */
11334
11335 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11336                                                       vector int __b) {
11337   return __builtin_altivec_vsubsws(__a, __b);
11338 }
11339
11340 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11341                                                       vector int __b) {
11342   return __builtin_altivec_vsubsws((vector int)__a, __b);
11343 }
11344
11345 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11346                                                       vector bool int __b) {
11347   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11348 }
11349
11350 /* vec_vsubuws */
11351
11352 static __inline__ vector unsigned int __ATTRS_o_ai
11353 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11354   return __builtin_altivec_vsubuws(__a, __b);
11355 }
11356
11357 static __inline__ vector unsigned int __ATTRS_o_ai
11358 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11359   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11360 }
11361
11362 static __inline__ vector unsigned int __ATTRS_o_ai
11363 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11364   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11365 }
11366
11367 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11368 /* vec_vsubuqm */
11369
11370 static __inline__ vector signed __int128 __ATTRS_o_ai
11371 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11372   return __a - __b;
11373 }
11374
11375 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11376 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11377   return __a - __b;
11378 }
11379
11380 /* vec_vsubeuqm */
11381
11382
11383 static __inline__ vector signed __int128 __ATTRS_o_ai
11384 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11385              vector signed __int128 __c) {
11386   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11387 }
11388
11389 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11390 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11391              vector unsigned __int128 __c) {
11392   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11393 }
11394
11395 static __inline__ vector signed __int128 __ATTRS_o_ai
11396 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11397              vector signed __int128 __c) {
11398   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11399 }
11400
11401 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11402 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11403              vector unsigned __int128 __c) {
11404   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11405 }
11406
11407 /* vec_vsubcuq */
11408
11409 static __inline__ vector signed __int128 __ATTRS_o_ai
11410 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11411   return __builtin_altivec_vsubcuq(__a, __b);
11412 }
11413
11414 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11415 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11416   return __builtin_altivec_vsubcuq(__a, __b);
11417 }
11418
11419 /* vec_vsubecuq */
11420
11421 static __inline__ vector signed __int128 __ATTRS_o_ai
11422 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11423              vector signed __int128 __c) {
11424   return __builtin_altivec_vsubecuq(__a, __b, __c);
11425 }
11426
11427 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11428 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11429              vector unsigned __int128 __c) {
11430   return __builtin_altivec_vsubecuq(__a, __b, __c);
11431 }
11432
11433 static __inline__ vector signed int __ATTRS_o_ai
11434 vec_subec(vector signed int __a, vector signed int __b,
11435              vector signed int __c) {
11436   return vec_addec(__a, ~__b, __c);
11437 }
11438
11439 static __inline__ vector unsigned int __ATTRS_o_ai
11440 vec_subec(vector unsigned int __a, vector unsigned int __b,
11441              vector unsigned int __c) {
11442   return vec_addec(__a, ~__b, __c);
11443 }
11444
11445 static __inline__ vector signed __int128 __ATTRS_o_ai
11446 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11447              vector signed __int128 __c) {
11448   return __builtin_altivec_vsubecuq(__a, __b, __c);
11449 }
11450
11451 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11452 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11453              vector unsigned __int128 __c) {
11454   return __builtin_altivec_vsubecuq(__a, __b, __c);
11455 }
11456 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11457
11458 static __inline__ vector signed int __ATTRS_o_ai
11459 vec_sube(vector signed int __a, vector signed int __b,
11460          vector signed int __c) {
11461   vector signed int __mask = {1, 1, 1, 1};
11462   vector signed int __carry = __c & __mask;
11463   return vec_adde(__a, ~__b, __carry);
11464 }
11465
11466 static __inline__ vector unsigned int __ATTRS_o_ai
11467 vec_sube(vector unsigned int __a, vector unsigned int __b,
11468          vector unsigned int __c) {
11469   vector unsigned int __mask = {1, 1, 1, 1};
11470   vector unsigned int __carry = __c & __mask;
11471   return vec_adde(__a, ~__b, __carry);
11472 }
11473 /* vec_sum4s */
11474
11475 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11476                                                     vector int __b) {
11477   return __builtin_altivec_vsum4sbs(__a, __b);
11478 }
11479
11480 static __inline__ vector unsigned int __ATTRS_o_ai
11481 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11482   return __builtin_altivec_vsum4ubs(__a, __b);
11483 }
11484
11485 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11486                                                     vector int __b) {
11487   return __builtin_altivec_vsum4shs(__a, __b);
11488 }
11489
11490 /* vec_vsum4sbs */
11491
11492 static __inline__ vector int __attribute__((__always_inline__))
11493 vec_vsum4sbs(vector signed char __a, vector int __b) {
11494   return __builtin_altivec_vsum4sbs(__a, __b);
11495 }
11496
11497 /* vec_vsum4ubs */
11498
11499 static __inline__ vector unsigned int __attribute__((__always_inline__))
11500 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11501   return __builtin_altivec_vsum4ubs(__a, __b);
11502 }
11503
11504 /* vec_vsum4shs */
11505
11506 static __inline__ vector int __attribute__((__always_inline__))
11507 vec_vsum4shs(vector signed short __a, vector int __b) {
11508   return __builtin_altivec_vsum4shs(__a, __b);
11509 }
11510
11511 /* vec_sum2s */
11512
11513 /* The vsum2sws instruction has a big-endian bias, so that the second
11514    input vector and the result always reference big-endian elements
11515    1 and 3 (little-endian element 0 and 2).  For ease of porting the
11516    programmer wants elements 1 and 3 in both cases, so for little
11517    endian we must perform some permutes.  */
11518
11519 static __inline__ vector signed int __attribute__((__always_inline__))
11520 vec_sum2s(vector int __a, vector int __b) {
11521 #ifdef __LITTLE_ENDIAN__
11522   vector int __c = (vector signed int)vec_perm(
11523       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11524                                        8, 9, 10, 11));
11525   __c = __builtin_altivec_vsum2sws(__a, __c);
11526   return (vector signed int)vec_perm(
11527       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11528                                        8, 9, 10, 11));
11529 #else
11530   return __builtin_altivec_vsum2sws(__a, __b);
11531 #endif
11532 }
11533
11534 /* vec_vsum2sws */
11535
11536 static __inline__ vector signed int __attribute__((__always_inline__))
11537 vec_vsum2sws(vector int __a, vector int __b) {
11538 #ifdef __LITTLE_ENDIAN__
11539   vector int __c = (vector signed int)vec_perm(
11540       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11541                                        8, 9, 10, 11));
11542   __c = __builtin_altivec_vsum2sws(__a, __c);
11543   return (vector signed int)vec_perm(
11544       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11545                                        8, 9, 10, 11));
11546 #else
11547   return __builtin_altivec_vsum2sws(__a, __b);
11548 #endif
11549 }
11550
11551 /* vec_sums */
11552
11553 /* The vsumsws instruction has a big-endian bias, so that the second
11554    input vector and the result always reference big-endian element 3
11555    (little-endian element 0).  For ease of porting the programmer
11556    wants element 3 in both cases, so for little endian we must perform
11557    some permutes.  */
11558
11559 static __inline__ vector signed int __attribute__((__always_inline__))
11560 vec_sums(vector signed int __a, vector signed int __b) {
11561 #ifdef __LITTLE_ENDIAN__
11562   __b = (vector signed int)vec_splat(__b, 3);
11563   __b = __builtin_altivec_vsumsws(__a, __b);
11564   return (vector signed int)(0, 0, 0, __b[0]);
11565 #else
11566   return __builtin_altivec_vsumsws(__a, __b);
11567 #endif
11568 }
11569
11570 /* vec_vsumsws */
11571
11572 static __inline__ vector signed int __attribute__((__always_inline__))
11573 vec_vsumsws(vector signed int __a, vector signed int __b) {
11574 #ifdef __LITTLE_ENDIAN__
11575   __b = (vector signed int)vec_splat(__b, 3);
11576   __b = __builtin_altivec_vsumsws(__a, __b);
11577   return (vector signed int)(0, 0, 0, __b[0]);
11578 #else
11579   return __builtin_altivec_vsumsws(__a, __b);
11580 #endif
11581 }
11582
11583 /* vec_trunc */
11584
11585 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11586 #ifdef __VSX__
11587   return __builtin_vsx_xvrspiz(__a);
11588 #else
11589   return __builtin_altivec_vrfiz(__a);
11590 #endif
11591 }
11592
11593 #ifdef __VSX__
11594 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11595   return __builtin_vsx_xvrdpiz(__a);
11596 }
11597 #endif
11598
11599 /* vec_vrfiz */
11600
11601 static __inline__ vector float __attribute__((__always_inline__))
11602 vec_vrfiz(vector float __a) {
11603   return __builtin_altivec_vrfiz(__a);
11604 }
11605
11606 /* vec_unpackh */
11607
11608 /* The vector unpack instructions all have a big-endian bias, so for
11609    little endian we must reverse the meanings of "high" and "low."  */
11610
11611 static __inline__ vector short __ATTRS_o_ai
11612 vec_unpackh(vector signed char __a) {
11613 #ifdef __LITTLE_ENDIAN__
11614   return __builtin_altivec_vupklsb((vector char)__a);
11615 #else
11616   return __builtin_altivec_vupkhsb((vector char)__a);
11617 #endif
11618 }
11619
11620 static __inline__ vector bool short __ATTRS_o_ai
11621 vec_unpackh(vector bool char __a) {
11622 #ifdef __LITTLE_ENDIAN__
11623   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11624 #else
11625   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11626 #endif
11627 }
11628
11629 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11630 #ifdef __LITTLE_ENDIAN__
11631   return __builtin_altivec_vupklsh(__a);
11632 #else
11633   return __builtin_altivec_vupkhsh(__a);
11634 #endif
11635 }
11636
11637 static __inline__ vector bool int __ATTRS_o_ai
11638 vec_unpackh(vector bool short __a) {
11639 #ifdef __LITTLE_ENDIAN__
11640   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11641 #else
11642   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11643 #endif
11644 }
11645
11646 static __inline__ vector unsigned int __ATTRS_o_ai
11647 vec_unpackh(vector pixel __a) {
11648 #ifdef __LITTLE_ENDIAN__
11649   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11650 #else
11651   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11652 #endif
11653 }
11654
11655 #ifdef __POWER8_VECTOR__
11656 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11657 #ifdef __LITTLE_ENDIAN__
11658   return __builtin_altivec_vupklsw(__a);
11659 #else
11660   return __builtin_altivec_vupkhsw(__a);
11661 #endif
11662 }
11663
11664 static __inline__ vector bool long long __ATTRS_o_ai
11665 vec_unpackh(vector bool int __a) {
11666 #ifdef __LITTLE_ENDIAN__
11667   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11668 #else
11669   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11670 #endif
11671 }
11672
11673 static __inline__ vector double __ATTRS_o_ai
11674 vec_unpackh(vector float __a) {
11675   return (vector double)(__a[0], __a[1]);
11676 }
11677 #endif
11678
11679 /* vec_vupkhsb */
11680
11681 static __inline__ vector short __ATTRS_o_ai
11682 vec_vupkhsb(vector signed char __a) {
11683 #ifdef __LITTLE_ENDIAN__
11684   return __builtin_altivec_vupklsb((vector char)__a);
11685 #else
11686   return __builtin_altivec_vupkhsb((vector char)__a);
11687 #endif
11688 }
11689
11690 static __inline__ vector bool short __ATTRS_o_ai
11691 vec_vupkhsb(vector bool char __a) {
11692 #ifdef __LITTLE_ENDIAN__
11693   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11694 #else
11695   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11696 #endif
11697 }
11698
11699 /* vec_vupkhsh */
11700
11701 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11702 #ifdef __LITTLE_ENDIAN__
11703   return __builtin_altivec_vupklsh(__a);
11704 #else
11705   return __builtin_altivec_vupkhsh(__a);
11706 #endif
11707 }
11708
11709 static __inline__ vector bool int __ATTRS_o_ai
11710 vec_vupkhsh(vector bool short __a) {
11711 #ifdef __LITTLE_ENDIAN__
11712   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11713 #else
11714   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11715 #endif
11716 }
11717
11718 static __inline__ vector unsigned int __ATTRS_o_ai
11719 vec_vupkhsh(vector pixel __a) {
11720 #ifdef __LITTLE_ENDIAN__
11721   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11722 #else
11723   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11724 #endif
11725 }
11726
11727 /* vec_vupkhsw */
11728
11729 #ifdef __POWER8_VECTOR__
11730 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11731 #ifdef __LITTLE_ENDIAN__
11732   return __builtin_altivec_vupklsw(__a);
11733 #else
11734   return __builtin_altivec_vupkhsw(__a);
11735 #endif
11736 }
11737
11738 static __inline__ vector bool long long __ATTRS_o_ai
11739 vec_vupkhsw(vector bool int __a) {
11740 #ifdef __LITTLE_ENDIAN__
11741   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11742 #else
11743   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11744 #endif
11745 }
11746 #endif
11747
11748 /* vec_unpackl */
11749
11750 static __inline__ vector short __ATTRS_o_ai
11751 vec_unpackl(vector signed char __a) {
11752 #ifdef __LITTLE_ENDIAN__
11753   return __builtin_altivec_vupkhsb((vector char)__a);
11754 #else
11755   return __builtin_altivec_vupklsb((vector char)__a);
11756 #endif
11757 }
11758
11759 static __inline__ vector bool short __ATTRS_o_ai
11760 vec_unpackl(vector bool char __a) {
11761 #ifdef __LITTLE_ENDIAN__
11762   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11763 #else
11764   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11765 #endif
11766 }
11767
11768 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11769 #ifdef __LITTLE_ENDIAN__
11770   return __builtin_altivec_vupkhsh(__a);
11771 #else
11772   return __builtin_altivec_vupklsh(__a);
11773 #endif
11774 }
11775
11776 static __inline__ vector bool int __ATTRS_o_ai
11777 vec_unpackl(vector bool short __a) {
11778 #ifdef __LITTLE_ENDIAN__
11779   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11780 #else
11781   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11782 #endif
11783 }
11784
11785 static __inline__ vector unsigned int __ATTRS_o_ai
11786 vec_unpackl(vector pixel __a) {
11787 #ifdef __LITTLE_ENDIAN__
11788   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11789 #else
11790   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11791 #endif
11792 }
11793
11794 #ifdef __POWER8_VECTOR__
11795 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11796 #ifdef __LITTLE_ENDIAN__
11797   return __builtin_altivec_vupkhsw(__a);
11798 #else
11799   return __builtin_altivec_vupklsw(__a);
11800 #endif
11801 }
11802
11803 static __inline__ vector bool long long __ATTRS_o_ai
11804 vec_unpackl(vector bool int __a) {
11805 #ifdef __LITTLE_ENDIAN__
11806   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11807 #else
11808   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11809 #endif
11810 }
11811
11812 static __inline__ vector double __ATTRS_o_ai
11813 vec_unpackl(vector float __a) {
11814   return (vector double)(__a[2], __a[3]);
11815 }
11816 #endif
11817
11818 /* vec_vupklsb */
11819
11820 static __inline__ vector short __ATTRS_o_ai
11821 vec_vupklsb(vector signed char __a) {
11822 #ifdef __LITTLE_ENDIAN__
11823   return __builtin_altivec_vupkhsb((vector char)__a);
11824 #else
11825   return __builtin_altivec_vupklsb((vector char)__a);
11826 #endif
11827 }
11828
11829 static __inline__ vector bool short __ATTRS_o_ai
11830 vec_vupklsb(vector bool char __a) {
11831 #ifdef __LITTLE_ENDIAN__
11832   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11833 #else
11834   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11835 #endif
11836 }
11837
11838 /* vec_vupklsh */
11839
11840 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11841 #ifdef __LITTLE_ENDIAN__
11842   return __builtin_altivec_vupkhsh(__a);
11843 #else
11844   return __builtin_altivec_vupklsh(__a);
11845 #endif
11846 }
11847
11848 static __inline__ vector bool int __ATTRS_o_ai
11849 vec_vupklsh(vector bool short __a) {
11850 #ifdef __LITTLE_ENDIAN__
11851   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11852 #else
11853   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11854 #endif
11855 }
11856
11857 static __inline__ vector unsigned int __ATTRS_o_ai
11858 vec_vupklsh(vector pixel __a) {
11859 #ifdef __LITTLE_ENDIAN__
11860   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11861 #else
11862   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11863 #endif
11864 }
11865
11866 /* vec_vupklsw */
11867
11868 #ifdef __POWER8_VECTOR__
11869 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11870 #ifdef __LITTLE_ENDIAN__
11871   return __builtin_altivec_vupkhsw(__a);
11872 #else
11873   return __builtin_altivec_vupklsw(__a);
11874 #endif
11875 }
11876
11877 static __inline__ vector bool long long __ATTRS_o_ai
11878 vec_vupklsw(vector bool int __a) {
11879 #ifdef __LITTLE_ENDIAN__
11880   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11881 #else
11882   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11883 #endif
11884 }
11885 #endif
11886
11887 /* vec_vsx_ld */
11888
11889 #ifdef __VSX__
11890
11891 static __inline__ vector bool int __ATTRS_o_ai
11892 vec_vsx_ld(int __a, const vector bool int *__b) {
11893   return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11894 }
11895
11896 static __inline__ vector signed int __ATTRS_o_ai
11897 vec_vsx_ld(int __a, const vector signed int *__b) {
11898   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11899 }
11900
11901 static __inline__ vector signed int __ATTRS_o_ai
11902 vec_vsx_ld(int __a, const signed int *__b) {
11903   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11904 }
11905
11906 static __inline__ vector unsigned int __ATTRS_o_ai
11907 vec_vsx_ld(int __a, const vector unsigned int *__b) {
11908   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11909 }
11910
11911 static __inline__ vector unsigned int __ATTRS_o_ai
11912 vec_vsx_ld(int __a, const unsigned int *__b) {
11913   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11914 }
11915
11916 static __inline__ vector float __ATTRS_o_ai
11917 vec_vsx_ld(int __a, const vector float *__b) {
11918   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11919 }
11920
11921 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11922                                                        const float *__b) {
11923   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11924 }
11925
11926 static __inline__ vector signed long long __ATTRS_o_ai
11927 vec_vsx_ld(int __a, const vector signed long long *__b) {
11928   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11929 }
11930
11931 static __inline__ vector unsigned long long __ATTRS_o_ai
11932 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11933   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11934 }
11935
11936 static __inline__ vector double __ATTRS_o_ai
11937 vec_vsx_ld(int __a, const vector double *__b) {
11938   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11939 }
11940
11941 static __inline__ vector double __ATTRS_o_ai
11942 vec_vsx_ld(int __a, const double *__b) {
11943   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11944 }
11945
11946 static __inline__ vector bool short __ATTRS_o_ai
11947 vec_vsx_ld(int __a, const vector bool short *__b) {
11948   return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11949 }
11950
11951 static __inline__ vector signed short __ATTRS_o_ai
11952 vec_vsx_ld(int __a, const vector signed short *__b) {
11953   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11954 }
11955
11956 static __inline__ vector signed short __ATTRS_o_ai
11957 vec_vsx_ld(int __a, const signed short *__b) {
11958   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11959 }
11960
11961 static __inline__ vector unsigned short __ATTRS_o_ai
11962 vec_vsx_ld(int __a, const vector unsigned short *__b) {
11963   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11964 }
11965
11966 static __inline__ vector unsigned short __ATTRS_o_ai
11967 vec_vsx_ld(int __a, const unsigned short *__b) {
11968   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11969 }
11970
11971 static __inline__ vector bool char __ATTRS_o_ai
11972 vec_vsx_ld(int __a, const vector bool char *__b) {
11973   return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11974 }
11975
11976 static __inline__ vector signed char __ATTRS_o_ai
11977 vec_vsx_ld(int __a, const vector signed char *__b) {
11978   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11979 }
11980
11981 static __inline__ vector signed char __ATTRS_o_ai
11982 vec_vsx_ld(int __a, const signed char *__b) {
11983   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11984 }
11985
11986 static __inline__ vector unsigned char __ATTRS_o_ai
11987 vec_vsx_ld(int __a, const vector unsigned char *__b) {
11988   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11989 }
11990
11991 static __inline__ vector unsigned char __ATTRS_o_ai
11992 vec_vsx_ld(int __a, const unsigned char *__b) {
11993   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11994 }
11995
11996 #endif
11997
11998 /* vec_vsx_st */
11999
12000 #ifdef __VSX__
12001
12002 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12003                                                vector bool int *__c) {
12004   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12005 }
12006
12007 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12008                                                signed int *__c) {
12009   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12010 }
12011
12012 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12013                                                unsigned int *__c) {
12014   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12015 }
12016
12017 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12018                                                vector signed int *__c) {
12019   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12020 }
12021
12022 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12023                                                signed int *__c) {
12024   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12025 }
12026
12027 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12028                                                vector unsigned int *__c) {
12029   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12030 }
12031
12032 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12033                                                unsigned int *__c) {
12034   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12035 }
12036
12037 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12038                                                vector float *__c) {
12039   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12040 }
12041
12042 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12043                                                float *__c) {
12044   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12045 }
12046
12047 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12048                                                int __b,
12049                                                vector signed long long *__c) {
12050   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12051 }
12052
12053 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12054                                                int __b,
12055                                                vector unsigned long long *__c) {
12056   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12057 }
12058
12059 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12060                                                vector double *__c) {
12061   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12062 }
12063
12064 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12065                                                double *__c) {
12066   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12067 }
12068
12069 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12070                                                vector bool short *__c) {
12071   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12072 }
12073
12074 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12075                                                signed short *__c) {
12076   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12077 }
12078
12079 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12080                                                unsigned short *__c) {
12081   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12082 }
12083 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12084                                                vector signed short *__c) {
12085   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12086 }
12087
12088 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12089                                                signed short *__c) {
12090   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12091 }
12092
12093 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12094                                                int __b,
12095                                                vector unsigned short *__c) {
12096   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12097 }
12098
12099 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12100                                                int __b, unsigned short *__c) {
12101   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12102 }
12103
12104 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12105                                                vector bool char *__c) {
12106   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12107 }
12108
12109 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12110                                                signed char *__c) {
12111   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12112 }
12113
12114 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12115                                                unsigned char *__c) {
12116   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12117 }
12118
12119 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12120                                                vector signed char *__c) {
12121   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12122 }
12123
12124 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12125                                                signed char *__c) {
12126   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12127 }
12128
12129 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12130                                                int __b,
12131                                                vector unsigned char *__c) {
12132   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12133 }
12134
12135 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12136                                                int __b, unsigned char *__c) {
12137   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12138 }
12139
12140 #endif
12141
12142 #ifdef __VSX__
12143 #define vec_xxpermdi __builtin_vsx_xxpermdi
12144 #define vec_xxsldwi __builtin_vsx_xxsldwi
12145 #endif
12146
12147 /* vec_xor */
12148
12149 #define __builtin_altivec_vxor vec_xor
12150
12151 static __inline__ vector signed char __ATTRS_o_ai
12152 vec_xor(vector signed char __a, vector signed char __b) {
12153   return __a ^ __b;
12154 }
12155
12156 static __inline__ vector signed char __ATTRS_o_ai
12157 vec_xor(vector bool char __a, vector signed char __b) {
12158   return (vector signed char)__a ^ __b;
12159 }
12160
12161 static __inline__ vector signed char __ATTRS_o_ai
12162 vec_xor(vector signed char __a, vector bool char __b) {
12163   return __a ^ (vector signed char)__b;
12164 }
12165
12166 static __inline__ vector unsigned char __ATTRS_o_ai
12167 vec_xor(vector unsigned char __a, vector unsigned char __b) {
12168   return __a ^ __b;
12169 }
12170
12171 static __inline__ vector unsigned char __ATTRS_o_ai
12172 vec_xor(vector bool char __a, vector unsigned char __b) {
12173   return (vector unsigned char)__a ^ __b;
12174 }
12175
12176 static __inline__ vector unsigned char __ATTRS_o_ai
12177 vec_xor(vector unsigned char __a, vector bool char __b) {
12178   return __a ^ (vector unsigned char)__b;
12179 }
12180
12181 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12182                                                         vector bool char __b) {
12183   return __a ^ __b;
12184 }
12185
12186 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12187                                                     vector short __b) {
12188   return __a ^ __b;
12189 }
12190
12191 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12192                                                     vector short __b) {
12193   return (vector short)__a ^ __b;
12194 }
12195
12196 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12197                                                     vector bool short __b) {
12198   return __a ^ (vector short)__b;
12199 }
12200
12201 static __inline__ vector unsigned short __ATTRS_o_ai
12202 vec_xor(vector unsigned short __a, vector unsigned short __b) {
12203   return __a ^ __b;
12204 }
12205
12206 static __inline__ vector unsigned short __ATTRS_o_ai
12207 vec_xor(vector bool short __a, vector unsigned short __b) {
12208   return (vector unsigned short)__a ^ __b;
12209 }
12210
12211 static __inline__ vector unsigned short __ATTRS_o_ai
12212 vec_xor(vector unsigned short __a, vector bool short __b) {
12213   return __a ^ (vector unsigned short)__b;
12214 }
12215
12216 static __inline__ vector bool short __ATTRS_o_ai
12217 vec_xor(vector bool short __a, vector bool short __b) {
12218   return __a ^ __b;
12219 }
12220
12221 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12222                                                   vector int __b) {
12223   return __a ^ __b;
12224 }
12225
12226 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12227                                                   vector int __b) {
12228   return (vector int)__a ^ __b;
12229 }
12230
12231 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12232                                                   vector bool int __b) {
12233   return __a ^ (vector int)__b;
12234 }
12235
12236 static __inline__ vector unsigned int __ATTRS_o_ai
12237 vec_xor(vector unsigned int __a, vector unsigned int __b) {
12238   return __a ^ __b;
12239 }
12240
12241 static __inline__ vector unsigned int __ATTRS_o_ai
12242 vec_xor(vector bool int __a, vector unsigned int __b) {
12243   return (vector unsigned int)__a ^ __b;
12244 }
12245
12246 static __inline__ vector unsigned int __ATTRS_o_ai
12247 vec_xor(vector unsigned int __a, vector bool int __b) {
12248   return __a ^ (vector unsigned int)__b;
12249 }
12250
12251 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12252                                                        vector bool int __b) {
12253   return __a ^ __b;
12254 }
12255
12256 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12257                                                     vector float __b) {
12258   vector unsigned int __res =
12259       (vector unsigned int)__a ^ (vector unsigned int)__b;
12260   return (vector float)__res;
12261 }
12262
12263 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12264                                                     vector float __b) {
12265   vector unsigned int __res =
12266       (vector unsigned int)__a ^ (vector unsigned int)__b;
12267   return (vector float)__res;
12268 }
12269
12270 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12271                                                     vector bool int __b) {
12272   vector unsigned int __res =
12273       (vector unsigned int)__a ^ (vector unsigned int)__b;
12274   return (vector float)__res;
12275 }
12276
12277 #ifdef __VSX__
12278 static __inline__ vector signed long long __ATTRS_o_ai
12279 vec_xor(vector signed long long __a, vector signed long long __b) {
12280   return __a ^ __b;
12281 }
12282
12283 static __inline__ vector signed long long __ATTRS_o_ai
12284 vec_xor(vector bool long long __a, vector signed long long __b) {
12285   return (vector signed long long)__a ^ __b;
12286 }
12287
12288 static __inline__ vector signed long long __ATTRS_o_ai
12289 vec_xor(vector signed long long __a, vector bool long long __b) {
12290   return __a ^ (vector signed long long)__b;
12291 }
12292
12293 static __inline__ vector unsigned long long __ATTRS_o_ai
12294 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12295   return __a ^ __b;
12296 }
12297
12298 static __inline__ vector unsigned long long __ATTRS_o_ai
12299 vec_xor(vector bool long long __a, vector unsigned long long __b) {
12300   return (vector unsigned long long)__a ^ __b;
12301 }
12302
12303 static __inline__ vector unsigned long long __ATTRS_o_ai
12304 vec_xor(vector unsigned long long __a, vector bool long long __b) {
12305   return __a ^ (vector unsigned long long)__b;
12306 }
12307
12308 static __inline__ vector bool long long __ATTRS_o_ai
12309 vec_xor(vector bool long long __a, vector bool long long __b) {
12310   return __a ^ __b;
12311 }
12312
12313 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12314                                                      vector double __b) {
12315   return (vector double)((vector unsigned long long)__a ^
12316                          (vector unsigned long long)__b);
12317 }
12318
12319 static __inline__ vector double __ATTRS_o_ai
12320 vec_xor(vector double __a, vector bool long long __b) {
12321   return (vector double)((vector unsigned long long)__a ^
12322                          (vector unsigned long long)__b);
12323 }
12324
12325 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12326                                                      vector double __b) {
12327   return (vector double)((vector unsigned long long)__a ^
12328                          (vector unsigned long long)__b);
12329 }
12330 #endif
12331
12332 /* vec_vxor */
12333
12334 static __inline__ vector signed char __ATTRS_o_ai
12335 vec_vxor(vector signed char __a, vector signed char __b) {
12336   return __a ^ __b;
12337 }
12338
12339 static __inline__ vector signed char __ATTRS_o_ai
12340 vec_vxor(vector bool char __a, vector signed char __b) {
12341   return (vector signed char)__a ^ __b;
12342 }
12343
12344 static __inline__ vector signed char __ATTRS_o_ai
12345 vec_vxor(vector signed char __a, vector bool char __b) {
12346   return __a ^ (vector signed char)__b;
12347 }
12348
12349 static __inline__ vector unsigned char __ATTRS_o_ai
12350 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12351   return __a ^ __b;
12352 }
12353
12354 static __inline__ vector unsigned char __ATTRS_o_ai
12355 vec_vxor(vector bool char __a, vector unsigned char __b) {
12356   return (vector unsigned char)__a ^ __b;
12357 }
12358
12359 static __inline__ vector unsigned char __ATTRS_o_ai
12360 vec_vxor(vector unsigned char __a, vector bool char __b) {
12361   return __a ^ (vector unsigned char)__b;
12362 }
12363
12364 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12365                                                          vector bool char __b) {
12366   return __a ^ __b;
12367 }
12368
12369 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12370                                                      vector short __b) {
12371   return __a ^ __b;
12372 }
12373
12374 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12375                                                      vector short __b) {
12376   return (vector short)__a ^ __b;
12377 }
12378
12379 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12380                                                      vector bool short __b) {
12381   return __a ^ (vector short)__b;
12382 }
12383
12384 static __inline__ vector unsigned short __ATTRS_o_ai
12385 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12386   return __a ^ __b;
12387 }
12388
12389 static __inline__ vector unsigned short __ATTRS_o_ai
12390 vec_vxor(vector bool short __a, vector unsigned short __b) {
12391   return (vector unsigned short)__a ^ __b;
12392 }
12393
12394 static __inline__ vector unsigned short __ATTRS_o_ai
12395 vec_vxor(vector unsigned short __a, vector bool short __b) {
12396   return __a ^ (vector unsigned short)__b;
12397 }
12398
12399 static __inline__ vector bool short __ATTRS_o_ai
12400 vec_vxor(vector bool short __a, vector bool short __b) {
12401   return __a ^ __b;
12402 }
12403
12404 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12405                                                    vector int __b) {
12406   return __a ^ __b;
12407 }
12408
12409 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12410                                                    vector int __b) {
12411   return (vector int)__a ^ __b;
12412 }
12413
12414 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12415                                                    vector bool int __b) {
12416   return __a ^ (vector int)__b;
12417 }
12418
12419 static __inline__ vector unsigned int __ATTRS_o_ai
12420 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12421   return __a ^ __b;
12422 }
12423
12424 static __inline__ vector unsigned int __ATTRS_o_ai
12425 vec_vxor(vector bool int __a, vector unsigned int __b) {
12426   return (vector unsigned int)__a ^ __b;
12427 }
12428
12429 static __inline__ vector unsigned int __ATTRS_o_ai
12430 vec_vxor(vector unsigned int __a, vector bool int __b) {
12431   return __a ^ (vector unsigned int)__b;
12432 }
12433
12434 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12435                                                         vector bool int __b) {
12436   return __a ^ __b;
12437 }
12438
12439 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12440                                                      vector float __b) {
12441   vector unsigned int __res =
12442       (vector unsigned int)__a ^ (vector unsigned int)__b;
12443   return (vector float)__res;
12444 }
12445
12446 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12447                                                      vector float __b) {
12448   vector unsigned int __res =
12449       (vector unsigned int)__a ^ (vector unsigned int)__b;
12450   return (vector float)__res;
12451 }
12452
12453 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12454                                                      vector bool int __b) {
12455   vector unsigned int __res =
12456       (vector unsigned int)__a ^ (vector unsigned int)__b;
12457   return (vector float)__res;
12458 }
12459
12460 #ifdef __VSX__
12461 static __inline__ vector signed long long __ATTRS_o_ai
12462 vec_vxor(vector signed long long __a, vector signed long long __b) {
12463   return __a ^ __b;
12464 }
12465
12466 static __inline__ vector signed long long __ATTRS_o_ai
12467 vec_vxor(vector bool long long __a, vector signed long long __b) {
12468   return (vector signed long long)__a ^ __b;
12469 }
12470
12471 static __inline__ vector signed long long __ATTRS_o_ai
12472 vec_vxor(vector signed long long __a, vector bool long long __b) {
12473   return __a ^ (vector signed long long)__b;
12474 }
12475
12476 static __inline__ vector unsigned long long __ATTRS_o_ai
12477 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12478   return __a ^ __b;
12479 }
12480
12481 static __inline__ vector unsigned long long __ATTRS_o_ai
12482 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12483   return (vector unsigned long long)__a ^ __b;
12484 }
12485
12486 static __inline__ vector unsigned long long __ATTRS_o_ai
12487 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12488   return __a ^ (vector unsigned long long)__b;
12489 }
12490
12491 static __inline__ vector bool long long __ATTRS_o_ai
12492 vec_vxor(vector bool long long __a, vector bool long long __b) {
12493   return __a ^ __b;
12494 }
12495 #endif
12496
12497 /* ------------------------ extensions for CBEA ----------------------------- */
12498
12499 /* vec_extract */
12500
12501 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12502                                                        int __b) {
12503   return __a[__b];
12504 }
12505
12506 static __inline__ unsigned char __ATTRS_o_ai
12507 vec_extract(vector unsigned char __a, int __b) {
12508   return __a[__b];
12509 }
12510
12511 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12512                                                          int __b) {
12513   return __a[__b];
12514 }
12515
12516 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12517                                                         int __b) {
12518   return __a[__b];
12519 }
12520
12521 static __inline__ unsigned short __ATTRS_o_ai
12522 vec_extract(vector unsigned short __a, int __b) {
12523   return __a[__b];
12524 }
12525
12526 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12527                                                           int __b) {
12528   return __a[__b];
12529 }
12530
12531 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12532                                                       int __b) {
12533   return __a[__b];
12534 }
12535
12536 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12537                                                         int __b) {
12538   return __a[__b];
12539 }
12540
12541 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12542                                                         int __b) {
12543   return __a[__b];
12544 }
12545
12546 #ifdef __VSX__
12547 static __inline__ signed long long __ATTRS_o_ai
12548 vec_extract(vector signed long long __a, int __b) {
12549   return __a[__b];
12550 }
12551
12552 static __inline__ unsigned long long __ATTRS_o_ai
12553 vec_extract(vector unsigned long long __a, int __b) {
12554   return __a[__b];
12555 }
12556
12557 static __inline__ unsigned long long __ATTRS_o_ai
12558 vec_extract(vector bool long long __a, int __b) {
12559   return __a[__b];
12560 }
12561
12562 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12563   return __a[__b];
12564 }
12565 #endif
12566
12567 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12568   return __a[__b];
12569 }
12570
12571 #ifdef __POWER9_VECTOR__
12572
12573 #define vec_insert4b __builtin_vsx_insertword
12574 #define vec_extract4b __builtin_vsx_extractuword
12575
12576 /* vec_extract_exp */
12577
12578 static __inline__ vector unsigned int __ATTRS_o_ai
12579 vec_extract_exp(vector float __a) {
12580   return __builtin_vsx_xvxexpsp(__a);
12581 }
12582
12583 static __inline__ vector unsigned long long __ATTRS_o_ai
12584 vec_extract_exp(vector double __a) {
12585   return __builtin_vsx_xvxexpdp(__a);
12586 }
12587
12588 /* vec_extract_sig */
12589
12590 static __inline__ vector unsigned int __ATTRS_o_ai
12591 vec_extract_sig(vector float __a) {
12592   return __builtin_vsx_xvxsigsp(__a);
12593 }
12594
12595 static __inline__ vector unsigned long long __ATTRS_o_ai
12596 vec_extract_sig (vector double __a) {
12597   return __builtin_vsx_xvxsigdp(__a);
12598 }
12599
12600 static __inline__ vector float __ATTRS_o_ai
12601 vec_extract_fp32_from_shorth(vector unsigned short __a) {
12602   vector unsigned short __b =
12603 #ifdef __LITTLE_ENDIAN__
12604             __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12605 #else
12606             __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12607 #endif
12608   return __builtin_vsx_xvcvhpsp(__b);
12609 }
12610
12611 static __inline__ vector float __ATTRS_o_ai
12612 vec_extract_fp32_from_shortl(vector unsigned short __a) {
12613   vector unsigned short __b =
12614 #ifdef __LITTLE_ENDIAN__
12615             __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12616 #else
12617             __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12618 #endif
12619   return __builtin_vsx_xvcvhpsp(__b);
12620 }
12621 #endif /* __POWER9_VECTOR__ */
12622
12623 /* vec_insert */
12624
12625 static __inline__ vector signed char __ATTRS_o_ai
12626 vec_insert(signed char __a, vector signed char __b, int __c) {
12627   __b[__c] = __a;
12628   return __b;
12629 }
12630
12631 static __inline__ vector unsigned char __ATTRS_o_ai
12632 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12633   __b[__c] = __a;
12634   return __b;
12635 }
12636
12637 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12638                                                            vector bool char __b,
12639                                                            int __c) {
12640   __b[__c] = __a;
12641   return __b;
12642 }
12643
12644 static __inline__ vector signed short __ATTRS_o_ai
12645 vec_insert(signed short __a, vector signed short __b, int __c) {
12646   __b[__c] = __a;
12647   return __b;
12648 }
12649
12650 static __inline__ vector unsigned short __ATTRS_o_ai
12651 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12652   __b[__c] = __a;
12653   return __b;
12654 }
12655
12656 static __inline__ vector bool short __ATTRS_o_ai
12657 vec_insert(unsigned short __a, vector bool short __b, int __c) {
12658   __b[__c] = __a;
12659   return __b;
12660 }
12661
12662 static __inline__ vector signed int __ATTRS_o_ai
12663 vec_insert(signed int __a, vector signed int __b, int __c) {
12664   __b[__c] = __a;
12665   return __b;
12666 }
12667
12668 static __inline__ vector unsigned int __ATTRS_o_ai
12669 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12670   __b[__c] = __a;
12671   return __b;
12672 }
12673
12674 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12675                                                           vector bool int __b,
12676                                                           int __c) {
12677   __b[__c] = __a;
12678   return __b;
12679 }
12680
12681 #ifdef __VSX__
12682 static __inline__ vector signed long long __ATTRS_o_ai
12683 vec_insert(signed long long __a, vector signed long long __b, int __c) {
12684   __b[__c] = __a;
12685   return __b;
12686 }
12687
12688 static __inline__ vector unsigned long long __ATTRS_o_ai
12689 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12690   __b[__c] = __a;
12691   return __b;
12692 }
12693
12694 static __inline__ vector bool long long __ATTRS_o_ai
12695 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12696   __b[__c] = __a;
12697   return __b;
12698 }
12699 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12700                                                         vector double __b,
12701                                                         int __c) {
12702   __b[__c] = __a;
12703   return __b;
12704 }
12705 #endif
12706
12707 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12708                                                        vector float __b,
12709                                                        int __c) {
12710   __b[__c] = __a;
12711   return __b;
12712 }
12713
12714 /* vec_lvlx */
12715
12716 static __inline__ vector signed char __ATTRS_o_ai
12717 vec_lvlx(int __a, const signed char *__b) {
12718   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12719                   vec_lvsl(__a, __b));
12720 }
12721
12722 static __inline__ vector signed char __ATTRS_o_ai
12723 vec_lvlx(int __a, const vector signed char *__b) {
12724   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12725                   vec_lvsl(__a, (unsigned char *)__b));
12726 }
12727
12728 static __inline__ vector unsigned char __ATTRS_o_ai
12729 vec_lvlx(int __a, const unsigned char *__b) {
12730   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12731                   vec_lvsl(__a, __b));
12732 }
12733
12734 static __inline__ vector unsigned char __ATTRS_o_ai
12735 vec_lvlx(int __a, const vector unsigned char *__b) {
12736   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12737                   vec_lvsl(__a, (unsigned char *)__b));
12738 }
12739
12740 static __inline__ vector bool char __ATTRS_o_ai
12741 vec_lvlx(int __a, const vector bool char *__b) {
12742   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12743                   vec_lvsl(__a, (unsigned char *)__b));
12744 }
12745
12746 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12747                                                      const short *__b) {
12748   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12749 }
12750
12751 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12752                                                      const vector short *__b) {
12753   return vec_perm(vec_ld(__a, __b), (vector short)(0),
12754                   vec_lvsl(__a, (unsigned char *)__b));
12755 }
12756
12757 static __inline__ vector unsigned short __ATTRS_o_ai
12758 vec_lvlx(int __a, const unsigned short *__b) {
12759   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12760                   vec_lvsl(__a, __b));
12761 }
12762
12763 static __inline__ vector unsigned short __ATTRS_o_ai
12764 vec_lvlx(int __a, const vector unsigned short *__b) {
12765   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12766                   vec_lvsl(__a, (unsigned char *)__b));
12767 }
12768
12769 static __inline__ vector bool short __ATTRS_o_ai
12770 vec_lvlx(int __a, const vector bool short *__b) {
12771   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12772                   vec_lvsl(__a, (unsigned char *)__b));
12773 }
12774
12775 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12776                                                      const vector pixel *__b) {
12777   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12778                   vec_lvsl(__a, (unsigned char *)__b));
12779 }
12780
12781 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12782   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12783 }
12784
12785 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12786                                                    const vector int *__b) {
12787   return vec_perm(vec_ld(__a, __b), (vector int)(0),
12788                   vec_lvsl(__a, (unsigned char *)__b));
12789 }
12790
12791 static __inline__ vector unsigned int __ATTRS_o_ai
12792 vec_lvlx(int __a, const unsigned int *__b) {
12793   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12794                   vec_lvsl(__a, __b));
12795 }
12796
12797 static __inline__ vector unsigned int __ATTRS_o_ai
12798 vec_lvlx(int __a, const vector unsigned int *__b) {
12799   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12800                   vec_lvsl(__a, (unsigned char *)__b));
12801 }
12802
12803 static __inline__ vector bool int __ATTRS_o_ai
12804 vec_lvlx(int __a, const vector bool int *__b) {
12805   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12806                   vec_lvsl(__a, (unsigned char *)__b));
12807 }
12808
12809 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12810                                                      const float *__b) {
12811   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12812 }
12813
12814 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12815                                                      const vector float *__b) {
12816   return vec_perm(vec_ld(__a, __b), (vector float)(0),
12817                   vec_lvsl(__a, (unsigned char *)__b));
12818 }
12819
12820 /* vec_lvlxl */
12821
12822 static __inline__ vector signed char __ATTRS_o_ai
12823 vec_lvlxl(int __a, const signed char *__b) {
12824   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12825                   vec_lvsl(__a, __b));
12826 }
12827
12828 static __inline__ vector signed char __ATTRS_o_ai
12829 vec_lvlxl(int __a, const vector signed char *__b) {
12830   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12831                   vec_lvsl(__a, (unsigned char *)__b));
12832 }
12833
12834 static __inline__ vector unsigned char __ATTRS_o_ai
12835 vec_lvlxl(int __a, const unsigned char *__b) {
12836   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12837                   vec_lvsl(__a, __b));
12838 }
12839
12840 static __inline__ vector unsigned char __ATTRS_o_ai
12841 vec_lvlxl(int __a, const vector unsigned char *__b) {
12842   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12843                   vec_lvsl(__a, (unsigned char *)__b));
12844 }
12845
12846 static __inline__ vector bool char __ATTRS_o_ai
12847 vec_lvlxl(int __a, const vector bool char *__b) {
12848   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12849                   vec_lvsl(__a, (unsigned char *)__b));
12850 }
12851
12852 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12853                                                       const short *__b) {
12854   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12855 }
12856
12857 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12858                                                       const vector short *__b) {
12859   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12860                   vec_lvsl(__a, (unsigned char *)__b));
12861 }
12862
12863 static __inline__ vector unsigned short __ATTRS_o_ai
12864 vec_lvlxl(int __a, const unsigned short *__b) {
12865   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12866                   vec_lvsl(__a, __b));
12867 }
12868
12869 static __inline__ vector unsigned short __ATTRS_o_ai
12870 vec_lvlxl(int __a, const vector unsigned short *__b) {
12871   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12872                   vec_lvsl(__a, (unsigned char *)__b));
12873 }
12874
12875 static __inline__ vector bool short __ATTRS_o_ai
12876 vec_lvlxl(int __a, const vector bool short *__b) {
12877   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12878                   vec_lvsl(__a, (unsigned char *)__b));
12879 }
12880
12881 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12882                                                       const vector pixel *__b) {
12883   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12884                   vec_lvsl(__a, (unsigned char *)__b));
12885 }
12886
12887 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12888   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12889 }
12890
12891 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12892                                                     const vector int *__b) {
12893   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12894                   vec_lvsl(__a, (unsigned char *)__b));
12895 }
12896
12897 static __inline__ vector unsigned int __ATTRS_o_ai
12898 vec_lvlxl(int __a, const unsigned int *__b) {
12899   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12900                   vec_lvsl(__a, __b));
12901 }
12902
12903 static __inline__ vector unsigned int __ATTRS_o_ai
12904 vec_lvlxl(int __a, const vector unsigned int *__b) {
12905   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12906                   vec_lvsl(__a, (unsigned char *)__b));
12907 }
12908
12909 static __inline__ vector bool int __ATTRS_o_ai
12910 vec_lvlxl(int __a, const vector bool int *__b) {
12911   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12912                   vec_lvsl(__a, (unsigned char *)__b));
12913 }
12914
12915 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12916                                                       const float *__b) {
12917   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12918 }
12919
12920 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12921                                                       vector float *__b) {
12922   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12923                   vec_lvsl(__a, (unsigned char *)__b));
12924 }
12925
12926 /* vec_lvrx */
12927
12928 static __inline__ vector signed char __ATTRS_o_ai
12929 vec_lvrx(int __a, const signed char *__b) {
12930   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12931                   vec_lvsl(__a, __b));
12932 }
12933
12934 static __inline__ vector signed char __ATTRS_o_ai
12935 vec_lvrx(int __a, const vector signed char *__b) {
12936   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12937                   vec_lvsl(__a, (unsigned char *)__b));
12938 }
12939
12940 static __inline__ vector unsigned char __ATTRS_o_ai
12941 vec_lvrx(int __a, const unsigned char *__b) {
12942   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12943                   vec_lvsl(__a, __b));
12944 }
12945
12946 static __inline__ vector unsigned char __ATTRS_o_ai
12947 vec_lvrx(int __a, const vector unsigned char *__b) {
12948   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12949                   vec_lvsl(__a, (unsigned char *)__b));
12950 }
12951
12952 static __inline__ vector bool char __ATTRS_o_ai
12953 vec_lvrx(int __a, const vector bool char *__b) {
12954   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12955                   vec_lvsl(__a, (unsigned char *)__b));
12956 }
12957
12958 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12959                                                      const short *__b) {
12960   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12961 }
12962
12963 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12964                                                      const vector short *__b) {
12965   return vec_perm((vector short)(0), vec_ld(__a, __b),
12966                   vec_lvsl(__a, (unsigned char *)__b));
12967 }
12968
12969 static __inline__ vector unsigned short __ATTRS_o_ai
12970 vec_lvrx(int __a, const unsigned short *__b) {
12971   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12972                   vec_lvsl(__a, __b));
12973 }
12974
12975 static __inline__ vector unsigned short __ATTRS_o_ai
12976 vec_lvrx(int __a, const vector unsigned short *__b) {
12977   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12978                   vec_lvsl(__a, (unsigned char *)__b));
12979 }
12980
12981 static __inline__ vector bool short __ATTRS_o_ai
12982 vec_lvrx(int __a, const vector bool short *__b) {
12983   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12984                   vec_lvsl(__a, (unsigned char *)__b));
12985 }
12986
12987 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12988                                                      const vector pixel *__b) {
12989   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12990                   vec_lvsl(__a, (unsigned char *)__b));
12991 }
12992
12993 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
12994   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12995 }
12996
12997 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
12998                                                    const vector int *__b) {
12999   return vec_perm((vector int)(0), vec_ld(__a, __b),
13000                   vec_lvsl(__a, (unsigned char *)__b));
13001 }
13002
13003 static __inline__ vector unsigned int __ATTRS_o_ai
13004 vec_lvrx(int __a, const unsigned int *__b) {
13005   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13006                   vec_lvsl(__a, __b));
13007 }
13008
13009 static __inline__ vector unsigned int __ATTRS_o_ai
13010 vec_lvrx(int __a, const vector unsigned int *__b) {
13011   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13012                   vec_lvsl(__a, (unsigned char *)__b));
13013 }
13014
13015 static __inline__ vector bool int __ATTRS_o_ai
13016 vec_lvrx(int __a, const vector bool int *__b) {
13017   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13018                   vec_lvsl(__a, (unsigned char *)__b));
13019 }
13020
13021 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13022                                                      const float *__b) {
13023   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13024 }
13025
13026 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13027                                                      const vector float *__b) {
13028   return vec_perm((vector float)(0), vec_ld(__a, __b),
13029                   vec_lvsl(__a, (unsigned char *)__b));
13030 }
13031
13032 /* vec_lvrxl */
13033
13034 static __inline__ vector signed char __ATTRS_o_ai
13035 vec_lvrxl(int __a, const signed char *__b) {
13036   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13037                   vec_lvsl(__a, __b));
13038 }
13039
13040 static __inline__ vector signed char __ATTRS_o_ai
13041 vec_lvrxl(int __a, const vector signed char *__b) {
13042   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13043                   vec_lvsl(__a, (unsigned char *)__b));
13044 }
13045
13046 static __inline__ vector unsigned char __ATTRS_o_ai
13047 vec_lvrxl(int __a, const unsigned char *__b) {
13048   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13049                   vec_lvsl(__a, __b));
13050 }
13051
13052 static __inline__ vector unsigned char __ATTRS_o_ai
13053 vec_lvrxl(int __a, const vector unsigned char *__b) {
13054   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13055                   vec_lvsl(__a, (unsigned char *)__b));
13056 }
13057
13058 static __inline__ vector bool char __ATTRS_o_ai
13059 vec_lvrxl(int __a, const vector bool char *__b) {
13060   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13061                   vec_lvsl(__a, (unsigned char *)__b));
13062 }
13063
13064 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13065                                                       const short *__b) {
13066   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13067 }
13068
13069 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13070                                                       const vector short *__b) {
13071   return vec_perm((vector short)(0), vec_ldl(__a, __b),
13072                   vec_lvsl(__a, (unsigned char *)__b));
13073 }
13074
13075 static __inline__ vector unsigned short __ATTRS_o_ai
13076 vec_lvrxl(int __a, const unsigned short *__b) {
13077   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13078                   vec_lvsl(__a, __b));
13079 }
13080
13081 static __inline__ vector unsigned short __ATTRS_o_ai
13082 vec_lvrxl(int __a, const vector unsigned short *__b) {
13083   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13084                   vec_lvsl(__a, (unsigned char *)__b));
13085 }
13086
13087 static __inline__ vector bool short __ATTRS_o_ai
13088 vec_lvrxl(int __a, const vector bool short *__b) {
13089   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13090                   vec_lvsl(__a, (unsigned char *)__b));
13091 }
13092
13093 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13094                                                       const vector pixel *__b) {
13095   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13096                   vec_lvsl(__a, (unsigned char *)__b));
13097 }
13098
13099 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13100   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13101 }
13102
13103 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13104                                                     const vector int *__b) {
13105   return vec_perm((vector int)(0), vec_ldl(__a, __b),
13106                   vec_lvsl(__a, (unsigned char *)__b));
13107 }
13108
13109 static __inline__ vector unsigned int __ATTRS_o_ai
13110 vec_lvrxl(int __a, const unsigned int *__b) {
13111   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13112                   vec_lvsl(__a, __b));
13113 }
13114
13115 static __inline__ vector unsigned int __ATTRS_o_ai
13116 vec_lvrxl(int __a, const vector unsigned int *__b) {
13117   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13118                   vec_lvsl(__a, (unsigned char *)__b));
13119 }
13120
13121 static __inline__ vector bool int __ATTRS_o_ai
13122 vec_lvrxl(int __a, const vector bool int *__b) {
13123   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13124                   vec_lvsl(__a, (unsigned char *)__b));
13125 }
13126
13127 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13128                                                       const float *__b) {
13129   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13130 }
13131
13132 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13133                                                       const vector float *__b) {
13134   return vec_perm((vector float)(0), vec_ldl(__a, __b),
13135                   vec_lvsl(__a, (unsigned char *)__b));
13136 }
13137
13138 /* vec_stvlx */
13139
13140 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13141                                               signed char *__c) {
13142   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13143                 __c);
13144 }
13145
13146 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13147                                               vector signed char *__c) {
13148   return vec_st(
13149       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13150       __b, __c);
13151 }
13152
13153 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13154                                               unsigned char *__c) {
13155   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13156                 __c);
13157 }
13158
13159 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13160                                               vector unsigned char *__c) {
13161   return vec_st(
13162       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13163       __b, __c);
13164 }
13165
13166 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13167                                               vector bool char *__c) {
13168   return vec_st(
13169       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13170       __b, __c);
13171 }
13172
13173 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13174                                               short *__c) {
13175   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13176                 __c);
13177 }
13178
13179 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13180                                               vector short *__c) {
13181   return vec_st(
13182       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13183       __b, __c);
13184 }
13185
13186 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13187                                               int __b, unsigned short *__c) {
13188   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13189                 __c);
13190 }
13191
13192 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13193                                               int __b,
13194                                               vector unsigned short *__c) {
13195   return vec_st(
13196       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13197       __b, __c);
13198 }
13199
13200 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13201                                               vector bool short *__c) {
13202   return vec_st(
13203       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13204       __b, __c);
13205 }
13206
13207 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13208                                               vector pixel *__c) {
13209   return vec_st(
13210       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13211       __b, __c);
13212 }
13213
13214 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13215                                               int *__c) {
13216   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13217                 __c);
13218 }
13219
13220 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13221                                               vector int *__c) {
13222   return vec_st(
13223       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13224       __b, __c);
13225 }
13226
13227 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13228                                               unsigned int *__c) {
13229   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13230                 __c);
13231 }
13232
13233 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13234                                               vector unsigned int *__c) {
13235   return vec_st(
13236       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13237       __b, __c);
13238 }
13239
13240 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13241                                               vector bool int *__c) {
13242   return vec_st(
13243       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13244       __b, __c);
13245 }
13246
13247 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13248                                               vector float *__c) {
13249   return vec_st(
13250       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13251       __b, __c);
13252 }
13253
13254 /* vec_stvlxl */
13255
13256 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13257                                                signed char *__c) {
13258   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13259                  __c);
13260 }
13261
13262 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13263                                                vector signed char *__c) {
13264   return vec_stl(
13265       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13266       __b, __c);
13267 }
13268
13269 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13270                                                int __b, unsigned char *__c) {
13271   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13272                  __c);
13273 }
13274
13275 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13276                                                int __b,
13277                                                vector unsigned char *__c) {
13278   return vec_stl(
13279       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13280       __b, __c);
13281 }
13282
13283 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13284                                                vector bool char *__c) {
13285   return vec_stl(
13286       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13287       __b, __c);
13288 }
13289
13290 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13291                                                short *__c) {
13292   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13293                  __c);
13294 }
13295
13296 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13297                                                vector short *__c) {
13298   return vec_stl(
13299       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13300       __b, __c);
13301 }
13302
13303 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13304                                                int __b, unsigned short *__c) {
13305   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13306                  __c);
13307 }
13308
13309 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13310                                                int __b,
13311                                                vector unsigned short *__c) {
13312   return vec_stl(
13313       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13314       __b, __c);
13315 }
13316
13317 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13318                                                vector bool short *__c) {
13319   return vec_stl(
13320       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13321       __b, __c);
13322 }
13323
13324 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13325                                                vector pixel *__c) {
13326   return vec_stl(
13327       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13328       __b, __c);
13329 }
13330
13331 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13332                                                int *__c) {
13333   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13334                  __c);
13335 }
13336
13337 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13338                                                vector int *__c) {
13339   return vec_stl(
13340       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13341       __b, __c);
13342 }
13343
13344 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13345                                                unsigned int *__c) {
13346   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13347                  __c);
13348 }
13349
13350 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13351                                                vector unsigned int *__c) {
13352   return vec_stl(
13353       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13354       __b, __c);
13355 }
13356
13357 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13358                                                vector bool int *__c) {
13359   return vec_stl(
13360       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13361       __b, __c);
13362 }
13363
13364 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13365                                                vector float *__c) {
13366   return vec_stl(
13367       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13368       __b, __c);
13369 }
13370
13371 /* vec_stvrx */
13372
13373 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13374                                               signed char *__c) {
13375   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13376                 __c);
13377 }
13378
13379 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13380                                               vector signed char *__c) {
13381   return vec_st(
13382       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13383       __b, __c);
13384 }
13385
13386 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13387                                               unsigned char *__c) {
13388   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13389                 __c);
13390 }
13391
13392 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13393                                               vector unsigned char *__c) {
13394   return vec_st(
13395       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13396       __b, __c);
13397 }
13398
13399 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13400                                               vector bool char *__c) {
13401   return vec_st(
13402       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13403       __b, __c);
13404 }
13405
13406 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13407                                               short *__c) {
13408   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13409                 __c);
13410 }
13411
13412 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13413                                               vector short *__c) {
13414   return vec_st(
13415       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13416       __b, __c);
13417 }
13418
13419 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13420                                               int __b, unsigned short *__c) {
13421   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13422                 __c);
13423 }
13424
13425 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13426                                               int __b,
13427                                               vector unsigned short *__c) {
13428   return vec_st(
13429       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13430       __b, __c);
13431 }
13432
13433 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13434                                               vector bool short *__c) {
13435   return vec_st(
13436       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13437       __b, __c);
13438 }
13439
13440 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13441                                               vector pixel *__c) {
13442   return vec_st(
13443       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13444       __b, __c);
13445 }
13446
13447 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13448                                               int *__c) {
13449   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13450                 __c);
13451 }
13452
13453 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13454                                               vector int *__c) {
13455   return vec_st(
13456       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13457       __b, __c);
13458 }
13459
13460 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13461                                               unsigned int *__c) {
13462   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13463                 __c);
13464 }
13465
13466 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13467                                               vector unsigned int *__c) {
13468   return vec_st(
13469       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13470       __b, __c);
13471 }
13472
13473 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13474                                               vector bool int *__c) {
13475   return vec_st(
13476       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13477       __b, __c);
13478 }
13479
13480 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13481                                               vector float *__c) {
13482   return vec_st(
13483       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13484       __b, __c);
13485 }
13486
13487 /* vec_stvrxl */
13488
13489 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13490                                                signed char *__c) {
13491   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13492                  __c);
13493 }
13494
13495 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13496                                                vector signed char *__c) {
13497   return vec_stl(
13498       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13499       __b, __c);
13500 }
13501
13502 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13503                                                int __b, unsigned char *__c) {
13504   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13505                  __c);
13506 }
13507
13508 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13509                                                int __b,
13510                                                vector unsigned char *__c) {
13511   return vec_stl(
13512       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13513       __b, __c);
13514 }
13515
13516 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13517                                                vector bool char *__c) {
13518   return vec_stl(
13519       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13520       __b, __c);
13521 }
13522
13523 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13524                                                short *__c) {
13525   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13526                  __c);
13527 }
13528
13529 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13530                                                vector short *__c) {
13531   return vec_stl(
13532       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13533       __b, __c);
13534 }
13535
13536 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13537                                                int __b, unsigned short *__c) {
13538   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13539                  __c);
13540 }
13541
13542 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13543                                                int __b,
13544                                                vector unsigned short *__c) {
13545   return vec_stl(
13546       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13547       __b, __c);
13548 }
13549
13550 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13551                                                vector bool short *__c) {
13552   return vec_stl(
13553       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13554       __b, __c);
13555 }
13556
13557 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13558                                                vector pixel *__c) {
13559   return vec_stl(
13560       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13561       __b, __c);
13562 }
13563
13564 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13565                                                int *__c) {
13566   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13567                  __c);
13568 }
13569
13570 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13571                                                vector int *__c) {
13572   return vec_stl(
13573       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13574       __b, __c);
13575 }
13576
13577 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13578                                                unsigned int *__c) {
13579   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13580                  __c);
13581 }
13582
13583 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13584                                                vector unsigned int *__c) {
13585   return vec_stl(
13586       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13587       __b, __c);
13588 }
13589
13590 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13591                                                vector bool int *__c) {
13592   return vec_stl(
13593       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13594       __b, __c);
13595 }
13596
13597 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13598                                                vector float *__c) {
13599   return vec_stl(
13600       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13601       __b, __c);
13602 }
13603
13604 /* vec_promote */
13605
13606 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13607                                                               int __b) {
13608   vector signed char __res = (vector signed char)(0);
13609   __res[__b] = __a;
13610   return __res;
13611 }
13612
13613 static __inline__ vector unsigned char __ATTRS_o_ai
13614 vec_promote(unsigned char __a, int __b) {
13615   vector unsigned char __res = (vector unsigned char)(0);
13616   __res[__b] = __a;
13617   return __res;
13618 }
13619
13620 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13621   vector short __res = (vector short)(0);
13622   __res[__b] = __a;
13623   return __res;
13624 }
13625
13626 static __inline__ vector unsigned short __ATTRS_o_ai
13627 vec_promote(unsigned short __a, int __b) {
13628   vector unsigned short __res = (vector unsigned short)(0);
13629   __res[__b] = __a;
13630   return __res;
13631 }
13632
13633 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13634   vector int __res = (vector int)(0);
13635   __res[__b] = __a;
13636   return __res;
13637 }
13638
13639 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13640                                                                int __b) {
13641   vector unsigned int __res = (vector unsigned int)(0);
13642   __res[__b] = __a;
13643   return __res;
13644 }
13645
13646 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13647   vector float __res = (vector float)(0);
13648   __res[__b] = __a;
13649   return __res;
13650 }
13651
13652 /* vec_splats */
13653
13654 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13655   return (vector signed char)(__a);
13656 }
13657
13658 static __inline__ vector unsigned char __ATTRS_o_ai
13659 vec_splats(unsigned char __a) {
13660   return (vector unsigned char)(__a);
13661 }
13662
13663 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13664   return (vector short)(__a);
13665 }
13666
13667 static __inline__ vector unsigned short __ATTRS_o_ai
13668 vec_splats(unsigned short __a) {
13669   return (vector unsigned short)(__a);
13670 }
13671
13672 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13673   return (vector int)(__a);
13674 }
13675
13676 static __inline__ vector unsigned int __ATTRS_o_ai
13677 vec_splats(unsigned int __a) {
13678   return (vector unsigned int)(__a);
13679 }
13680
13681 #ifdef __VSX__
13682 static __inline__ vector signed long long __ATTRS_o_ai
13683 vec_splats(signed long long __a) {
13684   return (vector signed long long)(__a);
13685 }
13686
13687 static __inline__ vector unsigned long long __ATTRS_o_ai
13688 vec_splats(unsigned long long __a) {
13689   return (vector unsigned long long)(__a);
13690 }
13691
13692 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13693 static __inline__ vector signed __int128 __ATTRS_o_ai
13694 vec_splats(signed __int128 __a) {
13695   return (vector signed __int128)(__a);
13696 }
13697
13698 static __inline__ vector unsigned __int128 __ATTRS_o_ai
13699 vec_splats(unsigned __int128 __a) {
13700   return (vector unsigned __int128)(__a);
13701 }
13702
13703 #endif
13704
13705 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13706   return (vector double)(__a);
13707 }
13708 #endif
13709
13710 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13711   return (vector float)(__a);
13712 }
13713
13714 /* ----------------------------- predicates --------------------------------- */
13715
13716 /* vec_all_eq */
13717
13718 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13719                                               vector signed char __b) {
13720   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13721                                       (vector char)__b);
13722 }
13723
13724 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13725                                               vector bool char __b) {
13726   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13727                                       (vector char)__b);
13728 }
13729
13730 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13731                                               vector unsigned char __b) {
13732   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13733                                       (vector char)__b);
13734 }
13735
13736 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13737                                               vector bool char __b) {
13738   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13739                                       (vector char)__b);
13740 }
13741
13742 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13743                                               vector signed char __b) {
13744   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13745                                       (vector char)__b);
13746 }
13747
13748 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13749                                               vector unsigned char __b) {
13750   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13751                                       (vector char)__b);
13752 }
13753
13754 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13755                                               vector bool char __b) {
13756   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13757                                       (vector char)__b);
13758 }
13759
13760 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13761                                               vector short __b) {
13762   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13763 }
13764
13765 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13766                                               vector bool short __b) {
13767   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13768 }
13769
13770 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13771                                               vector unsigned short __b) {
13772   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13773                                       (vector short)__b);
13774 }
13775
13776 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13777                                               vector bool short __b) {
13778   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13779                                       (vector short)__b);
13780 }
13781
13782 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13783                                               vector short __b) {
13784   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13785                                       (vector short)__b);
13786 }
13787
13788 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13789                                               vector unsigned short __b) {
13790   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13791                                       (vector short)__b);
13792 }
13793
13794 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13795                                               vector bool short __b) {
13796   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13797                                       (vector short)__b);
13798 }
13799
13800 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13801                                               vector pixel __b) {
13802   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13803                                       (vector short)__b);
13804 }
13805
13806 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13807   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13808 }
13809
13810 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13811                                               vector bool int __b) {
13812   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13813 }
13814
13815 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13816                                               vector unsigned int __b) {
13817   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13818                                       (vector int)__b);
13819 }
13820
13821 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13822                                               vector bool int __b) {
13823   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13824                                       (vector int)__b);
13825 }
13826
13827 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13828                                               vector int __b) {
13829   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13830                                       (vector int)__b);
13831 }
13832
13833 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13834                                               vector unsigned int __b) {
13835   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13836                                       (vector int)__b);
13837 }
13838
13839 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13840                                               vector bool int __b) {
13841   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13842                                       (vector int)__b);
13843 }
13844
13845 #ifdef __POWER8_VECTOR__
13846 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13847                                               vector signed long long __b) {
13848   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13849 }
13850
13851 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13852                                               vector bool long long __b) {
13853   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13854 }
13855
13856 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13857                                               vector unsigned long long __b) {
13858   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13859                                       (vector long long)__b);
13860 }
13861
13862 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13863                                               vector bool long long __b) {
13864   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13865                                       (vector long long)__b);
13866 }
13867
13868 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13869                                               vector long long __b) {
13870   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13871                                       (vector long long)__b);
13872 }
13873
13874 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13875                                               vector unsigned long long __b) {
13876   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13877                                       (vector long long)__b);
13878 }
13879
13880 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13881                                               vector bool long long __b) {
13882   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13883                                       (vector long long)__b);
13884 }
13885 #endif
13886
13887 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13888                                               vector float __b) {
13889 #ifdef __VSX__
13890   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13891 #else
13892   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13893 #endif
13894 }
13895
13896 #ifdef __VSX__
13897 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13898                                               vector double __b) {
13899   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13900 }
13901 #endif
13902
13903 /* vec_all_ge */
13904
13905 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13906                                               vector signed char __b) {
13907   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13908 }
13909
13910 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13911                                               vector bool char __b) {
13912   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13913 }
13914
13915 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13916                                               vector unsigned char __b) {
13917   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13918 }
13919
13920 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13921                                               vector bool char __b) {
13922   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13923 }
13924
13925 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13926                                               vector signed char __b) {
13927   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13928                                       (vector unsigned char)__a);
13929 }
13930
13931 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13932                                               vector unsigned char __b) {
13933   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13934 }
13935
13936 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13937                                               vector bool char __b) {
13938   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13939                                       (vector unsigned char)__a);
13940 }
13941
13942 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13943                                               vector short __b) {
13944   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13945 }
13946
13947 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13948                                               vector bool short __b) {
13949   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13950 }
13951
13952 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13953                                               vector unsigned short __b) {
13954   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13955 }
13956
13957 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13958                                               vector bool short __b) {
13959   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13960                                       __a);
13961 }
13962
13963 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13964                                               vector short __b) {
13965   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13966                                       (vector unsigned short)__a);
13967 }
13968
13969 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13970                                               vector unsigned short __b) {
13971   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13972                                       (vector unsigned short)__a);
13973 }
13974
13975 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13976                                               vector bool short __b) {
13977   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13978                                       (vector unsigned short)__a);
13979 }
13980
13981 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13982   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13983 }
13984
13985 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13986                                               vector bool int __b) {
13987   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13988 }
13989
13990 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13991                                               vector unsigned int __b) {
13992   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13993 }
13994
13995 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13996                                               vector bool int __b) {
13997   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
13998 }
13999
14000 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14001                                               vector int __b) {
14002   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14003                                       (vector unsigned int)__a);
14004 }
14005
14006 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14007                                               vector unsigned int __b) {
14008   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14009 }
14010
14011 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14012                                               vector bool int __b) {
14013   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14014                                       (vector unsigned int)__a);
14015 }
14016
14017 #ifdef __POWER8_VECTOR__
14018 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14019                                               vector signed long long __b) {
14020   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14021 }
14022 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14023                                               vector bool long long __b) {
14024   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14025                                       __a);
14026 }
14027
14028 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14029                                               vector unsigned long long __b) {
14030   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14031 }
14032
14033 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14034                                               vector bool long long __b) {
14035   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14036                                       __a);
14037 }
14038
14039 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14040                                               vector signed long long __b) {
14041   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14042                                       (vector unsigned long long)__a);
14043 }
14044
14045 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14046                                               vector unsigned long long __b) {
14047   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14048                                       (vector unsigned long long)__a);
14049 }
14050
14051 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14052                                               vector bool long long __b) {
14053   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14054                                       (vector unsigned long long)__a);
14055 }
14056 #endif
14057
14058 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14059                                               vector float __b) {
14060 #ifdef __VSX__
14061   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14062 #else
14063   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14064 #endif
14065 }
14066
14067 #ifdef __VSX__
14068 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14069                                               vector double __b) {
14070   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14071 }
14072 #endif
14073
14074 /* vec_all_gt */
14075
14076 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14077                                               vector signed char __b) {
14078   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14079 }
14080
14081 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14082                                               vector bool char __b) {
14083   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14084 }
14085
14086 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14087                                               vector unsigned char __b) {
14088   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14089 }
14090
14091 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14092                                               vector bool char __b) {
14093   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14094 }
14095
14096 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14097                                               vector signed char __b) {
14098   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14099                                       (vector unsigned char)__b);
14100 }
14101
14102 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14103                                               vector unsigned char __b) {
14104   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14105 }
14106
14107 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14108                                               vector bool char __b) {
14109   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14110                                       (vector unsigned char)__b);
14111 }
14112
14113 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14114                                               vector short __b) {
14115   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14116 }
14117
14118 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14119                                               vector bool short __b) {
14120   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14121 }
14122
14123 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14124                                               vector unsigned short __b) {
14125   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14126 }
14127
14128 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14129                                               vector bool short __b) {
14130   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14131                                       (vector unsigned short)__b);
14132 }
14133
14134 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14135                                               vector short __b) {
14136   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14137                                       (vector unsigned short)__b);
14138 }
14139
14140 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14141                                               vector unsigned short __b) {
14142   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14143                                       __b);
14144 }
14145
14146 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14147                                               vector bool short __b) {
14148   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14149                                       (vector unsigned short)__b);
14150 }
14151
14152 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14153   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14154 }
14155
14156 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14157                                               vector bool int __b) {
14158   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14159 }
14160
14161 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14162                                               vector unsigned int __b) {
14163   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14164 }
14165
14166 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14167                                               vector bool int __b) {
14168   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14169 }
14170
14171 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14172                                               vector int __b) {
14173   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14174                                       (vector unsigned int)__b);
14175 }
14176
14177 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14178                                               vector unsigned int __b) {
14179   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14180 }
14181
14182 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14183                                               vector bool int __b) {
14184   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14185                                       (vector unsigned int)__b);
14186 }
14187
14188 #ifdef __POWER8_VECTOR__
14189 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14190                                               vector signed long long __b) {
14191   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14192 }
14193 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14194                                               vector bool long long __b) {
14195   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14196                                       (vector signed long long)__b);
14197 }
14198
14199 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14200                                               vector unsigned long long __b) {
14201   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14202 }
14203
14204 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14205                                               vector bool long long __b) {
14206   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14207                                       (vector unsigned long long)__b);
14208 }
14209
14210 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14211                                               vector signed long long __b) {
14212   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14213                                       (vector unsigned long long)__b);
14214 }
14215
14216 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14217                                               vector unsigned long long __b) {
14218   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14219                                       __b);
14220 }
14221
14222 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14223                                               vector bool long long __b) {
14224   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14225                                       (vector unsigned long long)__b);
14226 }
14227 #endif
14228
14229 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14230                                               vector float __b) {
14231 #ifdef __VSX__
14232   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14233 #else
14234   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14235 #endif
14236 }
14237
14238 #ifdef __VSX__
14239 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14240                                               vector double __b) {
14241   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14242 }
14243 #endif
14244
14245 /* vec_all_in */
14246
14247 static __inline__ int __attribute__((__always_inline__))
14248 vec_all_in(vector float __a, vector float __b) {
14249   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14250 }
14251
14252 /* vec_all_le */
14253
14254 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14255                                               vector signed char __b) {
14256   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14257 }
14258
14259 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14260                                               vector bool char __b) {
14261   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14262 }
14263
14264 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14265                                               vector unsigned char __b) {
14266   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14267 }
14268
14269 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14270                                               vector bool char __b) {
14271   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14272 }
14273
14274 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14275                                               vector signed char __b) {
14276   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14277                                       (vector unsigned char)__b);
14278 }
14279
14280 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14281                                               vector unsigned char __b) {
14282   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14283 }
14284
14285 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14286                                               vector bool char __b) {
14287   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14288                                       (vector unsigned char)__b);
14289 }
14290
14291 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14292                                               vector short __b) {
14293   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14294 }
14295
14296 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14297                                               vector bool short __b) {
14298   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14299 }
14300
14301 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14302                                               vector unsigned short __b) {
14303   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14304 }
14305
14306 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14307                                               vector bool short __b) {
14308   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14309                                       (vector unsigned short)__b);
14310 }
14311
14312 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14313                                               vector short __b) {
14314   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14315                                       (vector unsigned short)__b);
14316 }
14317
14318 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14319                                               vector unsigned short __b) {
14320   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14321                                       __b);
14322 }
14323
14324 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14325                                               vector bool short __b) {
14326   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14327                                       (vector unsigned short)__b);
14328 }
14329
14330 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14331   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14332 }
14333
14334 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14335                                               vector bool int __b) {
14336   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14337 }
14338
14339 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14340                                               vector unsigned int __b) {
14341   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14342 }
14343
14344 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14345                                               vector bool int __b) {
14346   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14347 }
14348
14349 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14350                                               vector int __b) {
14351   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14352                                       (vector unsigned int)__b);
14353 }
14354
14355 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14356                                               vector unsigned int __b) {
14357   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14358 }
14359
14360 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14361                                               vector bool int __b) {
14362   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14363                                       (vector unsigned int)__b);
14364 }
14365
14366 #ifdef __POWER8_VECTOR__
14367 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14368                                               vector signed long long __b) {
14369   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14370 }
14371
14372 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14373                                               vector unsigned long long __b) {
14374   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14375 }
14376
14377 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14378                                               vector bool long long __b) {
14379   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14380                                       (vector signed long long)__b);
14381 }
14382
14383 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14384                                               vector bool long long __b) {
14385   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14386                                       (vector unsigned long long)__b);
14387 }
14388
14389 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14390                                               vector signed long long __b) {
14391   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14392                                       (vector unsigned long long)__b);
14393 }
14394
14395 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14396                                               vector unsigned long long __b) {
14397   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14398                                       __b);
14399 }
14400
14401 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14402                                               vector bool long long __b) {
14403   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14404                                       (vector unsigned long long)__b);
14405 }
14406 #endif
14407
14408 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14409                                               vector float __b) {
14410 #ifdef __VSX__
14411   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14412 #else
14413   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14414 #endif
14415 }
14416
14417 #ifdef __VSX__
14418 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14419                                               vector double __b) {
14420   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14421 }
14422 #endif
14423
14424 /* vec_all_lt */
14425
14426 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14427                                               vector signed char __b) {
14428   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14429 }
14430
14431 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14432                                               vector bool char __b) {
14433   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14434 }
14435
14436 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14437                                               vector unsigned char __b) {
14438   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14439 }
14440
14441 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14442                                               vector bool char __b) {
14443   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14444 }
14445
14446 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14447                                               vector signed char __b) {
14448   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14449                                       (vector unsigned char)__a);
14450 }
14451
14452 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14453                                               vector unsigned char __b) {
14454   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14455 }
14456
14457 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14458                                               vector bool char __b) {
14459   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14460                                       (vector unsigned char)__a);
14461 }
14462
14463 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14464                                               vector short __b) {
14465   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14466 }
14467
14468 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14469                                               vector bool short __b) {
14470   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14471 }
14472
14473 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14474                                               vector unsigned short __b) {
14475   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14476 }
14477
14478 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14479                                               vector bool short __b) {
14480   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14481                                       __a);
14482 }
14483
14484 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14485                                               vector short __b) {
14486   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14487                                       (vector unsigned short)__a);
14488 }
14489
14490 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14491                                               vector unsigned short __b) {
14492   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14493                                       (vector unsigned short)__a);
14494 }
14495
14496 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14497                                               vector bool short __b) {
14498   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14499                                       (vector unsigned short)__a);
14500 }
14501
14502 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14503   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14504 }
14505
14506 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14507                                               vector bool int __b) {
14508   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14509 }
14510
14511 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14512                                               vector unsigned int __b) {
14513   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14514 }
14515
14516 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14517                                               vector bool int __b) {
14518   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14519 }
14520
14521 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14522                                               vector int __b) {
14523   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14524                                       (vector unsigned int)__a);
14525 }
14526
14527 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14528                                               vector unsigned int __b) {
14529   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14530 }
14531
14532 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14533                                               vector bool int __b) {
14534   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14535                                       (vector unsigned int)__a);
14536 }
14537
14538 #ifdef __POWER8_VECTOR__
14539 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14540                                               vector signed long long __b) {
14541   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14542 }
14543
14544 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14545                                               vector unsigned long long __b) {
14546   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14547 }
14548
14549 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14550                                               vector bool long long __b) {
14551   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14552                                       __a);
14553 }
14554
14555 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14556                                               vector bool long long __b) {
14557   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14558                                       __a);
14559 }
14560
14561 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14562                                               vector signed long long __b) {
14563   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14564                                       (vector unsigned long long)__a);
14565 }
14566
14567 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14568                                               vector unsigned long long __b) {
14569   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14570                                       (vector unsigned long long)__a);
14571 }
14572
14573 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14574                                               vector bool long long __b) {
14575   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14576                                       (vector unsigned long long)__a);
14577 }
14578 #endif
14579
14580 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14581                                               vector float __b) {
14582 #ifdef __VSX__
14583   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14584 #else
14585   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14586 #endif
14587 }
14588
14589 #ifdef __VSX__
14590 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14591                                               vector double __b) {
14592   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14593 }
14594 #endif
14595
14596 /* vec_all_nan */
14597
14598 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14599 #ifdef __VSX__
14600   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14601 #else
14602   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14603 #endif
14604 }
14605
14606 #ifdef __VSX__
14607 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14608   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14609 }
14610 #endif
14611
14612 /* vec_all_ne */
14613
14614 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14615                                               vector signed char __b) {
14616   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14617                                       (vector char)__b);
14618 }
14619
14620 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14621                                               vector bool char __b) {
14622   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14623                                       (vector char)__b);
14624 }
14625
14626 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14627                                               vector unsigned char __b) {
14628   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14629                                       (vector char)__b);
14630 }
14631
14632 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14633                                               vector bool char __b) {
14634   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14635                                       (vector char)__b);
14636 }
14637
14638 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14639                                               vector signed char __b) {
14640   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14641                                       (vector char)__b);
14642 }
14643
14644 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14645                                               vector unsigned char __b) {
14646   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14647                                       (vector char)__b);
14648 }
14649
14650 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14651                                               vector bool char __b) {
14652   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14653                                       (vector char)__b);
14654 }
14655
14656 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14657                                               vector short __b) {
14658   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14659 }
14660
14661 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14662                                               vector bool short __b) {
14663   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14664 }
14665
14666 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14667                                               vector unsigned short __b) {
14668   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14669                                       (vector short)__b);
14670 }
14671
14672 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14673                                               vector bool short __b) {
14674   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14675                                       (vector short)__b);
14676 }
14677
14678 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14679                                               vector short __b) {
14680   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14681                                       (vector short)__b);
14682 }
14683
14684 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14685                                               vector unsigned short __b) {
14686   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14687                                       (vector short)__b);
14688 }
14689
14690 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14691                                               vector bool short __b) {
14692   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14693                                       (vector short)__b);
14694 }
14695
14696 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
14697                                               vector pixel __b) {
14698   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14699                                       (vector short)__b);
14700 }
14701
14702 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14703   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14704 }
14705
14706 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14707                                               vector bool int __b) {
14708   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14709 }
14710
14711 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14712                                               vector unsigned int __b) {
14713   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14714                                       (vector int)__b);
14715 }
14716
14717 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14718                                               vector bool int __b) {
14719   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14720                                       (vector int)__b);
14721 }
14722
14723 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14724                                               vector int __b) {
14725   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14726                                       (vector int)__b);
14727 }
14728
14729 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14730                                               vector unsigned int __b) {
14731   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14732                                       (vector int)__b);
14733 }
14734
14735 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14736                                               vector bool int __b) {
14737   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14738                                       (vector int)__b);
14739 }
14740
14741 #ifdef __POWER8_VECTOR__
14742 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14743                                               vector signed long long __b) {
14744   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14745 }
14746
14747 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14748                                               vector unsigned long long __b) {
14749   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14750                                       (vector long long)__b);
14751 }
14752
14753 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14754                                               vector bool long long __b) {
14755   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14756                                       (vector signed long long)__b);
14757 }
14758
14759 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14760                                               vector bool long long __b) {
14761   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14762                                       (vector signed long long)__b);
14763 }
14764
14765 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14766                                               vector signed long long __b) {
14767   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14768                                       (vector signed long long)__b);
14769 }
14770
14771 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14772                                               vector unsigned long long __b) {
14773   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14774                                       (vector signed long long)__b);
14775 }
14776
14777 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14778                                               vector bool long long __b) {
14779   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14780                                       (vector signed long long)__b);
14781 }
14782 #endif
14783
14784 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14785                                               vector float __b) {
14786 #ifdef __VSX__
14787   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, (vector double)__a, (vector double)__b);
14788 #else
14789   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14790 #endif
14791 }
14792
14793 #ifdef __VSX__
14794 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14795                                               vector double __b) {
14796   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14797 }
14798 #endif
14799
14800 /* vec_all_nge */
14801
14802 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14803                                                vector float __b) {
14804 #ifdef __VSX__
14805   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14806 #else
14807   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14808 #endif
14809 }
14810
14811 #ifdef __VSX__
14812 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14813                                                vector double __b) {
14814   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14815 }
14816 #endif
14817
14818 /* vec_all_ngt */
14819
14820 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14821                                                vector float __b) {
14822 #ifdef __VSX__
14823   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14824 #else
14825   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14826 #endif
14827 }
14828
14829 #ifdef __VSX__
14830 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14831                                                vector double __b) {
14832   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14833 }
14834 #endif
14835
14836 /* vec_all_nle */
14837
14838 static __inline__ int __attribute__((__always_inline__))
14839 vec_all_nle(vector float __a, vector float __b) {
14840   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14841 }
14842
14843 /* vec_all_nlt */
14844
14845 static __inline__ int __attribute__((__always_inline__))
14846 vec_all_nlt(vector float __a, vector float __b) {
14847   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14848 }
14849
14850 /* vec_all_numeric */
14851
14852 static __inline__ int __attribute__((__always_inline__))
14853 vec_all_numeric(vector float __a) {
14854   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14855 }
14856
14857 /* vec_any_eq */
14858
14859 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14860                                               vector signed char __b) {
14861   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14862                                       (vector char)__b);
14863 }
14864
14865 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14866                                               vector bool char __b) {
14867   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14868                                       (vector char)__b);
14869 }
14870
14871 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14872                                               vector unsigned char __b) {
14873   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14874                                       (vector char)__b);
14875 }
14876
14877 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14878                                               vector bool char __b) {
14879   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14880                                       (vector char)__b);
14881 }
14882
14883 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14884                                               vector signed char __b) {
14885   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14886                                       (vector char)__b);
14887 }
14888
14889 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14890                                               vector unsigned char __b) {
14891   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14892                                       (vector char)__b);
14893 }
14894
14895 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14896                                               vector bool char __b) {
14897   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14898                                       (vector char)__b);
14899 }
14900
14901 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14902                                               vector short __b) {
14903   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14904 }
14905
14906 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14907                                               vector bool short __b) {
14908   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14909 }
14910
14911 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14912                                               vector unsigned short __b) {
14913   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14914                                       (vector short)__b);
14915 }
14916
14917 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14918                                               vector bool short __b) {
14919   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14920                                       (vector short)__b);
14921 }
14922
14923 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14924                                               vector short __b) {
14925   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14926                                       (vector short)__b);
14927 }
14928
14929 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14930                                               vector unsigned short __b) {
14931   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14932                                       (vector short)__b);
14933 }
14934
14935 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14936                                               vector bool short __b) {
14937   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14938                                       (vector short)__b);
14939 }
14940
14941 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14942                                               vector pixel __b) {
14943   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14944                                       (vector short)__b);
14945 }
14946
14947 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14948   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14949 }
14950
14951 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14952                                               vector bool int __b) {
14953   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14954 }
14955
14956 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14957                                               vector unsigned int __b) {
14958   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14959                                       (vector int)__b);
14960 }
14961
14962 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14963                                               vector bool int __b) {
14964   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14965                                       (vector int)__b);
14966 }
14967
14968 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14969                                               vector int __b) {
14970   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14971                                       (vector int)__b);
14972 }
14973
14974 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14975                                               vector unsigned int __b) {
14976   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14977                                       (vector int)__b);
14978 }
14979
14980 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14981                                               vector bool int __b) {
14982   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14983                                       (vector int)__b);
14984 }
14985
14986 #ifdef __POWER8_VECTOR__
14987 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14988                                               vector signed long long __b) {
14989   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14990 }
14991
14992 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14993                                               vector unsigned long long __b) {
14994   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
14995                                       (vector long long)__b);
14996 }
14997
14998 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14999                                               vector bool long long __b) {
15000   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15001                                       (vector signed long long)__b);
15002 }
15003
15004 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15005                                               vector bool long long __b) {
15006   return __builtin_altivec_vcmpequd_p(
15007       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15008 }
15009
15010 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15011                                               vector signed long long __b) {
15012   return __builtin_altivec_vcmpequd_p(
15013       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15014 }
15015
15016 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15017                                               vector unsigned long long __b) {
15018   return __builtin_altivec_vcmpequd_p(
15019       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15020 }
15021
15022 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15023                                               vector bool long long __b) {
15024   return __builtin_altivec_vcmpequd_p(
15025       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15026 }
15027 #endif
15028
15029 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15030                                               vector float __b) {
15031 #ifdef __VSX__
15032   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15033 #else
15034   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15035 #endif
15036 }
15037
15038 #ifdef __VSX__
15039 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15040                                               vector double __b) {
15041   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15042 }
15043 #endif
15044
15045 /* vec_any_ge */
15046
15047 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15048                                               vector signed char __b) {
15049   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15050 }
15051
15052 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15053                                               vector bool char __b) {
15054   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15055                                       __a);
15056 }
15057
15058 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15059                                               vector unsigned char __b) {
15060   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15061 }
15062
15063 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15064                                               vector bool char __b) {
15065   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15066                                       __a);
15067 }
15068
15069 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15070                                               vector signed char __b) {
15071   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15072                                       (vector unsigned char)__a);
15073 }
15074
15075 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15076                                               vector unsigned char __b) {
15077   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15078                                       (vector unsigned char)__a);
15079 }
15080
15081 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15082                                               vector bool char __b) {
15083   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15084                                       (vector unsigned char)__a);
15085 }
15086
15087 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15088                                               vector short __b) {
15089   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15090 }
15091
15092 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15093                                               vector bool short __b) {
15094   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15095 }
15096
15097 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15098                                               vector unsigned short __b) {
15099   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15100 }
15101
15102 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15103                                               vector bool short __b) {
15104   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15105                                       __a);
15106 }
15107
15108 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15109                                               vector short __b) {
15110   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15111                                       (vector unsigned short)__a);
15112 }
15113
15114 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15115                                               vector unsigned short __b) {
15116   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15117                                       (vector unsigned short)__a);
15118 }
15119
15120 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15121                                               vector bool short __b) {
15122   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15123                                       (vector unsigned short)__a);
15124 }
15125
15126 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15127   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15128 }
15129
15130 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15131                                               vector bool int __b) {
15132   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15133 }
15134
15135 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15136                                               vector unsigned int __b) {
15137   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15138 }
15139
15140 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15141                                               vector bool int __b) {
15142   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15143                                       __a);
15144 }
15145
15146 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15147                                               vector int __b) {
15148   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15149                                       (vector unsigned int)__a);
15150 }
15151
15152 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15153                                               vector unsigned int __b) {
15154   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15155                                       (vector unsigned int)__a);
15156 }
15157
15158 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15159                                               vector bool int __b) {
15160   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15161                                       (vector unsigned int)__a);
15162 }
15163
15164 #ifdef __POWER8_VECTOR__
15165 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15166                                               vector signed long long __b) {
15167   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15168 }
15169
15170 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15171                                               vector unsigned long long __b) {
15172   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15173 }
15174
15175 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15176                                               vector bool long long __b) {
15177   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15178                                       (vector signed long long)__b, __a);
15179 }
15180
15181 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15182                                               vector bool long long __b) {
15183   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15184                                       (vector unsigned long long)__b, __a);
15185 }
15186
15187 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15188                                               vector signed long long __b) {
15189   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15190                                       (vector unsigned long long)__b,
15191                                       (vector unsigned long long)__a);
15192 }
15193
15194 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15195                                               vector unsigned long long __b) {
15196   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15197                                       (vector unsigned long long)__a);
15198 }
15199
15200 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15201                                               vector bool long long __b) {
15202   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15203                                       (vector unsigned long long)__b,
15204                                       (vector unsigned long long)__a);
15205 }
15206 #endif
15207
15208 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15209                                               vector float __b) {
15210 #ifdef __VSX__
15211   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15212 #else
15213   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15214 #endif
15215 }
15216
15217 #ifdef __VSX__
15218 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15219                                               vector double __b) {
15220   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15221 }
15222 #endif
15223
15224 /* vec_any_gt */
15225
15226 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15227                                               vector signed char __b) {
15228   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15229 }
15230
15231 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15232                                               vector bool char __b) {
15233   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15234                                       (vector signed char)__b);
15235 }
15236
15237 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15238                                               vector unsigned char __b) {
15239   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15240 }
15241
15242 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15243                                               vector bool char __b) {
15244   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15245                                       (vector unsigned char)__b);
15246 }
15247
15248 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15249                                               vector signed char __b) {
15250   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15251                                       (vector unsigned char)__b);
15252 }
15253
15254 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15255                                               vector unsigned char __b) {
15256   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15257                                       __b);
15258 }
15259
15260 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15261                                               vector bool char __b) {
15262   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15263                                       (vector unsigned char)__b);
15264 }
15265
15266 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15267                                               vector short __b) {
15268   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15269 }
15270
15271 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15272                                               vector bool short __b) {
15273   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15274 }
15275
15276 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15277                                               vector unsigned short __b) {
15278   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15279 }
15280
15281 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15282                                               vector bool short __b) {
15283   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15284                                       (vector unsigned short)__b);
15285 }
15286
15287 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15288                                               vector short __b) {
15289   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15290                                       (vector unsigned short)__b);
15291 }
15292
15293 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15294                                               vector unsigned short __b) {
15295   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15296                                       __b);
15297 }
15298
15299 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15300                                               vector bool short __b) {
15301   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15302                                       (vector unsigned short)__b);
15303 }
15304
15305 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15306   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15307 }
15308
15309 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15310                                               vector bool int __b) {
15311   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15312 }
15313
15314 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15315                                               vector unsigned int __b) {
15316   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15317 }
15318
15319 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15320                                               vector bool int __b) {
15321   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15322                                       (vector unsigned int)__b);
15323 }
15324
15325 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15326                                               vector int __b) {
15327   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15328                                       (vector unsigned int)__b);
15329 }
15330
15331 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15332                                               vector unsigned int __b) {
15333   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15334                                       __b);
15335 }
15336
15337 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15338                                               vector bool int __b) {
15339   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15340                                       (vector unsigned int)__b);
15341 }
15342
15343 #ifdef __POWER8_VECTOR__
15344 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15345                                               vector signed long long __b) {
15346   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15347 }
15348
15349 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15350                                               vector unsigned long long __b) {
15351   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15352 }
15353
15354 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15355                                               vector bool long long __b) {
15356   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15357                                       (vector signed long long)__b);
15358 }
15359
15360 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15361                                               vector bool long long __b) {
15362   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15363                                       (vector unsigned long long)__b);
15364 }
15365
15366 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15367                                               vector signed long long __b) {
15368   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15369                                       (vector unsigned long long)__a,
15370                                       (vector unsigned long long)__b);
15371 }
15372
15373 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15374                                               vector unsigned long long __b) {
15375   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15376                                       (vector unsigned long long)__a, __b);
15377 }
15378
15379 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15380                                               vector bool long long __b) {
15381   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15382                                       (vector unsigned long long)__a,
15383                                       (vector unsigned long long)__b);
15384 }
15385 #endif
15386
15387 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15388                                               vector float __b) {
15389 #ifdef __VSX__
15390   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15391 #else
15392   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15393 #endif
15394 }
15395
15396 #ifdef __VSX__
15397 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15398                                               vector double __b) {
15399   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15400 }
15401 #endif
15402
15403 /* vec_any_le */
15404
15405 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15406                                               vector signed char __b) {
15407   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15408 }
15409
15410 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15411                                               vector bool char __b) {
15412   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15413                                       (vector signed char)__b);
15414 }
15415
15416 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15417                                               vector unsigned char __b) {
15418   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15419 }
15420
15421 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15422                                               vector bool char __b) {
15423   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15424                                       (vector unsigned char)__b);
15425 }
15426
15427 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15428                                               vector signed char __b) {
15429   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15430                                       (vector unsigned char)__b);
15431 }
15432
15433 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15434                                               vector unsigned char __b) {
15435   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15436                                       __b);
15437 }
15438
15439 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15440                                               vector bool char __b) {
15441   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15442                                       (vector unsigned char)__b);
15443 }
15444
15445 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15446                                               vector short __b) {
15447   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15448 }
15449
15450 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15451                                               vector bool short __b) {
15452   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15453 }
15454
15455 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15456                                               vector unsigned short __b) {
15457   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15458 }
15459
15460 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15461                                               vector bool short __b) {
15462   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15463                                       (vector unsigned short)__b);
15464 }
15465
15466 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15467                                               vector short __b) {
15468   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15469                                       (vector unsigned short)__b);
15470 }
15471
15472 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15473                                               vector unsigned short __b) {
15474   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15475                                       __b);
15476 }
15477
15478 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15479                                               vector bool short __b) {
15480   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15481                                       (vector unsigned short)__b);
15482 }
15483
15484 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15485   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15486 }
15487
15488 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15489                                               vector bool int __b) {
15490   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15491 }
15492
15493 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15494                                               vector unsigned int __b) {
15495   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15496 }
15497
15498 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15499                                               vector bool int __b) {
15500   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15501                                       (vector unsigned int)__b);
15502 }
15503
15504 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15505                                               vector int __b) {
15506   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15507                                       (vector unsigned int)__b);
15508 }
15509
15510 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15511                                               vector unsigned int __b) {
15512   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15513                                       __b);
15514 }
15515
15516 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15517                                               vector bool int __b) {
15518   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15519                                       (vector unsigned int)__b);
15520 }
15521
15522 #ifdef __POWER8_VECTOR__
15523 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15524                                               vector signed long long __b) {
15525   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15526 }
15527
15528 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15529                                               vector unsigned long long __b) {
15530   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15531 }
15532
15533 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15534                                               vector bool long long __b) {
15535   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15536                                       (vector signed long long)__b);
15537 }
15538
15539 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15540                                               vector bool long long __b) {
15541   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15542                                       (vector unsigned long long)__b);
15543 }
15544
15545 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15546                                               vector signed long long __b) {
15547   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15548                                       (vector unsigned long long)__a,
15549                                       (vector unsigned long long)__b);
15550 }
15551
15552 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15553                                               vector unsigned long long __b) {
15554   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15555                                       (vector unsigned long long)__a, __b);
15556 }
15557
15558 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15559                                               vector bool long long __b) {
15560   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15561                                       (vector unsigned long long)__a,
15562                                       (vector unsigned long long)__b);
15563 }
15564 #endif
15565
15566 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15567                                               vector float __b) {
15568 #ifdef __VSX__
15569   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15570 #else
15571   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15572 #endif
15573 }
15574
15575 #ifdef __VSX__
15576 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15577                                               vector double __b) {
15578   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15579 }
15580 #endif
15581
15582 /* vec_any_lt */
15583
15584 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15585                                               vector signed char __b) {
15586   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15587 }
15588
15589 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15590                                               vector bool char __b) {
15591   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15592                                       __a);
15593 }
15594
15595 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15596                                               vector unsigned char __b) {
15597   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15598 }
15599
15600 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15601                                               vector bool char __b) {
15602   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15603                                       __a);
15604 }
15605
15606 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15607                                               vector signed char __b) {
15608   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15609                                       (vector unsigned char)__a);
15610 }
15611
15612 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15613                                               vector unsigned char __b) {
15614   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15615                                       (vector unsigned char)__a);
15616 }
15617
15618 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15619                                               vector bool char __b) {
15620   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15621                                       (vector unsigned char)__a);
15622 }
15623
15624 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15625                                               vector short __b) {
15626   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15627 }
15628
15629 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15630                                               vector bool short __b) {
15631   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15632 }
15633
15634 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15635                                               vector unsigned short __b) {
15636   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15637 }
15638
15639 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15640                                               vector bool short __b) {
15641   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15642                                       __a);
15643 }
15644
15645 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15646                                               vector short __b) {
15647   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15648                                       (vector unsigned short)__a);
15649 }
15650
15651 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15652                                               vector unsigned short __b) {
15653   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15654                                       (vector unsigned short)__a);
15655 }
15656
15657 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15658                                               vector bool short __b) {
15659   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15660                                       (vector unsigned short)__a);
15661 }
15662
15663 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15664   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15665 }
15666
15667 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15668                                               vector bool int __b) {
15669   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15670 }
15671
15672 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15673                                               vector unsigned int __b) {
15674   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15675 }
15676
15677 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15678                                               vector bool int __b) {
15679   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15680                                       __a);
15681 }
15682
15683 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15684                                               vector int __b) {
15685   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15686                                       (vector unsigned int)__a);
15687 }
15688
15689 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15690                                               vector unsigned int __b) {
15691   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15692                                       (vector unsigned int)__a);
15693 }
15694
15695 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15696                                               vector bool int __b) {
15697   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15698                                       (vector unsigned int)__a);
15699 }
15700
15701 #ifdef __POWER8_VECTOR__
15702 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15703                                               vector signed long long __b) {
15704   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15705 }
15706
15707 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15708                                               vector unsigned long long __b) {
15709   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15710 }
15711
15712 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15713                                               vector bool long long __b) {
15714   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15715                                       (vector signed long long)__b, __a);
15716 }
15717
15718 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15719                                               vector bool long long __b) {
15720   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15721                                       (vector unsigned long long)__b, __a);
15722 }
15723
15724 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15725                                               vector signed long long __b) {
15726   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15727                                       (vector unsigned long long)__b,
15728                                       (vector unsigned long long)__a);
15729 }
15730
15731 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15732                                               vector unsigned long long __b) {
15733   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15734                                       (vector unsigned long long)__a);
15735 }
15736
15737 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15738                                               vector bool long long __b) {
15739   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15740                                       (vector unsigned long long)__b,
15741                                       (vector unsigned long long)__a);
15742 }
15743 #endif
15744
15745 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15746                                               vector float __b) {
15747 #ifdef __VSX__
15748   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15749 #else
15750   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15751 #endif
15752 }
15753
15754 #ifdef __VSX__
15755 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15756                                               vector double __b) {
15757   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15758 }
15759 #endif
15760
15761 /* vec_any_nan */
15762
15763 static __inline__ int __attribute__((__always_inline__))
15764 vec_any_nan(vector float __a) {
15765   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15766 }
15767
15768 /* vec_any_ne */
15769
15770 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15771                                               vector signed char __b) {
15772   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15773                                       (vector char)__b);
15774 }
15775
15776 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15777                                               vector bool char __b) {
15778   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15779                                       (vector char)__b);
15780 }
15781
15782 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15783                                               vector unsigned char __b) {
15784   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15785                                       (vector char)__b);
15786 }
15787
15788 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15789                                               vector bool char __b) {
15790   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15791                                       (vector char)__b);
15792 }
15793
15794 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15795                                               vector signed char __b) {
15796   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15797                                       (vector char)__b);
15798 }
15799
15800 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15801                                               vector unsigned char __b) {
15802   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15803                                       (vector char)__b);
15804 }
15805
15806 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15807                                               vector bool char __b) {
15808   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15809                                       (vector char)__b);
15810 }
15811
15812 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15813                                               vector short __b) {
15814   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15815 }
15816
15817 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15818                                               vector bool short __b) {
15819   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15820 }
15821
15822 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15823                                               vector unsigned short __b) {
15824   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15825                                       (vector short)__b);
15826 }
15827
15828 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15829                                               vector bool short __b) {
15830   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15831                                       (vector short)__b);
15832 }
15833
15834 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15835                                               vector short __b) {
15836   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15837                                       (vector short)__b);
15838 }
15839
15840 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15841                                               vector unsigned short __b) {
15842   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15843                                       (vector short)__b);
15844 }
15845
15846 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15847                                               vector bool short __b) {
15848   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15849                                       (vector short)__b);
15850 }
15851
15852 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15853                                               vector pixel __b) {
15854   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15855                                       (vector short)__b);
15856 }
15857
15858 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15859   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15860 }
15861
15862 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15863                                               vector bool int __b) {
15864   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15865 }
15866
15867 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15868                                               vector unsigned int __b) {
15869   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15870                                       (vector int)__b);
15871 }
15872
15873 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15874                                               vector bool int __b) {
15875   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15876                                       (vector int)__b);
15877 }
15878
15879 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15880                                               vector int __b) {
15881   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15882                                       (vector int)__b);
15883 }
15884
15885 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15886                                               vector unsigned int __b) {
15887   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15888                                       (vector int)__b);
15889 }
15890
15891 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15892                                               vector bool int __b) {
15893   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15894                                       (vector int)__b);
15895 }
15896
15897 #ifdef __POWER8_VECTOR__
15898 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15899                                               vector signed long long __b) {
15900   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15901 }
15902
15903 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15904                                               vector unsigned long long __b) {
15905   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15906                                       (vector long long)__b);
15907 }
15908
15909 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15910                                               vector bool long long __b) {
15911   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15912                                       (vector signed long long)__b);
15913 }
15914
15915 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15916                                               vector bool long long __b) {
15917   return __builtin_altivec_vcmpequd_p(
15918       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15919 }
15920
15921 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15922                                               vector signed long long __b) {
15923   return __builtin_altivec_vcmpequd_p(
15924       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15925 }
15926
15927 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15928                                               vector unsigned long long __b) {
15929   return __builtin_altivec_vcmpequd_p(
15930       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15931 }
15932
15933 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15934                                               vector bool long long __b) {
15935   return __builtin_altivec_vcmpequd_p(
15936       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15937 }
15938 #endif
15939
15940 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15941                                               vector float __b) {
15942 #ifdef __VSX__
15943   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15944 #else
15945   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15946 #endif
15947 }
15948
15949 #ifdef __VSX__
15950 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15951                                               vector double __b) {
15952   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15953 }
15954 #endif
15955
15956 /* vec_any_nge */
15957
15958 static __inline__ int __attribute__((__always_inline__))
15959 vec_any_nge(vector float __a, vector float __b) {
15960   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15961 }
15962
15963 /* vec_any_ngt */
15964
15965 static __inline__ int __attribute__((__always_inline__))
15966 vec_any_ngt(vector float __a, vector float __b) {
15967   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15968 }
15969
15970 /* vec_any_nle */
15971
15972 static __inline__ int __attribute__((__always_inline__))
15973 vec_any_nle(vector float __a, vector float __b) {
15974   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15975 }
15976
15977 /* vec_any_nlt */
15978
15979 static __inline__ int __attribute__((__always_inline__))
15980 vec_any_nlt(vector float __a, vector float __b) {
15981   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15982 }
15983
15984 /* vec_any_numeric */
15985
15986 static __inline__ int __attribute__((__always_inline__))
15987 vec_any_numeric(vector float __a) {
15988   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15989 }
15990
15991 /* vec_any_out */
15992
15993 static __inline__ int __attribute__((__always_inline__))
15994 vec_any_out(vector float __a, vector float __b) {
15995   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
15996 }
15997
15998 /* Power 8 Crypto functions
15999 Note: We diverge from the current GCC implementation with regard
16000 to cryptography and related functions as follows:
16001 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16002 - The remaining ones are only available on Power8 and up so
16003   require -mpower8-vector
16004 The justification for this is that export requirements require that
16005 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16006 support). As a result, we need to be able to turn off support for those.
16007 The remaining ones (currently controlled by -mcrypto for GCC) still
16008 need to be provided on compliant hardware even if Vector.Crypto is not
16009 provided.
16010 */
16011 #ifdef __CRYPTO__
16012 #define vec_sbox_be __builtin_altivec_crypto_vsbox
16013 #define vec_cipher_be __builtin_altivec_crypto_vcipher
16014 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16015 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
16016 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16017
16018 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16019 __builtin_crypto_vsbox(vector unsigned long long __a) {
16020   return __builtin_altivec_crypto_vsbox(__a);
16021 }
16022
16023 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16024 __builtin_crypto_vcipher(vector unsigned long long __a,
16025                          vector unsigned long long __b) {
16026   return __builtin_altivec_crypto_vcipher(__a, __b);
16027 }
16028
16029 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16030 __builtin_crypto_vcipherlast(vector unsigned long long __a,
16031                              vector unsigned long long __b) {
16032   return __builtin_altivec_crypto_vcipherlast(__a, __b);
16033 }
16034
16035 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16036 __builtin_crypto_vncipher(vector unsigned long long __a,
16037                           vector unsigned long long __b) {
16038   return __builtin_altivec_crypto_vncipher(__a, __b);
16039 }
16040
16041 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16042 __builtin_crypto_vncipherlast(vector unsigned long long __a,
16043                               vector unsigned long long __b) {
16044   return __builtin_altivec_crypto_vncipherlast(__a, __b);
16045 }
16046
16047 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16048 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16049
16050 #define vec_shasigma_be(X, Y, Z)                                               \
16051   _Generic((X), vector unsigned int                                            \
16052            : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16053            : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16054 #endif
16055
16056 #ifdef __POWER8_VECTOR__
16057 static __inline__ vector bool char __ATTRS_o_ai
16058 vec_permxor(vector bool char __a, vector bool char __b,
16059             vector bool char __c) {
16060   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16061 }
16062
16063 static __inline__ vector signed char __ATTRS_o_ai
16064 vec_permxor(vector signed char __a, vector signed char __b,
16065             vector signed char __c) {
16066   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16067 }
16068
16069 static __inline__ vector unsigned char __ATTRS_o_ai
16070 vec_permxor(vector unsigned char __a, vector unsigned char __b,
16071             vector unsigned char __c) {
16072   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16073 }
16074
16075 static __inline__ vector unsigned char __ATTRS_o_ai
16076 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16077                           vector unsigned char __c) {
16078   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16079 }
16080
16081 static __inline__ vector unsigned short __ATTRS_o_ai
16082 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16083                           vector unsigned short __c) {
16084   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16085       (vector unsigned char)__a, (vector unsigned char)__b,
16086       (vector unsigned char)__c);
16087 }
16088
16089 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16090     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16091   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16092       (vector unsigned char)__a, (vector unsigned char)__b,
16093       (vector unsigned char)__c);
16094 }
16095
16096 static __inline__ vector unsigned long long __ATTRS_o_ai
16097 __builtin_crypto_vpermxor(vector unsigned long long __a,
16098                           vector unsigned long long __b,
16099                           vector unsigned long long __c) {
16100   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16101       (vector unsigned char)__a, (vector unsigned char)__b,
16102       (vector unsigned char)__c);
16103 }
16104
16105 static __inline__ vector unsigned char __ATTRS_o_ai
16106 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16107   return __builtin_altivec_crypto_vpmsumb(__a, __b);
16108 }
16109
16110 static __inline__ vector unsigned short __ATTRS_o_ai
16111 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16112   return __builtin_altivec_crypto_vpmsumh(__a, __b);
16113 }
16114
16115 static __inline__ vector unsigned int __ATTRS_o_ai
16116 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16117   return __builtin_altivec_crypto_vpmsumw(__a, __b);
16118 }
16119
16120 static __inline__ vector unsigned long long __ATTRS_o_ai
16121 __builtin_crypto_vpmsumb(vector unsigned long long __a,
16122                          vector unsigned long long __b) {
16123   return __builtin_altivec_crypto_vpmsumd(__a, __b);
16124 }
16125
16126 static __inline__ vector signed char __ATTRS_o_ai
16127 vec_vgbbd(vector signed char __a) {
16128   return __builtin_altivec_vgbbd((vector unsigned char)__a);
16129 }
16130
16131 #define vec_pmsum_be __builtin_crypto_vpmsumb
16132 #define vec_gb __builtin_altivec_vgbbd
16133
16134 static __inline__ vector unsigned char __ATTRS_o_ai
16135 vec_vgbbd(vector unsigned char __a) {
16136   return __builtin_altivec_vgbbd(__a);
16137 }
16138
16139 static __inline__ vector long long __ATTRS_o_ai
16140 vec_vbpermq(vector signed char __a, vector signed char __b) {
16141   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16142                                    (vector unsigned char)__b);
16143 }
16144
16145 static __inline__ vector long long __ATTRS_o_ai
16146 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16147   return __builtin_altivec_vbpermq(__a, __b);
16148 }
16149
16150 #ifdef __powerpc64__
16151 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16152 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16153   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16154                                    (vector unsigned char)__b);
16155 }
16156 #endif
16157 #endif
16158
16159
16160 /* vec_reve */
16161
16162 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16163   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16164                                  5, 4, 3, 2, 1, 0);
16165 }
16166
16167 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16168   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16169                                  5, 4, 3, 2, 1, 0);
16170 }
16171
16172 static inline __ATTRS_o_ai vector unsigned char
16173 vec_reve(vector unsigned char __a) {
16174   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16175                                  5, 4, 3, 2, 1, 0);
16176 }
16177
16178 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16179   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16180 }
16181
16182 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16183   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16184 }
16185
16186 static inline __ATTRS_o_ai vector unsigned int
16187 vec_reve(vector unsigned int __a) {
16188   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16189 }
16190
16191 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16192   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16193 }
16194
16195 static inline __ATTRS_o_ai vector signed short
16196 vec_reve(vector signed short __a) {
16197   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16198 }
16199
16200 static inline __ATTRS_o_ai vector unsigned short
16201 vec_reve(vector unsigned short __a) {
16202   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16203 }
16204
16205 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16206   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16207 }
16208
16209 #ifdef __VSX__
16210 static inline __ATTRS_o_ai vector bool long long
16211 vec_reve(vector bool long long __a) {
16212   return __builtin_shufflevector(__a, __a, 1, 0);
16213 }
16214
16215 static inline __ATTRS_o_ai vector signed long long
16216 vec_reve(vector signed long long __a) {
16217   return __builtin_shufflevector(__a, __a, 1, 0);
16218 }
16219
16220 static inline __ATTRS_o_ai vector unsigned long long
16221 vec_reve(vector unsigned long long __a) {
16222   return __builtin_shufflevector(__a, __a, 1, 0);
16223 }
16224
16225 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16226   return __builtin_shufflevector(__a, __a, 1, 0);
16227 }
16228 #endif
16229
16230 /* vec_revb */
16231 static __inline__ vector bool char __ATTRS_o_ai
16232 vec_revb(vector bool char __a) {
16233   return __a;
16234 }
16235
16236 static __inline__ vector signed char __ATTRS_o_ai
16237 vec_revb(vector signed char __a) {
16238   return __a;
16239 }
16240
16241 static __inline__ vector unsigned char __ATTRS_o_ai
16242 vec_revb(vector unsigned char __a) {
16243   return __a;
16244 }
16245
16246 static __inline__ vector bool short __ATTRS_o_ai
16247 vec_revb(vector bool short __a) {
16248   vector unsigned char __indices =
16249       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16250   return vec_perm(__a, __a, __indices);
16251 }
16252
16253 static __inline__ vector signed short __ATTRS_o_ai
16254 vec_revb(vector signed short __a) {
16255   vector unsigned char __indices =
16256       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16257   return vec_perm(__a, __a, __indices);
16258 }
16259
16260 static __inline__ vector unsigned short __ATTRS_o_ai
16261 vec_revb(vector unsigned short __a) {
16262   vector unsigned char __indices =
16263      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16264   return vec_perm(__a, __a, __indices);
16265 }
16266
16267 static __inline__ vector bool int __ATTRS_o_ai
16268 vec_revb(vector bool int __a) {
16269   vector unsigned char __indices =
16270       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16271   return vec_perm(__a, __a, __indices);
16272 }
16273
16274 static __inline__ vector signed int __ATTRS_o_ai
16275 vec_revb(vector signed int __a) {
16276   vector unsigned char __indices =
16277       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16278   return vec_perm(__a, __a, __indices);
16279 }
16280
16281 static __inline__ vector unsigned int __ATTRS_o_ai
16282 vec_revb(vector unsigned int __a) {
16283   vector unsigned char __indices =
16284       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16285   return vec_perm(__a, __a, __indices);
16286 }
16287
16288 static __inline__ vector float __ATTRS_o_ai
16289 vec_revb(vector float __a) {
16290  vector unsigned char __indices =
16291       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16292  return vec_perm(__a, __a, __indices);
16293 }
16294
16295 #ifdef __VSX__
16296 static __inline__ vector bool long long __ATTRS_o_ai
16297 vec_revb(vector bool long long __a) {
16298   vector unsigned char __indices =
16299       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16300   return vec_perm(__a, __a, __indices);
16301 }
16302
16303 static __inline__ vector signed long long __ATTRS_o_ai
16304 vec_revb(vector signed long long __a) {
16305   vector unsigned char __indices =
16306       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16307   return vec_perm(__a, __a, __indices);
16308 }
16309
16310 static __inline__ vector unsigned long long __ATTRS_o_ai
16311 vec_revb(vector unsigned long long __a) {
16312   vector unsigned char __indices =
16313       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16314   return vec_perm(__a, __a, __indices);
16315 }
16316
16317 static __inline__ vector double __ATTRS_o_ai
16318 vec_revb(vector double __a) {
16319   vector unsigned char __indices =
16320       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16321   return vec_perm(__a, __a, __indices);
16322 }
16323 #endif /* End __VSX__ */
16324
16325 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16326 static __inline__ vector signed __int128 __ATTRS_o_ai
16327 vec_revb(vector signed __int128 __a) {
16328   vector unsigned char __indices =
16329       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16330   return (vector signed __int128)vec_perm((vector signed int)__a,
16331                                           (vector signed int)__a,
16332                                            __indices);
16333 }
16334
16335 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16336 vec_revb(vector unsigned __int128 __a) {
16337   vector unsigned char __indices =
16338       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16339   return (vector unsigned __int128)vec_perm((vector signed int)__a,
16340                                             (vector signed int)__a,
16341                                              __indices);
16342 }
16343 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16344
16345 /* vec_xl */
16346
16347 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
16348 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
16349 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
16350 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
16351 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
16352 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
16353 typedef vector float unaligned_vec_float __attribute__((aligned(1)));
16354
16355 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16356                                                      signed char *__ptr) {
16357   return *(unaligned_vec_schar *)(__ptr + __offset);
16358 }
16359
16360 static inline __ATTRS_o_ai vector unsigned char
16361 vec_xl(signed long long __offset, unsigned char *__ptr) {
16362   return *(unaligned_vec_uchar*)(__ptr + __offset);
16363 }
16364
16365 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16366                                                       signed short *__ptr) {
16367   return *(unaligned_vec_sshort *)(__ptr + __offset);
16368 }
16369
16370 static inline __ATTRS_o_ai vector unsigned short
16371 vec_xl(signed long long __offset, unsigned short *__ptr) {
16372   return *(unaligned_vec_ushort *)(__ptr + __offset);
16373 }
16374
16375 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16376                                                     signed int *__ptr) {
16377   return *(unaligned_vec_sint *)(__ptr + __offset);
16378 }
16379
16380 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16381                                                       unsigned int *__ptr) {
16382   return *(unaligned_vec_uint *)(__ptr + __offset);
16383 }
16384
16385 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16386                                                float *__ptr) {
16387   return *(unaligned_vec_float *)(__ptr + __offset);
16388 }
16389
16390 #ifdef __VSX__
16391 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
16392 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
16393 typedef vector double unaligned_vec_double __attribute__((aligned(1)));
16394
16395 static inline __ATTRS_o_ai vector signed long long
16396 vec_xl(signed long long __offset, signed long long *__ptr) {
16397   return *(unaligned_vec_sll *)(__ptr + __offset);
16398 }
16399
16400 static inline __ATTRS_o_ai vector unsigned long long
16401 vec_xl(signed long long __offset, unsigned long long *__ptr) {
16402   return *(unaligned_vec_ull *)(__ptr + __offset);
16403 }
16404
16405 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16406                                                 double *__ptr) {
16407   return *(unaligned_vec_double *)(__ptr + __offset);
16408 }
16409 #endif
16410
16411 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16412 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
16413 typedef vector unsigned __int128 unaligned_vec_ui128
16414     __attribute__((aligned(1)));
16415 static inline __ATTRS_o_ai vector signed __int128
16416 vec_xl(signed long long __offset, signed __int128 *__ptr) {
16417   return *(unaligned_vec_si128 *)(__ptr + __offset);
16418 }
16419
16420 static inline __ATTRS_o_ai vector unsigned __int128
16421 vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16422   return *(unaligned_vec_ui128 *)(__ptr + __offset);
16423 }
16424 #endif
16425
16426 /* vec_xl_be */
16427
16428 #ifdef __LITTLE_ENDIAN__
16429 static __inline__ vector signed char __ATTRS_o_ai
16430 vec_xl_be(signed long long __offset, signed char *__ptr) {
16431   vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16432   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16433                                  13, 12, 11, 10, 9, 8);
16434 }
16435
16436 static __inline__ vector unsigned char __ATTRS_o_ai
16437 vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16438   vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16439   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16440                                  13, 12, 11, 10, 9, 8);
16441 }
16442
16443 static __inline__ vector signed short  __ATTRS_o_ai
16444 vec_xl_be(signed long long __offset, signed short *__ptr) {
16445   vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16446   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16447 }
16448
16449 static __inline__ vector unsigned short __ATTRS_o_ai
16450 vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16451   vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16452   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16453 }
16454
16455 static __inline__ vector signed int __ATTRS_o_ai
16456 vec_xl_be(signed long long  __offset, signed int *__ptr) {
16457   return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16458 }
16459
16460 static __inline__ vector unsigned int __ATTRS_o_ai
16461 vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16462   return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16463 }
16464
16465 static __inline__ vector float __ATTRS_o_ai
16466 vec_xl_be(signed long long  __offset, float *__ptr) {
16467   return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16468 }
16469
16470 #ifdef __VSX__
16471 static __inline__ vector signed long long __ATTRS_o_ai
16472 vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16473   return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16474 }
16475
16476 static __inline__ vector unsigned long long __ATTRS_o_ai
16477 vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16478   return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16479 }
16480
16481 static __inline__ vector double __ATTRS_o_ai
16482 vec_xl_be(signed long long  __offset, double *__ptr) {
16483   return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16484 }
16485 #endif
16486
16487 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16488 static __inline__ vector signed __int128 __ATTRS_o_ai
16489 vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16490   return vec_xl(__offset, __ptr);
16491 }
16492
16493 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16494 vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16495   return vec_xl(__offset, __ptr);
16496 }
16497 #endif
16498 #else
16499   #define vec_xl_be vec_xl
16500 #endif
16501
16502 /* vec_xst */
16503
16504 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16505                                         signed long long __offset,
16506                                         signed char *__ptr) {
16507   *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
16508 }
16509
16510 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16511                                         signed long long __offset,
16512                                         unsigned char *__ptr) {
16513   *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
16514 }
16515
16516 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16517                                         signed long long __offset,
16518                                         signed short *__ptr) {
16519   *(unaligned_vec_sshort *)(__ptr + __offset) = __vec;
16520 }
16521
16522 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
16523                                         signed long long __offset,
16524                                         unsigned short *__ptr) {
16525   *(unaligned_vec_ushort *)(__ptr + __offset) = __vec;
16526 }
16527
16528 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16529                                         signed long long __offset,
16530                                         signed int *__ptr) {
16531   *(unaligned_vec_sint *)(__ptr + __offset) = __vec;
16532 }
16533
16534 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16535                                         signed long long __offset,
16536                                         unsigned int *__ptr) {
16537   *(unaligned_vec_uint *)(__ptr + __offset) = __vec;
16538 }
16539
16540 static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16541                                         signed long long __offset,
16542                                         float *__ptr) {
16543   *(unaligned_vec_float *)(__ptr + __offset) = __vec;
16544 }
16545
16546 #ifdef __VSX__
16547 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16548                                         signed long long __offset,
16549                                         signed long long *__ptr) {
16550   *(unaligned_vec_sll *)(__ptr + __offset) = __vec;
16551 }
16552
16553 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16554                                         signed long long __offset,
16555                                         unsigned long long *__ptr) {
16556   *(unaligned_vec_ull *)(__ptr + __offset) = __vec;
16557 }
16558
16559 static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16560                                         signed long long __offset,
16561                                         double *__ptr) {
16562   *(unaligned_vec_double *)(__ptr + __offset) = __vec;
16563 }
16564 #endif
16565
16566 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16567 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16568                                         signed long long __offset,
16569                                         signed __int128 *__ptr) {
16570   *(unaligned_vec_si128 *)(__ptr + __offset) = __vec;
16571 }
16572
16573 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16574                                         signed long long __offset,
16575                                         unsigned __int128 *__ptr) {
16576   *(unaligned_vec_ui128 *)(__ptr + __offset) = __vec;
16577 }
16578 #endif
16579
16580 /* vec_xst_be */
16581
16582 #ifdef __LITTLE_ENDIAN__
16583 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16584                                                signed long long  __offset,
16585                                                signed char *__ptr) {
16586   vector signed char __tmp =
16587      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16588                              13, 12, 11, 10, 9, 8);
16589   typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16590   __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16591 }
16592
16593 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16594                                                signed long long  __offset,
16595                                                unsigned char *__ptr) {
16596   vector unsigned char __tmp =
16597      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16598                              13, 12, 11, 10, 9, 8);
16599   typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16600   __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16601 }
16602
16603 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16604                                                signed long long  __offset,
16605                                                signed short *__ptr) {
16606   vector signed short __tmp =
16607      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16608   typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16609   __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16610 }
16611
16612 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16613                                                signed long long  __offset,
16614                                                unsigned short *__ptr) {
16615   vector unsigned short __tmp =
16616      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16617   typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
16618   __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
16619 }
16620
16621 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16622                                                signed long long  __offset,
16623                                                signed int *__ptr) {
16624   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16625 }
16626
16627 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16628                                                signed long long  __offset,
16629                                                unsigned int *__ptr) {
16630   __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
16631 }
16632
16633 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16634                                                signed long long  __offset,
16635                                                float *__ptr) {
16636   __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
16637 }
16638
16639 #ifdef __VSX__
16640 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16641                                                signed long long  __offset,
16642                                                signed long long *__ptr) {
16643   __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16644 }
16645
16646 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16647                                                signed long long  __offset,
16648                                                unsigned long long *__ptr) {
16649   __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16650 }
16651
16652 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16653                                                signed long long  __offset,
16654                                                double *__ptr) {
16655   __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
16656 }
16657 #endif
16658
16659 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16660 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16661                                                signed long long  __offset,
16662                                                signed __int128 *__ptr) {
16663   vec_xst(__vec, __offset, __ptr);
16664 }
16665
16666 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16667                                                signed long long  __offset,
16668                                                unsigned __int128 *__ptr) {
16669   vec_xst(__vec, __offset, __ptr);
16670 }
16671 #endif
16672 #else
16673   #define vec_xst_be vec_xst
16674 #endif
16675
16676 #ifdef __POWER9_VECTOR__
16677 #define vec_test_data_class(__a, __b)                                          \
16678   _Generic(                                                                    \
16679       (__a), vector float                                                      \
16680       : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)),  \
16681         vector double                                                          \
16682       : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a),   \
16683                                                        (__b)))
16684
16685 #endif /* #ifdef __POWER9_VECTOR__ */
16686
16687 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16688   return -__a;
16689 }
16690
16691 #ifdef __VSX__
16692 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16693   return -__a;
16694 }
16695
16696 #endif
16697
16698 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16699 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16700   return -__a;
16701 }
16702 #endif
16703
16704 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16705   return -__a;
16706 }
16707
16708 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16709   return -__a;
16710 }
16711
16712 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16713   return -__a;
16714 }
16715
16716 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16717   return - vec_abs(__a);
16718 }
16719
16720 #ifdef __VSX__
16721 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16722   return - vec_abs(__a);
16723 }
16724
16725 #endif
16726
16727 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16728 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16729   return __builtin_altivec_vminsd(__a, -__a);
16730 }
16731 #endif
16732
16733 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16734   return __builtin_altivec_vminsw(__a, -__a);
16735 }
16736
16737 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16738   return __builtin_altivec_vminsh(__a, -__a);
16739 }
16740
16741 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16742   return __builtin_altivec_vminsb(__a, -__a);
16743 }
16744 #undef __ATTRS_o_ai
16745
16746 #endif /* __ALTIVEC_H */