]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
Merge llvm, clang, lld and lldb release_40 branch r292009. Also update
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Headers / altivec.h
1 /*===---- altivec.h - Standard header for type generic math ---------------===*\
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  *
21 \*===----------------------------------------------------------------------===*/
22
23 #ifndef __ALTIVEC_H
24 #define __ALTIVEC_H
25
26 #ifndef __ALTIVEC__
27 #error "AltiVec support not enabled"
28 #endif
29
30 /* Constants for mapping CR6 bits to predicate result. */
31
32 #define __CR6_EQ 0
33 #define __CR6_EQ_REV 1
34 #define __CR6_LT 2
35 #define __CR6_LT_REV 3
36
37 /* Constants for vec_test_data_class */
38 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
39 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
40 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
41                                   __VEC_CLASS_FP_SUBNORMAL_N)
42 #define __VEC_CLASS_FP_ZERO_N (1<<2)
43 #define __VEC_CLASS_FP_ZERO_P (1<<3)
44 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P           | \
45                              __VEC_CLASS_FP_ZERO_N)
46 #define __VEC_CLASS_FP_INFINITY_N (1<<4)
47 #define __VEC_CLASS_FP_INFINITY_P (1<<5)
48 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P   | \
49                                  __VEC_CLASS_FP_INFINITY_N)
50 #define __VEC_CLASS_FP_NAN (1<<6)
51 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN        | \
52                                    __VEC_CLASS_FP_SUBNORMAL  | \
53                                    __VEC_CLASS_FP_ZERO       | \
54                                    __VEC_CLASS_FP_INFINITY)
55
56 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
57
58 #ifdef __POWER9_VECTOR__
59 #include <stddef.h>
60 #endif
61
62 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
63     vector signed char __a, vector signed char __b, vector unsigned char __c);
64
65 static __inline__ vector unsigned char __ATTRS_o_ai
66 vec_perm(vector unsigned char __a, vector unsigned char __b,
67          vector unsigned char __c);
68
69 static __inline__ vector bool char __ATTRS_o_ai
70 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
71
72 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
73                                                      vector signed short __b,
74                                                      vector unsigned char __c);
75
76 static __inline__ vector unsigned short __ATTRS_o_ai
77 vec_perm(vector unsigned short __a, vector unsigned short __b,
78          vector unsigned char __c);
79
80 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
81     vector bool short __a, vector bool short __b, vector unsigned char __c);
82
83 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
84                                                      vector pixel __b,
85                                                      vector unsigned char __c);
86
87 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
88                                                    vector signed int __b,
89                                                    vector unsigned char __c);
90
91 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
92     vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
93
94 static __inline__ vector bool int __ATTRS_o_ai
95 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
96
97 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
98                                                      vector float __b,
99                                                      vector unsigned char __c);
100
101 #ifdef __VSX__
102 static __inline__ vector long long __ATTRS_o_ai
103 vec_perm(vector signed long long __a, vector signed long long __b,
104          vector unsigned char __c);
105
106 static __inline__ vector unsigned long long __ATTRS_o_ai
107 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
108          vector unsigned char __c);
109
110 static __inline__ vector bool long long __ATTRS_o_ai
111 vec_perm(vector bool long long __a, vector bool long long __b,
112          vector unsigned char __c);
113
114 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
115                                                       vector double __b,
116                                                       vector unsigned char __c);
117 #endif
118
119 static __inline__ vector unsigned char __ATTRS_o_ai
120 vec_xor(vector unsigned char __a, vector unsigned char __b);
121
122 /* vec_abs */
123
124 #define __builtin_altivec_abs_v16qi vec_abs
125 #define __builtin_altivec_abs_v8hi vec_abs
126 #define __builtin_altivec_abs_v4si vec_abs
127
128 static __inline__ vector signed char __ATTRS_o_ai
129 vec_abs(vector signed char __a) {
130   return __builtin_altivec_vmaxsb(__a, -__a);
131 }
132
133 static __inline__ vector signed short __ATTRS_o_ai
134 vec_abs(vector signed short __a) {
135   return __builtin_altivec_vmaxsh(__a, -__a);
136 }
137
138 static __inline__ vector signed int __ATTRS_o_ai
139 vec_abs(vector signed int __a) {
140   return __builtin_altivec_vmaxsw(__a, -__a);
141 }
142
143 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
144 static __inline__ vector signed long long __ATTRS_o_ai
145 vec_abs(vector signed long long __a) {
146   return __builtin_altivec_vmaxsd(__a, -__a);
147 }
148 #endif
149
150 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
151 #ifdef __VSX__
152   return __builtin_vsx_xvabssp(__a);
153 #else
154   vector unsigned int __res =
155       (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
156   return (vector float)__res;
157 #endif
158 }
159
160 #ifdef __VSX__
161 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
162   return __builtin_vsx_xvabsdp(__a);
163 }
164 #endif
165
166 /* vec_abss */
167 #define __builtin_altivec_abss_v16qi vec_abss
168 #define __builtin_altivec_abss_v8hi vec_abss
169 #define __builtin_altivec_abss_v4si vec_abss
170
171 static __inline__ vector signed char __ATTRS_o_ai
172 vec_abss(vector signed char __a) {
173   return __builtin_altivec_vmaxsb(
174       __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
175 }
176
177 static __inline__ vector signed short __ATTRS_o_ai
178 vec_abss(vector signed short __a) {
179   return __builtin_altivec_vmaxsh(
180       __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
181 }
182
183 static __inline__ vector signed int __ATTRS_o_ai
184 vec_abss(vector signed int __a) {
185   return __builtin_altivec_vmaxsw(
186       __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
187 }
188
189 /* vec_absd */
190 #if defined(__POWER9_VECTOR__)
191
192 static __inline__ vector unsigned char __ATTRS_o_ai
193 vec_absd(vector unsigned char __a, vector unsigned char __b) {
194   return __builtin_altivec_vabsdub(__a, __b);
195 }
196
197 static __inline__ vector unsigned short __ATTRS_o_ai
198 vec_absd(vector unsigned short __a, vector unsigned short __b) {
199   return __builtin_altivec_vabsduh(__a, __b);
200 }
201
202 static __inline__ vector unsigned int __ATTRS_o_ai
203 vec_absd(vector unsigned int __a,  vector unsigned int __b) {
204   return __builtin_altivec_vabsduw(__a, __b);
205 }
206
207 #endif /* End __POWER9_VECTOR__ */
208
209 /* vec_add */
210
211 static __inline__ vector signed char __ATTRS_o_ai
212 vec_add(vector signed char __a, vector signed char __b) {
213   return __a + __b;
214 }
215
216 static __inline__ vector signed char __ATTRS_o_ai
217 vec_add(vector bool char __a, vector signed char __b) {
218   return (vector signed char)__a + __b;
219 }
220
221 static __inline__ vector signed char __ATTRS_o_ai
222 vec_add(vector signed char __a, vector bool char __b) {
223   return __a + (vector signed char)__b;
224 }
225
226 static __inline__ vector unsigned char __ATTRS_o_ai
227 vec_add(vector unsigned char __a, vector unsigned char __b) {
228   return __a + __b;
229 }
230
231 static __inline__ vector unsigned char __ATTRS_o_ai
232 vec_add(vector bool char __a, vector unsigned char __b) {
233   return (vector unsigned char)__a + __b;
234 }
235
236 static __inline__ vector unsigned char __ATTRS_o_ai
237 vec_add(vector unsigned char __a, vector bool char __b) {
238   return __a + (vector unsigned char)__b;
239 }
240
241 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
242                                                     vector short __b) {
243   return __a + __b;
244 }
245
246 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
247                                                     vector short __b) {
248   return (vector short)__a + __b;
249 }
250
251 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
252                                                     vector bool short __b) {
253   return __a + (vector short)__b;
254 }
255
256 static __inline__ vector unsigned short __ATTRS_o_ai
257 vec_add(vector unsigned short __a, vector unsigned short __b) {
258   return __a + __b;
259 }
260
261 static __inline__ vector unsigned short __ATTRS_o_ai
262 vec_add(vector bool short __a, vector unsigned short __b) {
263   return (vector unsigned short)__a + __b;
264 }
265
266 static __inline__ vector unsigned short __ATTRS_o_ai
267 vec_add(vector unsigned short __a, vector bool short __b) {
268   return __a + (vector unsigned short)__b;
269 }
270
271 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
272                                                   vector int __b) {
273   return __a + __b;
274 }
275
276 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
277                                                   vector int __b) {
278   return (vector int)__a + __b;
279 }
280
281 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
282                                                   vector bool int __b) {
283   return __a + (vector int)__b;
284 }
285
286 static __inline__ vector unsigned int __ATTRS_o_ai
287 vec_add(vector unsigned int __a, vector unsigned int __b) {
288   return __a + __b;
289 }
290
291 static __inline__ vector unsigned int __ATTRS_o_ai
292 vec_add(vector bool int __a, vector unsigned int __b) {
293   return (vector unsigned int)__a + __b;
294 }
295
296 static __inline__ vector unsigned int __ATTRS_o_ai
297 vec_add(vector unsigned int __a, vector bool int __b) {
298   return __a + (vector unsigned int)__b;
299 }
300
301 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
302 static __inline__ vector signed long long __ATTRS_o_ai
303 vec_add(vector signed long long __a, vector signed long long __b) {
304   return __a + __b;
305 }
306
307 static __inline__ vector unsigned long long __ATTRS_o_ai
308 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
309   return __a + __b;
310 }
311
312 static __inline__ vector signed __int128 __ATTRS_o_ai
313 vec_add(vector signed __int128 __a, vector signed __int128 __b) {
314   return __a + __b;
315 }
316
317 static __inline__ vector unsigned __int128 __ATTRS_o_ai
318 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
319   return __a + __b;
320 }
321 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
322
323 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
324                                                     vector float __b) {
325   return __a + __b;
326 }
327
328 #ifdef __VSX__
329 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
330                                                      vector double __b) {
331   return __a + __b;
332 }
333 #endif // __VSX__
334
335 /* vec_adde */
336
337 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
338 static __inline__ vector signed __int128 __ATTRS_o_ai
339 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
340          vector signed __int128 __c) {
341   return __builtin_altivec_vaddeuqm(__a, __b, __c);
342 }
343
344 static __inline__ vector unsigned __int128 __ATTRS_o_ai
345 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
346          vector unsigned __int128 __c) {
347   return __builtin_altivec_vaddeuqm(__a, __b, __c);
348 }
349 #endif
350
351 static __inline__ vector signed int __ATTRS_o_ai
352 vec_adde(vector signed int __a, vector signed int __b,
353          vector signed int __c) {
354   vector signed int __mask = {1, 1, 1, 1};
355   vector signed int __carry = __c & __mask;
356   return vec_add(vec_add(__a, __b), __carry);
357 }
358
359 static __inline__ vector unsigned int __ATTRS_o_ai
360 vec_adde(vector unsigned int __a, vector unsigned int __b,
361          vector unsigned int __c) {
362   vector unsigned int __mask = {1, 1, 1, 1};
363   vector unsigned int __carry = __c & __mask;
364   return vec_add(vec_add(__a, __b), __carry);
365 }
366
367 /* vec_addec */
368
369 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
370 static __inline__ vector signed __int128 __ATTRS_o_ai
371 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
372           vector signed __int128 __c) {
373   return __builtin_altivec_vaddecuq(__a, __b, __c);
374 }
375
376 static __inline__ vector unsigned __int128 __ATTRS_o_ai
377 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
378           vector unsigned __int128 __c) {
379   return __builtin_altivec_vaddecuq(__a, __b, __c);
380 }
381
382 static __inline__ vector signed int __ATTRS_o_ai
383 vec_addec(vector signed int __a, vector signed int __b,
384           vector signed int __c) {
385
386   signed int __result[4];
387   for (int i = 0; i < 4; i++) {
388     unsigned int __tempa = (unsigned int) __a[i];
389     unsigned int __tempb = (unsigned int) __b[i];
390     unsigned int __tempc = (unsigned int) __c[i];
391     __tempc = __tempc & 0x00000001;
392     unsigned long long __longa = (unsigned long long) __tempa;
393     unsigned long long __longb = (unsigned long long) __tempb;
394     unsigned long long __longc = (unsigned long long) __tempc;
395     unsigned long long __sum = __longa + __longb + __longc;
396     unsigned long long __res = (__sum >> 32) & 0x01;
397     unsigned long long __tempres = (unsigned int) __res;
398     __result[i] = (signed int) __tempres;
399   }
400
401   vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
402   return ret;
403 }
404
405 static __inline__ vector unsigned int __ATTRS_o_ai
406 vec_addec(vector unsigned int __a, vector unsigned int __b,
407           vector unsigned int __c) {
408
409   unsigned int __result[4];
410   for (int i = 0; i < 4; i++) {
411     unsigned int __tempc = __c[i] & 1;
412     unsigned long long __longa = (unsigned long long) __a[i];
413     unsigned long long __longb = (unsigned long long) __b[i];
414     unsigned long long __longc = (unsigned long long) __tempc;
415     unsigned long long __sum = __longa + __longb + __longc;
416     unsigned long long __res = (__sum >> 32) & 0x01;
417     unsigned long long __tempres = (unsigned int) __res;
418     __result[i] = (signed int) __tempres;
419   }
420
421   vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
422   return ret;
423 }
424
425 #endif
426
427 /* vec_vaddubm */
428
429 #define __builtin_altivec_vaddubm vec_vaddubm
430
431 static __inline__ vector signed char __ATTRS_o_ai
432 vec_vaddubm(vector signed char __a, vector signed char __b) {
433   return __a + __b;
434 }
435
436 static __inline__ vector signed char __ATTRS_o_ai
437 vec_vaddubm(vector bool char __a, vector signed char __b) {
438   return (vector signed char)__a + __b;
439 }
440
441 static __inline__ vector signed char __ATTRS_o_ai
442 vec_vaddubm(vector signed char __a, vector bool char __b) {
443   return __a + (vector signed char)__b;
444 }
445
446 static __inline__ vector unsigned char __ATTRS_o_ai
447 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
448   return __a + __b;
449 }
450
451 static __inline__ vector unsigned char __ATTRS_o_ai
452 vec_vaddubm(vector bool char __a, vector unsigned char __b) {
453   return (vector unsigned char)__a + __b;
454 }
455
456 static __inline__ vector unsigned char __ATTRS_o_ai
457 vec_vaddubm(vector unsigned char __a, vector bool char __b) {
458   return __a + (vector unsigned char)__b;
459 }
460
461 /* vec_vadduhm */
462
463 #define __builtin_altivec_vadduhm vec_vadduhm
464
465 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
466                                                         vector short __b) {
467   return __a + __b;
468 }
469
470 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
471                                                         vector short __b) {
472   return (vector short)__a + __b;
473 }
474
475 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
476                                                         vector bool short __b) {
477   return __a + (vector short)__b;
478 }
479
480 static __inline__ vector unsigned short __ATTRS_o_ai
481 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
482   return __a + __b;
483 }
484
485 static __inline__ vector unsigned short __ATTRS_o_ai
486 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
487   return (vector unsigned short)__a + __b;
488 }
489
490 static __inline__ vector unsigned short __ATTRS_o_ai
491 vec_vadduhm(vector unsigned short __a, vector bool short __b) {
492   return __a + (vector unsigned short)__b;
493 }
494
495 /* vec_vadduwm */
496
497 #define __builtin_altivec_vadduwm vec_vadduwm
498
499 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
500                                                       vector int __b) {
501   return __a + __b;
502 }
503
504 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
505                                                       vector int __b) {
506   return (vector int)__a + __b;
507 }
508
509 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
510                                                       vector bool int __b) {
511   return __a + (vector int)__b;
512 }
513
514 static __inline__ vector unsigned int __ATTRS_o_ai
515 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
516   return __a + __b;
517 }
518
519 static __inline__ vector unsigned int __ATTRS_o_ai
520 vec_vadduwm(vector bool int __a, vector unsigned int __b) {
521   return (vector unsigned int)__a + __b;
522 }
523
524 static __inline__ vector unsigned int __ATTRS_o_ai
525 vec_vadduwm(vector unsigned int __a, vector bool int __b) {
526   return __a + (vector unsigned int)__b;
527 }
528
529 /* vec_vaddfp */
530
531 #define __builtin_altivec_vaddfp vec_vaddfp
532
533 static __inline__ vector float __attribute__((__always_inline__))
534 vec_vaddfp(vector float __a, vector float __b) {
535   return __a + __b;
536 }
537
538 /* vec_addc */
539
540 static __inline__ vector signed int __ATTRS_o_ai
541 vec_addc(vector signed int __a, vector signed int __b) {
542   return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
543                                                       (vector unsigned int)__b);
544 }
545
546 static __inline__ vector unsigned int __ATTRS_o_ai
547 vec_addc(vector unsigned int __a, vector unsigned int __b) {
548   return __builtin_altivec_vaddcuw(__a, __b);
549 }
550
551 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
552 static __inline__ vector signed __int128 __ATTRS_o_ai
553 vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
554   return (vector signed __int128)__builtin_altivec_vaddcuq(
555       (vector unsigned __int128)__a, (vector unsigned __int128)__b);
556 }
557
558 static __inline__ vector unsigned __int128 __ATTRS_o_ai
559 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
560   return __builtin_altivec_vaddcuq(__a, __b);
561 }
562 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
563
564 /* vec_vaddcuw */
565
566 static __inline__ vector unsigned int __attribute__((__always_inline__))
567 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
568   return __builtin_altivec_vaddcuw(__a, __b);
569 }
570
571 /* vec_adds */
572
573 static __inline__ vector signed char __ATTRS_o_ai
574 vec_adds(vector signed char __a, vector signed char __b) {
575   return __builtin_altivec_vaddsbs(__a, __b);
576 }
577
578 static __inline__ vector signed char __ATTRS_o_ai
579 vec_adds(vector bool char __a, vector signed char __b) {
580   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
581 }
582
583 static __inline__ vector signed char __ATTRS_o_ai
584 vec_adds(vector signed char __a, vector bool char __b) {
585   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
586 }
587
588 static __inline__ vector unsigned char __ATTRS_o_ai
589 vec_adds(vector unsigned char __a, vector unsigned char __b) {
590   return __builtin_altivec_vaddubs(__a, __b);
591 }
592
593 static __inline__ vector unsigned char __ATTRS_o_ai
594 vec_adds(vector bool char __a, vector unsigned char __b) {
595   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
596 }
597
598 static __inline__ vector unsigned char __ATTRS_o_ai
599 vec_adds(vector unsigned char __a, vector bool char __b) {
600   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
601 }
602
603 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
604                                                      vector short __b) {
605   return __builtin_altivec_vaddshs(__a, __b);
606 }
607
608 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
609                                                      vector short __b) {
610   return __builtin_altivec_vaddshs((vector short)__a, __b);
611 }
612
613 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
614                                                      vector bool short __b) {
615   return __builtin_altivec_vaddshs(__a, (vector short)__b);
616 }
617
618 static __inline__ vector unsigned short __ATTRS_o_ai
619 vec_adds(vector unsigned short __a, vector unsigned short __b) {
620   return __builtin_altivec_vadduhs(__a, __b);
621 }
622
623 static __inline__ vector unsigned short __ATTRS_o_ai
624 vec_adds(vector bool short __a, vector unsigned short __b) {
625   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
626 }
627
628 static __inline__ vector unsigned short __ATTRS_o_ai
629 vec_adds(vector unsigned short __a, vector bool short __b) {
630   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
631 }
632
633 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
634                                                    vector int __b) {
635   return __builtin_altivec_vaddsws(__a, __b);
636 }
637
638 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
639                                                    vector int __b) {
640   return __builtin_altivec_vaddsws((vector int)__a, __b);
641 }
642
643 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
644                                                    vector bool int __b) {
645   return __builtin_altivec_vaddsws(__a, (vector int)__b);
646 }
647
648 static __inline__ vector unsigned int __ATTRS_o_ai
649 vec_adds(vector unsigned int __a, vector unsigned int __b) {
650   return __builtin_altivec_vadduws(__a, __b);
651 }
652
653 static __inline__ vector unsigned int __ATTRS_o_ai
654 vec_adds(vector bool int __a, vector unsigned int __b) {
655   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
656 }
657
658 static __inline__ vector unsigned int __ATTRS_o_ai
659 vec_adds(vector unsigned int __a, vector bool int __b) {
660   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
661 }
662
663 /* vec_vaddsbs */
664
665 static __inline__ vector signed char __ATTRS_o_ai
666 vec_vaddsbs(vector signed char __a, vector signed char __b) {
667   return __builtin_altivec_vaddsbs(__a, __b);
668 }
669
670 static __inline__ vector signed char __ATTRS_o_ai
671 vec_vaddsbs(vector bool char __a, vector signed char __b) {
672   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
673 }
674
675 static __inline__ vector signed char __ATTRS_o_ai
676 vec_vaddsbs(vector signed char __a, vector bool char __b) {
677   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
678 }
679
680 /* vec_vaddubs */
681
682 static __inline__ vector unsigned char __ATTRS_o_ai
683 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
684   return __builtin_altivec_vaddubs(__a, __b);
685 }
686
687 static __inline__ vector unsigned char __ATTRS_o_ai
688 vec_vaddubs(vector bool char __a, vector unsigned char __b) {
689   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
690 }
691
692 static __inline__ vector unsigned char __ATTRS_o_ai
693 vec_vaddubs(vector unsigned char __a, vector bool char __b) {
694   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
695 }
696
697 /* vec_vaddshs */
698
699 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
700                                                         vector short __b) {
701   return __builtin_altivec_vaddshs(__a, __b);
702 }
703
704 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
705                                                         vector short __b) {
706   return __builtin_altivec_vaddshs((vector short)__a, __b);
707 }
708
709 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
710                                                         vector bool short __b) {
711   return __builtin_altivec_vaddshs(__a, (vector short)__b);
712 }
713
714 /* vec_vadduhs */
715
716 static __inline__ vector unsigned short __ATTRS_o_ai
717 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
718   return __builtin_altivec_vadduhs(__a, __b);
719 }
720
721 static __inline__ vector unsigned short __ATTRS_o_ai
722 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
723   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
724 }
725
726 static __inline__ vector unsigned short __ATTRS_o_ai
727 vec_vadduhs(vector unsigned short __a, vector bool short __b) {
728   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
729 }
730
731 /* vec_vaddsws */
732
733 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
734                                                       vector int __b) {
735   return __builtin_altivec_vaddsws(__a, __b);
736 }
737
738 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
739                                                       vector int __b) {
740   return __builtin_altivec_vaddsws((vector int)__a, __b);
741 }
742
743 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
744                                                       vector bool int __b) {
745   return __builtin_altivec_vaddsws(__a, (vector int)__b);
746 }
747
748 /* vec_vadduws */
749
750 static __inline__ vector unsigned int __ATTRS_o_ai
751 vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
752   return __builtin_altivec_vadduws(__a, __b);
753 }
754
755 static __inline__ vector unsigned int __ATTRS_o_ai
756 vec_vadduws(vector bool int __a, vector unsigned int __b) {
757   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
758 }
759
760 static __inline__ vector unsigned int __ATTRS_o_ai
761 vec_vadduws(vector unsigned int __a, vector bool int __b) {
762   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
763 }
764
765 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
766 /* vec_vadduqm */
767
768 static __inline__ vector signed __int128 __ATTRS_o_ai
769 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
770   return __a + __b;
771 }
772
773 static __inline__ vector unsigned __int128 __ATTRS_o_ai
774 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
775   return __a + __b;
776 }
777
778 /* vec_vaddeuqm */
779
780 static __inline__ vector signed __int128 __ATTRS_o_ai
781 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
782              vector signed __int128 __c) {
783   return __builtin_altivec_vaddeuqm(__a, __b, __c);
784 }
785
786 static __inline__ vector unsigned __int128 __ATTRS_o_ai
787 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
788              vector unsigned __int128 __c) {
789   return __builtin_altivec_vaddeuqm(__a, __b, __c);
790 }
791
792 /* vec_vaddcuq */
793
794 static __inline__ vector signed __int128 __ATTRS_o_ai
795 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
796   return __builtin_altivec_vaddcuq(__a, __b);
797 }
798
799 static __inline__ vector unsigned __int128 __ATTRS_o_ai
800 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
801   return __builtin_altivec_vaddcuq(__a, __b);
802 }
803
804 /* vec_vaddecuq */
805
806 static __inline__ vector signed __int128 __ATTRS_o_ai
807 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
808              vector signed __int128 __c) {
809   return __builtin_altivec_vaddecuq(__a, __b, __c);
810 }
811
812 static __inline__ vector unsigned __int128 __ATTRS_o_ai
813 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
814              vector unsigned __int128 __c) {
815   return __builtin_altivec_vaddecuq(__a, __b, __c);
816 }
817 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
818
819 /* vec_and */
820
821 #define __builtin_altivec_vand vec_and
822
823 static __inline__ vector signed char __ATTRS_o_ai
824 vec_and(vector signed char __a, vector signed char __b) {
825   return __a & __b;
826 }
827
828 static __inline__ vector signed char __ATTRS_o_ai
829 vec_and(vector bool char __a, vector signed char __b) {
830   return (vector signed char)__a & __b;
831 }
832
833 static __inline__ vector signed char __ATTRS_o_ai
834 vec_and(vector signed char __a, vector bool char __b) {
835   return __a & (vector signed char)__b;
836 }
837
838 static __inline__ vector unsigned char __ATTRS_o_ai
839 vec_and(vector unsigned char __a, vector unsigned char __b) {
840   return __a & __b;
841 }
842
843 static __inline__ vector unsigned char __ATTRS_o_ai
844 vec_and(vector bool char __a, vector unsigned char __b) {
845   return (vector unsigned char)__a & __b;
846 }
847
848 static __inline__ vector unsigned char __ATTRS_o_ai
849 vec_and(vector unsigned char __a, vector bool char __b) {
850   return __a & (vector unsigned char)__b;
851 }
852
853 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
854                                                         vector bool char __b) {
855   return __a & __b;
856 }
857
858 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
859                                                     vector short __b) {
860   return __a & __b;
861 }
862
863 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
864                                                     vector short __b) {
865   return (vector short)__a & __b;
866 }
867
868 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
869                                                     vector bool short __b) {
870   return __a & (vector short)__b;
871 }
872
873 static __inline__ vector unsigned short __ATTRS_o_ai
874 vec_and(vector unsigned short __a, vector unsigned short __b) {
875   return __a & __b;
876 }
877
878 static __inline__ vector unsigned short __ATTRS_o_ai
879 vec_and(vector bool short __a, vector unsigned short __b) {
880   return (vector unsigned short)__a & __b;
881 }
882
883 static __inline__ vector unsigned short __ATTRS_o_ai
884 vec_and(vector unsigned short __a, vector bool short __b) {
885   return __a & (vector unsigned short)__b;
886 }
887
888 static __inline__ vector bool short __ATTRS_o_ai
889 vec_and(vector bool short __a, vector bool short __b) {
890   return __a & __b;
891 }
892
893 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
894                                                   vector int __b) {
895   return __a & __b;
896 }
897
898 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
899                                                   vector int __b) {
900   return (vector int)__a & __b;
901 }
902
903 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
904                                                   vector bool int __b) {
905   return __a & (vector int)__b;
906 }
907
908 static __inline__ vector unsigned int __ATTRS_o_ai
909 vec_and(vector unsigned int __a, vector unsigned int __b) {
910   return __a & __b;
911 }
912
913 static __inline__ vector unsigned int __ATTRS_o_ai
914 vec_and(vector bool int __a, vector unsigned int __b) {
915   return (vector unsigned int)__a & __b;
916 }
917
918 static __inline__ vector unsigned int __ATTRS_o_ai
919 vec_and(vector unsigned int __a, vector bool int __b) {
920   return __a & (vector unsigned int)__b;
921 }
922
923 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
924                                                        vector bool int __b) {
925   return __a & __b;
926 }
927
928 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
929                                                     vector float __b) {
930   vector unsigned int __res =
931       (vector unsigned int)__a & (vector unsigned int)__b;
932   return (vector float)__res;
933 }
934
935 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
936                                                     vector float __b) {
937   vector unsigned int __res =
938       (vector unsigned int)__a & (vector unsigned int)__b;
939   return (vector float)__res;
940 }
941
942 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
943                                                     vector bool int __b) {
944   vector unsigned int __res =
945       (vector unsigned int)__a & (vector unsigned int)__b;
946   return (vector float)__res;
947 }
948
949 #ifdef __VSX__
950 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
951                                                      vector double __b) {
952   vector unsigned long long __res =
953       (vector unsigned long long)__a & (vector unsigned long long)__b;
954   return (vector double)__res;
955 }
956
957 static __inline__ vector double __ATTRS_o_ai
958 vec_and(vector double __a, vector bool long long __b) {
959   vector unsigned long long __res =
960       (vector unsigned long long)__a & (vector unsigned long long)__b;
961   return (vector double)__res;
962 }
963
964 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
965                                                      vector double __b) {
966   vector unsigned long long __res =
967       (vector unsigned long long)__a & (vector unsigned long long)__b;
968   return (vector double)__res;
969 }
970
971 static __inline__ vector signed long long __ATTRS_o_ai
972 vec_and(vector signed long long __a, vector signed long long __b) {
973   return __a & __b;
974 }
975
976 static __inline__ vector signed long long __ATTRS_o_ai
977 vec_and(vector bool long long __a, vector signed long long __b) {
978   return (vector signed long long)__a & __b;
979 }
980
981 static __inline__ vector signed long long __ATTRS_o_ai
982 vec_and(vector signed long long __a, vector bool long long __b) {
983   return __a & (vector signed long long)__b;
984 }
985
986 static __inline__ vector unsigned long long __ATTRS_o_ai
987 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
988   return __a & __b;
989 }
990
991 static __inline__ vector unsigned long long __ATTRS_o_ai
992 vec_and(vector bool long long __a, vector unsigned long long __b) {
993   return (vector unsigned long long)__a & __b;
994 }
995
996 static __inline__ vector unsigned long long __ATTRS_o_ai
997 vec_and(vector unsigned long long __a, vector bool long long __b) {
998   return __a & (vector unsigned long long)__b;
999 }
1000
1001 static __inline__ vector bool long long __ATTRS_o_ai
1002 vec_and(vector bool long long __a, vector bool long long __b) {
1003   return __a & __b;
1004 }
1005 #endif
1006
1007 /* vec_vand */
1008
1009 static __inline__ vector signed char __ATTRS_o_ai
1010 vec_vand(vector signed char __a, vector signed char __b) {
1011   return __a & __b;
1012 }
1013
1014 static __inline__ vector signed char __ATTRS_o_ai
1015 vec_vand(vector bool char __a, vector signed char __b) {
1016   return (vector signed char)__a & __b;
1017 }
1018
1019 static __inline__ vector signed char __ATTRS_o_ai
1020 vec_vand(vector signed char __a, vector bool char __b) {
1021   return __a & (vector signed char)__b;
1022 }
1023
1024 static __inline__ vector unsigned char __ATTRS_o_ai
1025 vec_vand(vector unsigned char __a, vector unsigned char __b) {
1026   return __a & __b;
1027 }
1028
1029 static __inline__ vector unsigned char __ATTRS_o_ai
1030 vec_vand(vector bool char __a, vector unsigned char __b) {
1031   return (vector unsigned char)__a & __b;
1032 }
1033
1034 static __inline__ vector unsigned char __ATTRS_o_ai
1035 vec_vand(vector unsigned char __a, vector bool char __b) {
1036   return __a & (vector unsigned char)__b;
1037 }
1038
1039 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1040                                                          vector bool char __b) {
1041   return __a & __b;
1042 }
1043
1044 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1045                                                      vector short __b) {
1046   return __a & __b;
1047 }
1048
1049 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1050                                                      vector short __b) {
1051   return (vector short)__a & __b;
1052 }
1053
1054 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1055                                                      vector bool short __b) {
1056   return __a & (vector short)__b;
1057 }
1058
1059 static __inline__ vector unsigned short __ATTRS_o_ai
1060 vec_vand(vector unsigned short __a, vector unsigned short __b) {
1061   return __a & __b;
1062 }
1063
1064 static __inline__ vector unsigned short __ATTRS_o_ai
1065 vec_vand(vector bool short __a, vector unsigned short __b) {
1066   return (vector unsigned short)__a & __b;
1067 }
1068
1069 static __inline__ vector unsigned short __ATTRS_o_ai
1070 vec_vand(vector unsigned short __a, vector bool short __b) {
1071   return __a & (vector unsigned short)__b;
1072 }
1073
1074 static __inline__ vector bool short __ATTRS_o_ai
1075 vec_vand(vector bool short __a, vector bool short __b) {
1076   return __a & __b;
1077 }
1078
1079 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1080                                                    vector int __b) {
1081   return __a & __b;
1082 }
1083
1084 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1085                                                    vector int __b) {
1086   return (vector int)__a & __b;
1087 }
1088
1089 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1090                                                    vector bool int __b) {
1091   return __a & (vector int)__b;
1092 }
1093
1094 static __inline__ vector unsigned int __ATTRS_o_ai
1095 vec_vand(vector unsigned int __a, vector unsigned int __b) {
1096   return __a & __b;
1097 }
1098
1099 static __inline__ vector unsigned int __ATTRS_o_ai
1100 vec_vand(vector bool int __a, vector unsigned int __b) {
1101   return (vector unsigned int)__a & __b;
1102 }
1103
1104 static __inline__ vector unsigned int __ATTRS_o_ai
1105 vec_vand(vector unsigned int __a, vector bool int __b) {
1106   return __a & (vector unsigned int)__b;
1107 }
1108
1109 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1110                                                         vector bool int __b) {
1111   return __a & __b;
1112 }
1113
1114 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1115                                                      vector float __b) {
1116   vector unsigned int __res =
1117       (vector unsigned int)__a & (vector unsigned int)__b;
1118   return (vector float)__res;
1119 }
1120
1121 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1122                                                      vector float __b) {
1123   vector unsigned int __res =
1124       (vector unsigned int)__a & (vector unsigned int)__b;
1125   return (vector float)__res;
1126 }
1127
1128 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1129                                                      vector bool int __b) {
1130   vector unsigned int __res =
1131       (vector unsigned int)__a & (vector unsigned int)__b;
1132   return (vector float)__res;
1133 }
1134
1135 #ifdef __VSX__
1136 static __inline__ vector signed long long __ATTRS_o_ai
1137 vec_vand(vector signed long long __a, vector signed long long __b) {
1138   return __a & __b;
1139 }
1140
1141 static __inline__ vector signed long long __ATTRS_o_ai
1142 vec_vand(vector bool long long __a, vector signed long long __b) {
1143   return (vector signed long long)__a & __b;
1144 }
1145
1146 static __inline__ vector signed long long __ATTRS_o_ai
1147 vec_vand(vector signed long long __a, vector bool long long __b) {
1148   return __a & (vector signed long long)__b;
1149 }
1150
1151 static __inline__ vector unsigned long long __ATTRS_o_ai
1152 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1153   return __a & __b;
1154 }
1155
1156 static __inline__ vector unsigned long long __ATTRS_o_ai
1157 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1158   return (vector unsigned long long)__a & __b;
1159 }
1160
1161 static __inline__ vector unsigned long long __ATTRS_o_ai
1162 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1163   return __a & (vector unsigned long long)__b;
1164 }
1165
1166 static __inline__ vector bool long long __ATTRS_o_ai
1167 vec_vand(vector bool long long __a, vector bool long long __b) {
1168   return __a & __b;
1169 }
1170 #endif
1171
1172 /* vec_andc */
1173
1174 #define __builtin_altivec_vandc vec_andc
1175
1176 static __inline__ vector signed char __ATTRS_o_ai
1177 vec_andc(vector signed char __a, vector signed char __b) {
1178   return __a & ~__b;
1179 }
1180
1181 static __inline__ vector signed char __ATTRS_o_ai
1182 vec_andc(vector bool char __a, vector signed char __b) {
1183   return (vector signed char)__a & ~__b;
1184 }
1185
1186 static __inline__ vector signed char __ATTRS_o_ai
1187 vec_andc(vector signed char __a, vector bool char __b) {
1188   return __a & ~(vector signed char)__b;
1189 }
1190
1191 static __inline__ vector unsigned char __ATTRS_o_ai
1192 vec_andc(vector unsigned char __a, vector unsigned char __b) {
1193   return __a & ~__b;
1194 }
1195
1196 static __inline__ vector unsigned char __ATTRS_o_ai
1197 vec_andc(vector bool char __a, vector unsigned char __b) {
1198   return (vector unsigned char)__a & ~__b;
1199 }
1200
1201 static __inline__ vector unsigned char __ATTRS_o_ai
1202 vec_andc(vector unsigned char __a, vector bool char __b) {
1203   return __a & ~(vector unsigned char)__b;
1204 }
1205
1206 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1207                                                          vector bool char __b) {
1208   return __a & ~__b;
1209 }
1210
1211 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1212                                                      vector short __b) {
1213   return __a & ~__b;
1214 }
1215
1216 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1217                                                      vector short __b) {
1218   return (vector short)__a & ~__b;
1219 }
1220
1221 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1222                                                      vector bool short __b) {
1223   return __a & ~(vector short)__b;
1224 }
1225
1226 static __inline__ vector unsigned short __ATTRS_o_ai
1227 vec_andc(vector unsigned short __a, vector unsigned short __b) {
1228   return __a & ~__b;
1229 }
1230
1231 static __inline__ vector unsigned short __ATTRS_o_ai
1232 vec_andc(vector bool short __a, vector unsigned short __b) {
1233   return (vector unsigned short)__a & ~__b;
1234 }
1235
1236 static __inline__ vector unsigned short __ATTRS_o_ai
1237 vec_andc(vector unsigned short __a, vector bool short __b) {
1238   return __a & ~(vector unsigned short)__b;
1239 }
1240
1241 static __inline__ vector bool short __ATTRS_o_ai
1242 vec_andc(vector bool short __a, vector bool short __b) {
1243   return __a & ~__b;
1244 }
1245
1246 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1247                                                    vector int __b) {
1248   return __a & ~__b;
1249 }
1250
1251 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1252                                                    vector int __b) {
1253   return (vector int)__a & ~__b;
1254 }
1255
1256 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1257                                                    vector bool int __b) {
1258   return __a & ~(vector int)__b;
1259 }
1260
1261 static __inline__ vector unsigned int __ATTRS_o_ai
1262 vec_andc(vector unsigned int __a, vector unsigned int __b) {
1263   return __a & ~__b;
1264 }
1265
1266 static __inline__ vector unsigned int __ATTRS_o_ai
1267 vec_andc(vector bool int __a, vector unsigned int __b) {
1268   return (vector unsigned int)__a & ~__b;
1269 }
1270
1271 static __inline__ vector unsigned int __ATTRS_o_ai
1272 vec_andc(vector unsigned int __a, vector bool int __b) {
1273   return __a & ~(vector unsigned int)__b;
1274 }
1275
1276 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1277                                                         vector bool int __b) {
1278   return __a & ~__b;
1279 }
1280
1281 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1282                                                      vector float __b) {
1283   vector unsigned int __res =
1284       (vector unsigned int)__a & ~(vector unsigned int)__b;
1285   return (vector float)__res;
1286 }
1287
1288 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1289                                                      vector float __b) {
1290   vector unsigned int __res =
1291       (vector unsigned int)__a & ~(vector unsigned int)__b;
1292   return (vector float)__res;
1293 }
1294
1295 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1296                                                      vector bool int __b) {
1297   vector unsigned int __res =
1298       (vector unsigned int)__a & ~(vector unsigned int)__b;
1299   return (vector float)__res;
1300 }
1301
1302 #ifdef __VSX__
1303 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1304                                                       vector double __b) {
1305   vector unsigned long long __res =
1306       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1307   return (vector double)__res;
1308 }
1309
1310 static __inline__ vector double __ATTRS_o_ai
1311 vec_andc(vector double __a, vector bool long long __b) {
1312   vector unsigned long long __res =
1313       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1314   return (vector double)__res;
1315 }
1316
1317 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1318                                                       vector double __b) {
1319   vector unsigned long long __res =
1320       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1321   return (vector double)__res;
1322 }
1323
1324 static __inline__ vector signed long long __ATTRS_o_ai
1325 vec_andc(vector signed long long __a, vector signed long long __b) {
1326   return __a & ~__b;
1327 }
1328
1329 static __inline__ vector signed long long __ATTRS_o_ai
1330 vec_andc(vector bool long long __a, vector signed long long __b) {
1331   return (vector signed long long)__a & ~__b;
1332 }
1333
1334 static __inline__ vector signed long long __ATTRS_o_ai
1335 vec_andc(vector signed long long __a, vector bool long long __b) {
1336   return __a & ~(vector signed long long)__b;
1337 }
1338
1339 static __inline__ vector unsigned long long __ATTRS_o_ai
1340 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1341   return __a & ~__b;
1342 }
1343
1344 static __inline__ vector unsigned long long __ATTRS_o_ai
1345 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1346   return (vector unsigned long long)__a & ~__b;
1347 }
1348
1349 static __inline__ vector unsigned long long __ATTRS_o_ai
1350 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1351   return __a & ~(vector unsigned long long)__b;
1352 }
1353
1354 static __inline__ vector bool long long __ATTRS_o_ai
1355 vec_andc(vector bool long long __a, vector bool long long __b) {
1356   return __a & ~__b;
1357 }
1358 #endif
1359
1360 /* vec_vandc */
1361
1362 static __inline__ vector signed char __ATTRS_o_ai
1363 vec_vandc(vector signed char __a, vector signed char __b) {
1364   return __a & ~__b;
1365 }
1366
1367 static __inline__ vector signed char __ATTRS_o_ai
1368 vec_vandc(vector bool char __a, vector signed char __b) {
1369   return (vector signed char)__a & ~__b;
1370 }
1371
1372 static __inline__ vector signed char __ATTRS_o_ai
1373 vec_vandc(vector signed char __a, vector bool char __b) {
1374   return __a & ~(vector signed char)__b;
1375 }
1376
1377 static __inline__ vector unsigned char __ATTRS_o_ai
1378 vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1379   return __a & ~__b;
1380 }
1381
1382 static __inline__ vector unsigned char __ATTRS_o_ai
1383 vec_vandc(vector bool char __a, vector unsigned char __b) {
1384   return (vector unsigned char)__a & ~__b;
1385 }
1386
1387 static __inline__ vector unsigned char __ATTRS_o_ai
1388 vec_vandc(vector unsigned char __a, vector bool char __b) {
1389   return __a & ~(vector unsigned char)__b;
1390 }
1391
1392 static __inline__ vector bool char __ATTRS_o_ai
1393 vec_vandc(vector bool char __a, vector bool char __b) {
1394   return __a & ~__b;
1395 }
1396
1397 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1398                                                       vector short __b) {
1399   return __a & ~__b;
1400 }
1401
1402 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1403                                                       vector short __b) {
1404   return (vector short)__a & ~__b;
1405 }
1406
1407 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1408                                                       vector bool short __b) {
1409   return __a & ~(vector short)__b;
1410 }
1411
1412 static __inline__ vector unsigned short __ATTRS_o_ai
1413 vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1414   return __a & ~__b;
1415 }
1416
1417 static __inline__ vector unsigned short __ATTRS_o_ai
1418 vec_vandc(vector bool short __a, vector unsigned short __b) {
1419   return (vector unsigned short)__a & ~__b;
1420 }
1421
1422 static __inline__ vector unsigned short __ATTRS_o_ai
1423 vec_vandc(vector unsigned short __a, vector bool short __b) {
1424   return __a & ~(vector unsigned short)__b;
1425 }
1426
1427 static __inline__ vector bool short __ATTRS_o_ai
1428 vec_vandc(vector bool short __a, vector bool short __b) {
1429   return __a & ~__b;
1430 }
1431
1432 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1433                                                     vector int __b) {
1434   return __a & ~__b;
1435 }
1436
1437 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1438                                                     vector int __b) {
1439   return (vector int)__a & ~__b;
1440 }
1441
1442 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1443                                                     vector bool int __b) {
1444   return __a & ~(vector int)__b;
1445 }
1446
1447 static __inline__ vector unsigned int __ATTRS_o_ai
1448 vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1449   return __a & ~__b;
1450 }
1451
1452 static __inline__ vector unsigned int __ATTRS_o_ai
1453 vec_vandc(vector bool int __a, vector unsigned int __b) {
1454   return (vector unsigned int)__a & ~__b;
1455 }
1456
1457 static __inline__ vector unsigned int __ATTRS_o_ai
1458 vec_vandc(vector unsigned int __a, vector bool int __b) {
1459   return __a & ~(vector unsigned int)__b;
1460 }
1461
1462 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1463                                                          vector bool int __b) {
1464   return __a & ~__b;
1465 }
1466
1467 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1468                                                       vector float __b) {
1469   vector unsigned int __res =
1470       (vector unsigned int)__a & ~(vector unsigned int)__b;
1471   return (vector float)__res;
1472 }
1473
1474 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1475                                                       vector float __b) {
1476   vector unsigned int __res =
1477       (vector unsigned int)__a & ~(vector unsigned int)__b;
1478   return (vector float)__res;
1479 }
1480
1481 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1482                                                       vector bool int __b) {
1483   vector unsigned int __res =
1484       (vector unsigned int)__a & ~(vector unsigned int)__b;
1485   return (vector float)__res;
1486 }
1487
1488 #ifdef __VSX__
1489 static __inline__ vector signed long long __ATTRS_o_ai
1490 vec_vandc(vector signed long long __a, vector signed long long __b) {
1491   return __a & ~__b;
1492 }
1493
1494 static __inline__ vector signed long long __ATTRS_o_ai
1495 vec_vandc(vector bool long long __a, vector signed long long __b) {
1496   return (vector signed long long)__a & ~__b;
1497 }
1498
1499 static __inline__ vector signed long long __ATTRS_o_ai
1500 vec_vandc(vector signed long long __a, vector bool long long __b) {
1501   return __a & ~(vector signed long long)__b;
1502 }
1503
1504 static __inline__ vector unsigned long long __ATTRS_o_ai
1505 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1506   return __a & ~__b;
1507 }
1508
1509 static __inline__ vector unsigned long long __ATTRS_o_ai
1510 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1511   return (vector unsigned long long)__a & ~__b;
1512 }
1513
1514 static __inline__ vector unsigned long long __ATTRS_o_ai
1515 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1516   return __a & ~(vector unsigned long long)__b;
1517 }
1518
1519 static __inline__ vector bool long long __ATTRS_o_ai
1520 vec_vandc(vector bool long long __a, vector bool long long __b) {
1521   return __a & ~__b;
1522 }
1523 #endif
1524
1525 /* vec_avg */
1526
1527 static __inline__ vector signed char __ATTRS_o_ai
1528 vec_avg(vector signed char __a, vector signed char __b) {
1529   return __builtin_altivec_vavgsb(__a, __b);
1530 }
1531
1532 static __inline__ vector unsigned char __ATTRS_o_ai
1533 vec_avg(vector unsigned char __a, vector unsigned char __b) {
1534   return __builtin_altivec_vavgub(__a, __b);
1535 }
1536
1537 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1538                                                     vector short __b) {
1539   return __builtin_altivec_vavgsh(__a, __b);
1540 }
1541
1542 static __inline__ vector unsigned short __ATTRS_o_ai
1543 vec_avg(vector unsigned short __a, vector unsigned short __b) {
1544   return __builtin_altivec_vavguh(__a, __b);
1545 }
1546
1547 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1548                                                   vector int __b) {
1549   return __builtin_altivec_vavgsw(__a, __b);
1550 }
1551
1552 static __inline__ vector unsigned int __ATTRS_o_ai
1553 vec_avg(vector unsigned int __a, vector unsigned int __b) {
1554   return __builtin_altivec_vavguw(__a, __b);
1555 }
1556
1557 /* vec_vavgsb */
1558
1559 static __inline__ vector signed char __attribute__((__always_inline__))
1560 vec_vavgsb(vector signed char __a, vector signed char __b) {
1561   return __builtin_altivec_vavgsb(__a, __b);
1562 }
1563
1564 /* vec_vavgub */
1565
1566 static __inline__ vector unsigned char __attribute__((__always_inline__))
1567 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1568   return __builtin_altivec_vavgub(__a, __b);
1569 }
1570
1571 /* vec_vavgsh */
1572
1573 static __inline__ vector short __attribute__((__always_inline__))
1574 vec_vavgsh(vector short __a, vector short __b) {
1575   return __builtin_altivec_vavgsh(__a, __b);
1576 }
1577
1578 /* vec_vavguh */
1579
1580 static __inline__ vector unsigned short __attribute__((__always_inline__))
1581 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1582   return __builtin_altivec_vavguh(__a, __b);
1583 }
1584
1585 /* vec_vavgsw */
1586
1587 static __inline__ vector int __attribute__((__always_inline__))
1588 vec_vavgsw(vector int __a, vector int __b) {
1589   return __builtin_altivec_vavgsw(__a, __b);
1590 }
1591
1592 /* vec_vavguw */
1593
1594 static __inline__ vector unsigned int __attribute__((__always_inline__))
1595 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1596   return __builtin_altivec_vavguw(__a, __b);
1597 }
1598
1599 /* vec_ceil */
1600
1601 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1602 #ifdef __VSX__
1603   return __builtin_vsx_xvrspip(__a);
1604 #else
1605   return __builtin_altivec_vrfip(__a);
1606 #endif
1607 }
1608
1609 #ifdef __VSX__
1610 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1611   return __builtin_vsx_xvrdpip(__a);
1612 }
1613 #endif
1614
1615 /* vec_vrfip */
1616
1617 static __inline__ vector float __attribute__((__always_inline__))
1618 vec_vrfip(vector float __a) {
1619   return __builtin_altivec_vrfip(__a);
1620 }
1621
1622 /* vec_cmpb */
1623
1624 static __inline__ vector int __attribute__((__always_inline__))
1625 vec_cmpb(vector float __a, vector float __b) {
1626   return __builtin_altivec_vcmpbfp(__a, __b);
1627 }
1628
1629 /* vec_vcmpbfp */
1630
1631 static __inline__ vector int __attribute__((__always_inline__))
1632 vec_vcmpbfp(vector float __a, vector float __b) {
1633   return __builtin_altivec_vcmpbfp(__a, __b);
1634 }
1635
1636 /* vec_cmpeq */
1637
1638 static __inline__ vector bool char __ATTRS_o_ai
1639 vec_cmpeq(vector signed char __a, vector signed char __b) {
1640   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1641                                                       (vector char)__b);
1642 }
1643
1644 static __inline__ vector bool char __ATTRS_o_ai
1645 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1646   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1647                                                       (vector char)__b);
1648 }
1649
1650 static __inline__ vector bool char __ATTRS_o_ai
1651 vec_cmpeq(vector bool char __a, vector bool char __b) {
1652   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1653                                                       (vector char)__b);
1654 }
1655
1656 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1657                                                            vector short __b) {
1658   return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1659 }
1660
1661 static __inline__ vector bool short __ATTRS_o_ai
1662 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1663   return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1664                                                        (vector short)__b);
1665 }
1666
1667 static __inline__ vector bool short __ATTRS_o_ai
1668 vec_cmpeq(vector bool short __a, vector bool short __b) {
1669   return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1670                                                        (vector short)__b);
1671 }
1672
1673 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1674                                                          vector int __b) {
1675   return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1676 }
1677
1678 static __inline__ vector bool int __ATTRS_o_ai
1679 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1680   return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1681                                                      (vector int)__b);
1682 }
1683
1684 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1685                                                          vector bool int __b) {
1686   return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1687                                                      (vector int)__b);
1688 }
1689
1690 #ifdef __POWER8_VECTOR__
1691 static __inline__ vector bool long long __ATTRS_o_ai
1692 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1693   return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1694 }
1695
1696 static __inline__ vector bool long long __ATTRS_o_ai
1697 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1698   return (vector bool long long)__builtin_altivec_vcmpequd(
1699       (vector long long)__a, (vector long long)__b);
1700 }
1701
1702 static __inline__ vector bool long long __ATTRS_o_ai
1703 vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1704   return (vector bool long long)__builtin_altivec_vcmpequd(
1705       (vector long long)__a, (vector long long)__b);
1706 }
1707
1708 #endif
1709
1710 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1711                                                          vector float __b) {
1712 #ifdef __VSX__
1713   return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1714 #else
1715   return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1716 #endif
1717 }
1718
1719 #ifdef __VSX__
1720 static __inline__ vector bool long long __ATTRS_o_ai
1721 vec_cmpeq(vector double __a, vector double __b) {
1722   return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1723 }
1724 #endif
1725
1726 #ifdef __POWER9_VECTOR__
1727 /* vec_cmpne */
1728
1729 static __inline__ vector bool char __ATTRS_o_ai
1730 vec_cmpne(vector bool char __a, vector bool char __b) {
1731   return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1732                                                      (vector char)__b);
1733 }
1734
1735 static __inline__ vector bool char __ATTRS_o_ai
1736 vec_cmpne(vector signed char __a, vector signed char __b) {
1737   return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1738                                                      (vector char)__b);
1739 }
1740
1741 static __inline__ vector bool char __ATTRS_o_ai
1742 vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1743   return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1744                                                      (vector char)__b);
1745 }
1746
1747 static __inline__ vector bool short __ATTRS_o_ai
1748 vec_cmpne(vector bool short __a, vector bool short __b) {
1749   return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1750                                                       (vector short)__b);
1751 }
1752
1753 static __inline__ vector bool short __ATTRS_o_ai
1754 vec_cmpne(vector signed short __a, vector signed short __b) {
1755   return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1756                                                       (vector short)__b);
1757 }
1758
1759 static __inline__ vector bool short __ATTRS_o_ai
1760 vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1761   return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1762                                                       (vector short)__b);
1763 }
1764
1765 static __inline__ vector bool int __ATTRS_o_ai
1766 vec_cmpne(vector bool int __a, vector bool int __b) {
1767   return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1768                                                     (vector int)__b);
1769 }
1770
1771 static __inline__ vector bool int __ATTRS_o_ai
1772 vec_cmpne(vector signed int __a, vector signed int __b) {
1773   return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1774                                                     (vector int)__b);
1775 }
1776
1777 static __inline__ vector bool int __ATTRS_o_ai
1778 vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1779   return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1780                                                     (vector int)__b);
1781 }
1782
1783 static __inline__ vector bool long long __ATTRS_o_ai
1784 vec_cmpne(vector bool long long __a, vector bool long long __b) {
1785   return (vector bool long long)
1786     ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1787 }
1788
1789 static __inline__ vector bool long long __ATTRS_o_ai
1790 vec_cmpne(vector signed long long __a, vector signed long long __b) {
1791   return (vector bool long long)
1792     ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1793 }
1794
1795 static __inline__ vector bool long long __ATTRS_o_ai
1796 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
1797   return (vector bool long long)
1798     ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1799 }
1800
1801 static __inline__ vector bool int __ATTRS_o_ai
1802 vec_cmpne(vector float __a, vector float __b) {
1803   return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1804                                                     (vector int)__b);
1805 }
1806
1807 static __inline__ vector bool long long __ATTRS_o_ai
1808 vec_cmpne(vector double __a, vector double __b) {
1809   return (vector bool long long)
1810     ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
1811 }
1812
1813 /* vec_cmpnez */
1814
1815 static __inline__ vector bool char __ATTRS_o_ai
1816 vec_cmpnez(vector signed char __a, vector signed char __b) {
1817   return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1818                                                       (vector char)__b);
1819 }
1820
1821 static __inline__ vector bool char __ATTRS_o_ai
1822 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1823   return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1824                                                       (vector char)__b);
1825 }
1826
1827 static __inline__ vector bool short __ATTRS_o_ai
1828 vec_cmpnez(vector signed short __a, vector signed short __b) {
1829   return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1830                                                        (vector short)__b);
1831 }
1832
1833 static __inline__ vector bool short __ATTRS_o_ai
1834 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1835   return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1836                                                        (vector short)__b);
1837 }
1838
1839 static __inline__ vector bool int __ATTRS_o_ai
1840 vec_cmpnez(vector signed int __a, vector signed int __b) {
1841   return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1842                                                      (vector int)__b);
1843 }
1844
1845 static __inline__ vector bool int __ATTRS_o_ai
1846 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1847   return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1848                                                      (vector int)__b);
1849 }
1850
1851 static __inline__ signed int __ATTRS_o_ai
1852 vec_cntlz_lsbb(vector signed char __a) {
1853 #ifdef __LITTLE_ENDIAN__
1854   return __builtin_altivec_vctzlsbb(__a);
1855 #else
1856   return __builtin_altivec_vclzlsbb(__a);
1857 #endif
1858 }
1859
1860 static __inline__ signed int __ATTRS_o_ai
1861 vec_cntlz_lsbb(vector unsigned char __a) {
1862 #ifdef __LITTLE_ENDIAN__
1863   return __builtin_altivec_vctzlsbb(__a);
1864 #else
1865   return __builtin_altivec_vclzlsbb(__a);
1866 #endif
1867 }
1868
1869 static __inline__ signed int __ATTRS_o_ai
1870 vec_cnttz_lsbb(vector signed char __a) {
1871 #ifdef __LITTLE_ENDIAN__
1872   return __builtin_altivec_vclzlsbb(__a);
1873 #else
1874   return __builtin_altivec_vctzlsbb(__a);
1875 #endif
1876 }
1877
1878 static __inline__ signed int __ATTRS_o_ai
1879 vec_cnttz_lsbb(vector unsigned char __a) {
1880 #ifdef __LITTLE_ENDIAN__
1881   return __builtin_altivec_vclzlsbb(__a);
1882 #else
1883   return __builtin_altivec_vctzlsbb(__a);
1884 #endif
1885 }
1886
1887 static __inline__ vector unsigned int __ATTRS_o_ai
1888 vec_parity_lsbb(vector unsigned int __a) {
1889   return __builtin_altivec_vprtybw(__a);
1890 }
1891
1892 static __inline__ vector unsigned int __ATTRS_o_ai
1893 vec_parity_lsbb(vector signed int __a) {
1894   return __builtin_altivec_vprtybw(__a);
1895 }
1896
1897 static __inline__ vector unsigned __int128 __ATTRS_o_ai
1898 vec_parity_lsbb(vector unsigned __int128 __a) {
1899   return __builtin_altivec_vprtybq(__a);
1900 }
1901
1902 static __inline__ vector unsigned __int128 __ATTRS_o_ai
1903 vec_parity_lsbb(vector signed __int128 __a) {
1904   return __builtin_altivec_vprtybq(__a);
1905 }
1906
1907 static __inline__ vector unsigned long long __ATTRS_o_ai
1908 vec_parity_lsbb(vector unsigned long long __a) {
1909   return __builtin_altivec_vprtybd(__a);
1910 }
1911
1912 static __inline__ vector unsigned long long __ATTRS_o_ai
1913 vec_parity_lsbb(vector signed long long __a) {
1914   return __builtin_altivec_vprtybd(__a);
1915 }
1916
1917 #endif
1918
1919 /* vec_cmpgt */
1920
1921 static __inline__ vector bool char __ATTRS_o_ai
1922 vec_cmpgt(vector signed char __a, vector signed char __b) {
1923   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1924 }
1925
1926 static __inline__ vector bool char __ATTRS_o_ai
1927 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1928   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1929 }
1930
1931 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1932                                                            vector short __b) {
1933   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1934 }
1935
1936 static __inline__ vector bool short __ATTRS_o_ai
1937 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1938   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1939 }
1940
1941 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1942                                                          vector int __b) {
1943   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1944 }
1945
1946 static __inline__ vector bool int __ATTRS_o_ai
1947 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1948   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1949 }
1950
1951 #ifdef __POWER8_VECTOR__
1952 static __inline__ vector bool long long __ATTRS_o_ai
1953 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1954   return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1955 }
1956
1957 static __inline__ vector bool long long __ATTRS_o_ai
1958 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1959   return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1960 }
1961 #endif
1962
1963 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1964                                                          vector float __b) {
1965 #ifdef __VSX__
1966   return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1967 #else
1968   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1969 #endif
1970 }
1971
1972 #ifdef __VSX__
1973 static __inline__ vector bool long long __ATTRS_o_ai
1974 vec_cmpgt(vector double __a, vector double __b) {
1975   return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1976 }
1977 #endif
1978
1979 /* vec_cmpge */
1980
1981 static __inline__ vector bool char __ATTRS_o_ai
1982 vec_cmpge(vector signed char __a, vector signed char __b) {
1983   return ~(vec_cmpgt(__b, __a));
1984 }
1985
1986 static __inline__ vector bool char __ATTRS_o_ai
1987 vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1988   return ~(vec_cmpgt(__b, __a));
1989 }
1990
1991 static __inline__ vector bool short __ATTRS_o_ai
1992 vec_cmpge(vector signed short __a, vector signed short __b) {
1993   return ~(vec_cmpgt(__b, __a));
1994 }
1995
1996 static __inline__ vector bool short __ATTRS_o_ai
1997 vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1998   return ~(vec_cmpgt(__b, __a));
1999 }
2000
2001 static __inline__ vector bool int __ATTRS_o_ai
2002 vec_cmpge(vector signed int __a, vector signed int __b) {
2003   return ~(vec_cmpgt(__b, __a));
2004 }
2005
2006 static __inline__ vector bool int __ATTRS_o_ai
2007 vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2008   return ~(vec_cmpgt(__b, __a));
2009 }
2010
2011 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
2012                                                          vector float __b) {
2013 #ifdef __VSX__
2014   return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2015 #else
2016   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2017 #endif
2018 }
2019
2020 #ifdef __VSX__
2021 static __inline__ vector bool long long __ATTRS_o_ai
2022 vec_cmpge(vector double __a, vector double __b) {
2023   return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2024 }
2025 #endif
2026
2027 #ifdef __POWER8_VECTOR__
2028 static __inline__ vector bool long long __ATTRS_o_ai
2029 vec_cmpge(vector signed long long __a, vector signed long long __b) {
2030   return ~(vec_cmpgt(__b, __a));
2031 }
2032
2033 static __inline__ vector bool long long __ATTRS_o_ai
2034 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2035   return ~(vec_cmpgt(__b, __a));
2036 }
2037 #endif
2038
2039 /* vec_vcmpgefp */
2040
2041 static __inline__ vector bool int __attribute__((__always_inline__))
2042 vec_vcmpgefp(vector float __a, vector float __b) {
2043   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2044 }
2045
2046 /* vec_vcmpgtsb */
2047
2048 static __inline__ vector bool char __attribute__((__always_inline__))
2049 vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2050   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2051 }
2052
2053 /* vec_vcmpgtub */
2054
2055 static __inline__ vector bool char __attribute__((__always_inline__))
2056 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2057   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2058 }
2059
2060 /* vec_vcmpgtsh */
2061
2062 static __inline__ vector bool short __attribute__((__always_inline__))
2063 vec_vcmpgtsh(vector short __a, vector short __b) {
2064   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2065 }
2066
2067 /* vec_vcmpgtuh */
2068
2069 static __inline__ vector bool short __attribute__((__always_inline__))
2070 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2071   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2072 }
2073
2074 /* vec_vcmpgtsw */
2075
2076 static __inline__ vector bool int __attribute__((__always_inline__))
2077 vec_vcmpgtsw(vector int __a, vector int __b) {
2078   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2079 }
2080
2081 /* vec_vcmpgtuw */
2082
2083 static __inline__ vector bool int __attribute__((__always_inline__))
2084 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2085   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2086 }
2087
2088 /* vec_vcmpgtfp */
2089
2090 static __inline__ vector bool int __attribute__((__always_inline__))
2091 vec_vcmpgtfp(vector float __a, vector float __b) {
2092   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2093 }
2094
2095 /* vec_cmple */
2096
2097 static __inline__ vector bool char __ATTRS_o_ai
2098 vec_cmple(vector signed char __a, vector signed char __b) {
2099   return vec_cmpge(__b, __a);
2100 }
2101
2102 static __inline__ vector bool char __ATTRS_o_ai
2103 vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2104   return vec_cmpge(__b, __a);
2105 }
2106
2107 static __inline__ vector bool short __ATTRS_o_ai
2108 vec_cmple(vector signed short __a, vector signed short __b) {
2109   return vec_cmpge(__b, __a);
2110 }
2111
2112 static __inline__ vector bool short __ATTRS_o_ai
2113 vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2114   return vec_cmpge(__b, __a);
2115 }
2116
2117 static __inline__ vector bool int __ATTRS_o_ai
2118 vec_cmple(vector signed int __a, vector signed int __b) {
2119   return vec_cmpge(__b, __a);
2120 }
2121
2122 static __inline__ vector bool int __ATTRS_o_ai
2123 vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2124   return vec_cmpge(__b, __a);
2125 }
2126
2127 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2128                                                          vector float __b) {
2129   return vec_cmpge(__b, __a);
2130 }
2131
2132 #ifdef __VSX__
2133 static __inline__ vector bool long long __ATTRS_o_ai
2134 vec_cmple(vector double __a, vector double __b) {
2135   return vec_cmpge(__b, __a);
2136 }
2137 #endif
2138
2139 #ifdef __POWER8_VECTOR__
2140 static __inline__ vector bool long long __ATTRS_o_ai
2141 vec_cmple(vector signed long long __a, vector signed long long __b) {
2142   return vec_cmpge(__b, __a);
2143 }
2144
2145 static __inline__ vector bool long long __ATTRS_o_ai
2146 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2147   return vec_cmpge(__b, __a);
2148 }
2149 #endif
2150
2151 /* vec_cmplt */
2152
2153 static __inline__ vector bool char __ATTRS_o_ai
2154 vec_cmplt(vector signed char __a, vector signed char __b) {
2155   return vec_cmpgt(__b, __a);
2156 }
2157
2158 static __inline__ vector bool char __ATTRS_o_ai
2159 vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2160   return vec_cmpgt(__b, __a);
2161 }
2162
2163 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2164                                                            vector short __b) {
2165   return vec_cmpgt(__b, __a);
2166 }
2167
2168 static __inline__ vector bool short __ATTRS_o_ai
2169 vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2170   return vec_cmpgt(__b, __a);
2171 }
2172
2173 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2174                                                          vector int __b) {
2175   return vec_cmpgt(__b, __a);
2176 }
2177
2178 static __inline__ vector bool int __ATTRS_o_ai
2179 vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2180   return vec_cmpgt(__b, __a);
2181 }
2182
2183 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2184                                                          vector float __b) {
2185   return vec_cmpgt(__b, __a);
2186 }
2187
2188 #ifdef __VSX__
2189 static __inline__ vector bool long long __ATTRS_o_ai
2190 vec_cmplt(vector double __a, vector double __b) {
2191   return vec_cmpgt(__b, __a);
2192 }
2193 #endif
2194
2195 #ifdef __POWER8_VECTOR__
2196 static __inline__ vector bool long long __ATTRS_o_ai
2197 vec_cmplt(vector signed long long __a, vector signed long long __b) {
2198   return vec_cmpgt(__b, __a);
2199 }
2200
2201 static __inline__ vector bool long long __ATTRS_o_ai
2202 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2203   return vec_cmpgt(__b, __a);
2204 }
2205
2206 /* vec_popcnt */
2207
2208 static __inline__ vector signed char __ATTRS_o_ai
2209 vec_popcnt(vector signed char __a) {
2210   return __builtin_altivec_vpopcntb(__a);
2211 }
2212 static __inline__ vector unsigned char __ATTRS_o_ai
2213 vec_popcnt(vector unsigned char __a) {
2214   return __builtin_altivec_vpopcntb(__a);
2215 }
2216 static __inline__ vector signed short __ATTRS_o_ai
2217 vec_popcnt(vector signed short __a) {
2218   return __builtin_altivec_vpopcnth(__a);
2219 }
2220 static __inline__ vector unsigned short __ATTRS_o_ai
2221 vec_popcnt(vector unsigned short __a) {
2222   return __builtin_altivec_vpopcnth(__a);
2223 }
2224 static __inline__ vector signed int __ATTRS_o_ai
2225 vec_popcnt(vector signed int __a) {
2226   return __builtin_altivec_vpopcntw(__a);
2227 }
2228 static __inline__ vector unsigned int __ATTRS_o_ai
2229 vec_popcnt(vector unsigned int __a) {
2230   return __builtin_altivec_vpopcntw(__a);
2231 }
2232 static __inline__ vector signed long long __ATTRS_o_ai
2233 vec_popcnt(vector signed long long __a) {
2234   return __builtin_altivec_vpopcntd(__a);
2235 }
2236 static __inline__ vector unsigned long long __ATTRS_o_ai
2237 vec_popcnt(vector unsigned long long __a) {
2238   return __builtin_altivec_vpopcntd(__a);
2239 }
2240
2241 /* vec_cntlz */
2242
2243 static __inline__ vector signed char __ATTRS_o_ai
2244 vec_cntlz(vector signed char __a) {
2245   return __builtin_altivec_vclzb(__a);
2246 }
2247 static __inline__ vector unsigned char __ATTRS_o_ai
2248 vec_cntlz(vector unsigned char __a) {
2249   return __builtin_altivec_vclzb(__a);
2250 }
2251 static __inline__ vector signed short __ATTRS_o_ai
2252 vec_cntlz(vector signed short __a) {
2253   return __builtin_altivec_vclzh(__a);
2254 }
2255 static __inline__ vector unsigned short __ATTRS_o_ai
2256 vec_cntlz(vector unsigned short __a) {
2257   return __builtin_altivec_vclzh(__a);
2258 }
2259 static __inline__ vector signed int __ATTRS_o_ai
2260 vec_cntlz(vector signed int __a) {
2261   return __builtin_altivec_vclzw(__a);
2262 }
2263 static __inline__ vector unsigned int __ATTRS_o_ai
2264 vec_cntlz(vector unsigned int __a) {
2265   return __builtin_altivec_vclzw(__a);
2266 }
2267 static __inline__ vector signed long long __ATTRS_o_ai
2268 vec_cntlz(vector signed long long __a) {
2269   return __builtin_altivec_vclzd(__a);
2270 }
2271 static __inline__ vector unsigned long long __ATTRS_o_ai
2272 vec_cntlz(vector unsigned long long __a) {
2273   return __builtin_altivec_vclzd(__a);
2274 }
2275 #endif
2276
2277 #ifdef __POWER9_VECTOR__
2278
2279 /* vec_cnttz */
2280
2281 static __inline__ vector signed char __ATTRS_o_ai
2282 vec_cnttz(vector signed char __a) {
2283   return __builtin_altivec_vctzb(__a);
2284 }
2285 static __inline__ vector unsigned char __ATTRS_o_ai
2286 vec_cnttz(vector unsigned char __a) {
2287   return __builtin_altivec_vctzb(__a);
2288 }
2289 static __inline__ vector signed short __ATTRS_o_ai
2290 vec_cnttz(vector signed short __a) {
2291   return __builtin_altivec_vctzh(__a);
2292 }
2293 static __inline__ vector unsigned short __ATTRS_o_ai
2294 vec_cnttz(vector unsigned short __a) {
2295   return __builtin_altivec_vctzh(__a);
2296 }
2297 static __inline__ vector signed int __ATTRS_o_ai
2298 vec_cnttz(vector signed int __a) {
2299   return __builtin_altivec_vctzw(__a);
2300 }
2301 static __inline__ vector unsigned int __ATTRS_o_ai
2302 vec_cnttz(vector unsigned int __a) {
2303   return __builtin_altivec_vctzw(__a);
2304 }
2305 static __inline__ vector signed long long __ATTRS_o_ai
2306 vec_cnttz(vector signed long long __a) {
2307   return __builtin_altivec_vctzd(__a);
2308 }
2309 static __inline__ vector unsigned long long __ATTRS_o_ai
2310 vec_cnttz(vector unsigned long long __a) {
2311   return __builtin_altivec_vctzd(__a);
2312 }
2313
2314 /* vec_first_match_index */
2315
2316 static __inline__ unsigned __ATTRS_o_ai
2317 vec_first_match_index(vector signed char __a, vector signed char __b) {
2318   vector unsigned long long __res =
2319 #ifdef __LITTLE_ENDIAN__
2320     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2321 #else
2322     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2323 #endif
2324   if (__res[0] == 64) {
2325     return (__res[1] + 64) >> 3;
2326   }
2327   return __res[0] >> 3;
2328 }
2329
2330 static __inline__ unsigned __ATTRS_o_ai
2331 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2332   vector unsigned long long __res =
2333 #ifdef __LITTLE_ENDIAN__
2334     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2335 #else
2336     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2337 #endif
2338   if (__res[0] == 64) {
2339     return (__res[1] + 64) >> 3;
2340   }
2341   return __res[0] >> 3;
2342 }
2343
2344 static __inline__ unsigned __ATTRS_o_ai
2345 vec_first_match_index(vector signed short __a, vector signed short __b) {
2346   vector unsigned long long __res =
2347 #ifdef __LITTLE_ENDIAN__
2348     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2349 #else
2350     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2351 #endif
2352   if (__res[0] == 64) {
2353     return (__res[1] + 64) >> 4;
2354   }
2355   return __res[0] >> 4;
2356 }
2357
2358 static __inline__ unsigned __ATTRS_o_ai
2359 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2360   vector unsigned long long __res =
2361 #ifdef __LITTLE_ENDIAN__
2362     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2363 #else
2364     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2365 #endif
2366   if (__res[0] == 64) {
2367     return (__res[1] + 64) >> 4;
2368   }
2369   return __res[0] >> 4;
2370 }
2371
2372 static __inline__ unsigned __ATTRS_o_ai
2373 vec_first_match_index(vector signed int __a, vector signed int __b) {
2374   vector unsigned long long __res =
2375 #ifdef __LITTLE_ENDIAN__
2376     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2377 #else
2378     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2379 #endif
2380   if (__res[0] == 64) {
2381     return (__res[1] + 64) >> 5;
2382   }
2383   return __res[0] >> 5;
2384 }
2385
2386 static __inline__ unsigned __ATTRS_o_ai
2387 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2388   vector unsigned long long __res =
2389 #ifdef __LITTLE_ENDIAN__
2390     vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2391 #else
2392     vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2393 #endif
2394   if (__res[0] == 64) {
2395     return (__res[1] + 64) >> 5;
2396   }
2397   return __res[0] >> 5;
2398 }
2399
2400 /* vec_first_match_or_eos_index */
2401
2402 static __inline__ unsigned __ATTRS_o_ai
2403 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2404   /* Compare the result of the comparison of two vectors with either and OR the
2405      result. Either the elements are equal or one will equal the comparison
2406      result if either is zero.
2407   */
2408   vector bool char __tmp1 = vec_cmpeq(__a, __b);
2409   vector bool char __tmp2 = __tmp1 |
2410                             vec_cmpeq((vector signed char)__tmp1, __a) |
2411                             vec_cmpeq((vector signed char)__tmp1, __b);
2412
2413   vector unsigned long long __res =
2414 #ifdef __LITTLE_ENDIAN__
2415       vec_cnttz((vector unsigned long long)__tmp2);
2416 #else
2417       vec_cntlz((vector unsigned long long)__tmp2);
2418 #endif
2419   if (__res[0] == 64) {
2420     return (__res[1] + 64) >> 3;
2421   }
2422   return __res[0] >> 3;
2423 }
2424
2425 static __inline__ unsigned __ATTRS_o_ai
2426 vec_first_match_or_eos_index(vector unsigned char __a,
2427                              vector unsigned char __b) {
2428   vector bool char __tmp1 = vec_cmpeq(__a, __b);
2429   vector bool char __tmp2 = __tmp1 |
2430                             vec_cmpeq((vector unsigned char)__tmp1, __a) |
2431                             vec_cmpeq((vector unsigned char)__tmp1, __b);
2432
2433   vector unsigned long long __res =
2434 #ifdef __LITTLE_ENDIAN__
2435       vec_cnttz((vector unsigned long long)__tmp2);
2436 #else
2437       vec_cntlz((vector unsigned long long)__tmp2);
2438 #endif
2439   if (__res[0] == 64) {
2440     return (__res[1] + 64) >> 3;
2441   }
2442   return __res[0] >> 3;
2443 }
2444
2445 static __inline__ unsigned __ATTRS_o_ai
2446 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2447   vector bool short __tmp1 = vec_cmpeq(__a, __b);
2448   vector bool short __tmp2 = __tmp1 |
2449                              vec_cmpeq((vector signed short)__tmp1, __a) |
2450                              vec_cmpeq((vector signed short)__tmp1, __b);
2451
2452   vector unsigned long long __res =
2453 #ifdef __LITTLE_ENDIAN__
2454       vec_cnttz((vector unsigned long long)__tmp2);
2455 #else
2456       vec_cntlz((vector unsigned long long)__tmp2);
2457 #endif
2458   if (__res[0] == 64) {
2459     return (__res[1] + 64) >> 4;
2460   }
2461   return __res[0] >> 4;
2462 }
2463
2464 static __inline__ unsigned __ATTRS_o_ai
2465 vec_first_match_or_eos_index(vector unsigned short __a,
2466                              vector unsigned short __b) {
2467   vector bool short __tmp1 = vec_cmpeq(__a, __b);
2468   vector bool short __tmp2 = __tmp1 |
2469                              vec_cmpeq((vector unsigned short)__tmp1, __a) |
2470                              vec_cmpeq((vector unsigned short)__tmp1, __b);
2471
2472   vector unsigned long long __res =
2473 #ifdef __LITTLE_ENDIAN__
2474       vec_cnttz((vector unsigned long long)__tmp2);
2475 #else
2476       vec_cntlz((vector unsigned long long)__tmp2);
2477 #endif
2478   if (__res[0] == 64) {
2479     return (__res[1] + 64) >> 4;
2480   }
2481   return __res[0] >> 4;
2482 }
2483
2484 static __inline__ unsigned __ATTRS_o_ai
2485 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2486   vector bool int __tmp1 = vec_cmpeq(__a, __b);
2487   vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2488                            vec_cmpeq((vector signed int)__tmp1, __b);
2489
2490   vector unsigned long long __res =
2491 #ifdef __LITTLE_ENDIAN__
2492       vec_cnttz((vector unsigned long long)__tmp2);
2493 #else
2494       vec_cntlz((vector unsigned long long)__tmp2);
2495 #endif
2496   if (__res[0] == 64) {
2497     return (__res[1] + 64) >> 5;
2498   }
2499   return __res[0] >> 5;
2500 }
2501
2502 static __inline__ unsigned __ATTRS_o_ai
2503 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2504   vector bool int __tmp1 = vec_cmpeq(__a, __b);
2505   vector bool int __tmp2 = __tmp1 |
2506                            vec_cmpeq((vector unsigned int)__tmp1, __a) |
2507                            vec_cmpeq((vector unsigned int)__tmp1, __b);
2508
2509   vector unsigned long long __res =
2510 #ifdef __LITTLE_ENDIAN__
2511     vec_cnttz((vector unsigned long long)__tmp2);
2512 #else
2513     vec_cntlz((vector unsigned long long)__tmp2);
2514 #endif
2515   if (__res[0] == 64) {
2516     return (__res[1] + 64) >> 5;
2517   }
2518   return __res[0] >> 5;
2519 }
2520
2521 /* vec_first_mismatch_index */
2522
2523 static __inline__ unsigned __ATTRS_o_ai
2524 vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2525   vector unsigned long long __res =
2526 #ifdef __LITTLE_ENDIAN__
2527     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2528 #else
2529     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2530 #endif
2531   if (__res[0] == 64) {
2532     return (__res[1] + 64) >> 3;
2533   }
2534   return __res[0] >> 3;
2535 }
2536
2537 static __inline__ unsigned __ATTRS_o_ai
2538 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2539   vector unsigned long long __res =
2540 #ifdef __LITTLE_ENDIAN__
2541     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2542 #else
2543     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2544 #endif
2545   if (__res[0] == 64) {
2546     return (__res[1] + 64) >> 3;
2547   }
2548   return __res[0] >> 3;
2549 }
2550
2551 static __inline__ unsigned __ATTRS_o_ai
2552 vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2553   vector unsigned long long __res =
2554 #ifdef __LITTLE_ENDIAN__
2555     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2556 #else
2557     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2558 #endif
2559   if (__res[0] == 64) {
2560     return (__res[1] + 64) >> 4;
2561   }
2562   return __res[0] >> 4;
2563 }
2564
2565 static __inline__ unsigned __ATTRS_o_ai
2566 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2567   vector unsigned long long __res =
2568 #ifdef __LITTLE_ENDIAN__
2569     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2570 #else
2571     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2572 #endif
2573   if (__res[0] == 64) {
2574     return (__res[1] + 64) >> 4;
2575   }
2576   return __res[0] >> 4;
2577 }
2578
2579 static __inline__ unsigned __ATTRS_o_ai
2580 vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2581   vector unsigned long long __res =
2582 #ifdef __LITTLE_ENDIAN__
2583     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2584 #else
2585     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2586 #endif
2587   if (__res[0] == 64) {
2588     return (__res[1] + 64) >> 5;
2589   }
2590   return __res[0] >> 5;
2591 }
2592
2593 static __inline__ unsigned __ATTRS_o_ai
2594 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2595   vector unsigned long long __res =
2596 #ifdef __LITTLE_ENDIAN__
2597     vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2598 #else
2599     vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2600 #endif
2601   if (__res[0] == 64) {
2602     return (__res[1] + 64) >> 5;
2603   }
2604   return __res[0] >> 5;
2605 }
2606
2607 /* vec_first_mismatch_or_eos_index */
2608
2609 static __inline__ unsigned __ATTRS_o_ai
2610 vec_first_mismatch_or_eos_index(vector signed char __a,
2611                                 vector signed char __b) {
2612   vector unsigned long long __res =
2613 #ifdef __LITTLE_ENDIAN__
2614     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2615 #else
2616     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2617 #endif
2618   if (__res[0] == 64) {
2619     return (__res[1] + 64) >> 3;
2620   }
2621   return __res[0] >> 3;
2622 }
2623
2624 static __inline__ unsigned __ATTRS_o_ai
2625 vec_first_mismatch_or_eos_index(vector unsigned char __a,
2626                                 vector unsigned char __b) {
2627   vector unsigned long long __res =
2628 #ifdef __LITTLE_ENDIAN__
2629     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2630 #else
2631     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2632 #endif
2633   if (__res[0] == 64) {
2634     return (__res[1] + 64) >> 3;
2635   }
2636   return __res[0] >> 3;
2637 }
2638
2639 static __inline__ unsigned __ATTRS_o_ai
2640 vec_first_mismatch_or_eos_index(vector signed short __a,
2641                                 vector signed short __b) {
2642   vector unsigned long long __res =
2643 #ifdef __LITTLE_ENDIAN__
2644     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2645 #else
2646     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2647 #endif
2648   if (__res[0] == 64) {
2649     return (__res[1] + 64) >> 4;
2650   }
2651   return __res[0] >> 4;
2652 }
2653
2654 static __inline__ unsigned __ATTRS_o_ai
2655 vec_first_mismatch_or_eos_index(vector unsigned short __a,
2656                                 vector unsigned short __b) {
2657   vector unsigned long long __res =
2658 #ifdef __LITTLE_ENDIAN__
2659     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2660 #else
2661     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2662 #endif
2663   if (__res[0] == 64) {
2664     return (__res[1] + 64) >> 4;
2665   }
2666   return __res[0] >> 4;
2667 }
2668
2669 static __inline__ unsigned __ATTRS_o_ai
2670 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2671   vector unsigned long long __res =
2672 #ifdef __LITTLE_ENDIAN__
2673     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2674 #else
2675     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2676 #endif
2677   if (__res[0] == 64) {
2678     return (__res[1] + 64) >> 5;
2679   }
2680   return __res[0] >> 5;
2681 }
2682
2683 static __inline__ unsigned __ATTRS_o_ai
2684 vec_first_mismatch_or_eos_index(vector unsigned int __a,
2685                                 vector unsigned int __b) {
2686   vector unsigned long long __res =
2687 #ifdef __LITTLE_ENDIAN__
2688     vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2689 #else
2690     vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2691 #endif
2692   if (__res[0] == 64) {
2693     return (__res[1] + 64) >> 5;
2694   }
2695   return __res[0] >> 5;
2696 }
2697
2698 static __inline__ vector double  __ATTRS_o_ai
2699 vec_insert_exp(vector double __a, vector unsigned long long __b) {
2700   return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
2701 }
2702
2703 static __inline__ vector double  __ATTRS_o_ai
2704 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
2705   return __builtin_vsx_xviexpdp(__a,__b);
2706 }
2707
2708 static __inline__ vector float  __ATTRS_o_ai
2709 vec_insert_exp(vector float __a, vector unsigned int __b) {
2710   return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
2711 }
2712
2713 static __inline__ vector float  __ATTRS_o_ai
2714 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
2715   return __builtin_vsx_xviexpsp(__a,__b);
2716 }
2717
2718 #if defined(__powerpc64__)
2719 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(signed char *__a,
2720                                                              size_t __b) {
2721   return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
2722 }
2723
2724 static __inline__ vector unsigned char __ATTRS_o_ai
2725 vec_xl_len(unsigned char *__a, size_t __b) {
2726   return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
2727 }
2728
2729 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(signed short *__a,
2730                                                               size_t __b) {
2731   return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
2732 }
2733
2734 static __inline__ vector unsigned short __ATTRS_o_ai
2735 vec_xl_len(unsigned short *__a, size_t __b) {
2736   return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
2737 }
2738
2739 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(signed int *__a,
2740                                                             size_t __b) {
2741   return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
2742 }
2743
2744 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(unsigned int *__a,
2745                                                               size_t __b) {
2746   return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
2747 }
2748
2749 static __inline__ vector float __ATTRS_o_ai vec_xl_len(float *__a, size_t __b) {
2750   return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
2751 }
2752
2753 static __inline__ vector signed __int128 __ATTRS_o_ai
2754 vec_xl_len(signed __int128 *__a, size_t __b) {
2755   return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2756 }
2757
2758 static __inline__ vector unsigned __int128 __ATTRS_o_ai
2759 vec_xl_len(unsigned __int128 *__a, size_t __b) {
2760   return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
2761 }
2762
2763 static __inline__ vector signed long long __ATTRS_o_ai
2764 vec_xl_len(signed long long *__a, size_t __b) {
2765   return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
2766 }
2767
2768 static __inline__ vector unsigned long long __ATTRS_o_ai
2769 vec_xl_len(unsigned long long *__a, size_t __b) {
2770   return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
2771 }
2772
2773 static __inline__ vector double __ATTRS_o_ai vec_xl_len(double *__a,
2774                                                         size_t __b) {
2775   return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
2776 }
2777
2778 static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
2779                                                           size_t __b) {
2780   vector unsigned char __res =
2781       (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
2782 #ifdef __LITTLE_ENDIAN__
2783   vector unsigned char __mask =
2784       (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
2785   __res = (vector unsigned char)__builtin_altivec_vperm_4si(
2786       (vector int)__res, (vector int)__res, __mask);
2787 #endif
2788   return __res;
2789 }
2790
2791 // vec_xst_len
2792 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
2793                                                 unsigned char *__b,
2794                                                 size_t __c) {
2795   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2796 }
2797
2798 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
2799                                                 signed char *__b, size_t __c) {
2800   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2801 }
2802
2803 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
2804                                                 signed short *__b, size_t __c) {
2805   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2806 }
2807
2808 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
2809                                                 unsigned short *__b,
2810                                                 size_t __c) {
2811   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2812 }
2813
2814 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
2815                                                 signed int *__b, size_t __c) {
2816   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2817 }
2818
2819 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
2820                                                 unsigned int *__b, size_t __c) {
2821   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2822 }
2823
2824 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
2825                                                 size_t __c) {
2826   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2827 }
2828
2829 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
2830                                                 signed __int128 *__b,
2831                                                 size_t __c) {
2832   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2833 }
2834
2835 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
2836                                                 unsigned __int128 *__b,
2837                                                 size_t __c) {
2838   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2839 }
2840
2841 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
2842                                                 signed long long *__b,
2843                                                 size_t __c) {
2844   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2845 }
2846
2847 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
2848                                                 unsigned long long *__b,
2849                                                 size_t __c) {
2850   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2851 }
2852
2853 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
2854                                                 size_t __c) {
2855   return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
2856 }
2857
2858 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
2859                                                   unsigned char *__b,
2860                                                   size_t __c) {
2861 #ifdef __LITTLE_ENDIAN__
2862   vector unsigned char __mask =
2863       (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
2864   vector unsigned char __res =
2865       __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask);
2866   return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
2867 #else
2868   return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56));
2869 #endif
2870 }
2871 #endif
2872 #endif
2873
2874 /* vec_cpsgn */
2875
2876 #ifdef __VSX__
2877 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
2878                                                       vector float __b) {
2879   return __builtin_vsx_xvcpsgnsp(__a, __b);
2880 }
2881
2882 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
2883                                                        vector double __b) {
2884   return __builtin_vsx_xvcpsgndp(__a, __b);
2885 }
2886 #endif
2887
2888 /* vec_ctf */
2889
2890 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
2891   return __builtin_altivec_vcfsx(__a, __b);
2892 }
2893
2894 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a,
2895                                                     int __b) {
2896   return __builtin_altivec_vcfux((vector int)__a, __b);
2897 }
2898
2899 #ifdef __VSX__
2900 static __inline__ vector double __ATTRS_o_ai
2901 vec_ctf(vector unsigned long long __a, int __b) {
2902   vector double __ret = __builtin_convertvector(__a, vector double);
2903   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
2904   return __ret;
2905 }
2906
2907 static __inline__ vector double __ATTRS_o_ai
2908 vec_ctf(vector signed long long __a, int __b) {
2909   vector double __ret = __builtin_convertvector(__a, vector double);
2910   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
2911   return __ret;
2912 }
2913 #endif
2914
2915 /* vec_vcfsx */
2916
2917 static __inline__ vector float __attribute__((__always_inline__))
2918 vec_vcfsx(vector int __a, int __b) {
2919   return __builtin_altivec_vcfsx(__a, __b);
2920 }
2921
2922 /* vec_vcfux */
2923
2924 static __inline__ vector float __attribute__((__always_inline__))
2925 vec_vcfux(vector unsigned int __a, int __b) {
2926   return __builtin_altivec_vcfux((vector int)__a, __b);
2927 }
2928
2929 /* vec_cts */
2930
2931 static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) {
2932   return __builtin_altivec_vctsxs(__a, __b);
2933 }
2934
2935 #ifdef __VSX__
2936 static __inline__ vector signed long long __ATTRS_o_ai
2937 vec_cts(vector double __a, int __b) {
2938   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2939   return __builtin_convertvector(__a, vector signed long long);
2940 }
2941 #endif
2942
2943 /* vec_vctsxs */
2944
2945 static __inline__ vector int __attribute__((__always_inline__))
2946 vec_vctsxs(vector float __a, int __b) {
2947   return __builtin_altivec_vctsxs(__a, __b);
2948 }
2949
2950 /* vec_ctu */
2951
2952 static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a,
2953                                                            int __b) {
2954   return __builtin_altivec_vctuxs(__a, __b);
2955 }
2956
2957 #ifdef __VSX__
2958 static __inline__ vector unsigned long long __ATTRS_o_ai
2959 vec_ctu(vector double __a, int __b) {
2960   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2961   return __builtin_convertvector(__a, vector unsigned long long);
2962 }
2963 #endif
2964
2965 /* vec_vctuxs */
2966
2967 static __inline__ vector unsigned int __attribute__((__always_inline__))
2968 vec_vctuxs(vector float __a, int __b) {
2969   return __builtin_altivec_vctuxs(__a, __b);
2970 }
2971
2972 /* vec_signed */
2973
2974 static __inline__ vector signed int __ATTRS_o_ai
2975 vec_sld(vector signed int, vector signed int, unsigned const int __c);
2976
2977 static __inline__ vector signed int __ATTRS_o_ai
2978 vec_signed(vector float __a) {
2979   return __builtin_convertvector(__a, vector signed int);
2980 }
2981
2982 #ifdef __VSX__
2983 static __inline__ vector signed long long __ATTRS_o_ai
2984 vec_signed(vector double __a) {
2985   return __builtin_convertvector(__a, vector signed long long);
2986 }
2987
2988 static __inline__ vector signed int __attribute__((__always_inline__))
2989 vec_signed2(vector double __a, vector double __b) {
2990   return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
2991 }
2992
2993 static __inline__ vector signed int __ATTRS_o_ai
2994 vec_signede(vector double __a) {
2995 #ifdef __LITTLE_ENDIAN__
2996   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
2997   return vec_sld(__ret, __ret, 12);
2998 #else
2999   return __builtin_vsx_xvcvdpsxws(__a);
3000 #endif
3001 }
3002
3003 static __inline__ vector signed int __ATTRS_o_ai
3004 vec_signedo(vector double __a) {
3005 #ifdef __LITTLE_ENDIAN__
3006   return __builtin_vsx_xvcvdpsxws(__a);
3007 #else
3008   vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3009   return vec_sld(__ret, __ret, 12);
3010 #endif
3011 }
3012 #endif
3013
3014 /* vec_unsigned */
3015
3016 static __inline__ vector unsigned int __ATTRS_o_ai
3017 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3018
3019 static __inline__ vector unsigned int __ATTRS_o_ai
3020 vec_unsigned(vector float __a) {
3021   return __builtin_convertvector(__a, vector unsigned int);
3022 }
3023
3024 #ifdef __VSX__
3025 static __inline__ vector unsigned long long __ATTRS_o_ai
3026 vec_unsigned(vector double __a) {
3027   return __builtin_convertvector(__a, vector unsigned long long);
3028 }
3029
3030 static __inline__ vector unsigned int __attribute__((__always_inline__))
3031 vec_unsigned2(vector double __a, vector double __b) {
3032   return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3033 }
3034
3035 static __inline__ vector unsigned int __ATTRS_o_ai
3036 vec_unsignede(vector double __a) {
3037 #ifdef __LITTLE_ENDIAN__
3038   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3039   return vec_sld(__ret, __ret, 12);
3040 #else
3041   return __builtin_vsx_xvcvdpuxws(__a);
3042 #endif
3043 }
3044
3045 static __inline__ vector unsigned int __ATTRS_o_ai
3046 vec_unsignedo(vector double __a) {
3047 #ifdef __LITTLE_ENDIAN__
3048   return __builtin_vsx_xvcvdpuxws(__a);
3049 #else
3050   vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3051   return vec_sld(__ret, __ret, 12);
3052 #endif
3053 }
3054 #endif
3055
3056 /* vec_float */
3057
3058 static __inline__ vector float __ATTRS_o_ai
3059 vec_sld(vector float, vector float, unsigned const int __c);
3060
3061 static __inline__ vector float __ATTRS_o_ai
3062 vec_float(vector signed int __a) {
3063   return __builtin_convertvector(__a, vector float);
3064 }
3065
3066 static __inline__ vector float __ATTRS_o_ai
3067 vec_float(vector unsigned int __a) {
3068   return __builtin_convertvector(__a, vector float);
3069 }
3070
3071 #ifdef __VSX__
3072 static __inline__ vector float __ATTRS_o_ai
3073 vec_float2(vector signed long long __a, vector signed long long __b) {
3074   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3075 }
3076
3077 static __inline__ vector float __ATTRS_o_ai
3078 vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3079   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3080 }
3081
3082 static __inline__ vector float __ATTRS_o_ai
3083 vec_float2(vector double __a, vector double __b) {
3084   return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3085 }
3086
3087 static __inline__ vector float __ATTRS_o_ai
3088 vec_floate(vector signed long long __a) {
3089 #ifdef __LITTLE_ENDIAN__
3090   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3091   return vec_sld(__ret, __ret, 12);
3092 #else
3093   return __builtin_vsx_xvcvsxdsp(__a);
3094 #endif
3095 }
3096
3097 static __inline__ vector float __ATTRS_o_ai
3098 vec_floate(vector unsigned long long __a) {
3099 #ifdef __LITTLE_ENDIAN__
3100   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3101   return vec_sld(__ret, __ret, 12);
3102 #else
3103   return __builtin_vsx_xvcvuxdsp(__a);
3104 #endif
3105 }
3106
3107 static __inline__ vector float __ATTRS_o_ai
3108 vec_floate(vector double __a) {
3109 #ifdef __LITTLE_ENDIAN__
3110   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3111   return vec_sld(__ret, __ret, 12);
3112 #else
3113   return __builtin_vsx_xvcvdpsp(__a);
3114 #endif
3115 }
3116
3117 static __inline__ vector float __ATTRS_o_ai
3118 vec_floato(vector signed long long __a) {
3119 #ifdef __LITTLE_ENDIAN__
3120   return __builtin_vsx_xvcvsxdsp(__a);
3121 #else
3122   vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3123   return vec_sld(__ret, __ret, 12);
3124 #endif
3125 }
3126
3127 static __inline__ vector float __ATTRS_o_ai
3128 vec_floato(vector unsigned long long __a) {
3129 #ifdef __LITTLE_ENDIAN__
3130   return __builtin_vsx_xvcvuxdsp(__a);
3131 #else
3132   vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3133   return vec_sld(__ret, __ret, 12);
3134 #endif
3135 }
3136
3137 static __inline__ vector float __ATTRS_o_ai
3138 vec_floato(vector double __a) {
3139 #ifdef __LITTLE_ENDIAN__
3140   return __builtin_vsx_xvcvdpsp(__a);
3141 #else
3142   vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3143   return vec_sld(__ret, __ret, 12);
3144 #endif
3145 }
3146 #endif
3147
3148 /* vec_double */
3149
3150 #ifdef __VSX__
3151 static __inline__ vector double __ATTRS_o_ai
3152 vec_double(vector signed long long __a) {
3153   return __builtin_convertvector(__a, vector double);
3154 }
3155
3156 static __inline__ vector double __ATTRS_o_ai
3157 vec_double(vector unsigned long long __a) {
3158   return __builtin_convertvector(__a, vector double);
3159 }
3160
3161 static __inline__ vector double __ATTRS_o_ai
3162 vec_doublee(vector signed int __a) {
3163 #ifdef __LITTLE_ENDIAN__
3164   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3165 #else
3166   return __builtin_vsx_xvcvsxwdp(__a);
3167 #endif
3168 }
3169
3170 static __inline__ vector double __ATTRS_o_ai
3171 vec_doublee(vector unsigned int __a) {
3172 #ifdef __LITTLE_ENDIAN__
3173   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3174 #else
3175   return __builtin_vsx_xvcvuxwdp(__a);
3176 #endif
3177 }
3178
3179 static __inline__ vector double __ATTRS_o_ai
3180 vec_doublee(vector float __a) {
3181 #ifdef __LITTLE_ENDIAN__
3182   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3183 #else
3184   return __builtin_vsx_xvcvspdp(__a);
3185 #endif
3186 }
3187
3188 static __inline__ vector double __ATTRS_o_ai
3189 vec_doubleh(vector signed int __a) {
3190   vector double __ret = {__a[0], __a[1]};
3191   return __ret;
3192 }
3193
3194 static __inline__ vector double __ATTRS_o_ai
3195 vec_doubleh(vector unsigned int __a) {
3196   vector double __ret = {__a[0], __a[1]};
3197   return __ret;
3198 }
3199
3200 static __inline__ vector double __ATTRS_o_ai
3201 vec_doubleh(vector float __a) {
3202   vector double __ret = {__a[0], __a[1]};
3203   return __ret;
3204 }
3205
3206 static __inline__ vector double __ATTRS_o_ai
3207 vec_doublel(vector signed int __a) {
3208   vector double __ret = {__a[2], __a[3]};
3209   return __ret;
3210 }
3211
3212 static __inline__ vector double __ATTRS_o_ai
3213 vec_doublel(vector unsigned int __a) {
3214   vector double __ret = {__a[2], __a[3]};
3215   return __ret;
3216 }
3217
3218 static __inline__ vector double __ATTRS_o_ai
3219 vec_doublel(vector float __a) {
3220   vector double __ret = {__a[2], __a[3]};
3221   return __ret;
3222 }
3223
3224 static __inline__ vector double __ATTRS_o_ai
3225 vec_doubleo(vector signed int __a) {
3226 #ifdef __LITTLE_ENDIAN__
3227   return __builtin_vsx_xvcvsxwdp(__a);
3228 #else
3229   return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3230 #endif
3231 }
3232
3233 static __inline__ vector double __ATTRS_o_ai
3234 vec_doubleo(vector unsigned int __a) {
3235 #ifdef __LITTLE_ENDIAN__
3236   return __builtin_vsx_xvcvuxwdp(__a);
3237 #else
3238   return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3239 #endif
3240 }
3241
3242 static __inline__ vector double __ATTRS_o_ai
3243 vec_doubleo(vector float __a) {
3244 #ifdef __LITTLE_ENDIAN__
3245   return __builtin_vsx_xvcvspdp(__a);
3246 #else
3247   return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3248 #endif
3249 }
3250 #endif
3251
3252 /* vec_div */
3253
3254 /* Integer vector divides (vectors are scalarized, elements divided
3255    and the vectors reassembled).
3256 */
3257 static __inline__ vector signed char __ATTRS_o_ai
3258 vec_div(vector signed char __a, vector signed char __b) {
3259   return __a / __b;
3260 }
3261
3262 static __inline__ vector unsigned char __ATTRS_o_ai
3263 vec_div(vector unsigned char __a, vector unsigned char __b) {
3264   return __a / __b;
3265 }
3266
3267 static __inline__ vector signed short __ATTRS_o_ai
3268 vec_div(vector signed short __a, vector signed short __b) {
3269   return __a / __b;
3270 }
3271
3272 static __inline__ vector unsigned short __ATTRS_o_ai
3273 vec_div(vector unsigned short __a, vector unsigned short __b) {
3274   return __a / __b;
3275 }
3276
3277 static __inline__ vector signed int __ATTRS_o_ai
3278 vec_div(vector signed int __a, vector signed int __b) {
3279   return __a / __b;
3280 }
3281
3282 static __inline__ vector unsigned int __ATTRS_o_ai
3283 vec_div(vector unsigned int __a, vector unsigned int __b) {
3284   return __a / __b;
3285 }
3286
3287 #ifdef __VSX__
3288 static __inline__ vector signed long long __ATTRS_o_ai
3289 vec_div(vector signed long long __a, vector signed long long __b) {
3290   return __a / __b;
3291 }
3292
3293 static __inline__ vector unsigned long long __ATTRS_o_ai
3294 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3295   return __a / __b;
3296 }
3297
3298 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3299                                                     vector float __b) {
3300   return __a / __b;
3301 }
3302
3303 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3304                                                      vector double __b) {
3305   return __a / __b;
3306 }
3307 #endif
3308
3309 /* vec_dss */
3310
3311 static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
3312   __builtin_altivec_dss(__a);
3313 }
3314
3315 /* vec_dssall */
3316
3317 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3318   __builtin_altivec_dssall();
3319 }
3320
3321 /* vec_dst */
3322 #define vec_dst(__PTR, __CW, __STR) \
3323   __extension__(                    \
3324       { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
3325
3326 /* vec_dstst */
3327 #define vec_dstst(__PTR, __CW, __STR) \
3328   __extension__(                      \
3329       { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
3330
3331 /* vec_dststt */
3332 #define vec_dststt(__PTR, __CW, __STR) \
3333   __extension__(                       \
3334       { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
3335
3336 /* vec_dstt */
3337 #define vec_dstt(__PTR, __CW, __STR) \
3338   __extension__(                     \
3339       { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
3340
3341 /* vec_eqv */
3342
3343 #ifdef __POWER8_VECTOR__
3344 static __inline__ vector signed char __ATTRS_o_ai
3345 vec_eqv(vector signed char __a, vector signed char __b) {
3346   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3347                                                   (vector unsigned int)__b);
3348 }
3349
3350 static __inline__ vector unsigned char __ATTRS_o_ai
3351 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3352   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3353                                                     (vector unsigned int)__b);
3354 }
3355
3356 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3357                                                         vector bool char __b) {
3358   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3359                                                 (vector unsigned int)__b);
3360 }
3361
3362 static __inline__ vector signed short __ATTRS_o_ai
3363 vec_eqv(vector signed short __a, vector signed short __b) {
3364   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3365                                                    (vector unsigned int)__b);
3366 }
3367
3368 static __inline__ vector unsigned short __ATTRS_o_ai
3369 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3370   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3371                                                      (vector unsigned int)__b);
3372 }
3373
3374 static __inline__ vector bool short __ATTRS_o_ai
3375 vec_eqv(vector bool short __a, vector bool short __b) {
3376   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3377                                                  (vector unsigned int)__b);
3378 }
3379
3380 static __inline__ vector signed int __ATTRS_o_ai
3381 vec_eqv(vector signed int __a, vector signed int __b) {
3382   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3383                                                  (vector unsigned int)__b);
3384 }
3385
3386 static __inline__ vector unsigned int __ATTRS_o_ai
3387 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3388   return __builtin_vsx_xxleqv(__a, __b);
3389 }
3390
3391 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3392                                                        vector bool int __b) {
3393   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3394                                                (vector unsigned int)__b);
3395 }
3396
3397 static __inline__ vector signed long long __ATTRS_o_ai
3398 vec_eqv(vector signed long long __a, vector signed long long __b) {
3399   return (vector signed long long)__builtin_vsx_xxleqv(
3400       (vector unsigned int)__a, (vector unsigned int)__b);
3401 }
3402
3403 static __inline__ vector unsigned long long __ATTRS_o_ai
3404 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3405   return (vector unsigned long long)__builtin_vsx_xxleqv(
3406       (vector unsigned int)__a, (vector unsigned int)__b);
3407 }
3408
3409 static __inline__ vector bool long long __ATTRS_o_ai
3410 vec_eqv(vector bool long long __a, vector bool long long __b) {
3411   return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3412                                                      (vector unsigned int)__b);
3413 }
3414
3415 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3416                                                     vector float __b) {
3417   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
3418                                             (vector unsigned int)__b);
3419 }
3420
3421 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
3422                                                      vector double __b) {
3423   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
3424                                              (vector unsigned int)__b);
3425 }
3426 #endif
3427
3428 /* vec_expte */
3429
3430 static __inline__ vector float __attribute__((__always_inline__))
3431 vec_expte(vector float __a) {
3432   return __builtin_altivec_vexptefp(__a);
3433 }
3434
3435 /* vec_vexptefp */
3436
3437 static __inline__ vector float __attribute__((__always_inline__))
3438 vec_vexptefp(vector float __a) {
3439   return __builtin_altivec_vexptefp(__a);
3440 }
3441
3442 /* vec_floor */
3443
3444 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
3445 #ifdef __VSX__
3446   return __builtin_vsx_xvrspim(__a);
3447 #else
3448   return __builtin_altivec_vrfim(__a);
3449 #endif
3450 }
3451
3452 #ifdef __VSX__
3453 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
3454   return __builtin_vsx_xvrdpim(__a);
3455 }
3456 #endif
3457
3458 /* vec_vrfim */
3459
3460 static __inline__ vector float __attribute__((__always_inline__))
3461 vec_vrfim(vector float __a) {
3462   return __builtin_altivec_vrfim(__a);
3463 }
3464
3465 /* vec_ld */
3466
3467 static __inline__ vector signed char __ATTRS_o_ai
3468 vec_ld(int __a, const vector signed char *__b) {
3469   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3470 }
3471
3472 static __inline__ vector signed char __ATTRS_o_ai
3473 vec_ld(int __a, const signed char *__b) {
3474   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3475 }
3476
3477 static __inline__ vector unsigned char __ATTRS_o_ai
3478 vec_ld(int __a, const vector unsigned char *__b) {
3479   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3480 }
3481
3482 static __inline__ vector unsigned char __ATTRS_o_ai
3483 vec_ld(int __a, const unsigned char *__b) {
3484   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3485 }
3486
3487 static __inline__ vector bool char __ATTRS_o_ai
3488 vec_ld(int __a, const vector bool char *__b) {
3489   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3490 }
3491
3492 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
3493                                                    const vector short *__b) {
3494   return (vector short)__builtin_altivec_lvx(__a, __b);
3495 }
3496
3497 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
3498   return (vector short)__builtin_altivec_lvx(__a, __b);
3499 }
3500
3501 static __inline__ vector unsigned short __ATTRS_o_ai
3502 vec_ld(int __a, const vector unsigned short *__b) {
3503   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3504 }
3505
3506 static __inline__ vector unsigned short __ATTRS_o_ai
3507 vec_ld(int __a, const unsigned short *__b) {
3508   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3509 }
3510
3511 static __inline__ vector bool short __ATTRS_o_ai
3512 vec_ld(int __a, const vector bool short *__b) {
3513   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3514 }
3515
3516 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
3517                                                    const vector pixel *__b) {
3518   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3519 }
3520
3521 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
3522                                                  const vector int *__b) {
3523   return (vector int)__builtin_altivec_lvx(__a, __b);
3524 }
3525
3526 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
3527   return (vector int)__builtin_altivec_lvx(__a, __b);
3528 }
3529
3530 static __inline__ vector unsigned int __ATTRS_o_ai
3531 vec_ld(int __a, const vector unsigned int *__b) {
3532   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3533 }
3534
3535 static __inline__ vector unsigned int __ATTRS_o_ai
3536 vec_ld(int __a, const unsigned int *__b) {
3537   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3538 }
3539
3540 static __inline__ vector bool int __ATTRS_o_ai
3541 vec_ld(int __a, const vector bool int *__b) {
3542   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3543 }
3544
3545 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
3546                                                    const vector float *__b) {
3547   return (vector float)__builtin_altivec_lvx(__a, __b);
3548 }
3549
3550 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
3551   return (vector float)__builtin_altivec_lvx(__a, __b);
3552 }
3553
3554 /* vec_lvx */
3555
3556 static __inline__ vector signed char __ATTRS_o_ai
3557 vec_lvx(int __a, const vector signed char *__b) {
3558   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3559 }
3560
3561 static __inline__ vector signed char __ATTRS_o_ai
3562 vec_lvx(int __a, const signed char *__b) {
3563   return (vector signed char)__builtin_altivec_lvx(__a, __b);
3564 }
3565
3566 static __inline__ vector unsigned char __ATTRS_o_ai
3567 vec_lvx(int __a, const vector unsigned char *__b) {
3568   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3569 }
3570
3571 static __inline__ vector unsigned char __ATTRS_o_ai
3572 vec_lvx(int __a, const unsigned char *__b) {
3573   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
3574 }
3575
3576 static __inline__ vector bool char __ATTRS_o_ai
3577 vec_lvx(int __a, const vector bool char *__b) {
3578   return (vector bool char)__builtin_altivec_lvx(__a, __b);
3579 }
3580
3581 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
3582                                                     const vector short *__b) {
3583   return (vector short)__builtin_altivec_lvx(__a, __b);
3584 }
3585
3586 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
3587   return (vector short)__builtin_altivec_lvx(__a, __b);
3588 }
3589
3590 static __inline__ vector unsigned short __ATTRS_o_ai
3591 vec_lvx(int __a, const vector unsigned short *__b) {
3592   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3593 }
3594
3595 static __inline__ vector unsigned short __ATTRS_o_ai
3596 vec_lvx(int __a, const unsigned short *__b) {
3597   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
3598 }
3599
3600 static __inline__ vector bool short __ATTRS_o_ai
3601 vec_lvx(int __a, const vector bool short *__b) {
3602   return (vector bool short)__builtin_altivec_lvx(__a, __b);
3603 }
3604
3605 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
3606                                                     const vector pixel *__b) {
3607   return (vector pixel)__builtin_altivec_lvx(__a, __b);
3608 }
3609
3610 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
3611                                                   const vector int *__b) {
3612   return (vector int)__builtin_altivec_lvx(__a, __b);
3613 }
3614
3615 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
3616   return (vector int)__builtin_altivec_lvx(__a, __b);
3617 }
3618
3619 static __inline__ vector unsigned int __ATTRS_o_ai
3620 vec_lvx(int __a, const vector unsigned int *__b) {
3621   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3622 }
3623
3624 static __inline__ vector unsigned int __ATTRS_o_ai
3625 vec_lvx(int __a, const unsigned int *__b) {
3626   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
3627 }
3628
3629 static __inline__ vector bool int __ATTRS_o_ai
3630 vec_lvx(int __a, const vector bool int *__b) {
3631   return (vector bool int)__builtin_altivec_lvx(__a, __b);
3632 }
3633
3634 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
3635                                                     const vector float *__b) {
3636   return (vector float)__builtin_altivec_lvx(__a, __b);
3637 }
3638
3639 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
3640   return (vector float)__builtin_altivec_lvx(__a, __b);
3641 }
3642
3643 /* vec_lde */
3644
3645 static __inline__ vector signed char __ATTRS_o_ai
3646 vec_lde(int __a, const signed char *__b) {
3647   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3648 }
3649
3650 static __inline__ vector unsigned char __ATTRS_o_ai
3651 vec_lde(int __a, const unsigned char *__b) {
3652   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3653 }
3654
3655 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
3656   return (vector short)__builtin_altivec_lvehx(__a, __b);
3657 }
3658
3659 static __inline__ vector unsigned short __ATTRS_o_ai
3660 vec_lde(int __a, const unsigned short *__b) {
3661   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3662 }
3663
3664 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
3665   return (vector int)__builtin_altivec_lvewx(__a, __b);
3666 }
3667
3668 static __inline__ vector unsigned int __ATTRS_o_ai
3669 vec_lde(int __a, const unsigned int *__b) {
3670   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3671 }
3672
3673 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
3674   return (vector float)__builtin_altivec_lvewx(__a, __b);
3675 }
3676
3677 /* vec_lvebx */
3678
3679 static __inline__ vector signed char __ATTRS_o_ai
3680 vec_lvebx(int __a, const signed char *__b) {
3681   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
3682 }
3683
3684 static __inline__ vector unsigned char __ATTRS_o_ai
3685 vec_lvebx(int __a, const unsigned char *__b) {
3686   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
3687 }
3688
3689 /* vec_lvehx */
3690
3691 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
3692                                                       const short *__b) {
3693   return (vector short)__builtin_altivec_lvehx(__a, __b);
3694 }
3695
3696 static __inline__ vector unsigned short __ATTRS_o_ai
3697 vec_lvehx(int __a, const unsigned short *__b) {
3698   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
3699 }
3700
3701 /* vec_lvewx */
3702
3703 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
3704   return (vector int)__builtin_altivec_lvewx(__a, __b);
3705 }
3706
3707 static __inline__ vector unsigned int __ATTRS_o_ai
3708 vec_lvewx(int __a, const unsigned int *__b) {
3709   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
3710 }
3711
3712 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
3713                                                       const float *__b) {
3714   return (vector float)__builtin_altivec_lvewx(__a, __b);
3715 }
3716
3717 /* vec_ldl */
3718
3719 static __inline__ vector signed char __ATTRS_o_ai
3720 vec_ldl(int __a, const vector signed char *__b) {
3721   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3722 }
3723
3724 static __inline__ vector signed char __ATTRS_o_ai
3725 vec_ldl(int __a, const signed char *__b) {
3726   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3727 }
3728
3729 static __inline__ vector unsigned char __ATTRS_o_ai
3730 vec_ldl(int __a, const vector unsigned char *__b) {
3731   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3732 }
3733
3734 static __inline__ vector unsigned char __ATTRS_o_ai
3735 vec_ldl(int __a, const unsigned char *__b) {
3736   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3737 }
3738
3739 static __inline__ vector bool char __ATTRS_o_ai
3740 vec_ldl(int __a, const vector bool char *__b) {
3741   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3742 }
3743
3744 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
3745                                                     const vector short *__b) {
3746   return (vector short)__builtin_altivec_lvxl(__a, __b);
3747 }
3748
3749 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
3750   return (vector short)__builtin_altivec_lvxl(__a, __b);
3751 }
3752
3753 static __inline__ vector unsigned short __ATTRS_o_ai
3754 vec_ldl(int __a, const vector unsigned short *__b) {
3755   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3756 }
3757
3758 static __inline__ vector unsigned short __ATTRS_o_ai
3759 vec_ldl(int __a, const unsigned short *__b) {
3760   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3761 }
3762
3763 static __inline__ vector bool short __ATTRS_o_ai
3764 vec_ldl(int __a, const vector bool short *__b) {
3765   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3766 }
3767
3768 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
3769                                                     const vector pixel *__b) {
3770   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
3771 }
3772
3773 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
3774                                                   const vector int *__b) {
3775   return (vector int)__builtin_altivec_lvxl(__a, __b);
3776 }
3777
3778 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
3779   return (vector int)__builtin_altivec_lvxl(__a, __b);
3780 }
3781
3782 static __inline__ vector unsigned int __ATTRS_o_ai
3783 vec_ldl(int __a, const vector unsigned int *__b) {
3784   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3785 }
3786
3787 static __inline__ vector unsigned int __ATTRS_o_ai
3788 vec_ldl(int __a, const unsigned int *__b) {
3789   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3790 }
3791
3792 static __inline__ vector bool int __ATTRS_o_ai
3793 vec_ldl(int __a, const vector bool int *__b) {
3794   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3795 }
3796
3797 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
3798                                                     const vector float *__b) {
3799   return (vector float)__builtin_altivec_lvxl(__a, __b);
3800 }
3801
3802 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
3803   return (vector float)__builtin_altivec_lvxl(__a, __b);
3804 }
3805
3806 /* vec_lvxl */
3807
3808 static __inline__ vector signed char __ATTRS_o_ai
3809 vec_lvxl(int __a, const vector signed char *__b) {
3810   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3811 }
3812
3813 static __inline__ vector signed char __ATTRS_o_ai
3814 vec_lvxl(int __a, const signed char *__b) {
3815   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
3816 }
3817
3818 static __inline__ vector unsigned char __ATTRS_o_ai
3819 vec_lvxl(int __a, const vector unsigned char *__b) {
3820   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3821 }
3822
3823 static __inline__ vector unsigned char __ATTRS_o_ai
3824 vec_lvxl(int __a, const unsigned char *__b) {
3825   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
3826 }
3827
3828 static __inline__ vector bool char __ATTRS_o_ai
3829 vec_lvxl(int __a, const vector bool char *__b) {
3830   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
3831 }
3832
3833 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3834                                                      const vector short *__b) {
3835   return (vector short)__builtin_altivec_lvxl(__a, __b);
3836 }
3837
3838 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
3839                                                      const short *__b) {
3840   return (vector short)__builtin_altivec_lvxl(__a, __b);
3841 }
3842
3843 static __inline__ vector unsigned short __ATTRS_o_ai
3844 vec_lvxl(int __a, const vector unsigned short *__b) {
3845   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3846 }
3847
3848 static __inline__ vector unsigned short __ATTRS_o_ai
3849 vec_lvxl(int __a, const unsigned short *__b) {
3850   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
3851 }
3852
3853 static __inline__ vector bool short __ATTRS_o_ai
3854 vec_lvxl(int __a, const vector bool short *__b) {
3855   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
3856 }
3857
3858 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
3859                                                      const vector pixel *__b) {
3860   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
3861 }
3862
3863 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
3864                                                    const vector int *__b) {
3865   return (vector int)__builtin_altivec_lvxl(__a, __b);
3866 }
3867
3868 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
3869   return (vector int)__builtin_altivec_lvxl(__a, __b);
3870 }
3871
3872 static __inline__ vector unsigned int __ATTRS_o_ai
3873 vec_lvxl(int __a, const vector unsigned int *__b) {
3874   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3875 }
3876
3877 static __inline__ vector unsigned int __ATTRS_o_ai
3878 vec_lvxl(int __a, const unsigned int *__b) {
3879   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
3880 }
3881
3882 static __inline__ vector bool int __ATTRS_o_ai
3883 vec_lvxl(int __a, const vector bool int *__b) {
3884   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
3885 }
3886
3887 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3888                                                      const vector float *__b) {
3889   return (vector float)__builtin_altivec_lvxl(__a, __b);
3890 }
3891
3892 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
3893                                                      const float *__b) {
3894   return (vector float)__builtin_altivec_lvxl(__a, __b);
3895 }
3896
3897 /* vec_loge */
3898
3899 static __inline__ vector float __attribute__((__always_inline__))
3900 vec_loge(vector float __a) {
3901   return __builtin_altivec_vlogefp(__a);
3902 }
3903
3904 /* vec_vlogefp */
3905
3906 static __inline__ vector float __attribute__((__always_inline__))
3907 vec_vlogefp(vector float __a) {
3908   return __builtin_altivec_vlogefp(__a);
3909 }
3910
3911 /* vec_lvsl */
3912
3913 #ifdef __LITTLE_ENDIAN__
3914 static __inline__ vector unsigned char __ATTRS_o_ai
3915     __attribute__((__deprecated__("use assignment for unaligned little endian \
3916 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
3917   vector unsigned char mask =
3918       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3919   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3920                                   7,  6,  5,  4,  3,  2,  1, 0};
3921   return vec_perm(mask, mask, reverse);
3922 }
3923 #else
3924 static __inline__ vector unsigned char __ATTRS_o_ai
3925 vec_lvsl(int __a, const signed char *__b) {
3926   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3927 }
3928 #endif
3929
3930 #ifdef __LITTLE_ENDIAN__
3931 static __inline__ vector unsigned char __ATTRS_o_ai
3932     __attribute__((__deprecated__("use assignment for unaligned little endian \
3933 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
3934   vector unsigned char mask =
3935       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3936   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3937                                   7,  6,  5,  4,  3,  2,  1, 0};
3938   return vec_perm(mask, mask, reverse);
3939 }
3940 #else
3941 static __inline__ vector unsigned char __ATTRS_o_ai
3942 vec_lvsl(int __a, const unsigned char *__b) {
3943   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3944 }
3945 #endif
3946
3947 #ifdef __LITTLE_ENDIAN__
3948 static __inline__ vector unsigned char __ATTRS_o_ai
3949     __attribute__((__deprecated__("use assignment for unaligned little endian \
3950 loads/stores"))) vec_lvsl(int __a, const short *__b) {
3951   vector unsigned char mask =
3952       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3953   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3954                                   7,  6,  5,  4,  3,  2,  1, 0};
3955   return vec_perm(mask, mask, reverse);
3956 }
3957 #else
3958 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3959                                                              const short *__b) {
3960   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3961 }
3962 #endif
3963
3964 #ifdef __LITTLE_ENDIAN__
3965 static __inline__ vector unsigned char __ATTRS_o_ai
3966     __attribute__((__deprecated__("use assignment for unaligned little endian \
3967 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
3968   vector unsigned char mask =
3969       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3970   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3971                                   7,  6,  5,  4,  3,  2,  1, 0};
3972   return vec_perm(mask, mask, reverse);
3973 }
3974 #else
3975 static __inline__ vector unsigned char __ATTRS_o_ai
3976 vec_lvsl(int __a, const unsigned short *__b) {
3977   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3978 }
3979 #endif
3980
3981 #ifdef __LITTLE_ENDIAN__
3982 static __inline__ vector unsigned char __ATTRS_o_ai
3983     __attribute__((__deprecated__("use assignment for unaligned little endian \
3984 loads/stores"))) vec_lvsl(int __a, const int *__b) {
3985   vector unsigned char mask =
3986       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3987   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
3988                                   7,  6,  5,  4,  3,  2,  1, 0};
3989   return vec_perm(mask, mask, reverse);
3990 }
3991 #else
3992 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
3993                                                              const int *__b) {
3994   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
3995 }
3996 #endif
3997
3998 #ifdef __LITTLE_ENDIAN__
3999 static __inline__ vector unsigned char __ATTRS_o_ai
4000     __attribute__((__deprecated__("use assignment for unaligned little endian \
4001 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
4002   vector unsigned char mask =
4003       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4004   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4005                                   7,  6,  5,  4,  3,  2,  1, 0};
4006   return vec_perm(mask, mask, reverse);
4007 }
4008 #else
4009 static __inline__ vector unsigned char __ATTRS_o_ai
4010 vec_lvsl(int __a, const unsigned int *__b) {
4011   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4012 }
4013 #endif
4014
4015 #ifdef __LITTLE_ENDIAN__
4016 static __inline__ vector unsigned char __ATTRS_o_ai
4017     __attribute__((__deprecated__("use assignment for unaligned little endian \
4018 loads/stores"))) vec_lvsl(int __a, const float *__b) {
4019   vector unsigned char mask =
4020       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4021   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4022                                   7,  6,  5,  4,  3,  2,  1, 0};
4023   return vec_perm(mask, mask, reverse);
4024 }
4025 #else
4026 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4027                                                              const float *__b) {
4028   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4029 }
4030 #endif
4031
4032 /* vec_lvsr */
4033
4034 #ifdef __LITTLE_ENDIAN__
4035 static __inline__ vector unsigned char __ATTRS_o_ai
4036     __attribute__((__deprecated__("use assignment for unaligned little endian \
4037 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4038   vector unsigned char mask =
4039       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4040   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4041                                   7,  6,  5,  4,  3,  2,  1, 0};
4042   return vec_perm(mask, mask, reverse);
4043 }
4044 #else
4045 static __inline__ vector unsigned char __ATTRS_o_ai
4046 vec_lvsr(int __a, const signed char *__b) {
4047   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4048 }
4049 #endif
4050
4051 #ifdef __LITTLE_ENDIAN__
4052 static __inline__ vector unsigned char __ATTRS_o_ai
4053     __attribute__((__deprecated__("use assignment for unaligned little endian \
4054 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4055   vector unsigned char mask =
4056       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4057   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4058                                   7,  6,  5,  4,  3,  2,  1, 0};
4059   return vec_perm(mask, mask, reverse);
4060 }
4061 #else
4062 static __inline__ vector unsigned char __ATTRS_o_ai
4063 vec_lvsr(int __a, const unsigned char *__b) {
4064   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4065 }
4066 #endif
4067
4068 #ifdef __LITTLE_ENDIAN__
4069 static __inline__ vector unsigned char __ATTRS_o_ai
4070     __attribute__((__deprecated__("use assignment for unaligned little endian \
4071 loads/stores"))) vec_lvsr(int __a, const short *__b) {
4072   vector unsigned char mask =
4073       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4074   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4075                                   7,  6,  5,  4,  3,  2,  1, 0};
4076   return vec_perm(mask, mask, reverse);
4077 }
4078 #else
4079 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4080                                                              const short *__b) {
4081   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4082 }
4083 #endif
4084
4085 #ifdef __LITTLE_ENDIAN__
4086 static __inline__ vector unsigned char __ATTRS_o_ai
4087     __attribute__((__deprecated__("use assignment for unaligned little endian \
4088 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4089   vector unsigned char mask =
4090       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4091   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4092                                   7,  6,  5,  4,  3,  2,  1, 0};
4093   return vec_perm(mask, mask, reverse);
4094 }
4095 #else
4096 static __inline__ vector unsigned char __ATTRS_o_ai
4097 vec_lvsr(int __a, const unsigned short *__b) {
4098   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4099 }
4100 #endif
4101
4102 #ifdef __LITTLE_ENDIAN__
4103 static __inline__ vector unsigned char __ATTRS_o_ai
4104     __attribute__((__deprecated__("use assignment for unaligned little endian \
4105 loads/stores"))) vec_lvsr(int __a, const int *__b) {
4106   vector unsigned char mask =
4107       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4108   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4109                                   7,  6,  5,  4,  3,  2,  1, 0};
4110   return vec_perm(mask, mask, reverse);
4111 }
4112 #else
4113 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4114                                                              const int *__b) {
4115   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4116 }
4117 #endif
4118
4119 #ifdef __LITTLE_ENDIAN__
4120 static __inline__ vector unsigned char __ATTRS_o_ai
4121     __attribute__((__deprecated__("use assignment for unaligned little endian \
4122 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4123   vector unsigned char mask =
4124       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4125   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4126                                   7,  6,  5,  4,  3,  2,  1, 0};
4127   return vec_perm(mask, mask, reverse);
4128 }
4129 #else
4130 static __inline__ vector unsigned char __ATTRS_o_ai
4131 vec_lvsr(int __a, const unsigned int *__b) {
4132   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4133 }
4134 #endif
4135
4136 #ifdef __LITTLE_ENDIAN__
4137 static __inline__ vector unsigned char __ATTRS_o_ai
4138     __attribute__((__deprecated__("use assignment for unaligned little endian \
4139 loads/stores"))) vec_lvsr(int __a, const float *__b) {
4140   vector unsigned char mask =
4141       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4142   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4143                                   7,  6,  5,  4,  3,  2,  1, 0};
4144   return vec_perm(mask, mask, reverse);
4145 }
4146 #else
4147 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4148                                                              const float *__b) {
4149   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4150 }
4151 #endif
4152
4153 /* vec_madd */
4154 static __inline__ vector signed short __ATTRS_o_ai
4155 vec_mladd(vector signed short, vector signed short, vector signed short);
4156 static __inline__ vector signed short __ATTRS_o_ai
4157 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4158 static __inline__ vector signed short __ATTRS_o_ai
4159 vec_mladd(vector unsigned short, vector signed short, vector signed short);
4160 static __inline__ vector unsigned short __ATTRS_o_ai
4161 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4162
4163 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4164     vector signed short __a, vector signed short __b, vector signed short __c) {
4165   return vec_mladd(__a, __b, __c);
4166 }
4167
4168 static __inline__ vector signed short __ATTRS_o_ai
4169 vec_madd(vector signed short __a, vector unsigned short __b,
4170          vector unsigned short __c) {
4171   return vec_mladd(__a, __b, __c);
4172 }
4173
4174 static __inline__ vector signed short __ATTRS_o_ai
4175 vec_madd(vector unsigned short __a, vector signed short __b,
4176          vector signed short __c) {
4177   return vec_mladd(__a, __b, __c);
4178 }
4179
4180 static __inline__ vector unsigned short __ATTRS_o_ai
4181 vec_madd(vector unsigned short __a, vector unsigned short __b,
4182          vector unsigned short __c) {
4183   return vec_mladd(__a, __b, __c);
4184 }
4185
4186 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4187                                                      vector float __b,
4188                                                      vector float __c) {
4189 #ifdef __VSX__
4190   return __builtin_vsx_xvmaddasp(__a, __b, __c);
4191 #else
4192   return __builtin_altivec_vmaddfp(__a, __b, __c);
4193 #endif
4194 }
4195
4196 #ifdef __VSX__
4197 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4198                                                       vector double __b,
4199                                                       vector double __c) {
4200   return __builtin_vsx_xvmaddadp(__a, __b, __c);
4201 }
4202 #endif
4203
4204 /* vec_vmaddfp */
4205
4206 static __inline__ vector float __attribute__((__always_inline__))
4207 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4208   return __builtin_altivec_vmaddfp(__a, __b, __c);
4209 }
4210
4211 /* vec_madds */
4212
4213 static __inline__ vector signed short __attribute__((__always_inline__))
4214 vec_madds(vector signed short __a, vector signed short __b,
4215           vector signed short __c) {
4216   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4217 }
4218
4219 /* vec_vmhaddshs */
4220 static __inline__ vector signed short __attribute__((__always_inline__))
4221 vec_vmhaddshs(vector signed short __a, vector signed short __b,
4222               vector signed short __c) {
4223   return __builtin_altivec_vmhaddshs(__a, __b, __c);
4224 }
4225
4226 /* vec_msub */
4227
4228 #ifdef __VSX__
4229 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4230                                                      vector float __b,
4231                                                      vector float __c) {
4232   return __builtin_vsx_xvmsubasp(__a, __b, __c);
4233 }
4234
4235 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4236                                                       vector double __b,
4237                                                       vector double __c) {
4238   return __builtin_vsx_xvmsubadp(__a, __b, __c);
4239 }
4240 #endif
4241
4242 /* vec_max */
4243
4244 static __inline__ vector signed char __ATTRS_o_ai
4245 vec_max(vector signed char __a, vector signed char __b) {
4246   return __builtin_altivec_vmaxsb(__a, __b);
4247 }
4248
4249 static __inline__ vector signed char __ATTRS_o_ai
4250 vec_max(vector bool char __a, vector signed char __b) {
4251   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4252 }
4253
4254 static __inline__ vector signed char __ATTRS_o_ai
4255 vec_max(vector signed char __a, vector bool char __b) {
4256   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4257 }
4258
4259 static __inline__ vector unsigned char __ATTRS_o_ai
4260 vec_max(vector unsigned char __a, vector unsigned char __b) {
4261   return __builtin_altivec_vmaxub(__a, __b);
4262 }
4263
4264 static __inline__ vector unsigned char __ATTRS_o_ai
4265 vec_max(vector bool char __a, vector unsigned char __b) {
4266   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4267 }
4268
4269 static __inline__ vector unsigned char __ATTRS_o_ai
4270 vec_max(vector unsigned char __a, vector bool char __b) {
4271   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4272 }
4273
4274 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4275                                                     vector short __b) {
4276   return __builtin_altivec_vmaxsh(__a, __b);
4277 }
4278
4279 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4280                                                     vector short __b) {
4281   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4282 }
4283
4284 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4285                                                     vector bool short __b) {
4286   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4287 }
4288
4289 static __inline__ vector unsigned short __ATTRS_o_ai
4290 vec_max(vector unsigned short __a, vector unsigned short __b) {
4291   return __builtin_altivec_vmaxuh(__a, __b);
4292 }
4293
4294 static __inline__ vector unsigned short __ATTRS_o_ai
4295 vec_max(vector bool short __a, vector unsigned short __b) {
4296   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4297 }
4298
4299 static __inline__ vector unsigned short __ATTRS_o_ai
4300 vec_max(vector unsigned short __a, vector bool short __b) {
4301   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4302 }
4303
4304 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4305                                                   vector int __b) {
4306   return __builtin_altivec_vmaxsw(__a, __b);
4307 }
4308
4309 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4310                                                   vector int __b) {
4311   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4312 }
4313
4314 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4315                                                   vector bool int __b) {
4316   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4317 }
4318
4319 static __inline__ vector unsigned int __ATTRS_o_ai
4320 vec_max(vector unsigned int __a, vector unsigned int __b) {
4321   return __builtin_altivec_vmaxuw(__a, __b);
4322 }
4323
4324 static __inline__ vector unsigned int __ATTRS_o_ai
4325 vec_max(vector bool int __a, vector unsigned int __b) {
4326   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4327 }
4328
4329 static __inline__ vector unsigned int __ATTRS_o_ai
4330 vec_max(vector unsigned int __a, vector bool int __b) {
4331   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4332 }
4333
4334 #ifdef __POWER8_VECTOR__
4335 static __inline__ vector signed long long __ATTRS_o_ai
4336 vec_max(vector signed long long __a, vector signed long long __b) {
4337   return __builtin_altivec_vmaxsd(__a, __b);
4338 }
4339
4340 static __inline__ vector signed long long __ATTRS_o_ai
4341 vec_max(vector bool long long __a, vector signed long long __b) {
4342   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4343 }
4344
4345 static __inline__ vector signed long long __ATTRS_o_ai
4346 vec_max(vector signed long long __a, vector bool long long __b) {
4347   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4348 }
4349
4350 static __inline__ vector unsigned long long __ATTRS_o_ai
4351 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4352   return __builtin_altivec_vmaxud(__a, __b);
4353 }
4354
4355 static __inline__ vector unsigned long long __ATTRS_o_ai
4356 vec_max(vector bool long long __a, vector unsigned long long __b) {
4357   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4358 }
4359
4360 static __inline__ vector unsigned long long __ATTRS_o_ai
4361 vec_max(vector unsigned long long __a, vector bool long long __b) {
4362   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4363 }
4364 #endif
4365
4366 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4367                                                     vector float __b) {
4368 #ifdef __VSX__
4369   return __builtin_vsx_xvmaxsp(__a, __b);
4370 #else
4371   return __builtin_altivec_vmaxfp(__a, __b);
4372 #endif
4373 }
4374
4375 #ifdef __VSX__
4376 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4377                                                      vector double __b) {
4378   return __builtin_vsx_xvmaxdp(__a, __b);
4379 }
4380 #endif
4381
4382 /* vec_vmaxsb */
4383
4384 static __inline__ vector signed char __ATTRS_o_ai
4385 vec_vmaxsb(vector signed char __a, vector signed char __b) {
4386   return __builtin_altivec_vmaxsb(__a, __b);
4387 }
4388
4389 static __inline__ vector signed char __ATTRS_o_ai
4390 vec_vmaxsb(vector bool char __a, vector signed char __b) {
4391   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4392 }
4393
4394 static __inline__ vector signed char __ATTRS_o_ai
4395 vec_vmaxsb(vector signed char __a, vector bool char __b) {
4396   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4397 }
4398
4399 /* vec_vmaxub */
4400
4401 static __inline__ vector unsigned char __ATTRS_o_ai
4402 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4403   return __builtin_altivec_vmaxub(__a, __b);
4404 }
4405
4406 static __inline__ vector unsigned char __ATTRS_o_ai
4407 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
4408   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4409 }
4410
4411 static __inline__ vector unsigned char __ATTRS_o_ai
4412 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
4413   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4414 }
4415
4416 /* vec_vmaxsh */
4417
4418 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4419                                                        vector short __b) {
4420   return __builtin_altivec_vmaxsh(__a, __b);
4421 }
4422
4423 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
4424                                                        vector short __b) {
4425   return __builtin_altivec_vmaxsh((vector short)__a, __b);
4426 }
4427
4428 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
4429                                                        vector bool short __b) {
4430   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4431 }
4432
4433 /* vec_vmaxuh */
4434
4435 static __inline__ vector unsigned short __ATTRS_o_ai
4436 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
4437   return __builtin_altivec_vmaxuh(__a, __b);
4438 }
4439
4440 static __inline__ vector unsigned short __ATTRS_o_ai
4441 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
4442   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4443 }
4444
4445 static __inline__ vector unsigned short __ATTRS_o_ai
4446 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
4447   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4448 }
4449
4450 /* vec_vmaxsw */
4451
4452 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4453                                                      vector int __b) {
4454   return __builtin_altivec_vmaxsw(__a, __b);
4455 }
4456
4457 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
4458                                                      vector int __b) {
4459   return __builtin_altivec_vmaxsw((vector int)__a, __b);
4460 }
4461
4462 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
4463                                                      vector bool int __b) {
4464   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4465 }
4466
4467 /* vec_vmaxuw */
4468
4469 static __inline__ vector unsigned int __ATTRS_o_ai
4470 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
4471   return __builtin_altivec_vmaxuw(__a, __b);
4472 }
4473
4474 static __inline__ vector unsigned int __ATTRS_o_ai
4475 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
4476   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4477 }
4478
4479 static __inline__ vector unsigned int __ATTRS_o_ai
4480 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
4481   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4482 }
4483
4484 /* vec_vmaxfp */
4485
4486 static __inline__ vector float __attribute__((__always_inline__))
4487 vec_vmaxfp(vector float __a, vector float __b) {
4488 #ifdef __VSX__
4489   return __builtin_vsx_xvmaxsp(__a, __b);
4490 #else
4491   return __builtin_altivec_vmaxfp(__a, __b);
4492 #endif
4493 }
4494
4495 /* vec_mergeh */
4496
4497 static __inline__ vector signed char __ATTRS_o_ai
4498 vec_mergeh(vector signed char __a, vector signed char __b) {
4499   return vec_perm(__a, __b,
4500                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4501                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4502                                          0x06, 0x16, 0x07, 0x17));
4503 }
4504
4505 static __inline__ vector unsigned char __ATTRS_o_ai
4506 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
4507   return vec_perm(__a, __b,
4508                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4509                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4510                                          0x06, 0x16, 0x07, 0x17));
4511 }
4512
4513 static __inline__ vector bool char __ATTRS_o_ai
4514 vec_mergeh(vector bool char __a, vector bool char __b) {
4515   return vec_perm(__a, __b,
4516                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4517                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4518                                          0x06, 0x16, 0x07, 0x17));
4519 }
4520
4521 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
4522                                                        vector short __b) {
4523   return vec_perm(__a, __b,
4524                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4525                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4526                                          0x06, 0x07, 0x16, 0x17));
4527 }
4528
4529 static __inline__ vector unsigned short __ATTRS_o_ai
4530 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
4531   return vec_perm(__a, __b,
4532                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4533                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4534                                          0x06, 0x07, 0x16, 0x17));
4535 }
4536
4537 static __inline__ vector bool short __ATTRS_o_ai
4538 vec_mergeh(vector bool short __a, vector bool short __b) {
4539   return vec_perm(__a, __b,
4540                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4541                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4542                                          0x06, 0x07, 0x16, 0x17));
4543 }
4544
4545 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
4546                                                        vector pixel __b) {
4547   return vec_perm(__a, __b,
4548                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4549                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4550                                          0x06, 0x07, 0x16, 0x17));
4551 }
4552
4553 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
4554                                                      vector int __b) {
4555   return vec_perm(__a, __b,
4556                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4557                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4558                                          0x14, 0x15, 0x16, 0x17));
4559 }
4560
4561 static __inline__ vector unsigned int __ATTRS_o_ai
4562 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
4563   return vec_perm(__a, __b,
4564                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4565                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4566                                          0x14, 0x15, 0x16, 0x17));
4567 }
4568
4569 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
4570                                                           vector bool int __b) {
4571   return vec_perm(__a, __b,
4572                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4573                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4574                                          0x14, 0x15, 0x16, 0x17));
4575 }
4576
4577 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
4578                                                        vector float __b) {
4579   return vec_perm(__a, __b,
4580                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4581                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4582                                          0x14, 0x15, 0x16, 0x17));
4583 }
4584
4585 #ifdef __VSX__
4586 static __inline__ vector signed long long __ATTRS_o_ai
4587 vec_mergeh(vector signed long long __a, vector signed long long __b) {
4588   return vec_perm(__a, __b,
4589                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4590                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4591                                          0x14, 0x15, 0x16, 0x17));
4592 }
4593
4594 static __inline__ vector signed long long __ATTRS_o_ai
4595 vec_mergeh(vector signed long long __a, vector bool long long __b) {
4596   return vec_perm(__a, (vector signed long long)__b,
4597                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4598                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4599                                          0x14, 0x15, 0x16, 0x17));
4600 }
4601
4602 static __inline__ vector signed long long __ATTRS_o_ai
4603 vec_mergeh(vector bool long long __a, vector signed long long __b) {
4604   return vec_perm((vector signed long long)__a, __b,
4605                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4606                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4607                                          0x14, 0x15, 0x16, 0x17));
4608 }
4609
4610 static __inline__ vector unsigned long long __ATTRS_o_ai
4611 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
4612   return vec_perm(__a, __b,
4613                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4614                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4615                                          0x14, 0x15, 0x16, 0x17));
4616 }
4617
4618 static __inline__ vector unsigned long long __ATTRS_o_ai
4619 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
4620   return vec_perm(__a, (vector unsigned long long)__b,
4621                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4622                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4623                                          0x14, 0x15, 0x16, 0x17));
4624 }
4625
4626 static __inline__ vector unsigned long long __ATTRS_o_ai
4627 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
4628   return vec_perm((vector unsigned long long)__a, __b,
4629                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4630                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4631                                          0x14, 0x15, 0x16, 0x17));
4632 }
4633
4634 static __inline__ vector bool long long __ATTRS_o_ai
4635 vec_mergeh(vector bool long long __a, vector bool long long __b) {
4636   return vec_perm(__a, __b,
4637                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4638                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4639                                          0x14, 0x15, 0x16, 0x17));
4640 }
4641
4642 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
4643                                                         vector double __b) {
4644   return vec_perm(__a, __b,
4645                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4646                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4647                                          0x14, 0x15, 0x16, 0x17));
4648 }
4649 static __inline__ vector double __ATTRS_o_ai
4650 vec_mergeh(vector double __a, vector bool long long __b) {
4651   return vec_perm(__a, (vector double)__b,
4652                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4653                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4654                                          0x14, 0x15, 0x16, 0x17));
4655 }
4656 static __inline__ vector double __ATTRS_o_ai
4657 vec_mergeh(vector bool long long __a, vector double __b) {
4658   return vec_perm((vector double)__a, __b,
4659                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
4660                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
4661                                          0x14, 0x15, 0x16, 0x17));
4662 }
4663 #endif
4664
4665 /* vec_vmrghb */
4666
4667 #define __builtin_altivec_vmrghb vec_vmrghb
4668
4669 static __inline__ vector signed char __ATTRS_o_ai
4670 vec_vmrghb(vector signed char __a, vector signed char __b) {
4671   return vec_perm(__a, __b,
4672                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4673                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4674                                          0x06, 0x16, 0x07, 0x17));
4675 }
4676
4677 static __inline__ vector unsigned char __ATTRS_o_ai
4678 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
4679   return vec_perm(__a, __b,
4680                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4681                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4682                                          0x06, 0x16, 0x07, 0x17));
4683 }
4684
4685 static __inline__ vector bool char __ATTRS_o_ai
4686 vec_vmrghb(vector bool char __a, vector bool char __b) {
4687   return vec_perm(__a, __b,
4688                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
4689                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
4690                                          0x06, 0x16, 0x07, 0x17));
4691 }
4692
4693 /* vec_vmrghh */
4694
4695 #define __builtin_altivec_vmrghh vec_vmrghh
4696
4697 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
4698                                                        vector short __b) {
4699   return vec_perm(__a, __b,
4700                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4701                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4702                                          0x06, 0x07, 0x16, 0x17));
4703 }
4704
4705 static __inline__ vector unsigned short __ATTRS_o_ai
4706 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
4707   return vec_perm(__a, __b,
4708                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4709                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4710                                          0x06, 0x07, 0x16, 0x17));
4711 }
4712
4713 static __inline__ vector bool short __ATTRS_o_ai
4714 vec_vmrghh(vector bool short __a, vector bool short __b) {
4715   return vec_perm(__a, __b,
4716                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4717                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4718                                          0x06, 0x07, 0x16, 0x17));
4719 }
4720
4721 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
4722                                                        vector pixel __b) {
4723   return vec_perm(__a, __b,
4724                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
4725                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
4726                                          0x06, 0x07, 0x16, 0x17));
4727 }
4728
4729 /* vec_vmrghw */
4730
4731 #define __builtin_altivec_vmrghw vec_vmrghw
4732
4733 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
4734                                                      vector int __b) {
4735   return vec_perm(__a, __b,
4736                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4737                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4738                                          0x14, 0x15, 0x16, 0x17));
4739 }
4740
4741 static __inline__ vector unsigned int __ATTRS_o_ai
4742 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
4743   return vec_perm(__a, __b,
4744                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4745                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4746                                          0x14, 0x15, 0x16, 0x17));
4747 }
4748
4749 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
4750                                                           vector bool int __b) {
4751   return vec_perm(__a, __b,
4752                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4753                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4754                                          0x14, 0x15, 0x16, 0x17));
4755 }
4756
4757 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
4758                                                        vector float __b) {
4759   return vec_perm(__a, __b,
4760                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
4761                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
4762                                          0x14, 0x15, 0x16, 0x17));
4763 }
4764
4765 /* vec_mergel */
4766
4767 static __inline__ vector signed char __ATTRS_o_ai
4768 vec_mergel(vector signed char __a, vector signed char __b) {
4769   return vec_perm(__a, __b,
4770                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4771                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4772                                          0x0E, 0x1E, 0x0F, 0x1F));
4773 }
4774
4775 static __inline__ vector unsigned char __ATTRS_o_ai
4776 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
4777   return vec_perm(__a, __b,
4778                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4779                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4780                                          0x0E, 0x1E, 0x0F, 0x1F));
4781 }
4782
4783 static __inline__ vector bool char __ATTRS_o_ai
4784 vec_mergel(vector bool char __a, vector bool char __b) {
4785   return vec_perm(__a, __b,
4786                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4787                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4788                                          0x0E, 0x1E, 0x0F, 0x1F));
4789 }
4790
4791 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
4792                                                        vector short __b) {
4793   return vec_perm(__a, __b,
4794                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4795                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4796                                          0x0E, 0x0F, 0x1E, 0x1F));
4797 }
4798
4799 static __inline__ vector unsigned short __ATTRS_o_ai
4800 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
4801   return vec_perm(__a, __b,
4802                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4803                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4804                                          0x0E, 0x0F, 0x1E, 0x1F));
4805 }
4806
4807 static __inline__ vector bool short __ATTRS_o_ai
4808 vec_mergel(vector bool short __a, vector bool short __b) {
4809   return vec_perm(__a, __b,
4810                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4811                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4812                                          0x0E, 0x0F, 0x1E, 0x1F));
4813 }
4814
4815 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
4816                                                        vector pixel __b) {
4817   return vec_perm(__a, __b,
4818                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4819                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4820                                          0x0E, 0x0F, 0x1E, 0x1F));
4821 }
4822
4823 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
4824                                                      vector int __b) {
4825   return vec_perm(__a, __b,
4826                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4827                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4828                                          0x1C, 0x1D, 0x1E, 0x1F));
4829 }
4830
4831 static __inline__ vector unsigned int __ATTRS_o_ai
4832 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
4833   return vec_perm(__a, __b,
4834                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4835                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4836                                          0x1C, 0x1D, 0x1E, 0x1F));
4837 }
4838
4839 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
4840                                                           vector bool int __b) {
4841   return vec_perm(__a, __b,
4842                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4843                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4844                                          0x1C, 0x1D, 0x1E, 0x1F));
4845 }
4846
4847 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
4848                                                        vector float __b) {
4849   return vec_perm(__a, __b,
4850                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
4851                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
4852                                          0x1C, 0x1D, 0x1E, 0x1F));
4853 }
4854
4855 #ifdef __VSX__
4856 static __inline__ vector signed long long __ATTRS_o_ai
4857 vec_mergel(vector signed long long __a, vector signed long long __b) {
4858   return vec_perm(__a, __b,
4859                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4860                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4861                                          0x1C, 0x1D, 0x1E, 0x1F));
4862 }
4863 static __inline__ vector signed long long __ATTRS_o_ai
4864 vec_mergel(vector signed long long __a, vector bool long long __b) {
4865   return vec_perm(__a, (vector signed long long)__b,
4866                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4867                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4868                                          0x1C, 0x1D, 0x1E, 0x1F));
4869 }
4870 static __inline__ vector signed long long __ATTRS_o_ai
4871 vec_mergel(vector bool long long __a, vector signed long long __b) {
4872   return vec_perm((vector signed long long)__a, __b,
4873                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4874                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4875                                          0x1C, 0x1D, 0x1E, 0x1F));
4876 }
4877 static __inline__ vector unsigned long long __ATTRS_o_ai
4878 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
4879   return vec_perm(__a, __b,
4880                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4881                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4882                                          0x1C, 0x1D, 0x1E, 0x1F));
4883 }
4884 static __inline__ vector unsigned long long __ATTRS_o_ai
4885 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
4886   return vec_perm(__a, (vector unsigned long long)__b,
4887                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4888                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4889                                          0x1C, 0x1D, 0x1E, 0x1F));
4890 }
4891 static __inline__ vector unsigned long long __ATTRS_o_ai
4892 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
4893   return vec_perm((vector unsigned long long)__a, __b,
4894                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4895                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4896                                          0x1C, 0x1D, 0x1E, 0x1F));
4897 }
4898 static __inline__ vector bool long long __ATTRS_o_ai
4899 vec_mergel(vector bool long long __a, vector bool long long __b) {
4900   return vec_perm(__a, __b,
4901                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4902                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4903                                          0x1C, 0x1D, 0x1E, 0x1F));
4904 }
4905 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
4906                                                         vector double __b) {
4907   return vec_perm(__a, __b,
4908                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4909                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4910                                          0x1C, 0x1D, 0x1E, 0x1F));
4911 }
4912 static __inline__ vector double __ATTRS_o_ai
4913 vec_mergel(vector double __a, vector bool long long __b) {
4914   return vec_perm(__a, (vector double)__b,
4915                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4916                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4917                                          0x1C, 0x1D, 0x1E, 0x1F));
4918 }
4919 static __inline__ vector double __ATTRS_o_ai
4920 vec_mergel(vector bool long long __a, vector double __b) {
4921   return vec_perm((vector double)__a, __b,
4922                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
4923                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
4924                                          0x1C, 0x1D, 0x1E, 0x1F));
4925 }
4926 #endif
4927
4928 /* vec_vmrglb */
4929
4930 #define __builtin_altivec_vmrglb vec_vmrglb
4931
4932 static __inline__ vector signed char __ATTRS_o_ai
4933 vec_vmrglb(vector signed char __a, vector signed char __b) {
4934   return vec_perm(__a, __b,
4935                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4936                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4937                                          0x0E, 0x1E, 0x0F, 0x1F));
4938 }
4939
4940 static __inline__ vector unsigned char __ATTRS_o_ai
4941 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
4942   return vec_perm(__a, __b,
4943                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4944                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4945                                          0x0E, 0x1E, 0x0F, 0x1F));
4946 }
4947
4948 static __inline__ vector bool char __ATTRS_o_ai
4949 vec_vmrglb(vector bool char __a, vector bool char __b) {
4950   return vec_perm(__a, __b,
4951                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
4952                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
4953                                          0x0E, 0x1E, 0x0F, 0x1F));
4954 }
4955
4956 /* vec_vmrglh */
4957
4958 #define __builtin_altivec_vmrglh vec_vmrglh
4959
4960 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
4961                                                        vector short __b) {
4962   return vec_perm(__a, __b,
4963                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4964                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4965                                          0x0E, 0x0F, 0x1E, 0x1F));
4966 }
4967
4968 static __inline__ vector unsigned short __ATTRS_o_ai
4969 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
4970   return vec_perm(__a, __b,
4971                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4972                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4973                                          0x0E, 0x0F, 0x1E, 0x1F));
4974 }
4975
4976 static __inline__ vector bool short __ATTRS_o_ai
4977 vec_vmrglh(vector bool short __a, vector bool short __b) {
4978   return vec_perm(__a, __b,
4979                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4980                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4981                                          0x0E, 0x0F, 0x1E, 0x1F));
4982 }
4983
4984 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
4985                                                        vector pixel __b) {
4986   return vec_perm(__a, __b,
4987                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
4988                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
4989                                          0x0E, 0x0F, 0x1E, 0x1F));
4990 }
4991
4992 /* vec_vmrglw */
4993
4994 #define __builtin_altivec_vmrglw vec_vmrglw
4995
4996 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
4997                                                      vector int __b) {
4998   return vec_perm(__a, __b,
4999                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5000                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5001                                          0x1C, 0x1D, 0x1E, 0x1F));
5002 }
5003
5004 static __inline__ vector unsigned int __ATTRS_o_ai
5005 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
5006   return vec_perm(__a, __b,
5007                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5008                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5009                                          0x1C, 0x1D, 0x1E, 0x1F));
5010 }
5011
5012 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5013                                                           vector bool int __b) {
5014   return vec_perm(__a, __b,
5015                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5016                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5017                                          0x1C, 0x1D, 0x1E, 0x1F));
5018 }
5019
5020 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5021                                                        vector float __b) {
5022   return vec_perm(__a, __b,
5023                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5024                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5025                                          0x1C, 0x1D, 0x1E, 0x1F));
5026 }
5027
5028 #ifdef __POWER8_VECTOR__
5029 /* vec_mergee */
5030
5031 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5032                                                           vector bool int __b) {
5033   return vec_perm(__a, __b,
5034                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5035                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5036                                          0x18, 0x19, 0x1A, 0x1B));
5037 }
5038
5039 static __inline__ vector signed int __ATTRS_o_ai
5040 vec_mergee(vector signed int __a, vector signed int __b) {
5041   return vec_perm(__a, __b,
5042                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5043                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5044                                          0x18, 0x19, 0x1A, 0x1B));
5045 }
5046
5047 static __inline__ vector unsigned int __ATTRS_o_ai
5048 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5049   return vec_perm(__a, __b,
5050                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5051                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5052                                          0x18, 0x19, 0x1A, 0x1B));
5053 }
5054
5055 static __inline__ vector bool long long __ATTRS_o_ai
5056 vec_mergee(vector bool long long __a, vector bool long long __b) {
5057   return vec_mergeh(__a, __b);
5058 }
5059
5060 static __inline__ vector signed long long __ATTRS_o_ai
5061 vec_mergee(vector signed long long __a, vector signed long long __b) {
5062   return vec_mergeh(__a, __b);
5063 }
5064
5065 static __inline__ vector unsigned long long __ATTRS_o_ai
5066 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5067   return vec_mergeh(__a, __b);
5068 }
5069
5070 static __inline__ vector float __ATTRS_o_ai
5071 vec_mergee(vector float __a, vector float __b) {
5072   return vec_perm(__a, __b,
5073                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5074                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5075                                          0x18, 0x19, 0x1A, 0x1B));
5076 }
5077
5078 static __inline__ vector double __ATTRS_o_ai
5079 vec_mergee(vector double __a, vector double __b) {
5080   return vec_mergeh(__a, __b);
5081 }
5082
5083 /* vec_mergeo */
5084
5085 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5086                                                           vector bool int __b) {
5087   return vec_perm(__a, __b,
5088                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5089                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5090                                          0x1C, 0x1D, 0x1E, 0x1F));
5091 }
5092
5093 static __inline__ vector signed int __ATTRS_o_ai
5094 vec_mergeo(vector signed int __a, vector signed int __b) {
5095   return vec_perm(__a, __b,
5096                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5097                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5098                                          0x1C, 0x1D, 0x1E, 0x1F));
5099 }
5100
5101 static __inline__ vector unsigned int __ATTRS_o_ai
5102 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5103   return vec_perm(__a, __b,
5104                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5105                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5106                                          0x1C, 0x1D, 0x1E, 0x1F));
5107 }
5108
5109 static __inline__ vector bool long long __ATTRS_o_ai
5110 vec_mergeo(vector bool long long __a, vector bool long long __b) {
5111   return vec_mergel(__a, __b);
5112 }
5113
5114 static __inline__ vector signed long long __ATTRS_o_ai
5115 vec_mergeo(vector signed long long __a, vector signed long long __b) {
5116   return vec_mergel(__a, __b);
5117 }
5118
5119 static __inline__ vector unsigned long long __ATTRS_o_ai
5120 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5121   return vec_mergel(__a, __b);
5122 }
5123
5124 static __inline__ vector float __ATTRS_o_ai
5125 vec_mergeo(vector float __a, vector float __b) {
5126   return vec_perm(__a, __b,
5127                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5128                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5129                                          0x1C, 0x1D, 0x1E, 0x1F));
5130 }
5131
5132 static __inline__ vector double __ATTRS_o_ai
5133 vec_mergeo(vector double __a, vector double __b) {
5134   return vec_mergel(__a, __b);
5135 }
5136
5137 #endif
5138
5139 /* vec_mfvscr */
5140
5141 static __inline__ vector unsigned short __attribute__((__always_inline__))
5142 vec_mfvscr(void) {
5143   return __builtin_altivec_mfvscr();
5144 }
5145
5146 /* vec_min */
5147
5148 static __inline__ vector signed char __ATTRS_o_ai
5149 vec_min(vector signed char __a, vector signed char __b) {
5150   return __builtin_altivec_vminsb(__a, __b);
5151 }
5152
5153 static __inline__ vector signed char __ATTRS_o_ai
5154 vec_min(vector bool char __a, vector signed char __b) {
5155   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5156 }
5157
5158 static __inline__ vector signed char __ATTRS_o_ai
5159 vec_min(vector signed char __a, vector bool char __b) {
5160   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5161 }
5162
5163 static __inline__ vector unsigned char __ATTRS_o_ai
5164 vec_min(vector unsigned char __a, vector unsigned char __b) {
5165   return __builtin_altivec_vminub(__a, __b);
5166 }
5167
5168 static __inline__ vector unsigned char __ATTRS_o_ai
5169 vec_min(vector bool char __a, vector unsigned char __b) {
5170   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5171 }
5172
5173 static __inline__ vector unsigned char __ATTRS_o_ai
5174 vec_min(vector unsigned char __a, vector bool char __b) {
5175   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5176 }
5177
5178 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5179                                                     vector short __b) {
5180   return __builtin_altivec_vminsh(__a, __b);
5181 }
5182
5183 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5184                                                     vector short __b) {
5185   return __builtin_altivec_vminsh((vector short)__a, __b);
5186 }
5187
5188 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5189                                                     vector bool short __b) {
5190   return __builtin_altivec_vminsh(__a, (vector short)__b);
5191 }
5192
5193 static __inline__ vector unsigned short __ATTRS_o_ai
5194 vec_min(vector unsigned short __a, vector unsigned short __b) {
5195   return __builtin_altivec_vminuh(__a, __b);
5196 }
5197
5198 static __inline__ vector unsigned short __ATTRS_o_ai
5199 vec_min(vector bool short __a, vector unsigned short __b) {
5200   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5201 }
5202
5203 static __inline__ vector unsigned short __ATTRS_o_ai
5204 vec_min(vector unsigned short __a, vector bool short __b) {
5205   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5206 }
5207
5208 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5209                                                   vector int __b) {
5210   return __builtin_altivec_vminsw(__a, __b);
5211 }
5212
5213 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5214                                                   vector int __b) {
5215   return __builtin_altivec_vminsw((vector int)__a, __b);
5216 }
5217
5218 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5219                                                   vector bool int __b) {
5220   return __builtin_altivec_vminsw(__a, (vector int)__b);
5221 }
5222
5223 static __inline__ vector unsigned int __ATTRS_o_ai
5224 vec_min(vector unsigned int __a, vector unsigned int __b) {
5225   return __builtin_altivec_vminuw(__a, __b);
5226 }
5227
5228 static __inline__ vector unsigned int __ATTRS_o_ai
5229 vec_min(vector bool int __a, vector unsigned int __b) {
5230   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5231 }
5232
5233 static __inline__ vector unsigned int __ATTRS_o_ai
5234 vec_min(vector unsigned int __a, vector bool int __b) {
5235   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5236 }
5237
5238 #ifdef __POWER8_VECTOR__
5239 static __inline__ vector signed long long __ATTRS_o_ai
5240 vec_min(vector signed long long __a, vector signed long long __b) {
5241   return __builtin_altivec_vminsd(__a, __b);
5242 }
5243
5244 static __inline__ vector signed long long __ATTRS_o_ai
5245 vec_min(vector bool long long __a, vector signed long long __b) {
5246   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5247 }
5248
5249 static __inline__ vector signed long long __ATTRS_o_ai
5250 vec_min(vector signed long long __a, vector bool long long __b) {
5251   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5252 }
5253
5254 static __inline__ vector unsigned long long __ATTRS_o_ai
5255 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5256   return __builtin_altivec_vminud(__a, __b);
5257 }
5258
5259 static __inline__ vector unsigned long long __ATTRS_o_ai
5260 vec_min(vector bool long long __a, vector unsigned long long __b) {
5261   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5262 }
5263
5264 static __inline__ vector unsigned long long __ATTRS_o_ai
5265 vec_min(vector unsigned long long __a, vector bool long long __b) {
5266   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5267 }
5268 #endif
5269
5270 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5271                                                     vector float __b) {
5272 #ifdef __VSX__
5273   return __builtin_vsx_xvminsp(__a, __b);
5274 #else
5275   return __builtin_altivec_vminfp(__a, __b);
5276 #endif
5277 }
5278
5279 #ifdef __VSX__
5280 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5281                                                      vector double __b) {
5282   return __builtin_vsx_xvmindp(__a, __b);
5283 }
5284 #endif
5285
5286 /* vec_vminsb */
5287
5288 static __inline__ vector signed char __ATTRS_o_ai
5289 vec_vminsb(vector signed char __a, vector signed char __b) {
5290   return __builtin_altivec_vminsb(__a, __b);
5291 }
5292
5293 static __inline__ vector signed char __ATTRS_o_ai
5294 vec_vminsb(vector bool char __a, vector signed char __b) {
5295   return __builtin_altivec_vminsb((vector signed char)__a, __b);
5296 }
5297
5298 static __inline__ vector signed char __ATTRS_o_ai
5299 vec_vminsb(vector signed char __a, vector bool char __b) {
5300   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5301 }
5302
5303 /* vec_vminub */
5304
5305 static __inline__ vector unsigned char __ATTRS_o_ai
5306 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5307   return __builtin_altivec_vminub(__a, __b);
5308 }
5309
5310 static __inline__ vector unsigned char __ATTRS_o_ai
5311 vec_vminub(vector bool char __a, vector unsigned char __b) {
5312   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5313 }
5314
5315 static __inline__ vector unsigned char __ATTRS_o_ai
5316 vec_vminub(vector unsigned char __a, vector bool char __b) {
5317   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5318 }
5319
5320 /* vec_vminsh */
5321
5322 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5323                                                        vector short __b) {
5324   return __builtin_altivec_vminsh(__a, __b);
5325 }
5326
5327 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5328                                                        vector short __b) {
5329   return __builtin_altivec_vminsh((vector short)__a, __b);
5330 }
5331
5332 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5333                                                        vector bool short __b) {
5334   return __builtin_altivec_vminsh(__a, (vector short)__b);
5335 }
5336
5337 /* vec_vminuh */
5338
5339 static __inline__ vector unsigned short __ATTRS_o_ai
5340 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5341   return __builtin_altivec_vminuh(__a, __b);
5342 }
5343
5344 static __inline__ vector unsigned short __ATTRS_o_ai
5345 vec_vminuh(vector bool short __a, vector unsigned short __b) {
5346   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5347 }
5348
5349 static __inline__ vector unsigned short __ATTRS_o_ai
5350 vec_vminuh(vector unsigned short __a, vector bool short __b) {
5351   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5352 }
5353
5354 /* vec_vminsw */
5355
5356 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5357                                                      vector int __b) {
5358   return __builtin_altivec_vminsw(__a, __b);
5359 }
5360
5361 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5362                                                      vector int __b) {
5363   return __builtin_altivec_vminsw((vector int)__a, __b);
5364 }
5365
5366 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5367                                                      vector bool int __b) {
5368   return __builtin_altivec_vminsw(__a, (vector int)__b);
5369 }
5370
5371 /* vec_vminuw */
5372
5373 static __inline__ vector unsigned int __ATTRS_o_ai
5374 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5375   return __builtin_altivec_vminuw(__a, __b);
5376 }
5377
5378 static __inline__ vector unsigned int __ATTRS_o_ai
5379 vec_vminuw(vector bool int __a, vector unsigned int __b) {
5380   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5381 }
5382
5383 static __inline__ vector unsigned int __ATTRS_o_ai
5384 vec_vminuw(vector unsigned int __a, vector bool int __b) {
5385   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5386 }
5387
5388 /* vec_vminfp */
5389
5390 static __inline__ vector float __attribute__((__always_inline__))
5391 vec_vminfp(vector float __a, vector float __b) {
5392 #ifdef __VSX__
5393   return __builtin_vsx_xvminsp(__a, __b);
5394 #else
5395   return __builtin_altivec_vminfp(__a, __b);
5396 #endif
5397 }
5398
5399 /* vec_mladd */
5400
5401 #define __builtin_altivec_vmladduhm vec_mladd
5402
5403 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5404                                                       vector short __b,
5405                                                       vector short __c) {
5406   return __a * __b + __c;
5407 }
5408
5409 static __inline__ vector short __ATTRS_o_ai vec_mladd(
5410     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5411   return __a * (vector short)__b + (vector short)__c;
5412 }
5413
5414 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
5415                                                       vector short __b,
5416                                                       vector short __c) {
5417   return (vector short)__a * __b + __c;
5418 }
5419
5420 static __inline__ vector unsigned short __ATTRS_o_ai
5421 vec_mladd(vector unsigned short __a, vector unsigned short __b,
5422           vector unsigned short __c) {
5423   return __a * __b + __c;
5424 }
5425
5426 /* vec_vmladduhm */
5427
5428 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
5429                                                           vector short __b,
5430                                                           vector short __c) {
5431   return __a * __b + __c;
5432 }
5433
5434 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
5435     vector short __a, vector unsigned short __b, vector unsigned short __c) {
5436   return __a * (vector short)__b + (vector short)__c;
5437 }
5438
5439 static __inline__ vector short __ATTRS_o_ai
5440 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
5441   return (vector short)__a * __b + __c;
5442 }
5443
5444 static __inline__ vector unsigned short __ATTRS_o_ai
5445 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
5446               vector unsigned short __c) {
5447   return __a * __b + __c;
5448 }
5449
5450 /* vec_mradds */
5451
5452 static __inline__ vector short __attribute__((__always_inline__))
5453 vec_mradds(vector short __a, vector short __b, vector short __c) {
5454   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5455 }
5456
5457 /* vec_vmhraddshs */
5458
5459 static __inline__ vector short __attribute__((__always_inline__))
5460 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
5461   return __builtin_altivec_vmhraddshs(__a, __b, __c);
5462 }
5463
5464 /* vec_msum */
5465
5466 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
5467                                                    vector unsigned char __b,
5468                                                    vector int __c) {
5469   return __builtin_altivec_vmsummbm(__a, __b, __c);
5470 }
5471
5472 static __inline__ vector unsigned int __ATTRS_o_ai
5473 vec_msum(vector unsigned char __a, vector unsigned char __b,
5474          vector unsigned int __c) {
5475   return __builtin_altivec_vmsumubm(__a, __b, __c);
5476 }
5477
5478 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
5479                                                    vector short __b,
5480                                                    vector int __c) {
5481   return __builtin_altivec_vmsumshm(__a, __b, __c);
5482 }
5483
5484 static __inline__ vector unsigned int __ATTRS_o_ai
5485 vec_msum(vector unsigned short __a, vector unsigned short __b,
5486          vector unsigned int __c) {
5487   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5488 }
5489
5490 /* vec_vmsummbm */
5491
5492 static __inline__ vector int __attribute__((__always_inline__))
5493 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
5494   return __builtin_altivec_vmsummbm(__a, __b, __c);
5495 }
5496
5497 /* vec_vmsumubm */
5498
5499 static __inline__ vector unsigned int __attribute__((__always_inline__))
5500 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
5501              vector unsigned int __c) {
5502   return __builtin_altivec_vmsumubm(__a, __b, __c);
5503 }
5504
5505 /* vec_vmsumshm */
5506
5507 static __inline__ vector int __attribute__((__always_inline__))
5508 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
5509   return __builtin_altivec_vmsumshm(__a, __b, __c);
5510 }
5511
5512 /* vec_vmsumuhm */
5513
5514 static __inline__ vector unsigned int __attribute__((__always_inline__))
5515 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
5516              vector unsigned int __c) {
5517   return __builtin_altivec_vmsumuhm(__a, __b, __c);
5518 }
5519
5520 /* vec_msums */
5521
5522 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
5523                                                     vector short __b,
5524                                                     vector int __c) {
5525   return __builtin_altivec_vmsumshs(__a, __b, __c);
5526 }
5527
5528 static __inline__ vector unsigned int __ATTRS_o_ai
5529 vec_msums(vector unsigned short __a, vector unsigned short __b,
5530           vector unsigned int __c) {
5531   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5532 }
5533
5534 /* vec_vmsumshs */
5535
5536 static __inline__ vector int __attribute__((__always_inline__))
5537 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
5538   return __builtin_altivec_vmsumshs(__a, __b, __c);
5539 }
5540
5541 /* vec_vmsumuhs */
5542
5543 static __inline__ vector unsigned int __attribute__((__always_inline__))
5544 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
5545              vector unsigned int __c) {
5546   return __builtin_altivec_vmsumuhs(__a, __b, __c);
5547 }
5548
5549 /* vec_mtvscr */
5550
5551 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
5552   __builtin_altivec_mtvscr((vector int)__a);
5553 }
5554
5555 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
5556   __builtin_altivec_mtvscr((vector int)__a);
5557 }
5558
5559 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
5560   __builtin_altivec_mtvscr((vector int)__a);
5561 }
5562
5563 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
5564   __builtin_altivec_mtvscr((vector int)__a);
5565 }
5566
5567 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
5568   __builtin_altivec_mtvscr((vector int)__a);
5569 }
5570
5571 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
5572   __builtin_altivec_mtvscr((vector int)__a);
5573 }
5574
5575 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
5576   __builtin_altivec_mtvscr((vector int)__a);
5577 }
5578
5579 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
5580   __builtin_altivec_mtvscr((vector int)__a);
5581 }
5582
5583 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
5584   __builtin_altivec_mtvscr((vector int)__a);
5585 }
5586
5587 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
5588   __builtin_altivec_mtvscr((vector int)__a);
5589 }
5590
5591 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
5592   __builtin_altivec_mtvscr((vector int)__a);
5593 }
5594
5595 /* vec_mul */
5596
5597 /* Integer vector multiplication will involve multiplication of the odd/even
5598    elements separately, then truncating the results and moving to the
5599    result vector.
5600 */
5601 static __inline__ vector signed char __ATTRS_o_ai
5602 vec_mul(vector signed char __a, vector signed char __b) {
5603   return __a * __b;
5604 }
5605
5606 static __inline__ vector unsigned char __ATTRS_o_ai
5607 vec_mul(vector unsigned char __a, vector unsigned char __b) {
5608   return __a * __b;
5609 }
5610
5611 static __inline__ vector signed short __ATTRS_o_ai
5612 vec_mul(vector signed short __a, vector signed short __b) {
5613   return __a * __b;
5614 }
5615
5616 static __inline__ vector unsigned short __ATTRS_o_ai
5617 vec_mul(vector unsigned short __a, vector unsigned short __b) {
5618   return __a * __b;
5619 }
5620
5621 static __inline__ vector signed int __ATTRS_o_ai
5622 vec_mul(vector signed int __a, vector signed int __b) {
5623   return __a * __b;
5624 }
5625
5626 static __inline__ vector unsigned int __ATTRS_o_ai
5627 vec_mul(vector unsigned int __a, vector unsigned int __b) {
5628   return __a * __b;
5629 }
5630
5631 #ifdef __VSX__
5632 static __inline__ vector signed long long __ATTRS_o_ai
5633 vec_mul(vector signed long long __a, vector signed long long __b) {
5634   return __a * __b;
5635 }
5636
5637 static __inline__ vector unsigned long long __ATTRS_o_ai
5638 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
5639   return __a * __b;
5640 }
5641 #endif
5642
5643 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
5644                                                     vector float __b) {
5645   return __a * __b;
5646 }
5647
5648 #ifdef __VSX__
5649 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
5650                                                      vector double __b) {
5651   return __a * __b;
5652 }
5653 #endif
5654
5655 /* The vmulos* and vmules* instructions have a big endian bias, so
5656    we must reverse the meaning of "even" and "odd" for little endian.  */
5657
5658 /* vec_mule */
5659
5660 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
5661                                                      vector signed char __b) {
5662 #ifdef __LITTLE_ENDIAN__
5663   return __builtin_altivec_vmulosb(__a, __b);
5664 #else
5665   return __builtin_altivec_vmulesb(__a, __b);
5666 #endif
5667 }
5668
5669 static __inline__ vector unsigned short __ATTRS_o_ai
5670 vec_mule(vector unsigned char __a, vector unsigned char __b) {
5671 #ifdef __LITTLE_ENDIAN__
5672   return __builtin_altivec_vmuloub(__a, __b);
5673 #else
5674   return __builtin_altivec_vmuleub(__a, __b);
5675 #endif
5676 }
5677
5678 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
5679                                                    vector short __b) {
5680 #ifdef __LITTLE_ENDIAN__
5681   return __builtin_altivec_vmulosh(__a, __b);
5682 #else
5683   return __builtin_altivec_vmulesh(__a, __b);
5684 #endif
5685 }
5686
5687 static __inline__ vector unsigned int __ATTRS_o_ai
5688 vec_mule(vector unsigned short __a, vector unsigned short __b) {
5689 #ifdef __LITTLE_ENDIAN__
5690   return __builtin_altivec_vmulouh(__a, __b);
5691 #else
5692   return __builtin_altivec_vmuleuh(__a, __b);
5693 #endif
5694 }
5695
5696 #ifdef __POWER8_VECTOR__
5697 static __inline__ vector signed long long __ATTRS_o_ai
5698 vec_mule(vector signed int __a, vector signed int __b) {
5699 #ifdef __LITTLE_ENDIAN__
5700   return __builtin_altivec_vmulosw(__a, __b);
5701 #else
5702   return __builtin_altivec_vmulesw(__a, __b);
5703 #endif
5704 }
5705
5706 static __inline__ vector unsigned long long __ATTRS_o_ai
5707 vec_mule(vector unsigned int __a, vector unsigned int __b) {
5708 #ifdef __LITTLE_ENDIAN__
5709   return __builtin_altivec_vmulouw(__a, __b);
5710 #else
5711   return __builtin_altivec_vmuleuw(__a, __b);
5712 #endif
5713 }
5714 #endif
5715
5716 /* vec_vmulesb */
5717
5718 static __inline__ vector short __attribute__((__always_inline__))
5719 vec_vmulesb(vector signed char __a, vector signed char __b) {
5720 #ifdef __LITTLE_ENDIAN__
5721   return __builtin_altivec_vmulosb(__a, __b);
5722 #else
5723   return __builtin_altivec_vmulesb(__a, __b);
5724 #endif
5725 }
5726
5727 /* vec_vmuleub */
5728
5729 static __inline__ vector unsigned short __attribute__((__always_inline__))
5730 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
5731 #ifdef __LITTLE_ENDIAN__
5732   return __builtin_altivec_vmuloub(__a, __b);
5733 #else
5734   return __builtin_altivec_vmuleub(__a, __b);
5735 #endif
5736 }
5737
5738 /* vec_vmulesh */
5739
5740 static __inline__ vector int __attribute__((__always_inline__))
5741 vec_vmulesh(vector short __a, vector short __b) {
5742 #ifdef __LITTLE_ENDIAN__
5743   return __builtin_altivec_vmulosh(__a, __b);
5744 #else
5745   return __builtin_altivec_vmulesh(__a, __b);
5746 #endif
5747 }
5748
5749 /* vec_vmuleuh */
5750
5751 static __inline__ vector unsigned int __attribute__((__always_inline__))
5752 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
5753 #ifdef __LITTLE_ENDIAN__
5754   return __builtin_altivec_vmulouh(__a, __b);
5755 #else
5756   return __builtin_altivec_vmuleuh(__a, __b);
5757 #endif
5758 }
5759
5760 /* vec_mulo */
5761
5762 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
5763                                                      vector signed char __b) {
5764 #ifdef __LITTLE_ENDIAN__
5765   return __builtin_altivec_vmulesb(__a, __b);
5766 #else
5767   return __builtin_altivec_vmulosb(__a, __b);
5768 #endif
5769 }
5770
5771 static __inline__ vector unsigned short __ATTRS_o_ai
5772 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
5773 #ifdef __LITTLE_ENDIAN__
5774   return __builtin_altivec_vmuleub(__a, __b);
5775 #else
5776   return __builtin_altivec_vmuloub(__a, __b);
5777 #endif
5778 }
5779
5780 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
5781                                                    vector short __b) {
5782 #ifdef __LITTLE_ENDIAN__
5783   return __builtin_altivec_vmulesh(__a, __b);
5784 #else
5785   return __builtin_altivec_vmulosh(__a, __b);
5786 #endif
5787 }
5788
5789 static __inline__ vector unsigned int __ATTRS_o_ai
5790 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
5791 #ifdef __LITTLE_ENDIAN__
5792   return __builtin_altivec_vmuleuh(__a, __b);
5793 #else
5794   return __builtin_altivec_vmulouh(__a, __b);
5795 #endif
5796 }
5797
5798 #ifdef __POWER8_VECTOR__
5799 static __inline__ vector signed long long __ATTRS_o_ai
5800 vec_mulo(vector signed int __a, vector signed int __b) {
5801 #ifdef __LITTLE_ENDIAN__
5802   return __builtin_altivec_vmulesw(__a, __b);
5803 #else
5804   return __builtin_altivec_vmulosw(__a, __b);
5805 #endif
5806 }
5807
5808 static __inline__ vector unsigned long long __ATTRS_o_ai
5809 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
5810 #ifdef __LITTLE_ENDIAN__
5811   return __builtin_altivec_vmuleuw(__a, __b);
5812 #else
5813   return __builtin_altivec_vmulouw(__a, __b);
5814 #endif
5815 }
5816 #endif
5817
5818 /* vec_vmulosb */
5819
5820 static __inline__ vector short __attribute__((__always_inline__))
5821 vec_vmulosb(vector signed char __a, vector signed char __b) {
5822 #ifdef __LITTLE_ENDIAN__
5823   return __builtin_altivec_vmulesb(__a, __b);
5824 #else
5825   return __builtin_altivec_vmulosb(__a, __b);
5826 #endif
5827 }
5828
5829 /* vec_vmuloub */
5830
5831 static __inline__ vector unsigned short __attribute__((__always_inline__))
5832 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
5833 #ifdef __LITTLE_ENDIAN__
5834   return __builtin_altivec_vmuleub(__a, __b);
5835 #else
5836   return __builtin_altivec_vmuloub(__a, __b);
5837 #endif
5838 }
5839
5840 /* vec_vmulosh */
5841
5842 static __inline__ vector int __attribute__((__always_inline__))
5843 vec_vmulosh(vector short __a, vector short __b) {
5844 #ifdef __LITTLE_ENDIAN__
5845   return __builtin_altivec_vmulesh(__a, __b);
5846 #else
5847   return __builtin_altivec_vmulosh(__a, __b);
5848 #endif
5849 }
5850
5851 /* vec_vmulouh */
5852
5853 static __inline__ vector unsigned int __attribute__((__always_inline__))
5854 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
5855 #ifdef __LITTLE_ENDIAN__
5856   return __builtin_altivec_vmuleuh(__a, __b);
5857 #else
5858   return __builtin_altivec_vmulouh(__a, __b);
5859 #endif
5860 }
5861
5862 /*  vec_nand */
5863
5864 #ifdef __POWER8_VECTOR__
5865 static __inline__ vector signed char __ATTRS_o_ai
5866 vec_nand(vector signed char __a, vector signed char __b) {
5867   return ~(__a & __b);
5868 }
5869
5870 static __inline__ vector signed char __ATTRS_o_ai
5871 vec_nand(vector signed char __a, vector bool char __b) {
5872   return ~(__a & __b);
5873 }
5874
5875 static __inline__ vector signed char __ATTRS_o_ai
5876 vec_nand(vector bool char __a, vector signed char __b) {
5877   return ~(__a & __b);
5878 }
5879
5880 static __inline__ vector unsigned char __ATTRS_o_ai
5881 vec_nand(vector unsigned char __a, vector unsigned char __b) {
5882   return ~(__a & __b);
5883 }
5884
5885 static __inline__ vector unsigned char __ATTRS_o_ai
5886 vec_nand(vector unsigned char __a, vector bool char __b) {
5887   return ~(__a & __b);
5888 }
5889
5890 static __inline__ vector unsigned char __ATTRS_o_ai
5891 vec_nand(vector bool char __a, vector unsigned char __b) {
5892   return ~(__a & __b);
5893 }
5894
5895 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
5896                                                          vector bool char __b) {
5897   return ~(__a & __b);
5898 }
5899
5900 static __inline__ vector signed short __ATTRS_o_ai
5901 vec_nand(vector signed short __a, vector signed short __b) {
5902   return ~(__a & __b);
5903 }
5904
5905 static __inline__ vector signed short __ATTRS_o_ai
5906 vec_nand(vector signed short __a, vector bool short __b) {
5907   return ~(__a & __b);
5908 }
5909
5910 static __inline__ vector signed short __ATTRS_o_ai
5911 vec_nand(vector bool short __a, vector signed short __b) {
5912   return ~(__a & __b);
5913 }
5914
5915 static __inline__ vector unsigned short __ATTRS_o_ai
5916 vec_nand(vector unsigned short __a, vector unsigned short __b) {
5917   return ~(__a & __b);
5918 }
5919
5920 static __inline__ vector unsigned short __ATTRS_o_ai
5921 vec_nand(vector unsigned short __a, vector bool short __b) {
5922   return ~(__a & __b);
5923 }
5924
5925 static __inline__ vector bool short __ATTRS_o_ai
5926 vec_nand(vector bool short __a, vector bool short __b) {
5927   return ~(__a & __b);
5928 }
5929
5930 static __inline__ vector signed int __ATTRS_o_ai
5931 vec_nand(vector signed int __a, vector signed int __b) {
5932   return ~(__a & __b);
5933 }
5934
5935 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
5936                                                           vector bool int __b) {
5937   return ~(__a & __b);
5938 }
5939
5940 static __inline__ vector signed int __ATTRS_o_ai
5941 vec_nand(vector bool int __a, vector signed int __b) {
5942   return ~(__a & __b);
5943 }
5944
5945 static __inline__ vector unsigned int __ATTRS_o_ai
5946 vec_nand(vector unsigned int __a, vector unsigned int __b) {
5947   return ~(__a & __b);
5948 }
5949
5950 static __inline__ vector unsigned int __ATTRS_o_ai
5951 vec_nand(vector unsigned int __a, vector bool int __b) {
5952   return ~(__a & __b);
5953 }
5954
5955 static __inline__ vector unsigned int __ATTRS_o_ai
5956 vec_nand(vector bool int __a, vector unsigned int __b) {
5957   return ~(__a & __b);
5958 }
5959
5960 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
5961                                                         vector bool int __b) {
5962   return ~(__a & __b);
5963 }
5964
5965 static __inline__ vector float __ATTRS_o_ai
5966 vec_nand(vector float __a, vector float __b) {
5967   return (vector float)(~((vector unsigned int)__a &
5968                           (vector unsigned int)__b));
5969 }
5970
5971 static __inline__ vector signed long long __ATTRS_o_ai
5972 vec_nand(vector signed long long __a, vector signed long long __b) {
5973   return ~(__a & __b);
5974 }
5975
5976 static __inline__ vector signed long long __ATTRS_o_ai
5977 vec_nand(vector signed long long __a, vector bool long long __b) {
5978   return ~(__a & __b);
5979 }
5980
5981 static __inline__ vector signed long long __ATTRS_o_ai
5982 vec_nand(vector bool long long __a, vector signed long long __b) {
5983   return ~(__a & __b);
5984 }
5985
5986 static __inline__ vector unsigned long long __ATTRS_o_ai
5987 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
5988   return ~(__a & __b);
5989 }
5990
5991 static __inline__ vector unsigned long long __ATTRS_o_ai
5992 vec_nand(vector unsigned long long __a, vector bool long long __b) {
5993   return ~(__a & __b);
5994 }
5995
5996 static __inline__ vector unsigned long long __ATTRS_o_ai
5997 vec_nand(vector bool long long __a, vector unsigned long long __b) {
5998   return ~(__a & __b);
5999 }
6000
6001 static __inline__ vector bool long long __ATTRS_o_ai
6002 vec_nand(vector bool long long __a, vector bool long long __b) {
6003   return ~(__a & __b);
6004 }
6005
6006 static __inline__ vector double __ATTRS_o_ai
6007 vec_nand(vector double __a, vector double __b) {
6008   return (vector double)(~((vector unsigned long long)__a &
6009                            (vector unsigned long long)__b));
6010 }
6011
6012 #endif
6013
6014 /* vec_nmadd */
6015
6016 #ifdef __VSX__
6017 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6018                                                       vector float __b,
6019                                                       vector float __c) {
6020   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6021 }
6022
6023 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6024                                                        vector double __b,
6025                                                        vector double __c) {
6026   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6027 }
6028 #endif
6029
6030 /* vec_nmsub */
6031
6032 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6033                                                       vector float __b,
6034                                                       vector float __c) {
6035 #ifdef __VSX__
6036   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6037 #else
6038   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6039 #endif
6040 }
6041
6042 #ifdef __VSX__
6043 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6044                                                        vector double __b,
6045                                                        vector double __c) {
6046   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6047 }
6048 #endif
6049
6050 /* vec_vnmsubfp */
6051
6052 static __inline__ vector float __attribute__((__always_inline__))
6053 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6054   return __builtin_altivec_vnmsubfp(__a, __b, __c);
6055 }
6056
6057 /* vec_nor */
6058
6059 #define __builtin_altivec_vnor vec_nor
6060
6061 static __inline__ vector signed char __ATTRS_o_ai
6062 vec_nor(vector signed char __a, vector signed char __b) {
6063   return ~(__a | __b);
6064 }
6065
6066 static __inline__ vector unsigned char __ATTRS_o_ai
6067 vec_nor(vector unsigned char __a, vector unsigned char __b) {
6068   return ~(__a | __b);
6069 }
6070
6071 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6072                                                         vector bool char __b) {
6073   return ~(__a | __b);
6074 }
6075
6076 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6077                                                     vector short __b) {
6078   return ~(__a | __b);
6079 }
6080
6081 static __inline__ vector unsigned short __ATTRS_o_ai
6082 vec_nor(vector unsigned short __a, vector unsigned short __b) {
6083   return ~(__a | __b);
6084 }
6085
6086 static __inline__ vector bool short __ATTRS_o_ai
6087 vec_nor(vector bool short __a, vector bool short __b) {
6088   return ~(__a | __b);
6089 }
6090
6091 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6092                                                   vector int __b) {
6093   return ~(__a | __b);
6094 }
6095
6096 static __inline__ vector unsigned int __ATTRS_o_ai
6097 vec_nor(vector unsigned int __a, vector unsigned int __b) {
6098   return ~(__a | __b);
6099 }
6100
6101 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6102                                                        vector bool int __b) {
6103   return ~(__a | __b);
6104 }
6105
6106 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6107                                                     vector float __b) {
6108   vector unsigned int __res =
6109       ~((vector unsigned int)__a | (vector unsigned int)__b);
6110   return (vector float)__res;
6111 }
6112
6113 #ifdef __VSX__
6114 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6115                                                      vector double __b) {
6116   vector unsigned long long __res =
6117       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6118   return (vector double)__res;
6119 }
6120 #endif
6121
6122 /* vec_vnor */
6123
6124 static __inline__ vector signed char __ATTRS_o_ai
6125 vec_vnor(vector signed char __a, vector signed char __b) {
6126   return ~(__a | __b);
6127 }
6128
6129 static __inline__ vector unsigned char __ATTRS_o_ai
6130 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6131   return ~(__a | __b);
6132 }
6133
6134 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6135                                                          vector bool char __b) {
6136   return ~(__a | __b);
6137 }
6138
6139 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6140                                                      vector short __b) {
6141   return ~(__a | __b);
6142 }
6143
6144 static __inline__ vector unsigned short __ATTRS_o_ai
6145 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6146   return ~(__a | __b);
6147 }
6148
6149 static __inline__ vector bool short __ATTRS_o_ai
6150 vec_vnor(vector bool short __a, vector bool short __b) {
6151   return ~(__a | __b);
6152 }
6153
6154 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6155                                                    vector int __b) {
6156   return ~(__a | __b);
6157 }
6158
6159 static __inline__ vector unsigned int __ATTRS_o_ai
6160 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6161   return ~(__a | __b);
6162 }
6163
6164 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6165                                                         vector bool int __b) {
6166   return ~(__a | __b);
6167 }
6168
6169 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6170                                                      vector float __b) {
6171   vector unsigned int __res =
6172       ~((vector unsigned int)__a | (vector unsigned int)__b);
6173   return (vector float)__res;
6174 }
6175
6176 #ifdef __VSX__
6177 static __inline__ vector signed long long __ATTRS_o_ai
6178 vec_nor(vector signed long long __a, vector signed long long __b) {
6179   return ~(__a | __b);
6180 }
6181
6182 static __inline__ vector unsigned long long __ATTRS_o_ai
6183 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6184   return ~(__a | __b);
6185 }
6186
6187 static __inline__ vector bool long long __ATTRS_o_ai
6188 vec_nor(vector bool long long __a, vector bool long long __b) {
6189   return ~(__a | __b);
6190 }
6191 #endif
6192
6193 /* vec_or */
6194
6195 #define __builtin_altivec_vor vec_or
6196
6197 static __inline__ vector signed char __ATTRS_o_ai
6198 vec_or(vector signed char __a, vector signed char __b) {
6199   return __a | __b;
6200 }
6201
6202 static __inline__ vector signed char __ATTRS_o_ai
6203 vec_or(vector bool char __a, vector signed char __b) {
6204   return (vector signed char)__a | __b;
6205 }
6206
6207 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6208                                                          vector bool char __b) {
6209   return __a | (vector signed char)__b;
6210 }
6211
6212 static __inline__ vector unsigned char __ATTRS_o_ai
6213 vec_or(vector unsigned char __a, vector unsigned char __b) {
6214   return __a | __b;
6215 }
6216
6217 static __inline__ vector unsigned char __ATTRS_o_ai
6218 vec_or(vector bool char __a, vector unsigned char __b) {
6219   return (vector unsigned char)__a | __b;
6220 }
6221
6222 static __inline__ vector unsigned char __ATTRS_o_ai
6223 vec_or(vector unsigned char __a, vector bool char __b) {
6224   return __a | (vector unsigned char)__b;
6225 }
6226
6227 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6228                                                        vector bool char __b) {
6229   return __a | __b;
6230 }
6231
6232 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6233                                                    vector short __b) {
6234   return __a | __b;
6235 }
6236
6237 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6238                                                    vector short __b) {
6239   return (vector short)__a | __b;
6240 }
6241
6242 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6243                                                    vector bool short __b) {
6244   return __a | (vector short)__b;
6245 }
6246
6247 static __inline__ vector unsigned short __ATTRS_o_ai
6248 vec_or(vector unsigned short __a, vector unsigned short __b) {
6249   return __a | __b;
6250 }
6251
6252 static __inline__ vector unsigned short __ATTRS_o_ai
6253 vec_or(vector bool short __a, vector unsigned short __b) {
6254   return (vector unsigned short)__a | __b;
6255 }
6256
6257 static __inline__ vector unsigned short __ATTRS_o_ai
6258 vec_or(vector unsigned short __a, vector bool short __b) {
6259   return __a | (vector unsigned short)__b;
6260 }
6261
6262 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6263                                                         vector bool short __b) {
6264   return __a | __b;
6265 }
6266
6267 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6268                                                  vector int __b) {
6269   return __a | __b;
6270 }
6271
6272 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6273                                                  vector int __b) {
6274   return (vector int)__a | __b;
6275 }
6276
6277 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6278                                                  vector bool int __b) {
6279   return __a | (vector int)__b;
6280 }
6281
6282 static __inline__ vector unsigned int __ATTRS_o_ai
6283 vec_or(vector unsigned int __a, vector unsigned int __b) {
6284   return __a | __b;
6285 }
6286
6287 static __inline__ vector unsigned int __ATTRS_o_ai
6288 vec_or(vector bool int __a, vector unsigned int __b) {
6289   return (vector unsigned int)__a | __b;
6290 }
6291
6292 static __inline__ vector unsigned int __ATTRS_o_ai
6293 vec_or(vector unsigned int __a, vector bool int __b) {
6294   return __a | (vector unsigned int)__b;
6295 }
6296
6297 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6298                                                       vector bool int __b) {
6299   return __a | __b;
6300 }
6301
6302 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6303                                                    vector float __b) {
6304   vector unsigned int __res =
6305       (vector unsigned int)__a | (vector unsigned int)__b;
6306   return (vector float)__res;
6307 }
6308
6309 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6310                                                    vector float __b) {
6311   vector unsigned int __res =
6312       (vector unsigned int)__a | (vector unsigned int)__b;
6313   return (vector float)__res;
6314 }
6315
6316 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6317                                                    vector bool int __b) {
6318   vector unsigned int __res =
6319       (vector unsigned int)__a | (vector unsigned int)__b;
6320   return (vector float)__res;
6321 }
6322
6323 #ifdef __VSX__
6324 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6325                                                     vector double __b) {
6326   return (vector unsigned long long)__a | (vector unsigned long long)__b;
6327 }
6328
6329 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6330                                                     vector bool long long __b) {
6331   return (vector unsigned long long)__a | (vector unsigned long long)__b;
6332 }
6333
6334 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6335                                                     vector double __b) {
6336   vector unsigned long long __res =
6337       (vector unsigned long long)__a | (vector unsigned long long)__b;
6338   return (vector double)__res;
6339 }
6340
6341 static __inline__ vector signed long long __ATTRS_o_ai
6342 vec_or(vector signed long long __a, vector signed long long __b) {
6343   return __a | __b;
6344 }
6345
6346 static __inline__ vector signed long long __ATTRS_o_ai
6347 vec_or(vector bool long long __a, vector signed long long __b) {
6348   return (vector signed long long)__a | __b;
6349 }
6350
6351 static __inline__ vector signed long long __ATTRS_o_ai
6352 vec_or(vector signed long long __a, vector bool long long __b) {
6353   return __a | (vector signed long long)__b;
6354 }
6355
6356 static __inline__ vector unsigned long long __ATTRS_o_ai
6357 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
6358   return __a | __b;
6359 }
6360
6361 static __inline__ vector unsigned long long __ATTRS_o_ai
6362 vec_or(vector bool long long __a, vector unsigned long long __b) {
6363   return (vector unsigned long long)__a | __b;
6364 }
6365
6366 static __inline__ vector unsigned long long __ATTRS_o_ai
6367 vec_or(vector unsigned long long __a, vector bool long long __b) {
6368   return __a | (vector unsigned long long)__b;
6369 }
6370
6371 static __inline__ vector bool long long __ATTRS_o_ai
6372 vec_or(vector bool long long __a, vector bool long long __b) {
6373   return __a | __b;
6374 }
6375 #endif
6376
6377 #ifdef __POWER8_VECTOR__
6378 static __inline__ vector signed char __ATTRS_o_ai
6379 vec_orc(vector signed char __a, vector signed char __b) {
6380   return __a | ~__b;
6381 }
6382
6383 static __inline__ vector signed char __ATTRS_o_ai
6384 vec_orc(vector signed char __a, vector bool char __b) {
6385   return __a | ~__b;
6386 }
6387
6388 static __inline__ vector signed char __ATTRS_o_ai
6389 vec_orc(vector bool char __a, vector signed char __b) {
6390   return __a | ~__b;
6391 }
6392
6393 static __inline__ vector unsigned char __ATTRS_o_ai
6394 vec_orc(vector unsigned char __a, vector unsigned char __b) {
6395   return __a | ~__b;
6396 }
6397
6398 static __inline__ vector unsigned char __ATTRS_o_ai
6399 vec_orc(vector unsigned char __a, vector bool char __b) {
6400   return __a | ~__b;
6401 }
6402
6403 static __inline__ vector unsigned char __ATTRS_o_ai
6404 vec_orc(vector bool char __a, vector unsigned char __b) {
6405   return __a | ~__b;
6406 }
6407
6408 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
6409                                                         vector bool char __b) {
6410   return __a | ~__b;
6411 }
6412
6413 static __inline__ vector signed short __ATTRS_o_ai
6414 vec_orc(vector signed short __a, vector signed short __b) {
6415   return __a | ~__b;
6416 }
6417
6418 static __inline__ vector signed short __ATTRS_o_ai
6419 vec_orc(vector signed short __a, vector bool short __b) {
6420   return __a | ~__b;
6421 }
6422
6423 static __inline__ vector signed short __ATTRS_o_ai
6424 vec_orc(vector bool short __a, vector signed short __b) {
6425   return __a | ~__b;
6426 }
6427
6428 static __inline__ vector unsigned short __ATTRS_o_ai
6429 vec_orc(vector unsigned short __a, vector unsigned short __b) {
6430   return __a | ~__b;
6431 }
6432
6433 static __inline__ vector unsigned short __ATTRS_o_ai
6434 vec_orc(vector unsigned short __a, vector bool short __b) {
6435   return __a | ~__b;
6436 }
6437
6438 static __inline__ vector unsigned short __ATTRS_o_ai
6439 vec_orc(vector bool short __a, vector unsigned short __b) {
6440   return __a | ~__b;
6441 }
6442
6443 static __inline__ vector bool short __ATTRS_o_ai
6444 vec_orc(vector bool short __a, vector bool short __b) {
6445   return __a | ~__b;
6446 }
6447
6448 static __inline__ vector signed int __ATTRS_o_ai
6449 vec_orc(vector signed int __a, vector signed int __b) {
6450   return __a | ~__b;
6451 }
6452
6453 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
6454                                                          vector bool int __b) {
6455   return __a | ~__b;
6456 }
6457
6458 static __inline__ vector signed int __ATTRS_o_ai
6459 vec_orc(vector bool int __a, vector signed int __b) {
6460   return __a | ~__b;
6461 }
6462
6463 static __inline__ vector unsigned int __ATTRS_o_ai
6464 vec_orc(vector unsigned int __a, vector unsigned int __b) {
6465   return __a | ~__b;
6466 }
6467
6468 static __inline__ vector unsigned int __ATTRS_o_ai
6469 vec_orc(vector unsigned int __a, vector bool int __b) {
6470   return __a | ~__b;
6471 }
6472
6473 static __inline__ vector unsigned int __ATTRS_o_ai
6474 vec_orc(vector bool int __a, vector unsigned int __b) {
6475   return __a | ~__b;
6476 }
6477
6478 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
6479                                                        vector bool int __b) {
6480   return __a | ~__b;
6481 }
6482
6483 static __inline__ vector float __ATTRS_o_ai
6484 vec_orc(vector bool int __a, vector float __b) {
6485  return (vector float)(__a | ~(vector unsigned int)__b);
6486 }
6487
6488 static __inline__ vector float __ATTRS_o_ai
6489 vec_orc(vector float __a, vector bool int __b) {
6490   return (vector float)((vector unsigned int)__a | ~__b);
6491 }
6492
6493 static __inline__ vector signed long long __ATTRS_o_ai
6494 vec_orc(vector signed long long __a, vector signed long long __b) {
6495   return __a | ~__b;
6496 }
6497
6498 static __inline__ vector signed long long __ATTRS_o_ai
6499 vec_orc(vector signed long long __a, vector bool long long __b) {
6500   return __a | ~__b;
6501 }
6502
6503 static __inline__ vector signed long long __ATTRS_o_ai
6504 vec_orc(vector bool long long __a, vector signed long long __b) {
6505   return __a | ~__b;
6506 }
6507
6508 static __inline__ vector unsigned long long __ATTRS_o_ai
6509 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
6510   return __a | ~__b;
6511 }
6512
6513 static __inline__ vector unsigned long long __ATTRS_o_ai
6514 vec_orc(vector unsigned long long __a, vector bool long long __b) {
6515   return __a | ~__b;
6516 }
6517
6518 static __inline__ vector unsigned long long __ATTRS_o_ai
6519 vec_orc(vector bool long long __a, vector unsigned long long __b) {
6520   return __a | ~__b;
6521 }
6522
6523 static __inline__ vector bool long long __ATTRS_o_ai
6524 vec_orc(vector bool long long __a, vector bool long long __b) {
6525   return __a | ~__b;
6526 }
6527
6528 static __inline__ vector double __ATTRS_o_ai
6529 vec_orc(vector double __a, vector bool long long __b) {
6530   return (vector double)((vector unsigned long long)__a | ~__b);
6531 }
6532
6533 static __inline__ vector double __ATTRS_o_ai
6534 vec_orc(vector bool long long __a, vector double __b) {
6535   return (vector double)(__a | ~(vector unsigned long long)__b);
6536 }
6537 #endif
6538
6539 /* vec_vor */
6540
6541 static __inline__ vector signed char __ATTRS_o_ai
6542 vec_vor(vector signed char __a, vector signed char __b) {
6543   return __a | __b;
6544 }
6545
6546 static __inline__ vector signed char __ATTRS_o_ai
6547 vec_vor(vector bool char __a, vector signed char __b) {
6548   return (vector signed char)__a | __b;
6549 }
6550
6551 static __inline__ vector signed char __ATTRS_o_ai
6552 vec_vor(vector signed char __a, vector bool char __b) {
6553   return __a | (vector signed char)__b;
6554 }
6555
6556 static __inline__ vector unsigned char __ATTRS_o_ai
6557 vec_vor(vector unsigned char __a, vector unsigned char __b) {
6558   return __a | __b;
6559 }
6560
6561 static __inline__ vector unsigned char __ATTRS_o_ai
6562 vec_vor(vector bool char __a, vector unsigned char __b) {
6563   return (vector unsigned char)__a | __b;
6564 }
6565
6566 static __inline__ vector unsigned char __ATTRS_o_ai
6567 vec_vor(vector unsigned char __a, vector bool char __b) {
6568   return __a | (vector unsigned char)__b;
6569 }
6570
6571 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
6572                                                         vector bool char __b) {
6573   return __a | __b;
6574 }
6575
6576 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6577                                                     vector short __b) {
6578   return __a | __b;
6579 }
6580
6581 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
6582                                                     vector short __b) {
6583   return (vector short)__a | __b;
6584 }
6585
6586 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
6587                                                     vector bool short __b) {
6588   return __a | (vector short)__b;
6589 }
6590
6591 static __inline__ vector unsigned short __ATTRS_o_ai
6592 vec_vor(vector unsigned short __a, vector unsigned short __b) {
6593   return __a | __b;
6594 }
6595
6596 static __inline__ vector unsigned short __ATTRS_o_ai
6597 vec_vor(vector bool short __a, vector unsigned short __b) {
6598   return (vector unsigned short)__a | __b;
6599 }
6600
6601 static __inline__ vector unsigned short __ATTRS_o_ai
6602 vec_vor(vector unsigned short __a, vector bool short __b) {
6603   return __a | (vector unsigned short)__b;
6604 }
6605
6606 static __inline__ vector bool short __ATTRS_o_ai
6607 vec_vor(vector bool short __a, vector bool short __b) {
6608   return __a | __b;
6609 }
6610
6611 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6612                                                   vector int __b) {
6613   return __a | __b;
6614 }
6615
6616 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
6617                                                   vector int __b) {
6618   return (vector int)__a | __b;
6619 }
6620
6621 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
6622                                                   vector bool int __b) {
6623   return __a | (vector int)__b;
6624 }
6625
6626 static __inline__ vector unsigned int __ATTRS_o_ai
6627 vec_vor(vector unsigned int __a, vector unsigned int __b) {
6628   return __a | __b;
6629 }
6630
6631 static __inline__ vector unsigned int __ATTRS_o_ai
6632 vec_vor(vector bool int __a, vector unsigned int __b) {
6633   return (vector unsigned int)__a | __b;
6634 }
6635
6636 static __inline__ vector unsigned int __ATTRS_o_ai
6637 vec_vor(vector unsigned int __a, vector bool int __b) {
6638   return __a | (vector unsigned int)__b;
6639 }
6640
6641 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
6642                                                        vector bool int __b) {
6643   return __a | __b;
6644 }
6645
6646 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6647                                                     vector float __b) {
6648   vector unsigned int __res =
6649       (vector unsigned int)__a | (vector unsigned int)__b;
6650   return (vector float)__res;
6651 }
6652
6653 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
6654                                                     vector float __b) {
6655   vector unsigned int __res =
6656       (vector unsigned int)__a | (vector unsigned int)__b;
6657   return (vector float)__res;
6658 }
6659
6660 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
6661                                                     vector bool int __b) {
6662   vector unsigned int __res =
6663       (vector unsigned int)__a | (vector unsigned int)__b;
6664   return (vector float)__res;
6665 }
6666
6667 #ifdef __VSX__
6668 static __inline__ vector signed long long __ATTRS_o_ai
6669 vec_vor(vector signed long long __a, vector signed long long __b) {
6670   return __a | __b;
6671 }
6672
6673 static __inline__ vector signed long long __ATTRS_o_ai
6674 vec_vor(vector bool long long __a, vector signed long long __b) {
6675   return (vector signed long long)__a | __b;
6676 }
6677
6678 static __inline__ vector signed long long __ATTRS_o_ai
6679 vec_vor(vector signed long long __a, vector bool long long __b) {
6680   return __a | (vector signed long long)__b;
6681 }
6682
6683 static __inline__ vector unsigned long long __ATTRS_o_ai
6684 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
6685   return __a | __b;
6686 }
6687
6688 static __inline__ vector unsigned long long __ATTRS_o_ai
6689 vec_vor(vector bool long long __a, vector unsigned long long __b) {
6690   return (vector unsigned long long)__a | __b;
6691 }
6692
6693 static __inline__ vector unsigned long long __ATTRS_o_ai
6694 vec_vor(vector unsigned long long __a, vector bool long long __b) {
6695   return __a | (vector unsigned long long)__b;
6696 }
6697
6698 static __inline__ vector bool long long __ATTRS_o_ai
6699 vec_vor(vector bool long long __a, vector bool long long __b) {
6700   return __a | __b;
6701 }
6702 #endif
6703
6704 /* vec_pack */
6705
6706 /* The various vector pack instructions have a big-endian bias, so for
6707    little endian we must handle reversed element numbering.  */
6708
6709 static __inline__ vector signed char __ATTRS_o_ai
6710 vec_pack(vector signed short __a, vector signed short __b) {
6711 #ifdef __LITTLE_ENDIAN__
6712   return (vector signed char)vec_perm(
6713       __a, __b,
6714       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6715                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6716 #else
6717   return (vector signed char)vec_perm(
6718       __a, __b,
6719       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6720                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6721 #endif
6722 }
6723
6724 static __inline__ vector unsigned char __ATTRS_o_ai
6725 vec_pack(vector unsigned short __a, vector unsigned short __b) {
6726 #ifdef __LITTLE_ENDIAN__
6727   return (vector unsigned char)vec_perm(
6728       __a, __b,
6729       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6730                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6731 #else
6732   return (vector unsigned char)vec_perm(
6733       __a, __b,
6734       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6735                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6736 #endif
6737 }
6738
6739 static __inline__ vector bool char __ATTRS_o_ai
6740 vec_pack(vector bool short __a, vector bool short __b) {
6741 #ifdef __LITTLE_ENDIAN__
6742   return (vector bool char)vec_perm(
6743       __a, __b,
6744       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6745                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6746 #else
6747   return (vector bool char)vec_perm(
6748       __a, __b,
6749       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6750                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6751 #endif
6752 }
6753
6754 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
6755                                                      vector int __b) {
6756 #ifdef __LITTLE_ENDIAN__
6757   return (vector short)vec_perm(
6758       __a, __b,
6759       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6760                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6761 #else
6762   return (vector short)vec_perm(
6763       __a, __b,
6764       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6765                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6766 #endif
6767 }
6768
6769 static __inline__ vector unsigned short __ATTRS_o_ai
6770 vec_pack(vector unsigned int __a, vector unsigned int __b) {
6771 #ifdef __LITTLE_ENDIAN__
6772   return (vector unsigned short)vec_perm(
6773       __a, __b,
6774       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6775                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6776 #else
6777   return (vector unsigned short)vec_perm(
6778       __a, __b,
6779       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6780                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6781 #endif
6782 }
6783
6784 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
6785                                                           vector bool int __b) {
6786 #ifdef __LITTLE_ENDIAN__
6787   return (vector bool short)vec_perm(
6788       __a, __b,
6789       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6790                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6791 #else
6792   return (vector bool short)vec_perm(
6793       __a, __b,
6794       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6795                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6796 #endif
6797 }
6798
6799 #ifdef __VSX__
6800 static __inline__ vector signed int __ATTRS_o_ai
6801 vec_pack(vector signed long long __a, vector signed long long __b) {
6802 #ifdef __LITTLE_ENDIAN__
6803   return (vector signed int)vec_perm(
6804       __a, __b,
6805       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6806                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6807 #else
6808   return (vector signed int)vec_perm(
6809       __a, __b,
6810       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6811                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6812 #endif
6813 }
6814 static __inline__ vector unsigned int __ATTRS_o_ai
6815 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
6816 #ifdef __LITTLE_ENDIAN__
6817   return (vector unsigned int)vec_perm(
6818       __a, __b,
6819       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6820                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6821 #else
6822   return (vector unsigned int)vec_perm(
6823       __a, __b,
6824       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6825                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6826 #endif
6827 }
6828
6829 static __inline__ vector bool int __ATTRS_o_ai
6830 vec_pack(vector bool long long __a, vector bool long long __b) {
6831 #ifdef __LITTLE_ENDIAN__
6832   return (vector bool int)vec_perm(
6833       __a, __b,
6834       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6835                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6836 #else
6837   return (vector bool int)vec_perm(
6838       __a, __b,
6839       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6840                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6841 #endif
6842 }
6843
6844 static __inline__ vector float __ATTRS_o_ai
6845 vec_pack(vector double __a, vector double __b) {
6846   return (vector float) (__a[0], __a[1], __b[0], __b[1]);
6847 }
6848 #endif
6849
6850 #ifdef __POWER9_VECTOR__
6851 static __inline__ vector unsigned short __ATTRS_o_ai
6852 vec_pack_to_short_fp32(vector float __a, vector float __b) {
6853   vector float __resa = __builtin_vsx_xvcvsphp(__a);
6854   vector float __resb = __builtin_vsx_xvcvsphp(__b);
6855 #ifdef __LITTLE_ENDIAN__
6856   return (vector unsigned short)vec_mergee(__resa, __resb);
6857 #else
6858   return (vector unsigned short)vec_mergeo(__resa, __resb);
6859 #endif
6860 }
6861
6862 #endif
6863 /* vec_vpkuhum */
6864
6865 #define __builtin_altivec_vpkuhum vec_vpkuhum
6866
6867 static __inline__ vector signed char __ATTRS_o_ai
6868 vec_vpkuhum(vector signed short __a, vector signed short __b) {
6869 #ifdef __LITTLE_ENDIAN__
6870   return (vector signed char)vec_perm(
6871       __a, __b,
6872       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6873                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6874 #else
6875   return (vector signed char)vec_perm(
6876       __a, __b,
6877       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6878                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6879 #endif
6880 }
6881
6882 static __inline__ vector unsigned char __ATTRS_o_ai
6883 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
6884 #ifdef __LITTLE_ENDIAN__
6885   return (vector unsigned char)vec_perm(
6886       __a, __b,
6887       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6888                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6889 #else
6890   return (vector unsigned char)vec_perm(
6891       __a, __b,
6892       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6893                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6894 #endif
6895 }
6896
6897 static __inline__ vector bool char __ATTRS_o_ai
6898 vec_vpkuhum(vector bool short __a, vector bool short __b) {
6899 #ifdef __LITTLE_ENDIAN__
6900   return (vector bool char)vec_perm(
6901       __a, __b,
6902       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
6903                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
6904 #else
6905   return (vector bool char)vec_perm(
6906       __a, __b,
6907       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
6908                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
6909 #endif
6910 }
6911
6912 /* vec_vpkuwum */
6913
6914 #define __builtin_altivec_vpkuwum vec_vpkuwum
6915
6916 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
6917                                                         vector int __b) {
6918 #ifdef __LITTLE_ENDIAN__
6919   return (vector short)vec_perm(
6920       __a, __b,
6921       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6922                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6923 #else
6924   return (vector short)vec_perm(
6925       __a, __b,
6926       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6927                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6928 #endif
6929 }
6930
6931 static __inline__ vector unsigned short __ATTRS_o_ai
6932 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
6933 #ifdef __LITTLE_ENDIAN__
6934   return (vector unsigned short)vec_perm(
6935       __a, __b,
6936       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6937                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6938 #else
6939   return (vector unsigned short)vec_perm(
6940       __a, __b,
6941       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6942                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6943 #endif
6944 }
6945
6946 static __inline__ vector bool short __ATTRS_o_ai
6947 vec_vpkuwum(vector bool int __a, vector bool int __b) {
6948 #ifdef __LITTLE_ENDIAN__
6949   return (vector bool short)vec_perm(
6950       __a, __b,
6951       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
6952                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
6953 #else
6954   return (vector bool short)vec_perm(
6955       __a, __b,
6956       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
6957                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
6958 #endif
6959 }
6960
6961 /* vec_vpkudum */
6962
6963 #ifdef __POWER8_VECTOR__
6964 #define __builtin_altivec_vpkudum vec_vpkudum
6965
6966 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
6967                                                       vector long long __b) {
6968 #ifdef __LITTLE_ENDIAN__
6969   return (vector int)vec_perm(
6970       __a, __b,
6971       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6972                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6973 #else
6974   return (vector int)vec_perm(
6975       __a, __b,
6976       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6977                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6978 #endif
6979 }
6980
6981 static __inline__ vector unsigned int __ATTRS_o_ai
6982 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
6983 #ifdef __LITTLE_ENDIAN__
6984   return (vector unsigned int)vec_perm(
6985       __a, __b,
6986       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
6987                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
6988 #else
6989   return (vector unsigned int)vec_perm(
6990       __a, __b,
6991       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
6992                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
6993 #endif
6994 }
6995
6996 static __inline__ vector bool int __ATTRS_o_ai
6997 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
6998 #ifdef __LITTLE_ENDIAN__
6999   return (vector bool int)vec_perm(
7000       (vector long long)__a, (vector long long)__b,
7001       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7002                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7003 #else
7004   return (vector bool int)vec_perm(
7005       (vector long long)__a, (vector long long)__b,
7006       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7007                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7008 #endif
7009 }
7010 #endif
7011
7012 /* vec_packpx */
7013
7014 static __inline__ vector pixel __attribute__((__always_inline__))
7015 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7016 #ifdef __LITTLE_ENDIAN__
7017   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7018 #else
7019   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7020 #endif
7021 }
7022
7023 /* vec_vpkpx */
7024
7025 static __inline__ vector pixel __attribute__((__always_inline__))
7026 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7027 #ifdef __LITTLE_ENDIAN__
7028   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7029 #else
7030   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7031 #endif
7032 }
7033
7034 /* vec_packs */
7035
7036 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7037                                                             vector short __b) {
7038 #ifdef __LITTLE_ENDIAN__
7039   return __builtin_altivec_vpkshss(__b, __a);
7040 #else
7041   return __builtin_altivec_vpkshss(__a, __b);
7042 #endif
7043 }
7044
7045 static __inline__ vector unsigned char __ATTRS_o_ai
7046 vec_packs(vector unsigned short __a, vector unsigned short __b) {
7047 #ifdef __LITTLE_ENDIAN__
7048   return __builtin_altivec_vpkuhus(__b, __a);
7049 #else
7050   return __builtin_altivec_vpkuhus(__a, __b);
7051 #endif
7052 }
7053
7054 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7055                                                              vector int __b) {
7056 #ifdef __LITTLE_ENDIAN__
7057   return __builtin_altivec_vpkswss(__b, __a);
7058 #else
7059   return __builtin_altivec_vpkswss(__a, __b);
7060 #endif
7061 }
7062
7063 static __inline__ vector unsigned short __ATTRS_o_ai
7064 vec_packs(vector unsigned int __a, vector unsigned int __b) {
7065 #ifdef __LITTLE_ENDIAN__
7066   return __builtin_altivec_vpkuwus(__b, __a);
7067 #else
7068   return __builtin_altivec_vpkuwus(__a, __b);
7069 #endif
7070 }
7071
7072 #ifdef __POWER8_VECTOR__
7073 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7074                                                     vector long long __b) {
7075 #ifdef __LITTLE_ENDIAN__
7076   return __builtin_altivec_vpksdss(__b, __a);
7077 #else
7078   return __builtin_altivec_vpksdss(__a, __b);
7079 #endif
7080 }
7081
7082 static __inline__ vector unsigned int __ATTRS_o_ai
7083 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7084 #ifdef __LITTLE_ENDIAN__
7085   return __builtin_altivec_vpkudus(__b, __a);
7086 #else
7087   return __builtin_altivec_vpkudus(__a, __b);
7088 #endif
7089 }
7090 #endif
7091
7092 /* vec_vpkshss */
7093
7094 static __inline__ vector signed char __attribute__((__always_inline__))
7095 vec_vpkshss(vector short __a, vector short __b) {
7096 #ifdef __LITTLE_ENDIAN__
7097   return __builtin_altivec_vpkshss(__b, __a);
7098 #else
7099   return __builtin_altivec_vpkshss(__a, __b);
7100 #endif
7101 }
7102
7103 /* vec_vpksdss */
7104
7105 #ifdef __POWER8_VECTOR__
7106 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7107                                                       vector long long __b) {
7108 #ifdef __LITTLE_ENDIAN__
7109   return __builtin_altivec_vpksdss(__b, __a);
7110 #else
7111   return __builtin_altivec_vpksdss(__a, __b);
7112 #endif
7113 }
7114 #endif
7115
7116 /* vec_vpkuhus */
7117
7118 static __inline__ vector unsigned char __attribute__((__always_inline__))
7119 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7120 #ifdef __LITTLE_ENDIAN__
7121   return __builtin_altivec_vpkuhus(__b, __a);
7122 #else
7123   return __builtin_altivec_vpkuhus(__a, __b);
7124 #endif
7125 }
7126
7127 /* vec_vpkudus */
7128
7129 #ifdef __POWER8_VECTOR__
7130 static __inline__ vector unsigned int __attribute__((__always_inline__))
7131 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7132 #ifdef __LITTLE_ENDIAN__
7133   return __builtin_altivec_vpkudus(__b, __a);
7134 #else
7135   return __builtin_altivec_vpkudus(__a, __b);
7136 #endif
7137 }
7138 #endif
7139
7140 /* vec_vpkswss */
7141
7142 static __inline__ vector signed short __attribute__((__always_inline__))
7143 vec_vpkswss(vector int __a, vector int __b) {
7144 #ifdef __LITTLE_ENDIAN__
7145   return __builtin_altivec_vpkswss(__b, __a);
7146 #else
7147   return __builtin_altivec_vpkswss(__a, __b);
7148 #endif
7149 }
7150
7151 /* vec_vpkuwus */
7152
7153 static __inline__ vector unsigned short __attribute__((__always_inline__))
7154 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7155 #ifdef __LITTLE_ENDIAN__
7156   return __builtin_altivec_vpkuwus(__b, __a);
7157 #else
7158   return __builtin_altivec_vpkuwus(__a, __b);
7159 #endif
7160 }
7161
7162 /* vec_packsu */
7163
7164 static __inline__ vector unsigned char __ATTRS_o_ai
7165 vec_packsu(vector short __a, vector short __b) {
7166 #ifdef __LITTLE_ENDIAN__
7167   return __builtin_altivec_vpkshus(__b, __a);
7168 #else
7169   return __builtin_altivec_vpkshus(__a, __b);
7170 #endif
7171 }
7172
7173 static __inline__ vector unsigned char __ATTRS_o_ai
7174 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7175 #ifdef __LITTLE_ENDIAN__
7176   return __builtin_altivec_vpkuhus(__b, __a);
7177 #else
7178   return __builtin_altivec_vpkuhus(__a, __b);
7179 #endif
7180 }
7181
7182 static __inline__ vector unsigned short __ATTRS_o_ai
7183 vec_packsu(vector int __a, vector int __b) {
7184 #ifdef __LITTLE_ENDIAN__
7185   return __builtin_altivec_vpkswus(__b, __a);
7186 #else
7187   return __builtin_altivec_vpkswus(__a, __b);
7188 #endif
7189 }
7190
7191 static __inline__ vector unsigned short __ATTRS_o_ai
7192 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7193 #ifdef __LITTLE_ENDIAN__
7194   return __builtin_altivec_vpkuwus(__b, __a);
7195 #else
7196   return __builtin_altivec_vpkuwus(__a, __b);
7197 #endif
7198 }
7199
7200 #ifdef __POWER8_VECTOR__
7201 static __inline__ vector unsigned int __ATTRS_o_ai
7202 vec_packsu(vector long long __a, vector long long __b) {
7203 #ifdef __LITTLE_ENDIAN__
7204   return __builtin_altivec_vpksdus(__b, __a);
7205 #else
7206   return __builtin_altivec_vpksdus(__a, __b);
7207 #endif
7208 }
7209
7210 static __inline__ vector unsigned int __ATTRS_o_ai
7211 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7212 #ifdef __LITTLE_ENDIAN__
7213   return __builtin_altivec_vpkudus(__b, __a);
7214 #else
7215   return __builtin_altivec_vpkudus(__a, __b);
7216 #endif
7217 }
7218 #endif
7219
7220 /* vec_vpkshus */
7221
7222 static __inline__ vector unsigned char __ATTRS_o_ai
7223 vec_vpkshus(vector short __a, vector short __b) {
7224 #ifdef __LITTLE_ENDIAN__
7225   return __builtin_altivec_vpkshus(__b, __a);
7226 #else
7227   return __builtin_altivec_vpkshus(__a, __b);
7228 #endif
7229 }
7230
7231 static __inline__ vector unsigned char __ATTRS_o_ai
7232 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7233 #ifdef __LITTLE_ENDIAN__
7234   return __builtin_altivec_vpkuhus(__b, __a);
7235 #else
7236   return __builtin_altivec_vpkuhus(__a, __b);
7237 #endif
7238 }
7239
7240 /* vec_vpkswus */
7241
7242 static __inline__ vector unsigned short __ATTRS_o_ai
7243 vec_vpkswus(vector int __a, vector int __b) {
7244 #ifdef __LITTLE_ENDIAN__
7245   return __builtin_altivec_vpkswus(__b, __a);
7246 #else
7247   return __builtin_altivec_vpkswus(__a, __b);
7248 #endif
7249 }
7250
7251 static __inline__ vector unsigned short __ATTRS_o_ai
7252 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7253 #ifdef __LITTLE_ENDIAN__
7254   return __builtin_altivec_vpkuwus(__b, __a);
7255 #else
7256   return __builtin_altivec_vpkuwus(__a, __b);
7257 #endif
7258 }
7259
7260 /* vec_vpksdus */
7261
7262 #ifdef __POWER8_VECTOR__
7263 static __inline__ vector unsigned int __ATTRS_o_ai
7264 vec_vpksdus(vector long long __a, vector long long __b) {
7265 #ifdef __LITTLE_ENDIAN__
7266   return __builtin_altivec_vpksdus(__b, __a);
7267 #else
7268   return __builtin_altivec_vpksdus(__a, __b);
7269 #endif
7270 }
7271 #endif
7272
7273 /* vec_perm */
7274
7275 // The vperm instruction is defined architecturally with a big-endian bias.
7276 // For little endian, we swap the input operands and invert the permute
7277 // control vector.  Only the rightmost 5 bits matter, so we could use
7278 // a vector of all 31s instead of all 255s to perform the inversion.
7279 // However, when the PCV is not a constant, using 255 has an advantage
7280 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
7281 // later, possibly a vec_nand).
7282
7283 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7284     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7285 #ifdef __LITTLE_ENDIAN__
7286   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7287                               255, 255, 255, 255, 255, 255, 255, 255};
7288   __d = vec_xor(__c, __d);
7289   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7290                                                          (vector int)__a, __d);
7291 #else
7292   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7293                                                          (vector int)__b, __c);
7294 #endif
7295 }
7296
7297 static __inline__ vector unsigned char __ATTRS_o_ai
7298 vec_perm(vector unsigned char __a, vector unsigned char __b,
7299          vector unsigned char __c) {
7300 #ifdef __LITTLE_ENDIAN__
7301   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7302                               255, 255, 255, 255, 255, 255, 255, 255};
7303   __d = vec_xor(__c, __d);
7304   return (vector unsigned char)__builtin_altivec_vperm_4si(
7305       (vector int)__b, (vector int)__a, __d);
7306 #else
7307   return (vector unsigned char)__builtin_altivec_vperm_4si(
7308       (vector int)__a, (vector int)__b, __c);
7309 #endif
7310 }
7311
7312 static __inline__ vector bool char __ATTRS_o_ai
7313 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7314 #ifdef __LITTLE_ENDIAN__
7315   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7316                               255, 255, 255, 255, 255, 255, 255, 255};
7317   __d = vec_xor(__c, __d);
7318   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7319                                                        (vector int)__a, __d);
7320 #else
7321   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
7322                                                        (vector int)__b, __c);
7323 #endif
7324 }
7325
7326 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
7327                                                      vector signed short __b,
7328                                                      vector unsigned char __c) {
7329 #ifdef __LITTLE_ENDIAN__
7330   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7331                               255, 255, 255, 255, 255, 255, 255, 255};
7332   __d = vec_xor(__c, __d);
7333   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
7334                                                           (vector int)__a, __d);
7335 #else
7336   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
7337                                                           (vector int)__b, __c);
7338 #endif
7339 }
7340
7341 static __inline__ vector unsigned short __ATTRS_o_ai
7342 vec_perm(vector unsigned short __a, vector unsigned short __b,
7343          vector unsigned char __c) {
7344 #ifdef __LITTLE_ENDIAN__
7345   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7346                               255, 255, 255, 255, 255, 255, 255, 255};
7347   __d = vec_xor(__c, __d);
7348   return (vector unsigned short)__builtin_altivec_vperm_4si(
7349       (vector int)__b, (vector int)__a, __d);
7350 #else
7351   return (vector unsigned short)__builtin_altivec_vperm_4si(
7352       (vector int)__a, (vector int)__b, __c);
7353 #endif
7354 }
7355
7356 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
7357     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7358 #ifdef __LITTLE_ENDIAN__
7359   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7360                               255, 255, 255, 255, 255, 255, 255, 255};
7361   __d = vec_xor(__c, __d);
7362   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
7363                                                         (vector int)__a, __d);
7364 #else
7365   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
7366                                                         (vector int)__b, __c);
7367 #endif
7368 }
7369
7370 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
7371                                                      vector pixel __b,
7372                                                      vector unsigned char __c) {
7373 #ifdef __LITTLE_ENDIAN__
7374   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7375                               255, 255, 255, 255, 255, 255, 255, 255};
7376   __d = vec_xor(__c, __d);
7377   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
7378                                                    (vector int)__a, __d);
7379 #else
7380   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
7381                                                    (vector int)__b, __c);
7382 #endif
7383 }
7384
7385 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
7386                                                    vector signed int __b,
7387                                                    vector unsigned char __c) {
7388 #ifdef __LITTLE_ENDIAN__
7389   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7390                               255, 255, 255, 255, 255, 255, 255, 255};
7391   __d = vec_xor(__c, __d);
7392   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
7393 #else
7394   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
7395 #endif
7396 }
7397
7398 static __inline__ vector unsigned int __ATTRS_o_ai
7399 vec_perm(vector unsigned int __a, vector unsigned int __b,
7400          vector unsigned char __c) {
7401 #ifdef __LITTLE_ENDIAN__
7402   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7403                               255, 255, 255, 255, 255, 255, 255, 255};
7404   __d = vec_xor(__c, __d);
7405   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
7406                                                           (vector int)__a, __d);
7407 #else
7408   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
7409                                                           (vector int)__b, __c);
7410 #endif
7411 }
7412
7413 static __inline__ vector bool int __ATTRS_o_ai
7414 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7415 #ifdef __LITTLE_ENDIAN__
7416   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7417                               255, 255, 255, 255, 255, 255, 255, 255};
7418   __d = vec_xor(__c, __d);
7419   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
7420                                                       (vector int)__a, __d);
7421 #else
7422   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
7423                                                       (vector int)__b, __c);
7424 #endif
7425 }
7426
7427 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
7428                                                      vector float __b,
7429                                                      vector unsigned char __c) {
7430 #ifdef __LITTLE_ENDIAN__
7431   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7432                               255, 255, 255, 255, 255, 255, 255, 255};
7433   __d = vec_xor(__c, __d);
7434   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
7435                                                    (vector int)__a, __d);
7436 #else
7437   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
7438                                                    (vector int)__b, __c);
7439 #endif
7440 }
7441
7442 #ifdef __VSX__
7443 static __inline__ vector long long __ATTRS_o_ai
7444 vec_perm(vector signed long long __a, vector signed long long __b,
7445          vector unsigned char __c) {
7446 #ifdef __LITTLE_ENDIAN__
7447   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7448                               255, 255, 255, 255, 255, 255, 255, 255};
7449   __d = vec_xor(__c, __d);
7450   return (vector signed long long)__builtin_altivec_vperm_4si(
7451       (vector int)__b, (vector int)__a, __d);
7452 #else
7453   return (vector signed long long)__builtin_altivec_vperm_4si(
7454       (vector int)__a, (vector int)__b, __c);
7455 #endif
7456 }
7457
7458 static __inline__ vector unsigned long long __ATTRS_o_ai
7459 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
7460          vector unsigned char __c) {
7461 #ifdef __LITTLE_ENDIAN__
7462   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7463                               255, 255, 255, 255, 255, 255, 255, 255};
7464   __d = vec_xor(__c, __d);
7465   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7466       (vector int)__b, (vector int)__a, __d);
7467 #else
7468   return (vector unsigned long long)__builtin_altivec_vperm_4si(
7469       (vector int)__a, (vector int)__b, __c);
7470 #endif
7471 }
7472
7473 static __inline__ vector bool long long __ATTRS_o_ai
7474 vec_perm(vector bool long long __a, vector bool long long __b,
7475          vector unsigned char __c) {
7476 #ifdef __LITTLE_ENDIAN__
7477   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7478                               255, 255, 255, 255, 255, 255, 255, 255};
7479   __d = vec_xor(__c, __d);
7480   return (vector bool long long)__builtin_altivec_vperm_4si(
7481       (vector int)__b, (vector int)__a, __d);
7482 #else
7483   return (vector bool long long)__builtin_altivec_vperm_4si(
7484       (vector int)__a, (vector int)__b, __c);
7485 #endif
7486 }
7487
7488 static __inline__ vector double __ATTRS_o_ai
7489 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
7490 #ifdef __LITTLE_ENDIAN__
7491   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7492                               255, 255, 255, 255, 255, 255, 255, 255};
7493   __d = vec_xor(__c, __d);
7494   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
7495                                                     (vector int)__a, __d);
7496 #else
7497   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
7498                                                     (vector int)__b, __c);
7499 #endif
7500 }
7501 #endif
7502
7503 /* vec_vperm */
7504
7505 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
7506     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7507   return vec_perm(__a, __b, __c);
7508 }
7509
7510 static __inline__ vector unsigned char __ATTRS_o_ai
7511 vec_vperm(vector unsigned char __a, vector unsigned char __b,
7512           vector unsigned char __c) {
7513   return vec_perm(__a, __b, __c);
7514 }
7515
7516 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
7517     vector bool char __a, vector bool char __b, vector unsigned char __c) {
7518   return vec_perm(__a, __b, __c);
7519 }
7520
7521 static __inline__ vector short __ATTRS_o_ai
7522 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
7523   return vec_perm(__a, __b, __c);
7524 }
7525
7526 static __inline__ vector unsigned short __ATTRS_o_ai
7527 vec_vperm(vector unsigned short __a, vector unsigned short __b,
7528           vector unsigned char __c) {
7529   return vec_perm(__a, __b, __c);
7530 }
7531
7532 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
7533     vector bool short __a, vector bool short __b, vector unsigned char __c) {
7534   return vec_perm(__a, __b, __c);
7535 }
7536
7537 static __inline__ vector pixel __ATTRS_o_ai
7538 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
7539   return vec_perm(__a, __b, __c);
7540 }
7541
7542 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
7543                                                     vector int __b,
7544                                                     vector unsigned char __c) {
7545   return vec_perm(__a, __b, __c);
7546 }
7547
7548 static __inline__ vector unsigned int __ATTRS_o_ai
7549 vec_vperm(vector unsigned int __a, vector unsigned int __b,
7550           vector unsigned char __c) {
7551   return vec_perm(__a, __b, __c);
7552 }
7553
7554 static __inline__ vector bool int __ATTRS_o_ai
7555 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
7556   return vec_perm(__a, __b, __c);
7557 }
7558
7559 static __inline__ vector float __ATTRS_o_ai
7560 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
7561   return vec_perm(__a, __b, __c);
7562 }
7563
7564 #ifdef __VSX__
7565 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
7566     vector long long __a, vector long long __b, vector unsigned char __c) {
7567   return vec_perm(__a, __b, __c);
7568 }
7569
7570 static __inline__ vector unsigned long long __ATTRS_o_ai
7571 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
7572           vector unsigned char __c) {
7573   return vec_perm(__a, __b, __c);
7574 }
7575
7576 static __inline__ vector double __ATTRS_o_ai
7577 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
7578   return vec_perm(__a, __b, __c);
7579 }
7580 #endif
7581
7582 /* vec_re */
7583
7584 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
7585 #ifdef __VSX__
7586   return __builtin_vsx_xvresp(__a);
7587 #else
7588   return __builtin_altivec_vrefp(__a);
7589 #endif
7590 }
7591
7592 #ifdef __VSX__
7593 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
7594   return __builtin_vsx_xvredp(__a);
7595 }
7596 #endif
7597
7598 /* vec_vrefp */
7599
7600 static __inline__ vector float __attribute__((__always_inline__))
7601 vec_vrefp(vector float __a) {
7602   return __builtin_altivec_vrefp(__a);
7603 }
7604
7605 /* vec_rl */
7606
7607 static __inline__ vector signed char __ATTRS_o_ai
7608 vec_rl(vector signed char __a, vector unsigned char __b) {
7609   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7610 }
7611
7612 static __inline__ vector unsigned char __ATTRS_o_ai
7613 vec_rl(vector unsigned char __a, vector unsigned char __b) {
7614   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7615 }
7616
7617 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
7618                                                    vector unsigned short __b) {
7619   return __builtin_altivec_vrlh(__a, __b);
7620 }
7621
7622 static __inline__ vector unsigned short __ATTRS_o_ai
7623 vec_rl(vector unsigned short __a, vector unsigned short __b) {
7624   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7625 }
7626
7627 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
7628                                                  vector unsigned int __b) {
7629   return __builtin_altivec_vrlw(__a, __b);
7630 }
7631
7632 static __inline__ vector unsigned int __ATTRS_o_ai
7633 vec_rl(vector unsigned int __a, vector unsigned int __b) {
7634   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7635 }
7636
7637 #ifdef __POWER8_VECTOR__
7638 static __inline__ vector signed long long __ATTRS_o_ai
7639 vec_rl(vector signed long long __a, vector unsigned long long __b) {
7640   return __builtin_altivec_vrld(__a, __b);
7641 }
7642
7643 static __inline__ vector unsigned long long __ATTRS_o_ai
7644 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
7645   return __builtin_altivec_vrld(__a, __b);
7646 }
7647 #endif
7648
7649 /* vec_rlmi */
7650 #ifdef __POWER9_VECTOR__
7651 static __inline__ vector unsigned int __ATTRS_o_ai
7652 vec_rlmi(vector unsigned int __a, vector unsigned int __b,
7653          vector unsigned int __c) {
7654   return __builtin_altivec_vrlwmi(__a, __c, __b);
7655 }
7656
7657 static __inline__ vector unsigned long long __ATTRS_o_ai
7658 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
7659          vector unsigned long long __c) {
7660   return __builtin_altivec_vrldmi(__a, __c, __b);
7661 }
7662
7663 /* vec_rlnm */
7664 static __inline__ vector unsigned int __ATTRS_o_ai
7665 vec_rlnm(vector unsigned int __a, vector unsigned int __b,
7666          vector unsigned int __c) {
7667   vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
7668   return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
7669 }
7670
7671 static __inline__ vector unsigned long long __ATTRS_o_ai
7672 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7673          vector unsigned long long __c) {
7674   vector unsigned long long OneByte = { 0x8, 0x8 };
7675   return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
7676 }
7677 #endif
7678
7679 /* vec_vrlb */
7680
7681 static __inline__ vector signed char __ATTRS_o_ai
7682 vec_vrlb(vector signed char __a, vector unsigned char __b) {
7683   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7684 }
7685
7686 static __inline__ vector unsigned char __ATTRS_o_ai
7687 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7688   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7689 }
7690
7691 /* vec_vrlh */
7692
7693 static __inline__ vector short __ATTRS_o_ai
7694 vec_vrlh(vector short __a, vector unsigned short __b) {
7695   return __builtin_altivec_vrlh(__a, __b);
7696 }
7697
7698 static __inline__ vector unsigned short __ATTRS_o_ai
7699 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7700   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7701 }
7702
7703 /* vec_vrlw */
7704
7705 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7706                                                    vector unsigned int __b) {
7707   return __builtin_altivec_vrlw(__a, __b);
7708 }
7709
7710 static __inline__ vector unsigned int __ATTRS_o_ai
7711 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7712   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7713 }
7714
7715 /* vec_round */
7716
7717 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7718 #ifdef __VSX__
7719   return __builtin_vsx_xvrspi(__a);
7720 #else
7721   return __builtin_altivec_vrfin(__a);
7722 #endif
7723 }
7724
7725 #ifdef __VSX__
7726 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7727   return __builtin_vsx_xvrdpi(__a);
7728 }
7729
7730 /* vec_rint */
7731
7732 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7733   return __builtin_vsx_xvrspic(__a);
7734 }
7735
7736 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7737   return __builtin_vsx_xvrdpic(__a);
7738 }
7739
7740 /* vec_nearbyint */
7741
7742 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7743   return __builtin_vsx_xvrspi(__a);
7744 }
7745
7746 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7747   return __builtin_vsx_xvrdpi(__a);
7748 }
7749 #endif
7750
7751 /* vec_vrfin */
7752
7753 static __inline__ vector float __attribute__((__always_inline__))
7754 vec_vrfin(vector float __a) {
7755   return __builtin_altivec_vrfin(__a);
7756 }
7757
7758 /* vec_sqrt */
7759
7760 #ifdef __VSX__
7761 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7762   return __builtin_vsx_xvsqrtsp(__a);
7763 }
7764
7765 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7766   return __builtin_vsx_xvsqrtdp(__a);
7767 }
7768 #endif
7769
7770 /* vec_rsqrte */
7771
7772 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7773 #ifdef __VSX__
7774   return __builtin_vsx_xvrsqrtesp(__a);
7775 #else
7776   return __builtin_altivec_vrsqrtefp(__a);
7777 #endif
7778 }
7779
7780 #ifdef __VSX__
7781 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7782   return __builtin_vsx_xvrsqrtedp(__a);
7783 }
7784 #endif
7785
7786 /* vec_vrsqrtefp */
7787
7788 static __inline__ __vector float __attribute__((__always_inline__))
7789 vec_vrsqrtefp(vector float __a) {
7790   return __builtin_altivec_vrsqrtefp(__a);
7791 }
7792
7793 /* vec_sel */
7794
7795 #define __builtin_altivec_vsel_4si vec_sel
7796
7797 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7798     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7799   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7800 }
7801
7802 static __inline__ vector signed char __ATTRS_o_ai
7803 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7804   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7805 }
7806
7807 static __inline__ vector unsigned char __ATTRS_o_ai
7808 vec_sel(vector unsigned char __a, vector unsigned char __b,
7809         vector unsigned char __c) {
7810   return (__a & ~__c) | (__b & __c);
7811 }
7812
7813 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7814     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7815   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7816 }
7817
7818 static __inline__ vector bool char __ATTRS_o_ai
7819 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7820   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7821 }
7822
7823 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7824                                                         vector bool char __b,
7825                                                         vector bool char __c) {
7826   return (__a & ~__c) | (__b & __c);
7827 }
7828
7829 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7830                                                     vector short __b,
7831                                                     vector unsigned short __c) {
7832   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7833 }
7834
7835 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7836                                                     vector short __b,
7837                                                     vector bool short __c) {
7838   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7839 }
7840
7841 static __inline__ vector unsigned short __ATTRS_o_ai
7842 vec_sel(vector unsigned short __a, vector unsigned short __b,
7843         vector unsigned short __c) {
7844   return (__a & ~__c) | (__b & __c);
7845 }
7846
7847 static __inline__ vector unsigned short __ATTRS_o_ai
7848 vec_sel(vector unsigned short __a, vector unsigned short __b,
7849         vector bool short __c) {
7850   return (__a & ~(vector unsigned short)__c) |
7851          (__b & (vector unsigned short)__c);
7852 }
7853
7854 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7855     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7856   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7857 }
7858
7859 static __inline__ vector bool short __ATTRS_o_ai
7860 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7861   return (__a & ~__c) | (__b & __c);
7862 }
7863
7864 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7865                                                   vector int __b,
7866                                                   vector unsigned int __c) {
7867   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7868 }
7869
7870 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7871                                                   vector int __b,
7872                                                   vector bool int __c) {
7873   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7874 }
7875
7876 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7877     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7878   return (__a & ~__c) | (__b & __c);
7879 }
7880
7881 static __inline__ vector unsigned int __ATTRS_o_ai
7882 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7883   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7884 }
7885
7886 static __inline__ vector bool int __ATTRS_o_ai
7887 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7888   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7889 }
7890
7891 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7892                                                        vector bool int __b,
7893                                                        vector bool int __c) {
7894   return (__a & ~__c) | (__b & __c);
7895 }
7896
7897 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7898                                                     vector float __b,
7899                                                     vector unsigned int __c) {
7900   vector int __res = ((vector int)__a & ~(vector int)__c) |
7901                      ((vector int)__b & (vector int)__c);
7902   return (vector float)__res;
7903 }
7904
7905 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7906                                                     vector float __b,
7907                                                     vector bool int __c) {
7908   vector int __res = ((vector int)__a & ~(vector int)__c) |
7909                      ((vector int)__b & (vector int)__c);
7910   return (vector float)__res;
7911 }
7912
7913 #ifdef __VSX__
7914 static __inline__ vector double __ATTRS_o_ai
7915 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7916   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7917                            ((vector long long)__b & (vector long long)__c);
7918   return (vector double)__res;
7919 }
7920
7921 static __inline__ vector double __ATTRS_o_ai
7922 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7923   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7924                            ((vector long long)__b & (vector long long)__c);
7925   return (vector double)__res;
7926 }
7927 #endif
7928
7929 /* vec_vsel */
7930
7931 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7932     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7933   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7934 }
7935
7936 static __inline__ vector signed char __ATTRS_o_ai
7937 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7938   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7939 }
7940
7941 static __inline__ vector unsigned char __ATTRS_o_ai
7942 vec_vsel(vector unsigned char __a, vector unsigned char __b,
7943          vector unsigned char __c) {
7944   return (__a & ~__c) | (__b & __c);
7945 }
7946
7947 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7948     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7949   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7950 }
7951
7952 static __inline__ vector bool char __ATTRS_o_ai
7953 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7954   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7955 }
7956
7957 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7958                                                          vector bool char __b,
7959                                                          vector bool char __c) {
7960   return (__a & ~__c) | (__b & __c);
7961 }
7962
7963 static __inline__ vector short __ATTRS_o_ai
7964 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7965   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7966 }
7967
7968 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7969                                                      vector short __b,
7970                                                      vector bool short __c) {
7971   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7972 }
7973
7974 static __inline__ vector unsigned short __ATTRS_o_ai
7975 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7976          vector unsigned short __c) {
7977   return (__a & ~__c) | (__b & __c);
7978 }
7979
7980 static __inline__ vector unsigned short __ATTRS_o_ai
7981 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7982          vector bool short __c) {
7983   return (__a & ~(vector unsigned short)__c) |
7984          (__b & (vector unsigned short)__c);
7985 }
7986
7987 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7988     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7989   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7990 }
7991
7992 static __inline__ vector bool short __ATTRS_o_ai
7993 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7994   return (__a & ~__c) | (__b & __c);
7995 }
7996
7997 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7998                                                    vector int __b,
7999                                                    vector unsigned int __c) {
8000   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8001 }
8002
8003 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8004                                                    vector int __b,
8005                                                    vector bool int __c) {
8006   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8007 }
8008
8009 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8010     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8011   return (__a & ~__c) | (__b & __c);
8012 }
8013
8014 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8015     vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8016   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8017 }
8018
8019 static __inline__ vector bool int __ATTRS_o_ai
8020 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8021   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8022 }
8023
8024 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8025                                                         vector bool int __b,
8026                                                         vector bool int __c) {
8027   return (__a & ~__c) | (__b & __c);
8028 }
8029
8030 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8031                                                      vector float __b,
8032                                                      vector unsigned int __c) {
8033   vector int __res = ((vector int)__a & ~(vector int)__c) |
8034                      ((vector int)__b & (vector int)__c);
8035   return (vector float)__res;
8036 }
8037
8038 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8039                                                      vector float __b,
8040                                                      vector bool int __c) {
8041   vector int __res = ((vector int)__a & ~(vector int)__c) |
8042                      ((vector int)__b & (vector int)__c);
8043   return (vector float)__res;
8044 }
8045
8046 /* vec_sl */
8047
8048 static __inline__ vector signed char __ATTRS_o_ai
8049 vec_sl(vector signed char __a, vector unsigned char __b) {
8050   return __a << (vector signed char)__b;
8051 }
8052
8053 static __inline__ vector unsigned char __ATTRS_o_ai
8054 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8055   return __a << __b;
8056 }
8057
8058 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8059                                                    vector unsigned short __b) {
8060   return __a << (vector short)__b;
8061 }
8062
8063 static __inline__ vector unsigned short __ATTRS_o_ai
8064 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8065   return __a << __b;
8066 }
8067
8068 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8069                                                  vector unsigned int __b) {
8070   return __a << (vector int)__b;
8071 }
8072
8073 static __inline__ vector unsigned int __ATTRS_o_ai
8074 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8075   return __a << __b;
8076 }
8077
8078 #ifdef __POWER8_VECTOR__
8079 static __inline__ vector signed long long __ATTRS_o_ai
8080 vec_sl(vector signed long long __a, vector unsigned long long __b) {
8081   return __a << (vector long long)__b;
8082 }
8083
8084 static __inline__ vector unsigned long long __ATTRS_o_ai
8085 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8086   return __a << __b;
8087 }
8088 #endif
8089
8090 /* vec_vslb */
8091
8092 #define __builtin_altivec_vslb vec_vslb
8093
8094 static __inline__ vector signed char __ATTRS_o_ai
8095 vec_vslb(vector signed char __a, vector unsigned char __b) {
8096   return vec_sl(__a, __b);
8097 }
8098
8099 static __inline__ vector unsigned char __ATTRS_o_ai
8100 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8101   return vec_sl(__a, __b);
8102 }
8103
8104 /* vec_vslh */
8105
8106 #define __builtin_altivec_vslh vec_vslh
8107
8108 static __inline__ vector short __ATTRS_o_ai
8109 vec_vslh(vector short __a, vector unsigned short __b) {
8110   return vec_sl(__a, __b);
8111 }
8112
8113 static __inline__ vector unsigned short __ATTRS_o_ai
8114 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8115   return vec_sl(__a, __b);
8116 }
8117
8118 /* vec_vslw */
8119
8120 #define __builtin_altivec_vslw vec_vslw
8121
8122 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8123                                                    vector unsigned int __b) {
8124   return vec_sl(__a, __b);
8125 }
8126
8127 static __inline__ vector unsigned int __ATTRS_o_ai
8128 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8129   return vec_sl(__a, __b);
8130 }
8131
8132 /* vec_sld */
8133
8134 #define __builtin_altivec_vsldoi_4si vec_sld
8135
8136 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8137     vector signed char __a, vector signed char __b, unsigned const int __c) {
8138   unsigned char __d = __c & 0x0F;
8139 #ifdef __LITTLE_ENDIAN__
8140   return vec_perm(
8141       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8142                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8143                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8144                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8145 #else
8146   return vec_perm(
8147       __a, __b,
8148       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8149                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8150                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8151 #endif
8152 }
8153
8154 static __inline__ vector unsigned char __ATTRS_o_ai
8155 vec_sld(vector unsigned char __a, vector unsigned char __b,
8156         unsigned const int __c) {
8157   unsigned char __d = __c & 0x0F;
8158 #ifdef __LITTLE_ENDIAN__
8159   return vec_perm(
8160       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8161                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8162                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8163                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8164 #else
8165   return vec_perm(
8166       __a, __b,
8167       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8168                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8169                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8170 #endif
8171 }
8172
8173 static __inline__ vector bool char __ATTRS_o_ai
8174 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8175   unsigned char __d = __c & 0x0F;
8176 #ifdef __LITTLE_ENDIAN__
8177   return vec_perm(
8178       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8179                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8180                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8181                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8182 #else
8183   return vec_perm(
8184       __a, __b,
8185       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8186                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8187                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8188 #endif
8189 }
8190
8191 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8192     vector signed short __a, vector signed short __b, unsigned const int __c) {
8193   unsigned char __d = __c & 0x0F;
8194 #ifdef __LITTLE_ENDIAN__
8195   return vec_perm(
8196       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8197                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8198                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8199                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8200 #else
8201   return vec_perm(
8202       __a, __b,
8203       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8204                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8205                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8206 #endif
8207 }
8208
8209 static __inline__ vector unsigned short __ATTRS_o_ai
8210 vec_sld(vector unsigned short __a, vector unsigned short __b,
8211         unsigned const int __c) {
8212   unsigned char __d = __c & 0x0F;
8213 #ifdef __LITTLE_ENDIAN__
8214   return vec_perm(
8215       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8216                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8217                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8218                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8219 #else
8220   return vec_perm(
8221       __a, __b,
8222       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8223                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8224                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8225 #endif
8226 }
8227
8228 static __inline__ vector bool short __ATTRS_o_ai
8229 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8230   unsigned char __d = __c & 0x0F;
8231 #ifdef __LITTLE_ENDIAN__
8232   return vec_perm(
8233       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8234                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8235                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8236                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8237 #else
8238   return vec_perm(
8239       __a, __b,
8240       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8241                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8242                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8243 #endif
8244 }
8245
8246 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8247                                                     vector pixel __b,
8248                                                     unsigned const int __c) {
8249   unsigned char __d = __c & 0x0F;
8250 #ifdef __LITTLE_ENDIAN__
8251   return vec_perm(
8252       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8253                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8254                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8255                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8256 #else
8257   return vec_perm(
8258       __a, __b,
8259       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8260                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8261                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8262 #endif
8263 }
8264
8265 static __inline__ vector signed int __ATTRS_o_ai
8266 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8267   unsigned char __d = __c & 0x0F;
8268 #ifdef __LITTLE_ENDIAN__
8269   return vec_perm(
8270       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8271                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8272                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8273                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8274 #else
8275   return vec_perm(
8276       __a, __b,
8277       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8278                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8279                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8280 #endif
8281 }
8282
8283 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8284     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8285   unsigned char __d = __c & 0x0F;
8286 #ifdef __LITTLE_ENDIAN__
8287   return vec_perm(
8288       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8289                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8290                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8291                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8292 #else
8293   return vec_perm(
8294       __a, __b,
8295       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8296                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8297                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8298 #endif
8299 }
8300
8301 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8302                                                        vector bool int __b,
8303                                                        unsigned const int __c) {
8304   unsigned char __d = __c & 0x0F;
8305 #ifdef __LITTLE_ENDIAN__
8306   return vec_perm(
8307       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8308                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8309                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8310                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8311 #else
8312   return vec_perm(
8313       __a, __b,
8314       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8315                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8316                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8317 #endif
8318 }
8319
8320 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8321                                                     vector float __b,
8322                                                     unsigned const int __c) {
8323   unsigned char __d = __c & 0x0F;
8324 #ifdef __LITTLE_ENDIAN__
8325   return vec_perm(
8326       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8327                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8328                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8329                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8330 #else
8331   return vec_perm(
8332       __a, __b,
8333       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8334                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8335                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8336 #endif
8337 }
8338
8339 #ifdef __VSX__
8340 static __inline__ vector bool long long __ATTRS_o_ai
8341 vec_sld(vector bool long long __a, vector bool long long __b,
8342         unsigned const int __c) {
8343   unsigned char __d = __c & 0x0F;
8344 #ifdef __LITTLE_ENDIAN__
8345   return vec_perm(
8346       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8347                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8348                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8349                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8350 #else
8351   return vec_perm(
8352       __a, __b,
8353       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8354                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8355                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8356 #endif
8357 }
8358
8359 static __inline__ vector signed long long __ATTRS_o_ai
8360 vec_sld(vector signed long long __a, vector signed long long __b,
8361         unsigned const int __c) {
8362   unsigned char __d = __c & 0x0F;
8363 #ifdef __LITTLE_ENDIAN__
8364   return vec_perm(
8365       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8366                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8367                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8368                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8369 #else
8370   return vec_perm(
8371       __a, __b,
8372       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8373                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8374                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8375 #endif
8376 }
8377
8378 static __inline__ vector unsigned long long __ATTRS_o_ai
8379 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8380         unsigned const int __c) {
8381   unsigned char __d = __c & 0x0F;
8382 #ifdef __LITTLE_ENDIAN__
8383   return vec_perm(
8384       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8385                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8386                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8387                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8388 #else
8389   return vec_perm(
8390       __a, __b,
8391       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8392                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8393                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8394 #endif
8395 }
8396
8397 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8398                                                      vector double __b,
8399                                                      unsigned const int __c) {
8400   unsigned char __d = __c & 0x0F;
8401 #ifdef __LITTLE_ENDIAN__
8402   return vec_perm(
8403       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8404                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8405                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8406                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8407 #else
8408   return vec_perm(
8409       __a, __b,
8410       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8411                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8412                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8413 #endif
8414 }
8415 #endif
8416
8417 /* vec_sldw */
8418 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8419     vector signed char __a, vector signed char __b, unsigned const int __c) {
8420   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8421 }
8422
8423 static __inline__ vector unsigned char __ATTRS_o_ai
8424 vec_sldw(vector unsigned char __a, vector unsigned char __b,
8425          unsigned const int __c) {
8426   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8427 }
8428
8429 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8430     vector signed short __a, vector signed short __b, unsigned const int __c) {
8431   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8432 }
8433
8434 static __inline__ vector unsigned short __ATTRS_o_ai
8435 vec_sldw(vector unsigned short __a, vector unsigned short __b,
8436          unsigned const int __c) {
8437   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8438 }
8439
8440 static __inline__ vector signed int __ATTRS_o_ai
8441 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8442   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8443 }
8444
8445 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8446     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8447   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8448 }
8449
8450 #ifdef __VSX__
8451 static __inline__ vector signed long long __ATTRS_o_ai
8452 vec_sldw(vector signed long long __a, vector signed long long __b,
8453          unsigned const int __c) {
8454   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8455 }
8456
8457 static __inline__ vector unsigned long long __ATTRS_o_ai
8458 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8459          unsigned const int __c) {
8460   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8461 }
8462 #endif
8463
8464 #ifdef __POWER9_VECTOR__
8465 /* vec_slv */
8466 static __inline__ vector unsigned char __ATTRS_o_ai
8467 vec_slv(vector unsigned char __a, vector unsigned char __b) {
8468   return __builtin_altivec_vslv(__a, __b);
8469 }
8470
8471 /* vec_srv */
8472 static __inline__ vector unsigned char __ATTRS_o_ai
8473 vec_srv(vector unsigned char __a, vector unsigned char __b) {
8474   return __builtin_altivec_vsrv(__a, __b);
8475 }
8476 #endif
8477
8478 /* vec_vsldoi */
8479
8480 static __inline__ vector signed char __ATTRS_o_ai
8481 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8482   unsigned char __d = __c & 0x0F;
8483 #ifdef __LITTLE_ENDIAN__
8484   return vec_perm(
8485       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8486                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8487                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8488                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8489 #else
8490   return vec_perm(
8491       __a, __b,
8492       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8493                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8494                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8495 #endif
8496 }
8497
8498 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8499     vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8500   unsigned char __d = __c & 0x0F;
8501 #ifdef __LITTLE_ENDIAN__
8502   return vec_perm(
8503       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8504                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8505                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8506                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8507 #else
8508   return vec_perm(
8509       __a, __b,
8510       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8511                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8512                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8513 #endif
8514 }
8515
8516 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8517                                                        vector short __b,
8518                                                        unsigned char __c) {
8519   unsigned char __d = __c & 0x0F;
8520 #ifdef __LITTLE_ENDIAN__
8521   return vec_perm(
8522       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8523                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8524                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8525                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8526 #else
8527   return vec_perm(
8528       __a, __b,
8529       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8530                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8531                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8532 #endif
8533 }
8534
8535 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8536     vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8537   unsigned char __d = __c & 0x0F;
8538 #ifdef __LITTLE_ENDIAN__
8539   return vec_perm(
8540       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8541                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8542                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8543                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8544 #else
8545   return vec_perm(
8546       __a, __b,
8547       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8548                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8549                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8550 #endif
8551 }
8552
8553 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8554                                                        vector pixel __b,
8555                                                        unsigned char __c) {
8556   unsigned char __d = __c & 0x0F;
8557 #ifdef __LITTLE_ENDIAN__
8558   return vec_perm(
8559       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8560                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8561                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8562                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8563 #else
8564   return vec_perm(
8565       __a, __b,
8566       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8567                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8568                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8569 #endif
8570 }
8571
8572 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8573                                                      vector int __b,
8574                                                      unsigned char __c) {
8575   unsigned char __d = __c & 0x0F;
8576 #ifdef __LITTLE_ENDIAN__
8577   return vec_perm(
8578       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8579                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8580                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8581                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8582 #else
8583   return vec_perm(
8584       __a, __b,
8585       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8586                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8587                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8588 #endif
8589 }
8590
8591 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8592     vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8593   unsigned char __d = __c & 0x0F;
8594 #ifdef __LITTLE_ENDIAN__
8595   return vec_perm(
8596       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8597                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8598                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8599                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8600 #else
8601   return vec_perm(
8602       __a, __b,
8603       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8604                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8605                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8606 #endif
8607 }
8608
8609 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8610                                                        vector float __b,
8611                                                        unsigned char __c) {
8612   unsigned char __d = __c & 0x0F;
8613 #ifdef __LITTLE_ENDIAN__
8614   return vec_perm(
8615       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8616                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8617                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8618                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8619 #else
8620   return vec_perm(
8621       __a, __b,
8622       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8623                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8624                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8625 #endif
8626 }
8627
8628 /* vec_sll */
8629
8630 static __inline__ vector signed char __ATTRS_o_ai
8631 vec_sll(vector signed char __a, vector unsigned char __b) {
8632   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8633                                                    (vector int)__b);
8634 }
8635
8636 static __inline__ vector signed char __ATTRS_o_ai
8637 vec_sll(vector signed char __a, vector unsigned short __b) {
8638   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8639                                                    (vector int)__b);
8640 }
8641
8642 static __inline__ vector signed char __ATTRS_o_ai
8643 vec_sll(vector signed char __a, vector unsigned int __b) {
8644   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8645                                                    (vector int)__b);
8646 }
8647
8648 static __inline__ vector unsigned char __ATTRS_o_ai
8649 vec_sll(vector unsigned char __a, vector unsigned char __b) {
8650   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8651                                                      (vector int)__b);
8652 }
8653
8654 static __inline__ vector unsigned char __ATTRS_o_ai
8655 vec_sll(vector unsigned char __a, vector unsigned short __b) {
8656   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8657                                                      (vector int)__b);
8658 }
8659
8660 static __inline__ vector unsigned char __ATTRS_o_ai
8661 vec_sll(vector unsigned char __a, vector unsigned int __b) {
8662   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8663                                                      (vector int)__b);
8664 }
8665
8666 static __inline__ vector bool char __ATTRS_o_ai
8667 vec_sll(vector bool char __a, vector unsigned char __b) {
8668   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8669                                                  (vector int)__b);
8670 }
8671
8672 static __inline__ vector bool char __ATTRS_o_ai
8673 vec_sll(vector bool char __a, vector unsigned short __b) {
8674   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8675                                                  (vector int)__b);
8676 }
8677
8678 static __inline__ vector bool char __ATTRS_o_ai
8679 vec_sll(vector bool char __a, vector unsigned int __b) {
8680   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8681                                                  (vector int)__b);
8682 }
8683
8684 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8685                                                     vector unsigned char __b) {
8686   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8687 }
8688
8689 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8690                                                     vector unsigned short __b) {
8691   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8692 }
8693
8694 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8695                                                     vector unsigned int __b) {
8696   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8697 }
8698
8699 static __inline__ vector unsigned short __ATTRS_o_ai
8700 vec_sll(vector unsigned short __a, vector unsigned char __b) {
8701   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8702                                                       (vector int)__b);
8703 }
8704
8705 static __inline__ vector unsigned short __ATTRS_o_ai
8706 vec_sll(vector unsigned short __a, vector unsigned short __b) {
8707   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8708                                                       (vector int)__b);
8709 }
8710
8711 static __inline__ vector unsigned short __ATTRS_o_ai
8712 vec_sll(vector unsigned short __a, vector unsigned int __b) {
8713   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8714                                                       (vector int)__b);
8715 }
8716
8717 static __inline__ vector bool short __ATTRS_o_ai
8718 vec_sll(vector bool short __a, vector unsigned char __b) {
8719   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8720                                                   (vector int)__b);
8721 }
8722
8723 static __inline__ vector bool short __ATTRS_o_ai
8724 vec_sll(vector bool short __a, vector unsigned short __b) {
8725   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8726                                                   (vector int)__b);
8727 }
8728
8729 static __inline__ vector bool short __ATTRS_o_ai
8730 vec_sll(vector bool short __a, vector unsigned int __b) {
8731   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8732                                                   (vector int)__b);
8733 }
8734
8735 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8736                                                     vector unsigned char __b) {
8737   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8738 }
8739
8740 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8741                                                     vector unsigned short __b) {
8742   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8743 }
8744
8745 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8746                                                     vector unsigned int __b) {
8747   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8748 }
8749
8750 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8751                                                   vector unsigned char __b) {
8752   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8753 }
8754
8755 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8756                                                   vector unsigned short __b) {
8757   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8758 }
8759
8760 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8761                                                   vector unsigned int __b) {
8762   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8763 }
8764
8765 static __inline__ vector unsigned int __ATTRS_o_ai
8766 vec_sll(vector unsigned int __a, vector unsigned char __b) {
8767   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8768                                                     (vector int)__b);
8769 }
8770
8771 static __inline__ vector unsigned int __ATTRS_o_ai
8772 vec_sll(vector unsigned int __a, vector unsigned short __b) {
8773   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8774                                                     (vector int)__b);
8775 }
8776
8777 static __inline__ vector unsigned int __ATTRS_o_ai
8778 vec_sll(vector unsigned int __a, vector unsigned int __b) {
8779   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8780                                                     (vector int)__b);
8781 }
8782
8783 static __inline__ vector bool int __ATTRS_o_ai
8784 vec_sll(vector bool int __a, vector unsigned char __b) {
8785   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8786                                                 (vector int)__b);
8787 }
8788
8789 static __inline__ vector bool int __ATTRS_o_ai
8790 vec_sll(vector bool int __a, vector unsigned short __b) {
8791   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8792                                                 (vector int)__b);
8793 }
8794
8795 static __inline__ vector bool int __ATTRS_o_ai
8796 vec_sll(vector bool int __a, vector unsigned int __b) {
8797   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8798                                                 (vector int)__b);
8799 }
8800
8801 #ifdef __VSX__
8802 static __inline__ vector signed long long __ATTRS_o_ai
8803 vec_sll(vector signed long long __a, vector unsigned char __b) {
8804   return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8805                                                         (vector int)__b);
8806 }
8807
8808 static __inline__ vector unsigned long long __ATTRS_o_ai
8809 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8810   return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8811                                                           (vector int)__b);
8812 }
8813 #endif
8814
8815 /* vec_vsl */
8816
8817 static __inline__ vector signed char __ATTRS_o_ai
8818 vec_vsl(vector signed char __a, vector unsigned char __b) {
8819   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8820                                                    (vector int)__b);
8821 }
8822
8823 static __inline__ vector signed char __ATTRS_o_ai
8824 vec_vsl(vector signed char __a, vector unsigned short __b) {
8825   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8826                                                    (vector int)__b);
8827 }
8828
8829 static __inline__ vector signed char __ATTRS_o_ai
8830 vec_vsl(vector signed char __a, vector unsigned int __b) {
8831   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8832                                                    (vector int)__b);
8833 }
8834
8835 static __inline__ vector unsigned char __ATTRS_o_ai
8836 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8837   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8838                                                      (vector int)__b);
8839 }
8840
8841 static __inline__ vector unsigned char __ATTRS_o_ai
8842 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8843   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8844                                                      (vector int)__b);
8845 }
8846
8847 static __inline__ vector unsigned char __ATTRS_o_ai
8848 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8849   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8850                                                      (vector int)__b);
8851 }
8852
8853 static __inline__ vector bool char __ATTRS_o_ai
8854 vec_vsl(vector bool char __a, vector unsigned char __b) {
8855   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8856                                                  (vector int)__b);
8857 }
8858
8859 static __inline__ vector bool char __ATTRS_o_ai
8860 vec_vsl(vector bool char __a, vector unsigned short __b) {
8861   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8862                                                  (vector int)__b);
8863 }
8864
8865 static __inline__ vector bool char __ATTRS_o_ai
8866 vec_vsl(vector bool char __a, vector unsigned int __b) {
8867   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8868                                                  (vector int)__b);
8869 }
8870
8871 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8872                                                     vector unsigned char __b) {
8873   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8874 }
8875
8876 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8877                                                     vector unsigned short __b) {
8878   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8879 }
8880
8881 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8882                                                     vector unsigned int __b) {
8883   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8884 }
8885
8886 static __inline__ vector unsigned short __ATTRS_o_ai
8887 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8888   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8889                                                       (vector int)__b);
8890 }
8891
8892 static __inline__ vector unsigned short __ATTRS_o_ai
8893 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8894   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8895                                                       (vector int)__b);
8896 }
8897
8898 static __inline__ vector unsigned short __ATTRS_o_ai
8899 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8900   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8901                                                       (vector int)__b);
8902 }
8903
8904 static __inline__ vector bool short __ATTRS_o_ai
8905 vec_vsl(vector bool short __a, vector unsigned char __b) {
8906   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8907                                                   (vector int)__b);
8908 }
8909
8910 static __inline__ vector bool short __ATTRS_o_ai
8911 vec_vsl(vector bool short __a, vector unsigned short __b) {
8912   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8913                                                   (vector int)__b);
8914 }
8915
8916 static __inline__ vector bool short __ATTRS_o_ai
8917 vec_vsl(vector bool short __a, vector unsigned int __b) {
8918   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8919                                                   (vector int)__b);
8920 }
8921
8922 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8923                                                     vector unsigned char __b) {
8924   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8925 }
8926
8927 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8928                                                     vector unsigned short __b) {
8929   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8930 }
8931
8932 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8933                                                     vector unsigned int __b) {
8934   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8935 }
8936
8937 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8938                                                   vector unsigned char __b) {
8939   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8940 }
8941
8942 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8943                                                   vector unsigned short __b) {
8944   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8945 }
8946
8947 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8948                                                   vector unsigned int __b) {
8949   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8950 }
8951
8952 static __inline__ vector unsigned int __ATTRS_o_ai
8953 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8954   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8955                                                     (vector int)__b);
8956 }
8957
8958 static __inline__ vector unsigned int __ATTRS_o_ai
8959 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8960   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8961                                                     (vector int)__b);
8962 }
8963
8964 static __inline__ vector unsigned int __ATTRS_o_ai
8965 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8966   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8967                                                     (vector int)__b);
8968 }
8969
8970 static __inline__ vector bool int __ATTRS_o_ai
8971 vec_vsl(vector bool int __a, vector unsigned char __b) {
8972   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8973                                                 (vector int)__b);
8974 }
8975
8976 static __inline__ vector bool int __ATTRS_o_ai
8977 vec_vsl(vector bool int __a, vector unsigned short __b) {
8978   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8979                                                 (vector int)__b);
8980 }
8981
8982 static __inline__ vector bool int __ATTRS_o_ai
8983 vec_vsl(vector bool int __a, vector unsigned int __b) {
8984   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8985                                                 (vector int)__b);
8986 }
8987
8988 /* vec_slo */
8989
8990 static __inline__ vector signed char __ATTRS_o_ai
8991 vec_slo(vector signed char __a, vector signed char __b) {
8992   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8993                                                     (vector int)__b);
8994 }
8995
8996 static __inline__ vector signed char __ATTRS_o_ai
8997 vec_slo(vector signed char __a, vector unsigned char __b) {
8998   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8999                                                     (vector int)__b);
9000 }
9001
9002 static __inline__ vector unsigned char __ATTRS_o_ai
9003 vec_slo(vector unsigned char __a, vector signed char __b) {
9004   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9005                                                       (vector int)__b);
9006 }
9007
9008 static __inline__ vector unsigned char __ATTRS_o_ai
9009 vec_slo(vector unsigned char __a, vector unsigned char __b) {
9010   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9011                                                       (vector int)__b);
9012 }
9013
9014 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9015                                                     vector signed char __b) {
9016   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9017 }
9018
9019 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9020                                                     vector unsigned char __b) {
9021   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9022 }
9023
9024 static __inline__ vector unsigned short __ATTRS_o_ai
9025 vec_slo(vector unsigned short __a, vector signed char __b) {
9026   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9027                                                        (vector int)__b);
9028 }
9029
9030 static __inline__ vector unsigned short __ATTRS_o_ai
9031 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9032   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9033                                                        (vector int)__b);
9034 }
9035
9036 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9037                                                     vector signed char __b) {
9038   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9039 }
9040
9041 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9042                                                     vector unsigned char __b) {
9043   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9044 }
9045
9046 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9047                                                   vector signed char __b) {
9048   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9049 }
9050
9051 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9052                                                   vector unsigned char __b) {
9053   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9054 }
9055
9056 static __inline__ vector unsigned int __ATTRS_o_ai
9057 vec_slo(vector unsigned int __a, vector signed char __b) {
9058   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9059                                                      (vector int)__b);
9060 }
9061
9062 static __inline__ vector unsigned int __ATTRS_o_ai
9063 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9064   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9065                                                      (vector int)__b);
9066 }
9067
9068 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9069                                                     vector signed char __b) {
9070   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9071 }
9072
9073 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9074                                                     vector unsigned char __b) {
9075   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9076 }
9077
9078 #ifdef __VSX__
9079 static __inline__ vector signed long long __ATTRS_o_ai
9080 vec_slo(vector signed long long __a, vector signed char __b) {
9081   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9082                                                          (vector int)__b);
9083 }
9084
9085 static __inline__ vector signed long long __ATTRS_o_ai
9086 vec_slo(vector signed long long __a, vector unsigned char __b) {
9087   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9088                                                          (vector int)__b);
9089 }
9090
9091 static __inline__ vector unsigned long long __ATTRS_o_ai
9092 vec_slo(vector unsigned long long __a, vector signed char __b) {
9093   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9094                                                            (vector int)__b);
9095 }
9096
9097 static __inline__ vector unsigned long long __ATTRS_o_ai
9098 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9099   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9100                                                            (vector int)__b);
9101 }
9102 #endif
9103
9104 /* vec_vslo */
9105
9106 static __inline__ vector signed char __ATTRS_o_ai
9107 vec_vslo(vector signed char __a, vector signed char __b) {
9108   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9109                                                     (vector int)__b);
9110 }
9111
9112 static __inline__ vector signed char __ATTRS_o_ai
9113 vec_vslo(vector signed char __a, vector unsigned char __b) {
9114   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9115                                                     (vector int)__b);
9116 }
9117
9118 static __inline__ vector unsigned char __ATTRS_o_ai
9119 vec_vslo(vector unsigned char __a, vector signed char __b) {
9120   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9121                                                       (vector int)__b);
9122 }
9123
9124 static __inline__ vector unsigned char __ATTRS_o_ai
9125 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9126   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9127                                                       (vector int)__b);
9128 }
9129
9130 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9131                                                      vector signed char __b) {
9132   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9133 }
9134
9135 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9136                                                      vector unsigned char __b) {
9137   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9138 }
9139
9140 static __inline__ vector unsigned short __ATTRS_o_ai
9141 vec_vslo(vector unsigned short __a, vector signed char __b) {
9142   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9143                                                        (vector int)__b);
9144 }
9145
9146 static __inline__ vector unsigned short __ATTRS_o_ai
9147 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9148   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9149                                                        (vector int)__b);
9150 }
9151
9152 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9153                                                      vector signed char __b) {
9154   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9155 }
9156
9157 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9158                                                      vector unsigned char __b) {
9159   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9160 }
9161
9162 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9163                                                    vector signed char __b) {
9164   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9165 }
9166
9167 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9168                                                    vector unsigned char __b) {
9169   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9170 }
9171
9172 static __inline__ vector unsigned int __ATTRS_o_ai
9173 vec_vslo(vector unsigned int __a, vector signed char __b) {
9174   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9175                                                      (vector int)__b);
9176 }
9177
9178 static __inline__ vector unsigned int __ATTRS_o_ai
9179 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9180   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9181                                                      (vector int)__b);
9182 }
9183
9184 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9185                                                      vector signed char __b) {
9186   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9187 }
9188
9189 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9190                                                      vector unsigned char __b) {
9191   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9192 }
9193
9194 /* vec_splat */
9195
9196 static __inline__ vector signed char __ATTRS_o_ai
9197 vec_splat(vector signed char __a, unsigned const int __b) {
9198   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9199 }
9200
9201 static __inline__ vector unsigned char __ATTRS_o_ai
9202 vec_splat(vector unsigned char __a, unsigned const int __b) {
9203   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9204 }
9205
9206 static __inline__ vector bool char __ATTRS_o_ai
9207 vec_splat(vector bool char __a, unsigned const int __b) {
9208   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9209 }
9210
9211 static __inline__ vector signed short __ATTRS_o_ai
9212 vec_splat(vector signed short __a, unsigned const int __b) {
9213   unsigned char b0 = (__b & 0x07) * 2;
9214   unsigned char b1 = b0 + 1;
9215   return vec_perm(__a, __a,
9216                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9217                                          b0, b1, b0, b1, b0, b1));
9218 }
9219
9220 static __inline__ vector unsigned short __ATTRS_o_ai
9221 vec_splat(vector unsigned short __a, unsigned const int __b) {
9222   unsigned char b0 = (__b & 0x07) * 2;
9223   unsigned char b1 = b0 + 1;
9224   return vec_perm(__a, __a,
9225                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9226                                          b0, b1, b0, b1, b0, b1));
9227 }
9228
9229 static __inline__ vector bool short __ATTRS_o_ai
9230 vec_splat(vector bool short __a, unsigned const int __b) {
9231   unsigned char b0 = (__b & 0x07) * 2;
9232   unsigned char b1 = b0 + 1;
9233   return vec_perm(__a, __a,
9234                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9235                                          b0, b1, b0, b1, b0, b1));
9236 }
9237
9238 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9239                                                       unsigned const int __b) {
9240   unsigned char b0 = (__b & 0x07) * 2;
9241   unsigned char b1 = b0 + 1;
9242   return vec_perm(__a, __a,
9243                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9244                                          b0, b1, b0, b1, b0, b1));
9245 }
9246
9247 static __inline__ vector signed int __ATTRS_o_ai
9248 vec_splat(vector signed int __a, unsigned const int __b) {
9249   unsigned char b0 = (__b & 0x03) * 4;
9250   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9251   return vec_perm(__a, __a,
9252                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9253                                          b2, b3, b0, b1, b2, b3));
9254 }
9255
9256 static __inline__ vector unsigned int __ATTRS_o_ai
9257 vec_splat(vector unsigned int __a, unsigned const int __b) {
9258   unsigned char b0 = (__b & 0x03) * 4;
9259   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9260   return vec_perm(__a, __a,
9261                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9262                                          b2, b3, b0, b1, b2, b3));
9263 }
9264
9265 static __inline__ vector bool int __ATTRS_o_ai
9266 vec_splat(vector bool int __a, unsigned const int __b) {
9267   unsigned char b0 = (__b & 0x03) * 4;
9268   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9269   return vec_perm(__a, __a,
9270                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9271                                          b2, b3, b0, b1, b2, b3));
9272 }
9273
9274 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9275                                                       unsigned const int __b) {
9276   unsigned char b0 = (__b & 0x03) * 4;
9277   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9278   return vec_perm(__a, __a,
9279                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9280                                          b2, b3, b0, b1, b2, b3));
9281 }
9282
9283 #ifdef __VSX__
9284 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9285                                                        unsigned const int __b) {
9286   unsigned char b0 = (__b & 0x01) * 8;
9287   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9288                 b6 = b0 + 6, b7 = b0 + 7;
9289   return vec_perm(__a, __a,
9290                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9291                                          b2, b3, b4, b5, b6, b7));
9292 }
9293 static __inline__ vector bool long long __ATTRS_o_ai
9294 vec_splat(vector bool long long __a, unsigned const int __b) {
9295   unsigned char b0 = (__b & 0x01) * 8;
9296   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9297                 b6 = b0 + 6, b7 = b0 + 7;
9298   return vec_perm(__a, __a,
9299                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9300                                          b2, b3, b4, b5, b6, b7));
9301 }
9302 static __inline__ vector signed long long __ATTRS_o_ai
9303 vec_splat(vector signed long long __a, unsigned const int __b) {
9304   unsigned char b0 = (__b & 0x01) * 8;
9305   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9306                 b6 = b0 + 6, b7 = b0 + 7;
9307   return vec_perm(__a, __a,
9308                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9309                                          b2, b3, b4, b5, b6, b7));
9310 }
9311 static __inline__ vector unsigned long long __ATTRS_o_ai
9312 vec_splat(vector unsigned long long __a, unsigned const int __b) {
9313   unsigned char b0 = (__b & 0x01) * 8;
9314   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9315                 b6 = b0 + 6, b7 = b0 + 7;
9316   return vec_perm(__a, __a,
9317                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9318                                          b2, b3, b4, b5, b6, b7));
9319 }
9320 #endif
9321
9322 /* vec_vspltb */
9323
9324 #define __builtin_altivec_vspltb vec_vspltb
9325
9326 static __inline__ vector signed char __ATTRS_o_ai
9327 vec_vspltb(vector signed char __a, unsigned char __b) {
9328   return vec_perm(__a, __a, (vector unsigned char)(__b));
9329 }
9330
9331 static __inline__ vector unsigned char __ATTRS_o_ai
9332 vec_vspltb(vector unsigned char __a, unsigned char __b) {
9333   return vec_perm(__a, __a, (vector unsigned char)(__b));
9334 }
9335
9336 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9337                                                            unsigned char __b) {
9338   return vec_perm(__a, __a, (vector unsigned char)(__b));
9339 }
9340
9341 /* vec_vsplth */
9342
9343 #define __builtin_altivec_vsplth vec_vsplth
9344
9345 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9346                                                        unsigned char __b) {
9347   __b *= 2;
9348   unsigned char b1 = __b + 1;
9349   return vec_perm(__a, __a,
9350                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9351                                          __b, b1, __b, b1, __b, b1, __b, b1));
9352 }
9353
9354 static __inline__ vector unsigned short __ATTRS_o_ai
9355 vec_vsplth(vector unsigned short __a, unsigned char __b) {
9356   __b *= 2;
9357   unsigned char b1 = __b + 1;
9358   return vec_perm(__a, __a,
9359                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9360                                          __b, b1, __b, b1, __b, b1, __b, b1));
9361 }
9362
9363 static __inline__ vector bool short __ATTRS_o_ai
9364 vec_vsplth(vector bool short __a, unsigned char __b) {
9365   __b *= 2;
9366   unsigned char b1 = __b + 1;
9367   return vec_perm(__a, __a,
9368                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9369                                          __b, b1, __b, b1, __b, b1, __b, b1));
9370 }
9371
9372 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9373                                                        unsigned char __b) {
9374   __b *= 2;
9375   unsigned char b1 = __b + 1;
9376   return vec_perm(__a, __a,
9377                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9378                                          __b, b1, __b, b1, __b, b1, __b, b1));
9379 }
9380
9381 /* vec_vspltw */
9382
9383 #define __builtin_altivec_vspltw vec_vspltw
9384
9385 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9386                                                      unsigned char __b) {
9387   __b *= 4;
9388   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9389   return vec_perm(__a, __a,
9390                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9391                                          b1, b2, b3, __b, b1, b2, b3));
9392 }
9393
9394 static __inline__ vector unsigned int __ATTRS_o_ai
9395 vec_vspltw(vector unsigned int __a, unsigned char __b) {
9396   __b *= 4;
9397   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9398   return vec_perm(__a, __a,
9399                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9400                                          b1, b2, b3, __b, b1, b2, b3));
9401 }
9402
9403 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9404                                                           unsigned char __b) {
9405   __b *= 4;
9406   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9407   return vec_perm(__a, __a,
9408                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9409                                          b1, b2, b3, __b, b1, b2, b3));
9410 }
9411
9412 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9413                                                        unsigned char __b) {
9414   __b *= 4;
9415   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9416   return vec_perm(__a, __a,
9417                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9418                                          b1, b2, b3, __b, b1, b2, b3));
9419 }
9420
9421 /* vec_splat_s8 */
9422
9423 #define __builtin_altivec_vspltisb vec_splat_s8
9424
9425 // FIXME: parameter should be treated as 5-bit signed literal
9426 static __inline__ vector signed char __ATTRS_o_ai
9427 vec_splat_s8(signed char __a) {
9428   return (vector signed char)(__a);
9429 }
9430
9431 /* vec_vspltisb */
9432
9433 // FIXME: parameter should be treated as 5-bit signed literal
9434 static __inline__ vector signed char __ATTRS_o_ai
9435 vec_vspltisb(signed char __a) {
9436   return (vector signed char)(__a);
9437 }
9438
9439 /* vec_splat_s16 */
9440
9441 #define __builtin_altivec_vspltish vec_splat_s16
9442
9443 // FIXME: parameter should be treated as 5-bit signed literal
9444 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9445   return (vector short)(__a);
9446 }
9447
9448 /* vec_vspltish */
9449
9450 // FIXME: parameter should be treated as 5-bit signed literal
9451 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9452   return (vector short)(__a);
9453 }
9454
9455 /* vec_splat_s32 */
9456
9457 #define __builtin_altivec_vspltisw vec_splat_s32
9458
9459 // FIXME: parameter should be treated as 5-bit signed literal
9460 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9461   return (vector int)(__a);
9462 }
9463
9464 /* vec_vspltisw */
9465
9466 // FIXME: parameter should be treated as 5-bit signed literal
9467 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9468   return (vector int)(__a);
9469 }
9470
9471 /* vec_splat_u8 */
9472
9473 // FIXME: parameter should be treated as 5-bit signed literal
9474 static __inline__ vector unsigned char __ATTRS_o_ai
9475 vec_splat_u8(unsigned char __a) {
9476   return (vector unsigned char)(__a);
9477 }
9478
9479 /* vec_splat_u16 */
9480
9481 // FIXME: parameter should be treated as 5-bit signed literal
9482 static __inline__ vector unsigned short __ATTRS_o_ai
9483 vec_splat_u16(signed char __a) {
9484   return (vector unsigned short)(__a);
9485 }
9486
9487 /* vec_splat_u32 */
9488
9489 // FIXME: parameter should be treated as 5-bit signed literal
9490 static __inline__ vector unsigned int __ATTRS_o_ai
9491 vec_splat_u32(signed char __a) {
9492   return (vector unsigned int)(__a);
9493 }
9494
9495 /* vec_sr */
9496
9497 static __inline__ vector signed char __ATTRS_o_ai
9498 vec_sr(vector signed char __a, vector unsigned char __b) {
9499   vector unsigned char __res = (vector unsigned char)__a >> __b;
9500   return (vector signed char)__res;
9501 }
9502
9503 static __inline__ vector unsigned char __ATTRS_o_ai
9504 vec_sr(vector unsigned char __a, vector unsigned char __b) {
9505   return __a >> __b;
9506 }
9507
9508 static __inline__ vector signed short __ATTRS_o_ai
9509 vec_sr(vector signed short __a, vector unsigned short __b) {
9510   vector unsigned short __res = (vector unsigned short)__a >> __b;
9511   return (vector signed short)__res;
9512 }
9513
9514 static __inline__ vector unsigned short __ATTRS_o_ai
9515 vec_sr(vector unsigned short __a, vector unsigned short __b) {
9516   return __a >> __b;
9517 }
9518
9519 static __inline__ vector signed int __ATTRS_o_ai
9520 vec_sr(vector signed int __a, vector unsigned int __b) {
9521   vector unsigned int __res = (vector unsigned int)__a >> __b;
9522   return (vector signed int)__res;
9523 }
9524
9525 static __inline__ vector unsigned int __ATTRS_o_ai
9526 vec_sr(vector unsigned int __a, vector unsigned int __b) {
9527   return __a >> __b;
9528 }
9529
9530 #ifdef __POWER8_VECTOR__
9531 static __inline__ vector signed long long __ATTRS_o_ai
9532 vec_sr(vector signed long long __a, vector unsigned long long __b) {
9533   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
9534   return (vector signed long long)__res;
9535 }
9536
9537 static __inline__ vector unsigned long long __ATTRS_o_ai
9538 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9539   return __a >> __b;
9540 }
9541 #endif
9542
9543 /* vec_vsrb */
9544
9545 #define __builtin_altivec_vsrb vec_vsrb
9546
9547 static __inline__ vector signed char __ATTRS_o_ai
9548 vec_vsrb(vector signed char __a, vector unsigned char __b) {
9549   return __a >> (vector signed char)__b;
9550 }
9551
9552 static __inline__ vector unsigned char __ATTRS_o_ai
9553 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9554   return __a >> __b;
9555 }
9556
9557 /* vec_vsrh */
9558
9559 #define __builtin_altivec_vsrh vec_vsrh
9560
9561 static __inline__ vector short __ATTRS_o_ai
9562 vec_vsrh(vector short __a, vector unsigned short __b) {
9563   return __a >> (vector short)__b;
9564 }
9565
9566 static __inline__ vector unsigned short __ATTRS_o_ai
9567 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9568   return __a >> __b;
9569 }
9570
9571 /* vec_vsrw */
9572
9573 #define __builtin_altivec_vsrw vec_vsrw
9574
9575 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9576                                                    vector unsigned int __b) {
9577   return __a >> (vector int)__b;
9578 }
9579
9580 static __inline__ vector unsigned int __ATTRS_o_ai
9581 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9582   return __a >> __b;
9583 }
9584
9585 /* vec_sra */
9586
9587 static __inline__ vector signed char __ATTRS_o_ai
9588 vec_sra(vector signed char __a, vector unsigned char __b) {
9589   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9590 }
9591
9592 static __inline__ vector unsigned char __ATTRS_o_ai
9593 vec_sra(vector unsigned char __a, vector unsigned char __b) {
9594   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9595 }
9596
9597 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9598                                                     vector unsigned short __b) {
9599   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9600 }
9601
9602 static __inline__ vector unsigned short __ATTRS_o_ai
9603 vec_sra(vector unsigned short __a, vector unsigned short __b) {
9604   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9605 }
9606
9607 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9608                                                   vector unsigned int __b) {
9609   return __builtin_altivec_vsraw(__a, __b);
9610 }
9611
9612 static __inline__ vector unsigned int __ATTRS_o_ai
9613 vec_sra(vector unsigned int __a, vector unsigned int __b) {
9614   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9615 }
9616
9617 #ifdef __POWER8_VECTOR__
9618 static __inline__ vector signed long long __ATTRS_o_ai
9619 vec_sra(vector signed long long __a, vector unsigned long long __b) {
9620   return __a >> __b;
9621 }
9622
9623 static __inline__ vector unsigned long long __ATTRS_o_ai
9624 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9625   return (vector unsigned long long)((vector signed long long)__a >> __b);
9626 }
9627 #endif
9628
9629 /* vec_vsrab */
9630
9631 static __inline__ vector signed char __ATTRS_o_ai
9632 vec_vsrab(vector signed char __a, vector unsigned char __b) {
9633   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9634 }
9635
9636 static __inline__ vector unsigned char __ATTRS_o_ai
9637 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9638   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9639 }
9640
9641 /* vec_vsrah */
9642
9643 static __inline__ vector short __ATTRS_o_ai
9644 vec_vsrah(vector short __a, vector unsigned short __b) {
9645   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9646 }
9647
9648 static __inline__ vector unsigned short __ATTRS_o_ai
9649 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9650   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9651 }
9652
9653 /* vec_vsraw */
9654
9655 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9656                                                     vector unsigned int __b) {
9657   return __builtin_altivec_vsraw(__a, __b);
9658 }
9659
9660 static __inline__ vector unsigned int __ATTRS_o_ai
9661 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9662   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9663 }
9664
9665 /* vec_srl */
9666
9667 static __inline__ vector signed char __ATTRS_o_ai
9668 vec_srl(vector signed char __a, vector unsigned char __b) {
9669   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9670                                                    (vector int)__b);
9671 }
9672
9673 static __inline__ vector signed char __ATTRS_o_ai
9674 vec_srl(vector signed char __a, vector unsigned short __b) {
9675   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9676                                                    (vector int)__b);
9677 }
9678
9679 static __inline__ vector signed char __ATTRS_o_ai
9680 vec_srl(vector signed char __a, vector unsigned int __b) {
9681   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9682                                                    (vector int)__b);
9683 }
9684
9685 static __inline__ vector unsigned char __ATTRS_o_ai
9686 vec_srl(vector unsigned char __a, vector unsigned char __b) {
9687   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9688                                                      (vector int)__b);
9689 }
9690
9691 static __inline__ vector unsigned char __ATTRS_o_ai
9692 vec_srl(vector unsigned char __a, vector unsigned short __b) {
9693   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9694                                                      (vector int)__b);
9695 }
9696
9697 static __inline__ vector unsigned char __ATTRS_o_ai
9698 vec_srl(vector unsigned char __a, vector unsigned int __b) {
9699   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9700                                                      (vector int)__b);
9701 }
9702
9703 static __inline__ vector bool char __ATTRS_o_ai
9704 vec_srl(vector bool char __a, vector unsigned char __b) {
9705   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9706                                                  (vector int)__b);
9707 }
9708
9709 static __inline__ vector bool char __ATTRS_o_ai
9710 vec_srl(vector bool char __a, vector unsigned short __b) {
9711   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9712                                                  (vector int)__b);
9713 }
9714
9715 static __inline__ vector bool char __ATTRS_o_ai
9716 vec_srl(vector bool char __a, vector unsigned int __b) {
9717   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9718                                                  (vector int)__b);
9719 }
9720
9721 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9722                                                     vector unsigned char __b) {
9723   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9724 }
9725
9726 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9727                                                     vector unsigned short __b) {
9728   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9729 }
9730
9731 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9732                                                     vector unsigned int __b) {
9733   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9734 }
9735
9736 static __inline__ vector unsigned short __ATTRS_o_ai
9737 vec_srl(vector unsigned short __a, vector unsigned char __b) {
9738   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9739                                                       (vector int)__b);
9740 }
9741
9742 static __inline__ vector unsigned short __ATTRS_o_ai
9743 vec_srl(vector unsigned short __a, vector unsigned short __b) {
9744   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9745                                                       (vector int)__b);
9746 }
9747
9748 static __inline__ vector unsigned short __ATTRS_o_ai
9749 vec_srl(vector unsigned short __a, vector unsigned int __b) {
9750   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9751                                                       (vector int)__b);
9752 }
9753
9754 static __inline__ vector bool short __ATTRS_o_ai
9755 vec_srl(vector bool short __a, vector unsigned char __b) {
9756   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9757                                                   (vector int)__b);
9758 }
9759
9760 static __inline__ vector bool short __ATTRS_o_ai
9761 vec_srl(vector bool short __a, vector unsigned short __b) {
9762   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9763                                                   (vector int)__b);
9764 }
9765
9766 static __inline__ vector bool short __ATTRS_o_ai
9767 vec_srl(vector bool short __a, vector unsigned int __b) {
9768   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9769                                                   (vector int)__b);
9770 }
9771
9772 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9773                                                     vector unsigned char __b) {
9774   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9775 }
9776
9777 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9778                                                     vector unsigned short __b) {
9779   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9780 }
9781
9782 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9783                                                     vector unsigned int __b) {
9784   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9785 }
9786
9787 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9788                                                   vector unsigned char __b) {
9789   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9790 }
9791
9792 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9793                                                   vector unsigned short __b) {
9794   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9795 }
9796
9797 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9798                                                   vector unsigned int __b) {
9799   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9800 }
9801
9802 static __inline__ vector unsigned int __ATTRS_o_ai
9803 vec_srl(vector unsigned int __a, vector unsigned char __b) {
9804   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9805                                                     (vector int)__b);
9806 }
9807
9808 static __inline__ vector unsigned int __ATTRS_o_ai
9809 vec_srl(vector unsigned int __a, vector unsigned short __b) {
9810   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9811                                                     (vector int)__b);
9812 }
9813
9814 static __inline__ vector unsigned int __ATTRS_o_ai
9815 vec_srl(vector unsigned int __a, vector unsigned int __b) {
9816   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9817                                                     (vector int)__b);
9818 }
9819
9820 static __inline__ vector bool int __ATTRS_o_ai
9821 vec_srl(vector bool int __a, vector unsigned char __b) {
9822   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9823                                                 (vector int)__b);
9824 }
9825
9826 static __inline__ vector bool int __ATTRS_o_ai
9827 vec_srl(vector bool int __a, vector unsigned short __b) {
9828   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9829                                                 (vector int)__b);
9830 }
9831
9832 static __inline__ vector bool int __ATTRS_o_ai
9833 vec_srl(vector bool int __a, vector unsigned int __b) {
9834   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9835                                                 (vector int)__b);
9836 }
9837
9838 #ifdef __VSX__
9839 static __inline__ vector signed long long __ATTRS_o_ai
9840 vec_srl(vector signed long long __a, vector unsigned char __b) {
9841   return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9842                                                         (vector int)__b);
9843 }
9844
9845 static __inline__ vector unsigned long long __ATTRS_o_ai
9846 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9847   return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9848                                                           (vector int)__b);
9849 }
9850 #endif
9851
9852 /* vec_vsr */
9853
9854 static __inline__ vector signed char __ATTRS_o_ai
9855 vec_vsr(vector signed char __a, vector unsigned char __b) {
9856   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9857                                                    (vector int)__b);
9858 }
9859
9860 static __inline__ vector signed char __ATTRS_o_ai
9861 vec_vsr(vector signed char __a, vector unsigned short __b) {
9862   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9863                                                    (vector int)__b);
9864 }
9865
9866 static __inline__ vector signed char __ATTRS_o_ai
9867 vec_vsr(vector signed char __a, vector unsigned int __b) {
9868   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9869                                                    (vector int)__b);
9870 }
9871
9872 static __inline__ vector unsigned char __ATTRS_o_ai
9873 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9874   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9875                                                      (vector int)__b);
9876 }
9877
9878 static __inline__ vector unsigned char __ATTRS_o_ai
9879 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9880   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9881                                                      (vector int)__b);
9882 }
9883
9884 static __inline__ vector unsigned char __ATTRS_o_ai
9885 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9886   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9887                                                      (vector int)__b);
9888 }
9889
9890 static __inline__ vector bool char __ATTRS_o_ai
9891 vec_vsr(vector bool char __a, vector unsigned char __b) {
9892   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9893                                                  (vector int)__b);
9894 }
9895
9896 static __inline__ vector bool char __ATTRS_o_ai
9897 vec_vsr(vector bool char __a, vector unsigned short __b) {
9898   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9899                                                  (vector int)__b);
9900 }
9901
9902 static __inline__ vector bool char __ATTRS_o_ai
9903 vec_vsr(vector bool char __a, vector unsigned int __b) {
9904   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9905                                                  (vector int)__b);
9906 }
9907
9908 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9909                                                     vector unsigned char __b) {
9910   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9911 }
9912
9913 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9914                                                     vector unsigned short __b) {
9915   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9916 }
9917
9918 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9919                                                     vector unsigned int __b) {
9920   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9921 }
9922
9923 static __inline__ vector unsigned short __ATTRS_o_ai
9924 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9925   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9926                                                       (vector int)__b);
9927 }
9928
9929 static __inline__ vector unsigned short __ATTRS_o_ai
9930 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9931   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9932                                                       (vector int)__b);
9933 }
9934
9935 static __inline__ vector unsigned short __ATTRS_o_ai
9936 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9937   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9938                                                       (vector int)__b);
9939 }
9940
9941 static __inline__ vector bool short __ATTRS_o_ai
9942 vec_vsr(vector bool short __a, vector unsigned char __b) {
9943   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9944                                                   (vector int)__b);
9945 }
9946
9947 static __inline__ vector bool short __ATTRS_o_ai
9948 vec_vsr(vector bool short __a, vector unsigned short __b) {
9949   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9950                                                   (vector int)__b);
9951 }
9952
9953 static __inline__ vector bool short __ATTRS_o_ai
9954 vec_vsr(vector bool short __a, vector unsigned int __b) {
9955   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9956                                                   (vector int)__b);
9957 }
9958
9959 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9960                                                     vector unsigned char __b) {
9961   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9962 }
9963
9964 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9965                                                     vector unsigned short __b) {
9966   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9967 }
9968
9969 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9970                                                     vector unsigned int __b) {
9971   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9972 }
9973
9974 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9975                                                   vector unsigned char __b) {
9976   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9977 }
9978
9979 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9980                                                   vector unsigned short __b) {
9981   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9982 }
9983
9984 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9985                                                   vector unsigned int __b) {
9986   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9987 }
9988
9989 static __inline__ vector unsigned int __ATTRS_o_ai
9990 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9991   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9992                                                     (vector int)__b);
9993 }
9994
9995 static __inline__ vector unsigned int __ATTRS_o_ai
9996 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9997   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9998                                                     (vector int)__b);
9999 }
10000
10001 static __inline__ vector unsigned int __ATTRS_o_ai
10002 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10003   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10004                                                     (vector int)__b);
10005 }
10006
10007 static __inline__ vector bool int __ATTRS_o_ai
10008 vec_vsr(vector bool int __a, vector unsigned char __b) {
10009   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10010                                                 (vector int)__b);
10011 }
10012
10013 static __inline__ vector bool int __ATTRS_o_ai
10014 vec_vsr(vector bool int __a, vector unsigned short __b) {
10015   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10016                                                 (vector int)__b);
10017 }
10018
10019 static __inline__ vector bool int __ATTRS_o_ai
10020 vec_vsr(vector bool int __a, vector unsigned int __b) {
10021   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10022                                                 (vector int)__b);
10023 }
10024
10025 /* vec_sro */
10026
10027 static __inline__ vector signed char __ATTRS_o_ai
10028 vec_sro(vector signed char __a, vector signed char __b) {
10029   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10030                                                     (vector int)__b);
10031 }
10032
10033 static __inline__ vector signed char __ATTRS_o_ai
10034 vec_sro(vector signed char __a, vector unsigned char __b) {
10035   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10036                                                     (vector int)__b);
10037 }
10038
10039 static __inline__ vector unsigned char __ATTRS_o_ai
10040 vec_sro(vector unsigned char __a, vector signed char __b) {
10041   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10042                                                       (vector int)__b);
10043 }
10044
10045 static __inline__ vector unsigned char __ATTRS_o_ai
10046 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10047   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10048                                                       (vector int)__b);
10049 }
10050
10051 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10052                                                     vector signed char __b) {
10053   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10054 }
10055
10056 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10057                                                     vector unsigned char __b) {
10058   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10059 }
10060
10061 static __inline__ vector unsigned short __ATTRS_o_ai
10062 vec_sro(vector unsigned short __a, vector signed char __b) {
10063   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10064                                                        (vector int)__b);
10065 }
10066
10067 static __inline__ vector unsigned short __ATTRS_o_ai
10068 vec_sro(vector unsigned short __a, vector unsigned char __b) {
10069   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10070                                                        (vector int)__b);
10071 }
10072
10073 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10074                                                     vector signed char __b) {
10075   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10076 }
10077
10078 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10079                                                     vector unsigned char __b) {
10080   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10081 }
10082
10083 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10084                                                   vector signed char __b) {
10085   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10086 }
10087
10088 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10089                                                   vector unsigned char __b) {
10090   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10091 }
10092
10093 static __inline__ vector unsigned int __ATTRS_o_ai
10094 vec_sro(vector unsigned int __a, vector signed char __b) {
10095   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10096                                                      (vector int)__b);
10097 }
10098
10099 static __inline__ vector unsigned int __ATTRS_o_ai
10100 vec_sro(vector unsigned int __a, vector unsigned char __b) {
10101   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10102                                                      (vector int)__b);
10103 }
10104
10105 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10106                                                     vector signed char __b) {
10107   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10108 }
10109
10110 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10111                                                     vector unsigned char __b) {
10112   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10113 }
10114
10115 #ifdef __VSX__
10116 static __inline__ vector signed long long __ATTRS_o_ai
10117 vec_sro(vector signed long long __a, vector signed char __b) {
10118   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10119                                                          (vector int)__b);
10120 }
10121
10122 static __inline__ vector signed long long __ATTRS_o_ai
10123 vec_sro(vector signed long long __a, vector unsigned char __b) {
10124   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10125                                                          (vector int)__b);
10126 }
10127
10128 static __inline__ vector unsigned long long __ATTRS_o_ai
10129 vec_sro(vector unsigned long long __a, vector signed char __b) {
10130   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10131                                                            (vector int)__b);
10132 }
10133
10134 static __inline__ vector unsigned long long __ATTRS_o_ai
10135 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10136   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10137                                                            (vector int)__b);
10138 }
10139 #endif
10140
10141 /* vec_vsro */
10142
10143 static __inline__ vector signed char __ATTRS_o_ai
10144 vec_vsro(vector signed char __a, vector signed char __b) {
10145   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10146                                                     (vector int)__b);
10147 }
10148
10149 static __inline__ vector signed char __ATTRS_o_ai
10150 vec_vsro(vector signed char __a, vector unsigned char __b) {
10151   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10152                                                     (vector int)__b);
10153 }
10154
10155 static __inline__ vector unsigned char __ATTRS_o_ai
10156 vec_vsro(vector unsigned char __a, vector signed char __b) {
10157   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10158                                                       (vector int)__b);
10159 }
10160
10161 static __inline__ vector unsigned char __ATTRS_o_ai
10162 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10163   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10164                                                       (vector int)__b);
10165 }
10166
10167 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10168                                                      vector signed char __b) {
10169   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10170 }
10171
10172 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10173                                                      vector unsigned char __b) {
10174   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10175 }
10176
10177 static __inline__ vector unsigned short __ATTRS_o_ai
10178 vec_vsro(vector unsigned short __a, vector signed char __b) {
10179   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10180                                                        (vector int)__b);
10181 }
10182
10183 static __inline__ vector unsigned short __ATTRS_o_ai
10184 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10185   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10186                                                        (vector int)__b);
10187 }
10188
10189 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10190                                                      vector signed char __b) {
10191   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10192 }
10193
10194 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10195                                                      vector unsigned char __b) {
10196   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10197 }
10198
10199 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10200                                                    vector signed char __b) {
10201   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10202 }
10203
10204 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10205                                                    vector unsigned char __b) {
10206   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10207 }
10208
10209 static __inline__ vector unsigned int __ATTRS_o_ai
10210 vec_vsro(vector unsigned int __a, vector signed char __b) {
10211   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10212                                                      (vector int)__b);
10213 }
10214
10215 static __inline__ vector unsigned int __ATTRS_o_ai
10216 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10217   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10218                                                      (vector int)__b);
10219 }
10220
10221 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10222                                                      vector signed char __b) {
10223   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10224 }
10225
10226 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10227                                                      vector unsigned char __b) {
10228   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10229 }
10230
10231 /* vec_st */
10232
10233 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10234                                            vector signed char *__c) {
10235   __builtin_altivec_stvx((vector int)__a, __b, __c);
10236 }
10237
10238 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10239                                            signed char *__c) {
10240   __builtin_altivec_stvx((vector int)__a, __b, __c);
10241 }
10242
10243 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10244                                            vector unsigned char *__c) {
10245   __builtin_altivec_stvx((vector int)__a, __b, __c);
10246 }
10247
10248 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10249                                            unsigned char *__c) {
10250   __builtin_altivec_stvx((vector int)__a, __b, __c);
10251 }
10252
10253 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10254                                            signed char *__c) {
10255   __builtin_altivec_stvx((vector int)__a, __b, __c);
10256 }
10257
10258 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10259                                            unsigned char *__c) {
10260   __builtin_altivec_stvx((vector int)__a, __b, __c);
10261 }
10262
10263 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10264                                            vector bool char *__c) {
10265   __builtin_altivec_stvx((vector int)__a, __b, __c);
10266 }
10267
10268 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10269                                            vector short *__c) {
10270   __builtin_altivec_stvx((vector int)__a, __b, __c);
10271 }
10272
10273 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10274                                            short *__c) {
10275   __builtin_altivec_stvx((vector int)__a, __b, __c);
10276 }
10277
10278 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10279                                            vector unsigned short *__c) {
10280   __builtin_altivec_stvx((vector int)__a, __b, __c);
10281 }
10282
10283 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10284                                            unsigned short *__c) {
10285   __builtin_altivec_stvx((vector int)__a, __b, __c);
10286 }
10287
10288 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10289                                            short *__c) {
10290   __builtin_altivec_stvx((vector int)__a, __b, __c);
10291 }
10292
10293 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10294                                            unsigned short *__c) {
10295   __builtin_altivec_stvx((vector int)__a, __b, __c);
10296 }
10297
10298 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10299                                            vector bool short *__c) {
10300   __builtin_altivec_stvx((vector int)__a, __b, __c);
10301 }
10302
10303 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10304                                            short *__c) {
10305   __builtin_altivec_stvx((vector int)__a, __b, __c);
10306 }
10307
10308 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10309                                            unsigned short *__c) {
10310   __builtin_altivec_stvx((vector int)__a, __b, __c);
10311 }
10312
10313 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10314                                            vector pixel *__c) {
10315   __builtin_altivec_stvx((vector int)__a, __b, __c);
10316 }
10317
10318 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10319                                            vector int *__c) {
10320   __builtin_altivec_stvx(__a, __b, __c);
10321 }
10322
10323 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10324   __builtin_altivec_stvx(__a, __b, __c);
10325 }
10326
10327 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10328                                            vector unsigned int *__c) {
10329   __builtin_altivec_stvx((vector int)__a, __b, __c);
10330 }
10331
10332 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10333                                            unsigned int *__c) {
10334   __builtin_altivec_stvx((vector int)__a, __b, __c);
10335 }
10336
10337 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10338                                            int *__c) {
10339   __builtin_altivec_stvx((vector int)__a, __b, __c);
10340 }
10341
10342 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10343                                            unsigned int *__c) {
10344   __builtin_altivec_stvx((vector int)__a, __b, __c);
10345 }
10346
10347 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10348                                            vector bool int *__c) {
10349   __builtin_altivec_stvx((vector int)__a, __b, __c);
10350 }
10351
10352 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10353                                            vector float *__c) {
10354   __builtin_altivec_stvx((vector int)__a, __b, __c);
10355 }
10356
10357 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10358                                            float *__c) {
10359   __builtin_altivec_stvx((vector int)__a, __b, __c);
10360 }
10361
10362 /* vec_stvx */
10363
10364 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10365                                              vector signed char *__c) {
10366   __builtin_altivec_stvx((vector int)__a, __b, __c);
10367 }
10368
10369 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10370                                              signed char *__c) {
10371   __builtin_altivec_stvx((vector int)__a, __b, __c);
10372 }
10373
10374 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10375                                              vector unsigned char *__c) {
10376   __builtin_altivec_stvx((vector int)__a, __b, __c);
10377 }
10378
10379 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10380                                              unsigned char *__c) {
10381   __builtin_altivec_stvx((vector int)__a, __b, __c);
10382 }
10383
10384 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10385                                              signed char *__c) {
10386   __builtin_altivec_stvx((vector int)__a, __b, __c);
10387 }
10388
10389 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10390                                              unsigned char *__c) {
10391   __builtin_altivec_stvx((vector int)__a, __b, __c);
10392 }
10393
10394 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10395                                              vector bool char *__c) {
10396   __builtin_altivec_stvx((vector int)__a, __b, __c);
10397 }
10398
10399 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10400                                              vector short *__c) {
10401   __builtin_altivec_stvx((vector int)__a, __b, __c);
10402 }
10403
10404 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10405                                              short *__c) {
10406   __builtin_altivec_stvx((vector int)__a, __b, __c);
10407 }
10408
10409 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10410                                              vector unsigned short *__c) {
10411   __builtin_altivec_stvx((vector int)__a, __b, __c);
10412 }
10413
10414 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10415                                              unsigned short *__c) {
10416   __builtin_altivec_stvx((vector int)__a, __b, __c);
10417 }
10418
10419 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10420                                              short *__c) {
10421   __builtin_altivec_stvx((vector int)__a, __b, __c);
10422 }
10423
10424 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10425                                              unsigned short *__c) {
10426   __builtin_altivec_stvx((vector int)__a, __b, __c);
10427 }
10428
10429 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10430                                              vector bool short *__c) {
10431   __builtin_altivec_stvx((vector int)__a, __b, __c);
10432 }
10433
10434 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10435                                              short *__c) {
10436   __builtin_altivec_stvx((vector int)__a, __b, __c);
10437 }
10438
10439 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10440                                              unsigned short *__c) {
10441   __builtin_altivec_stvx((vector int)__a, __b, __c);
10442 }
10443
10444 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10445                                              vector pixel *__c) {
10446   __builtin_altivec_stvx((vector int)__a, __b, __c);
10447 }
10448
10449 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10450                                              vector int *__c) {
10451   __builtin_altivec_stvx(__a, __b, __c);
10452 }
10453
10454 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10455                                              int *__c) {
10456   __builtin_altivec_stvx(__a, __b, __c);
10457 }
10458
10459 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10460                                              vector unsigned int *__c) {
10461   __builtin_altivec_stvx((vector int)__a, __b, __c);
10462 }
10463
10464 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10465                                              unsigned int *__c) {
10466   __builtin_altivec_stvx((vector int)__a, __b, __c);
10467 }
10468
10469 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10470                                              int *__c) {
10471   __builtin_altivec_stvx((vector int)__a, __b, __c);
10472 }
10473
10474 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10475                                              unsigned int *__c) {
10476   __builtin_altivec_stvx((vector int)__a, __b, __c);
10477 }
10478
10479 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10480                                              vector bool int *__c) {
10481   __builtin_altivec_stvx((vector int)__a, __b, __c);
10482 }
10483
10484 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10485                                              vector float *__c) {
10486   __builtin_altivec_stvx((vector int)__a, __b, __c);
10487 }
10488
10489 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10490                                              float *__c) {
10491   __builtin_altivec_stvx((vector int)__a, __b, __c);
10492 }
10493
10494 /* vec_ste */
10495
10496 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10497                                             signed char *__c) {
10498   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10499 }
10500
10501 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10502                                             unsigned char *__c) {
10503   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10504 }
10505
10506 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10507                                             signed char *__c) {
10508   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10509 }
10510
10511 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10512                                             unsigned char *__c) {
10513   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10514 }
10515
10516 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10517                                             short *__c) {
10518   __builtin_altivec_stvehx(__a, __b, __c);
10519 }
10520
10521 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10522                                             unsigned short *__c) {
10523   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10524 }
10525
10526 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10527                                             short *__c) {
10528   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10529 }
10530
10531 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10532                                             unsigned short *__c) {
10533   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10534 }
10535
10536 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10537                                             short *__c) {
10538   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10539 }
10540
10541 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10542                                             unsigned short *__c) {
10543   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10544 }
10545
10546 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10547   __builtin_altivec_stvewx(__a, __b, __c);
10548 }
10549
10550 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10551                                             unsigned int *__c) {
10552   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10553 }
10554
10555 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10556                                             int *__c) {
10557   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10558 }
10559
10560 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10561                                             unsigned int *__c) {
10562   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10563 }
10564
10565 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10566                                             float *__c) {
10567   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10568 }
10569
10570 /* vec_stvebx */
10571
10572 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10573                                                signed char *__c) {
10574   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10575 }
10576
10577 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10578                                                int __b, unsigned char *__c) {
10579   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10580 }
10581
10582 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10583                                                signed char *__c) {
10584   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10585 }
10586
10587 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10588                                                unsigned char *__c) {
10589   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10590 }
10591
10592 /* vec_stvehx */
10593
10594 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10595                                                short *__c) {
10596   __builtin_altivec_stvehx(__a, __b, __c);
10597 }
10598
10599 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10600                                                int __b, unsigned short *__c) {
10601   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10602 }
10603
10604 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10605                                                short *__c) {
10606   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10607 }
10608
10609 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10610                                                unsigned short *__c) {
10611   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10612 }
10613
10614 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10615                                                short *__c) {
10616   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10617 }
10618
10619 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10620                                                unsigned short *__c) {
10621   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10622 }
10623
10624 /* vec_stvewx */
10625
10626 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10627                                                int *__c) {
10628   __builtin_altivec_stvewx(__a, __b, __c);
10629 }
10630
10631 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10632                                                unsigned int *__c) {
10633   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10634 }
10635
10636 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10637                                                int *__c) {
10638   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10639 }
10640
10641 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10642                                                unsigned int *__c) {
10643   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10644 }
10645
10646 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10647                                                float *__c) {
10648   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10649 }
10650
10651 /* vec_stl */
10652
10653 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10654                                             vector signed char *__c) {
10655   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10656 }
10657
10658 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10659                                             signed char *__c) {
10660   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10661 }
10662
10663 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10664                                             vector unsigned char *__c) {
10665   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10666 }
10667
10668 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10669                                             unsigned char *__c) {
10670   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10671 }
10672
10673 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10674                                             signed char *__c) {
10675   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10676 }
10677
10678 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10679                                             unsigned char *__c) {
10680   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10681 }
10682
10683 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10684                                             vector bool char *__c) {
10685   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10686 }
10687
10688 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10689                                             vector short *__c) {
10690   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10691 }
10692
10693 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10694                                             short *__c) {
10695   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10696 }
10697
10698 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10699                                             vector unsigned short *__c) {
10700   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10701 }
10702
10703 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10704                                             unsigned short *__c) {
10705   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10706 }
10707
10708 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10709                                             short *__c) {
10710   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10711 }
10712
10713 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10714                                             unsigned short *__c) {
10715   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10716 }
10717
10718 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10719                                             vector bool short *__c) {
10720   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10721 }
10722
10723 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10724                                             short *__c) {
10725   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10726 }
10727
10728 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10729                                             unsigned short *__c) {
10730   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10731 }
10732
10733 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10734                                             vector pixel *__c) {
10735   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10736 }
10737
10738 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10739                                             vector int *__c) {
10740   __builtin_altivec_stvxl(__a, __b, __c);
10741 }
10742
10743 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10744   __builtin_altivec_stvxl(__a, __b, __c);
10745 }
10746
10747 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10748                                             vector unsigned int *__c) {
10749   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10750 }
10751
10752 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10753                                             unsigned int *__c) {
10754   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10755 }
10756
10757 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10758                                             int *__c) {
10759   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10760 }
10761
10762 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10763                                             unsigned int *__c) {
10764   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10765 }
10766
10767 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10768                                             vector bool int *__c) {
10769   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10770 }
10771
10772 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10773                                             vector float *__c) {
10774   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10775 }
10776
10777 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10778                                             float *__c) {
10779   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10780 }
10781
10782 /* vec_stvxl */
10783
10784 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10785                                               vector signed char *__c) {
10786   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10787 }
10788
10789 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10790                                               signed char *__c) {
10791   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10792 }
10793
10794 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10795                                               vector unsigned char *__c) {
10796   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10797 }
10798
10799 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10800                                               unsigned char *__c) {
10801   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10802 }
10803
10804 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10805                                               signed char *__c) {
10806   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10807 }
10808
10809 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10810                                               unsigned char *__c) {
10811   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10812 }
10813
10814 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10815                                               vector bool char *__c) {
10816   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10817 }
10818
10819 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10820                                               vector short *__c) {
10821   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10822 }
10823
10824 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10825                                               short *__c) {
10826   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10827 }
10828
10829 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10830                                               int __b,
10831                                               vector unsigned short *__c) {
10832   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10833 }
10834
10835 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10836                                               int __b, unsigned short *__c) {
10837   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10838 }
10839
10840 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10841                                               short *__c) {
10842   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10843 }
10844
10845 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10846                                               unsigned short *__c) {
10847   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10848 }
10849
10850 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10851                                               vector bool short *__c) {
10852   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10853 }
10854
10855 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10856                                               short *__c) {
10857   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10858 }
10859
10860 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10861                                               unsigned short *__c) {
10862   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10863 }
10864
10865 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10866                                               vector pixel *__c) {
10867   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10868 }
10869
10870 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10871                                               vector int *__c) {
10872   __builtin_altivec_stvxl(__a, __b, __c);
10873 }
10874
10875 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10876                                               int *__c) {
10877   __builtin_altivec_stvxl(__a, __b, __c);
10878 }
10879
10880 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10881                                               vector unsigned int *__c) {
10882   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10883 }
10884
10885 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10886                                               unsigned int *__c) {
10887   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10888 }
10889
10890 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10891                                               int *__c) {
10892   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10893 }
10894
10895 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10896                                               unsigned int *__c) {
10897   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10898 }
10899
10900 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10901                                               vector bool int *__c) {
10902   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10903 }
10904
10905 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10906                                               vector float *__c) {
10907   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10908 }
10909
10910 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10911                                               float *__c) {
10912   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10913 }
10914
10915 /* vec_sub */
10916
10917 static __inline__ vector signed char __ATTRS_o_ai
10918 vec_sub(vector signed char __a, vector signed char __b) {
10919   return __a - __b;
10920 }
10921
10922 static __inline__ vector signed char __ATTRS_o_ai
10923 vec_sub(vector bool char __a, vector signed char __b) {
10924   return (vector signed char)__a - __b;
10925 }
10926
10927 static __inline__ vector signed char __ATTRS_o_ai
10928 vec_sub(vector signed char __a, vector bool char __b) {
10929   return __a - (vector signed char)__b;
10930 }
10931
10932 static __inline__ vector unsigned char __ATTRS_o_ai
10933 vec_sub(vector unsigned char __a, vector unsigned char __b) {
10934   return __a - __b;
10935 }
10936
10937 static __inline__ vector unsigned char __ATTRS_o_ai
10938 vec_sub(vector bool char __a, vector unsigned char __b) {
10939   return (vector unsigned char)__a - __b;
10940 }
10941
10942 static __inline__ vector unsigned char __ATTRS_o_ai
10943 vec_sub(vector unsigned char __a, vector bool char __b) {
10944   return __a - (vector unsigned char)__b;
10945 }
10946
10947 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10948                                                     vector short __b) {
10949   return __a - __b;
10950 }
10951
10952 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10953                                                     vector short __b) {
10954   return (vector short)__a - __b;
10955 }
10956
10957 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10958                                                     vector bool short __b) {
10959   return __a - (vector short)__b;
10960 }
10961
10962 static __inline__ vector unsigned short __ATTRS_o_ai
10963 vec_sub(vector unsigned short __a, vector unsigned short __b) {
10964   return __a - __b;
10965 }
10966
10967 static __inline__ vector unsigned short __ATTRS_o_ai
10968 vec_sub(vector bool short __a, vector unsigned short __b) {
10969   return (vector unsigned short)__a - __b;
10970 }
10971
10972 static __inline__ vector unsigned short __ATTRS_o_ai
10973 vec_sub(vector unsigned short __a, vector bool short __b) {
10974   return __a - (vector unsigned short)__b;
10975 }
10976
10977 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10978                                                   vector int __b) {
10979   return __a - __b;
10980 }
10981
10982 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10983                                                   vector int __b) {
10984   return (vector int)__a - __b;
10985 }
10986
10987 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10988                                                   vector bool int __b) {
10989   return __a - (vector int)__b;
10990 }
10991
10992 static __inline__ vector unsigned int __ATTRS_o_ai
10993 vec_sub(vector unsigned int __a, vector unsigned int __b) {
10994   return __a - __b;
10995 }
10996
10997 static __inline__ vector unsigned int __ATTRS_o_ai
10998 vec_sub(vector bool int __a, vector unsigned int __b) {
10999   return (vector unsigned int)__a - __b;
11000 }
11001
11002 static __inline__ vector unsigned int __ATTRS_o_ai
11003 vec_sub(vector unsigned int __a, vector bool int __b) {
11004   return __a - (vector unsigned int)__b;
11005 }
11006
11007 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11008 static __inline__ vector signed __int128 __ATTRS_o_ai
11009 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11010   return __a - __b;
11011 }
11012
11013 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11014 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11015   return __a - __b;
11016 }
11017 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11018
11019 #ifdef __VSX__
11020 static __inline__ vector signed long long __ATTRS_o_ai
11021 vec_sub(vector signed long long __a, vector signed long long __b) {
11022   return __a - __b;
11023 }
11024
11025 static __inline__ vector unsigned long long __ATTRS_o_ai
11026 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11027   return __a - __b;
11028 }
11029
11030 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11031                                                      vector double __b) {
11032   return __a - __b;
11033 }
11034 #endif
11035
11036 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11037                                                     vector float __b) {
11038   return __a - __b;
11039 }
11040
11041 /* vec_vsububm */
11042
11043 #define __builtin_altivec_vsububm vec_vsububm
11044
11045 static __inline__ vector signed char __ATTRS_o_ai
11046 vec_vsububm(vector signed char __a, vector signed char __b) {
11047   return __a - __b;
11048 }
11049
11050 static __inline__ vector signed char __ATTRS_o_ai
11051 vec_vsububm(vector bool char __a, vector signed char __b) {
11052   return (vector signed char)__a - __b;
11053 }
11054
11055 static __inline__ vector signed char __ATTRS_o_ai
11056 vec_vsububm(vector signed char __a, vector bool char __b) {
11057   return __a - (vector signed char)__b;
11058 }
11059
11060 static __inline__ vector unsigned char __ATTRS_o_ai
11061 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11062   return __a - __b;
11063 }
11064
11065 static __inline__ vector unsigned char __ATTRS_o_ai
11066 vec_vsububm(vector bool char __a, vector unsigned char __b) {
11067   return (vector unsigned char)__a - __b;
11068 }
11069
11070 static __inline__ vector unsigned char __ATTRS_o_ai
11071 vec_vsububm(vector unsigned char __a, vector bool char __b) {
11072   return __a - (vector unsigned char)__b;
11073 }
11074
11075 /* vec_vsubuhm */
11076
11077 #define __builtin_altivec_vsubuhm vec_vsubuhm
11078
11079 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11080                                                         vector short __b) {
11081   return __a - __b;
11082 }
11083
11084 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11085                                                         vector short __b) {
11086   return (vector short)__a - __b;
11087 }
11088
11089 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11090                                                         vector bool short __b) {
11091   return __a - (vector short)__b;
11092 }
11093
11094 static __inline__ vector unsigned short __ATTRS_o_ai
11095 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11096   return __a - __b;
11097 }
11098
11099 static __inline__ vector unsigned short __ATTRS_o_ai
11100 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11101   return (vector unsigned short)__a - __b;
11102 }
11103
11104 static __inline__ vector unsigned short __ATTRS_o_ai
11105 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11106   return __a - (vector unsigned short)__b;
11107 }
11108
11109 /* vec_vsubuwm */
11110
11111 #define __builtin_altivec_vsubuwm vec_vsubuwm
11112
11113 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11114                                                       vector int __b) {
11115   return __a - __b;
11116 }
11117
11118 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11119                                                       vector int __b) {
11120   return (vector int)__a - __b;
11121 }
11122
11123 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11124                                                       vector bool int __b) {
11125   return __a - (vector int)__b;
11126 }
11127
11128 static __inline__ vector unsigned int __ATTRS_o_ai
11129 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11130   return __a - __b;
11131 }
11132
11133 static __inline__ vector unsigned int __ATTRS_o_ai
11134 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11135   return (vector unsigned int)__a - __b;
11136 }
11137
11138 static __inline__ vector unsigned int __ATTRS_o_ai
11139 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11140   return __a - (vector unsigned int)__b;
11141 }
11142
11143 /* vec_vsubfp */
11144
11145 #define __builtin_altivec_vsubfp vec_vsubfp
11146
11147 static __inline__ vector float __attribute__((__always_inline__))
11148 vec_vsubfp(vector float __a, vector float __b) {
11149   return __a - __b;
11150 }
11151
11152 /* vec_subc */
11153
11154 static __inline__ vector signed int __ATTRS_o_ai
11155 vec_subc(vector signed int __a, vector signed int __b) {
11156   return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11157                                                       (vector unsigned int) __b);
11158 }
11159
11160 static __inline__ vector unsigned int __ATTRS_o_ai
11161 vec_subc(vector unsigned int __a, vector unsigned int __b) {
11162   return __builtin_altivec_vsubcuw(__a, __b);
11163 }
11164
11165 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11166 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11167 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11168   return __builtin_altivec_vsubcuq(__a, __b);
11169 }
11170
11171 static __inline__ vector signed __int128 __ATTRS_o_ai
11172 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11173   return __builtin_altivec_vsubcuq(__a, __b);
11174 }
11175 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11176
11177 /* vec_vsubcuw */
11178
11179 static __inline__ vector unsigned int __attribute__((__always_inline__))
11180 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11181   return __builtin_altivec_vsubcuw(__a, __b);
11182 }
11183
11184 /* vec_subs */
11185
11186 static __inline__ vector signed char __ATTRS_o_ai
11187 vec_subs(vector signed char __a, vector signed char __b) {
11188   return __builtin_altivec_vsubsbs(__a, __b);
11189 }
11190
11191 static __inline__ vector signed char __ATTRS_o_ai
11192 vec_subs(vector bool char __a, vector signed char __b) {
11193   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11194 }
11195
11196 static __inline__ vector signed char __ATTRS_o_ai
11197 vec_subs(vector signed char __a, vector bool char __b) {
11198   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11199 }
11200
11201 static __inline__ vector unsigned char __ATTRS_o_ai
11202 vec_subs(vector unsigned char __a, vector unsigned char __b) {
11203   return __builtin_altivec_vsububs(__a, __b);
11204 }
11205
11206 static __inline__ vector unsigned char __ATTRS_o_ai
11207 vec_subs(vector bool char __a, vector unsigned char __b) {
11208   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11209 }
11210
11211 static __inline__ vector unsigned char __ATTRS_o_ai
11212 vec_subs(vector unsigned char __a, vector bool char __b) {
11213   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11214 }
11215
11216 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11217                                                      vector short __b) {
11218   return __builtin_altivec_vsubshs(__a, __b);
11219 }
11220
11221 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11222                                                      vector short __b) {
11223   return __builtin_altivec_vsubshs((vector short)__a, __b);
11224 }
11225
11226 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11227                                                      vector bool short __b) {
11228   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11229 }
11230
11231 static __inline__ vector unsigned short __ATTRS_o_ai
11232 vec_subs(vector unsigned short __a, vector unsigned short __b) {
11233   return __builtin_altivec_vsubuhs(__a, __b);
11234 }
11235
11236 static __inline__ vector unsigned short __ATTRS_o_ai
11237 vec_subs(vector bool short __a, vector unsigned short __b) {
11238   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11239 }
11240
11241 static __inline__ vector unsigned short __ATTRS_o_ai
11242 vec_subs(vector unsigned short __a, vector bool short __b) {
11243   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11244 }
11245
11246 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11247                                                    vector int __b) {
11248   return __builtin_altivec_vsubsws(__a, __b);
11249 }
11250
11251 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11252                                                    vector int __b) {
11253   return __builtin_altivec_vsubsws((vector int)__a, __b);
11254 }
11255
11256 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11257                                                    vector bool int __b) {
11258   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11259 }
11260
11261 static __inline__ vector unsigned int __ATTRS_o_ai
11262 vec_subs(vector unsigned int __a, vector unsigned int __b) {
11263   return __builtin_altivec_vsubuws(__a, __b);
11264 }
11265
11266 static __inline__ vector unsigned int __ATTRS_o_ai
11267 vec_subs(vector bool int __a, vector unsigned int __b) {
11268   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11269 }
11270
11271 static __inline__ vector unsigned int __ATTRS_o_ai
11272 vec_subs(vector unsigned int __a, vector bool int __b) {
11273   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11274 }
11275
11276 /* vec_vsubsbs */
11277
11278 static __inline__ vector signed char __ATTRS_o_ai
11279 vec_vsubsbs(vector signed char __a, vector signed char __b) {
11280   return __builtin_altivec_vsubsbs(__a, __b);
11281 }
11282
11283 static __inline__ vector signed char __ATTRS_o_ai
11284 vec_vsubsbs(vector bool char __a, vector signed char __b) {
11285   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11286 }
11287
11288 static __inline__ vector signed char __ATTRS_o_ai
11289 vec_vsubsbs(vector signed char __a, vector bool char __b) {
11290   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11291 }
11292
11293 /* vec_vsububs */
11294
11295 static __inline__ vector unsigned char __ATTRS_o_ai
11296 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11297   return __builtin_altivec_vsububs(__a, __b);
11298 }
11299
11300 static __inline__ vector unsigned char __ATTRS_o_ai
11301 vec_vsububs(vector bool char __a, vector unsigned char __b) {
11302   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11303 }
11304
11305 static __inline__ vector unsigned char __ATTRS_o_ai
11306 vec_vsububs(vector unsigned char __a, vector bool char __b) {
11307   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11308 }
11309
11310 /* vec_vsubshs */
11311
11312 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11313                                                         vector short __b) {
11314   return __builtin_altivec_vsubshs(__a, __b);
11315 }
11316
11317 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11318                                                         vector short __b) {
11319   return __builtin_altivec_vsubshs((vector short)__a, __b);
11320 }
11321
11322 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11323                                                         vector bool short __b) {
11324   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11325 }
11326
11327 /* vec_vsubuhs */
11328
11329 static __inline__ vector unsigned short __ATTRS_o_ai
11330 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11331   return __builtin_altivec_vsubuhs(__a, __b);
11332 }
11333
11334 static __inline__ vector unsigned short __ATTRS_o_ai
11335 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11336   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11337 }
11338
11339 static __inline__ vector unsigned short __ATTRS_o_ai
11340 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11341   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11342 }
11343
11344 /* vec_vsubsws */
11345
11346 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11347                                                       vector int __b) {
11348   return __builtin_altivec_vsubsws(__a, __b);
11349 }
11350
11351 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11352                                                       vector int __b) {
11353   return __builtin_altivec_vsubsws((vector int)__a, __b);
11354 }
11355
11356 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11357                                                       vector bool int __b) {
11358   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11359 }
11360
11361 /* vec_vsubuws */
11362
11363 static __inline__ vector unsigned int __ATTRS_o_ai
11364 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11365   return __builtin_altivec_vsubuws(__a, __b);
11366 }
11367
11368 static __inline__ vector unsigned int __ATTRS_o_ai
11369 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11370   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11371 }
11372
11373 static __inline__ vector unsigned int __ATTRS_o_ai
11374 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11375   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11376 }
11377
11378 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11379 /* vec_vsubuqm */
11380
11381 static __inline__ vector signed __int128 __ATTRS_o_ai
11382 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11383   return __a - __b;
11384 }
11385
11386 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11387 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11388   return __a - __b;
11389 }
11390
11391 /* vec_vsubeuqm */
11392
11393
11394 static __inline__ vector signed __int128 __ATTRS_o_ai
11395 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11396              vector signed __int128 __c) {
11397   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11398 }
11399
11400 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11401 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11402              vector unsigned __int128 __c) {
11403   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11404 }
11405
11406 static __inline__ vector signed __int128 __ATTRS_o_ai
11407 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11408              vector signed __int128 __c) {
11409   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11410 }
11411
11412 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11413 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11414              vector unsigned __int128 __c) {
11415   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11416 }
11417
11418 /* vec_vsubcuq */
11419
11420 static __inline__ vector signed __int128 __ATTRS_o_ai
11421 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11422   return __builtin_altivec_vsubcuq(__a, __b);
11423 }
11424
11425 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11426 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11427   return __builtin_altivec_vsubcuq(__a, __b);
11428 }
11429
11430 /* vec_vsubecuq */
11431
11432 static __inline__ vector signed __int128 __ATTRS_o_ai
11433 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11434              vector signed __int128 __c) {
11435   return __builtin_altivec_vsubecuq(__a, __b, __c);
11436 }
11437
11438 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11439 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11440              vector unsigned __int128 __c) {
11441   return __builtin_altivec_vsubecuq(__a, __b, __c);
11442 }
11443
11444 static __inline__ vector signed int __ATTRS_o_ai
11445 vec_subec(vector signed int __a, vector signed int __b,
11446              vector signed int __c) {
11447   return vec_addec(__a, ~__b, __c);
11448 }
11449
11450 static __inline__ vector unsigned int __ATTRS_o_ai
11451 vec_subec(vector unsigned int __a, vector unsigned int __b,
11452              vector unsigned int __c) {
11453   return vec_addec(__a, ~__b, __c);
11454 }
11455
11456 static __inline__ vector signed __int128 __ATTRS_o_ai
11457 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11458              vector signed __int128 __c) {
11459   return __builtin_altivec_vsubecuq(__a, __b, __c);
11460 }
11461
11462 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11463 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11464              vector unsigned __int128 __c) {
11465   return __builtin_altivec_vsubecuq(__a, __b, __c);
11466 }
11467 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11468
11469 static __inline__ vector signed int __ATTRS_o_ai
11470 vec_sube(vector signed int __a, vector signed int __b,
11471          vector signed int __c) {
11472   vector signed int __mask = {1, 1, 1, 1};
11473   vector signed int __carry = __c & __mask;
11474   return vec_adde(__a, ~__b, __carry);
11475 }
11476
11477 static __inline__ vector unsigned int __ATTRS_o_ai
11478 vec_sube(vector unsigned int __a, vector unsigned int __b,
11479          vector unsigned int __c) {
11480   vector unsigned int __mask = {1, 1, 1, 1};
11481   vector unsigned int __carry = __c & __mask;
11482   return vec_adde(__a, ~__b, __carry);
11483 }
11484 /* vec_sum4s */
11485
11486 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11487                                                     vector int __b) {
11488   return __builtin_altivec_vsum4sbs(__a, __b);
11489 }
11490
11491 static __inline__ vector unsigned int __ATTRS_o_ai
11492 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11493   return __builtin_altivec_vsum4ubs(__a, __b);
11494 }
11495
11496 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11497                                                     vector int __b) {
11498   return __builtin_altivec_vsum4shs(__a, __b);
11499 }
11500
11501 /* vec_vsum4sbs */
11502
11503 static __inline__ vector int __attribute__((__always_inline__))
11504 vec_vsum4sbs(vector signed char __a, vector int __b) {
11505   return __builtin_altivec_vsum4sbs(__a, __b);
11506 }
11507
11508 /* vec_vsum4ubs */
11509
11510 static __inline__ vector unsigned int __attribute__((__always_inline__))
11511 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11512   return __builtin_altivec_vsum4ubs(__a, __b);
11513 }
11514
11515 /* vec_vsum4shs */
11516
11517 static __inline__ vector int __attribute__((__always_inline__))
11518 vec_vsum4shs(vector signed short __a, vector int __b) {
11519   return __builtin_altivec_vsum4shs(__a, __b);
11520 }
11521
11522 /* vec_sum2s */
11523
11524 /* The vsum2sws instruction has a big-endian bias, so that the second
11525    input vector and the result always reference big-endian elements
11526    1 and 3 (little-endian element 0 and 2).  For ease of porting the
11527    programmer wants elements 1 and 3 in both cases, so for little
11528    endian we must perform some permutes.  */
11529
11530 static __inline__ vector signed int __attribute__((__always_inline__))
11531 vec_sum2s(vector int __a, vector int __b) {
11532 #ifdef __LITTLE_ENDIAN__
11533   vector int __c = (vector signed int)vec_perm(
11534       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11535                                        8, 9, 10, 11));
11536   __c = __builtin_altivec_vsum2sws(__a, __c);
11537   return (vector signed int)vec_perm(
11538       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11539                                        8, 9, 10, 11));
11540 #else
11541   return __builtin_altivec_vsum2sws(__a, __b);
11542 #endif
11543 }
11544
11545 /* vec_vsum2sws */
11546
11547 static __inline__ vector signed int __attribute__((__always_inline__))
11548 vec_vsum2sws(vector int __a, vector int __b) {
11549 #ifdef __LITTLE_ENDIAN__
11550   vector int __c = (vector signed int)vec_perm(
11551       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11552                                        8, 9, 10, 11));
11553   __c = __builtin_altivec_vsum2sws(__a, __c);
11554   return (vector signed int)vec_perm(
11555       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11556                                        8, 9, 10, 11));
11557 #else
11558   return __builtin_altivec_vsum2sws(__a, __b);
11559 #endif
11560 }
11561
11562 /* vec_sums */
11563
11564 /* The vsumsws instruction has a big-endian bias, so that the second
11565    input vector and the result always reference big-endian element 3
11566    (little-endian element 0).  For ease of porting the programmer
11567    wants element 3 in both cases, so for little endian we must perform
11568    some permutes.  */
11569
11570 static __inline__ vector signed int __attribute__((__always_inline__))
11571 vec_sums(vector signed int __a, vector signed int __b) {
11572 #ifdef __LITTLE_ENDIAN__
11573   __b = (vector signed int)vec_splat(__b, 3);
11574   __b = __builtin_altivec_vsumsws(__a, __b);
11575   return (vector signed int)(0, 0, 0, __b[0]);
11576 #else
11577   return __builtin_altivec_vsumsws(__a, __b);
11578 #endif
11579 }
11580
11581 /* vec_vsumsws */
11582
11583 static __inline__ vector signed int __attribute__((__always_inline__))
11584 vec_vsumsws(vector signed int __a, vector signed int __b) {
11585 #ifdef __LITTLE_ENDIAN__
11586   __b = (vector signed int)vec_splat(__b, 3);
11587   __b = __builtin_altivec_vsumsws(__a, __b);
11588   return (vector signed int)(0, 0, 0, __b[0]);
11589 #else
11590   return __builtin_altivec_vsumsws(__a, __b);
11591 #endif
11592 }
11593
11594 /* vec_trunc */
11595
11596 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11597 #ifdef __VSX__
11598   return __builtin_vsx_xvrspiz(__a);
11599 #else
11600   return __builtin_altivec_vrfiz(__a);
11601 #endif
11602 }
11603
11604 #ifdef __VSX__
11605 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11606   return __builtin_vsx_xvrdpiz(__a);
11607 }
11608 #endif
11609
11610 /* vec_vrfiz */
11611
11612 static __inline__ vector float __attribute__((__always_inline__))
11613 vec_vrfiz(vector float __a) {
11614   return __builtin_altivec_vrfiz(__a);
11615 }
11616
11617 /* vec_unpackh */
11618
11619 /* The vector unpack instructions all have a big-endian bias, so for
11620    little endian we must reverse the meanings of "high" and "low."  */
11621
11622 static __inline__ vector short __ATTRS_o_ai
11623 vec_unpackh(vector signed char __a) {
11624 #ifdef __LITTLE_ENDIAN__
11625   return __builtin_altivec_vupklsb((vector char)__a);
11626 #else
11627   return __builtin_altivec_vupkhsb((vector char)__a);
11628 #endif
11629 }
11630
11631 static __inline__ vector bool short __ATTRS_o_ai
11632 vec_unpackh(vector bool char __a) {
11633 #ifdef __LITTLE_ENDIAN__
11634   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11635 #else
11636   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11637 #endif
11638 }
11639
11640 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11641 #ifdef __LITTLE_ENDIAN__
11642   return __builtin_altivec_vupklsh(__a);
11643 #else
11644   return __builtin_altivec_vupkhsh(__a);
11645 #endif
11646 }
11647
11648 static __inline__ vector bool int __ATTRS_o_ai
11649 vec_unpackh(vector bool short __a) {
11650 #ifdef __LITTLE_ENDIAN__
11651   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11652 #else
11653   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11654 #endif
11655 }
11656
11657 static __inline__ vector unsigned int __ATTRS_o_ai
11658 vec_unpackh(vector pixel __a) {
11659 #ifdef __LITTLE_ENDIAN__
11660   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11661 #else
11662   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11663 #endif
11664 }
11665
11666 #ifdef __POWER8_VECTOR__
11667 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11668 #ifdef __LITTLE_ENDIAN__
11669   return __builtin_altivec_vupklsw(__a);
11670 #else
11671   return __builtin_altivec_vupkhsw(__a);
11672 #endif
11673 }
11674
11675 static __inline__ vector bool long long __ATTRS_o_ai
11676 vec_unpackh(vector bool int __a) {
11677 #ifdef __LITTLE_ENDIAN__
11678   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11679 #else
11680   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11681 #endif
11682 }
11683
11684 static __inline__ vector double __ATTRS_o_ai
11685 vec_unpackh(vector float __a) {
11686   return (vector double)(__a[0], __a[1]);
11687 }
11688 #endif
11689
11690 /* vec_vupkhsb */
11691
11692 static __inline__ vector short __ATTRS_o_ai
11693 vec_vupkhsb(vector signed char __a) {
11694 #ifdef __LITTLE_ENDIAN__
11695   return __builtin_altivec_vupklsb((vector char)__a);
11696 #else
11697   return __builtin_altivec_vupkhsb((vector char)__a);
11698 #endif
11699 }
11700
11701 static __inline__ vector bool short __ATTRS_o_ai
11702 vec_vupkhsb(vector bool char __a) {
11703 #ifdef __LITTLE_ENDIAN__
11704   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11705 #else
11706   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11707 #endif
11708 }
11709
11710 /* vec_vupkhsh */
11711
11712 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11713 #ifdef __LITTLE_ENDIAN__
11714   return __builtin_altivec_vupklsh(__a);
11715 #else
11716   return __builtin_altivec_vupkhsh(__a);
11717 #endif
11718 }
11719
11720 static __inline__ vector bool int __ATTRS_o_ai
11721 vec_vupkhsh(vector bool short __a) {
11722 #ifdef __LITTLE_ENDIAN__
11723   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11724 #else
11725   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11726 #endif
11727 }
11728
11729 static __inline__ vector unsigned int __ATTRS_o_ai
11730 vec_vupkhsh(vector pixel __a) {
11731 #ifdef __LITTLE_ENDIAN__
11732   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11733 #else
11734   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11735 #endif
11736 }
11737
11738 /* vec_vupkhsw */
11739
11740 #ifdef __POWER8_VECTOR__
11741 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11742 #ifdef __LITTLE_ENDIAN__
11743   return __builtin_altivec_vupklsw(__a);
11744 #else
11745   return __builtin_altivec_vupkhsw(__a);
11746 #endif
11747 }
11748
11749 static __inline__ vector bool long long __ATTRS_o_ai
11750 vec_vupkhsw(vector bool int __a) {
11751 #ifdef __LITTLE_ENDIAN__
11752   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11753 #else
11754   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11755 #endif
11756 }
11757 #endif
11758
11759 /* vec_unpackl */
11760
11761 static __inline__ vector short __ATTRS_o_ai
11762 vec_unpackl(vector signed char __a) {
11763 #ifdef __LITTLE_ENDIAN__
11764   return __builtin_altivec_vupkhsb((vector char)__a);
11765 #else
11766   return __builtin_altivec_vupklsb((vector char)__a);
11767 #endif
11768 }
11769
11770 static __inline__ vector bool short __ATTRS_o_ai
11771 vec_unpackl(vector bool char __a) {
11772 #ifdef __LITTLE_ENDIAN__
11773   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11774 #else
11775   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11776 #endif
11777 }
11778
11779 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11780 #ifdef __LITTLE_ENDIAN__
11781   return __builtin_altivec_vupkhsh(__a);
11782 #else
11783   return __builtin_altivec_vupklsh(__a);
11784 #endif
11785 }
11786
11787 static __inline__ vector bool int __ATTRS_o_ai
11788 vec_unpackl(vector bool short __a) {
11789 #ifdef __LITTLE_ENDIAN__
11790   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11791 #else
11792   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11793 #endif
11794 }
11795
11796 static __inline__ vector unsigned int __ATTRS_o_ai
11797 vec_unpackl(vector pixel __a) {
11798 #ifdef __LITTLE_ENDIAN__
11799   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11800 #else
11801   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11802 #endif
11803 }
11804
11805 #ifdef __POWER8_VECTOR__
11806 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11807 #ifdef __LITTLE_ENDIAN__
11808   return __builtin_altivec_vupkhsw(__a);
11809 #else
11810   return __builtin_altivec_vupklsw(__a);
11811 #endif
11812 }
11813
11814 static __inline__ vector bool long long __ATTRS_o_ai
11815 vec_unpackl(vector bool int __a) {
11816 #ifdef __LITTLE_ENDIAN__
11817   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11818 #else
11819   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11820 #endif
11821 }
11822
11823 static __inline__ vector double __ATTRS_o_ai
11824 vec_unpackl(vector float __a) {
11825   return (vector double)(__a[2], __a[3]);
11826 }
11827 #endif
11828
11829 /* vec_vupklsb */
11830
11831 static __inline__ vector short __ATTRS_o_ai
11832 vec_vupklsb(vector signed char __a) {
11833 #ifdef __LITTLE_ENDIAN__
11834   return __builtin_altivec_vupkhsb((vector char)__a);
11835 #else
11836   return __builtin_altivec_vupklsb((vector char)__a);
11837 #endif
11838 }
11839
11840 static __inline__ vector bool short __ATTRS_o_ai
11841 vec_vupklsb(vector bool char __a) {
11842 #ifdef __LITTLE_ENDIAN__
11843   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11844 #else
11845   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11846 #endif
11847 }
11848
11849 /* vec_vupklsh */
11850
11851 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11852 #ifdef __LITTLE_ENDIAN__
11853   return __builtin_altivec_vupkhsh(__a);
11854 #else
11855   return __builtin_altivec_vupklsh(__a);
11856 #endif
11857 }
11858
11859 static __inline__ vector bool int __ATTRS_o_ai
11860 vec_vupklsh(vector bool short __a) {
11861 #ifdef __LITTLE_ENDIAN__
11862   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11863 #else
11864   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11865 #endif
11866 }
11867
11868 static __inline__ vector unsigned int __ATTRS_o_ai
11869 vec_vupklsh(vector pixel __a) {
11870 #ifdef __LITTLE_ENDIAN__
11871   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11872 #else
11873   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11874 #endif
11875 }
11876
11877 /* vec_vupklsw */
11878
11879 #ifdef __POWER8_VECTOR__
11880 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11881 #ifdef __LITTLE_ENDIAN__
11882   return __builtin_altivec_vupkhsw(__a);
11883 #else
11884   return __builtin_altivec_vupklsw(__a);
11885 #endif
11886 }
11887
11888 static __inline__ vector bool long long __ATTRS_o_ai
11889 vec_vupklsw(vector bool int __a) {
11890 #ifdef __LITTLE_ENDIAN__
11891   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11892 #else
11893   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11894 #endif
11895 }
11896 #endif
11897
11898 /* vec_vsx_ld */
11899
11900 #ifdef __VSX__
11901
11902 static __inline__ vector bool int __ATTRS_o_ai
11903 vec_vsx_ld(int __a, const vector bool int *__b) {
11904   return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11905 }
11906
11907 static __inline__ vector signed int __ATTRS_o_ai
11908 vec_vsx_ld(int __a, const vector signed int *__b) {
11909   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11910 }
11911
11912 static __inline__ vector signed int __ATTRS_o_ai
11913 vec_vsx_ld(int __a, const signed int *__b) {
11914   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11915 }
11916
11917 static __inline__ vector unsigned int __ATTRS_o_ai
11918 vec_vsx_ld(int __a, const vector unsigned int *__b) {
11919   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11920 }
11921
11922 static __inline__ vector unsigned int __ATTRS_o_ai
11923 vec_vsx_ld(int __a, const unsigned int *__b) {
11924   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11925 }
11926
11927 static __inline__ vector float __ATTRS_o_ai
11928 vec_vsx_ld(int __a, const vector float *__b) {
11929   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11930 }
11931
11932 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11933                                                        const float *__b) {
11934   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11935 }
11936
11937 static __inline__ vector signed long long __ATTRS_o_ai
11938 vec_vsx_ld(int __a, const vector signed long long *__b) {
11939   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11940 }
11941
11942 static __inline__ vector unsigned long long __ATTRS_o_ai
11943 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11944   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11945 }
11946
11947 static __inline__ vector double __ATTRS_o_ai
11948 vec_vsx_ld(int __a, const vector double *__b) {
11949   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11950 }
11951
11952 static __inline__ vector double __ATTRS_o_ai
11953 vec_vsx_ld(int __a, const double *__b) {
11954   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11955 }
11956
11957 static __inline__ vector bool short __ATTRS_o_ai
11958 vec_vsx_ld(int __a, const vector bool short *__b) {
11959   return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11960 }
11961
11962 static __inline__ vector signed short __ATTRS_o_ai
11963 vec_vsx_ld(int __a, const vector signed short *__b) {
11964   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11965 }
11966
11967 static __inline__ vector signed short __ATTRS_o_ai
11968 vec_vsx_ld(int __a, const signed short *__b) {
11969   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11970 }
11971
11972 static __inline__ vector unsigned short __ATTRS_o_ai
11973 vec_vsx_ld(int __a, const vector unsigned short *__b) {
11974   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11975 }
11976
11977 static __inline__ vector unsigned short __ATTRS_o_ai
11978 vec_vsx_ld(int __a, const unsigned short *__b) {
11979   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11980 }
11981
11982 static __inline__ vector bool char __ATTRS_o_ai
11983 vec_vsx_ld(int __a, const vector bool char *__b) {
11984   return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11985 }
11986
11987 static __inline__ vector signed char __ATTRS_o_ai
11988 vec_vsx_ld(int __a, const vector signed char *__b) {
11989   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11990 }
11991
11992 static __inline__ vector signed char __ATTRS_o_ai
11993 vec_vsx_ld(int __a, const signed char *__b) {
11994   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11995 }
11996
11997 static __inline__ vector unsigned char __ATTRS_o_ai
11998 vec_vsx_ld(int __a, const vector unsigned char *__b) {
11999   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12000 }
12001
12002 static __inline__ vector unsigned char __ATTRS_o_ai
12003 vec_vsx_ld(int __a, const unsigned char *__b) {
12004   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12005 }
12006
12007 #endif
12008
12009 /* vec_vsx_st */
12010
12011 #ifdef __VSX__
12012
12013 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12014                                                vector bool int *__c) {
12015   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12016 }
12017
12018 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12019                                                signed int *__c) {
12020   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12021 }
12022
12023 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12024                                                unsigned int *__c) {
12025   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12026 }
12027
12028 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12029                                                vector signed int *__c) {
12030   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12031 }
12032
12033 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12034                                                signed int *__c) {
12035   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12036 }
12037
12038 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12039                                                vector unsigned int *__c) {
12040   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12041 }
12042
12043 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12044                                                unsigned int *__c) {
12045   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12046 }
12047
12048 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12049                                                vector float *__c) {
12050   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12051 }
12052
12053 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12054                                                float *__c) {
12055   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12056 }
12057
12058 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12059                                                int __b,
12060                                                vector signed long long *__c) {
12061   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12062 }
12063
12064 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12065                                                int __b,
12066                                                vector unsigned long long *__c) {
12067   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12068 }
12069
12070 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12071                                                vector double *__c) {
12072   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12073 }
12074
12075 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12076                                                double *__c) {
12077   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12078 }
12079
12080 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12081                                                vector bool short *__c) {
12082   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12083 }
12084
12085 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12086                                                signed short *__c) {
12087   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12088 }
12089
12090 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12091                                                unsigned short *__c) {
12092   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12093 }
12094 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12095                                                vector signed short *__c) {
12096   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12097 }
12098
12099 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12100                                                signed short *__c) {
12101   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12102 }
12103
12104 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12105                                                int __b,
12106                                                vector unsigned short *__c) {
12107   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12108 }
12109
12110 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12111                                                int __b, unsigned short *__c) {
12112   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12113 }
12114
12115 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12116                                                vector bool char *__c) {
12117   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12118 }
12119
12120 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12121                                                signed char *__c) {
12122   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12123 }
12124
12125 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12126                                                unsigned char *__c) {
12127   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12128 }
12129
12130 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12131                                                vector signed char *__c) {
12132   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12133 }
12134
12135 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12136                                                signed char *__c) {
12137   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12138 }
12139
12140 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12141                                                int __b,
12142                                                vector unsigned char *__c) {
12143   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12144 }
12145
12146 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12147                                                int __b, unsigned char *__c) {
12148   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12149 }
12150
12151 #endif
12152
12153 /* vec_xor */
12154
12155 #define __builtin_altivec_vxor vec_xor
12156
12157 static __inline__ vector signed char __ATTRS_o_ai
12158 vec_xor(vector signed char __a, vector signed char __b) {
12159   return __a ^ __b;
12160 }
12161
12162 static __inline__ vector signed char __ATTRS_o_ai
12163 vec_xor(vector bool char __a, vector signed char __b) {
12164   return (vector signed char)__a ^ __b;
12165 }
12166
12167 static __inline__ vector signed char __ATTRS_o_ai
12168 vec_xor(vector signed char __a, vector bool char __b) {
12169   return __a ^ (vector signed char)__b;
12170 }
12171
12172 static __inline__ vector unsigned char __ATTRS_o_ai
12173 vec_xor(vector unsigned char __a, vector unsigned char __b) {
12174   return __a ^ __b;
12175 }
12176
12177 static __inline__ vector unsigned char __ATTRS_o_ai
12178 vec_xor(vector bool char __a, vector unsigned char __b) {
12179   return (vector unsigned char)__a ^ __b;
12180 }
12181
12182 static __inline__ vector unsigned char __ATTRS_o_ai
12183 vec_xor(vector unsigned char __a, vector bool char __b) {
12184   return __a ^ (vector unsigned char)__b;
12185 }
12186
12187 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12188                                                         vector bool char __b) {
12189   return __a ^ __b;
12190 }
12191
12192 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12193                                                     vector short __b) {
12194   return __a ^ __b;
12195 }
12196
12197 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12198                                                     vector short __b) {
12199   return (vector short)__a ^ __b;
12200 }
12201
12202 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12203                                                     vector bool short __b) {
12204   return __a ^ (vector short)__b;
12205 }
12206
12207 static __inline__ vector unsigned short __ATTRS_o_ai
12208 vec_xor(vector unsigned short __a, vector unsigned short __b) {
12209   return __a ^ __b;
12210 }
12211
12212 static __inline__ vector unsigned short __ATTRS_o_ai
12213 vec_xor(vector bool short __a, vector unsigned short __b) {
12214   return (vector unsigned short)__a ^ __b;
12215 }
12216
12217 static __inline__ vector unsigned short __ATTRS_o_ai
12218 vec_xor(vector unsigned short __a, vector bool short __b) {
12219   return __a ^ (vector unsigned short)__b;
12220 }
12221
12222 static __inline__ vector bool short __ATTRS_o_ai
12223 vec_xor(vector bool short __a, vector bool short __b) {
12224   return __a ^ __b;
12225 }
12226
12227 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12228                                                   vector int __b) {
12229   return __a ^ __b;
12230 }
12231
12232 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12233                                                   vector int __b) {
12234   return (vector int)__a ^ __b;
12235 }
12236
12237 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12238                                                   vector bool int __b) {
12239   return __a ^ (vector int)__b;
12240 }
12241
12242 static __inline__ vector unsigned int __ATTRS_o_ai
12243 vec_xor(vector unsigned int __a, vector unsigned int __b) {
12244   return __a ^ __b;
12245 }
12246
12247 static __inline__ vector unsigned int __ATTRS_o_ai
12248 vec_xor(vector bool int __a, vector unsigned int __b) {
12249   return (vector unsigned int)__a ^ __b;
12250 }
12251
12252 static __inline__ vector unsigned int __ATTRS_o_ai
12253 vec_xor(vector unsigned int __a, vector bool int __b) {
12254   return __a ^ (vector unsigned int)__b;
12255 }
12256
12257 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12258                                                        vector bool int __b) {
12259   return __a ^ __b;
12260 }
12261
12262 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12263                                                     vector float __b) {
12264   vector unsigned int __res =
12265       (vector unsigned int)__a ^ (vector unsigned int)__b;
12266   return (vector float)__res;
12267 }
12268
12269 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12270                                                     vector float __b) {
12271   vector unsigned int __res =
12272       (vector unsigned int)__a ^ (vector unsigned int)__b;
12273   return (vector float)__res;
12274 }
12275
12276 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12277                                                     vector bool int __b) {
12278   vector unsigned int __res =
12279       (vector unsigned int)__a ^ (vector unsigned int)__b;
12280   return (vector float)__res;
12281 }
12282
12283 #ifdef __VSX__
12284 static __inline__ vector signed long long __ATTRS_o_ai
12285 vec_xor(vector signed long long __a, vector signed long long __b) {
12286   return __a ^ __b;
12287 }
12288
12289 static __inline__ vector signed long long __ATTRS_o_ai
12290 vec_xor(vector bool long long __a, vector signed long long __b) {
12291   return (vector signed long long)__a ^ __b;
12292 }
12293
12294 static __inline__ vector signed long long __ATTRS_o_ai
12295 vec_xor(vector signed long long __a, vector bool long long __b) {
12296   return __a ^ (vector signed long long)__b;
12297 }
12298
12299 static __inline__ vector unsigned long long __ATTRS_o_ai
12300 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12301   return __a ^ __b;
12302 }
12303
12304 static __inline__ vector unsigned long long __ATTRS_o_ai
12305 vec_xor(vector bool long long __a, vector unsigned long long __b) {
12306   return (vector unsigned long long)__a ^ __b;
12307 }
12308
12309 static __inline__ vector unsigned long long __ATTRS_o_ai
12310 vec_xor(vector unsigned long long __a, vector bool long long __b) {
12311   return __a ^ (vector unsigned long long)__b;
12312 }
12313
12314 static __inline__ vector bool long long __ATTRS_o_ai
12315 vec_xor(vector bool long long __a, vector bool long long __b) {
12316   return __a ^ __b;
12317 }
12318
12319 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12320                                                      vector double __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
12326 vec_xor(vector double __a, vector bool long long __b) {
12327   return (vector double)((vector unsigned long long)__a ^
12328                          (vector unsigned long long)__b);
12329 }
12330
12331 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12332                                                      vector double __b) {
12333   return (vector double)((vector unsigned long long)__a ^
12334                          (vector unsigned long long)__b);
12335 }
12336 #endif
12337
12338 /* vec_vxor */
12339
12340 static __inline__ vector signed char __ATTRS_o_ai
12341 vec_vxor(vector signed char __a, vector signed char __b) {
12342   return __a ^ __b;
12343 }
12344
12345 static __inline__ vector signed char __ATTRS_o_ai
12346 vec_vxor(vector bool char __a, vector signed char __b) {
12347   return (vector signed char)__a ^ __b;
12348 }
12349
12350 static __inline__ vector signed char __ATTRS_o_ai
12351 vec_vxor(vector signed char __a, vector bool char __b) {
12352   return __a ^ (vector signed char)__b;
12353 }
12354
12355 static __inline__ vector unsigned char __ATTRS_o_ai
12356 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12357   return __a ^ __b;
12358 }
12359
12360 static __inline__ vector unsigned char __ATTRS_o_ai
12361 vec_vxor(vector bool char __a, vector unsigned char __b) {
12362   return (vector unsigned char)__a ^ __b;
12363 }
12364
12365 static __inline__ vector unsigned char __ATTRS_o_ai
12366 vec_vxor(vector unsigned char __a, vector bool char __b) {
12367   return __a ^ (vector unsigned char)__b;
12368 }
12369
12370 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12371                                                          vector bool char __b) {
12372   return __a ^ __b;
12373 }
12374
12375 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12376                                                      vector short __b) {
12377   return __a ^ __b;
12378 }
12379
12380 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12381                                                      vector short __b) {
12382   return (vector short)__a ^ __b;
12383 }
12384
12385 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12386                                                      vector bool short __b) {
12387   return __a ^ (vector short)__b;
12388 }
12389
12390 static __inline__ vector unsigned short __ATTRS_o_ai
12391 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12392   return __a ^ __b;
12393 }
12394
12395 static __inline__ vector unsigned short __ATTRS_o_ai
12396 vec_vxor(vector bool short __a, vector unsigned short __b) {
12397   return (vector unsigned short)__a ^ __b;
12398 }
12399
12400 static __inline__ vector unsigned short __ATTRS_o_ai
12401 vec_vxor(vector unsigned short __a, vector bool short __b) {
12402   return __a ^ (vector unsigned short)__b;
12403 }
12404
12405 static __inline__ vector bool short __ATTRS_o_ai
12406 vec_vxor(vector bool short __a, vector bool short __b) {
12407   return __a ^ __b;
12408 }
12409
12410 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12411                                                    vector int __b) {
12412   return __a ^ __b;
12413 }
12414
12415 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12416                                                    vector int __b) {
12417   return (vector int)__a ^ __b;
12418 }
12419
12420 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12421                                                    vector bool int __b) {
12422   return __a ^ (vector int)__b;
12423 }
12424
12425 static __inline__ vector unsigned int __ATTRS_o_ai
12426 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12427   return __a ^ __b;
12428 }
12429
12430 static __inline__ vector unsigned int __ATTRS_o_ai
12431 vec_vxor(vector bool int __a, vector unsigned int __b) {
12432   return (vector unsigned int)__a ^ __b;
12433 }
12434
12435 static __inline__ vector unsigned int __ATTRS_o_ai
12436 vec_vxor(vector unsigned int __a, vector bool int __b) {
12437   return __a ^ (vector unsigned int)__b;
12438 }
12439
12440 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12441                                                         vector bool int __b) {
12442   return __a ^ __b;
12443 }
12444
12445 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12446                                                      vector float __b) {
12447   vector unsigned int __res =
12448       (vector unsigned int)__a ^ (vector unsigned int)__b;
12449   return (vector float)__res;
12450 }
12451
12452 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12453                                                      vector float __b) {
12454   vector unsigned int __res =
12455       (vector unsigned int)__a ^ (vector unsigned int)__b;
12456   return (vector float)__res;
12457 }
12458
12459 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12460                                                      vector bool int __b) {
12461   vector unsigned int __res =
12462       (vector unsigned int)__a ^ (vector unsigned int)__b;
12463   return (vector float)__res;
12464 }
12465
12466 #ifdef __VSX__
12467 static __inline__ vector signed long long __ATTRS_o_ai
12468 vec_vxor(vector signed long long __a, vector signed long long __b) {
12469   return __a ^ __b;
12470 }
12471
12472 static __inline__ vector signed long long __ATTRS_o_ai
12473 vec_vxor(vector bool long long __a, vector signed long long __b) {
12474   return (vector signed long long)__a ^ __b;
12475 }
12476
12477 static __inline__ vector signed long long __ATTRS_o_ai
12478 vec_vxor(vector signed long long __a, vector bool long long __b) {
12479   return __a ^ (vector signed long long)__b;
12480 }
12481
12482 static __inline__ vector unsigned long long __ATTRS_o_ai
12483 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12484   return __a ^ __b;
12485 }
12486
12487 static __inline__ vector unsigned long long __ATTRS_o_ai
12488 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12489   return (vector unsigned long long)__a ^ __b;
12490 }
12491
12492 static __inline__ vector unsigned long long __ATTRS_o_ai
12493 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12494   return __a ^ (vector unsigned long long)__b;
12495 }
12496
12497 static __inline__ vector bool long long __ATTRS_o_ai
12498 vec_vxor(vector bool long long __a, vector bool long long __b) {
12499   return __a ^ __b;
12500 }
12501 #endif
12502
12503 /* ------------------------ extensions for CBEA ----------------------------- */
12504
12505 /* vec_extract */
12506
12507 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12508                                                        int __b) {
12509   return __a[__b];
12510 }
12511
12512 static __inline__ unsigned char __ATTRS_o_ai
12513 vec_extract(vector unsigned char __a, int __b) {
12514   return __a[__b];
12515 }
12516
12517 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12518                                                          int __b) {
12519   return __a[__b];
12520 }
12521
12522 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12523                                                         int __b) {
12524   return __a[__b];
12525 }
12526
12527 static __inline__ unsigned short __ATTRS_o_ai
12528 vec_extract(vector unsigned short __a, int __b) {
12529   return __a[__b];
12530 }
12531
12532 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12533                                                           int __b) {
12534   return __a[__b];
12535 }
12536
12537 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12538                                                       int __b) {
12539   return __a[__b];
12540 }
12541
12542 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12543                                                         int __b) {
12544   return __a[__b];
12545 }
12546
12547 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12548                                                         int __b) {
12549   return __a[__b];
12550 }
12551
12552 #ifdef __VSX__
12553 static __inline__ signed long long __ATTRS_o_ai
12554 vec_extract(vector signed long long __a, int __b) {
12555   return __a[__b];
12556 }
12557
12558 static __inline__ unsigned long long __ATTRS_o_ai
12559 vec_extract(vector unsigned long long __a, int __b) {
12560   return __a[__b];
12561 }
12562
12563 static __inline__ unsigned long long __ATTRS_o_ai
12564 vec_extract(vector bool long long __a, int __b) {
12565   return __a[__b];
12566 }
12567
12568 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12569   return __a[__b];
12570 }
12571 #endif
12572
12573 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12574   return __a[__b];
12575 }
12576
12577 #ifdef __POWER9_VECTOR__
12578
12579 #define vec_insert4b __builtin_vsx_insertword
12580 #define vec_extract4b __builtin_vsx_extractuword
12581
12582 /* vec_extract_exp */
12583
12584 static __inline__ vector unsigned int __ATTRS_o_ai
12585 vec_extract_exp(vector float __a) {
12586   return __builtin_vsx_xvxexpsp(__a);
12587 }
12588
12589 static __inline__ vector unsigned long long __ATTRS_o_ai
12590 vec_extract_exp(vector double __a) {
12591   return __builtin_vsx_xvxexpdp(__a);
12592 }
12593
12594 /* vec_extract_sig */
12595
12596 static __inline__ vector unsigned int __ATTRS_o_ai
12597 vec_extract_sig(vector float __a) {
12598   return __builtin_vsx_xvxsigsp(__a);
12599 }
12600
12601 static __inline__ vector unsigned long long __ATTRS_o_ai
12602 vec_extract_sig (vector double __a) {
12603   return __builtin_vsx_xvxsigdp(__a);
12604 }
12605
12606 static __inline__ vector float __ATTRS_o_ai
12607 vec_extract_fp32_from_shorth(vector unsigned short __a) {
12608   vector unsigned short __b =
12609 #ifdef __LITTLE_ENDIAN__
12610             __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12611 #else
12612             __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12613 #endif
12614   return __builtin_vsx_xvcvhpsp(__b);
12615 }
12616
12617 static __inline__ vector float __ATTRS_o_ai
12618 vec_extract_fp32_from_shortl(vector unsigned short __a) {
12619   vector unsigned short __b =
12620 #ifdef __LITTLE_ENDIAN__
12621             __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12622 #else
12623             __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12624 #endif
12625   return __builtin_vsx_xvcvhpsp(__b);
12626 }
12627 #endif /* __POWER9_VECTOR__ */
12628
12629 /* vec_insert */
12630
12631 static __inline__ vector signed char __ATTRS_o_ai
12632 vec_insert(signed char __a, vector signed char __b, int __c) {
12633   __b[__c] = __a;
12634   return __b;
12635 }
12636
12637 static __inline__ vector unsigned char __ATTRS_o_ai
12638 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12639   __b[__c] = __a;
12640   return __b;
12641 }
12642
12643 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12644                                                            vector bool char __b,
12645                                                            int __c) {
12646   __b[__c] = __a;
12647   return __b;
12648 }
12649
12650 static __inline__ vector signed short __ATTRS_o_ai
12651 vec_insert(signed short __a, vector signed short __b, int __c) {
12652   __b[__c] = __a;
12653   return __b;
12654 }
12655
12656 static __inline__ vector unsigned short __ATTRS_o_ai
12657 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12658   __b[__c] = __a;
12659   return __b;
12660 }
12661
12662 static __inline__ vector bool short __ATTRS_o_ai
12663 vec_insert(unsigned short __a, vector bool short __b, int __c) {
12664   __b[__c] = __a;
12665   return __b;
12666 }
12667
12668 static __inline__ vector signed int __ATTRS_o_ai
12669 vec_insert(signed int __a, vector signed int __b, int __c) {
12670   __b[__c] = __a;
12671   return __b;
12672 }
12673
12674 static __inline__ vector unsigned int __ATTRS_o_ai
12675 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12676   __b[__c] = __a;
12677   return __b;
12678 }
12679
12680 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12681                                                           vector bool int __b,
12682                                                           int __c) {
12683   __b[__c] = __a;
12684   return __b;
12685 }
12686
12687 #ifdef __VSX__
12688 static __inline__ vector signed long long __ATTRS_o_ai
12689 vec_insert(signed long long __a, vector signed long long __b, int __c) {
12690   __b[__c] = __a;
12691   return __b;
12692 }
12693
12694 static __inline__ vector unsigned long long __ATTRS_o_ai
12695 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12696   __b[__c] = __a;
12697   return __b;
12698 }
12699
12700 static __inline__ vector bool long long __ATTRS_o_ai
12701 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12702   __b[__c] = __a;
12703   return __b;
12704 }
12705 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12706                                                         vector double __b,
12707                                                         int __c) {
12708   __b[__c] = __a;
12709   return __b;
12710 }
12711 #endif
12712
12713 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12714                                                        vector float __b,
12715                                                        int __c) {
12716   __b[__c] = __a;
12717   return __b;
12718 }
12719
12720 /* vec_lvlx */
12721
12722 static __inline__ vector signed char __ATTRS_o_ai
12723 vec_lvlx(int __a, const signed char *__b) {
12724   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12725                   vec_lvsl(__a, __b));
12726 }
12727
12728 static __inline__ vector signed char __ATTRS_o_ai
12729 vec_lvlx(int __a, const vector signed char *__b) {
12730   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12731                   vec_lvsl(__a, (unsigned char *)__b));
12732 }
12733
12734 static __inline__ vector unsigned char __ATTRS_o_ai
12735 vec_lvlx(int __a, const unsigned char *__b) {
12736   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12737                   vec_lvsl(__a, __b));
12738 }
12739
12740 static __inline__ vector unsigned char __ATTRS_o_ai
12741 vec_lvlx(int __a, const vector unsigned char *__b) {
12742   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12743                   vec_lvsl(__a, (unsigned char *)__b));
12744 }
12745
12746 static __inline__ vector bool char __ATTRS_o_ai
12747 vec_lvlx(int __a, const vector bool char *__b) {
12748   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12749                   vec_lvsl(__a, (unsigned char *)__b));
12750 }
12751
12752 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12753                                                      const short *__b) {
12754   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12755 }
12756
12757 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12758                                                      const vector short *__b) {
12759   return vec_perm(vec_ld(__a, __b), (vector short)(0),
12760                   vec_lvsl(__a, (unsigned char *)__b));
12761 }
12762
12763 static __inline__ vector unsigned short __ATTRS_o_ai
12764 vec_lvlx(int __a, const unsigned short *__b) {
12765   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12766                   vec_lvsl(__a, __b));
12767 }
12768
12769 static __inline__ vector unsigned short __ATTRS_o_ai
12770 vec_lvlx(int __a, const vector unsigned short *__b) {
12771   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12772                   vec_lvsl(__a, (unsigned char *)__b));
12773 }
12774
12775 static __inline__ vector bool short __ATTRS_o_ai
12776 vec_lvlx(int __a, const vector bool short *__b) {
12777   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12778                   vec_lvsl(__a, (unsigned char *)__b));
12779 }
12780
12781 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12782                                                      const vector pixel *__b) {
12783   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12784                   vec_lvsl(__a, (unsigned char *)__b));
12785 }
12786
12787 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12788   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12789 }
12790
12791 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12792                                                    const vector int *__b) {
12793   return vec_perm(vec_ld(__a, __b), (vector int)(0),
12794                   vec_lvsl(__a, (unsigned char *)__b));
12795 }
12796
12797 static __inline__ vector unsigned int __ATTRS_o_ai
12798 vec_lvlx(int __a, const unsigned int *__b) {
12799   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12800                   vec_lvsl(__a, __b));
12801 }
12802
12803 static __inline__ vector unsigned int __ATTRS_o_ai
12804 vec_lvlx(int __a, const vector unsigned int *__b) {
12805   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12806                   vec_lvsl(__a, (unsigned char *)__b));
12807 }
12808
12809 static __inline__ vector bool int __ATTRS_o_ai
12810 vec_lvlx(int __a, const vector bool int *__b) {
12811   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12812                   vec_lvsl(__a, (unsigned char *)__b));
12813 }
12814
12815 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12816                                                      const float *__b) {
12817   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12818 }
12819
12820 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12821                                                      const vector float *__b) {
12822   return vec_perm(vec_ld(__a, __b), (vector float)(0),
12823                   vec_lvsl(__a, (unsigned char *)__b));
12824 }
12825
12826 /* vec_lvlxl */
12827
12828 static __inline__ vector signed char __ATTRS_o_ai
12829 vec_lvlxl(int __a, const signed char *__b) {
12830   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12831                   vec_lvsl(__a, __b));
12832 }
12833
12834 static __inline__ vector signed char __ATTRS_o_ai
12835 vec_lvlxl(int __a, const vector signed char *__b) {
12836   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12837                   vec_lvsl(__a, (unsigned char *)__b));
12838 }
12839
12840 static __inline__ vector unsigned char __ATTRS_o_ai
12841 vec_lvlxl(int __a, const unsigned char *__b) {
12842   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12843                   vec_lvsl(__a, __b));
12844 }
12845
12846 static __inline__ vector unsigned char __ATTRS_o_ai
12847 vec_lvlxl(int __a, const vector unsigned char *__b) {
12848   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12849                   vec_lvsl(__a, (unsigned char *)__b));
12850 }
12851
12852 static __inline__ vector bool char __ATTRS_o_ai
12853 vec_lvlxl(int __a, const vector bool char *__b) {
12854   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12855                   vec_lvsl(__a, (unsigned char *)__b));
12856 }
12857
12858 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12859                                                       const short *__b) {
12860   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12861 }
12862
12863 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12864                                                       const vector short *__b) {
12865   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12866                   vec_lvsl(__a, (unsigned char *)__b));
12867 }
12868
12869 static __inline__ vector unsigned short __ATTRS_o_ai
12870 vec_lvlxl(int __a, const unsigned short *__b) {
12871   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12872                   vec_lvsl(__a, __b));
12873 }
12874
12875 static __inline__ vector unsigned short __ATTRS_o_ai
12876 vec_lvlxl(int __a, const vector unsigned short *__b) {
12877   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12878                   vec_lvsl(__a, (unsigned char *)__b));
12879 }
12880
12881 static __inline__ vector bool short __ATTRS_o_ai
12882 vec_lvlxl(int __a, const vector bool short *__b) {
12883   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12884                   vec_lvsl(__a, (unsigned char *)__b));
12885 }
12886
12887 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12888                                                       const vector pixel *__b) {
12889   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12890                   vec_lvsl(__a, (unsigned char *)__b));
12891 }
12892
12893 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12894   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12895 }
12896
12897 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12898                                                     const vector int *__b) {
12899   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12900                   vec_lvsl(__a, (unsigned char *)__b));
12901 }
12902
12903 static __inline__ vector unsigned int __ATTRS_o_ai
12904 vec_lvlxl(int __a, const unsigned int *__b) {
12905   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12906                   vec_lvsl(__a, __b));
12907 }
12908
12909 static __inline__ vector unsigned int __ATTRS_o_ai
12910 vec_lvlxl(int __a, const vector unsigned int *__b) {
12911   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12912                   vec_lvsl(__a, (unsigned char *)__b));
12913 }
12914
12915 static __inline__ vector bool int __ATTRS_o_ai
12916 vec_lvlxl(int __a, const vector bool int *__b) {
12917   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12918                   vec_lvsl(__a, (unsigned char *)__b));
12919 }
12920
12921 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12922                                                       const float *__b) {
12923   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12924 }
12925
12926 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12927                                                       vector float *__b) {
12928   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12929                   vec_lvsl(__a, (unsigned char *)__b));
12930 }
12931
12932 /* vec_lvrx */
12933
12934 static __inline__ vector signed char __ATTRS_o_ai
12935 vec_lvrx(int __a, const signed char *__b) {
12936   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12937                   vec_lvsl(__a, __b));
12938 }
12939
12940 static __inline__ vector signed char __ATTRS_o_ai
12941 vec_lvrx(int __a, const vector signed char *__b) {
12942   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12943                   vec_lvsl(__a, (unsigned char *)__b));
12944 }
12945
12946 static __inline__ vector unsigned char __ATTRS_o_ai
12947 vec_lvrx(int __a, const unsigned char *__b) {
12948   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12949                   vec_lvsl(__a, __b));
12950 }
12951
12952 static __inline__ vector unsigned char __ATTRS_o_ai
12953 vec_lvrx(int __a, const vector unsigned char *__b) {
12954   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12955                   vec_lvsl(__a, (unsigned char *)__b));
12956 }
12957
12958 static __inline__ vector bool char __ATTRS_o_ai
12959 vec_lvrx(int __a, const vector bool char *__b) {
12960   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12961                   vec_lvsl(__a, (unsigned char *)__b));
12962 }
12963
12964 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12965                                                      const short *__b) {
12966   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12967 }
12968
12969 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12970                                                      const vector short *__b) {
12971   return vec_perm((vector short)(0), vec_ld(__a, __b),
12972                   vec_lvsl(__a, (unsigned char *)__b));
12973 }
12974
12975 static __inline__ vector unsigned short __ATTRS_o_ai
12976 vec_lvrx(int __a, const unsigned short *__b) {
12977   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12978                   vec_lvsl(__a, __b));
12979 }
12980
12981 static __inline__ vector unsigned short __ATTRS_o_ai
12982 vec_lvrx(int __a, const vector unsigned short *__b) {
12983   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12984                   vec_lvsl(__a, (unsigned char *)__b));
12985 }
12986
12987 static __inline__ vector bool short __ATTRS_o_ai
12988 vec_lvrx(int __a, const vector bool short *__b) {
12989   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12990                   vec_lvsl(__a, (unsigned char *)__b));
12991 }
12992
12993 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12994                                                      const vector pixel *__b) {
12995   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12996                   vec_lvsl(__a, (unsigned char *)__b));
12997 }
12998
12999 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
13000   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13001 }
13002
13003 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
13004                                                    const vector int *__b) {
13005   return vec_perm((vector int)(0), vec_ld(__a, __b),
13006                   vec_lvsl(__a, (unsigned char *)__b));
13007 }
13008
13009 static __inline__ vector unsigned int __ATTRS_o_ai
13010 vec_lvrx(int __a, const unsigned int *__b) {
13011   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13012                   vec_lvsl(__a, __b));
13013 }
13014
13015 static __inline__ vector unsigned int __ATTRS_o_ai
13016 vec_lvrx(int __a, const vector unsigned int *__b) {
13017   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13018                   vec_lvsl(__a, (unsigned char *)__b));
13019 }
13020
13021 static __inline__ vector bool int __ATTRS_o_ai
13022 vec_lvrx(int __a, const vector bool int *__b) {
13023   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13024                   vec_lvsl(__a, (unsigned char *)__b));
13025 }
13026
13027 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13028                                                      const float *__b) {
13029   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13030 }
13031
13032 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13033                                                      const vector float *__b) {
13034   return vec_perm((vector float)(0), vec_ld(__a, __b),
13035                   vec_lvsl(__a, (unsigned char *)__b));
13036 }
13037
13038 /* vec_lvrxl */
13039
13040 static __inline__ vector signed char __ATTRS_o_ai
13041 vec_lvrxl(int __a, const signed char *__b) {
13042   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13043                   vec_lvsl(__a, __b));
13044 }
13045
13046 static __inline__ vector signed char __ATTRS_o_ai
13047 vec_lvrxl(int __a, const vector signed char *__b) {
13048   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13049                   vec_lvsl(__a, (unsigned char *)__b));
13050 }
13051
13052 static __inline__ vector unsigned char __ATTRS_o_ai
13053 vec_lvrxl(int __a, const unsigned char *__b) {
13054   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13055                   vec_lvsl(__a, __b));
13056 }
13057
13058 static __inline__ vector unsigned char __ATTRS_o_ai
13059 vec_lvrxl(int __a, const vector unsigned char *__b) {
13060   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13061                   vec_lvsl(__a, (unsigned char *)__b));
13062 }
13063
13064 static __inline__ vector bool char __ATTRS_o_ai
13065 vec_lvrxl(int __a, const vector bool char *__b) {
13066   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13067                   vec_lvsl(__a, (unsigned char *)__b));
13068 }
13069
13070 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13071                                                       const short *__b) {
13072   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13073 }
13074
13075 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13076                                                       const vector short *__b) {
13077   return vec_perm((vector short)(0), vec_ldl(__a, __b),
13078                   vec_lvsl(__a, (unsigned char *)__b));
13079 }
13080
13081 static __inline__ vector unsigned short __ATTRS_o_ai
13082 vec_lvrxl(int __a, const unsigned short *__b) {
13083   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13084                   vec_lvsl(__a, __b));
13085 }
13086
13087 static __inline__ vector unsigned short __ATTRS_o_ai
13088 vec_lvrxl(int __a, const vector unsigned short *__b) {
13089   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13090                   vec_lvsl(__a, (unsigned char *)__b));
13091 }
13092
13093 static __inline__ vector bool short __ATTRS_o_ai
13094 vec_lvrxl(int __a, const vector bool short *__b) {
13095   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13096                   vec_lvsl(__a, (unsigned char *)__b));
13097 }
13098
13099 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13100                                                       const vector pixel *__b) {
13101   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13102                   vec_lvsl(__a, (unsigned char *)__b));
13103 }
13104
13105 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13106   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13107 }
13108
13109 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13110                                                     const vector int *__b) {
13111   return vec_perm((vector int)(0), vec_ldl(__a, __b),
13112                   vec_lvsl(__a, (unsigned char *)__b));
13113 }
13114
13115 static __inline__ vector unsigned int __ATTRS_o_ai
13116 vec_lvrxl(int __a, const unsigned int *__b) {
13117   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13118                   vec_lvsl(__a, __b));
13119 }
13120
13121 static __inline__ vector unsigned int __ATTRS_o_ai
13122 vec_lvrxl(int __a, const vector unsigned int *__b) {
13123   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13124                   vec_lvsl(__a, (unsigned char *)__b));
13125 }
13126
13127 static __inline__ vector bool int __ATTRS_o_ai
13128 vec_lvrxl(int __a, const vector bool int *__b) {
13129   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13130                   vec_lvsl(__a, (unsigned char *)__b));
13131 }
13132
13133 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13134                                                       const float *__b) {
13135   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13136 }
13137
13138 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13139                                                       const vector float *__b) {
13140   return vec_perm((vector float)(0), vec_ldl(__a, __b),
13141                   vec_lvsl(__a, (unsigned char *)__b));
13142 }
13143
13144 /* vec_stvlx */
13145
13146 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13147                                               signed char *__c) {
13148   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13149                 __c);
13150 }
13151
13152 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13153                                               vector signed char *__c) {
13154   return vec_st(
13155       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13156       __b, __c);
13157 }
13158
13159 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13160                                               unsigned char *__c) {
13161   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13162                 __c);
13163 }
13164
13165 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13166                                               vector unsigned char *__c) {
13167   return vec_st(
13168       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13169       __b, __c);
13170 }
13171
13172 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13173                                               vector bool char *__c) {
13174   return vec_st(
13175       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13176       __b, __c);
13177 }
13178
13179 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13180                                               short *__c) {
13181   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13182                 __c);
13183 }
13184
13185 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13186                                               vector short *__c) {
13187   return vec_st(
13188       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13189       __b, __c);
13190 }
13191
13192 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13193                                               int __b, unsigned short *__c) {
13194   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13195                 __c);
13196 }
13197
13198 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13199                                               int __b,
13200                                               vector unsigned short *__c) {
13201   return vec_st(
13202       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13203       __b, __c);
13204 }
13205
13206 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13207                                               vector bool short *__c) {
13208   return vec_st(
13209       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13210       __b, __c);
13211 }
13212
13213 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13214                                               vector pixel *__c) {
13215   return vec_st(
13216       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13217       __b, __c);
13218 }
13219
13220 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13221                                               int *__c) {
13222   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13223                 __c);
13224 }
13225
13226 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13227                                               vector int *__c) {
13228   return vec_st(
13229       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13230       __b, __c);
13231 }
13232
13233 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13234                                               unsigned int *__c) {
13235   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13236                 __c);
13237 }
13238
13239 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13240                                               vector unsigned int *__c) {
13241   return vec_st(
13242       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13243       __b, __c);
13244 }
13245
13246 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13247                                               vector bool int *__c) {
13248   return vec_st(
13249       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13250       __b, __c);
13251 }
13252
13253 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13254                                               vector float *__c) {
13255   return vec_st(
13256       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13257       __b, __c);
13258 }
13259
13260 /* vec_stvlxl */
13261
13262 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13263                                                signed char *__c) {
13264   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13265                  __c);
13266 }
13267
13268 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13269                                                vector signed char *__c) {
13270   return vec_stl(
13271       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13272       __b, __c);
13273 }
13274
13275 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13276                                                int __b, unsigned char *__c) {
13277   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13278                  __c);
13279 }
13280
13281 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13282                                                int __b,
13283                                                vector unsigned char *__c) {
13284   return vec_stl(
13285       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13286       __b, __c);
13287 }
13288
13289 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13290                                                vector bool char *__c) {
13291   return vec_stl(
13292       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13293       __b, __c);
13294 }
13295
13296 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13297                                                short *__c) {
13298   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13299                  __c);
13300 }
13301
13302 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13303                                                vector short *__c) {
13304   return vec_stl(
13305       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13306       __b, __c);
13307 }
13308
13309 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13310                                                int __b, unsigned short *__c) {
13311   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13312                  __c);
13313 }
13314
13315 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13316                                                int __b,
13317                                                vector unsigned short *__c) {
13318   return vec_stl(
13319       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13320       __b, __c);
13321 }
13322
13323 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13324                                                vector bool short *__c) {
13325   return vec_stl(
13326       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13327       __b, __c);
13328 }
13329
13330 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13331                                                vector pixel *__c) {
13332   return vec_stl(
13333       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13334       __b, __c);
13335 }
13336
13337 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13338                                                int *__c) {
13339   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13340                  __c);
13341 }
13342
13343 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13344                                                vector int *__c) {
13345   return vec_stl(
13346       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13347       __b, __c);
13348 }
13349
13350 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13351                                                unsigned int *__c) {
13352   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13353                  __c);
13354 }
13355
13356 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13357                                                vector unsigned int *__c) {
13358   return vec_stl(
13359       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13360       __b, __c);
13361 }
13362
13363 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13364                                                vector bool int *__c) {
13365   return vec_stl(
13366       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13367       __b, __c);
13368 }
13369
13370 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13371                                                vector float *__c) {
13372   return vec_stl(
13373       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13374       __b, __c);
13375 }
13376
13377 /* vec_stvrx */
13378
13379 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13380                                               signed char *__c) {
13381   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13382                 __c);
13383 }
13384
13385 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13386                                               vector signed char *__c) {
13387   return vec_st(
13388       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13389       __b, __c);
13390 }
13391
13392 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13393                                               unsigned char *__c) {
13394   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13395                 __c);
13396 }
13397
13398 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13399                                               vector unsigned char *__c) {
13400   return vec_st(
13401       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13402       __b, __c);
13403 }
13404
13405 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13406                                               vector bool char *__c) {
13407   return vec_st(
13408       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13409       __b, __c);
13410 }
13411
13412 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13413                                               short *__c) {
13414   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13415                 __c);
13416 }
13417
13418 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13419                                               vector short *__c) {
13420   return vec_st(
13421       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13422       __b, __c);
13423 }
13424
13425 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13426                                               int __b, unsigned short *__c) {
13427   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13428                 __c);
13429 }
13430
13431 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13432                                               int __b,
13433                                               vector unsigned short *__c) {
13434   return vec_st(
13435       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13436       __b, __c);
13437 }
13438
13439 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13440                                               vector bool short *__c) {
13441   return vec_st(
13442       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13443       __b, __c);
13444 }
13445
13446 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13447                                               vector pixel *__c) {
13448   return vec_st(
13449       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13450       __b, __c);
13451 }
13452
13453 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13454                                               int *__c) {
13455   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13456                 __c);
13457 }
13458
13459 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13460                                               vector int *__c) {
13461   return vec_st(
13462       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13463       __b, __c);
13464 }
13465
13466 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13467                                               unsigned int *__c) {
13468   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13469                 __c);
13470 }
13471
13472 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13473                                               vector unsigned int *__c) {
13474   return vec_st(
13475       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13476       __b, __c);
13477 }
13478
13479 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13480                                               vector bool int *__c) {
13481   return vec_st(
13482       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13483       __b, __c);
13484 }
13485
13486 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13487                                               vector float *__c) {
13488   return vec_st(
13489       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13490       __b, __c);
13491 }
13492
13493 /* vec_stvrxl */
13494
13495 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13496                                                signed char *__c) {
13497   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13498                  __c);
13499 }
13500
13501 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13502                                                vector signed char *__c) {
13503   return vec_stl(
13504       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13505       __b, __c);
13506 }
13507
13508 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13509                                                int __b, unsigned char *__c) {
13510   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13511                  __c);
13512 }
13513
13514 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13515                                                int __b,
13516                                                vector unsigned char *__c) {
13517   return vec_stl(
13518       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13519       __b, __c);
13520 }
13521
13522 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13523                                                vector bool char *__c) {
13524   return vec_stl(
13525       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13526       __b, __c);
13527 }
13528
13529 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13530                                                short *__c) {
13531   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13532                  __c);
13533 }
13534
13535 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13536                                                vector short *__c) {
13537   return vec_stl(
13538       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13539       __b, __c);
13540 }
13541
13542 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13543                                                int __b, unsigned short *__c) {
13544   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13545                  __c);
13546 }
13547
13548 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13549                                                int __b,
13550                                                vector unsigned short *__c) {
13551   return vec_stl(
13552       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13553       __b, __c);
13554 }
13555
13556 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13557                                                vector bool short *__c) {
13558   return vec_stl(
13559       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13560       __b, __c);
13561 }
13562
13563 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13564                                                vector pixel *__c) {
13565   return vec_stl(
13566       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13567       __b, __c);
13568 }
13569
13570 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13571                                                int *__c) {
13572   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13573                  __c);
13574 }
13575
13576 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13577                                                vector int *__c) {
13578   return vec_stl(
13579       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13580       __b, __c);
13581 }
13582
13583 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13584                                                unsigned int *__c) {
13585   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13586                  __c);
13587 }
13588
13589 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13590                                                vector unsigned int *__c) {
13591   return vec_stl(
13592       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13593       __b, __c);
13594 }
13595
13596 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13597                                                vector bool int *__c) {
13598   return vec_stl(
13599       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13600       __b, __c);
13601 }
13602
13603 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13604                                                vector float *__c) {
13605   return vec_stl(
13606       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13607       __b, __c);
13608 }
13609
13610 /* vec_promote */
13611
13612 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13613                                                               int __b) {
13614   vector signed char __res = (vector signed char)(0);
13615   __res[__b] = __a;
13616   return __res;
13617 }
13618
13619 static __inline__ vector unsigned char __ATTRS_o_ai
13620 vec_promote(unsigned char __a, int __b) {
13621   vector unsigned char __res = (vector unsigned char)(0);
13622   __res[__b] = __a;
13623   return __res;
13624 }
13625
13626 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13627   vector short __res = (vector short)(0);
13628   __res[__b] = __a;
13629   return __res;
13630 }
13631
13632 static __inline__ vector unsigned short __ATTRS_o_ai
13633 vec_promote(unsigned short __a, int __b) {
13634   vector unsigned short __res = (vector unsigned short)(0);
13635   __res[__b] = __a;
13636   return __res;
13637 }
13638
13639 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13640   vector int __res = (vector int)(0);
13641   __res[__b] = __a;
13642   return __res;
13643 }
13644
13645 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13646                                                                int __b) {
13647   vector unsigned int __res = (vector unsigned int)(0);
13648   __res[__b] = __a;
13649   return __res;
13650 }
13651
13652 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13653   vector float __res = (vector float)(0);
13654   __res[__b] = __a;
13655   return __res;
13656 }
13657
13658 /* vec_splats */
13659
13660 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13661   return (vector signed char)(__a);
13662 }
13663
13664 static __inline__ vector unsigned char __ATTRS_o_ai
13665 vec_splats(unsigned char __a) {
13666   return (vector unsigned char)(__a);
13667 }
13668
13669 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13670   return (vector short)(__a);
13671 }
13672
13673 static __inline__ vector unsigned short __ATTRS_o_ai
13674 vec_splats(unsigned short __a) {
13675   return (vector unsigned short)(__a);
13676 }
13677
13678 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13679   return (vector int)(__a);
13680 }
13681
13682 static __inline__ vector unsigned int __ATTRS_o_ai
13683 vec_splats(unsigned int __a) {
13684   return (vector unsigned int)(__a);
13685 }
13686
13687 #ifdef __VSX__
13688 static __inline__ vector signed long long __ATTRS_o_ai
13689 vec_splats(signed long long __a) {
13690   return (vector signed long long)(__a);
13691 }
13692
13693 static __inline__ vector unsigned long long __ATTRS_o_ai
13694 vec_splats(unsigned long long __a) {
13695   return (vector unsigned long long)(__a);
13696 }
13697
13698 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13699 static __inline__ vector signed __int128 __ATTRS_o_ai
13700 vec_splats(signed __int128 __a) {
13701   return (vector signed __int128)(__a);
13702 }
13703
13704 static __inline__ vector unsigned __int128 __ATTRS_o_ai
13705 vec_splats(unsigned __int128 __a) {
13706   return (vector unsigned __int128)(__a);
13707 }
13708
13709 #endif
13710
13711 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13712   return (vector double)(__a);
13713 }
13714 #endif
13715
13716 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13717   return (vector float)(__a);
13718 }
13719
13720 /* ----------------------------- predicates --------------------------------- */
13721
13722 /* vec_all_eq */
13723
13724 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13725                                               vector signed 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 signed char __a,
13731                                               vector bool 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 unsigned 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 unsigned char __a,
13743                                               vector bool 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 signed 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 unsigned 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 bool char __a,
13761                                               vector bool char __b) {
13762   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13763                                       (vector char)__b);
13764 }
13765
13766 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13767                                               vector short __b) {
13768   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13769 }
13770
13771 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13772                                               vector bool short __b) {
13773   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13774 }
13775
13776 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13777                                               vector unsigned 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 unsigned short __a,
13783                                               vector bool 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 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 unsigned 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 bool short __a,
13801                                               vector bool short __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 pixel __a,
13807                                               vector pixel __b) {
13808   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13809                                       (vector short)__b);
13810 }
13811
13812 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13813   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13814 }
13815
13816 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13817                                               vector bool int __b) {
13818   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13819 }
13820
13821 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13822                                               vector unsigned 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 unsigned int __a,
13828                                               vector bool 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 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 unsigned int __b) {
13841   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13842                                       (vector int)__b);
13843 }
13844
13845 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13846                                               vector bool int __b) {
13847   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13848                                       (vector int)__b);
13849 }
13850
13851 #ifdef __POWER8_VECTOR__
13852 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13853                                               vector signed long long __b) {
13854   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13855 }
13856
13857 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13858                                               vector bool long long __b) {
13859   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13860 }
13861
13862 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13863                                               vector unsigned 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 unsigned long long __a,
13869                                               vector bool 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 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 unsigned long long __b) {
13882   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13883                                       (vector long long)__b);
13884 }
13885
13886 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13887                                               vector bool long long __b) {
13888   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13889                                       (vector long long)__b);
13890 }
13891 #endif
13892
13893 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13894                                               vector float __b) {
13895 #ifdef __VSX__
13896   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13897 #else
13898   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13899 #endif
13900 }
13901
13902 #ifdef __VSX__
13903 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13904                                               vector double __b) {
13905   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13906 }
13907 #endif
13908
13909 /* vec_all_ge */
13910
13911 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13912                                               vector signed char __b) {
13913   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13914 }
13915
13916 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13917                                               vector bool char __b) {
13918   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13919 }
13920
13921 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13922                                               vector unsigned char __b) {
13923   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13924 }
13925
13926 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13927                                               vector bool char __b) {
13928   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13929 }
13930
13931 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13932                                               vector signed char __b) {
13933   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13934                                       (vector unsigned char)__a);
13935 }
13936
13937 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13938                                               vector unsigned char __b) {
13939   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13940 }
13941
13942 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13943                                               vector bool char __b) {
13944   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13945                                       (vector unsigned char)__a);
13946 }
13947
13948 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13949                                               vector short __b) {
13950   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13951 }
13952
13953 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13954                                               vector bool short __b) {
13955   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13956 }
13957
13958 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13959                                               vector unsigned short __b) {
13960   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13961 }
13962
13963 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13964                                               vector bool short __b) {
13965   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13966                                       __a);
13967 }
13968
13969 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13970                                               vector short __b) {
13971   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13972                                       (vector unsigned short)__a);
13973 }
13974
13975 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13976                                               vector unsigned short __b) {
13977   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13978                                       (vector unsigned short)__a);
13979 }
13980
13981 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13982                                               vector bool short __b) {
13983   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13984                                       (vector unsigned short)__a);
13985 }
13986
13987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13988   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13989 }
13990
13991 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13992                                               vector bool int __b) {
13993   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13994 }
13995
13996 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13997                                               vector unsigned int __b) {
13998   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13999 }
14000
14001 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14002                                               vector bool int __b) {
14003   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
14004 }
14005
14006 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14007                                               vector int __b) {
14008   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14009                                       (vector unsigned int)__a);
14010 }
14011
14012 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14013                                               vector unsigned int __b) {
14014   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14015 }
14016
14017 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14018                                               vector bool int __b) {
14019   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14020                                       (vector unsigned int)__a);
14021 }
14022
14023 #ifdef __POWER8_VECTOR__
14024 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14025                                               vector signed long long __b) {
14026   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14027 }
14028 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14029                                               vector bool long long __b) {
14030   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14031                                       __a);
14032 }
14033
14034 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14035                                               vector unsigned long long __b) {
14036   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14037 }
14038
14039 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14040                                               vector bool long long __b) {
14041   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14042                                       __a);
14043 }
14044
14045 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14046                                               vector signed long long __b) {
14047   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__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 unsigned long long __b) {
14053   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14054                                       (vector unsigned long long)__a);
14055 }
14056
14057 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14058                                               vector bool long long __b) {
14059   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14060                                       (vector unsigned long long)__a);
14061 }
14062 #endif
14063
14064 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14065                                               vector float __b) {
14066 #ifdef __VSX__
14067   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14068 #else
14069   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14070 #endif
14071 }
14072
14073 #ifdef __VSX__
14074 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14075                                               vector double __b) {
14076   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14077 }
14078 #endif
14079
14080 /* vec_all_gt */
14081
14082 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14083                                               vector signed char __b) {
14084   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14085 }
14086
14087 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14088                                               vector bool char __b) {
14089   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14090 }
14091
14092 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14093                                               vector unsigned char __b) {
14094   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14095 }
14096
14097 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14098                                               vector bool char __b) {
14099   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14100 }
14101
14102 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14103                                               vector signed char __b) {
14104   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14105                                       (vector unsigned char)__b);
14106 }
14107
14108 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14109                                               vector unsigned char __b) {
14110   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14111 }
14112
14113 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14114                                               vector bool char __b) {
14115   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14116                                       (vector unsigned char)__b);
14117 }
14118
14119 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14120                                               vector short __b) {
14121   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14122 }
14123
14124 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14125                                               vector bool short __b) {
14126   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14127 }
14128
14129 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14130                                               vector unsigned short __b) {
14131   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14132 }
14133
14134 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14135                                               vector bool short __b) {
14136   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14137                                       (vector unsigned short)__b);
14138 }
14139
14140 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14141                                               vector short __b) {
14142   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14143                                       (vector unsigned short)__b);
14144 }
14145
14146 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14147                                               vector unsigned short __b) {
14148   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14149                                       __b);
14150 }
14151
14152 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14153                                               vector bool short __b) {
14154   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14155                                       (vector unsigned short)__b);
14156 }
14157
14158 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14159   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14160 }
14161
14162 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14163                                               vector bool int __b) {
14164   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14165 }
14166
14167 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14168                                               vector unsigned int __b) {
14169   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14170 }
14171
14172 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14173                                               vector bool int __b) {
14174   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14175 }
14176
14177 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14178                                               vector int __b) {
14179   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14180                                       (vector unsigned int)__b);
14181 }
14182
14183 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14184                                               vector unsigned int __b) {
14185   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14186 }
14187
14188 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14189                                               vector bool int __b) {
14190   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14191                                       (vector unsigned int)__b);
14192 }
14193
14194 #ifdef __POWER8_VECTOR__
14195 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14196                                               vector signed long long __b) {
14197   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14198 }
14199 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14200                                               vector bool long long __b) {
14201   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14202                                       (vector signed long long)__b);
14203 }
14204
14205 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14206                                               vector unsigned long long __b) {
14207   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14208 }
14209
14210 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14211                                               vector bool long long __b) {
14212   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __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 signed long long __b) {
14218   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14219                                       (vector unsigned long long)__b);
14220 }
14221
14222 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14223                                               vector unsigned long long __b) {
14224   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14225                                       __b);
14226 }
14227
14228 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14229                                               vector bool long long __b) {
14230   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14231                                       (vector unsigned long long)__b);
14232 }
14233 #endif
14234
14235 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14236                                               vector float __b) {
14237 #ifdef __VSX__
14238   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14239 #else
14240   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14241 #endif
14242 }
14243
14244 #ifdef __VSX__
14245 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14246                                               vector double __b) {
14247   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14248 }
14249 #endif
14250
14251 /* vec_all_in */
14252
14253 static __inline__ int __attribute__((__always_inline__))
14254 vec_all_in(vector float __a, vector float __b) {
14255   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14256 }
14257
14258 /* vec_all_le */
14259
14260 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14261                                               vector signed char __b) {
14262   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14263 }
14264
14265 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14266                                               vector bool char __b) {
14267   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14268 }
14269
14270 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14271                                               vector unsigned char __b) {
14272   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14273 }
14274
14275 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14276                                               vector bool char __b) {
14277   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14278 }
14279
14280 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14281                                               vector signed char __b) {
14282   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14283                                       (vector unsigned char)__b);
14284 }
14285
14286 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14287                                               vector unsigned char __b) {
14288   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14289 }
14290
14291 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14292                                               vector bool char __b) {
14293   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14294                                       (vector unsigned char)__b);
14295 }
14296
14297 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14298                                               vector short __b) {
14299   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14300 }
14301
14302 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14303                                               vector bool short __b) {
14304   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14305 }
14306
14307 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14308                                               vector unsigned short __b) {
14309   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14310 }
14311
14312 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14313                                               vector bool short __b) {
14314   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14315                                       (vector unsigned short)__b);
14316 }
14317
14318 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14319                                               vector short __b) {
14320   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14321                                       (vector unsigned short)__b);
14322 }
14323
14324 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14325                                               vector unsigned short __b) {
14326   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14327                                       __b);
14328 }
14329
14330 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14331                                               vector bool short __b) {
14332   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14333                                       (vector unsigned short)__b);
14334 }
14335
14336 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14337   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14338 }
14339
14340 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14341                                               vector bool int __b) {
14342   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14343 }
14344
14345 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14346                                               vector unsigned int __b) {
14347   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14348 }
14349
14350 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14351                                               vector bool int __b) {
14352   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14353 }
14354
14355 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14356                                               vector int __b) {
14357   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14358                                       (vector unsigned int)__b);
14359 }
14360
14361 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14362                                               vector unsigned int __b) {
14363   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14364 }
14365
14366 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14367                                               vector bool int __b) {
14368   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14369                                       (vector unsigned int)__b);
14370 }
14371
14372 #ifdef __POWER8_VECTOR__
14373 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14374                                               vector signed long long __b) {
14375   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14376 }
14377
14378 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14379                                               vector unsigned long long __b) {
14380   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14381 }
14382
14383 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14384                                               vector bool long long __b) {
14385   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14386                                       (vector signed long long)__b);
14387 }
14388
14389 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14390                                               vector bool long long __b) {
14391   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __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 signed long long __b) {
14397   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14398                                       (vector unsigned long long)__b);
14399 }
14400
14401 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14402                                               vector unsigned long long __b) {
14403   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14404                                       __b);
14405 }
14406
14407 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14408                                               vector bool long long __b) {
14409   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14410                                       (vector unsigned long long)__b);
14411 }
14412 #endif
14413
14414 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14415                                               vector float __b) {
14416 #ifdef __VSX__
14417   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14418 #else
14419   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14420 #endif
14421 }
14422
14423 #ifdef __VSX__
14424 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14425                                               vector double __b) {
14426   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14427 }
14428 #endif
14429
14430 /* vec_all_lt */
14431
14432 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14433                                               vector signed char __b) {
14434   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14435 }
14436
14437 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14438                                               vector bool char __b) {
14439   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14440 }
14441
14442 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14443                                               vector unsigned char __b) {
14444   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14445 }
14446
14447 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14448                                               vector bool char __b) {
14449   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14450 }
14451
14452 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14453                                               vector signed char __b) {
14454   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14455                                       (vector unsigned char)__a);
14456 }
14457
14458 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14459                                               vector unsigned char __b) {
14460   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14461 }
14462
14463 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14464                                               vector bool char __b) {
14465   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14466                                       (vector unsigned char)__a);
14467 }
14468
14469 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14470                                               vector short __b) {
14471   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14472 }
14473
14474 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14475                                               vector bool short __b) {
14476   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14477 }
14478
14479 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14480                                               vector unsigned short __b) {
14481   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14482 }
14483
14484 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14485                                               vector bool short __b) {
14486   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14487                                       __a);
14488 }
14489
14490 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14491                                               vector short __b) {
14492   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14493                                       (vector unsigned short)__a);
14494 }
14495
14496 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14497                                               vector unsigned short __b) {
14498   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14499                                       (vector unsigned short)__a);
14500 }
14501
14502 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14503                                               vector bool short __b) {
14504   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14505                                       (vector unsigned short)__a);
14506 }
14507
14508 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14509   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14510 }
14511
14512 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14513                                               vector bool int __b) {
14514   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14515 }
14516
14517 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14518                                               vector unsigned int __b) {
14519   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14520 }
14521
14522 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14523                                               vector bool int __b) {
14524   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14525 }
14526
14527 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14528                                               vector int __b) {
14529   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14530                                       (vector unsigned int)__a);
14531 }
14532
14533 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14534                                               vector unsigned int __b) {
14535   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14536 }
14537
14538 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14539                                               vector bool int __b) {
14540   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14541                                       (vector unsigned int)__a);
14542 }
14543
14544 #ifdef __POWER8_VECTOR__
14545 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14546                                               vector signed long long __b) {
14547   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14548 }
14549
14550 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14551                                               vector unsigned long long __b) {
14552   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14553 }
14554
14555 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14556                                               vector bool long long __b) {
14557   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14558                                       __a);
14559 }
14560
14561 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14562                                               vector bool long long __b) {
14563   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14564                                       __a);
14565 }
14566
14567 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14568                                               vector signed long long __b) {
14569   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__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 unsigned long long __b) {
14575   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14576                                       (vector unsigned long long)__a);
14577 }
14578
14579 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14580                                               vector bool long long __b) {
14581   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14582                                       (vector unsigned long long)__a);
14583 }
14584 #endif
14585
14586 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14587                                               vector float __b) {
14588 #ifdef __VSX__
14589   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14590 #else
14591   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14592 #endif
14593 }
14594
14595 #ifdef __VSX__
14596 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14597                                               vector double __b) {
14598   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14599 }
14600 #endif
14601
14602 /* vec_all_nan */
14603
14604 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14605 #ifdef __VSX__
14606   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14607 #else
14608   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14609 #endif
14610 }
14611
14612 #ifdef __VSX__
14613 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14614   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14615 }
14616 #endif
14617
14618 /* vec_all_ne */
14619
14620 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14621                                               vector signed 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 signed char __a,
14627                                               vector bool 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 unsigned 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 unsigned char __a,
14639                                               vector bool 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 signed 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 unsigned 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 bool char __a,
14657                                               vector bool char __b) {
14658   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14659                                       (vector char)__b);
14660 }
14661
14662 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14663                                               vector short __b) {
14664   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14665 }
14666
14667 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14668                                               vector bool short __b) {
14669   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14670 }
14671
14672 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14673                                               vector unsigned 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 unsigned short __a,
14679                                               vector bool 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 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 unsigned 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 bool short __a,
14697                                               vector bool short __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 pixel __a,
14703                                               vector pixel __b) {
14704   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14705                                       (vector short)__b);
14706 }
14707
14708 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14709   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14710 }
14711
14712 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14713                                               vector bool int __b) {
14714   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14715 }
14716
14717 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14718                                               vector unsigned 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 unsigned int __a,
14724                                               vector bool 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 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 unsigned int __b) {
14737   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14738                                       (vector int)__b);
14739 }
14740
14741 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14742                                               vector bool int __b) {
14743   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14744                                       (vector int)__b);
14745 }
14746
14747 #ifdef __POWER8_VECTOR__
14748 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14749                                               vector signed long long __b) {
14750   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14751 }
14752
14753 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14754                                               vector unsigned long long __b) {
14755   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14756                                       (vector long long)__b);
14757 }
14758
14759 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14760                                               vector bool long long __b) {
14761   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14762                                       (vector signed long long)__b);
14763 }
14764
14765 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14766                                               vector bool 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 signed 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 unsigned long long __b) {
14779   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14780                                       (vector signed long long)__b);
14781 }
14782
14783 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14784                                               vector bool long long __b) {
14785   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14786                                       (vector signed long long)__b);
14787 }
14788 #endif
14789
14790 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14791                                               vector float __b) {
14792 #ifdef __VSX__
14793   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14794 #else
14795   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14796 #endif
14797 }
14798
14799 #ifdef __VSX__
14800 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14801                                               vector double __b) {
14802   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14803 }
14804 #endif
14805
14806 /* vec_all_nge */
14807
14808 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14809                                                vector float __b) {
14810 #ifdef __VSX__
14811   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14812 #else
14813   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14814 #endif
14815 }
14816
14817 #ifdef __VSX__
14818 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14819                                                vector double __b) {
14820   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14821 }
14822 #endif
14823
14824 /* vec_all_ngt */
14825
14826 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14827                                                vector float __b) {
14828 #ifdef __VSX__
14829   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14830 #else
14831   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14832 #endif
14833 }
14834
14835 #ifdef __VSX__
14836 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14837                                                vector double __b) {
14838   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14839 }
14840 #endif
14841
14842 /* vec_all_nle */
14843
14844 static __inline__ int __attribute__((__always_inline__))
14845 vec_all_nle(vector float __a, vector float __b) {
14846   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14847 }
14848
14849 /* vec_all_nlt */
14850
14851 static __inline__ int __attribute__((__always_inline__))
14852 vec_all_nlt(vector float __a, vector float __b) {
14853   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14854 }
14855
14856 /* vec_all_numeric */
14857
14858 static __inline__ int __attribute__((__always_inline__))
14859 vec_all_numeric(vector float __a) {
14860   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14861 }
14862
14863 /* vec_any_eq */
14864
14865 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14866                                               vector signed 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 signed char __a,
14872                                               vector bool 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 unsigned 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 unsigned char __a,
14884                                               vector bool 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 signed 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 unsigned 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 bool char __a,
14902                                               vector bool char __b) {
14903   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14904                                       (vector char)__b);
14905 }
14906
14907 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14908                                               vector short __b) {
14909   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14910 }
14911
14912 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14913                                               vector bool short __b) {
14914   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14915 }
14916
14917 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14918                                               vector unsigned 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 unsigned short __a,
14924                                               vector bool 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 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 unsigned 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 bool short __a,
14942                                               vector bool short __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 pixel __a,
14948                                               vector pixel __b) {
14949   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14950                                       (vector short)__b);
14951 }
14952
14953 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14954   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14955 }
14956
14957 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14958                                               vector bool int __b) {
14959   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14960 }
14961
14962 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14963                                               vector unsigned 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 unsigned int __a,
14969                                               vector bool 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 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 unsigned int __b) {
14982   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14983                                       (vector int)__b);
14984 }
14985
14986 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14987                                               vector bool int __b) {
14988   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14989                                       (vector int)__b);
14990 }
14991
14992 #ifdef __POWER8_VECTOR__
14993 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14994                                               vector signed long long __b) {
14995   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14996 }
14997
14998 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14999                                               vector unsigned long long __b) {
15000   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
15001                                       (vector long long)__b);
15002 }
15003
15004 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
15005                                               vector bool long long __b) {
15006   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15007                                       (vector signed long long)__b);
15008 }
15009
15010 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15011                                               vector bool 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 signed 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 unsigned 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
15028 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15029                                               vector bool long long __b) {
15030   return __builtin_altivec_vcmpequd_p(
15031       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15032 }
15033 #endif
15034
15035 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15036                                               vector float __b) {
15037 #ifdef __VSX__
15038   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15039 #else
15040   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15041 #endif
15042 }
15043
15044 #ifdef __VSX__
15045 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15046                                               vector double __b) {
15047   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15048 }
15049 #endif
15050
15051 /* vec_any_ge */
15052
15053 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15054                                               vector signed char __b) {
15055   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15056 }
15057
15058 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15059                                               vector bool char __b) {
15060   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15061                                       __a);
15062 }
15063
15064 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15065                                               vector unsigned char __b) {
15066   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15067 }
15068
15069 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15070                                               vector bool char __b) {
15071   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15072                                       __a);
15073 }
15074
15075 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15076                                               vector signed char __b) {
15077   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15078                                       (vector unsigned char)__a);
15079 }
15080
15081 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15082                                               vector unsigned char __b) {
15083   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15084                                       (vector unsigned char)__a);
15085 }
15086
15087 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15088                                               vector bool char __b) {
15089   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15090                                       (vector unsigned char)__a);
15091 }
15092
15093 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15094                                               vector short __b) {
15095   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15096 }
15097
15098 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15099                                               vector bool short __b) {
15100   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15101 }
15102
15103 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15104                                               vector unsigned short __b) {
15105   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15106 }
15107
15108 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15109                                               vector bool short __b) {
15110   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15111                                       __a);
15112 }
15113
15114 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15115                                               vector short __b) {
15116   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15117                                       (vector unsigned short)__a);
15118 }
15119
15120 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15121                                               vector unsigned short __b) {
15122   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15123                                       (vector unsigned short)__a);
15124 }
15125
15126 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15127                                               vector bool short __b) {
15128   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15129                                       (vector unsigned short)__a);
15130 }
15131
15132 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15133   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15134 }
15135
15136 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15137                                               vector bool int __b) {
15138   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15139 }
15140
15141 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15142                                               vector unsigned int __b) {
15143   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15144 }
15145
15146 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15147                                               vector bool int __b) {
15148   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15149                                       __a);
15150 }
15151
15152 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15153                                               vector int __b) {
15154   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15155                                       (vector unsigned int)__a);
15156 }
15157
15158 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15159                                               vector unsigned int __b) {
15160   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15161                                       (vector unsigned int)__a);
15162 }
15163
15164 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15165                                               vector bool int __b) {
15166   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15167                                       (vector unsigned int)__a);
15168 }
15169
15170 #ifdef __POWER8_VECTOR__
15171 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15172                                               vector signed long long __b) {
15173   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15174 }
15175
15176 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15177                                               vector unsigned long long __b) {
15178   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15179 }
15180
15181 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15182                                               vector bool long long __b) {
15183   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15184                                       (vector signed long long)__b, __a);
15185 }
15186
15187 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15188                                               vector bool long long __b) {
15189   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15190                                       (vector unsigned long long)__b, __a);
15191 }
15192
15193 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15194                                               vector signed long long __b) {
15195   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15196                                       (vector unsigned long long)__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 unsigned long long __b) {
15202   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15203                                       (vector unsigned long long)__a);
15204 }
15205
15206 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15207                                               vector bool long long __b) {
15208   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15209                                       (vector unsigned long long)__b,
15210                                       (vector unsigned long long)__a);
15211 }
15212 #endif
15213
15214 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15215                                               vector float __b) {
15216 #ifdef __VSX__
15217   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15218 #else
15219   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15220 #endif
15221 }
15222
15223 #ifdef __VSX__
15224 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15225                                               vector double __b) {
15226   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15227 }
15228 #endif
15229
15230 /* vec_any_gt */
15231
15232 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15233                                               vector signed char __b) {
15234   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15235 }
15236
15237 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15238                                               vector bool char __b) {
15239   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15240                                       (vector signed char)__b);
15241 }
15242
15243 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15244                                               vector unsigned char __b) {
15245   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15246 }
15247
15248 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15249                                               vector bool char __b) {
15250   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15251                                       (vector unsigned char)__b);
15252 }
15253
15254 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15255                                               vector signed char __b) {
15256   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15257                                       (vector unsigned char)__b);
15258 }
15259
15260 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15261                                               vector unsigned char __b) {
15262   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15263                                       __b);
15264 }
15265
15266 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15267                                               vector bool char __b) {
15268   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15269                                       (vector unsigned char)__b);
15270 }
15271
15272 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15273                                               vector short __b) {
15274   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15275 }
15276
15277 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15278                                               vector bool short __b) {
15279   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15280 }
15281
15282 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15283                                               vector unsigned short __b) {
15284   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15285 }
15286
15287 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15288                                               vector bool short __b) {
15289   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15290                                       (vector unsigned short)__b);
15291 }
15292
15293 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15294                                               vector short __b) {
15295   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15296                                       (vector unsigned short)__b);
15297 }
15298
15299 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15300                                               vector unsigned short __b) {
15301   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15302                                       __b);
15303 }
15304
15305 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15306                                               vector bool short __b) {
15307   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15308                                       (vector unsigned short)__b);
15309 }
15310
15311 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15312   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15313 }
15314
15315 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15316                                               vector bool int __b) {
15317   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15318 }
15319
15320 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15321                                               vector unsigned int __b) {
15322   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15323 }
15324
15325 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15326                                               vector bool int __b) {
15327   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15328                                       (vector unsigned int)__b);
15329 }
15330
15331 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15332                                               vector int __b) {
15333   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15334                                       (vector unsigned int)__b);
15335 }
15336
15337 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15338                                               vector unsigned int __b) {
15339   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15340                                       __b);
15341 }
15342
15343 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15344                                               vector bool int __b) {
15345   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15346                                       (vector unsigned int)__b);
15347 }
15348
15349 #ifdef __POWER8_VECTOR__
15350 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15351                                               vector signed long long __b) {
15352   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15353 }
15354
15355 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15356                                               vector unsigned long long __b) {
15357   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15358 }
15359
15360 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15361                                               vector bool long long __b) {
15362   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15363                                       (vector signed long long)__b);
15364 }
15365
15366 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15367                                               vector bool long long __b) {
15368   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15369                                       (vector unsigned long long)__b);
15370 }
15371
15372 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15373                                               vector signed long long __b) {
15374   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15375                                       (vector unsigned long long)__a,
15376                                       (vector unsigned long long)__b);
15377 }
15378
15379 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15380                                               vector unsigned long long __b) {
15381   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15382                                       (vector unsigned long long)__a, __b);
15383 }
15384
15385 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15386                                               vector bool long long __b) {
15387   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15388                                       (vector unsigned long long)__a,
15389                                       (vector unsigned long long)__b);
15390 }
15391 #endif
15392
15393 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15394                                               vector float __b) {
15395 #ifdef __VSX__
15396   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15397 #else
15398   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15399 #endif
15400 }
15401
15402 #ifdef __VSX__
15403 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15404                                               vector double __b) {
15405   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15406 }
15407 #endif
15408
15409 /* vec_any_le */
15410
15411 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15412                                               vector signed char __b) {
15413   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15414 }
15415
15416 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15417                                               vector bool char __b) {
15418   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15419                                       (vector signed char)__b);
15420 }
15421
15422 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15423                                               vector unsigned char __b) {
15424   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15425 }
15426
15427 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15428                                               vector bool char __b) {
15429   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15430                                       (vector unsigned char)__b);
15431 }
15432
15433 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15434                                               vector signed char __b) {
15435   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15436                                       (vector unsigned char)__b);
15437 }
15438
15439 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15440                                               vector unsigned char __b) {
15441   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15442                                       __b);
15443 }
15444
15445 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15446                                               vector bool char __b) {
15447   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15448                                       (vector unsigned char)__b);
15449 }
15450
15451 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15452                                               vector short __b) {
15453   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15454 }
15455
15456 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15457                                               vector bool short __b) {
15458   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15459 }
15460
15461 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15462                                               vector unsigned short __b) {
15463   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15464 }
15465
15466 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15467                                               vector bool short __b) {
15468   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15469                                       (vector unsigned short)__b);
15470 }
15471
15472 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15473                                               vector short __b) {
15474   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15475                                       (vector unsigned short)__b);
15476 }
15477
15478 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15479                                               vector unsigned short __b) {
15480   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15481                                       __b);
15482 }
15483
15484 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15485                                               vector bool short __b) {
15486   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15487                                       (vector unsigned short)__b);
15488 }
15489
15490 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15491   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15492 }
15493
15494 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15495                                               vector bool int __b) {
15496   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15497 }
15498
15499 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15500                                               vector unsigned int __b) {
15501   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15502 }
15503
15504 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15505                                               vector bool int __b) {
15506   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15507                                       (vector unsigned int)__b);
15508 }
15509
15510 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15511                                               vector int __b) {
15512   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15513                                       (vector unsigned int)__b);
15514 }
15515
15516 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15517                                               vector unsigned int __b) {
15518   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15519                                       __b);
15520 }
15521
15522 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15523                                               vector bool int __b) {
15524   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15525                                       (vector unsigned int)__b);
15526 }
15527
15528 #ifdef __POWER8_VECTOR__
15529 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15530                                               vector signed long long __b) {
15531   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15532 }
15533
15534 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15535                                               vector unsigned long long __b) {
15536   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15537 }
15538
15539 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15540                                               vector bool long long __b) {
15541   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15542                                       (vector signed long long)__b);
15543 }
15544
15545 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15546                                               vector bool long long __b) {
15547   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15548                                       (vector unsigned long long)__b);
15549 }
15550
15551 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15552                                               vector signed long long __b) {
15553   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15554                                       (vector unsigned long long)__a,
15555                                       (vector unsigned long long)__b);
15556 }
15557
15558 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15559                                               vector unsigned long long __b) {
15560   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15561                                       (vector unsigned long long)__a, __b);
15562 }
15563
15564 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15565                                               vector bool long long __b) {
15566   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15567                                       (vector unsigned long long)__a,
15568                                       (vector unsigned long long)__b);
15569 }
15570 #endif
15571
15572 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15573                                               vector float __b) {
15574 #ifdef __VSX__
15575   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15576 #else
15577   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15578 #endif
15579 }
15580
15581 #ifdef __VSX__
15582 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15583                                               vector double __b) {
15584   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15585 }
15586 #endif
15587
15588 /* vec_any_lt */
15589
15590 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15591                                               vector signed char __b) {
15592   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15593 }
15594
15595 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15596                                               vector bool char __b) {
15597   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15598                                       __a);
15599 }
15600
15601 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15602                                               vector unsigned char __b) {
15603   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15604 }
15605
15606 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15607                                               vector bool char __b) {
15608   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15609                                       __a);
15610 }
15611
15612 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15613                                               vector signed char __b) {
15614   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15615                                       (vector unsigned char)__a);
15616 }
15617
15618 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15619                                               vector unsigned char __b) {
15620   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15621                                       (vector unsigned char)__a);
15622 }
15623
15624 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15625                                               vector bool char __b) {
15626   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15627                                       (vector unsigned char)__a);
15628 }
15629
15630 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15631                                               vector short __b) {
15632   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15633 }
15634
15635 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15636                                               vector bool short __b) {
15637   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15638 }
15639
15640 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15641                                               vector unsigned short __b) {
15642   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15643 }
15644
15645 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15646                                               vector bool short __b) {
15647   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15648                                       __a);
15649 }
15650
15651 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15652                                               vector short __b) {
15653   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15654                                       (vector unsigned short)__a);
15655 }
15656
15657 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15658                                               vector unsigned short __b) {
15659   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15660                                       (vector unsigned short)__a);
15661 }
15662
15663 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15664                                               vector bool short __b) {
15665   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15666                                       (vector unsigned short)__a);
15667 }
15668
15669 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15670   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15671 }
15672
15673 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15674                                               vector bool int __b) {
15675   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15676 }
15677
15678 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15679                                               vector unsigned int __b) {
15680   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15681 }
15682
15683 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15684                                               vector bool int __b) {
15685   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15686                                       __a);
15687 }
15688
15689 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15690                                               vector int __b) {
15691   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15692                                       (vector unsigned int)__a);
15693 }
15694
15695 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15696                                               vector unsigned int __b) {
15697   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15698                                       (vector unsigned int)__a);
15699 }
15700
15701 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15702                                               vector bool int __b) {
15703   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15704                                       (vector unsigned int)__a);
15705 }
15706
15707 #ifdef __POWER8_VECTOR__
15708 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15709                                               vector signed long long __b) {
15710   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15711 }
15712
15713 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15714                                               vector unsigned long long __b) {
15715   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15716 }
15717
15718 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15719                                               vector bool long long __b) {
15720   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15721                                       (vector signed long long)__b, __a);
15722 }
15723
15724 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15725                                               vector bool long long __b) {
15726   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15727                                       (vector unsigned long long)__b, __a);
15728 }
15729
15730 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15731                                               vector signed long long __b) {
15732   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15733                                       (vector unsigned long long)__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 unsigned long long __b) {
15739   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15740                                       (vector unsigned long long)__a);
15741 }
15742
15743 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15744                                               vector bool long long __b) {
15745   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15746                                       (vector unsigned long long)__b,
15747                                       (vector unsigned long long)__a);
15748 }
15749 #endif
15750
15751 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15752                                               vector float __b) {
15753 #ifdef __VSX__
15754   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15755 #else
15756   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15757 #endif
15758 }
15759
15760 #ifdef __VSX__
15761 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15762                                               vector double __b) {
15763   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15764 }
15765 #endif
15766
15767 /* vec_any_nan */
15768
15769 static __inline__ int __attribute__((__always_inline__))
15770 vec_any_nan(vector float __a) {
15771   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15772 }
15773
15774 /* vec_any_ne */
15775
15776 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15777                                               vector signed 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 signed char __a,
15783                                               vector bool 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 unsigned 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 unsigned char __a,
15795                                               vector bool 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 signed 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 unsigned 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 bool char __a,
15813                                               vector bool char __b) {
15814   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15815                                       (vector char)__b);
15816 }
15817
15818 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15819                                               vector short __b) {
15820   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15821 }
15822
15823 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15824                                               vector bool short __b) {
15825   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15826 }
15827
15828 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15829                                               vector unsigned 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 unsigned short __a,
15835                                               vector bool 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 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 unsigned 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 bool short __a,
15853                                               vector bool short __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 pixel __a,
15859                                               vector pixel __b) {
15860   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15861                                       (vector short)__b);
15862 }
15863
15864 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15865   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15866 }
15867
15868 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15869                                               vector bool int __b) {
15870   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15871 }
15872
15873 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15874                                               vector unsigned 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 unsigned int __a,
15880                                               vector bool 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 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 unsigned int __b) {
15893   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15894                                       (vector int)__b);
15895 }
15896
15897 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15898                                               vector bool int __b) {
15899   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15900                                       (vector int)__b);
15901 }
15902
15903 #ifdef __POWER8_VECTOR__
15904 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15905                                               vector signed long long __b) {
15906   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15907 }
15908
15909 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15910                                               vector unsigned long long __b) {
15911   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15912                                       (vector long long)__b);
15913 }
15914
15915 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15916                                               vector bool long long __b) {
15917   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15918                                       (vector signed long long)__b);
15919 }
15920
15921 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15922                                               vector bool 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 signed 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 unsigned 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
15939 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15940                                               vector bool long long __b) {
15941   return __builtin_altivec_vcmpequd_p(
15942       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15943 }
15944 #endif
15945
15946 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15947                                               vector float __b) {
15948 #ifdef __VSX__
15949   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15950 #else
15951   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15952 #endif
15953 }
15954
15955 #ifdef __VSX__
15956 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15957                                               vector double __b) {
15958   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15959 }
15960 #endif
15961
15962 /* vec_any_nge */
15963
15964 static __inline__ int __attribute__((__always_inline__))
15965 vec_any_nge(vector float __a, vector float __b) {
15966   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15967 }
15968
15969 /* vec_any_ngt */
15970
15971 static __inline__ int __attribute__((__always_inline__))
15972 vec_any_ngt(vector float __a, vector float __b) {
15973   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15974 }
15975
15976 /* vec_any_nle */
15977
15978 static __inline__ int __attribute__((__always_inline__))
15979 vec_any_nle(vector float __a, vector float __b) {
15980   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15981 }
15982
15983 /* vec_any_nlt */
15984
15985 static __inline__ int __attribute__((__always_inline__))
15986 vec_any_nlt(vector float __a, vector float __b) {
15987   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15988 }
15989
15990 /* vec_any_numeric */
15991
15992 static __inline__ int __attribute__((__always_inline__))
15993 vec_any_numeric(vector float __a) {
15994   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15995 }
15996
15997 /* vec_any_out */
15998
15999 static __inline__ int __attribute__((__always_inline__))
16000 vec_any_out(vector float __a, vector float __b) {
16001   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
16002 }
16003
16004 /* Power 8 Crypto functions
16005 Note: We diverge from the current GCC implementation with regard
16006 to cryptography and related functions as follows:
16007 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16008 - The remaining ones are only available on Power8 and up so
16009   require -mpower8-vector
16010 The justification for this is that export requirements require that
16011 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16012 support). As a result, we need to be able to turn off support for those.
16013 The remaining ones (currently controlled by -mcrypto for GCC) still
16014 need to be provided on compliant hardware even if Vector.Crypto is not
16015 provided.
16016 */
16017 #ifdef __CRYPTO__
16018 #define vec_sbox_be __builtin_altivec_crypto_vsbox
16019 #define vec_cipher_be __builtin_altivec_crypto_vcipher
16020 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16021 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
16022 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16023
16024 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16025 __builtin_crypto_vsbox(vector unsigned long long __a) {
16026   return __builtin_altivec_crypto_vsbox(__a);
16027 }
16028
16029 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16030 __builtin_crypto_vcipher(vector unsigned long long __a,
16031                          vector unsigned long long __b) {
16032   return __builtin_altivec_crypto_vcipher(__a, __b);
16033 }
16034
16035 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16036 __builtin_crypto_vcipherlast(vector unsigned long long __a,
16037                              vector unsigned long long __b) {
16038   return __builtin_altivec_crypto_vcipherlast(__a, __b);
16039 }
16040
16041 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16042 __builtin_crypto_vncipher(vector unsigned long long __a,
16043                           vector unsigned long long __b) {
16044   return __builtin_altivec_crypto_vncipher(__a, __b);
16045 }
16046
16047 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16048 __builtin_crypto_vncipherlast(vector unsigned long long __a,
16049                               vector unsigned long long __b) {
16050   return __builtin_altivec_crypto_vncipherlast(__a, __b);
16051 }
16052
16053 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16054 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16055
16056 #define vec_shasigma_be(X, Y, Z)                                               \
16057   _Generic((X), vector unsigned int                                            \
16058            : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16059            : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16060 #endif
16061
16062 #ifdef __POWER8_VECTOR__
16063 static __inline__ vector bool char __ATTRS_o_ai
16064 vec_permxor(vector bool char __a, vector bool char __b,
16065             vector bool char __c) {
16066   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16067 }
16068
16069 static __inline__ vector signed char __ATTRS_o_ai
16070 vec_permxor(vector signed char __a, vector signed char __b,
16071             vector signed char __c) {
16072   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16073 }
16074
16075 static __inline__ vector unsigned char __ATTRS_o_ai
16076 vec_permxor(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 char __ATTRS_o_ai
16082 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16083                           vector unsigned char __c) {
16084   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16085 }
16086
16087 static __inline__ vector unsigned short __ATTRS_o_ai
16088 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16089                           vector unsigned short __c) {
16090   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16091       (vector unsigned char)__a, (vector unsigned char)__b,
16092       (vector unsigned char)__c);
16093 }
16094
16095 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16096     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16097   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16098       (vector unsigned char)__a, (vector unsigned char)__b,
16099       (vector unsigned char)__c);
16100 }
16101
16102 static __inline__ vector unsigned long long __ATTRS_o_ai
16103 __builtin_crypto_vpermxor(vector unsigned long long __a,
16104                           vector unsigned long long __b,
16105                           vector unsigned long long __c) {
16106   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16107       (vector unsigned char)__a, (vector unsigned char)__b,
16108       (vector unsigned char)__c);
16109 }
16110
16111 static __inline__ vector unsigned char __ATTRS_o_ai
16112 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16113   return __builtin_altivec_crypto_vpmsumb(__a, __b);
16114 }
16115
16116 static __inline__ vector unsigned short __ATTRS_o_ai
16117 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16118   return __builtin_altivec_crypto_vpmsumh(__a, __b);
16119 }
16120
16121 static __inline__ vector unsigned int __ATTRS_o_ai
16122 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16123   return __builtin_altivec_crypto_vpmsumw(__a, __b);
16124 }
16125
16126 static __inline__ vector unsigned long long __ATTRS_o_ai
16127 __builtin_crypto_vpmsumb(vector unsigned long long __a,
16128                          vector unsigned long long __b) {
16129   return __builtin_altivec_crypto_vpmsumd(__a, __b);
16130 }
16131
16132 static __inline__ vector signed char __ATTRS_o_ai
16133 vec_vgbbd(vector signed char __a) {
16134   return __builtin_altivec_vgbbd((vector unsigned char)__a);
16135 }
16136
16137 #define vec_pmsum_be __builtin_crypto_vpmsumb
16138 #define vec_gb __builtin_altivec_vgbbd
16139
16140 static __inline__ vector unsigned char __ATTRS_o_ai
16141 vec_vgbbd(vector unsigned char __a) {
16142   return __builtin_altivec_vgbbd(__a);
16143 }
16144
16145 static __inline__ vector long long __ATTRS_o_ai
16146 vec_vbpermq(vector signed char __a, vector signed char __b) {
16147   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16148                                    (vector unsigned char)__b);
16149 }
16150
16151 static __inline__ vector long long __ATTRS_o_ai
16152 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16153   return __builtin_altivec_vbpermq(__a, __b);
16154 }
16155
16156 #ifdef __powerpc64__
16157 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16158 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16159   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16160                                    (vector unsigned char)__b);
16161 }
16162 #endif
16163 #endif
16164
16165
16166 /* vec_reve */
16167
16168 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16169   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16170                                  5, 4, 3, 2, 1, 0);
16171 }
16172
16173 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed 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 unsigned char
16179 vec_reve(vector unsigned char __a) {
16180   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16181                                  5, 4, 3, 2, 1, 0);
16182 }
16183
16184 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16185   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16186 }
16187
16188 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16189   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16190 }
16191
16192 static inline __ATTRS_o_ai vector unsigned int
16193 vec_reve(vector unsigned int __a) {
16194   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16195 }
16196
16197 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16198   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16199 }
16200
16201 static inline __ATTRS_o_ai vector signed short
16202 vec_reve(vector signed short __a) {
16203   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16204 }
16205
16206 static inline __ATTRS_o_ai vector unsigned short
16207 vec_reve(vector unsigned short __a) {
16208   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16209 }
16210
16211 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16212   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16213 }
16214
16215 #ifdef __VSX__
16216 static inline __ATTRS_o_ai vector bool long long
16217 vec_reve(vector bool long long __a) {
16218   return __builtin_shufflevector(__a, __a, 1, 0);
16219 }
16220
16221 static inline __ATTRS_o_ai vector signed long long
16222 vec_reve(vector signed long long __a) {
16223   return __builtin_shufflevector(__a, __a, 1, 0);
16224 }
16225
16226 static inline __ATTRS_o_ai vector unsigned long long
16227 vec_reve(vector unsigned long long __a) {
16228   return __builtin_shufflevector(__a, __a, 1, 0);
16229 }
16230
16231 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16232   return __builtin_shufflevector(__a, __a, 1, 0);
16233 }
16234 #endif
16235
16236 /* vec_revb */
16237 static __inline__ vector bool char __ATTRS_o_ai
16238 vec_revb(vector bool char __a) {
16239   return __a;
16240 }
16241
16242 static __inline__ vector signed char __ATTRS_o_ai
16243 vec_revb(vector signed char __a) {
16244   return __a;
16245 }
16246
16247 static __inline__ vector unsigned char __ATTRS_o_ai
16248 vec_revb(vector unsigned char __a) {
16249   return __a;
16250 }
16251
16252 static __inline__ vector bool short __ATTRS_o_ai
16253 vec_revb(vector bool short __a) {
16254   vector unsigned char __indices =
16255       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16256   return vec_perm(__a, __a, __indices);
16257 }
16258
16259 static __inline__ vector signed short __ATTRS_o_ai
16260 vec_revb(vector signed short __a) {
16261   vector unsigned char __indices =
16262       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16263   return vec_perm(__a, __a, __indices);
16264 }
16265
16266 static __inline__ vector unsigned short __ATTRS_o_ai
16267 vec_revb(vector unsigned short __a) {
16268   vector unsigned char __indices =
16269      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16270   return vec_perm(__a, __a, __indices);
16271 }
16272
16273 static __inline__ vector bool int __ATTRS_o_ai
16274 vec_revb(vector bool int __a) {
16275   vector unsigned char __indices =
16276       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16277   return vec_perm(__a, __a, __indices);
16278 }
16279
16280 static __inline__ vector signed int __ATTRS_o_ai
16281 vec_revb(vector signed int __a) {
16282   vector unsigned char __indices =
16283       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16284   return vec_perm(__a, __a, __indices);
16285 }
16286
16287 static __inline__ vector unsigned int __ATTRS_o_ai
16288 vec_revb(vector unsigned int __a) {
16289   vector unsigned char __indices =
16290       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16291   return vec_perm(__a, __a, __indices);
16292 }
16293
16294 static __inline__ vector float __ATTRS_o_ai
16295 vec_revb(vector float __a) {
16296  vector unsigned char __indices =
16297       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16298  return vec_perm(__a, __a, __indices);
16299 }
16300
16301 #ifdef __VSX__
16302 static __inline__ vector bool long long __ATTRS_o_ai
16303 vec_revb(vector bool long long __a) {
16304   vector unsigned char __indices =
16305       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16306   return vec_perm(__a, __a, __indices);
16307 }
16308
16309 static __inline__ vector signed long long __ATTRS_o_ai
16310 vec_revb(vector signed long long __a) {
16311   vector unsigned char __indices =
16312       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16313   return vec_perm(__a, __a, __indices);
16314 }
16315
16316 static __inline__ vector unsigned long long __ATTRS_o_ai
16317 vec_revb(vector unsigned long long __a) {
16318   vector unsigned char __indices =
16319       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16320   return vec_perm(__a, __a, __indices);
16321 }
16322
16323 static __inline__ vector double __ATTRS_o_ai
16324 vec_revb(vector double __a) {
16325   vector unsigned char __indices =
16326       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16327   return vec_perm(__a, __a, __indices);
16328 }
16329 #endif /* End __VSX__ */
16330
16331 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16332 static __inline__ vector signed __int128 __ATTRS_o_ai
16333 vec_revb(vector signed __int128 __a) {
16334   vector unsigned char __indices =
16335       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16336   return (vector signed __int128)vec_perm((vector signed int)__a,
16337                                           (vector signed int)__a,
16338                                            __indices);
16339 }
16340
16341 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16342 vec_revb(vector unsigned __int128 __a) {
16343   vector unsigned char __indices =
16344       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16345   return (vector unsigned __int128)vec_perm((vector signed int)__a,
16346                                             (vector signed int)__a,
16347                                              __indices);
16348 }
16349 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16350
16351 /* vec_xl */
16352
16353 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16354                                                      signed char *__ptr) {
16355   return *(vector signed char *)(__ptr + __offset);
16356 }
16357
16358 static inline __ATTRS_o_ai vector unsigned char
16359 vec_xl(signed long long __offset, unsigned char *__ptr) {
16360   return *(vector unsigned char *)(__ptr + __offset);
16361 }
16362
16363 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16364                                                       signed short *__ptr) {
16365   return *(vector signed short *)(__ptr + __offset);
16366 }
16367
16368 static inline __ATTRS_o_ai vector unsigned short
16369 vec_xl(signed long long __offset, unsigned short *__ptr) {
16370   return *(vector unsigned short *)(__ptr + __offset);
16371 }
16372
16373 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16374                                                     signed int *__ptr) {
16375   return *(vector signed int *)(__ptr + __offset);
16376 }
16377
16378 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16379                                                       unsigned int *__ptr) {
16380   return *(vector unsigned int *)(__ptr + __offset);
16381 }
16382
16383 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16384                                                float *__ptr) {
16385   return *(vector float *)(__ptr + __offset);
16386 }
16387
16388 #ifdef __VSX__
16389 static inline __ATTRS_o_ai vector signed long long
16390 vec_xl(signed long long __offset, signed long long *__ptr) {
16391   return *(vector signed long long *)(__ptr + __offset);
16392 }
16393
16394 static inline __ATTRS_o_ai vector unsigned long long
16395 vec_xl(signed long long __offset, unsigned long long *__ptr) {
16396   return *(vector unsigned long long *)(__ptr + __offset);
16397 }
16398
16399 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16400                                                 double *__ptr) {
16401   return *(vector double *)(__ptr + __offset);
16402 }
16403 #endif
16404
16405 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16406 static inline __ATTRS_o_ai vector signed __int128
16407 vec_xl(signed long long __offset, signed __int128 *__ptr) {
16408   return *(vector signed __int128 *)(__ptr + __offset);
16409 }
16410
16411 static inline __ATTRS_o_ai vector unsigned __int128
16412 vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16413   return *(vector unsigned __int128 *)(__ptr + __offset);
16414 }
16415 #endif
16416
16417 /* vec_xl_be */
16418
16419 #ifdef __LITTLE_ENDIAN__
16420 static __inline__ vector signed char __ATTRS_o_ai
16421 vec_xl_be(signed long long __offset, signed char *__ptr) {
16422   vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16423   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16424                                  13, 12, 11, 10, 9, 8);
16425 }
16426
16427 static __inline__ vector unsigned char __ATTRS_o_ai
16428 vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16429   vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16430   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16431                                  13, 12, 11, 10, 9, 8);
16432 }
16433
16434 static __inline__ vector signed short  __ATTRS_o_ai
16435 vec_xl_be(signed long long __offset, signed short *__ptr) {
16436   vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16437   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16438 }
16439
16440 static __inline__ vector unsigned short __ATTRS_o_ai
16441 vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16442   vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16443   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16444 }
16445
16446 static __inline__ vector signed int __ATTRS_o_ai
16447 vec_xl_be(signed long long  __offset, signed int *__ptr) {
16448   return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16449 }
16450
16451 static __inline__ vector unsigned int __ATTRS_o_ai
16452 vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16453   return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16454 }
16455
16456 static __inline__ vector float __ATTRS_o_ai
16457 vec_xl_be(signed long long  __offset, float *__ptr) {
16458   return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16459 }
16460
16461 #ifdef __VSX__
16462 static __inline__ vector signed long long __ATTRS_o_ai
16463 vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16464   return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16465 }
16466
16467 static __inline__ vector unsigned long long __ATTRS_o_ai
16468 vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16469   return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16470 }
16471
16472 static __inline__ vector double __ATTRS_o_ai
16473 vec_xl_be(signed long long  __offset, double *__ptr) {
16474   return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16475 }
16476 #endif
16477
16478 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16479 static __inline__ vector signed __int128 __ATTRS_o_ai
16480 vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16481   return vec_xl(__offset, __ptr);
16482 }
16483
16484 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16485 vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16486   return vec_xl(__offset, __ptr);
16487 }
16488 #endif
16489 #else
16490   #define vec_xl_be vec_xl
16491 #endif
16492
16493 /* vec_xst */
16494
16495 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16496                                         signed long long __offset,
16497                                         signed char *__ptr) {
16498   *(vector signed char *)(__ptr + __offset) = __vec;
16499 }
16500
16501 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16502                                         signed long long __offset,
16503                                         unsigned char *__ptr) {
16504   *(vector unsigned char *)(__ptr + __offset) = __vec;
16505 }
16506
16507 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16508                                         signed long long __offset,
16509                                         signed short *__ptr) {
16510   *(vector signed short *)(__ptr + __offset) = __vec;
16511 }
16512
16513 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
16514                                         signed long long __offset,
16515                                         unsigned short *__ptr) {
16516   *(vector unsigned short *)(__ptr + __offset) = __vec;
16517 }
16518
16519 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16520                                         signed long long __offset,
16521                                         signed int *__ptr) {
16522   *(vector signed int *)(__ptr + __offset) = __vec;
16523 }
16524
16525 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16526                                         signed long long __offset,
16527                                         unsigned int *__ptr) {
16528   *(vector unsigned int *)(__ptr + __offset) = __vec;
16529 }
16530
16531 static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16532                                         signed long long __offset,
16533                                         float *__ptr) {
16534   *(vector float *)(__ptr + __offset) = __vec;
16535 }
16536
16537 #ifdef __VSX__
16538 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16539                                         signed long long __offset,
16540                                         signed long long *__ptr) {
16541   *(vector signed long long *)(__ptr + __offset) = __vec;
16542 }
16543
16544 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16545                                         signed long long __offset,
16546                                         unsigned long long *__ptr) {
16547   *(vector unsigned long long *)(__ptr + __offset) = __vec;
16548 }
16549
16550 static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16551                                         signed long long __offset,
16552                                         double *__ptr) {
16553   *(vector double *)(__ptr + __offset) = __vec;
16554 }
16555 #endif
16556
16557 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16558 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16559                                         signed long long __offset,
16560                                         signed __int128 *__ptr) {
16561   *(vector signed __int128 *)(__ptr + __offset) = __vec;
16562 }
16563
16564 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16565                                         signed long long __offset,
16566                                         unsigned __int128 *__ptr) {
16567   *(vector unsigned __int128 *)(__ptr + __offset) = __vec;
16568 }
16569 #endif
16570
16571 /* vec_xst_be */
16572
16573 #ifdef __LITTLE_ENDIAN__
16574 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16575                                                signed long long  __offset,
16576                                                signed char *__ptr) {
16577   vector signed char __tmp =
16578      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16579                              13, 12, 11, 10, 9, 8);
16580   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16581 }
16582
16583 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16584                                                signed long long  __offset,
16585                                                unsigned char *__ptr) {
16586   vector unsigned 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   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16590 }
16591
16592 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16593                                                signed long long  __offset,
16594                                                signed short *__ptr) {
16595   vector signed short __tmp =
16596      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16597   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16598 }
16599
16600 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16601                                                signed long long  __offset,
16602                                                unsigned short *__ptr) {
16603   vector unsigned short __tmp =
16604      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16605   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16606 }
16607
16608 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16609                                                signed long long  __offset,
16610                                                signed int *__ptr) {
16611   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16612 }
16613
16614 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16615                                                signed long long  __offset,
16616                                                unsigned int *__ptr) {
16617   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16618 }
16619
16620 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16621                                                signed long long  __offset,
16622                                                float *__ptr) {
16623   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16624 }
16625
16626 #ifdef __VSX__
16627 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16628                                                signed long long  __offset,
16629                                                signed long long *__ptr) {
16630   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16631 }
16632
16633 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16634                                                signed long long  __offset,
16635                                                unsigned long long *__ptr) {
16636   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16637 }
16638
16639 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16640                                                signed long long  __offset,
16641                                                double *__ptr) {
16642   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16643 }
16644 #endif
16645
16646 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16647 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16648                                                signed long long  __offset,
16649                                                signed __int128 *__ptr) {
16650   vec_xst(__vec, __offset, __ptr);
16651 }
16652
16653 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16654                                                signed long long  __offset,
16655                                                unsigned __int128 *__ptr) {
16656   vec_xst(__vec, __offset, __ptr);
16657 }
16658 #endif
16659 #else
16660   #define vec_xst_be vec_xst
16661 #endif
16662
16663 #ifdef __POWER9_VECTOR__
16664 #define vec_test_data_class(__a, __b)                                      \
16665         _Generic((__a),                                                    \
16666            vector float:                                                   \
16667              (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)),       \
16668            vector double:                                                  \
16669              (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b))  \
16670         )
16671
16672 #endif /* #ifdef __POWER9_VECTOR__ */
16673
16674 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16675   return -__a;
16676 }
16677
16678 #ifdef __VSX__
16679 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16680   return -__a;
16681 }
16682
16683 #endif
16684
16685 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16686 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16687   return -__a;
16688 }
16689 #endif
16690
16691 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16692   return -__a;
16693 }
16694
16695 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16696   return -__a;
16697 }
16698
16699 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16700   return -__a;
16701 }
16702
16703 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16704   return - vec_abs(__a);
16705 }
16706
16707 #ifdef __VSX__
16708 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16709   return - vec_abs(__a);
16710 }
16711
16712 #endif
16713
16714 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16715 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16716   return __builtin_altivec_vminsd(__a, -__a);
16717 }
16718 #endif
16719
16720 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16721   return __builtin_altivec_vminsw(__a, -__a);
16722 }
16723
16724 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16725   return __builtin_altivec_vminsh(__a, -__a);
16726 }
16727
16728 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16729   return __builtin_altivec_vminsb(__a, -__a);
16730 }
16731 #undef __ATTRS_o_ai
16732
16733 #endif /* __ALTIVEC_H */