]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
Merge llvm, clang, lld and lldb trunk r291274, and resolve conflicts.
[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   return __builtin_altivec_vrlwnm(__a, __b) & __c;
7668 }
7669
7670 static __inline__ vector unsigned long long __ATTRS_o_ai
7671 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
7672          vector unsigned long long __c) {
7673   return __builtin_altivec_vrldnm(__a, __b) & __c;
7674 }
7675 #endif
7676
7677 /* vec_vrlb */
7678
7679 static __inline__ vector signed char __ATTRS_o_ai
7680 vec_vrlb(vector signed char __a, vector unsigned char __b) {
7681   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
7682 }
7683
7684 static __inline__ vector unsigned char __ATTRS_o_ai
7685 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
7686   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
7687 }
7688
7689 /* vec_vrlh */
7690
7691 static __inline__ vector short __ATTRS_o_ai
7692 vec_vrlh(vector short __a, vector unsigned short __b) {
7693   return __builtin_altivec_vrlh(__a, __b);
7694 }
7695
7696 static __inline__ vector unsigned short __ATTRS_o_ai
7697 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
7698   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
7699 }
7700
7701 /* vec_vrlw */
7702
7703 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
7704                                                    vector unsigned int __b) {
7705   return __builtin_altivec_vrlw(__a, __b);
7706 }
7707
7708 static __inline__ vector unsigned int __ATTRS_o_ai
7709 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
7710   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
7711 }
7712
7713 /* vec_round */
7714
7715 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
7716 #ifdef __VSX__
7717   return __builtin_vsx_xvrspi(__a);
7718 #else
7719   return __builtin_altivec_vrfin(__a);
7720 #endif
7721 }
7722
7723 #ifdef __VSX__
7724 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
7725   return __builtin_vsx_xvrdpi(__a);
7726 }
7727
7728 /* vec_rint */
7729
7730 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
7731   return __builtin_vsx_xvrspic(__a);
7732 }
7733
7734 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
7735   return __builtin_vsx_xvrdpic(__a);
7736 }
7737
7738 /* vec_nearbyint */
7739
7740 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
7741   return __builtin_vsx_xvrspi(__a);
7742 }
7743
7744 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
7745   return __builtin_vsx_xvrdpi(__a);
7746 }
7747 #endif
7748
7749 /* vec_vrfin */
7750
7751 static __inline__ vector float __attribute__((__always_inline__))
7752 vec_vrfin(vector float __a) {
7753   return __builtin_altivec_vrfin(__a);
7754 }
7755
7756 /* vec_sqrt */
7757
7758 #ifdef __VSX__
7759 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
7760   return __builtin_vsx_xvsqrtsp(__a);
7761 }
7762
7763 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
7764   return __builtin_vsx_xvsqrtdp(__a);
7765 }
7766 #endif
7767
7768 /* vec_rsqrte */
7769
7770 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
7771 #ifdef __VSX__
7772   return __builtin_vsx_xvrsqrtesp(__a);
7773 #else
7774   return __builtin_altivec_vrsqrtefp(__a);
7775 #endif
7776 }
7777
7778 #ifdef __VSX__
7779 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
7780   return __builtin_vsx_xvrsqrtedp(__a);
7781 }
7782 #endif
7783
7784 /* vec_vrsqrtefp */
7785
7786 static __inline__ __vector float __attribute__((__always_inline__))
7787 vec_vrsqrtefp(vector float __a) {
7788   return __builtin_altivec_vrsqrtefp(__a);
7789 }
7790
7791 /* vec_sel */
7792
7793 #define __builtin_altivec_vsel_4si vec_sel
7794
7795 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
7796     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7797   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7798 }
7799
7800 static __inline__ vector signed char __ATTRS_o_ai
7801 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
7802   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7803 }
7804
7805 static __inline__ vector unsigned char __ATTRS_o_ai
7806 vec_sel(vector unsigned char __a, vector unsigned char __b,
7807         vector unsigned char __c) {
7808   return (__a & ~__c) | (__b & __c);
7809 }
7810
7811 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
7812     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7813   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7814 }
7815
7816 static __inline__ vector bool char __ATTRS_o_ai
7817 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7818   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7819 }
7820
7821 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
7822                                                         vector bool char __b,
7823                                                         vector bool char __c) {
7824   return (__a & ~__c) | (__b & __c);
7825 }
7826
7827 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7828                                                     vector short __b,
7829                                                     vector unsigned short __c) {
7830   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7831 }
7832
7833 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
7834                                                     vector short __b,
7835                                                     vector bool short __c) {
7836   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7837 }
7838
7839 static __inline__ vector unsigned short __ATTRS_o_ai
7840 vec_sel(vector unsigned short __a, vector unsigned short __b,
7841         vector unsigned short __c) {
7842   return (__a & ~__c) | (__b & __c);
7843 }
7844
7845 static __inline__ vector unsigned short __ATTRS_o_ai
7846 vec_sel(vector unsigned short __a, vector unsigned short __b,
7847         vector bool short __c) {
7848   return (__a & ~(vector unsigned short)__c) |
7849          (__b & (vector unsigned short)__c);
7850 }
7851
7852 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
7853     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7854   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7855 }
7856
7857 static __inline__ vector bool short __ATTRS_o_ai
7858 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
7859   return (__a & ~__c) | (__b & __c);
7860 }
7861
7862 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7863                                                   vector int __b,
7864                                                   vector unsigned int __c) {
7865   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7866 }
7867
7868 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
7869                                                   vector int __b,
7870                                                   vector bool int __c) {
7871   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7872 }
7873
7874 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
7875     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
7876   return (__a & ~__c) | (__b & __c);
7877 }
7878
7879 static __inline__ vector unsigned int __ATTRS_o_ai
7880 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
7881   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
7882 }
7883
7884 static __inline__ vector bool int __ATTRS_o_ai
7885 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
7886   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
7887 }
7888
7889 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
7890                                                        vector bool int __b,
7891                                                        vector bool int __c) {
7892   return (__a & ~__c) | (__b & __c);
7893 }
7894
7895 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7896                                                     vector float __b,
7897                                                     vector unsigned int __c) {
7898   vector int __res = ((vector int)__a & ~(vector int)__c) |
7899                      ((vector int)__b & (vector int)__c);
7900   return (vector float)__res;
7901 }
7902
7903 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
7904                                                     vector float __b,
7905                                                     vector bool int __c) {
7906   vector int __res = ((vector int)__a & ~(vector int)__c) |
7907                      ((vector int)__b & (vector int)__c);
7908   return (vector float)__res;
7909 }
7910
7911 #ifdef __VSX__
7912 static __inline__ vector double __ATTRS_o_ai
7913 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
7914   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7915                            ((vector long long)__b & (vector long long)__c);
7916   return (vector double)__res;
7917 }
7918
7919 static __inline__ vector double __ATTRS_o_ai
7920 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
7921   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
7922                            ((vector long long)__b & (vector long long)__c);
7923   return (vector double)__res;
7924 }
7925 #endif
7926
7927 /* vec_vsel */
7928
7929 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
7930     vector signed char __a, vector signed char __b, vector unsigned char __c) {
7931   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7932 }
7933
7934 static __inline__ vector signed char __ATTRS_o_ai
7935 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
7936   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
7937 }
7938
7939 static __inline__ vector unsigned char __ATTRS_o_ai
7940 vec_vsel(vector unsigned char __a, vector unsigned char __b,
7941          vector unsigned char __c) {
7942   return (__a & ~__c) | (__b & __c);
7943 }
7944
7945 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
7946     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
7947   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
7948 }
7949
7950 static __inline__ vector bool char __ATTRS_o_ai
7951 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7952   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
7953 }
7954
7955 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
7956                                                          vector bool char __b,
7957                                                          vector bool char __c) {
7958   return (__a & ~__c) | (__b & __c);
7959 }
7960
7961 static __inline__ vector short __ATTRS_o_ai
7962 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
7963   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7964 }
7965
7966 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
7967                                                      vector short __b,
7968                                                      vector bool short __c) {
7969   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
7970 }
7971
7972 static __inline__ vector unsigned short __ATTRS_o_ai
7973 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7974          vector unsigned short __c) {
7975   return (__a & ~__c) | (__b & __c);
7976 }
7977
7978 static __inline__ vector unsigned short __ATTRS_o_ai
7979 vec_vsel(vector unsigned short __a, vector unsigned short __b,
7980          vector bool short __c) {
7981   return (__a & ~(vector unsigned short)__c) |
7982          (__b & (vector unsigned short)__c);
7983 }
7984
7985 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
7986     vector bool short __a, vector bool short __b, vector unsigned short __c) {
7987   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
7988 }
7989
7990 static __inline__ vector bool short __ATTRS_o_ai
7991 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
7992   return (__a & ~__c) | (__b & __c);
7993 }
7994
7995 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
7996                                                    vector int __b,
7997                                                    vector unsigned int __c) {
7998   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
7999 }
8000
8001 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8002                                                    vector int __b,
8003                                                    vector bool int __c) {
8004   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8005 }
8006
8007 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8008     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8009   return (__a & ~__c) | (__b & __c);
8010 }
8011
8012 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8013     vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8014   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8015 }
8016
8017 static __inline__ vector bool int __ATTRS_o_ai
8018 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8019   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8020 }
8021
8022 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8023                                                         vector bool int __b,
8024                                                         vector bool int __c) {
8025   return (__a & ~__c) | (__b & __c);
8026 }
8027
8028 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8029                                                      vector float __b,
8030                                                      vector unsigned int __c) {
8031   vector int __res = ((vector int)__a & ~(vector int)__c) |
8032                      ((vector int)__b & (vector int)__c);
8033   return (vector float)__res;
8034 }
8035
8036 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8037                                                      vector float __b,
8038                                                      vector bool int __c) {
8039   vector int __res = ((vector int)__a & ~(vector int)__c) |
8040                      ((vector int)__b & (vector int)__c);
8041   return (vector float)__res;
8042 }
8043
8044 /* vec_sl */
8045
8046 static __inline__ vector signed char __ATTRS_o_ai
8047 vec_sl(vector signed char __a, vector unsigned char __b) {
8048   return __a << (vector signed char)__b;
8049 }
8050
8051 static __inline__ vector unsigned char __ATTRS_o_ai
8052 vec_sl(vector unsigned char __a, vector unsigned char __b) {
8053   return __a << __b;
8054 }
8055
8056 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8057                                                    vector unsigned short __b) {
8058   return __a << (vector short)__b;
8059 }
8060
8061 static __inline__ vector unsigned short __ATTRS_o_ai
8062 vec_sl(vector unsigned short __a, vector unsigned short __b) {
8063   return __a << __b;
8064 }
8065
8066 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8067                                                  vector unsigned int __b) {
8068   return __a << (vector int)__b;
8069 }
8070
8071 static __inline__ vector unsigned int __ATTRS_o_ai
8072 vec_sl(vector unsigned int __a, vector unsigned int __b) {
8073   return __a << __b;
8074 }
8075
8076 #ifdef __POWER8_VECTOR__
8077 static __inline__ vector signed long long __ATTRS_o_ai
8078 vec_sl(vector signed long long __a, vector unsigned long long __b) {
8079   return __a << (vector long long)__b;
8080 }
8081
8082 static __inline__ vector unsigned long long __ATTRS_o_ai
8083 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8084   return __a << __b;
8085 }
8086 #endif
8087
8088 /* vec_vslb */
8089
8090 #define __builtin_altivec_vslb vec_vslb
8091
8092 static __inline__ vector signed char __ATTRS_o_ai
8093 vec_vslb(vector signed char __a, vector unsigned char __b) {
8094   return vec_sl(__a, __b);
8095 }
8096
8097 static __inline__ vector unsigned char __ATTRS_o_ai
8098 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8099   return vec_sl(__a, __b);
8100 }
8101
8102 /* vec_vslh */
8103
8104 #define __builtin_altivec_vslh vec_vslh
8105
8106 static __inline__ vector short __ATTRS_o_ai
8107 vec_vslh(vector short __a, vector unsigned short __b) {
8108   return vec_sl(__a, __b);
8109 }
8110
8111 static __inline__ vector unsigned short __ATTRS_o_ai
8112 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8113   return vec_sl(__a, __b);
8114 }
8115
8116 /* vec_vslw */
8117
8118 #define __builtin_altivec_vslw vec_vslw
8119
8120 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
8121                                                    vector unsigned int __b) {
8122   return vec_sl(__a, __b);
8123 }
8124
8125 static __inline__ vector unsigned int __ATTRS_o_ai
8126 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
8127   return vec_sl(__a, __b);
8128 }
8129
8130 /* vec_sld */
8131
8132 #define __builtin_altivec_vsldoi_4si vec_sld
8133
8134 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
8135     vector signed char __a, vector signed char __b, unsigned const int __c) {
8136   unsigned char __d = __c & 0x0F;
8137 #ifdef __LITTLE_ENDIAN__
8138   return vec_perm(
8139       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8140                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8141                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8142                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8143 #else
8144   return vec_perm(
8145       __a, __b,
8146       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8147                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8148                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8149 #endif
8150 }
8151
8152 static __inline__ vector unsigned char __ATTRS_o_ai
8153 vec_sld(vector unsigned char __a, vector unsigned char __b,
8154         unsigned const int __c) {
8155   unsigned char __d = __c & 0x0F;
8156 #ifdef __LITTLE_ENDIAN__
8157   return vec_perm(
8158       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8159                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8160                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8161                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8162 #else
8163   return vec_perm(
8164       __a, __b,
8165       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8166                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8167                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8168 #endif
8169 }
8170
8171 static __inline__ vector bool char __ATTRS_o_ai
8172 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
8173   unsigned char __d = __c & 0x0F;
8174 #ifdef __LITTLE_ENDIAN__
8175   return vec_perm(
8176       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8177                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8178                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8179                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8180 #else
8181   return vec_perm(
8182       __a, __b,
8183       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8184                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8185                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8186 #endif
8187 }
8188
8189 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
8190     vector signed short __a, vector signed short __b, unsigned const int __c) {
8191   unsigned char __d = __c & 0x0F;
8192 #ifdef __LITTLE_ENDIAN__
8193   return vec_perm(
8194       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8195                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8196                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8197                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8198 #else
8199   return vec_perm(
8200       __a, __b,
8201       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8202                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8203                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8204 #endif
8205 }
8206
8207 static __inline__ vector unsigned short __ATTRS_o_ai
8208 vec_sld(vector unsigned short __a, vector unsigned short __b,
8209         unsigned const int __c) {
8210   unsigned char __d = __c & 0x0F;
8211 #ifdef __LITTLE_ENDIAN__
8212   return vec_perm(
8213       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8214                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8215                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8216                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8217 #else
8218   return vec_perm(
8219       __a, __b,
8220       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8221                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8222                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8223 #endif
8224 }
8225
8226 static __inline__ vector bool short __ATTRS_o_ai
8227 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
8228   unsigned char __d = __c & 0x0F;
8229 #ifdef __LITTLE_ENDIAN__
8230   return vec_perm(
8231       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8232                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8233                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8234                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8235 #else
8236   return vec_perm(
8237       __a, __b,
8238       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8239                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8240                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8241 #endif
8242 }
8243
8244 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
8245                                                     vector pixel __b,
8246                                                     unsigned const int __c) {
8247   unsigned char __d = __c & 0x0F;
8248 #ifdef __LITTLE_ENDIAN__
8249   return vec_perm(
8250       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8251                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8252                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8253                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8254 #else
8255   return vec_perm(
8256       __a, __b,
8257       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8258                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8259                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8260 #endif
8261 }
8262
8263 static __inline__ vector signed int __ATTRS_o_ai
8264 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
8265   unsigned char __d = __c & 0x0F;
8266 #ifdef __LITTLE_ENDIAN__
8267   return vec_perm(
8268       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8269                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8270                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8271                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8272 #else
8273   return vec_perm(
8274       __a, __b,
8275       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8276                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8277                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8278 #endif
8279 }
8280
8281 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
8282     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8283   unsigned char __d = __c & 0x0F;
8284 #ifdef __LITTLE_ENDIAN__
8285   return vec_perm(
8286       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8287                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8288                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8289                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8290 #else
8291   return vec_perm(
8292       __a, __b,
8293       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8294                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8295                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8296 #endif
8297 }
8298
8299 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
8300                                                        vector bool int __b,
8301                                                        unsigned const int __c) {
8302   unsigned char __d = __c & 0x0F;
8303 #ifdef __LITTLE_ENDIAN__
8304   return vec_perm(
8305       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8306                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8307                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8308                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8309 #else
8310   return vec_perm(
8311       __a, __b,
8312       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8313                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8314                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8315 #endif
8316 }
8317
8318 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
8319                                                     vector float __b,
8320                                                     unsigned const int __c) {
8321   unsigned char __d = __c & 0x0F;
8322 #ifdef __LITTLE_ENDIAN__
8323   return vec_perm(
8324       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8325                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8326                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8327                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8328 #else
8329   return vec_perm(
8330       __a, __b,
8331       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8332                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8333                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8334 #endif
8335 }
8336
8337 #ifdef __VSX__
8338 static __inline__ vector bool long long __ATTRS_o_ai
8339 vec_sld(vector bool long long __a, vector bool long long __b,
8340         unsigned const int __c) {
8341   unsigned char __d = __c & 0x0F;
8342 #ifdef __LITTLE_ENDIAN__
8343   return vec_perm(
8344       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8345                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8346                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8347                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8348 #else
8349   return vec_perm(
8350       __a, __b,
8351       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8352                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8353                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8354 #endif
8355 }
8356
8357 static __inline__ vector signed long long __ATTRS_o_ai
8358 vec_sld(vector signed long long __a, vector signed long long __b,
8359         unsigned const int __c) {
8360   unsigned char __d = __c & 0x0F;
8361 #ifdef __LITTLE_ENDIAN__
8362   return vec_perm(
8363       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8364                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8365                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8366                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8367 #else
8368   return vec_perm(
8369       __a, __b,
8370       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8371                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8372                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8373 #endif
8374 }
8375
8376 static __inline__ vector unsigned long long __ATTRS_o_ai
8377 vec_sld(vector unsigned long long __a, vector unsigned long long __b,
8378         unsigned const int __c) {
8379   unsigned char __d = __c & 0x0F;
8380 #ifdef __LITTLE_ENDIAN__
8381   return vec_perm(
8382       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8383                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8384                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8385                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8386 #else
8387   return vec_perm(
8388       __a, __b,
8389       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8390                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8391                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8392 #endif
8393 }
8394
8395 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
8396                                                      vector double __b,
8397                                                      unsigned const int __c) {
8398   unsigned char __d = __c & 0x0F;
8399 #ifdef __LITTLE_ENDIAN__
8400   return vec_perm(
8401       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8402                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8403                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8404                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8405 #else
8406   return vec_perm(
8407       __a, __b,
8408       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8409                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8410                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8411 #endif
8412 }
8413 #endif
8414
8415 /* vec_sldw */
8416 static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
8417     vector signed char __a, vector signed char __b, unsigned const int __c) {
8418   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8419 }
8420
8421 static __inline__ vector unsigned char __ATTRS_o_ai
8422 vec_sldw(vector unsigned char __a, vector unsigned char __b,
8423          unsigned const int __c) {
8424   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8425 }
8426
8427 static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
8428     vector signed short __a, vector signed short __b, unsigned const int __c) {
8429   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8430 }
8431
8432 static __inline__ vector unsigned short __ATTRS_o_ai
8433 vec_sldw(vector unsigned short __a, vector unsigned short __b,
8434          unsigned const int __c) {
8435   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8436 }
8437
8438 static __inline__ vector signed int __ATTRS_o_ai
8439 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
8440   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8441 }
8442
8443 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
8444     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
8445   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8446 }
8447
8448 #ifdef __VSX__
8449 static __inline__ vector signed long long __ATTRS_o_ai
8450 vec_sldw(vector signed long long __a, vector signed long long __b,
8451          unsigned const int __c) {
8452   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8453 }
8454
8455 static __inline__ vector unsigned long long __ATTRS_o_ai
8456 vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
8457          unsigned const int __c) {
8458   return vec_sld(__a, __b, ((__c << 2) & 0x0F));
8459 }
8460 #endif
8461
8462 #ifdef __POWER9_VECTOR__
8463 /* vec_slv */
8464 static __inline__ vector unsigned char __ATTRS_o_ai
8465 vec_slv(vector unsigned char __a, vector unsigned char __b) {
8466   return __builtin_altivec_vslv(__a, __b);
8467 }
8468
8469 /* vec_srv */
8470 static __inline__ vector unsigned char __ATTRS_o_ai
8471 vec_srv(vector unsigned char __a, vector unsigned char __b) {
8472   return __builtin_altivec_vsrv(__a, __b);
8473 }
8474 #endif
8475
8476 /* vec_vsldoi */
8477
8478 static __inline__ vector signed char __ATTRS_o_ai
8479 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
8480   unsigned char __d = __c & 0x0F;
8481 #ifdef __LITTLE_ENDIAN__
8482   return vec_perm(
8483       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8484                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8485                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8486                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8487 #else
8488   return vec_perm(
8489       __a, __b,
8490       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8491                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8492                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8493 #endif
8494 }
8495
8496 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
8497     vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
8498   unsigned char __d = __c & 0x0F;
8499 #ifdef __LITTLE_ENDIAN__
8500   return vec_perm(
8501       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8502                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8503                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8504                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8505 #else
8506   return vec_perm(
8507       __a, __b,
8508       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8509                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8510                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8511 #endif
8512 }
8513
8514 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
8515                                                        vector short __b,
8516                                                        unsigned char __c) {
8517   unsigned char __d = __c & 0x0F;
8518 #ifdef __LITTLE_ENDIAN__
8519   return vec_perm(
8520       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8521                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8522                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8523                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8524 #else
8525   return vec_perm(
8526       __a, __b,
8527       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8528                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8529                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8530 #endif
8531 }
8532
8533 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
8534     vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
8535   unsigned char __d = __c & 0x0F;
8536 #ifdef __LITTLE_ENDIAN__
8537   return vec_perm(
8538       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8539                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8540                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8541                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8542 #else
8543   return vec_perm(
8544       __a, __b,
8545       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8546                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8547                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8548 #endif
8549 }
8550
8551 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
8552                                                        vector pixel __b,
8553                                                        unsigned char __c) {
8554   unsigned char __d = __c & 0x0F;
8555 #ifdef __LITTLE_ENDIAN__
8556   return vec_perm(
8557       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8558                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8559                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8560                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8561 #else
8562   return vec_perm(
8563       __a, __b,
8564       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8565                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8566                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8567 #endif
8568 }
8569
8570 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
8571                                                      vector int __b,
8572                                                      unsigned char __c) {
8573   unsigned char __d = __c & 0x0F;
8574 #ifdef __LITTLE_ENDIAN__
8575   return vec_perm(
8576       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8577                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8578                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8579                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8580 #else
8581   return vec_perm(
8582       __a, __b,
8583       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8584                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8585                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8586 #endif
8587 }
8588
8589 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
8590     vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
8591   unsigned char __d = __c & 0x0F;
8592 #ifdef __LITTLE_ENDIAN__
8593   return vec_perm(
8594       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8595                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8596                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8597                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8598 #else
8599   return vec_perm(
8600       __a, __b,
8601       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8602                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8603                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8604 #endif
8605 }
8606
8607 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
8608                                                        vector float __b,
8609                                                        unsigned char __c) {
8610   unsigned char __d = __c & 0x0F;
8611 #ifdef __LITTLE_ENDIAN__
8612   return vec_perm(
8613       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
8614                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
8615                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
8616                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
8617 #else
8618   return vec_perm(
8619       __a, __b,
8620       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
8621                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
8622                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
8623 #endif
8624 }
8625
8626 /* vec_sll */
8627
8628 static __inline__ vector signed char __ATTRS_o_ai
8629 vec_sll(vector signed char __a, vector unsigned char __b) {
8630   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8631                                                    (vector int)__b);
8632 }
8633
8634 static __inline__ vector signed char __ATTRS_o_ai
8635 vec_sll(vector signed char __a, vector unsigned short __b) {
8636   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8637                                                    (vector int)__b);
8638 }
8639
8640 static __inline__ vector signed char __ATTRS_o_ai
8641 vec_sll(vector signed char __a, vector unsigned int __b) {
8642   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8643                                                    (vector int)__b);
8644 }
8645
8646 static __inline__ vector unsigned char __ATTRS_o_ai
8647 vec_sll(vector unsigned char __a, vector unsigned char __b) {
8648   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8649                                                      (vector int)__b);
8650 }
8651
8652 static __inline__ vector unsigned char __ATTRS_o_ai
8653 vec_sll(vector unsigned char __a, vector unsigned short __b) {
8654   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8655                                                      (vector int)__b);
8656 }
8657
8658 static __inline__ vector unsigned char __ATTRS_o_ai
8659 vec_sll(vector unsigned char __a, vector unsigned int __b) {
8660   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8661                                                      (vector int)__b);
8662 }
8663
8664 static __inline__ vector bool char __ATTRS_o_ai
8665 vec_sll(vector bool char __a, vector unsigned char __b) {
8666   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8667                                                  (vector int)__b);
8668 }
8669
8670 static __inline__ vector bool char __ATTRS_o_ai
8671 vec_sll(vector bool char __a, vector unsigned short __b) {
8672   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8673                                                  (vector int)__b);
8674 }
8675
8676 static __inline__ vector bool char __ATTRS_o_ai
8677 vec_sll(vector bool char __a, vector unsigned int __b) {
8678   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8679                                                  (vector int)__b);
8680 }
8681
8682 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8683                                                     vector unsigned char __b) {
8684   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8685 }
8686
8687 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8688                                                     vector unsigned short __b) {
8689   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8690 }
8691
8692 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
8693                                                     vector unsigned int __b) {
8694   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8695 }
8696
8697 static __inline__ vector unsigned short __ATTRS_o_ai
8698 vec_sll(vector unsigned short __a, vector unsigned char __b) {
8699   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8700                                                       (vector int)__b);
8701 }
8702
8703 static __inline__ vector unsigned short __ATTRS_o_ai
8704 vec_sll(vector unsigned short __a, vector unsigned short __b) {
8705   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8706                                                       (vector int)__b);
8707 }
8708
8709 static __inline__ vector unsigned short __ATTRS_o_ai
8710 vec_sll(vector unsigned short __a, vector unsigned int __b) {
8711   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8712                                                       (vector int)__b);
8713 }
8714
8715 static __inline__ vector bool short __ATTRS_o_ai
8716 vec_sll(vector bool short __a, vector unsigned char __b) {
8717   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8718                                                   (vector int)__b);
8719 }
8720
8721 static __inline__ vector bool short __ATTRS_o_ai
8722 vec_sll(vector bool short __a, vector unsigned short __b) {
8723   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8724                                                   (vector int)__b);
8725 }
8726
8727 static __inline__ vector bool short __ATTRS_o_ai
8728 vec_sll(vector bool short __a, vector unsigned int __b) {
8729   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8730                                                   (vector int)__b);
8731 }
8732
8733 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8734                                                     vector unsigned char __b) {
8735   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8736 }
8737
8738 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8739                                                     vector unsigned short __b) {
8740   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8741 }
8742
8743 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
8744                                                     vector unsigned int __b) {
8745   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8746 }
8747
8748 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8749                                                   vector unsigned char __b) {
8750   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8751 }
8752
8753 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8754                                                   vector unsigned short __b) {
8755   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8756 }
8757
8758 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
8759                                                   vector unsigned int __b) {
8760   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8761 }
8762
8763 static __inline__ vector unsigned int __ATTRS_o_ai
8764 vec_sll(vector unsigned int __a, vector unsigned char __b) {
8765   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8766                                                     (vector int)__b);
8767 }
8768
8769 static __inline__ vector unsigned int __ATTRS_o_ai
8770 vec_sll(vector unsigned int __a, vector unsigned short __b) {
8771   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8772                                                     (vector int)__b);
8773 }
8774
8775 static __inline__ vector unsigned int __ATTRS_o_ai
8776 vec_sll(vector unsigned int __a, vector unsigned int __b) {
8777   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8778                                                     (vector int)__b);
8779 }
8780
8781 static __inline__ vector bool int __ATTRS_o_ai
8782 vec_sll(vector bool int __a, vector unsigned char __b) {
8783   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8784                                                 (vector int)__b);
8785 }
8786
8787 static __inline__ vector bool int __ATTRS_o_ai
8788 vec_sll(vector bool int __a, vector unsigned short __b) {
8789   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8790                                                 (vector int)__b);
8791 }
8792
8793 static __inline__ vector bool int __ATTRS_o_ai
8794 vec_sll(vector bool int __a, vector unsigned int __b) {
8795   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8796                                                 (vector int)__b);
8797 }
8798
8799 #ifdef __VSX__
8800 static __inline__ vector signed long long __ATTRS_o_ai
8801 vec_sll(vector signed long long __a, vector unsigned char __b) {
8802   return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
8803                                                         (vector int)__b);
8804 }
8805
8806 static __inline__ vector unsigned long long __ATTRS_o_ai
8807 vec_sll(vector unsigned long long __a, vector unsigned char __b) {
8808   return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
8809                                                           (vector int)__b);
8810 }
8811 #endif
8812
8813 /* vec_vsl */
8814
8815 static __inline__ vector signed char __ATTRS_o_ai
8816 vec_vsl(vector signed char __a, vector unsigned char __b) {
8817   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8818                                                    (vector int)__b);
8819 }
8820
8821 static __inline__ vector signed char __ATTRS_o_ai
8822 vec_vsl(vector signed char __a, vector unsigned short __b) {
8823   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8824                                                    (vector int)__b);
8825 }
8826
8827 static __inline__ vector signed char __ATTRS_o_ai
8828 vec_vsl(vector signed char __a, vector unsigned int __b) {
8829   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
8830                                                    (vector int)__b);
8831 }
8832
8833 static __inline__ vector unsigned char __ATTRS_o_ai
8834 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
8835   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8836                                                      (vector int)__b);
8837 }
8838
8839 static __inline__ vector unsigned char __ATTRS_o_ai
8840 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
8841   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8842                                                      (vector int)__b);
8843 }
8844
8845 static __inline__ vector unsigned char __ATTRS_o_ai
8846 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
8847   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
8848                                                      (vector int)__b);
8849 }
8850
8851 static __inline__ vector bool char __ATTRS_o_ai
8852 vec_vsl(vector bool char __a, vector unsigned char __b) {
8853   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8854                                                  (vector int)__b);
8855 }
8856
8857 static __inline__ vector bool char __ATTRS_o_ai
8858 vec_vsl(vector bool char __a, vector unsigned short __b) {
8859   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8860                                                  (vector int)__b);
8861 }
8862
8863 static __inline__ vector bool char __ATTRS_o_ai
8864 vec_vsl(vector bool char __a, vector unsigned int __b) {
8865   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
8866                                                  (vector int)__b);
8867 }
8868
8869 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8870                                                     vector unsigned char __b) {
8871   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8872 }
8873
8874 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8875                                                     vector unsigned short __b) {
8876   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8877 }
8878
8879 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
8880                                                     vector unsigned int __b) {
8881   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8882 }
8883
8884 static __inline__ vector unsigned short __ATTRS_o_ai
8885 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
8886   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8887                                                       (vector int)__b);
8888 }
8889
8890 static __inline__ vector unsigned short __ATTRS_o_ai
8891 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
8892   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8893                                                       (vector int)__b);
8894 }
8895
8896 static __inline__ vector unsigned short __ATTRS_o_ai
8897 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
8898   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
8899                                                       (vector int)__b);
8900 }
8901
8902 static __inline__ vector bool short __ATTRS_o_ai
8903 vec_vsl(vector bool short __a, vector unsigned char __b) {
8904   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8905                                                   (vector int)__b);
8906 }
8907
8908 static __inline__ vector bool short __ATTRS_o_ai
8909 vec_vsl(vector bool short __a, vector unsigned short __b) {
8910   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8911                                                   (vector int)__b);
8912 }
8913
8914 static __inline__ vector bool short __ATTRS_o_ai
8915 vec_vsl(vector bool short __a, vector unsigned int __b) {
8916   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
8917                                                   (vector int)__b);
8918 }
8919
8920 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8921                                                     vector unsigned char __b) {
8922   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8923 }
8924
8925 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8926                                                     vector unsigned short __b) {
8927   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8928 }
8929
8930 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
8931                                                     vector unsigned int __b) {
8932   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
8933 }
8934
8935 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8936                                                   vector unsigned char __b) {
8937   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8938 }
8939
8940 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8941                                                   vector unsigned short __b) {
8942   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8943 }
8944
8945 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
8946                                                   vector unsigned int __b) {
8947   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
8948 }
8949
8950 static __inline__ vector unsigned int __ATTRS_o_ai
8951 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
8952   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8953                                                     (vector int)__b);
8954 }
8955
8956 static __inline__ vector unsigned int __ATTRS_o_ai
8957 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
8958   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8959                                                     (vector int)__b);
8960 }
8961
8962 static __inline__ vector unsigned int __ATTRS_o_ai
8963 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
8964   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
8965                                                     (vector int)__b);
8966 }
8967
8968 static __inline__ vector bool int __ATTRS_o_ai
8969 vec_vsl(vector bool int __a, vector unsigned char __b) {
8970   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8971                                                 (vector int)__b);
8972 }
8973
8974 static __inline__ vector bool int __ATTRS_o_ai
8975 vec_vsl(vector bool int __a, vector unsigned short __b) {
8976   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8977                                                 (vector int)__b);
8978 }
8979
8980 static __inline__ vector bool int __ATTRS_o_ai
8981 vec_vsl(vector bool int __a, vector unsigned int __b) {
8982   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
8983                                                 (vector int)__b);
8984 }
8985
8986 /* vec_slo */
8987
8988 static __inline__ vector signed char __ATTRS_o_ai
8989 vec_slo(vector signed char __a, vector signed char __b) {
8990   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8991                                                     (vector int)__b);
8992 }
8993
8994 static __inline__ vector signed char __ATTRS_o_ai
8995 vec_slo(vector signed char __a, vector unsigned char __b) {
8996   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
8997                                                     (vector int)__b);
8998 }
8999
9000 static __inline__ vector unsigned char __ATTRS_o_ai
9001 vec_slo(vector unsigned char __a, vector signed char __b) {
9002   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9003                                                       (vector int)__b);
9004 }
9005
9006 static __inline__ vector unsigned char __ATTRS_o_ai
9007 vec_slo(vector unsigned char __a, vector unsigned char __b) {
9008   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9009                                                       (vector int)__b);
9010 }
9011
9012 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9013                                                     vector signed char __b) {
9014   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9015 }
9016
9017 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9018                                                     vector unsigned char __b) {
9019   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9020 }
9021
9022 static __inline__ vector unsigned short __ATTRS_o_ai
9023 vec_slo(vector unsigned short __a, vector signed char __b) {
9024   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9025                                                        (vector int)__b);
9026 }
9027
9028 static __inline__ vector unsigned short __ATTRS_o_ai
9029 vec_slo(vector unsigned short __a, vector unsigned char __b) {
9030   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9031                                                        (vector int)__b);
9032 }
9033
9034 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9035                                                     vector signed char __b) {
9036   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9037 }
9038
9039 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9040                                                     vector unsigned char __b) {
9041   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9042 }
9043
9044 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9045                                                   vector signed char __b) {
9046   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9047 }
9048
9049 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9050                                                   vector unsigned char __b) {
9051   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9052 }
9053
9054 static __inline__ vector unsigned int __ATTRS_o_ai
9055 vec_slo(vector unsigned int __a, vector signed char __b) {
9056   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9057                                                      (vector int)__b);
9058 }
9059
9060 static __inline__ vector unsigned int __ATTRS_o_ai
9061 vec_slo(vector unsigned int __a, vector unsigned char __b) {
9062   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9063                                                      (vector int)__b);
9064 }
9065
9066 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9067                                                     vector signed char __b) {
9068   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9069 }
9070
9071 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9072                                                     vector unsigned char __b) {
9073   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9074 }
9075
9076 #ifdef __VSX__
9077 static __inline__ vector signed long long __ATTRS_o_ai
9078 vec_slo(vector signed long long __a, vector signed char __b) {
9079   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9080                                                          (vector int)__b);
9081 }
9082
9083 static __inline__ vector signed long long __ATTRS_o_ai
9084 vec_slo(vector signed long long __a, vector unsigned char __b) {
9085   return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9086                                                          (vector int)__b);
9087 }
9088
9089 static __inline__ vector unsigned long long __ATTRS_o_ai
9090 vec_slo(vector unsigned long long __a, vector signed char __b) {
9091   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9092                                                            (vector int)__b);
9093 }
9094
9095 static __inline__ vector unsigned long long __ATTRS_o_ai
9096 vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9097   return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9098                                                            (vector int)__b);
9099 }
9100 #endif
9101
9102 /* vec_vslo */
9103
9104 static __inline__ vector signed char __ATTRS_o_ai
9105 vec_vslo(vector signed char __a, vector signed char __b) {
9106   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9107                                                     (vector int)__b);
9108 }
9109
9110 static __inline__ vector signed char __ATTRS_o_ai
9111 vec_vslo(vector signed char __a, vector unsigned char __b) {
9112   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9113                                                     (vector int)__b);
9114 }
9115
9116 static __inline__ vector unsigned char __ATTRS_o_ai
9117 vec_vslo(vector unsigned char __a, vector signed char __b) {
9118   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9119                                                       (vector int)__b);
9120 }
9121
9122 static __inline__ vector unsigned char __ATTRS_o_ai
9123 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
9124   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9125                                                       (vector int)__b);
9126 }
9127
9128 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9129                                                      vector signed char __b) {
9130   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9131 }
9132
9133 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
9134                                                      vector unsigned char __b) {
9135   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9136 }
9137
9138 static __inline__ vector unsigned short __ATTRS_o_ai
9139 vec_vslo(vector unsigned short __a, vector signed char __b) {
9140   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9141                                                        (vector int)__b);
9142 }
9143
9144 static __inline__ vector unsigned short __ATTRS_o_ai
9145 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
9146   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9147                                                        (vector int)__b);
9148 }
9149
9150 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9151                                                      vector signed char __b) {
9152   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9153 }
9154
9155 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
9156                                                      vector unsigned char __b) {
9157   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9158 }
9159
9160 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9161                                                    vector signed char __b) {
9162   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9163 }
9164
9165 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
9166                                                    vector unsigned char __b) {
9167   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9168 }
9169
9170 static __inline__ vector unsigned int __ATTRS_o_ai
9171 vec_vslo(vector unsigned int __a, vector signed char __b) {
9172   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9173                                                      (vector int)__b);
9174 }
9175
9176 static __inline__ vector unsigned int __ATTRS_o_ai
9177 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
9178   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9179                                                      (vector int)__b);
9180 }
9181
9182 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9183                                                      vector signed char __b) {
9184   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9185 }
9186
9187 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
9188                                                      vector unsigned char __b) {
9189   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9190 }
9191
9192 /* vec_splat */
9193
9194 static __inline__ vector signed char __ATTRS_o_ai
9195 vec_splat(vector signed char __a, unsigned const int __b) {
9196   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9197 }
9198
9199 static __inline__ vector unsigned char __ATTRS_o_ai
9200 vec_splat(vector unsigned char __a, unsigned const int __b) {
9201   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9202 }
9203
9204 static __inline__ vector bool char __ATTRS_o_ai
9205 vec_splat(vector bool char __a, unsigned const int __b) {
9206   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
9207 }
9208
9209 static __inline__ vector signed short __ATTRS_o_ai
9210 vec_splat(vector signed short __a, unsigned const int __b) {
9211   unsigned char b0 = (__b & 0x07) * 2;
9212   unsigned char b1 = b0 + 1;
9213   return vec_perm(__a, __a,
9214                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9215                                          b0, b1, b0, b1, b0, b1));
9216 }
9217
9218 static __inline__ vector unsigned short __ATTRS_o_ai
9219 vec_splat(vector unsigned short __a, unsigned const int __b) {
9220   unsigned char b0 = (__b & 0x07) * 2;
9221   unsigned char b1 = b0 + 1;
9222   return vec_perm(__a, __a,
9223                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9224                                          b0, b1, b0, b1, b0, b1));
9225 }
9226
9227 static __inline__ vector bool short __ATTRS_o_ai
9228 vec_splat(vector bool short __a, unsigned const int __b) {
9229   unsigned char b0 = (__b & 0x07) * 2;
9230   unsigned char b1 = b0 + 1;
9231   return vec_perm(__a, __a,
9232                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9233                                          b0, b1, b0, b1, b0, b1));
9234 }
9235
9236 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
9237                                                       unsigned const int __b) {
9238   unsigned char b0 = (__b & 0x07) * 2;
9239   unsigned char b1 = b0 + 1;
9240   return vec_perm(__a, __a,
9241                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
9242                                          b0, b1, b0, b1, b0, b1));
9243 }
9244
9245 static __inline__ vector signed int __ATTRS_o_ai
9246 vec_splat(vector signed int __a, unsigned const int __b) {
9247   unsigned char b0 = (__b & 0x03) * 4;
9248   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9249   return vec_perm(__a, __a,
9250                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9251                                          b2, b3, b0, b1, b2, b3));
9252 }
9253
9254 static __inline__ vector unsigned int __ATTRS_o_ai
9255 vec_splat(vector unsigned int __a, unsigned const int __b) {
9256   unsigned char b0 = (__b & 0x03) * 4;
9257   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9258   return vec_perm(__a, __a,
9259                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9260                                          b2, b3, b0, b1, b2, b3));
9261 }
9262
9263 static __inline__ vector bool int __ATTRS_o_ai
9264 vec_splat(vector bool int __a, unsigned const int __b) {
9265   unsigned char b0 = (__b & 0x03) * 4;
9266   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9267   return vec_perm(__a, __a,
9268                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9269                                          b2, b3, b0, b1, b2, b3));
9270 }
9271
9272 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
9273                                                       unsigned const int __b) {
9274   unsigned char b0 = (__b & 0x03) * 4;
9275   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
9276   return vec_perm(__a, __a,
9277                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
9278                                          b2, b3, b0, b1, b2, b3));
9279 }
9280
9281 #ifdef __VSX__
9282 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
9283                                                        unsigned const int __b) {
9284   unsigned char b0 = (__b & 0x01) * 8;
9285   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9286                 b6 = b0 + 6, b7 = b0 + 7;
9287   return vec_perm(__a, __a,
9288                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9289                                          b2, b3, b4, b5, b6, b7));
9290 }
9291 static __inline__ vector bool long long __ATTRS_o_ai
9292 vec_splat(vector bool long long __a, unsigned const int __b) {
9293   unsigned char b0 = (__b & 0x01) * 8;
9294   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9295                 b6 = b0 + 6, b7 = b0 + 7;
9296   return vec_perm(__a, __a,
9297                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9298                                          b2, b3, b4, b5, b6, b7));
9299 }
9300 static __inline__ vector signed long long __ATTRS_o_ai
9301 vec_splat(vector signed long long __a, unsigned const int __b) {
9302   unsigned char b0 = (__b & 0x01) * 8;
9303   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9304                 b6 = b0 + 6, b7 = b0 + 7;
9305   return vec_perm(__a, __a,
9306                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9307                                          b2, b3, b4, b5, b6, b7));
9308 }
9309 static __inline__ vector unsigned long long __ATTRS_o_ai
9310 vec_splat(vector unsigned long long __a, unsigned const int __b) {
9311   unsigned char b0 = (__b & 0x01) * 8;
9312   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
9313                 b6 = b0 + 6, b7 = b0 + 7;
9314   return vec_perm(__a, __a,
9315                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
9316                                          b2, b3, b4, b5, b6, b7));
9317 }
9318 #endif
9319
9320 /* vec_vspltb */
9321
9322 #define __builtin_altivec_vspltb vec_vspltb
9323
9324 static __inline__ vector signed char __ATTRS_o_ai
9325 vec_vspltb(vector signed char __a, unsigned char __b) {
9326   return vec_perm(__a, __a, (vector unsigned char)(__b));
9327 }
9328
9329 static __inline__ vector unsigned char __ATTRS_o_ai
9330 vec_vspltb(vector unsigned char __a, unsigned char __b) {
9331   return vec_perm(__a, __a, (vector unsigned char)(__b));
9332 }
9333
9334 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
9335                                                            unsigned char __b) {
9336   return vec_perm(__a, __a, (vector unsigned char)(__b));
9337 }
9338
9339 /* vec_vsplth */
9340
9341 #define __builtin_altivec_vsplth vec_vsplth
9342
9343 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
9344                                                        unsigned char __b) {
9345   __b *= 2;
9346   unsigned char b1 = __b + 1;
9347   return vec_perm(__a, __a,
9348                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9349                                          __b, b1, __b, b1, __b, b1, __b, b1));
9350 }
9351
9352 static __inline__ vector unsigned short __ATTRS_o_ai
9353 vec_vsplth(vector unsigned short __a, unsigned char __b) {
9354   __b *= 2;
9355   unsigned char b1 = __b + 1;
9356   return vec_perm(__a, __a,
9357                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9358                                          __b, b1, __b, b1, __b, b1, __b, b1));
9359 }
9360
9361 static __inline__ vector bool short __ATTRS_o_ai
9362 vec_vsplth(vector bool short __a, unsigned char __b) {
9363   __b *= 2;
9364   unsigned char b1 = __b + 1;
9365   return vec_perm(__a, __a,
9366                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9367                                          __b, b1, __b, b1, __b, b1, __b, b1));
9368 }
9369
9370 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
9371                                                        unsigned char __b) {
9372   __b *= 2;
9373   unsigned char b1 = __b + 1;
9374   return vec_perm(__a, __a,
9375                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
9376                                          __b, b1, __b, b1, __b, b1, __b, b1));
9377 }
9378
9379 /* vec_vspltw */
9380
9381 #define __builtin_altivec_vspltw vec_vspltw
9382
9383 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
9384                                                      unsigned char __b) {
9385   __b *= 4;
9386   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9387   return vec_perm(__a, __a,
9388                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9389                                          b1, b2, b3, __b, b1, b2, b3));
9390 }
9391
9392 static __inline__ vector unsigned int __ATTRS_o_ai
9393 vec_vspltw(vector unsigned int __a, unsigned char __b) {
9394   __b *= 4;
9395   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9396   return vec_perm(__a, __a,
9397                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9398                                          b1, b2, b3, __b, b1, b2, b3));
9399 }
9400
9401 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
9402                                                           unsigned char __b) {
9403   __b *= 4;
9404   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9405   return vec_perm(__a, __a,
9406                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9407                                          b1, b2, b3, __b, b1, b2, b3));
9408 }
9409
9410 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
9411                                                        unsigned char __b) {
9412   __b *= 4;
9413   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
9414   return vec_perm(__a, __a,
9415                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
9416                                          b1, b2, b3, __b, b1, b2, b3));
9417 }
9418
9419 /* vec_splat_s8 */
9420
9421 #define __builtin_altivec_vspltisb vec_splat_s8
9422
9423 // FIXME: parameter should be treated as 5-bit signed literal
9424 static __inline__ vector signed char __ATTRS_o_ai
9425 vec_splat_s8(signed char __a) {
9426   return (vector signed char)(__a);
9427 }
9428
9429 /* vec_vspltisb */
9430
9431 // FIXME: parameter should be treated as 5-bit signed literal
9432 static __inline__ vector signed char __ATTRS_o_ai
9433 vec_vspltisb(signed char __a) {
9434   return (vector signed char)(__a);
9435 }
9436
9437 /* vec_splat_s16 */
9438
9439 #define __builtin_altivec_vspltish vec_splat_s16
9440
9441 // FIXME: parameter should be treated as 5-bit signed literal
9442 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
9443   return (vector short)(__a);
9444 }
9445
9446 /* vec_vspltish */
9447
9448 // FIXME: parameter should be treated as 5-bit signed literal
9449 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
9450   return (vector short)(__a);
9451 }
9452
9453 /* vec_splat_s32 */
9454
9455 #define __builtin_altivec_vspltisw vec_splat_s32
9456
9457 // FIXME: parameter should be treated as 5-bit signed literal
9458 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
9459   return (vector int)(__a);
9460 }
9461
9462 /* vec_vspltisw */
9463
9464 // FIXME: parameter should be treated as 5-bit signed literal
9465 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
9466   return (vector int)(__a);
9467 }
9468
9469 /* vec_splat_u8 */
9470
9471 // FIXME: parameter should be treated as 5-bit signed literal
9472 static __inline__ vector unsigned char __ATTRS_o_ai
9473 vec_splat_u8(unsigned char __a) {
9474   return (vector unsigned char)(__a);
9475 }
9476
9477 /* vec_splat_u16 */
9478
9479 // FIXME: parameter should be treated as 5-bit signed literal
9480 static __inline__ vector unsigned short __ATTRS_o_ai
9481 vec_splat_u16(signed char __a) {
9482   return (vector unsigned short)(__a);
9483 }
9484
9485 /* vec_splat_u32 */
9486
9487 // FIXME: parameter should be treated as 5-bit signed literal
9488 static __inline__ vector unsigned int __ATTRS_o_ai
9489 vec_splat_u32(signed char __a) {
9490   return (vector unsigned int)(__a);
9491 }
9492
9493 /* vec_sr */
9494
9495 static __inline__ vector signed char __ATTRS_o_ai
9496 vec_sr(vector signed char __a, vector unsigned char __b) {
9497   vector unsigned char __res = (vector unsigned char)__a >> __b;
9498   return (vector signed char)__res;
9499 }
9500
9501 static __inline__ vector unsigned char __ATTRS_o_ai
9502 vec_sr(vector unsigned char __a, vector unsigned char __b) {
9503   return __a >> __b;
9504 }
9505
9506 static __inline__ vector signed short __ATTRS_o_ai
9507 vec_sr(vector signed short __a, vector unsigned short __b) {
9508   vector unsigned short __res = (vector unsigned short)__a >> __b;
9509   return (vector signed short)__res;
9510 }
9511
9512 static __inline__ vector unsigned short __ATTRS_o_ai
9513 vec_sr(vector unsigned short __a, vector unsigned short __b) {
9514   return __a >> __b;
9515 }
9516
9517 static __inline__ vector signed int __ATTRS_o_ai
9518 vec_sr(vector signed int __a, vector unsigned int __b) {
9519   vector unsigned int __res = (vector unsigned int)__a >> __b;
9520   return (vector signed int)__res;
9521 }
9522
9523 static __inline__ vector unsigned int __ATTRS_o_ai
9524 vec_sr(vector unsigned int __a, vector unsigned int __b) {
9525   return __a >> __b;
9526 }
9527
9528 #ifdef __POWER8_VECTOR__
9529 static __inline__ vector signed long long __ATTRS_o_ai
9530 vec_sr(vector signed long long __a, vector unsigned long long __b) {
9531   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
9532   return (vector signed long long)__res;
9533 }
9534
9535 static __inline__ vector unsigned long long __ATTRS_o_ai
9536 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
9537   return __a >> __b;
9538 }
9539 #endif
9540
9541 /* vec_vsrb */
9542
9543 #define __builtin_altivec_vsrb vec_vsrb
9544
9545 static __inline__ vector signed char __ATTRS_o_ai
9546 vec_vsrb(vector signed char __a, vector unsigned char __b) {
9547   return __a >> (vector signed char)__b;
9548 }
9549
9550 static __inline__ vector unsigned char __ATTRS_o_ai
9551 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
9552   return __a >> __b;
9553 }
9554
9555 /* vec_vsrh */
9556
9557 #define __builtin_altivec_vsrh vec_vsrh
9558
9559 static __inline__ vector short __ATTRS_o_ai
9560 vec_vsrh(vector short __a, vector unsigned short __b) {
9561   return __a >> (vector short)__b;
9562 }
9563
9564 static __inline__ vector unsigned short __ATTRS_o_ai
9565 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
9566   return __a >> __b;
9567 }
9568
9569 /* vec_vsrw */
9570
9571 #define __builtin_altivec_vsrw vec_vsrw
9572
9573 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
9574                                                    vector unsigned int __b) {
9575   return __a >> (vector int)__b;
9576 }
9577
9578 static __inline__ vector unsigned int __ATTRS_o_ai
9579 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
9580   return __a >> __b;
9581 }
9582
9583 /* vec_sra */
9584
9585 static __inline__ vector signed char __ATTRS_o_ai
9586 vec_sra(vector signed char __a, vector unsigned char __b) {
9587   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9588 }
9589
9590 static __inline__ vector unsigned char __ATTRS_o_ai
9591 vec_sra(vector unsigned char __a, vector unsigned char __b) {
9592   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9593 }
9594
9595 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
9596                                                     vector unsigned short __b) {
9597   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9598 }
9599
9600 static __inline__ vector unsigned short __ATTRS_o_ai
9601 vec_sra(vector unsigned short __a, vector unsigned short __b) {
9602   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9603 }
9604
9605 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
9606                                                   vector unsigned int __b) {
9607   return __builtin_altivec_vsraw(__a, __b);
9608 }
9609
9610 static __inline__ vector unsigned int __ATTRS_o_ai
9611 vec_sra(vector unsigned int __a, vector unsigned int __b) {
9612   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9613 }
9614
9615 #ifdef __POWER8_VECTOR__
9616 static __inline__ vector signed long long __ATTRS_o_ai
9617 vec_sra(vector signed long long __a, vector unsigned long long __b) {
9618   return __a >> __b;
9619 }
9620
9621 static __inline__ vector unsigned long long __ATTRS_o_ai
9622 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
9623   return (vector unsigned long long)((vector signed long long)__a >> __b);
9624 }
9625 #endif
9626
9627 /* vec_vsrab */
9628
9629 static __inline__ vector signed char __ATTRS_o_ai
9630 vec_vsrab(vector signed char __a, vector unsigned char __b) {
9631   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
9632 }
9633
9634 static __inline__ vector unsigned char __ATTRS_o_ai
9635 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
9636   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
9637 }
9638
9639 /* vec_vsrah */
9640
9641 static __inline__ vector short __ATTRS_o_ai
9642 vec_vsrah(vector short __a, vector unsigned short __b) {
9643   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
9644 }
9645
9646 static __inline__ vector unsigned short __ATTRS_o_ai
9647 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
9648   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
9649 }
9650
9651 /* vec_vsraw */
9652
9653 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
9654                                                     vector unsigned int __b) {
9655   return __builtin_altivec_vsraw(__a, __b);
9656 }
9657
9658 static __inline__ vector unsigned int __ATTRS_o_ai
9659 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
9660   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
9661 }
9662
9663 /* vec_srl */
9664
9665 static __inline__ vector signed char __ATTRS_o_ai
9666 vec_srl(vector signed char __a, vector unsigned char __b) {
9667   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9668                                                    (vector int)__b);
9669 }
9670
9671 static __inline__ vector signed char __ATTRS_o_ai
9672 vec_srl(vector signed char __a, vector unsigned short __b) {
9673   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9674                                                    (vector int)__b);
9675 }
9676
9677 static __inline__ vector signed char __ATTRS_o_ai
9678 vec_srl(vector signed char __a, vector unsigned int __b) {
9679   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9680                                                    (vector int)__b);
9681 }
9682
9683 static __inline__ vector unsigned char __ATTRS_o_ai
9684 vec_srl(vector unsigned char __a, vector unsigned char __b) {
9685   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9686                                                      (vector int)__b);
9687 }
9688
9689 static __inline__ vector unsigned char __ATTRS_o_ai
9690 vec_srl(vector unsigned char __a, vector unsigned short __b) {
9691   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9692                                                      (vector int)__b);
9693 }
9694
9695 static __inline__ vector unsigned char __ATTRS_o_ai
9696 vec_srl(vector unsigned char __a, vector unsigned int __b) {
9697   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9698                                                      (vector int)__b);
9699 }
9700
9701 static __inline__ vector bool char __ATTRS_o_ai
9702 vec_srl(vector bool char __a, vector unsigned char __b) {
9703   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9704                                                  (vector int)__b);
9705 }
9706
9707 static __inline__ vector bool char __ATTRS_o_ai
9708 vec_srl(vector bool char __a, vector unsigned short __b) {
9709   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9710                                                  (vector int)__b);
9711 }
9712
9713 static __inline__ vector bool char __ATTRS_o_ai
9714 vec_srl(vector bool char __a, vector unsigned int __b) {
9715   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9716                                                  (vector int)__b);
9717 }
9718
9719 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9720                                                     vector unsigned char __b) {
9721   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9722 }
9723
9724 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9725                                                     vector unsigned short __b) {
9726   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9727 }
9728
9729 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
9730                                                     vector unsigned int __b) {
9731   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9732 }
9733
9734 static __inline__ vector unsigned short __ATTRS_o_ai
9735 vec_srl(vector unsigned short __a, vector unsigned char __b) {
9736   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9737                                                       (vector int)__b);
9738 }
9739
9740 static __inline__ vector unsigned short __ATTRS_o_ai
9741 vec_srl(vector unsigned short __a, vector unsigned short __b) {
9742   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9743                                                       (vector int)__b);
9744 }
9745
9746 static __inline__ vector unsigned short __ATTRS_o_ai
9747 vec_srl(vector unsigned short __a, vector unsigned int __b) {
9748   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9749                                                       (vector int)__b);
9750 }
9751
9752 static __inline__ vector bool short __ATTRS_o_ai
9753 vec_srl(vector bool short __a, vector unsigned char __b) {
9754   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9755                                                   (vector int)__b);
9756 }
9757
9758 static __inline__ vector bool short __ATTRS_o_ai
9759 vec_srl(vector bool short __a, vector unsigned short __b) {
9760   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9761                                                   (vector int)__b);
9762 }
9763
9764 static __inline__ vector bool short __ATTRS_o_ai
9765 vec_srl(vector bool short __a, vector unsigned int __b) {
9766   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9767                                                   (vector int)__b);
9768 }
9769
9770 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9771                                                     vector unsigned char __b) {
9772   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9773 }
9774
9775 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9776                                                     vector unsigned short __b) {
9777   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9778 }
9779
9780 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
9781                                                     vector unsigned int __b) {
9782   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9783 }
9784
9785 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9786                                                   vector unsigned char __b) {
9787   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9788 }
9789
9790 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9791                                                   vector unsigned short __b) {
9792   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9793 }
9794
9795 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
9796                                                   vector unsigned int __b) {
9797   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9798 }
9799
9800 static __inline__ vector unsigned int __ATTRS_o_ai
9801 vec_srl(vector unsigned int __a, vector unsigned char __b) {
9802   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9803                                                     (vector int)__b);
9804 }
9805
9806 static __inline__ vector unsigned int __ATTRS_o_ai
9807 vec_srl(vector unsigned int __a, vector unsigned short __b) {
9808   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9809                                                     (vector int)__b);
9810 }
9811
9812 static __inline__ vector unsigned int __ATTRS_o_ai
9813 vec_srl(vector unsigned int __a, vector unsigned int __b) {
9814   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9815                                                     (vector int)__b);
9816 }
9817
9818 static __inline__ vector bool int __ATTRS_o_ai
9819 vec_srl(vector bool int __a, vector unsigned char __b) {
9820   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9821                                                 (vector int)__b);
9822 }
9823
9824 static __inline__ vector bool int __ATTRS_o_ai
9825 vec_srl(vector bool int __a, vector unsigned short __b) {
9826   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9827                                                 (vector int)__b);
9828 }
9829
9830 static __inline__ vector bool int __ATTRS_o_ai
9831 vec_srl(vector bool int __a, vector unsigned int __b) {
9832   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
9833                                                 (vector int)__b);
9834 }
9835
9836 #ifdef __VSX__
9837 static __inline__ vector signed long long __ATTRS_o_ai
9838 vec_srl(vector signed long long __a, vector unsigned char __b) {
9839   return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
9840                                                         (vector int)__b);
9841 }
9842
9843 static __inline__ vector unsigned long long __ATTRS_o_ai
9844 vec_srl(vector unsigned long long __a, vector unsigned char __b) {
9845   return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
9846                                                           (vector int)__b);
9847 }
9848 #endif
9849
9850 /* vec_vsr */
9851
9852 static __inline__ vector signed char __ATTRS_o_ai
9853 vec_vsr(vector signed char __a, vector unsigned char __b) {
9854   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9855                                                    (vector int)__b);
9856 }
9857
9858 static __inline__ vector signed char __ATTRS_o_ai
9859 vec_vsr(vector signed char __a, vector unsigned short __b) {
9860   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9861                                                    (vector int)__b);
9862 }
9863
9864 static __inline__ vector signed char __ATTRS_o_ai
9865 vec_vsr(vector signed char __a, vector unsigned int __b) {
9866   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
9867                                                    (vector int)__b);
9868 }
9869
9870 static __inline__ vector unsigned char __ATTRS_o_ai
9871 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
9872   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9873                                                      (vector int)__b);
9874 }
9875
9876 static __inline__ vector unsigned char __ATTRS_o_ai
9877 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
9878   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9879                                                      (vector int)__b);
9880 }
9881
9882 static __inline__ vector unsigned char __ATTRS_o_ai
9883 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
9884   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
9885                                                      (vector int)__b);
9886 }
9887
9888 static __inline__ vector bool char __ATTRS_o_ai
9889 vec_vsr(vector bool char __a, vector unsigned char __b) {
9890   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9891                                                  (vector int)__b);
9892 }
9893
9894 static __inline__ vector bool char __ATTRS_o_ai
9895 vec_vsr(vector bool char __a, vector unsigned short __b) {
9896   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9897                                                  (vector int)__b);
9898 }
9899
9900 static __inline__ vector bool char __ATTRS_o_ai
9901 vec_vsr(vector bool char __a, vector unsigned int __b) {
9902   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
9903                                                  (vector int)__b);
9904 }
9905
9906 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9907                                                     vector unsigned char __b) {
9908   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9909 }
9910
9911 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9912                                                     vector unsigned short __b) {
9913   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9914 }
9915
9916 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
9917                                                     vector unsigned int __b) {
9918   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9919 }
9920
9921 static __inline__ vector unsigned short __ATTRS_o_ai
9922 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
9923   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9924                                                       (vector int)__b);
9925 }
9926
9927 static __inline__ vector unsigned short __ATTRS_o_ai
9928 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
9929   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9930                                                       (vector int)__b);
9931 }
9932
9933 static __inline__ vector unsigned short __ATTRS_o_ai
9934 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
9935   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
9936                                                       (vector int)__b);
9937 }
9938
9939 static __inline__ vector bool short __ATTRS_o_ai
9940 vec_vsr(vector bool short __a, vector unsigned char __b) {
9941   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9942                                                   (vector int)__b);
9943 }
9944
9945 static __inline__ vector bool short __ATTRS_o_ai
9946 vec_vsr(vector bool short __a, vector unsigned short __b) {
9947   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9948                                                   (vector int)__b);
9949 }
9950
9951 static __inline__ vector bool short __ATTRS_o_ai
9952 vec_vsr(vector bool short __a, vector unsigned int __b) {
9953   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
9954                                                   (vector int)__b);
9955 }
9956
9957 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9958                                                     vector unsigned char __b) {
9959   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9960 }
9961
9962 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9963                                                     vector unsigned short __b) {
9964   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9965 }
9966
9967 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
9968                                                     vector unsigned int __b) {
9969   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
9970 }
9971
9972 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9973                                                   vector unsigned char __b) {
9974   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9975 }
9976
9977 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9978                                                   vector unsigned short __b) {
9979   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9980 }
9981
9982 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
9983                                                   vector unsigned int __b) {
9984   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
9985 }
9986
9987 static __inline__ vector unsigned int __ATTRS_o_ai
9988 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
9989   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9990                                                     (vector int)__b);
9991 }
9992
9993 static __inline__ vector unsigned int __ATTRS_o_ai
9994 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
9995   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
9996                                                     (vector int)__b);
9997 }
9998
9999 static __inline__ vector unsigned int __ATTRS_o_ai
10000 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10001   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10002                                                     (vector int)__b);
10003 }
10004
10005 static __inline__ vector bool int __ATTRS_o_ai
10006 vec_vsr(vector bool int __a, vector unsigned char __b) {
10007   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10008                                                 (vector int)__b);
10009 }
10010
10011 static __inline__ vector bool int __ATTRS_o_ai
10012 vec_vsr(vector bool int __a, vector unsigned short __b) {
10013   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10014                                                 (vector int)__b);
10015 }
10016
10017 static __inline__ vector bool int __ATTRS_o_ai
10018 vec_vsr(vector bool int __a, vector unsigned int __b) {
10019   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10020                                                 (vector int)__b);
10021 }
10022
10023 /* vec_sro */
10024
10025 static __inline__ vector signed char __ATTRS_o_ai
10026 vec_sro(vector signed char __a, vector signed char __b) {
10027   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10028                                                     (vector int)__b);
10029 }
10030
10031 static __inline__ vector signed char __ATTRS_o_ai
10032 vec_sro(vector signed char __a, vector unsigned char __b) {
10033   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10034                                                     (vector int)__b);
10035 }
10036
10037 static __inline__ vector unsigned char __ATTRS_o_ai
10038 vec_sro(vector unsigned char __a, vector signed char __b) {
10039   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10040                                                       (vector int)__b);
10041 }
10042
10043 static __inline__ vector unsigned char __ATTRS_o_ai
10044 vec_sro(vector unsigned char __a, vector unsigned char __b) {
10045   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10046                                                       (vector int)__b);
10047 }
10048
10049 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10050                                                     vector signed char __b) {
10051   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10052 }
10053
10054 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
10055                                                     vector unsigned char __b) {
10056   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10057 }
10058
10059 static __inline__ vector unsigned short __ATTRS_o_ai
10060 vec_sro(vector unsigned short __a, vector signed char __b) {
10061   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10062                                                        (vector int)__b);
10063 }
10064
10065 static __inline__ vector unsigned short __ATTRS_o_ai
10066 vec_sro(vector unsigned short __a, vector unsigned char __b) {
10067   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10068                                                        (vector int)__b);
10069 }
10070
10071 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10072                                                     vector signed char __b) {
10073   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10074 }
10075
10076 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
10077                                                     vector unsigned char __b) {
10078   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10079 }
10080
10081 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10082                                                   vector signed char __b) {
10083   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10084 }
10085
10086 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
10087                                                   vector unsigned char __b) {
10088   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10089 }
10090
10091 static __inline__ vector unsigned int __ATTRS_o_ai
10092 vec_sro(vector unsigned int __a, vector signed char __b) {
10093   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10094                                                      (vector int)__b);
10095 }
10096
10097 static __inline__ vector unsigned int __ATTRS_o_ai
10098 vec_sro(vector unsigned int __a, vector unsigned char __b) {
10099   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10100                                                      (vector int)__b);
10101 }
10102
10103 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10104                                                     vector signed char __b) {
10105   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10106 }
10107
10108 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
10109                                                     vector unsigned char __b) {
10110   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10111 }
10112
10113 #ifdef __VSX__
10114 static __inline__ vector signed long long __ATTRS_o_ai
10115 vec_sro(vector signed long long __a, vector signed char __b) {
10116   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10117                                                          (vector int)__b);
10118 }
10119
10120 static __inline__ vector signed long long __ATTRS_o_ai
10121 vec_sro(vector signed long long __a, vector unsigned char __b) {
10122   return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
10123                                                          (vector int)__b);
10124 }
10125
10126 static __inline__ vector unsigned long long __ATTRS_o_ai
10127 vec_sro(vector unsigned long long __a, vector signed char __b) {
10128   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10129                                                            (vector int)__b);
10130 }
10131
10132 static __inline__ vector unsigned long long __ATTRS_o_ai
10133 vec_sro(vector unsigned long long __a, vector unsigned char __b) {
10134   return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
10135                                                            (vector int)__b);
10136 }
10137 #endif
10138
10139 /* vec_vsro */
10140
10141 static __inline__ vector signed char __ATTRS_o_ai
10142 vec_vsro(vector signed char __a, vector signed char __b) {
10143   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10144                                                     (vector int)__b);
10145 }
10146
10147 static __inline__ vector signed char __ATTRS_o_ai
10148 vec_vsro(vector signed char __a, vector unsigned char __b) {
10149   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10150                                                     (vector int)__b);
10151 }
10152
10153 static __inline__ vector unsigned char __ATTRS_o_ai
10154 vec_vsro(vector unsigned char __a, vector signed char __b) {
10155   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10156                                                       (vector int)__b);
10157 }
10158
10159 static __inline__ vector unsigned char __ATTRS_o_ai
10160 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
10161   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10162                                                       (vector int)__b);
10163 }
10164
10165 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10166                                                      vector signed char __b) {
10167   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10168 }
10169
10170 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
10171                                                      vector unsigned char __b) {
10172   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10173 }
10174
10175 static __inline__ vector unsigned short __ATTRS_o_ai
10176 vec_vsro(vector unsigned short __a, vector signed char __b) {
10177   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10178                                                        (vector int)__b);
10179 }
10180
10181 static __inline__ vector unsigned short __ATTRS_o_ai
10182 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
10183   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
10184                                                        (vector int)__b);
10185 }
10186
10187 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10188                                                      vector signed char __b) {
10189   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10190 }
10191
10192 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
10193                                                      vector unsigned char __b) {
10194   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10195 }
10196
10197 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10198                                                    vector signed char __b) {
10199   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10200 }
10201
10202 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
10203                                                    vector unsigned char __b) {
10204   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
10205 }
10206
10207 static __inline__ vector unsigned int __ATTRS_o_ai
10208 vec_vsro(vector unsigned int __a, vector signed char __b) {
10209   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10210                                                      (vector int)__b);
10211 }
10212
10213 static __inline__ vector unsigned int __ATTRS_o_ai
10214 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
10215   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
10216                                                      (vector int)__b);
10217 }
10218
10219 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10220                                                      vector signed char __b) {
10221   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10222 }
10223
10224 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
10225                                                      vector unsigned char __b) {
10226   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
10227 }
10228
10229 /* vec_st */
10230
10231 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10232                                            vector signed char *__c) {
10233   __builtin_altivec_stvx((vector int)__a, __b, __c);
10234 }
10235
10236 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
10237                                            signed char *__c) {
10238   __builtin_altivec_stvx((vector int)__a, __b, __c);
10239 }
10240
10241 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10242                                            vector unsigned char *__c) {
10243   __builtin_altivec_stvx((vector int)__a, __b, __c);
10244 }
10245
10246 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
10247                                            unsigned char *__c) {
10248   __builtin_altivec_stvx((vector int)__a, __b, __c);
10249 }
10250
10251 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10252                                            signed char *__c) {
10253   __builtin_altivec_stvx((vector int)__a, __b, __c);
10254 }
10255
10256 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10257                                            unsigned char *__c) {
10258   __builtin_altivec_stvx((vector int)__a, __b, __c);
10259 }
10260
10261 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
10262                                            vector bool char *__c) {
10263   __builtin_altivec_stvx((vector int)__a, __b, __c);
10264 }
10265
10266 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10267                                            vector short *__c) {
10268   __builtin_altivec_stvx((vector int)__a, __b, __c);
10269 }
10270
10271 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
10272                                            short *__c) {
10273   __builtin_altivec_stvx((vector int)__a, __b, __c);
10274 }
10275
10276 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10277                                            vector unsigned short *__c) {
10278   __builtin_altivec_stvx((vector int)__a, __b, __c);
10279 }
10280
10281 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
10282                                            unsigned short *__c) {
10283   __builtin_altivec_stvx((vector int)__a, __b, __c);
10284 }
10285
10286 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10287                                            short *__c) {
10288   __builtin_altivec_stvx((vector int)__a, __b, __c);
10289 }
10290
10291 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10292                                            unsigned short *__c) {
10293   __builtin_altivec_stvx((vector int)__a, __b, __c);
10294 }
10295
10296 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
10297                                            vector bool short *__c) {
10298   __builtin_altivec_stvx((vector int)__a, __b, __c);
10299 }
10300
10301 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10302                                            short *__c) {
10303   __builtin_altivec_stvx((vector int)__a, __b, __c);
10304 }
10305
10306 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10307                                            unsigned short *__c) {
10308   __builtin_altivec_stvx((vector int)__a, __b, __c);
10309 }
10310
10311 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
10312                                            vector pixel *__c) {
10313   __builtin_altivec_stvx((vector int)__a, __b, __c);
10314 }
10315
10316 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
10317                                            vector int *__c) {
10318   __builtin_altivec_stvx(__a, __b, __c);
10319 }
10320
10321 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
10322   __builtin_altivec_stvx(__a, __b, __c);
10323 }
10324
10325 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10326                                            vector unsigned int *__c) {
10327   __builtin_altivec_stvx((vector int)__a, __b, __c);
10328 }
10329
10330 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
10331                                            unsigned int *__c) {
10332   __builtin_altivec_stvx((vector int)__a, __b, __c);
10333 }
10334
10335 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10336                                            int *__c) {
10337   __builtin_altivec_stvx((vector int)__a, __b, __c);
10338 }
10339
10340 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10341                                            unsigned int *__c) {
10342   __builtin_altivec_stvx((vector int)__a, __b, __c);
10343 }
10344
10345 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
10346                                            vector bool int *__c) {
10347   __builtin_altivec_stvx((vector int)__a, __b, __c);
10348 }
10349
10350 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10351                                            vector float *__c) {
10352   __builtin_altivec_stvx((vector int)__a, __b, __c);
10353 }
10354
10355 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
10356                                            float *__c) {
10357   __builtin_altivec_stvx((vector int)__a, __b, __c);
10358 }
10359
10360 /* vec_stvx */
10361
10362 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10363                                              vector signed char *__c) {
10364   __builtin_altivec_stvx((vector int)__a, __b, __c);
10365 }
10366
10367 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
10368                                              signed char *__c) {
10369   __builtin_altivec_stvx((vector int)__a, __b, __c);
10370 }
10371
10372 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10373                                              vector unsigned char *__c) {
10374   __builtin_altivec_stvx((vector int)__a, __b, __c);
10375 }
10376
10377 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
10378                                              unsigned char *__c) {
10379   __builtin_altivec_stvx((vector int)__a, __b, __c);
10380 }
10381
10382 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10383                                              signed char *__c) {
10384   __builtin_altivec_stvx((vector int)__a, __b, __c);
10385 }
10386
10387 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10388                                              unsigned char *__c) {
10389   __builtin_altivec_stvx((vector int)__a, __b, __c);
10390 }
10391
10392 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
10393                                              vector bool char *__c) {
10394   __builtin_altivec_stvx((vector int)__a, __b, __c);
10395 }
10396
10397 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10398                                              vector short *__c) {
10399   __builtin_altivec_stvx((vector int)__a, __b, __c);
10400 }
10401
10402 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
10403                                              short *__c) {
10404   __builtin_altivec_stvx((vector int)__a, __b, __c);
10405 }
10406
10407 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10408                                              vector unsigned short *__c) {
10409   __builtin_altivec_stvx((vector int)__a, __b, __c);
10410 }
10411
10412 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
10413                                              unsigned short *__c) {
10414   __builtin_altivec_stvx((vector int)__a, __b, __c);
10415 }
10416
10417 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10418                                              short *__c) {
10419   __builtin_altivec_stvx((vector int)__a, __b, __c);
10420 }
10421
10422 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10423                                              unsigned short *__c) {
10424   __builtin_altivec_stvx((vector int)__a, __b, __c);
10425 }
10426
10427 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
10428                                              vector bool short *__c) {
10429   __builtin_altivec_stvx((vector int)__a, __b, __c);
10430 }
10431
10432 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10433                                              short *__c) {
10434   __builtin_altivec_stvx((vector int)__a, __b, __c);
10435 }
10436
10437 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10438                                              unsigned short *__c) {
10439   __builtin_altivec_stvx((vector int)__a, __b, __c);
10440 }
10441
10442 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
10443                                              vector pixel *__c) {
10444   __builtin_altivec_stvx((vector int)__a, __b, __c);
10445 }
10446
10447 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10448                                              vector int *__c) {
10449   __builtin_altivec_stvx(__a, __b, __c);
10450 }
10451
10452 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
10453                                              int *__c) {
10454   __builtin_altivec_stvx(__a, __b, __c);
10455 }
10456
10457 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10458                                              vector unsigned int *__c) {
10459   __builtin_altivec_stvx((vector int)__a, __b, __c);
10460 }
10461
10462 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
10463                                              unsigned int *__c) {
10464   __builtin_altivec_stvx((vector int)__a, __b, __c);
10465 }
10466
10467 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10468                                              int *__c) {
10469   __builtin_altivec_stvx((vector int)__a, __b, __c);
10470 }
10471
10472 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10473                                              unsigned int *__c) {
10474   __builtin_altivec_stvx((vector int)__a, __b, __c);
10475 }
10476
10477 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
10478                                              vector bool int *__c) {
10479   __builtin_altivec_stvx((vector int)__a, __b, __c);
10480 }
10481
10482 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10483                                              vector float *__c) {
10484   __builtin_altivec_stvx((vector int)__a, __b, __c);
10485 }
10486
10487 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
10488                                              float *__c) {
10489   __builtin_altivec_stvx((vector int)__a, __b, __c);
10490 }
10491
10492 /* vec_ste */
10493
10494 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
10495                                             signed char *__c) {
10496   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10497 }
10498
10499 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
10500                                             unsigned char *__c) {
10501   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10502 }
10503
10504 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10505                                             signed char *__c) {
10506   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10507 }
10508
10509 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
10510                                             unsigned char *__c) {
10511   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10512 }
10513
10514 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
10515                                             short *__c) {
10516   __builtin_altivec_stvehx(__a, __b, __c);
10517 }
10518
10519 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
10520                                             unsigned short *__c) {
10521   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10522 }
10523
10524 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10525                                             short *__c) {
10526   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10527 }
10528
10529 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
10530                                             unsigned short *__c) {
10531   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10532 }
10533
10534 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10535                                             short *__c) {
10536   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10537 }
10538
10539 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
10540                                             unsigned short *__c) {
10541   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10542 }
10543
10544 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
10545   __builtin_altivec_stvewx(__a, __b, __c);
10546 }
10547
10548 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
10549                                             unsigned int *__c) {
10550   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10551 }
10552
10553 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10554                                             int *__c) {
10555   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10556 }
10557
10558 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
10559                                             unsigned int *__c) {
10560   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10561 }
10562
10563 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
10564                                             float *__c) {
10565   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10566 }
10567
10568 /* vec_stvebx */
10569
10570 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
10571                                                signed char *__c) {
10572   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10573 }
10574
10575 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
10576                                                int __b, unsigned char *__c) {
10577   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10578 }
10579
10580 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10581                                                signed char *__c) {
10582   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10583 }
10584
10585 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
10586                                                unsigned char *__c) {
10587   __builtin_altivec_stvebx((vector char)__a, __b, __c);
10588 }
10589
10590 /* vec_stvehx */
10591
10592 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
10593                                                short *__c) {
10594   __builtin_altivec_stvehx(__a, __b, __c);
10595 }
10596
10597 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
10598                                                int __b, unsigned short *__c) {
10599   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10600 }
10601
10602 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10603                                                short *__c) {
10604   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10605 }
10606
10607 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
10608                                                unsigned short *__c) {
10609   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10610 }
10611
10612 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10613                                                short *__c) {
10614   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10615 }
10616
10617 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
10618                                                unsigned short *__c) {
10619   __builtin_altivec_stvehx((vector short)__a, __b, __c);
10620 }
10621
10622 /* vec_stvewx */
10623
10624 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
10625                                                int *__c) {
10626   __builtin_altivec_stvewx(__a, __b, __c);
10627 }
10628
10629 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
10630                                                unsigned int *__c) {
10631   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10632 }
10633
10634 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10635                                                int *__c) {
10636   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10637 }
10638
10639 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
10640                                                unsigned int *__c) {
10641   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10642 }
10643
10644 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
10645                                                float *__c) {
10646   __builtin_altivec_stvewx((vector int)__a, __b, __c);
10647 }
10648
10649 /* vec_stl */
10650
10651 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10652                                             vector signed char *__c) {
10653   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10654 }
10655
10656 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
10657                                             signed char *__c) {
10658   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10659 }
10660
10661 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10662                                             vector unsigned char *__c) {
10663   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10664 }
10665
10666 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
10667                                             unsigned char *__c) {
10668   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10669 }
10670
10671 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10672                                             signed char *__c) {
10673   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10674 }
10675
10676 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10677                                             unsigned char *__c) {
10678   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10679 }
10680
10681 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
10682                                             vector bool char *__c) {
10683   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10684 }
10685
10686 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10687                                             vector short *__c) {
10688   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10689 }
10690
10691 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
10692                                             short *__c) {
10693   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10694 }
10695
10696 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10697                                             vector unsigned short *__c) {
10698   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10699 }
10700
10701 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
10702                                             unsigned short *__c) {
10703   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10704 }
10705
10706 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10707                                             short *__c) {
10708   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10709 }
10710
10711 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10712                                             unsigned short *__c) {
10713   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10714 }
10715
10716 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
10717                                             vector bool short *__c) {
10718   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10719 }
10720
10721 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10722                                             short *__c) {
10723   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10724 }
10725
10726 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10727                                             unsigned short *__c) {
10728   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10729 }
10730
10731 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
10732                                             vector pixel *__c) {
10733   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10734 }
10735
10736 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
10737                                             vector int *__c) {
10738   __builtin_altivec_stvxl(__a, __b, __c);
10739 }
10740
10741 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
10742   __builtin_altivec_stvxl(__a, __b, __c);
10743 }
10744
10745 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10746                                             vector unsigned int *__c) {
10747   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10748 }
10749
10750 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
10751                                             unsigned int *__c) {
10752   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10753 }
10754
10755 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10756                                             int *__c) {
10757   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10758 }
10759
10760 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10761                                             unsigned int *__c) {
10762   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10763 }
10764
10765 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
10766                                             vector bool int *__c) {
10767   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10768 }
10769
10770 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10771                                             vector float *__c) {
10772   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10773 }
10774
10775 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
10776                                             float *__c) {
10777   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10778 }
10779
10780 /* vec_stvxl */
10781
10782 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10783                                               vector signed char *__c) {
10784   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10785 }
10786
10787 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
10788                                               signed char *__c) {
10789   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10790 }
10791
10792 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10793                                               vector unsigned char *__c) {
10794   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10795 }
10796
10797 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
10798                                               unsigned char *__c) {
10799   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10800 }
10801
10802 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10803                                               signed char *__c) {
10804   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10805 }
10806
10807 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10808                                               unsigned char *__c) {
10809   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10810 }
10811
10812 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
10813                                               vector bool char *__c) {
10814   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10815 }
10816
10817 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10818                                               vector short *__c) {
10819   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10820 }
10821
10822 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
10823                                               short *__c) {
10824   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10825 }
10826
10827 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10828                                               int __b,
10829                                               vector unsigned short *__c) {
10830   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10831 }
10832
10833 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
10834                                               int __b, unsigned short *__c) {
10835   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10836 }
10837
10838 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10839                                               short *__c) {
10840   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10841 }
10842
10843 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10844                                               unsigned short *__c) {
10845   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10846 }
10847
10848 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
10849                                               vector bool short *__c) {
10850   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10851 }
10852
10853 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10854                                               short *__c) {
10855   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10856 }
10857
10858 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10859                                               unsigned short *__c) {
10860   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10861 }
10862
10863 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
10864                                               vector pixel *__c) {
10865   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10866 }
10867
10868 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10869                                               vector int *__c) {
10870   __builtin_altivec_stvxl(__a, __b, __c);
10871 }
10872
10873 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
10874                                               int *__c) {
10875   __builtin_altivec_stvxl(__a, __b, __c);
10876 }
10877
10878 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10879                                               vector unsigned int *__c) {
10880   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10881 }
10882
10883 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
10884                                               unsigned int *__c) {
10885   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10886 }
10887
10888 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10889                                               int *__c) {
10890   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10891 }
10892
10893 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10894                                               unsigned int *__c) {
10895   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10896 }
10897
10898 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
10899                                               vector bool int *__c) {
10900   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10901 }
10902
10903 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10904                                               vector float *__c) {
10905   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10906 }
10907
10908 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
10909                                               float *__c) {
10910   __builtin_altivec_stvxl((vector int)__a, __b, __c);
10911 }
10912
10913 /* vec_sub */
10914
10915 static __inline__ vector signed char __ATTRS_o_ai
10916 vec_sub(vector signed char __a, vector signed char __b) {
10917   return __a - __b;
10918 }
10919
10920 static __inline__ vector signed char __ATTRS_o_ai
10921 vec_sub(vector bool char __a, vector signed char __b) {
10922   return (vector signed char)__a - __b;
10923 }
10924
10925 static __inline__ vector signed char __ATTRS_o_ai
10926 vec_sub(vector signed char __a, vector bool char __b) {
10927   return __a - (vector signed char)__b;
10928 }
10929
10930 static __inline__ vector unsigned char __ATTRS_o_ai
10931 vec_sub(vector unsigned char __a, vector unsigned char __b) {
10932   return __a - __b;
10933 }
10934
10935 static __inline__ vector unsigned char __ATTRS_o_ai
10936 vec_sub(vector bool char __a, vector unsigned char __b) {
10937   return (vector unsigned char)__a - __b;
10938 }
10939
10940 static __inline__ vector unsigned char __ATTRS_o_ai
10941 vec_sub(vector unsigned char __a, vector bool char __b) {
10942   return __a - (vector unsigned char)__b;
10943 }
10944
10945 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10946                                                     vector short __b) {
10947   return __a - __b;
10948 }
10949
10950 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
10951                                                     vector short __b) {
10952   return (vector short)__a - __b;
10953 }
10954
10955 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
10956                                                     vector bool short __b) {
10957   return __a - (vector short)__b;
10958 }
10959
10960 static __inline__ vector unsigned short __ATTRS_o_ai
10961 vec_sub(vector unsigned short __a, vector unsigned short __b) {
10962   return __a - __b;
10963 }
10964
10965 static __inline__ vector unsigned short __ATTRS_o_ai
10966 vec_sub(vector bool short __a, vector unsigned short __b) {
10967   return (vector unsigned short)__a - __b;
10968 }
10969
10970 static __inline__ vector unsigned short __ATTRS_o_ai
10971 vec_sub(vector unsigned short __a, vector bool short __b) {
10972   return __a - (vector unsigned short)__b;
10973 }
10974
10975 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10976                                                   vector int __b) {
10977   return __a - __b;
10978 }
10979
10980 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
10981                                                   vector int __b) {
10982   return (vector int)__a - __b;
10983 }
10984
10985 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
10986                                                   vector bool int __b) {
10987   return __a - (vector int)__b;
10988 }
10989
10990 static __inline__ vector unsigned int __ATTRS_o_ai
10991 vec_sub(vector unsigned int __a, vector unsigned int __b) {
10992   return __a - __b;
10993 }
10994
10995 static __inline__ vector unsigned int __ATTRS_o_ai
10996 vec_sub(vector bool int __a, vector unsigned int __b) {
10997   return (vector unsigned int)__a - __b;
10998 }
10999
11000 static __inline__ vector unsigned int __ATTRS_o_ai
11001 vec_sub(vector unsigned int __a, vector bool int __b) {
11002   return __a - (vector unsigned int)__b;
11003 }
11004
11005 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11006 static __inline__ vector signed __int128 __ATTRS_o_ai
11007 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11008   return __a - __b;
11009 }
11010
11011 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11012 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11013   return __a - __b;
11014 }
11015 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11016
11017 #ifdef __VSX__
11018 static __inline__ vector signed long long __ATTRS_o_ai
11019 vec_sub(vector signed long long __a, vector signed long long __b) {
11020   return __a - __b;
11021 }
11022
11023 static __inline__ vector unsigned long long __ATTRS_o_ai
11024 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11025   return __a - __b;
11026 }
11027
11028 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11029                                                      vector double __b) {
11030   return __a - __b;
11031 }
11032 #endif
11033
11034 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11035                                                     vector float __b) {
11036   return __a - __b;
11037 }
11038
11039 /* vec_vsububm */
11040
11041 #define __builtin_altivec_vsububm vec_vsububm
11042
11043 static __inline__ vector signed char __ATTRS_o_ai
11044 vec_vsububm(vector signed char __a, vector signed char __b) {
11045   return __a - __b;
11046 }
11047
11048 static __inline__ vector signed char __ATTRS_o_ai
11049 vec_vsububm(vector bool char __a, vector signed char __b) {
11050   return (vector signed char)__a - __b;
11051 }
11052
11053 static __inline__ vector signed char __ATTRS_o_ai
11054 vec_vsububm(vector signed char __a, vector bool char __b) {
11055   return __a - (vector signed char)__b;
11056 }
11057
11058 static __inline__ vector unsigned char __ATTRS_o_ai
11059 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
11060   return __a - __b;
11061 }
11062
11063 static __inline__ vector unsigned char __ATTRS_o_ai
11064 vec_vsububm(vector bool char __a, vector unsigned char __b) {
11065   return (vector unsigned char)__a - __b;
11066 }
11067
11068 static __inline__ vector unsigned char __ATTRS_o_ai
11069 vec_vsububm(vector unsigned char __a, vector bool char __b) {
11070   return __a - (vector unsigned char)__b;
11071 }
11072
11073 /* vec_vsubuhm */
11074
11075 #define __builtin_altivec_vsubuhm vec_vsubuhm
11076
11077 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11078                                                         vector short __b) {
11079   return __a - __b;
11080 }
11081
11082 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
11083                                                         vector short __b) {
11084   return (vector short)__a - __b;
11085 }
11086
11087 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
11088                                                         vector bool short __b) {
11089   return __a - (vector short)__b;
11090 }
11091
11092 static __inline__ vector unsigned short __ATTRS_o_ai
11093 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
11094   return __a - __b;
11095 }
11096
11097 static __inline__ vector unsigned short __ATTRS_o_ai
11098 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
11099   return (vector unsigned short)__a - __b;
11100 }
11101
11102 static __inline__ vector unsigned short __ATTRS_o_ai
11103 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
11104   return __a - (vector unsigned short)__b;
11105 }
11106
11107 /* vec_vsubuwm */
11108
11109 #define __builtin_altivec_vsubuwm vec_vsubuwm
11110
11111 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11112                                                       vector int __b) {
11113   return __a - __b;
11114 }
11115
11116 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
11117                                                       vector int __b) {
11118   return (vector int)__a - __b;
11119 }
11120
11121 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
11122                                                       vector bool int __b) {
11123   return __a - (vector int)__b;
11124 }
11125
11126 static __inline__ vector unsigned int __ATTRS_o_ai
11127 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
11128   return __a - __b;
11129 }
11130
11131 static __inline__ vector unsigned int __ATTRS_o_ai
11132 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
11133   return (vector unsigned int)__a - __b;
11134 }
11135
11136 static __inline__ vector unsigned int __ATTRS_o_ai
11137 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
11138   return __a - (vector unsigned int)__b;
11139 }
11140
11141 /* vec_vsubfp */
11142
11143 #define __builtin_altivec_vsubfp vec_vsubfp
11144
11145 static __inline__ vector float __attribute__((__always_inline__))
11146 vec_vsubfp(vector float __a, vector float __b) {
11147   return __a - __b;
11148 }
11149
11150 /* vec_subc */
11151
11152 static __inline__ vector signed int __ATTRS_o_ai
11153 vec_subc(vector signed int __a, vector signed int __b) {
11154   return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
11155                                                       (vector unsigned int) __b);
11156 }
11157
11158 static __inline__ vector unsigned int __ATTRS_o_ai
11159 vec_subc(vector unsigned int __a, vector unsigned int __b) {
11160   return __builtin_altivec_vsubcuw(__a, __b);
11161 }
11162
11163 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11164 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11165 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11166   return __builtin_altivec_vsubcuq(__a, __b);
11167 }
11168
11169 static __inline__ vector signed __int128 __ATTRS_o_ai
11170 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
11171   return __builtin_altivec_vsubcuq(__a, __b);
11172 }
11173 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11174
11175 /* vec_vsubcuw */
11176
11177 static __inline__ vector unsigned int __attribute__((__always_inline__))
11178 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
11179   return __builtin_altivec_vsubcuw(__a, __b);
11180 }
11181
11182 /* vec_subs */
11183
11184 static __inline__ vector signed char __ATTRS_o_ai
11185 vec_subs(vector signed char __a, vector signed char __b) {
11186   return __builtin_altivec_vsubsbs(__a, __b);
11187 }
11188
11189 static __inline__ vector signed char __ATTRS_o_ai
11190 vec_subs(vector bool char __a, vector signed char __b) {
11191   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11192 }
11193
11194 static __inline__ vector signed char __ATTRS_o_ai
11195 vec_subs(vector signed char __a, vector bool char __b) {
11196   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11197 }
11198
11199 static __inline__ vector unsigned char __ATTRS_o_ai
11200 vec_subs(vector unsigned char __a, vector unsigned char __b) {
11201   return __builtin_altivec_vsububs(__a, __b);
11202 }
11203
11204 static __inline__ vector unsigned char __ATTRS_o_ai
11205 vec_subs(vector bool char __a, vector unsigned char __b) {
11206   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11207 }
11208
11209 static __inline__ vector unsigned char __ATTRS_o_ai
11210 vec_subs(vector unsigned char __a, vector bool char __b) {
11211   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11212 }
11213
11214 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11215                                                      vector short __b) {
11216   return __builtin_altivec_vsubshs(__a, __b);
11217 }
11218
11219 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
11220                                                      vector short __b) {
11221   return __builtin_altivec_vsubshs((vector short)__a, __b);
11222 }
11223
11224 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
11225                                                      vector bool short __b) {
11226   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11227 }
11228
11229 static __inline__ vector unsigned short __ATTRS_o_ai
11230 vec_subs(vector unsigned short __a, vector unsigned short __b) {
11231   return __builtin_altivec_vsubuhs(__a, __b);
11232 }
11233
11234 static __inline__ vector unsigned short __ATTRS_o_ai
11235 vec_subs(vector bool short __a, vector unsigned short __b) {
11236   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11237 }
11238
11239 static __inline__ vector unsigned short __ATTRS_o_ai
11240 vec_subs(vector unsigned short __a, vector bool short __b) {
11241   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11242 }
11243
11244 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11245                                                    vector int __b) {
11246   return __builtin_altivec_vsubsws(__a, __b);
11247 }
11248
11249 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
11250                                                    vector int __b) {
11251   return __builtin_altivec_vsubsws((vector int)__a, __b);
11252 }
11253
11254 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
11255                                                    vector bool int __b) {
11256   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11257 }
11258
11259 static __inline__ vector unsigned int __ATTRS_o_ai
11260 vec_subs(vector unsigned int __a, vector unsigned int __b) {
11261   return __builtin_altivec_vsubuws(__a, __b);
11262 }
11263
11264 static __inline__ vector unsigned int __ATTRS_o_ai
11265 vec_subs(vector bool int __a, vector unsigned int __b) {
11266   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11267 }
11268
11269 static __inline__ vector unsigned int __ATTRS_o_ai
11270 vec_subs(vector unsigned int __a, vector bool int __b) {
11271   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11272 }
11273
11274 /* vec_vsubsbs */
11275
11276 static __inline__ vector signed char __ATTRS_o_ai
11277 vec_vsubsbs(vector signed char __a, vector signed char __b) {
11278   return __builtin_altivec_vsubsbs(__a, __b);
11279 }
11280
11281 static __inline__ vector signed char __ATTRS_o_ai
11282 vec_vsubsbs(vector bool char __a, vector signed char __b) {
11283   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
11284 }
11285
11286 static __inline__ vector signed char __ATTRS_o_ai
11287 vec_vsubsbs(vector signed char __a, vector bool char __b) {
11288   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
11289 }
11290
11291 /* vec_vsububs */
11292
11293 static __inline__ vector unsigned char __ATTRS_o_ai
11294 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
11295   return __builtin_altivec_vsububs(__a, __b);
11296 }
11297
11298 static __inline__ vector unsigned char __ATTRS_o_ai
11299 vec_vsububs(vector bool char __a, vector unsigned char __b) {
11300   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
11301 }
11302
11303 static __inline__ vector unsigned char __ATTRS_o_ai
11304 vec_vsububs(vector unsigned char __a, vector bool char __b) {
11305   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
11306 }
11307
11308 /* vec_vsubshs */
11309
11310 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11311                                                         vector short __b) {
11312   return __builtin_altivec_vsubshs(__a, __b);
11313 }
11314
11315 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
11316                                                         vector short __b) {
11317   return __builtin_altivec_vsubshs((vector short)__a, __b);
11318 }
11319
11320 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
11321                                                         vector bool short __b) {
11322   return __builtin_altivec_vsubshs(__a, (vector short)__b);
11323 }
11324
11325 /* vec_vsubuhs */
11326
11327 static __inline__ vector unsigned short __ATTRS_o_ai
11328 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
11329   return __builtin_altivec_vsubuhs(__a, __b);
11330 }
11331
11332 static __inline__ vector unsigned short __ATTRS_o_ai
11333 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
11334   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
11335 }
11336
11337 static __inline__ vector unsigned short __ATTRS_o_ai
11338 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
11339   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
11340 }
11341
11342 /* vec_vsubsws */
11343
11344 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11345                                                       vector int __b) {
11346   return __builtin_altivec_vsubsws(__a, __b);
11347 }
11348
11349 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
11350                                                       vector int __b) {
11351   return __builtin_altivec_vsubsws((vector int)__a, __b);
11352 }
11353
11354 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
11355                                                       vector bool int __b) {
11356   return __builtin_altivec_vsubsws(__a, (vector int)__b);
11357 }
11358
11359 /* vec_vsubuws */
11360
11361 static __inline__ vector unsigned int __ATTRS_o_ai
11362 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
11363   return __builtin_altivec_vsubuws(__a, __b);
11364 }
11365
11366 static __inline__ vector unsigned int __ATTRS_o_ai
11367 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
11368   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
11369 }
11370
11371 static __inline__ vector unsigned int __ATTRS_o_ai
11372 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
11373   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
11374 }
11375
11376 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11377 /* vec_vsubuqm */
11378
11379 static __inline__ vector signed __int128 __ATTRS_o_ai
11380 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
11381   return __a - __b;
11382 }
11383
11384 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11385 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11386   return __a - __b;
11387 }
11388
11389 /* vec_vsubeuqm */
11390
11391
11392 static __inline__ vector signed __int128 __ATTRS_o_ai
11393 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
11394              vector signed __int128 __c) {
11395   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11396 }
11397
11398 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11399 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
11400              vector unsigned __int128 __c) {
11401   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11402 }
11403
11404 static __inline__ vector signed __int128 __ATTRS_o_ai
11405 vec_sube(vector signed __int128 __a, vector signed __int128 __b,
11406              vector signed __int128 __c) {
11407   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11408 }
11409
11410 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11411 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
11412              vector unsigned __int128 __c) {
11413   return __builtin_altivec_vsubeuqm(__a, __b, __c);
11414 }
11415
11416 /* vec_vsubcuq */
11417
11418 static __inline__ vector signed __int128 __ATTRS_o_ai
11419 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
11420   return __builtin_altivec_vsubcuq(__a, __b);
11421 }
11422
11423 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11424 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11425   return __builtin_altivec_vsubcuq(__a, __b);
11426 }
11427
11428 /* vec_vsubecuq */
11429
11430 static __inline__ vector signed __int128 __ATTRS_o_ai
11431 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
11432              vector signed __int128 __c) {
11433   return __builtin_altivec_vsubecuq(__a, __b, __c);
11434 }
11435
11436 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11437 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
11438              vector unsigned __int128 __c) {
11439   return __builtin_altivec_vsubecuq(__a, __b, __c);
11440 }
11441
11442 static __inline__ vector signed int __ATTRS_o_ai
11443 vec_subec(vector signed int __a, vector signed int __b,
11444              vector signed int __c) {
11445   return vec_addec(__a, ~__b, __c);
11446 }
11447
11448 static __inline__ vector unsigned int __ATTRS_o_ai
11449 vec_subec(vector unsigned int __a, vector unsigned int __b,
11450              vector unsigned int __c) {
11451   return vec_addec(__a, ~__b, __c);
11452 }
11453
11454 static __inline__ vector signed __int128 __ATTRS_o_ai
11455 vec_subec(vector signed __int128 __a, vector signed __int128 __b,
11456              vector signed __int128 __c) {
11457   return __builtin_altivec_vsubecuq(__a, __b, __c);
11458 }
11459
11460 static __inline__ vector unsigned __int128 __ATTRS_o_ai
11461 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
11462              vector unsigned __int128 __c) {
11463   return __builtin_altivec_vsubecuq(__a, __b, __c);
11464 }
11465 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11466
11467 static __inline__ vector signed int __ATTRS_o_ai
11468 vec_sube(vector signed int __a, vector signed int __b,
11469          vector signed int __c) {
11470   vector signed int __mask = {1, 1, 1, 1};
11471   vector signed int __carry = __c & __mask;
11472   return vec_adde(__a, ~__b, __carry);
11473 }
11474
11475 static __inline__ vector unsigned int __ATTRS_o_ai
11476 vec_sube(vector unsigned int __a, vector unsigned int __b,
11477          vector unsigned int __c) {
11478   vector unsigned int __mask = {1, 1, 1, 1};
11479   vector unsigned int __carry = __c & __mask;
11480   return vec_adde(__a, ~__b, __carry);
11481 }
11482 /* vec_sum4s */
11483
11484 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
11485                                                     vector int __b) {
11486   return __builtin_altivec_vsum4sbs(__a, __b);
11487 }
11488
11489 static __inline__ vector unsigned int __ATTRS_o_ai
11490 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
11491   return __builtin_altivec_vsum4ubs(__a, __b);
11492 }
11493
11494 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
11495                                                     vector int __b) {
11496   return __builtin_altivec_vsum4shs(__a, __b);
11497 }
11498
11499 /* vec_vsum4sbs */
11500
11501 static __inline__ vector int __attribute__((__always_inline__))
11502 vec_vsum4sbs(vector signed char __a, vector int __b) {
11503   return __builtin_altivec_vsum4sbs(__a, __b);
11504 }
11505
11506 /* vec_vsum4ubs */
11507
11508 static __inline__ vector unsigned int __attribute__((__always_inline__))
11509 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
11510   return __builtin_altivec_vsum4ubs(__a, __b);
11511 }
11512
11513 /* vec_vsum4shs */
11514
11515 static __inline__ vector int __attribute__((__always_inline__))
11516 vec_vsum4shs(vector signed short __a, vector int __b) {
11517   return __builtin_altivec_vsum4shs(__a, __b);
11518 }
11519
11520 /* vec_sum2s */
11521
11522 /* The vsum2sws instruction has a big-endian bias, so that the second
11523    input vector and the result always reference big-endian elements
11524    1 and 3 (little-endian element 0 and 2).  For ease of porting the
11525    programmer wants elements 1 and 3 in both cases, so for little
11526    endian we must perform some permutes.  */
11527
11528 static __inline__ vector signed int __attribute__((__always_inline__))
11529 vec_sum2s(vector int __a, vector int __b) {
11530 #ifdef __LITTLE_ENDIAN__
11531   vector int __c = (vector signed int)vec_perm(
11532       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11533                                        8, 9, 10, 11));
11534   __c = __builtin_altivec_vsum2sws(__a, __c);
11535   return (vector signed int)vec_perm(
11536       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11537                                        8, 9, 10, 11));
11538 #else
11539   return __builtin_altivec_vsum2sws(__a, __b);
11540 #endif
11541 }
11542
11543 /* vec_vsum2sws */
11544
11545 static __inline__ vector signed int __attribute__((__always_inline__))
11546 vec_vsum2sws(vector int __a, vector int __b) {
11547 #ifdef __LITTLE_ENDIAN__
11548   vector int __c = (vector signed int)vec_perm(
11549       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11550                                        8, 9, 10, 11));
11551   __c = __builtin_altivec_vsum2sws(__a, __c);
11552   return (vector signed int)vec_perm(
11553       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
11554                                        8, 9, 10, 11));
11555 #else
11556   return __builtin_altivec_vsum2sws(__a, __b);
11557 #endif
11558 }
11559
11560 /* vec_sums */
11561
11562 /* The vsumsws instruction has a big-endian bias, so that the second
11563    input vector and the result always reference big-endian element 3
11564    (little-endian element 0).  For ease of porting the programmer
11565    wants element 3 in both cases, so for little endian we must perform
11566    some permutes.  */
11567
11568 static __inline__ vector signed int __attribute__((__always_inline__))
11569 vec_sums(vector signed int __a, vector signed int __b) {
11570 #ifdef __LITTLE_ENDIAN__
11571   __b = (vector signed int)vec_splat(__b, 3);
11572   __b = __builtin_altivec_vsumsws(__a, __b);
11573   return (vector signed int)(0, 0, 0, __b[0]);
11574 #else
11575   return __builtin_altivec_vsumsws(__a, __b);
11576 #endif
11577 }
11578
11579 /* vec_vsumsws */
11580
11581 static __inline__ vector signed int __attribute__((__always_inline__))
11582 vec_vsumsws(vector signed int __a, vector signed int __b) {
11583 #ifdef __LITTLE_ENDIAN__
11584   __b = (vector signed int)vec_splat(__b, 3);
11585   __b = __builtin_altivec_vsumsws(__a, __b);
11586   return (vector signed int)(0, 0, 0, __b[0]);
11587 #else
11588   return __builtin_altivec_vsumsws(__a, __b);
11589 #endif
11590 }
11591
11592 /* vec_trunc */
11593
11594 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
11595 #ifdef __VSX__
11596   return __builtin_vsx_xvrspiz(__a);
11597 #else
11598   return __builtin_altivec_vrfiz(__a);
11599 #endif
11600 }
11601
11602 #ifdef __VSX__
11603 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
11604   return __builtin_vsx_xvrdpiz(__a);
11605 }
11606 #endif
11607
11608 /* vec_vrfiz */
11609
11610 static __inline__ vector float __attribute__((__always_inline__))
11611 vec_vrfiz(vector float __a) {
11612   return __builtin_altivec_vrfiz(__a);
11613 }
11614
11615 /* vec_unpackh */
11616
11617 /* The vector unpack instructions all have a big-endian bias, so for
11618    little endian we must reverse the meanings of "high" and "low."  */
11619
11620 static __inline__ vector short __ATTRS_o_ai
11621 vec_unpackh(vector signed char __a) {
11622 #ifdef __LITTLE_ENDIAN__
11623   return __builtin_altivec_vupklsb((vector char)__a);
11624 #else
11625   return __builtin_altivec_vupkhsb((vector char)__a);
11626 #endif
11627 }
11628
11629 static __inline__ vector bool short __ATTRS_o_ai
11630 vec_unpackh(vector bool char __a) {
11631 #ifdef __LITTLE_ENDIAN__
11632   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11633 #else
11634   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11635 #endif
11636 }
11637
11638 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
11639 #ifdef __LITTLE_ENDIAN__
11640   return __builtin_altivec_vupklsh(__a);
11641 #else
11642   return __builtin_altivec_vupkhsh(__a);
11643 #endif
11644 }
11645
11646 static __inline__ vector bool int __ATTRS_o_ai
11647 vec_unpackh(vector bool short __a) {
11648 #ifdef __LITTLE_ENDIAN__
11649   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11650 #else
11651   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11652 #endif
11653 }
11654
11655 static __inline__ vector unsigned int __ATTRS_o_ai
11656 vec_unpackh(vector pixel __a) {
11657 #ifdef __LITTLE_ENDIAN__
11658   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11659 #else
11660   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11661 #endif
11662 }
11663
11664 #ifdef __POWER8_VECTOR__
11665 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
11666 #ifdef __LITTLE_ENDIAN__
11667   return __builtin_altivec_vupklsw(__a);
11668 #else
11669   return __builtin_altivec_vupkhsw(__a);
11670 #endif
11671 }
11672
11673 static __inline__ vector bool long long __ATTRS_o_ai
11674 vec_unpackh(vector bool int __a) {
11675 #ifdef __LITTLE_ENDIAN__
11676   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11677 #else
11678   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11679 #endif
11680 }
11681
11682 static __inline__ vector double __ATTRS_o_ai
11683 vec_unpackh(vector float __a) {
11684   return (vector double)(__a[0], __a[1]);
11685 }
11686 #endif
11687
11688 /* vec_vupkhsb */
11689
11690 static __inline__ vector short __ATTRS_o_ai
11691 vec_vupkhsb(vector signed char __a) {
11692 #ifdef __LITTLE_ENDIAN__
11693   return __builtin_altivec_vupklsb((vector char)__a);
11694 #else
11695   return __builtin_altivec_vupkhsb((vector char)__a);
11696 #endif
11697 }
11698
11699 static __inline__ vector bool short __ATTRS_o_ai
11700 vec_vupkhsb(vector bool char __a) {
11701 #ifdef __LITTLE_ENDIAN__
11702   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11703 #else
11704   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11705 #endif
11706 }
11707
11708 /* vec_vupkhsh */
11709
11710 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
11711 #ifdef __LITTLE_ENDIAN__
11712   return __builtin_altivec_vupklsh(__a);
11713 #else
11714   return __builtin_altivec_vupkhsh(__a);
11715 #endif
11716 }
11717
11718 static __inline__ vector bool int __ATTRS_o_ai
11719 vec_vupkhsh(vector bool short __a) {
11720 #ifdef __LITTLE_ENDIAN__
11721   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11722 #else
11723   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11724 #endif
11725 }
11726
11727 static __inline__ vector unsigned int __ATTRS_o_ai
11728 vec_vupkhsh(vector pixel __a) {
11729 #ifdef __LITTLE_ENDIAN__
11730   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11731 #else
11732   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11733 #endif
11734 }
11735
11736 /* vec_vupkhsw */
11737
11738 #ifdef __POWER8_VECTOR__
11739 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
11740 #ifdef __LITTLE_ENDIAN__
11741   return __builtin_altivec_vupklsw(__a);
11742 #else
11743   return __builtin_altivec_vupkhsw(__a);
11744 #endif
11745 }
11746
11747 static __inline__ vector bool long long __ATTRS_o_ai
11748 vec_vupkhsw(vector bool int __a) {
11749 #ifdef __LITTLE_ENDIAN__
11750   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11751 #else
11752   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11753 #endif
11754 }
11755 #endif
11756
11757 /* vec_unpackl */
11758
11759 static __inline__ vector short __ATTRS_o_ai
11760 vec_unpackl(vector signed char __a) {
11761 #ifdef __LITTLE_ENDIAN__
11762   return __builtin_altivec_vupkhsb((vector char)__a);
11763 #else
11764   return __builtin_altivec_vupklsb((vector char)__a);
11765 #endif
11766 }
11767
11768 static __inline__ vector bool short __ATTRS_o_ai
11769 vec_unpackl(vector bool char __a) {
11770 #ifdef __LITTLE_ENDIAN__
11771   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11772 #else
11773   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11774 #endif
11775 }
11776
11777 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
11778 #ifdef __LITTLE_ENDIAN__
11779   return __builtin_altivec_vupkhsh(__a);
11780 #else
11781   return __builtin_altivec_vupklsh(__a);
11782 #endif
11783 }
11784
11785 static __inline__ vector bool int __ATTRS_o_ai
11786 vec_unpackl(vector bool short __a) {
11787 #ifdef __LITTLE_ENDIAN__
11788   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11789 #else
11790   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11791 #endif
11792 }
11793
11794 static __inline__ vector unsigned int __ATTRS_o_ai
11795 vec_unpackl(vector pixel __a) {
11796 #ifdef __LITTLE_ENDIAN__
11797   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11798 #else
11799   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11800 #endif
11801 }
11802
11803 #ifdef __POWER8_VECTOR__
11804 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
11805 #ifdef __LITTLE_ENDIAN__
11806   return __builtin_altivec_vupkhsw(__a);
11807 #else
11808   return __builtin_altivec_vupklsw(__a);
11809 #endif
11810 }
11811
11812 static __inline__ vector bool long long __ATTRS_o_ai
11813 vec_unpackl(vector bool int __a) {
11814 #ifdef __LITTLE_ENDIAN__
11815   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11816 #else
11817   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11818 #endif
11819 }
11820
11821 static __inline__ vector double __ATTRS_o_ai
11822 vec_unpackl(vector float __a) {
11823   return (vector double)(__a[2], __a[3]);
11824 }
11825 #endif
11826
11827 /* vec_vupklsb */
11828
11829 static __inline__ vector short __ATTRS_o_ai
11830 vec_vupklsb(vector signed char __a) {
11831 #ifdef __LITTLE_ENDIAN__
11832   return __builtin_altivec_vupkhsb((vector char)__a);
11833 #else
11834   return __builtin_altivec_vupklsb((vector char)__a);
11835 #endif
11836 }
11837
11838 static __inline__ vector bool short __ATTRS_o_ai
11839 vec_vupklsb(vector bool char __a) {
11840 #ifdef __LITTLE_ENDIAN__
11841   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
11842 #else
11843   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
11844 #endif
11845 }
11846
11847 /* vec_vupklsh */
11848
11849 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
11850 #ifdef __LITTLE_ENDIAN__
11851   return __builtin_altivec_vupkhsh(__a);
11852 #else
11853   return __builtin_altivec_vupklsh(__a);
11854 #endif
11855 }
11856
11857 static __inline__ vector bool int __ATTRS_o_ai
11858 vec_vupklsh(vector bool short __a) {
11859 #ifdef __LITTLE_ENDIAN__
11860   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
11861 #else
11862   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
11863 #endif
11864 }
11865
11866 static __inline__ vector unsigned int __ATTRS_o_ai
11867 vec_vupklsh(vector pixel __a) {
11868 #ifdef __LITTLE_ENDIAN__
11869   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
11870 #else
11871   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
11872 #endif
11873 }
11874
11875 /* vec_vupklsw */
11876
11877 #ifdef __POWER8_VECTOR__
11878 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
11879 #ifdef __LITTLE_ENDIAN__
11880   return __builtin_altivec_vupkhsw(__a);
11881 #else
11882   return __builtin_altivec_vupklsw(__a);
11883 #endif
11884 }
11885
11886 static __inline__ vector bool long long __ATTRS_o_ai
11887 vec_vupklsw(vector bool int __a) {
11888 #ifdef __LITTLE_ENDIAN__
11889   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
11890 #else
11891   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
11892 #endif
11893 }
11894 #endif
11895
11896 /* vec_vsx_ld */
11897
11898 #ifdef __VSX__
11899
11900 static __inline__ vector bool int __ATTRS_o_ai
11901 vec_vsx_ld(int __a, const vector bool int *__b) {
11902   return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
11903 }
11904
11905 static __inline__ vector signed int __ATTRS_o_ai
11906 vec_vsx_ld(int __a, const vector signed int *__b) {
11907   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11908 }
11909
11910 static __inline__ vector signed int __ATTRS_o_ai
11911 vec_vsx_ld(int __a, const signed int *__b) {
11912   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
11913 }
11914
11915 static __inline__ vector unsigned int __ATTRS_o_ai
11916 vec_vsx_ld(int __a, const vector unsigned int *__b) {
11917   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11918 }
11919
11920 static __inline__ vector unsigned int __ATTRS_o_ai
11921 vec_vsx_ld(int __a, const unsigned int *__b) {
11922   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
11923 }
11924
11925 static __inline__ vector float __ATTRS_o_ai
11926 vec_vsx_ld(int __a, const vector float *__b) {
11927   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11928 }
11929
11930 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
11931                                                        const float *__b) {
11932   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
11933 }
11934
11935 static __inline__ vector signed long long __ATTRS_o_ai
11936 vec_vsx_ld(int __a, const vector signed long long *__b) {
11937   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
11938 }
11939
11940 static __inline__ vector unsigned long long __ATTRS_o_ai
11941 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
11942   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
11943 }
11944
11945 static __inline__ vector double __ATTRS_o_ai
11946 vec_vsx_ld(int __a, const vector double *__b) {
11947   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11948 }
11949
11950 static __inline__ vector double __ATTRS_o_ai
11951 vec_vsx_ld(int __a, const double *__b) {
11952   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
11953 }
11954
11955 static __inline__ vector bool short __ATTRS_o_ai
11956 vec_vsx_ld(int __a, const vector bool short *__b) {
11957   return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
11958 }
11959
11960 static __inline__ vector signed short __ATTRS_o_ai
11961 vec_vsx_ld(int __a, const vector signed short *__b) {
11962   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11963 }
11964
11965 static __inline__ vector signed short __ATTRS_o_ai
11966 vec_vsx_ld(int __a, const signed short *__b) {
11967   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
11968 }
11969
11970 static __inline__ vector unsigned short __ATTRS_o_ai
11971 vec_vsx_ld(int __a, const vector unsigned short *__b) {
11972   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11973 }
11974
11975 static __inline__ vector unsigned short __ATTRS_o_ai
11976 vec_vsx_ld(int __a, const unsigned short *__b) {
11977   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
11978 }
11979
11980 static __inline__ vector bool char __ATTRS_o_ai
11981 vec_vsx_ld(int __a, const vector bool char *__b) {
11982   return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
11983 }
11984
11985 static __inline__ vector signed char __ATTRS_o_ai
11986 vec_vsx_ld(int __a, const vector signed char *__b) {
11987   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11988 }
11989
11990 static __inline__ vector signed char __ATTRS_o_ai
11991 vec_vsx_ld(int __a, const signed char *__b) {
11992   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
11993 }
11994
11995 static __inline__ vector unsigned char __ATTRS_o_ai
11996 vec_vsx_ld(int __a, const vector unsigned char *__b) {
11997   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
11998 }
11999
12000 static __inline__ vector unsigned char __ATTRS_o_ai
12001 vec_vsx_ld(int __a, const unsigned char *__b) {
12002   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
12003 }
12004
12005 #endif
12006
12007 /* vec_vsx_st */
12008
12009 #ifdef __VSX__
12010
12011 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12012                                                vector bool int *__c) {
12013   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12014 }
12015
12016 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12017                                                signed int *__c) {
12018   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12019 }
12020
12021 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
12022                                                unsigned int *__c) {
12023   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12024 }
12025
12026 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12027                                                vector signed int *__c) {
12028   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12029 }
12030
12031 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
12032                                                signed int *__c) {
12033   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12034 }
12035
12036 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12037                                                vector unsigned int *__c) {
12038   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12039 }
12040
12041 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
12042                                                unsigned int *__c) {
12043   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12044 }
12045
12046 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12047                                                vector float *__c) {
12048   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12049 }
12050
12051 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
12052                                                float *__c) {
12053   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12054 }
12055
12056 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
12057                                                int __b,
12058                                                vector signed long long *__c) {
12059   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12060 }
12061
12062 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
12063                                                int __b,
12064                                                vector unsigned long long *__c) {
12065   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12066 }
12067
12068 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12069                                                vector double *__c) {
12070   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12071 }
12072
12073 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
12074                                                double *__c) {
12075   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
12076 }
12077
12078 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12079                                                vector bool short *__c) {
12080   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12081 }
12082
12083 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12084                                                signed short *__c) {
12085   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12086 }
12087
12088 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
12089                                                unsigned short *__c) {
12090   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12091 }
12092 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12093                                                vector signed short *__c) {
12094   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12095 }
12096
12097 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
12098                                                signed short *__c) {
12099   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12100 }
12101
12102 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12103                                                int __b,
12104                                                vector unsigned short *__c) {
12105   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12106 }
12107
12108 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
12109                                                int __b, unsigned short *__c) {
12110   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12111 }
12112
12113 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12114                                                vector bool char *__c) {
12115   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12116 }
12117
12118 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12119                                                signed char *__c) {
12120   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12121 }
12122
12123 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
12124                                                unsigned char *__c) {
12125   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12126 }
12127
12128 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12129                                                vector signed char *__c) {
12130   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12131 }
12132
12133 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
12134                                                signed char *__c) {
12135   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12136 }
12137
12138 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12139                                                int __b,
12140                                                vector unsigned char *__c) {
12141   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12142 }
12143
12144 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
12145                                                int __b, unsigned char *__c) {
12146   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
12147 }
12148
12149 #endif
12150
12151 /* vec_xor */
12152
12153 #define __builtin_altivec_vxor vec_xor
12154
12155 static __inline__ vector signed char __ATTRS_o_ai
12156 vec_xor(vector signed char __a, vector signed char __b) {
12157   return __a ^ __b;
12158 }
12159
12160 static __inline__ vector signed char __ATTRS_o_ai
12161 vec_xor(vector bool char __a, vector signed char __b) {
12162   return (vector signed char)__a ^ __b;
12163 }
12164
12165 static __inline__ vector signed char __ATTRS_o_ai
12166 vec_xor(vector signed char __a, vector bool char __b) {
12167   return __a ^ (vector signed char)__b;
12168 }
12169
12170 static __inline__ vector unsigned char __ATTRS_o_ai
12171 vec_xor(vector unsigned char __a, vector unsigned char __b) {
12172   return __a ^ __b;
12173 }
12174
12175 static __inline__ vector unsigned char __ATTRS_o_ai
12176 vec_xor(vector bool char __a, vector unsigned char __b) {
12177   return (vector unsigned char)__a ^ __b;
12178 }
12179
12180 static __inline__ vector unsigned char __ATTRS_o_ai
12181 vec_xor(vector unsigned char __a, vector bool char __b) {
12182   return __a ^ (vector unsigned char)__b;
12183 }
12184
12185 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
12186                                                         vector bool char __b) {
12187   return __a ^ __b;
12188 }
12189
12190 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12191                                                     vector short __b) {
12192   return __a ^ __b;
12193 }
12194
12195 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
12196                                                     vector short __b) {
12197   return (vector short)__a ^ __b;
12198 }
12199
12200 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
12201                                                     vector bool short __b) {
12202   return __a ^ (vector short)__b;
12203 }
12204
12205 static __inline__ vector unsigned short __ATTRS_o_ai
12206 vec_xor(vector unsigned short __a, vector unsigned short __b) {
12207   return __a ^ __b;
12208 }
12209
12210 static __inline__ vector unsigned short __ATTRS_o_ai
12211 vec_xor(vector bool short __a, vector unsigned short __b) {
12212   return (vector unsigned short)__a ^ __b;
12213 }
12214
12215 static __inline__ vector unsigned short __ATTRS_o_ai
12216 vec_xor(vector unsigned short __a, vector bool short __b) {
12217   return __a ^ (vector unsigned short)__b;
12218 }
12219
12220 static __inline__ vector bool short __ATTRS_o_ai
12221 vec_xor(vector bool short __a, vector bool short __b) {
12222   return __a ^ __b;
12223 }
12224
12225 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12226                                                   vector int __b) {
12227   return __a ^ __b;
12228 }
12229
12230 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
12231                                                   vector int __b) {
12232   return (vector int)__a ^ __b;
12233 }
12234
12235 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
12236                                                   vector bool int __b) {
12237   return __a ^ (vector int)__b;
12238 }
12239
12240 static __inline__ vector unsigned int __ATTRS_o_ai
12241 vec_xor(vector unsigned int __a, vector unsigned int __b) {
12242   return __a ^ __b;
12243 }
12244
12245 static __inline__ vector unsigned int __ATTRS_o_ai
12246 vec_xor(vector bool int __a, vector unsigned int __b) {
12247   return (vector unsigned int)__a ^ __b;
12248 }
12249
12250 static __inline__ vector unsigned int __ATTRS_o_ai
12251 vec_xor(vector unsigned int __a, vector bool int __b) {
12252   return __a ^ (vector unsigned int)__b;
12253 }
12254
12255 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
12256                                                        vector bool int __b) {
12257   return __a ^ __b;
12258 }
12259
12260 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12261                                                     vector float __b) {
12262   vector unsigned int __res =
12263       (vector unsigned int)__a ^ (vector unsigned int)__b;
12264   return (vector float)__res;
12265 }
12266
12267 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
12268                                                     vector float __b) {
12269   vector unsigned int __res =
12270       (vector unsigned int)__a ^ (vector unsigned int)__b;
12271   return (vector float)__res;
12272 }
12273
12274 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
12275                                                     vector bool int __b) {
12276   vector unsigned int __res =
12277       (vector unsigned int)__a ^ (vector unsigned int)__b;
12278   return (vector float)__res;
12279 }
12280
12281 #ifdef __VSX__
12282 static __inline__ vector signed long long __ATTRS_o_ai
12283 vec_xor(vector signed long long __a, vector signed long long __b) {
12284   return __a ^ __b;
12285 }
12286
12287 static __inline__ vector signed long long __ATTRS_o_ai
12288 vec_xor(vector bool long long __a, vector signed long long __b) {
12289   return (vector signed long long)__a ^ __b;
12290 }
12291
12292 static __inline__ vector signed long long __ATTRS_o_ai
12293 vec_xor(vector signed long long __a, vector bool long long __b) {
12294   return __a ^ (vector signed long long)__b;
12295 }
12296
12297 static __inline__ vector unsigned long long __ATTRS_o_ai
12298 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
12299   return __a ^ __b;
12300 }
12301
12302 static __inline__ vector unsigned long long __ATTRS_o_ai
12303 vec_xor(vector bool long long __a, vector unsigned long long __b) {
12304   return (vector unsigned long long)__a ^ __b;
12305 }
12306
12307 static __inline__ vector unsigned long long __ATTRS_o_ai
12308 vec_xor(vector unsigned long long __a, vector bool long long __b) {
12309   return __a ^ (vector unsigned long long)__b;
12310 }
12311
12312 static __inline__ vector bool long long __ATTRS_o_ai
12313 vec_xor(vector bool long long __a, vector bool long long __b) {
12314   return __a ^ __b;
12315 }
12316
12317 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
12318                                                      vector double __b) {
12319   return (vector double)((vector unsigned long long)__a ^
12320                          (vector unsigned long long)__b);
12321 }
12322
12323 static __inline__ vector double __ATTRS_o_ai
12324 vec_xor(vector double __a, vector bool long long __b) {
12325   return (vector double)((vector unsigned long long)__a ^
12326                          (vector unsigned long long)__b);
12327 }
12328
12329 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
12330                                                      vector double __b) {
12331   return (vector double)((vector unsigned long long)__a ^
12332                          (vector unsigned long long)__b);
12333 }
12334 #endif
12335
12336 /* vec_vxor */
12337
12338 static __inline__ vector signed char __ATTRS_o_ai
12339 vec_vxor(vector signed char __a, vector signed char __b) {
12340   return __a ^ __b;
12341 }
12342
12343 static __inline__ vector signed char __ATTRS_o_ai
12344 vec_vxor(vector bool char __a, vector signed char __b) {
12345   return (vector signed char)__a ^ __b;
12346 }
12347
12348 static __inline__ vector signed char __ATTRS_o_ai
12349 vec_vxor(vector signed char __a, vector bool char __b) {
12350   return __a ^ (vector signed char)__b;
12351 }
12352
12353 static __inline__ vector unsigned char __ATTRS_o_ai
12354 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
12355   return __a ^ __b;
12356 }
12357
12358 static __inline__ vector unsigned char __ATTRS_o_ai
12359 vec_vxor(vector bool char __a, vector unsigned char __b) {
12360   return (vector unsigned char)__a ^ __b;
12361 }
12362
12363 static __inline__ vector unsigned char __ATTRS_o_ai
12364 vec_vxor(vector unsigned char __a, vector bool char __b) {
12365   return __a ^ (vector unsigned char)__b;
12366 }
12367
12368 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
12369                                                          vector bool char __b) {
12370   return __a ^ __b;
12371 }
12372
12373 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12374                                                      vector short __b) {
12375   return __a ^ __b;
12376 }
12377
12378 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
12379                                                      vector short __b) {
12380   return (vector short)__a ^ __b;
12381 }
12382
12383 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
12384                                                      vector bool short __b) {
12385   return __a ^ (vector short)__b;
12386 }
12387
12388 static __inline__ vector unsigned short __ATTRS_o_ai
12389 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
12390   return __a ^ __b;
12391 }
12392
12393 static __inline__ vector unsigned short __ATTRS_o_ai
12394 vec_vxor(vector bool short __a, vector unsigned short __b) {
12395   return (vector unsigned short)__a ^ __b;
12396 }
12397
12398 static __inline__ vector unsigned short __ATTRS_o_ai
12399 vec_vxor(vector unsigned short __a, vector bool short __b) {
12400   return __a ^ (vector unsigned short)__b;
12401 }
12402
12403 static __inline__ vector bool short __ATTRS_o_ai
12404 vec_vxor(vector bool short __a, vector bool short __b) {
12405   return __a ^ __b;
12406 }
12407
12408 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12409                                                    vector int __b) {
12410   return __a ^ __b;
12411 }
12412
12413 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
12414                                                    vector int __b) {
12415   return (vector int)__a ^ __b;
12416 }
12417
12418 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
12419                                                    vector bool int __b) {
12420   return __a ^ (vector int)__b;
12421 }
12422
12423 static __inline__ vector unsigned int __ATTRS_o_ai
12424 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
12425   return __a ^ __b;
12426 }
12427
12428 static __inline__ vector unsigned int __ATTRS_o_ai
12429 vec_vxor(vector bool int __a, vector unsigned int __b) {
12430   return (vector unsigned int)__a ^ __b;
12431 }
12432
12433 static __inline__ vector unsigned int __ATTRS_o_ai
12434 vec_vxor(vector unsigned int __a, vector bool int __b) {
12435   return __a ^ (vector unsigned int)__b;
12436 }
12437
12438 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
12439                                                         vector bool int __b) {
12440   return __a ^ __b;
12441 }
12442
12443 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12444                                                      vector float __b) {
12445   vector unsigned int __res =
12446       (vector unsigned int)__a ^ (vector unsigned int)__b;
12447   return (vector float)__res;
12448 }
12449
12450 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
12451                                                      vector float __b) {
12452   vector unsigned int __res =
12453       (vector unsigned int)__a ^ (vector unsigned int)__b;
12454   return (vector float)__res;
12455 }
12456
12457 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
12458                                                      vector bool int __b) {
12459   vector unsigned int __res =
12460       (vector unsigned int)__a ^ (vector unsigned int)__b;
12461   return (vector float)__res;
12462 }
12463
12464 #ifdef __VSX__
12465 static __inline__ vector signed long long __ATTRS_o_ai
12466 vec_vxor(vector signed long long __a, vector signed long long __b) {
12467   return __a ^ __b;
12468 }
12469
12470 static __inline__ vector signed long long __ATTRS_o_ai
12471 vec_vxor(vector bool long long __a, vector signed long long __b) {
12472   return (vector signed long long)__a ^ __b;
12473 }
12474
12475 static __inline__ vector signed long long __ATTRS_o_ai
12476 vec_vxor(vector signed long long __a, vector bool long long __b) {
12477   return __a ^ (vector signed long long)__b;
12478 }
12479
12480 static __inline__ vector unsigned long long __ATTRS_o_ai
12481 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
12482   return __a ^ __b;
12483 }
12484
12485 static __inline__ vector unsigned long long __ATTRS_o_ai
12486 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
12487   return (vector unsigned long long)__a ^ __b;
12488 }
12489
12490 static __inline__ vector unsigned long long __ATTRS_o_ai
12491 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
12492   return __a ^ (vector unsigned long long)__b;
12493 }
12494
12495 static __inline__ vector bool long long __ATTRS_o_ai
12496 vec_vxor(vector bool long long __a, vector bool long long __b) {
12497   return __a ^ __b;
12498 }
12499 #endif
12500
12501 /* ------------------------ extensions for CBEA ----------------------------- */
12502
12503 /* vec_extract */
12504
12505 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
12506                                                        int __b) {
12507   return __a[__b];
12508 }
12509
12510 static __inline__ unsigned char __ATTRS_o_ai
12511 vec_extract(vector unsigned char __a, int __b) {
12512   return __a[__b];
12513 }
12514
12515 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
12516                                                          int __b) {
12517   return __a[__b];
12518 }
12519
12520 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
12521                                                         int __b) {
12522   return __a[__b];
12523 }
12524
12525 static __inline__ unsigned short __ATTRS_o_ai
12526 vec_extract(vector unsigned short __a, int __b) {
12527   return __a[__b];
12528 }
12529
12530 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
12531                                                           int __b) {
12532   return __a[__b];
12533 }
12534
12535 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
12536                                                       int __b) {
12537   return __a[__b];
12538 }
12539
12540 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
12541                                                         int __b) {
12542   return __a[__b];
12543 }
12544
12545 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
12546                                                         int __b) {
12547   return __a[__b];
12548 }
12549
12550 #ifdef __VSX__
12551 static __inline__ signed long long __ATTRS_o_ai
12552 vec_extract(vector signed long long __a, int __b) {
12553   return __a[__b];
12554 }
12555
12556 static __inline__ unsigned long long __ATTRS_o_ai
12557 vec_extract(vector unsigned long long __a, int __b) {
12558   return __a[__b];
12559 }
12560
12561 static __inline__ unsigned long long __ATTRS_o_ai
12562 vec_extract(vector bool long long __a, int __b) {
12563   return __a[__b];
12564 }
12565
12566 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
12567   return __a[__b];
12568 }
12569 #endif
12570
12571 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
12572   return __a[__b];
12573 }
12574
12575 #ifdef __POWER9_VECTOR__
12576
12577 #define vec_insert4b __builtin_vsx_insertword
12578 #define vec_extract4b __builtin_vsx_extractuword
12579
12580 /* vec_extract_exp */
12581
12582 static __inline__ vector unsigned int __ATTRS_o_ai
12583 vec_extract_exp(vector float __a) {
12584   return __builtin_vsx_xvxexpsp(__a);
12585 }
12586
12587 static __inline__ vector unsigned long long __ATTRS_o_ai
12588 vec_extract_exp(vector double __a) {
12589   return __builtin_vsx_xvxexpdp(__a);
12590 }
12591
12592 /* vec_extract_sig */
12593
12594 static __inline__ vector unsigned int __ATTRS_o_ai
12595 vec_extract_sig(vector float __a) {
12596   return __builtin_vsx_xvxsigsp(__a);
12597 }
12598
12599 static __inline__ vector unsigned long long __ATTRS_o_ai
12600 vec_extract_sig (vector double __a) {
12601   return __builtin_vsx_xvxsigdp(__a);
12602 }
12603
12604 static __inline__ vector float __ATTRS_o_ai
12605 vec_extract_fp32_from_shorth(vector unsigned short __a) {
12606   vector unsigned short __b =
12607 #ifdef __LITTLE_ENDIAN__
12608             __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
12609 #else
12610             __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
12611 #endif
12612   return __builtin_vsx_xvcvhpsp(__b);
12613 }
12614
12615 static __inline__ vector float __ATTRS_o_ai
12616 vec_extract_fp32_from_shortl(vector unsigned short __a) {
12617   vector unsigned short __b =
12618 #ifdef __LITTLE_ENDIAN__
12619             __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
12620 #else
12621             __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
12622 #endif
12623   return __builtin_vsx_xvcvhpsp(__b);
12624 }
12625 #endif /* __POWER9_VECTOR__ */
12626
12627 /* vec_insert */
12628
12629 static __inline__ vector signed char __ATTRS_o_ai
12630 vec_insert(signed char __a, vector signed char __b, int __c) {
12631   __b[__c] = __a;
12632   return __b;
12633 }
12634
12635 static __inline__ vector unsigned char __ATTRS_o_ai
12636 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
12637   __b[__c] = __a;
12638   return __b;
12639 }
12640
12641 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
12642                                                            vector bool char __b,
12643                                                            int __c) {
12644   __b[__c] = __a;
12645   return __b;
12646 }
12647
12648 static __inline__ vector signed short __ATTRS_o_ai
12649 vec_insert(signed short __a, vector signed short __b, int __c) {
12650   __b[__c] = __a;
12651   return __b;
12652 }
12653
12654 static __inline__ vector unsigned short __ATTRS_o_ai
12655 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
12656   __b[__c] = __a;
12657   return __b;
12658 }
12659
12660 static __inline__ vector bool short __ATTRS_o_ai
12661 vec_insert(unsigned short __a, vector bool short __b, int __c) {
12662   __b[__c] = __a;
12663   return __b;
12664 }
12665
12666 static __inline__ vector signed int __ATTRS_o_ai
12667 vec_insert(signed int __a, vector signed int __b, int __c) {
12668   __b[__c] = __a;
12669   return __b;
12670 }
12671
12672 static __inline__ vector unsigned int __ATTRS_o_ai
12673 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
12674   __b[__c] = __a;
12675   return __b;
12676 }
12677
12678 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
12679                                                           vector bool int __b,
12680                                                           int __c) {
12681   __b[__c] = __a;
12682   return __b;
12683 }
12684
12685 #ifdef __VSX__
12686 static __inline__ vector signed long long __ATTRS_o_ai
12687 vec_insert(signed long long __a, vector signed long long __b, int __c) {
12688   __b[__c] = __a;
12689   return __b;
12690 }
12691
12692 static __inline__ vector unsigned long long __ATTRS_o_ai
12693 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
12694   __b[__c] = __a;
12695   return __b;
12696 }
12697
12698 static __inline__ vector bool long long __ATTRS_o_ai
12699 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
12700   __b[__c] = __a;
12701   return __b;
12702 }
12703 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
12704                                                         vector double __b,
12705                                                         int __c) {
12706   __b[__c] = __a;
12707   return __b;
12708 }
12709 #endif
12710
12711 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
12712                                                        vector float __b,
12713                                                        int __c) {
12714   __b[__c] = __a;
12715   return __b;
12716 }
12717
12718 /* vec_lvlx */
12719
12720 static __inline__ vector signed char __ATTRS_o_ai
12721 vec_lvlx(int __a, const signed char *__b) {
12722   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12723                   vec_lvsl(__a, __b));
12724 }
12725
12726 static __inline__ vector signed char __ATTRS_o_ai
12727 vec_lvlx(int __a, const vector signed char *__b) {
12728   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
12729                   vec_lvsl(__a, (unsigned char *)__b));
12730 }
12731
12732 static __inline__ vector unsigned char __ATTRS_o_ai
12733 vec_lvlx(int __a, const unsigned char *__b) {
12734   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12735                   vec_lvsl(__a, __b));
12736 }
12737
12738 static __inline__ vector unsigned char __ATTRS_o_ai
12739 vec_lvlx(int __a, const vector unsigned char *__b) {
12740   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
12741                   vec_lvsl(__a, (unsigned char *)__b));
12742 }
12743
12744 static __inline__ vector bool char __ATTRS_o_ai
12745 vec_lvlx(int __a, const vector bool char *__b) {
12746   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
12747                   vec_lvsl(__a, (unsigned char *)__b));
12748 }
12749
12750 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12751                                                      const short *__b) {
12752   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12753 }
12754
12755 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
12756                                                      const vector short *__b) {
12757   return vec_perm(vec_ld(__a, __b), (vector short)(0),
12758                   vec_lvsl(__a, (unsigned char *)__b));
12759 }
12760
12761 static __inline__ vector unsigned short __ATTRS_o_ai
12762 vec_lvlx(int __a, const unsigned short *__b) {
12763   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12764                   vec_lvsl(__a, __b));
12765 }
12766
12767 static __inline__ vector unsigned short __ATTRS_o_ai
12768 vec_lvlx(int __a, const vector unsigned short *__b) {
12769   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
12770                   vec_lvsl(__a, (unsigned char *)__b));
12771 }
12772
12773 static __inline__ vector bool short __ATTRS_o_ai
12774 vec_lvlx(int __a, const vector bool short *__b) {
12775   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
12776                   vec_lvsl(__a, (unsigned char *)__b));
12777 }
12778
12779 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
12780                                                      const vector pixel *__b) {
12781   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
12782                   vec_lvsl(__a, (unsigned char *)__b));
12783 }
12784
12785 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
12786   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12787 }
12788
12789 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
12790                                                    const vector int *__b) {
12791   return vec_perm(vec_ld(__a, __b), (vector int)(0),
12792                   vec_lvsl(__a, (unsigned char *)__b));
12793 }
12794
12795 static __inline__ vector unsigned int __ATTRS_o_ai
12796 vec_lvlx(int __a, const unsigned int *__b) {
12797   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12798                   vec_lvsl(__a, __b));
12799 }
12800
12801 static __inline__ vector unsigned int __ATTRS_o_ai
12802 vec_lvlx(int __a, const vector unsigned int *__b) {
12803   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
12804                   vec_lvsl(__a, (unsigned char *)__b));
12805 }
12806
12807 static __inline__ vector bool int __ATTRS_o_ai
12808 vec_lvlx(int __a, const vector bool int *__b) {
12809   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
12810                   vec_lvsl(__a, (unsigned char *)__b));
12811 }
12812
12813 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12814                                                      const float *__b) {
12815   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12816 }
12817
12818 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
12819                                                      const vector float *__b) {
12820   return vec_perm(vec_ld(__a, __b), (vector float)(0),
12821                   vec_lvsl(__a, (unsigned char *)__b));
12822 }
12823
12824 /* vec_lvlxl */
12825
12826 static __inline__ vector signed char __ATTRS_o_ai
12827 vec_lvlxl(int __a, const signed char *__b) {
12828   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12829                   vec_lvsl(__a, __b));
12830 }
12831
12832 static __inline__ vector signed char __ATTRS_o_ai
12833 vec_lvlxl(int __a, const vector signed char *__b) {
12834   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
12835                   vec_lvsl(__a, (unsigned char *)__b));
12836 }
12837
12838 static __inline__ vector unsigned char __ATTRS_o_ai
12839 vec_lvlxl(int __a, const unsigned char *__b) {
12840   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12841                   vec_lvsl(__a, __b));
12842 }
12843
12844 static __inline__ vector unsigned char __ATTRS_o_ai
12845 vec_lvlxl(int __a, const vector unsigned char *__b) {
12846   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
12847                   vec_lvsl(__a, (unsigned char *)__b));
12848 }
12849
12850 static __inline__ vector bool char __ATTRS_o_ai
12851 vec_lvlxl(int __a, const vector bool char *__b) {
12852   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
12853                   vec_lvsl(__a, (unsigned char *)__b));
12854 }
12855
12856 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12857                                                       const short *__b) {
12858   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
12859 }
12860
12861 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
12862                                                       const vector short *__b) {
12863   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
12864                   vec_lvsl(__a, (unsigned char *)__b));
12865 }
12866
12867 static __inline__ vector unsigned short __ATTRS_o_ai
12868 vec_lvlxl(int __a, const unsigned short *__b) {
12869   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12870                   vec_lvsl(__a, __b));
12871 }
12872
12873 static __inline__ vector unsigned short __ATTRS_o_ai
12874 vec_lvlxl(int __a, const vector unsigned short *__b) {
12875   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
12876                   vec_lvsl(__a, (unsigned char *)__b));
12877 }
12878
12879 static __inline__ vector bool short __ATTRS_o_ai
12880 vec_lvlxl(int __a, const vector bool short *__b) {
12881   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
12882                   vec_lvsl(__a, (unsigned char *)__b));
12883 }
12884
12885 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
12886                                                       const vector pixel *__b) {
12887   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
12888                   vec_lvsl(__a, (unsigned char *)__b));
12889 }
12890
12891 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
12892   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
12893 }
12894
12895 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
12896                                                     const vector int *__b) {
12897   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
12898                   vec_lvsl(__a, (unsigned char *)__b));
12899 }
12900
12901 static __inline__ vector unsigned int __ATTRS_o_ai
12902 vec_lvlxl(int __a, const unsigned int *__b) {
12903   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12904                   vec_lvsl(__a, __b));
12905 }
12906
12907 static __inline__ vector unsigned int __ATTRS_o_ai
12908 vec_lvlxl(int __a, const vector unsigned int *__b) {
12909   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
12910                   vec_lvsl(__a, (unsigned char *)__b));
12911 }
12912
12913 static __inline__ vector bool int __ATTRS_o_ai
12914 vec_lvlxl(int __a, const vector bool int *__b) {
12915   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
12916                   vec_lvsl(__a, (unsigned char *)__b));
12917 }
12918
12919 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12920                                                       const float *__b) {
12921   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
12922 }
12923
12924 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
12925                                                       vector float *__b) {
12926   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
12927                   vec_lvsl(__a, (unsigned char *)__b));
12928 }
12929
12930 /* vec_lvrx */
12931
12932 static __inline__ vector signed char __ATTRS_o_ai
12933 vec_lvrx(int __a, const signed char *__b) {
12934   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12935                   vec_lvsl(__a, __b));
12936 }
12937
12938 static __inline__ vector signed char __ATTRS_o_ai
12939 vec_lvrx(int __a, const vector signed char *__b) {
12940   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
12941                   vec_lvsl(__a, (unsigned char *)__b));
12942 }
12943
12944 static __inline__ vector unsigned char __ATTRS_o_ai
12945 vec_lvrx(int __a, const unsigned char *__b) {
12946   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12947                   vec_lvsl(__a, __b));
12948 }
12949
12950 static __inline__ vector unsigned char __ATTRS_o_ai
12951 vec_lvrx(int __a, const vector unsigned char *__b) {
12952   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
12953                   vec_lvsl(__a, (unsigned char *)__b));
12954 }
12955
12956 static __inline__ vector bool char __ATTRS_o_ai
12957 vec_lvrx(int __a, const vector bool char *__b) {
12958   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
12959                   vec_lvsl(__a, (unsigned char *)__b));
12960 }
12961
12962 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12963                                                      const short *__b) {
12964   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12965 }
12966
12967 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
12968                                                      const vector short *__b) {
12969   return vec_perm((vector short)(0), vec_ld(__a, __b),
12970                   vec_lvsl(__a, (unsigned char *)__b));
12971 }
12972
12973 static __inline__ vector unsigned short __ATTRS_o_ai
12974 vec_lvrx(int __a, const unsigned short *__b) {
12975   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12976                   vec_lvsl(__a, __b));
12977 }
12978
12979 static __inline__ vector unsigned short __ATTRS_o_ai
12980 vec_lvrx(int __a, const vector unsigned short *__b) {
12981   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
12982                   vec_lvsl(__a, (unsigned char *)__b));
12983 }
12984
12985 static __inline__ vector bool short __ATTRS_o_ai
12986 vec_lvrx(int __a, const vector bool short *__b) {
12987   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
12988                   vec_lvsl(__a, (unsigned char *)__b));
12989 }
12990
12991 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
12992                                                      const vector pixel *__b) {
12993   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
12994                   vec_lvsl(__a, (unsigned char *)__b));
12995 }
12996
12997 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
12998   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
12999 }
13000
13001 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
13002                                                    const vector int *__b) {
13003   return vec_perm((vector int)(0), vec_ld(__a, __b),
13004                   vec_lvsl(__a, (unsigned char *)__b));
13005 }
13006
13007 static __inline__ vector unsigned int __ATTRS_o_ai
13008 vec_lvrx(int __a, const unsigned int *__b) {
13009   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13010                   vec_lvsl(__a, __b));
13011 }
13012
13013 static __inline__ vector unsigned int __ATTRS_o_ai
13014 vec_lvrx(int __a, const vector unsigned int *__b) {
13015   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
13016                   vec_lvsl(__a, (unsigned char *)__b));
13017 }
13018
13019 static __inline__ vector bool int __ATTRS_o_ai
13020 vec_lvrx(int __a, const vector bool int *__b) {
13021   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
13022                   vec_lvsl(__a, (unsigned char *)__b));
13023 }
13024
13025 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13026                                                      const float *__b) {
13027   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
13028 }
13029
13030 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
13031                                                      const vector float *__b) {
13032   return vec_perm((vector float)(0), vec_ld(__a, __b),
13033                   vec_lvsl(__a, (unsigned char *)__b));
13034 }
13035
13036 /* vec_lvrxl */
13037
13038 static __inline__ vector signed char __ATTRS_o_ai
13039 vec_lvrxl(int __a, const signed char *__b) {
13040   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13041                   vec_lvsl(__a, __b));
13042 }
13043
13044 static __inline__ vector signed char __ATTRS_o_ai
13045 vec_lvrxl(int __a, const vector signed char *__b) {
13046   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
13047                   vec_lvsl(__a, (unsigned char *)__b));
13048 }
13049
13050 static __inline__ vector unsigned char __ATTRS_o_ai
13051 vec_lvrxl(int __a, const unsigned char *__b) {
13052   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13053                   vec_lvsl(__a, __b));
13054 }
13055
13056 static __inline__ vector unsigned char __ATTRS_o_ai
13057 vec_lvrxl(int __a, const vector unsigned char *__b) {
13058   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
13059                   vec_lvsl(__a, (unsigned char *)__b));
13060 }
13061
13062 static __inline__ vector bool char __ATTRS_o_ai
13063 vec_lvrxl(int __a, const vector bool char *__b) {
13064   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
13065                   vec_lvsl(__a, (unsigned char *)__b));
13066 }
13067
13068 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13069                                                       const short *__b) {
13070   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13071 }
13072
13073 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
13074                                                       const vector short *__b) {
13075   return vec_perm((vector short)(0), vec_ldl(__a, __b),
13076                   vec_lvsl(__a, (unsigned char *)__b));
13077 }
13078
13079 static __inline__ vector unsigned short __ATTRS_o_ai
13080 vec_lvrxl(int __a, const unsigned short *__b) {
13081   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13082                   vec_lvsl(__a, __b));
13083 }
13084
13085 static __inline__ vector unsigned short __ATTRS_o_ai
13086 vec_lvrxl(int __a, const vector unsigned short *__b) {
13087   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
13088                   vec_lvsl(__a, (unsigned char *)__b));
13089 }
13090
13091 static __inline__ vector bool short __ATTRS_o_ai
13092 vec_lvrxl(int __a, const vector bool short *__b) {
13093   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
13094                   vec_lvsl(__a, (unsigned char *)__b));
13095 }
13096
13097 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
13098                                                       const vector pixel *__b) {
13099   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
13100                   vec_lvsl(__a, (unsigned char *)__b));
13101 }
13102
13103 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
13104   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13105 }
13106
13107 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
13108                                                     const vector int *__b) {
13109   return vec_perm((vector int)(0), vec_ldl(__a, __b),
13110                   vec_lvsl(__a, (unsigned char *)__b));
13111 }
13112
13113 static __inline__ vector unsigned int __ATTRS_o_ai
13114 vec_lvrxl(int __a, const unsigned int *__b) {
13115   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13116                   vec_lvsl(__a, __b));
13117 }
13118
13119 static __inline__ vector unsigned int __ATTRS_o_ai
13120 vec_lvrxl(int __a, const vector unsigned int *__b) {
13121   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
13122                   vec_lvsl(__a, (unsigned char *)__b));
13123 }
13124
13125 static __inline__ vector bool int __ATTRS_o_ai
13126 vec_lvrxl(int __a, const vector bool int *__b) {
13127   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
13128                   vec_lvsl(__a, (unsigned char *)__b));
13129 }
13130
13131 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13132                                                       const float *__b) {
13133   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
13134 }
13135
13136 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
13137                                                       const vector float *__b) {
13138   return vec_perm((vector float)(0), vec_ldl(__a, __b),
13139                   vec_lvsl(__a, (unsigned char *)__b));
13140 }
13141
13142 /* vec_stvlx */
13143
13144 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13145                                               signed char *__c) {
13146   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13147                 __c);
13148 }
13149
13150 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
13151                                               vector signed char *__c) {
13152   return vec_st(
13153       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13154       __b, __c);
13155 }
13156
13157 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13158                                               unsigned char *__c) {
13159   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13160                 __c);
13161 }
13162
13163 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
13164                                               vector unsigned char *__c) {
13165   return vec_st(
13166       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13167       __b, __c);
13168 }
13169
13170 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
13171                                               vector bool char *__c) {
13172   return vec_st(
13173       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13174       __b, __c);
13175 }
13176
13177 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13178                                               short *__c) {
13179   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13180                 __c);
13181 }
13182
13183 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
13184                                               vector short *__c) {
13185   return vec_st(
13186       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13187       __b, __c);
13188 }
13189
13190 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13191                                               int __b, unsigned short *__c) {
13192   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13193                 __c);
13194 }
13195
13196 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
13197                                               int __b,
13198                                               vector unsigned short *__c) {
13199   return vec_st(
13200       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13201       __b, __c);
13202 }
13203
13204 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
13205                                               vector bool short *__c) {
13206   return vec_st(
13207       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13208       __b, __c);
13209 }
13210
13211 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
13212                                               vector pixel *__c) {
13213   return vec_st(
13214       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13215       __b, __c);
13216 }
13217
13218 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13219                                               int *__c) {
13220   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13221                 __c);
13222 }
13223
13224 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
13225                                               vector int *__c) {
13226   return vec_st(
13227       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13228       __b, __c);
13229 }
13230
13231 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13232                                               unsigned int *__c) {
13233   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13234                 __c);
13235 }
13236
13237 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
13238                                               vector unsigned int *__c) {
13239   return vec_st(
13240       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13241       __b, __c);
13242 }
13243
13244 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
13245                                               vector bool int *__c) {
13246   return vec_st(
13247       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13248       __b, __c);
13249 }
13250
13251 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
13252                                               vector float *__c) {
13253   return vec_st(
13254       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13255       __b, __c);
13256 }
13257
13258 /* vec_stvlxl */
13259
13260 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13261                                                signed char *__c) {
13262   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13263                  __c);
13264 }
13265
13266 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
13267                                                vector signed char *__c) {
13268   return vec_stl(
13269       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13270       __b, __c);
13271 }
13272
13273 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13274                                                int __b, unsigned char *__c) {
13275   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13276                  __c);
13277 }
13278
13279 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
13280                                                int __b,
13281                                                vector unsigned char *__c) {
13282   return vec_stl(
13283       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13284       __b, __c);
13285 }
13286
13287 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
13288                                                vector bool char *__c) {
13289   return vec_stl(
13290       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13291       __b, __c);
13292 }
13293
13294 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13295                                                short *__c) {
13296   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13297                  __c);
13298 }
13299
13300 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
13301                                                vector short *__c) {
13302   return vec_stl(
13303       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13304       __b, __c);
13305 }
13306
13307 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13308                                                int __b, unsigned short *__c) {
13309   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13310                  __c);
13311 }
13312
13313 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
13314                                                int __b,
13315                                                vector unsigned short *__c) {
13316   return vec_stl(
13317       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13318       __b, __c);
13319 }
13320
13321 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
13322                                                vector bool short *__c) {
13323   return vec_stl(
13324       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13325       __b, __c);
13326 }
13327
13328 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
13329                                                vector pixel *__c) {
13330   return vec_stl(
13331       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13332       __b, __c);
13333 }
13334
13335 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13336                                                int *__c) {
13337   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13338                  __c);
13339 }
13340
13341 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
13342                                                vector int *__c) {
13343   return vec_stl(
13344       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13345       __b, __c);
13346 }
13347
13348 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13349                                                unsigned int *__c) {
13350   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
13351                  __c);
13352 }
13353
13354 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
13355                                                vector unsigned int *__c) {
13356   return vec_stl(
13357       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13358       __b, __c);
13359 }
13360
13361 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
13362                                                vector bool int *__c) {
13363   return vec_stl(
13364       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13365       __b, __c);
13366 }
13367
13368 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
13369                                                vector float *__c) {
13370   return vec_stl(
13371       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
13372       __b, __c);
13373 }
13374
13375 /* vec_stvrx */
13376
13377 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13378                                               signed char *__c) {
13379   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13380                 __c);
13381 }
13382
13383 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
13384                                               vector signed char *__c) {
13385   return vec_st(
13386       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13387       __b, __c);
13388 }
13389
13390 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13391                                               unsigned char *__c) {
13392   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13393                 __c);
13394 }
13395
13396 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
13397                                               vector unsigned char *__c) {
13398   return vec_st(
13399       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13400       __b, __c);
13401 }
13402
13403 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
13404                                               vector bool char *__c) {
13405   return vec_st(
13406       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13407       __b, __c);
13408 }
13409
13410 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13411                                               short *__c) {
13412   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13413                 __c);
13414 }
13415
13416 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
13417                                               vector short *__c) {
13418   return vec_st(
13419       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13420       __b, __c);
13421 }
13422
13423 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13424                                               int __b, unsigned short *__c) {
13425   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13426                 __c);
13427 }
13428
13429 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
13430                                               int __b,
13431                                               vector unsigned short *__c) {
13432   return vec_st(
13433       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13434       __b, __c);
13435 }
13436
13437 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
13438                                               vector bool short *__c) {
13439   return vec_st(
13440       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13441       __b, __c);
13442 }
13443
13444 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
13445                                               vector pixel *__c) {
13446   return vec_st(
13447       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13448       __b, __c);
13449 }
13450
13451 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13452                                               int *__c) {
13453   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13454                 __c);
13455 }
13456
13457 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
13458                                               vector int *__c) {
13459   return vec_st(
13460       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13461       __b, __c);
13462 }
13463
13464 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13465                                               unsigned int *__c) {
13466   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13467                 __c);
13468 }
13469
13470 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
13471                                               vector unsigned int *__c) {
13472   return vec_st(
13473       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13474       __b, __c);
13475 }
13476
13477 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
13478                                               vector bool int *__c) {
13479   return vec_st(
13480       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13481       __b, __c);
13482 }
13483
13484 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
13485                                               vector float *__c) {
13486   return vec_st(
13487       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13488       __b, __c);
13489 }
13490
13491 /* vec_stvrxl */
13492
13493 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13494                                                signed char *__c) {
13495   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13496                  __c);
13497 }
13498
13499 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
13500                                                vector signed char *__c) {
13501   return vec_stl(
13502       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13503       __b, __c);
13504 }
13505
13506 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13507                                                int __b, unsigned char *__c) {
13508   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13509                  __c);
13510 }
13511
13512 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
13513                                                int __b,
13514                                                vector unsigned char *__c) {
13515   return vec_stl(
13516       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13517       __b, __c);
13518 }
13519
13520 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
13521                                                vector bool char *__c) {
13522   return vec_stl(
13523       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13524       __b, __c);
13525 }
13526
13527 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13528                                                short *__c) {
13529   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13530                  __c);
13531 }
13532
13533 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
13534                                                vector short *__c) {
13535   return vec_stl(
13536       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13537       __b, __c);
13538 }
13539
13540 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13541                                                int __b, unsigned short *__c) {
13542   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13543                  __c);
13544 }
13545
13546 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
13547                                                int __b,
13548                                                vector unsigned short *__c) {
13549   return vec_stl(
13550       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13551       __b, __c);
13552 }
13553
13554 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
13555                                                vector bool short *__c) {
13556   return vec_stl(
13557       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13558       __b, __c);
13559 }
13560
13561 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
13562                                                vector pixel *__c) {
13563   return vec_stl(
13564       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13565       __b, __c);
13566 }
13567
13568 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13569                                                int *__c) {
13570   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13571                  __c);
13572 }
13573
13574 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
13575                                                vector int *__c) {
13576   return vec_stl(
13577       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13578       __b, __c);
13579 }
13580
13581 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13582                                                unsigned int *__c) {
13583   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
13584                  __c);
13585 }
13586
13587 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
13588                                                vector unsigned int *__c) {
13589   return vec_stl(
13590       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13591       __b, __c);
13592 }
13593
13594 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
13595                                                vector bool int *__c) {
13596   return vec_stl(
13597       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13598       __b, __c);
13599 }
13600
13601 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
13602                                                vector float *__c) {
13603   return vec_stl(
13604       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
13605       __b, __c);
13606 }
13607
13608 /* vec_promote */
13609
13610 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
13611                                                               int __b) {
13612   vector signed char __res = (vector signed char)(0);
13613   __res[__b] = __a;
13614   return __res;
13615 }
13616
13617 static __inline__ vector unsigned char __ATTRS_o_ai
13618 vec_promote(unsigned char __a, int __b) {
13619   vector unsigned char __res = (vector unsigned char)(0);
13620   __res[__b] = __a;
13621   return __res;
13622 }
13623
13624 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
13625   vector short __res = (vector short)(0);
13626   __res[__b] = __a;
13627   return __res;
13628 }
13629
13630 static __inline__ vector unsigned short __ATTRS_o_ai
13631 vec_promote(unsigned short __a, int __b) {
13632   vector unsigned short __res = (vector unsigned short)(0);
13633   __res[__b] = __a;
13634   return __res;
13635 }
13636
13637 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
13638   vector int __res = (vector int)(0);
13639   __res[__b] = __a;
13640   return __res;
13641 }
13642
13643 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
13644                                                                int __b) {
13645   vector unsigned int __res = (vector unsigned int)(0);
13646   __res[__b] = __a;
13647   return __res;
13648 }
13649
13650 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
13651   vector float __res = (vector float)(0);
13652   __res[__b] = __a;
13653   return __res;
13654 }
13655
13656 /* vec_splats */
13657
13658 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
13659   return (vector signed char)(__a);
13660 }
13661
13662 static __inline__ vector unsigned char __ATTRS_o_ai
13663 vec_splats(unsigned char __a) {
13664   return (vector unsigned char)(__a);
13665 }
13666
13667 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
13668   return (vector short)(__a);
13669 }
13670
13671 static __inline__ vector unsigned short __ATTRS_o_ai
13672 vec_splats(unsigned short __a) {
13673   return (vector unsigned short)(__a);
13674 }
13675
13676 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
13677   return (vector int)(__a);
13678 }
13679
13680 static __inline__ vector unsigned int __ATTRS_o_ai
13681 vec_splats(unsigned int __a) {
13682   return (vector unsigned int)(__a);
13683 }
13684
13685 #ifdef __VSX__
13686 static __inline__ vector signed long long __ATTRS_o_ai
13687 vec_splats(signed long long __a) {
13688   return (vector signed long long)(__a);
13689 }
13690
13691 static __inline__ vector unsigned long long __ATTRS_o_ai
13692 vec_splats(unsigned long long __a) {
13693   return (vector unsigned long long)(__a);
13694 }
13695
13696 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
13697 static __inline__ vector signed __int128 __ATTRS_o_ai
13698 vec_splats(signed __int128 __a) {
13699   return (vector signed __int128)(__a);
13700 }
13701
13702 static __inline__ vector unsigned __int128 __ATTRS_o_ai
13703 vec_splats(unsigned __int128 __a) {
13704   return (vector unsigned __int128)(__a);
13705 }
13706
13707 #endif
13708
13709 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
13710   return (vector double)(__a);
13711 }
13712 #endif
13713
13714 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
13715   return (vector float)(__a);
13716 }
13717
13718 /* ----------------------------- predicates --------------------------------- */
13719
13720 /* vec_all_eq */
13721
13722 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13723                                               vector signed char __b) {
13724   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13725                                       (vector char)__b);
13726 }
13727
13728 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
13729                                               vector bool char __b) {
13730   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13731                                       (vector char)__b);
13732 }
13733
13734 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13735                                               vector unsigned char __b) {
13736   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13737                                       (vector char)__b);
13738 }
13739
13740 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
13741                                               vector bool char __b) {
13742   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13743                                       (vector char)__b);
13744 }
13745
13746 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13747                                               vector signed char __b) {
13748   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13749                                       (vector char)__b);
13750 }
13751
13752 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13753                                               vector unsigned char __b) {
13754   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13755                                       (vector char)__b);
13756 }
13757
13758 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
13759                                               vector bool char __b) {
13760   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
13761                                       (vector char)__b);
13762 }
13763
13764 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13765                                               vector short __b) {
13766   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
13767 }
13768
13769 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
13770                                               vector bool short __b) {
13771   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
13772 }
13773
13774 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13775                                               vector unsigned short __b) {
13776   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13777                                       (vector short)__b);
13778 }
13779
13780 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
13781                                               vector bool short __b) {
13782   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13783                                       (vector short)__b);
13784 }
13785
13786 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13787                                               vector short __b) {
13788   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13789                                       (vector short)__b);
13790 }
13791
13792 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13793                                               vector unsigned short __b) {
13794   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13795                                       (vector short)__b);
13796 }
13797
13798 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
13799                                               vector bool short __b) {
13800   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13801                                       (vector short)__b);
13802 }
13803
13804 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
13805                                               vector pixel __b) {
13806   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
13807                                       (vector short)__b);
13808 }
13809
13810 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
13811   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
13812 }
13813
13814 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
13815                                               vector bool int __b) {
13816   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
13817 }
13818
13819 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13820                                               vector unsigned int __b) {
13821   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13822                                       (vector int)__b);
13823 }
13824
13825 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
13826                                               vector bool int __b) {
13827   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13828                                       (vector int)__b);
13829 }
13830
13831 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13832                                               vector int __b) {
13833   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13834                                       (vector int)__b);
13835 }
13836
13837 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13838                                               vector unsigned int __b) {
13839   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13840                                       (vector int)__b);
13841 }
13842
13843 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
13844                                               vector bool int __b) {
13845   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
13846                                       (vector int)__b);
13847 }
13848
13849 #ifdef __POWER8_VECTOR__
13850 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
13851                                               vector signed long long __b) {
13852   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
13853 }
13854
13855 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
13856                                               vector bool long long __b) {
13857   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
13858 }
13859
13860 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13861                                               vector unsigned long long __b) {
13862   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13863                                       (vector long long)__b);
13864 }
13865
13866 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
13867                                               vector bool long long __b) {
13868   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13869                                       (vector long long)__b);
13870 }
13871
13872 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13873                                               vector long long __b) {
13874   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13875                                       (vector long long)__b);
13876 }
13877
13878 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13879                                               vector unsigned long long __b) {
13880   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13881                                       (vector long long)__b);
13882 }
13883
13884 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
13885                                               vector bool long long __b) {
13886   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
13887                                       (vector long long)__b);
13888 }
13889 #endif
13890
13891 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
13892                                               vector float __b) {
13893 #ifdef __VSX__
13894   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
13895 #else
13896   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
13897 #endif
13898 }
13899
13900 #ifdef __VSX__
13901 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
13902                                               vector double __b) {
13903   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
13904 }
13905 #endif
13906
13907 /* vec_all_ge */
13908
13909 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13910                                               vector signed char __b) {
13911   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
13912 }
13913
13914 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
13915                                               vector bool char __b) {
13916   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
13917 }
13918
13919 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13920                                               vector unsigned char __b) {
13921   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
13922 }
13923
13924 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
13925                                               vector bool char __b) {
13926   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
13927 }
13928
13929 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13930                                               vector signed char __b) {
13931   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13932                                       (vector unsigned char)__a);
13933 }
13934
13935 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13936                                               vector unsigned char __b) {
13937   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
13938 }
13939
13940 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
13941                                               vector bool char __b) {
13942   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
13943                                       (vector unsigned char)__a);
13944 }
13945
13946 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13947                                               vector short __b) {
13948   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
13949 }
13950
13951 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
13952                                               vector bool short __b) {
13953   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
13954 }
13955
13956 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13957                                               vector unsigned short __b) {
13958   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
13959 }
13960
13961 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
13962                                               vector bool short __b) {
13963   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13964                                       __a);
13965 }
13966
13967 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13968                                               vector short __b) {
13969   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13970                                       (vector unsigned short)__a);
13971 }
13972
13973 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13974                                               vector unsigned short __b) {
13975   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
13976                                       (vector unsigned short)__a);
13977 }
13978
13979 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
13980                                               vector bool short __b) {
13981   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
13982                                       (vector unsigned short)__a);
13983 }
13984
13985 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
13986   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
13987 }
13988
13989 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
13990                                               vector bool int __b) {
13991   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
13992 }
13993
13994 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
13995                                               vector unsigned int __b) {
13996   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
13997 }
13998
13999 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
14000                                               vector bool int __b) {
14001   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
14002 }
14003
14004 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14005                                               vector int __b) {
14006   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14007                                       (vector unsigned int)__a);
14008 }
14009
14010 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14011                                               vector unsigned int __b) {
14012   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
14013 }
14014
14015 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
14016                                               vector bool int __b) {
14017   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
14018                                       (vector unsigned int)__a);
14019 }
14020
14021 #ifdef __POWER8_VECTOR__
14022 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14023                                               vector signed long long __b) {
14024   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
14025 }
14026 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
14027                                               vector bool long long __b) {
14028   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
14029                                       __a);
14030 }
14031
14032 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14033                                               vector unsigned long long __b) {
14034   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
14035 }
14036
14037 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
14038                                               vector bool long long __b) {
14039   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14040                                       __a);
14041 }
14042
14043 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14044                                               vector signed long long __b) {
14045   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14046                                       (vector unsigned long long)__a);
14047 }
14048
14049 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14050                                               vector unsigned long long __b) {
14051   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
14052                                       (vector unsigned long long)__a);
14053 }
14054
14055 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
14056                                               vector bool long long __b) {
14057   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
14058                                       (vector unsigned long long)__a);
14059 }
14060 #endif
14061
14062 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
14063                                               vector float __b) {
14064 #ifdef __VSX__
14065   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
14066 #else
14067   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
14068 #endif
14069 }
14070
14071 #ifdef __VSX__
14072 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
14073                                               vector double __b) {
14074   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
14075 }
14076 #endif
14077
14078 /* vec_all_gt */
14079
14080 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14081                                               vector signed char __b) {
14082   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
14083 }
14084
14085 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
14086                                               vector bool char __b) {
14087   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
14088 }
14089
14090 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14091                                               vector unsigned char __b) {
14092   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
14093 }
14094
14095 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
14096                                               vector bool char __b) {
14097   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
14098 }
14099
14100 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14101                                               vector signed char __b) {
14102   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14103                                       (vector unsigned char)__b);
14104 }
14105
14106 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14107                                               vector unsigned char __b) {
14108   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
14109 }
14110
14111 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
14112                                               vector bool char __b) {
14113   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
14114                                       (vector unsigned char)__b);
14115 }
14116
14117 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14118                                               vector short __b) {
14119   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
14120 }
14121
14122 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
14123                                               vector bool short __b) {
14124   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
14125 }
14126
14127 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14128                                               vector unsigned short __b) {
14129   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
14130 }
14131
14132 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
14133                                               vector bool short __b) {
14134   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
14135                                       (vector unsigned short)__b);
14136 }
14137
14138 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14139                                               vector short __b) {
14140   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14141                                       (vector unsigned short)__b);
14142 }
14143
14144 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14145                                               vector unsigned short __b) {
14146   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14147                                       __b);
14148 }
14149
14150 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
14151                                               vector bool short __b) {
14152   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
14153                                       (vector unsigned short)__b);
14154 }
14155
14156 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
14157   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
14158 }
14159
14160 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
14161                                               vector bool int __b) {
14162   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
14163 }
14164
14165 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14166                                               vector unsigned int __b) {
14167   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
14168 }
14169
14170 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
14171                                               vector bool int __b) {
14172   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
14173 }
14174
14175 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14176                                               vector int __b) {
14177   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14178                                       (vector unsigned int)__b);
14179 }
14180
14181 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14182                                               vector unsigned int __b) {
14183   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
14184 }
14185
14186 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
14187                                               vector bool int __b) {
14188   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
14189                                       (vector unsigned int)__b);
14190 }
14191
14192 #ifdef __POWER8_VECTOR__
14193 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14194                                               vector signed long long __b) {
14195   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
14196 }
14197 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
14198                                               vector bool long long __b) {
14199   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
14200                                       (vector signed long long)__b);
14201 }
14202
14203 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14204                                               vector unsigned long long __b) {
14205   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
14206 }
14207
14208 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
14209                                               vector bool long long __b) {
14210   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
14211                                       (vector unsigned long long)__b);
14212 }
14213
14214 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14215                                               vector signed long long __b) {
14216   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14217                                       (vector unsigned long long)__b);
14218 }
14219
14220 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14221                                               vector unsigned long long __b) {
14222   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14223                                       __b);
14224 }
14225
14226 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
14227                                               vector bool long long __b) {
14228   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
14229                                       (vector unsigned long long)__b);
14230 }
14231 #endif
14232
14233 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
14234                                               vector float __b) {
14235 #ifdef __VSX__
14236   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
14237 #else
14238   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
14239 #endif
14240 }
14241
14242 #ifdef __VSX__
14243 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
14244                                               vector double __b) {
14245   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
14246 }
14247 #endif
14248
14249 /* vec_all_in */
14250
14251 static __inline__ int __attribute__((__always_inline__))
14252 vec_all_in(vector float __a, vector float __b) {
14253   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
14254 }
14255
14256 /* vec_all_le */
14257
14258 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14259                                               vector signed char __b) {
14260   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
14261 }
14262
14263 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
14264                                               vector bool char __b) {
14265   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
14266 }
14267
14268 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14269                                               vector unsigned char __b) {
14270   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
14271 }
14272
14273 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
14274                                               vector bool char __b) {
14275   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
14276 }
14277
14278 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14279                                               vector signed char __b) {
14280   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14281                                       (vector unsigned char)__b);
14282 }
14283
14284 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14285                                               vector unsigned char __b) {
14286   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
14287 }
14288
14289 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
14290                                               vector bool char __b) {
14291   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
14292                                       (vector unsigned char)__b);
14293 }
14294
14295 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14296                                               vector short __b) {
14297   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
14298 }
14299
14300 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
14301                                               vector bool short __b) {
14302   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
14303 }
14304
14305 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14306                                               vector unsigned short __b) {
14307   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
14308 }
14309
14310 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
14311                                               vector bool short __b) {
14312   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
14313                                       (vector unsigned short)__b);
14314 }
14315
14316 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14317                                               vector short __b) {
14318   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14319                                       (vector unsigned short)__b);
14320 }
14321
14322 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14323                                               vector unsigned short __b) {
14324   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14325                                       __b);
14326 }
14327
14328 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
14329                                               vector bool short __b) {
14330   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
14331                                       (vector unsigned short)__b);
14332 }
14333
14334 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
14335   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
14336 }
14337
14338 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
14339                                               vector bool int __b) {
14340   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
14341 }
14342
14343 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14344                                               vector unsigned int __b) {
14345   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
14346 }
14347
14348 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
14349                                               vector bool int __b) {
14350   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
14351 }
14352
14353 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14354                                               vector int __b) {
14355   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14356                                       (vector unsigned int)__b);
14357 }
14358
14359 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14360                                               vector unsigned int __b) {
14361   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
14362 }
14363
14364 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
14365                                               vector bool int __b) {
14366   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
14367                                       (vector unsigned int)__b);
14368 }
14369
14370 #ifdef __POWER8_VECTOR__
14371 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14372                                               vector signed long long __b) {
14373   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
14374 }
14375
14376 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14377                                               vector unsigned long long __b) {
14378   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
14379 }
14380
14381 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
14382                                               vector bool long long __b) {
14383   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
14384                                       (vector signed long long)__b);
14385 }
14386
14387 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
14388                                               vector bool long long __b) {
14389   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
14390                                       (vector unsigned long long)__b);
14391 }
14392
14393 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14394                                               vector signed long long __b) {
14395   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14396                                       (vector unsigned long long)__b);
14397 }
14398
14399 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14400                                               vector unsigned long long __b) {
14401   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14402                                       __b);
14403 }
14404
14405 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
14406                                               vector bool long long __b) {
14407   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
14408                                       (vector unsigned long long)__b);
14409 }
14410 #endif
14411
14412 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
14413                                               vector float __b) {
14414 #ifdef __VSX__
14415   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
14416 #else
14417   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
14418 #endif
14419 }
14420
14421 #ifdef __VSX__
14422 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
14423                                               vector double __b) {
14424   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
14425 }
14426 #endif
14427
14428 /* vec_all_lt */
14429
14430 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14431                                               vector signed char __b) {
14432   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
14433 }
14434
14435 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
14436                                               vector bool char __b) {
14437   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
14438 }
14439
14440 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14441                                               vector unsigned char __b) {
14442   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
14443 }
14444
14445 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
14446                                               vector bool char __b) {
14447   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
14448 }
14449
14450 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14451                                               vector signed char __b) {
14452   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14453                                       (vector unsigned char)__a);
14454 }
14455
14456 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14457                                               vector unsigned char __b) {
14458   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
14459 }
14460
14461 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
14462                                               vector bool char __b) {
14463   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
14464                                       (vector unsigned char)__a);
14465 }
14466
14467 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14468                                               vector short __b) {
14469   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
14470 }
14471
14472 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
14473                                               vector bool short __b) {
14474   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
14475 }
14476
14477 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14478                                               vector unsigned short __b) {
14479   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
14480 }
14481
14482 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
14483                                               vector bool short __b) {
14484   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14485                                       __a);
14486 }
14487
14488 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14489                                               vector short __b) {
14490   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14491                                       (vector unsigned short)__a);
14492 }
14493
14494 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14495                                               vector unsigned short __b) {
14496   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
14497                                       (vector unsigned short)__a);
14498 }
14499
14500 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
14501                                               vector bool short __b) {
14502   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
14503                                       (vector unsigned short)__a);
14504 }
14505
14506 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
14507   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
14508 }
14509
14510 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
14511                                               vector bool int __b) {
14512   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
14513 }
14514
14515 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14516                                               vector unsigned int __b) {
14517   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
14518 }
14519
14520 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
14521                                               vector bool int __b) {
14522   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
14523 }
14524
14525 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14526                                               vector int __b) {
14527   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14528                                       (vector unsigned int)__a);
14529 }
14530
14531 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14532                                               vector unsigned int __b) {
14533   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
14534 }
14535
14536 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
14537                                               vector bool int __b) {
14538   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
14539                                       (vector unsigned int)__a);
14540 }
14541
14542 #ifdef __POWER8_VECTOR__
14543 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14544                                               vector signed long long __b) {
14545   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
14546 }
14547
14548 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14549                                               vector unsigned long long __b) {
14550   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
14551 }
14552
14553 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
14554                                               vector bool long long __b) {
14555   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
14556                                       __a);
14557 }
14558
14559 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
14560                                               vector bool long long __b) {
14561   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14562                                       __a);
14563 }
14564
14565 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14566                                               vector signed long long __b) {
14567   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14568                                       (vector unsigned long long)__a);
14569 }
14570
14571 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14572                                               vector unsigned long long __b) {
14573   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
14574                                       (vector unsigned long long)__a);
14575 }
14576
14577 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
14578                                               vector bool long long __b) {
14579   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
14580                                       (vector unsigned long long)__a);
14581 }
14582 #endif
14583
14584 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
14585                                               vector float __b) {
14586 #ifdef __VSX__
14587   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
14588 #else
14589   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
14590 #endif
14591 }
14592
14593 #ifdef __VSX__
14594 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
14595                                               vector double __b) {
14596   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
14597 }
14598 #endif
14599
14600 /* vec_all_nan */
14601
14602 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
14603 #ifdef __VSX__
14604   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
14605 #else
14606   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
14607 #endif
14608 }
14609
14610 #ifdef __VSX__
14611 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
14612   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
14613 }
14614 #endif
14615
14616 /* vec_all_ne */
14617
14618 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14619                                               vector signed char __b) {
14620   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14621                                       (vector char)__b);
14622 }
14623
14624 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
14625                                               vector bool char __b) {
14626   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14627                                       (vector char)__b);
14628 }
14629
14630 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14631                                               vector unsigned char __b) {
14632   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14633                                       (vector char)__b);
14634 }
14635
14636 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
14637                                               vector bool char __b) {
14638   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14639                                       (vector char)__b);
14640 }
14641
14642 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14643                                               vector signed char __b) {
14644   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14645                                       (vector char)__b);
14646 }
14647
14648 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14649                                               vector unsigned char __b) {
14650   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14651                                       (vector char)__b);
14652 }
14653
14654 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
14655                                               vector bool char __b) {
14656   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
14657                                       (vector char)__b);
14658 }
14659
14660 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14661                                               vector short __b) {
14662   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
14663 }
14664
14665 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
14666                                               vector bool short __b) {
14667   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
14668 }
14669
14670 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14671                                               vector unsigned short __b) {
14672   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14673                                       (vector short)__b);
14674 }
14675
14676 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
14677                                               vector bool short __b) {
14678   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14679                                       (vector short)__b);
14680 }
14681
14682 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14683                                               vector short __b) {
14684   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14685                                       (vector short)__b);
14686 }
14687
14688 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14689                                               vector unsigned short __b) {
14690   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14691                                       (vector short)__b);
14692 }
14693
14694 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
14695                                               vector bool short __b) {
14696   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14697                                       (vector short)__b);
14698 }
14699
14700 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
14701                                               vector pixel __b) {
14702   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
14703                                       (vector short)__b);
14704 }
14705
14706 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
14707   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
14708 }
14709
14710 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
14711                                               vector bool int __b) {
14712   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
14713 }
14714
14715 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14716                                               vector unsigned int __b) {
14717   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14718                                       (vector int)__b);
14719 }
14720
14721 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
14722                                               vector bool int __b) {
14723   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14724                                       (vector int)__b);
14725 }
14726
14727 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14728                                               vector int __b) {
14729   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14730                                       (vector int)__b);
14731 }
14732
14733 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14734                                               vector unsigned int __b) {
14735   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14736                                       (vector int)__b);
14737 }
14738
14739 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
14740                                               vector bool int __b) {
14741   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
14742                                       (vector int)__b);
14743 }
14744
14745 #ifdef __POWER8_VECTOR__
14746 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14747                                               vector signed long long __b) {
14748   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
14749 }
14750
14751 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14752                                               vector unsigned long long __b) {
14753   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
14754                                       (vector long long)__b);
14755 }
14756
14757 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
14758                                               vector bool long long __b) {
14759   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
14760                                       (vector signed long long)__b);
14761 }
14762
14763 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
14764                                               vector bool long long __b) {
14765   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14766                                       (vector signed long long)__b);
14767 }
14768
14769 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14770                                               vector signed long long __b) {
14771   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14772                                       (vector signed long long)__b);
14773 }
14774
14775 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14776                                               vector unsigned long long __b) {
14777   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14778                                       (vector signed long long)__b);
14779 }
14780
14781 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
14782                                               vector bool long long __b) {
14783   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
14784                                       (vector signed long long)__b);
14785 }
14786 #endif
14787
14788 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
14789                                               vector float __b) {
14790 #ifdef __VSX__
14791   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14792 #else
14793   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
14794 #endif
14795 }
14796
14797 #ifdef __VSX__
14798 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
14799                                               vector double __b) {
14800   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
14801 }
14802 #endif
14803
14804 /* vec_all_nge */
14805
14806 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
14807                                                vector float __b) {
14808 #ifdef __VSX__
14809   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
14810 #else
14811   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
14812 #endif
14813 }
14814
14815 #ifdef __VSX__
14816 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
14817                                                vector double __b) {
14818   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
14819 }
14820 #endif
14821
14822 /* vec_all_ngt */
14823
14824 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
14825                                                vector float __b) {
14826 #ifdef __VSX__
14827   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
14828 #else
14829   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
14830 #endif
14831 }
14832
14833 #ifdef __VSX__
14834 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
14835                                                vector double __b) {
14836   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
14837 }
14838 #endif
14839
14840 /* vec_all_nle */
14841
14842 static __inline__ int __attribute__((__always_inline__))
14843 vec_all_nle(vector float __a, vector float __b) {
14844   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
14845 }
14846
14847 /* vec_all_nlt */
14848
14849 static __inline__ int __attribute__((__always_inline__))
14850 vec_all_nlt(vector float __a, vector float __b) {
14851   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
14852 }
14853
14854 /* vec_all_numeric */
14855
14856 static __inline__ int __attribute__((__always_inline__))
14857 vec_all_numeric(vector float __a) {
14858   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
14859 }
14860
14861 /* vec_any_eq */
14862
14863 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14864                                               vector signed char __b) {
14865   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14866                                       (vector char)__b);
14867 }
14868
14869 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
14870                                               vector bool char __b) {
14871   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14872                                       (vector char)__b);
14873 }
14874
14875 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14876                                               vector unsigned char __b) {
14877   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14878                                       (vector char)__b);
14879 }
14880
14881 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
14882                                               vector bool char __b) {
14883   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14884                                       (vector char)__b);
14885 }
14886
14887 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14888                                               vector signed char __b) {
14889   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14890                                       (vector char)__b);
14891 }
14892
14893 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14894                                               vector unsigned char __b) {
14895   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14896                                       (vector char)__b);
14897 }
14898
14899 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
14900                                               vector bool char __b) {
14901   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
14902                                       (vector char)__b);
14903 }
14904
14905 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14906                                               vector short __b) {
14907   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
14908 }
14909
14910 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
14911                                               vector bool short __b) {
14912   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
14913 }
14914
14915 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14916                                               vector unsigned short __b) {
14917   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14918                                       (vector short)__b);
14919 }
14920
14921 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
14922                                               vector bool short __b) {
14923   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14924                                       (vector short)__b);
14925 }
14926
14927 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14928                                               vector short __b) {
14929   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14930                                       (vector short)__b);
14931 }
14932
14933 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14934                                               vector unsigned short __b) {
14935   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14936                                       (vector short)__b);
14937 }
14938
14939 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
14940                                               vector bool short __b) {
14941   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14942                                       (vector short)__b);
14943 }
14944
14945 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
14946                                               vector pixel __b) {
14947   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
14948                                       (vector short)__b);
14949 }
14950
14951 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
14952   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
14953 }
14954
14955 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
14956                                               vector bool int __b) {
14957   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
14958 }
14959
14960 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14961                                               vector unsigned int __b) {
14962   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14963                                       (vector int)__b);
14964 }
14965
14966 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
14967                                               vector bool int __b) {
14968   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14969                                       (vector int)__b);
14970 }
14971
14972 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14973                                               vector int __b) {
14974   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14975                                       (vector int)__b);
14976 }
14977
14978 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14979                                               vector unsigned int __b) {
14980   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14981                                       (vector int)__b);
14982 }
14983
14984 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
14985                                               vector bool int __b) {
14986   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
14987                                       (vector int)__b);
14988 }
14989
14990 #ifdef __POWER8_VECTOR__
14991 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
14992                                               vector signed long long __b) {
14993   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
14994 }
14995
14996 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
14997                                               vector unsigned long long __b) {
14998   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
14999                                       (vector long long)__b);
15000 }
15001
15002 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
15003                                               vector bool long long __b) {
15004   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
15005                                       (vector signed long long)__b);
15006 }
15007
15008 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
15009                                               vector bool long long __b) {
15010   return __builtin_altivec_vcmpequd_p(
15011       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15012 }
15013
15014 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15015                                               vector signed long long __b) {
15016   return __builtin_altivec_vcmpequd_p(
15017       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15018 }
15019
15020 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15021                                               vector unsigned long long __b) {
15022   return __builtin_altivec_vcmpequd_p(
15023       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15024 }
15025
15026 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
15027                                               vector bool long long __b) {
15028   return __builtin_altivec_vcmpequd_p(
15029       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
15030 }
15031 #endif
15032
15033 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
15034                                               vector float __b) {
15035 #ifdef __VSX__
15036   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
15037 #else
15038   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
15039 #endif
15040 }
15041
15042 #ifdef __VSX__
15043 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
15044                                               vector double __b) {
15045   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
15046 }
15047 #endif
15048
15049 /* vec_any_ge */
15050
15051 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15052                                               vector signed char __b) {
15053   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
15054 }
15055
15056 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
15057                                               vector bool char __b) {
15058   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
15059                                       __a);
15060 }
15061
15062 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15063                                               vector unsigned char __b) {
15064   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
15065 }
15066
15067 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
15068                                               vector bool char __b) {
15069   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15070                                       __a);
15071 }
15072
15073 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15074                                               vector signed char __b) {
15075   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15076                                       (vector unsigned char)__a);
15077 }
15078
15079 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15080                                               vector unsigned char __b) {
15081   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
15082                                       (vector unsigned char)__a);
15083 }
15084
15085 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
15086                                               vector bool char __b) {
15087   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
15088                                       (vector unsigned char)__a);
15089 }
15090
15091 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15092                                               vector short __b) {
15093   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
15094 }
15095
15096 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
15097                                               vector bool short __b) {
15098   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
15099 }
15100
15101 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15102                                               vector unsigned short __b) {
15103   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
15104 }
15105
15106 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
15107                                               vector bool short __b) {
15108   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15109                                       __a);
15110 }
15111
15112 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15113                                               vector short __b) {
15114   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15115                                       (vector unsigned short)__a);
15116 }
15117
15118 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15119                                               vector unsigned short __b) {
15120   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
15121                                       (vector unsigned short)__a);
15122 }
15123
15124 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
15125                                               vector bool short __b) {
15126   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
15127                                       (vector unsigned short)__a);
15128 }
15129
15130 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
15131   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
15132 }
15133
15134 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
15135                                               vector bool int __b) {
15136   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
15137 }
15138
15139 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15140                                               vector unsigned int __b) {
15141   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
15142 }
15143
15144 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
15145                                               vector bool int __b) {
15146   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15147                                       __a);
15148 }
15149
15150 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15151                                               vector int __b) {
15152   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15153                                       (vector unsigned int)__a);
15154 }
15155
15156 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15157                                               vector unsigned int __b) {
15158   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
15159                                       (vector unsigned int)__a);
15160 }
15161
15162 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
15163                                               vector bool int __b) {
15164   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
15165                                       (vector unsigned int)__a);
15166 }
15167
15168 #ifdef __POWER8_VECTOR__
15169 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15170                                               vector signed long long __b) {
15171   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
15172 }
15173
15174 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15175                                               vector unsigned long long __b) {
15176   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
15177 }
15178
15179 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
15180                                               vector bool long long __b) {
15181   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
15182                                       (vector signed long long)__b, __a);
15183 }
15184
15185 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
15186                                               vector bool long long __b) {
15187   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15188                                       (vector unsigned long long)__b, __a);
15189 }
15190
15191 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15192                                               vector signed long long __b) {
15193   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15194                                       (vector unsigned long long)__b,
15195                                       (vector unsigned long long)__a);
15196 }
15197
15198 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15199                                               vector unsigned long long __b) {
15200   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
15201                                       (vector unsigned long long)__a);
15202 }
15203
15204 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
15205                                               vector bool long long __b) {
15206   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15207                                       (vector unsigned long long)__b,
15208                                       (vector unsigned long long)__a);
15209 }
15210 #endif
15211
15212 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
15213                                               vector float __b) {
15214 #ifdef __VSX__
15215   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
15216 #else
15217   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
15218 #endif
15219 }
15220
15221 #ifdef __VSX__
15222 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
15223                                               vector double __b) {
15224   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
15225 }
15226 #endif
15227
15228 /* vec_any_gt */
15229
15230 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15231                                               vector signed char __b) {
15232   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
15233 }
15234
15235 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
15236                                               vector bool char __b) {
15237   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
15238                                       (vector signed char)__b);
15239 }
15240
15241 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15242                                               vector unsigned char __b) {
15243   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
15244 }
15245
15246 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
15247                                               vector bool char __b) {
15248   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
15249                                       (vector unsigned char)__b);
15250 }
15251
15252 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15253                                               vector signed char __b) {
15254   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15255                                       (vector unsigned char)__b);
15256 }
15257
15258 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15259                                               vector unsigned char __b) {
15260   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15261                                       __b);
15262 }
15263
15264 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
15265                                               vector bool char __b) {
15266   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
15267                                       (vector unsigned char)__b);
15268 }
15269
15270 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15271                                               vector short __b) {
15272   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
15273 }
15274
15275 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
15276                                               vector bool short __b) {
15277   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
15278 }
15279
15280 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15281                                               vector unsigned short __b) {
15282   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
15283 }
15284
15285 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
15286                                               vector bool short __b) {
15287   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
15288                                       (vector unsigned short)__b);
15289 }
15290
15291 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15292                                               vector short __b) {
15293   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15294                                       (vector unsigned short)__b);
15295 }
15296
15297 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15298                                               vector unsigned short __b) {
15299   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15300                                       __b);
15301 }
15302
15303 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
15304                                               vector bool short __b) {
15305   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
15306                                       (vector unsigned short)__b);
15307 }
15308
15309 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
15310   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
15311 }
15312
15313 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
15314                                               vector bool int __b) {
15315   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
15316 }
15317
15318 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15319                                               vector unsigned int __b) {
15320   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
15321 }
15322
15323 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
15324                                               vector bool int __b) {
15325   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
15326                                       (vector unsigned int)__b);
15327 }
15328
15329 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15330                                               vector int __b) {
15331   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15332                                       (vector unsigned int)__b);
15333 }
15334
15335 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15336                                               vector unsigned int __b) {
15337   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15338                                       __b);
15339 }
15340
15341 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
15342                                               vector bool int __b) {
15343   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
15344                                       (vector unsigned int)__b);
15345 }
15346
15347 #ifdef __POWER8_VECTOR__
15348 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15349                                               vector signed long long __b) {
15350   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
15351 }
15352
15353 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15354                                               vector unsigned long long __b) {
15355   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
15356 }
15357
15358 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
15359                                               vector bool long long __b) {
15360   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
15361                                       (vector signed long long)__b);
15362 }
15363
15364 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
15365                                               vector bool long long __b) {
15366   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
15367                                       (vector unsigned long long)__b);
15368 }
15369
15370 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15371                                               vector signed long long __b) {
15372   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15373                                       (vector unsigned long long)__a,
15374                                       (vector unsigned long long)__b);
15375 }
15376
15377 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15378                                               vector unsigned long long __b) {
15379   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15380                                       (vector unsigned long long)__a, __b);
15381 }
15382
15383 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
15384                                               vector bool long long __b) {
15385   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15386                                       (vector unsigned long long)__a,
15387                                       (vector unsigned long long)__b);
15388 }
15389 #endif
15390
15391 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
15392                                               vector float __b) {
15393 #ifdef __VSX__
15394   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
15395 #else
15396   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
15397 #endif
15398 }
15399
15400 #ifdef __VSX__
15401 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
15402                                               vector double __b) {
15403   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
15404 }
15405 #endif
15406
15407 /* vec_any_le */
15408
15409 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15410                                               vector signed char __b) {
15411   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
15412 }
15413
15414 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
15415                                               vector bool char __b) {
15416   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
15417                                       (vector signed char)__b);
15418 }
15419
15420 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15421                                               vector unsigned char __b) {
15422   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
15423 }
15424
15425 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
15426                                               vector bool char __b) {
15427   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
15428                                       (vector unsigned char)__b);
15429 }
15430
15431 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15432                                               vector signed char __b) {
15433   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15434                                       (vector unsigned char)__b);
15435 }
15436
15437 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15438                                               vector unsigned char __b) {
15439   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15440                                       __b);
15441 }
15442
15443 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
15444                                               vector bool char __b) {
15445   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
15446                                       (vector unsigned char)__b);
15447 }
15448
15449 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15450                                               vector short __b) {
15451   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
15452 }
15453
15454 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
15455                                               vector bool short __b) {
15456   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
15457 }
15458
15459 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15460                                               vector unsigned short __b) {
15461   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
15462 }
15463
15464 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
15465                                               vector bool short __b) {
15466   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
15467                                       (vector unsigned short)__b);
15468 }
15469
15470 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15471                                               vector short __b) {
15472   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15473                                       (vector unsigned short)__b);
15474 }
15475
15476 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15477                                               vector unsigned short __b) {
15478   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15479                                       __b);
15480 }
15481
15482 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
15483                                               vector bool short __b) {
15484   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
15485                                       (vector unsigned short)__b);
15486 }
15487
15488 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
15489   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
15490 }
15491
15492 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
15493                                               vector bool int __b) {
15494   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
15495 }
15496
15497 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15498                                               vector unsigned int __b) {
15499   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
15500 }
15501
15502 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
15503                                               vector bool int __b) {
15504   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
15505                                       (vector unsigned int)__b);
15506 }
15507
15508 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15509                                               vector int __b) {
15510   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15511                                       (vector unsigned int)__b);
15512 }
15513
15514 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15515                                               vector unsigned int __b) {
15516   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15517                                       __b);
15518 }
15519
15520 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
15521                                               vector bool int __b) {
15522   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
15523                                       (vector unsigned int)__b);
15524 }
15525
15526 #ifdef __POWER8_VECTOR__
15527 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15528                                               vector signed long long __b) {
15529   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
15530 }
15531
15532 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15533                                               vector unsigned long long __b) {
15534   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
15535 }
15536
15537 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
15538                                               vector bool long long __b) {
15539   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
15540                                       (vector signed long long)__b);
15541 }
15542
15543 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
15544                                               vector bool long long __b) {
15545   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
15546                                       (vector unsigned long long)__b);
15547 }
15548
15549 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15550                                               vector signed long long __b) {
15551   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15552                                       (vector unsigned long long)__a,
15553                                       (vector unsigned long long)__b);
15554 }
15555
15556 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15557                                               vector unsigned long long __b) {
15558   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15559                                       (vector unsigned long long)__a, __b);
15560 }
15561
15562 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
15563                                               vector bool long long __b) {
15564   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
15565                                       (vector unsigned long long)__a,
15566                                       (vector unsigned long long)__b);
15567 }
15568 #endif
15569
15570 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
15571                                               vector float __b) {
15572 #ifdef __VSX__
15573   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
15574 #else
15575   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
15576 #endif
15577 }
15578
15579 #ifdef __VSX__
15580 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
15581                                               vector double __b) {
15582   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
15583 }
15584 #endif
15585
15586 /* vec_any_lt */
15587
15588 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15589                                               vector signed char __b) {
15590   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
15591 }
15592
15593 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
15594                                               vector bool char __b) {
15595   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
15596                                       __a);
15597 }
15598
15599 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15600                                               vector unsigned char __b) {
15601   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
15602 }
15603
15604 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
15605                                               vector bool char __b) {
15606   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15607                                       __a);
15608 }
15609
15610 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15611                                               vector signed char __b) {
15612   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15613                                       (vector unsigned char)__a);
15614 }
15615
15616 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15617                                               vector unsigned char __b) {
15618   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
15619                                       (vector unsigned char)__a);
15620 }
15621
15622 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
15623                                               vector bool char __b) {
15624   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
15625                                       (vector unsigned char)__a);
15626 }
15627
15628 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15629                                               vector short __b) {
15630   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
15631 }
15632
15633 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
15634                                               vector bool short __b) {
15635   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
15636 }
15637
15638 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15639                                               vector unsigned short __b) {
15640   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
15641 }
15642
15643 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
15644                                               vector bool short __b) {
15645   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15646                                       __a);
15647 }
15648
15649 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15650                                               vector short __b) {
15651   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15652                                       (vector unsigned short)__a);
15653 }
15654
15655 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15656                                               vector unsigned short __b) {
15657   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
15658                                       (vector unsigned short)__a);
15659 }
15660
15661 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
15662                                               vector bool short __b) {
15663   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
15664                                       (vector unsigned short)__a);
15665 }
15666
15667 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
15668   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
15669 }
15670
15671 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
15672                                               vector bool int __b) {
15673   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
15674 }
15675
15676 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15677                                               vector unsigned int __b) {
15678   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
15679 }
15680
15681 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
15682                                               vector bool int __b) {
15683   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15684                                       __a);
15685 }
15686
15687 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15688                                               vector int __b) {
15689   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15690                                       (vector unsigned int)__a);
15691 }
15692
15693 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15694                                               vector unsigned int __b) {
15695   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
15696                                       (vector unsigned int)__a);
15697 }
15698
15699 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
15700                                               vector bool int __b) {
15701   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
15702                                       (vector unsigned int)__a);
15703 }
15704
15705 #ifdef __POWER8_VECTOR__
15706 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15707                                               vector signed long long __b) {
15708   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
15709 }
15710
15711 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15712                                               vector unsigned long long __b) {
15713   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
15714 }
15715
15716 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
15717                                               vector bool long long __b) {
15718   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
15719                                       (vector signed long long)__b, __a);
15720 }
15721
15722 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
15723                                               vector bool long long __b) {
15724   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15725                                       (vector unsigned long long)__b, __a);
15726 }
15727
15728 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15729                                               vector signed long long __b) {
15730   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15731                                       (vector unsigned long long)__b,
15732                                       (vector unsigned long long)__a);
15733 }
15734
15735 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15736                                               vector unsigned long long __b) {
15737   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
15738                                       (vector unsigned long long)__a);
15739 }
15740
15741 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
15742                                               vector bool long long __b) {
15743   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
15744                                       (vector unsigned long long)__b,
15745                                       (vector unsigned long long)__a);
15746 }
15747 #endif
15748
15749 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
15750                                               vector float __b) {
15751 #ifdef __VSX__
15752   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
15753 #else
15754   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
15755 #endif
15756 }
15757
15758 #ifdef __VSX__
15759 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
15760                                               vector double __b) {
15761   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
15762 }
15763 #endif
15764
15765 /* vec_any_nan */
15766
15767 static __inline__ int __attribute__((__always_inline__))
15768 vec_any_nan(vector float __a) {
15769   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
15770 }
15771
15772 /* vec_any_ne */
15773
15774 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15775                                               vector signed char __b) {
15776   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15777                                       (vector char)__b);
15778 }
15779
15780 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
15781                                               vector bool char __b) {
15782   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15783                                       (vector char)__b);
15784 }
15785
15786 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15787                                               vector unsigned char __b) {
15788   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15789                                       (vector char)__b);
15790 }
15791
15792 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
15793                                               vector bool char __b) {
15794   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15795                                       (vector char)__b);
15796 }
15797
15798 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15799                                               vector signed char __b) {
15800   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15801                                       (vector char)__b);
15802 }
15803
15804 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15805                                               vector unsigned char __b) {
15806   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15807                                       (vector char)__b);
15808 }
15809
15810 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
15811                                               vector bool char __b) {
15812   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
15813                                       (vector char)__b);
15814 }
15815
15816 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15817                                               vector short __b) {
15818   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
15819 }
15820
15821 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
15822                                               vector bool short __b) {
15823   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
15824 }
15825
15826 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15827                                               vector unsigned short __b) {
15828   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15829                                       (vector short)__b);
15830 }
15831
15832 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
15833                                               vector bool short __b) {
15834   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15835                                       (vector short)__b);
15836 }
15837
15838 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15839                                               vector short __b) {
15840   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15841                                       (vector short)__b);
15842 }
15843
15844 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15845                                               vector unsigned short __b) {
15846   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15847                                       (vector short)__b);
15848 }
15849
15850 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
15851                                               vector bool short __b) {
15852   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15853                                       (vector short)__b);
15854 }
15855
15856 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
15857                                               vector pixel __b) {
15858   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
15859                                       (vector short)__b);
15860 }
15861
15862 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
15863   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
15864 }
15865
15866 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
15867                                               vector bool int __b) {
15868   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
15869 }
15870
15871 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15872                                               vector unsigned int __b) {
15873   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15874                                       (vector int)__b);
15875 }
15876
15877 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
15878                                               vector bool int __b) {
15879   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15880                                       (vector int)__b);
15881 }
15882
15883 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15884                                               vector int __b) {
15885   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15886                                       (vector int)__b);
15887 }
15888
15889 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15890                                               vector unsigned int __b) {
15891   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15892                                       (vector int)__b);
15893 }
15894
15895 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
15896                                               vector bool int __b) {
15897   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
15898                                       (vector int)__b);
15899 }
15900
15901 #ifdef __POWER8_VECTOR__
15902 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15903                                               vector signed long long __b) {
15904   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
15905 }
15906
15907 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15908                                               vector unsigned long long __b) {
15909   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
15910                                       (vector long long)__b);
15911 }
15912
15913 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
15914                                               vector bool long long __b) {
15915   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
15916                                       (vector signed long long)__b);
15917 }
15918
15919 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
15920                                               vector bool long long __b) {
15921   return __builtin_altivec_vcmpequd_p(
15922       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15923 }
15924
15925 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15926                                               vector signed long long __b) {
15927   return __builtin_altivec_vcmpequd_p(
15928       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15929 }
15930
15931 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15932                                               vector unsigned long long __b) {
15933   return __builtin_altivec_vcmpequd_p(
15934       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15935 }
15936
15937 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
15938                                               vector bool long long __b) {
15939   return __builtin_altivec_vcmpequd_p(
15940       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
15941 }
15942 #endif
15943
15944 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
15945                                               vector float __b) {
15946 #ifdef __VSX__
15947   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
15948 #else
15949   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
15950 #endif
15951 }
15952
15953 #ifdef __VSX__
15954 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
15955                                               vector double __b) {
15956   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
15957 }
15958 #endif
15959
15960 /* vec_any_nge */
15961
15962 static __inline__ int __attribute__((__always_inline__))
15963 vec_any_nge(vector float __a, vector float __b) {
15964   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
15965 }
15966
15967 /* vec_any_ngt */
15968
15969 static __inline__ int __attribute__((__always_inline__))
15970 vec_any_ngt(vector float __a, vector float __b) {
15971   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
15972 }
15973
15974 /* vec_any_nle */
15975
15976 static __inline__ int __attribute__((__always_inline__))
15977 vec_any_nle(vector float __a, vector float __b) {
15978   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
15979 }
15980
15981 /* vec_any_nlt */
15982
15983 static __inline__ int __attribute__((__always_inline__))
15984 vec_any_nlt(vector float __a, vector float __b) {
15985   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
15986 }
15987
15988 /* vec_any_numeric */
15989
15990 static __inline__ int __attribute__((__always_inline__))
15991 vec_any_numeric(vector float __a) {
15992   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
15993 }
15994
15995 /* vec_any_out */
15996
15997 static __inline__ int __attribute__((__always_inline__))
15998 vec_any_out(vector float __a, vector float __b) {
15999   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
16000 }
16001
16002 /* Power 8 Crypto functions
16003 Note: We diverge from the current GCC implementation with regard
16004 to cryptography and related functions as follows:
16005 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
16006 - The remaining ones are only available on Power8 and up so
16007   require -mpower8-vector
16008 The justification for this is that export requirements require that
16009 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
16010 support). As a result, we need to be able to turn off support for those.
16011 The remaining ones (currently controlled by -mcrypto for GCC) still
16012 need to be provided on compliant hardware even if Vector.Crypto is not
16013 provided.
16014 */
16015 #ifdef __CRYPTO__
16016 #define vec_sbox_be __builtin_altivec_crypto_vsbox
16017 #define vec_cipher_be __builtin_altivec_crypto_vcipher
16018 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
16019 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
16020 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
16021
16022 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16023 __builtin_crypto_vsbox(vector unsigned long long __a) {
16024   return __builtin_altivec_crypto_vsbox(__a);
16025 }
16026
16027 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16028 __builtin_crypto_vcipher(vector unsigned long long __a,
16029                          vector unsigned long long __b) {
16030   return __builtin_altivec_crypto_vcipher(__a, __b);
16031 }
16032
16033 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16034 __builtin_crypto_vcipherlast(vector unsigned long long __a,
16035                              vector unsigned long long __b) {
16036   return __builtin_altivec_crypto_vcipherlast(__a, __b);
16037 }
16038
16039 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16040 __builtin_crypto_vncipher(vector unsigned long long __a,
16041                           vector unsigned long long __b) {
16042   return __builtin_altivec_crypto_vncipher(__a, __b);
16043 }
16044
16045 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16046 __builtin_crypto_vncipherlast(vector unsigned long long __a,
16047                               vector unsigned long long __b) {
16048   return __builtin_altivec_crypto_vncipherlast(__a, __b);
16049 }
16050
16051 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
16052 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
16053
16054 #define vec_shasigma_be(X, Y, Z)                                               \
16055   _Generic((X), vector unsigned int                                            \
16056            : __builtin_crypto_vshasigmaw, vector unsigned long long            \
16057            : __builtin_crypto_vshasigmad)((X), (Y), (Z))
16058 #endif
16059
16060 #ifdef __POWER8_VECTOR__
16061 static __inline__ vector bool char __ATTRS_o_ai
16062 vec_permxor(vector bool char __a, vector bool char __b,
16063             vector bool char __c) {
16064   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16065 }
16066
16067 static __inline__ vector signed char __ATTRS_o_ai
16068 vec_permxor(vector signed char __a, vector signed char __b,
16069             vector signed char __c) {
16070   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16071 }
16072
16073 static __inline__ vector unsigned char __ATTRS_o_ai
16074 vec_permxor(vector unsigned char __a, vector unsigned char __b,
16075             vector unsigned char __c) {
16076   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16077 }
16078
16079 static __inline__ vector unsigned char __ATTRS_o_ai
16080 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
16081                           vector unsigned char __c) {
16082   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
16083 }
16084
16085 static __inline__ vector unsigned short __ATTRS_o_ai
16086 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
16087                           vector unsigned short __c) {
16088   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
16089       (vector unsigned char)__a, (vector unsigned char)__b,
16090       (vector unsigned char)__c);
16091 }
16092
16093 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
16094     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
16095   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
16096       (vector unsigned char)__a, (vector unsigned char)__b,
16097       (vector unsigned char)__c);
16098 }
16099
16100 static __inline__ vector unsigned long long __ATTRS_o_ai
16101 __builtin_crypto_vpermxor(vector unsigned long long __a,
16102                           vector unsigned long long __b,
16103                           vector unsigned long long __c) {
16104   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
16105       (vector unsigned char)__a, (vector unsigned char)__b,
16106       (vector unsigned char)__c);
16107 }
16108
16109 static __inline__ vector unsigned char __ATTRS_o_ai
16110 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
16111   return __builtin_altivec_crypto_vpmsumb(__a, __b);
16112 }
16113
16114 static __inline__ vector unsigned short __ATTRS_o_ai
16115 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
16116   return __builtin_altivec_crypto_vpmsumh(__a, __b);
16117 }
16118
16119 static __inline__ vector unsigned int __ATTRS_o_ai
16120 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
16121   return __builtin_altivec_crypto_vpmsumw(__a, __b);
16122 }
16123
16124 static __inline__ vector unsigned long long __ATTRS_o_ai
16125 __builtin_crypto_vpmsumb(vector unsigned long long __a,
16126                          vector unsigned long long __b) {
16127   return __builtin_altivec_crypto_vpmsumd(__a, __b);
16128 }
16129
16130 static __inline__ vector signed char __ATTRS_o_ai
16131 vec_vgbbd(vector signed char __a) {
16132   return __builtin_altivec_vgbbd((vector unsigned char)__a);
16133 }
16134
16135 #define vec_pmsum_be __builtin_crypto_vpmsumb
16136 #define vec_gb __builtin_altivec_vgbbd
16137
16138 static __inline__ vector unsigned char __ATTRS_o_ai
16139 vec_vgbbd(vector unsigned char __a) {
16140   return __builtin_altivec_vgbbd(__a);
16141 }
16142
16143 static __inline__ vector long long __ATTRS_o_ai
16144 vec_vbpermq(vector signed char __a, vector signed char __b) {
16145   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16146                                    (vector unsigned char)__b);
16147 }
16148
16149 static __inline__ vector long long __ATTRS_o_ai
16150 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
16151   return __builtin_altivec_vbpermq(__a, __b);
16152 }
16153
16154 #ifdef __powerpc64__
16155 static __inline__ vector unsigned long long __attribute__((__always_inline__))
16156 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
16157   return __builtin_altivec_vbpermq((vector unsigned char)__a,
16158                                    (vector unsigned char)__b);
16159 }
16160 #endif
16161 #endif
16162
16163
16164 /* vec_reve */
16165
16166 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
16167   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16168                                  5, 4, 3, 2, 1, 0);
16169 }
16170
16171 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
16172   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16173                                  5, 4, 3, 2, 1, 0);
16174 }
16175
16176 static inline __ATTRS_o_ai vector unsigned char
16177 vec_reve(vector unsigned char __a) {
16178   return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
16179                                  5, 4, 3, 2, 1, 0);
16180 }
16181
16182 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
16183   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16184 }
16185
16186 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
16187   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16188 }
16189
16190 static inline __ATTRS_o_ai vector unsigned int
16191 vec_reve(vector unsigned int __a) {
16192   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16193 }
16194
16195 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
16196   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16197 }
16198
16199 static inline __ATTRS_o_ai vector signed short
16200 vec_reve(vector signed short __a) {
16201   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16202 }
16203
16204 static inline __ATTRS_o_ai vector unsigned short
16205 vec_reve(vector unsigned short __a) {
16206   return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
16207 }
16208
16209 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
16210   return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
16211 }
16212
16213 #ifdef __VSX__
16214 static inline __ATTRS_o_ai vector bool long long
16215 vec_reve(vector bool long long __a) {
16216   return __builtin_shufflevector(__a, __a, 1, 0);
16217 }
16218
16219 static inline __ATTRS_o_ai vector signed long long
16220 vec_reve(vector signed long long __a) {
16221   return __builtin_shufflevector(__a, __a, 1, 0);
16222 }
16223
16224 static inline __ATTRS_o_ai vector unsigned long long
16225 vec_reve(vector unsigned long long __a) {
16226   return __builtin_shufflevector(__a, __a, 1, 0);
16227 }
16228
16229 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
16230   return __builtin_shufflevector(__a, __a, 1, 0);
16231 }
16232 #endif
16233
16234 /* vec_revb */
16235 static __inline__ vector bool char __ATTRS_o_ai
16236 vec_revb(vector bool char __a) {
16237   return __a;
16238 }
16239
16240 static __inline__ vector signed char __ATTRS_o_ai
16241 vec_revb(vector signed char __a) {
16242   return __a;
16243 }
16244
16245 static __inline__ vector unsigned char __ATTRS_o_ai
16246 vec_revb(vector unsigned char __a) {
16247   return __a;
16248 }
16249
16250 static __inline__ vector bool short __ATTRS_o_ai
16251 vec_revb(vector bool short __a) {
16252   vector unsigned char __indices =
16253       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16254   return vec_perm(__a, __a, __indices);
16255 }
16256
16257 static __inline__ vector signed short __ATTRS_o_ai
16258 vec_revb(vector signed short __a) {
16259   vector unsigned char __indices =
16260       { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16261   return vec_perm(__a, __a, __indices);
16262 }
16263
16264 static __inline__ vector unsigned short __ATTRS_o_ai
16265 vec_revb(vector unsigned short __a) {
16266   vector unsigned char __indices =
16267      { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
16268   return vec_perm(__a, __a, __indices);
16269 }
16270
16271 static __inline__ vector bool int __ATTRS_o_ai
16272 vec_revb(vector bool int __a) {
16273   vector unsigned char __indices =
16274       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16275   return vec_perm(__a, __a, __indices);
16276 }
16277
16278 static __inline__ vector signed int __ATTRS_o_ai
16279 vec_revb(vector signed int __a) {
16280   vector unsigned char __indices =
16281       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16282   return vec_perm(__a, __a, __indices);
16283 }
16284
16285 static __inline__ vector unsigned int __ATTRS_o_ai
16286 vec_revb(vector unsigned int __a) {
16287   vector unsigned char __indices =
16288       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16289   return vec_perm(__a, __a, __indices);
16290 }
16291
16292 static __inline__ vector float __ATTRS_o_ai
16293 vec_revb(vector float __a) {
16294  vector unsigned char __indices =
16295       { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
16296  return vec_perm(__a, __a, __indices);
16297 }
16298
16299 #ifdef __VSX__
16300 static __inline__ vector bool long long __ATTRS_o_ai
16301 vec_revb(vector bool long long __a) {
16302   vector unsigned char __indices =
16303       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16304   return vec_perm(__a, __a, __indices);
16305 }
16306
16307 static __inline__ vector signed long long __ATTRS_o_ai
16308 vec_revb(vector signed long long __a) {
16309   vector unsigned char __indices =
16310       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16311   return vec_perm(__a, __a, __indices);
16312 }
16313
16314 static __inline__ vector unsigned long long __ATTRS_o_ai
16315 vec_revb(vector unsigned long long __a) {
16316   vector unsigned char __indices =
16317       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16318   return vec_perm(__a, __a, __indices);
16319 }
16320
16321 static __inline__ vector double __ATTRS_o_ai
16322 vec_revb(vector double __a) {
16323   vector unsigned char __indices =
16324       { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
16325   return vec_perm(__a, __a, __indices);
16326 }
16327 #endif /* End __VSX__ */
16328
16329 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16330 static __inline__ vector signed __int128 __ATTRS_o_ai
16331 vec_revb(vector signed __int128 __a) {
16332   vector unsigned char __indices =
16333       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16334   return (vector signed __int128)vec_perm((vector signed int)__a,
16335                                           (vector signed int)__a,
16336                                            __indices);
16337 }
16338
16339 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16340 vec_revb(vector unsigned __int128 __a) {
16341   vector unsigned char __indices =
16342       { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
16343   return (vector unsigned __int128)vec_perm((vector signed int)__a,
16344                                             (vector signed int)__a,
16345                                              __indices);
16346 }
16347 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
16348
16349 /* vec_xl */
16350
16351 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
16352                                                      signed char *__ptr) {
16353   return *(vector signed char *)(__ptr + __offset);
16354 }
16355
16356 static inline __ATTRS_o_ai vector unsigned char
16357 vec_xl(signed long long __offset, unsigned char *__ptr) {
16358   return *(vector unsigned char *)(__ptr + __offset);
16359 }
16360
16361 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
16362                                                       signed short *__ptr) {
16363   return *(vector signed short *)(__ptr + __offset);
16364 }
16365
16366 static inline __ATTRS_o_ai vector unsigned short
16367 vec_xl(signed long long __offset, unsigned short *__ptr) {
16368   return *(vector unsigned short *)(__ptr + __offset);
16369 }
16370
16371 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
16372                                                     signed int *__ptr) {
16373   return *(vector signed int *)(__ptr + __offset);
16374 }
16375
16376 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
16377                                                       unsigned int *__ptr) {
16378   return *(vector unsigned int *)(__ptr + __offset);
16379 }
16380
16381 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
16382                                                float *__ptr) {
16383   return *(vector float *)(__ptr + __offset);
16384 }
16385
16386 #ifdef __VSX__
16387 static inline __ATTRS_o_ai vector signed long long
16388 vec_xl(signed long long __offset, signed long long *__ptr) {
16389   return *(vector signed long long *)(__ptr + __offset);
16390 }
16391
16392 static inline __ATTRS_o_ai vector unsigned long long
16393 vec_xl(signed long long __offset, unsigned long long *__ptr) {
16394   return *(vector unsigned long long *)(__ptr + __offset);
16395 }
16396
16397 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
16398                                                 double *__ptr) {
16399   return *(vector double *)(__ptr + __offset);
16400 }
16401 #endif
16402
16403 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16404 static inline __ATTRS_o_ai vector signed __int128
16405 vec_xl(signed long long __offset, signed __int128 *__ptr) {
16406   return *(vector signed __int128 *)(__ptr + __offset);
16407 }
16408
16409 static inline __ATTRS_o_ai vector unsigned __int128
16410 vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
16411   return *(vector unsigned __int128 *)(__ptr + __offset);
16412 }
16413 #endif
16414
16415 /* vec_xl_be */
16416
16417 #ifdef __LITTLE_ENDIAN__
16418 static __inline__ vector signed char __ATTRS_o_ai
16419 vec_xl_be(signed long long __offset, signed char *__ptr) {
16420   vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16421   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16422                                  13, 12, 11, 10, 9, 8);
16423 }
16424
16425 static __inline__ vector unsigned char __ATTRS_o_ai
16426 vec_xl_be(signed long long __offset, unsigned char *__ptr) {
16427   vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16428   return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16429                                  13, 12, 11, 10, 9, 8);
16430 }
16431
16432 static __inline__ vector signed short  __ATTRS_o_ai
16433 vec_xl_be(signed long long __offset, signed short *__ptr) {
16434   vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16435   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16436 }
16437
16438 static __inline__ vector unsigned short __ATTRS_o_ai
16439 vec_xl_be(signed long long __offset, unsigned short *__ptr) {
16440   vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
16441   return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16442 }
16443
16444 static __inline__ vector signed int __ATTRS_o_ai
16445 vec_xl_be(signed long long  __offset, signed int *__ptr) {
16446   return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16447 }
16448
16449 static __inline__ vector unsigned int __ATTRS_o_ai
16450 vec_xl_be(signed long long  __offset, unsigned int *__ptr) {
16451   return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16452 }
16453
16454 static __inline__ vector float __ATTRS_o_ai
16455 vec_xl_be(signed long long  __offset, float *__ptr) {
16456   return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
16457 }
16458
16459 #ifdef __VSX__
16460 static __inline__ vector signed long long __ATTRS_o_ai
16461 vec_xl_be(signed long long  __offset, signed long long *__ptr) {
16462   return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16463 }
16464
16465 static __inline__ vector unsigned long long __ATTRS_o_ai
16466 vec_xl_be(signed long long  __offset, unsigned long long *__ptr) {
16467   return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16468 }
16469
16470 static __inline__ vector double __ATTRS_o_ai
16471 vec_xl_be(signed long long  __offset, double *__ptr) {
16472   return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
16473 }
16474 #endif
16475
16476 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16477 static __inline__ vector signed __int128 __ATTRS_o_ai
16478 vec_xl_be(signed long long  __offset, signed __int128 *__ptr) {
16479   return vec_xl(__offset, __ptr);
16480 }
16481
16482 static __inline__ vector unsigned __int128 __ATTRS_o_ai
16483 vec_xl_be(signed long long  __offset, unsigned __int128 *__ptr) {
16484   return vec_xl(__offset, __ptr);
16485 }
16486 #endif
16487 #else
16488   #define vec_xl_be vec_xl
16489 #endif
16490
16491 /* vec_xst */
16492
16493 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
16494                                         signed long long __offset,
16495                                         signed char *__ptr) {
16496   *(vector signed char *)(__ptr + __offset) = __vec;
16497 }
16498
16499 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
16500                                         signed long long __offset,
16501                                         unsigned char *__ptr) {
16502   *(vector unsigned char *)(__ptr + __offset) = __vec;
16503 }
16504
16505 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
16506                                         signed long long __offset,
16507                                         signed short *__ptr) {
16508   *(vector signed short *)(__ptr + __offset) = __vec;
16509 }
16510
16511 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
16512                                         signed long long __offset,
16513                                         unsigned short *__ptr) {
16514   *(vector unsigned short *)(__ptr + __offset) = __vec;
16515 }
16516
16517 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
16518                                         signed long long __offset,
16519                                         signed int *__ptr) {
16520   *(vector signed int *)(__ptr + __offset) = __vec;
16521 }
16522
16523 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
16524                                         signed long long __offset,
16525                                         unsigned int *__ptr) {
16526   *(vector unsigned int *)(__ptr + __offset) = __vec;
16527 }
16528
16529 static inline __ATTRS_o_ai void vec_xst(vector float __vec,
16530                                         signed long long __offset,
16531                                         float *__ptr) {
16532   *(vector float *)(__ptr + __offset) = __vec;
16533 }
16534
16535 #ifdef __VSX__
16536 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
16537                                         signed long long __offset,
16538                                         signed long long *__ptr) {
16539   *(vector signed long long *)(__ptr + __offset) = __vec;
16540 }
16541
16542 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
16543                                         signed long long __offset,
16544                                         unsigned long long *__ptr) {
16545   *(vector unsigned long long *)(__ptr + __offset) = __vec;
16546 }
16547
16548 static inline __ATTRS_o_ai void vec_xst(vector double __vec,
16549                                         signed long long __offset,
16550                                         double *__ptr) {
16551   *(vector double *)(__ptr + __offset) = __vec;
16552 }
16553 #endif
16554
16555 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16556 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
16557                                         signed long long __offset,
16558                                         signed __int128 *__ptr) {
16559   *(vector signed __int128 *)(__ptr + __offset) = __vec;
16560 }
16561
16562 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
16563                                         signed long long __offset,
16564                                         unsigned __int128 *__ptr) {
16565   *(vector unsigned __int128 *)(__ptr + __offset) = __vec;
16566 }
16567 #endif
16568
16569 /* vec_xst_be */
16570
16571 #ifdef __LITTLE_ENDIAN__
16572 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
16573                                                signed long long  __offset,
16574                                                signed char *__ptr) {
16575   vector signed char __tmp =
16576      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16577                              13, 12, 11, 10, 9, 8);
16578   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16579 }
16580
16581 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
16582                                                signed long long  __offset,
16583                                                unsigned char *__ptr) {
16584   vector unsigned char __tmp =
16585      __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
16586                              13, 12, 11, 10, 9, 8);
16587   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16588 }
16589
16590 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
16591                                                signed long long  __offset,
16592                                                signed short *__ptr) {
16593   vector signed short __tmp =
16594      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16595   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16596 }
16597
16598 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
16599                                                signed long long  __offset,
16600                                                unsigned short *__ptr) {
16601   vector unsigned short __tmp =
16602      __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
16603   __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
16604 }
16605
16606 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
16607                                                signed long long  __offset,
16608                                                signed int *__ptr) {
16609   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16610 }
16611
16612 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
16613                                                signed long long  __offset,
16614                                                unsigned int *__ptr) {
16615   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16616 }
16617
16618 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
16619                                                signed long long  __offset,
16620                                                float *__ptr) {
16621   __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
16622 }
16623
16624 #ifdef __VSX__
16625 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
16626                                                signed long long  __offset,
16627                                                signed long long *__ptr) {
16628   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16629 }
16630
16631 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
16632                                                signed long long  __offset,
16633                                                unsigned long long *__ptr) {
16634   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16635 }
16636
16637 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
16638                                                signed long long  __offset,
16639                                                double *__ptr) {
16640   __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
16641 }
16642 #endif
16643
16644 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16645 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
16646                                                signed long long  __offset,
16647                                                signed __int128 *__ptr) {
16648   vec_xst(__vec, __offset, __ptr);
16649 }
16650
16651 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
16652                                                signed long long  __offset,
16653                                                unsigned __int128 *__ptr) {
16654   vec_xst(__vec, __offset, __ptr);
16655 }
16656 #endif
16657 #else
16658   #define vec_xst_be vec_xst
16659 #endif
16660
16661 #ifdef __POWER9_VECTOR__
16662 #define vec_test_data_class(__a, __b)                                      \
16663         _Generic((__a),                                                    \
16664            vector float:                                                   \
16665              (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)),       \
16666            vector double:                                                  \
16667              (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b))  \
16668         )
16669
16670 #endif /* #ifdef __POWER9_VECTOR__ */
16671
16672 static vector float __ATTRS_o_ai vec_neg(vector float __a) {
16673   return -__a;
16674 }
16675
16676 #ifdef __VSX__
16677 static vector double __ATTRS_o_ai vec_neg(vector double __a) {
16678   return -__a;
16679 }
16680
16681 #endif
16682
16683 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16684 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
16685   return -__a;
16686 }
16687 #endif
16688
16689 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
16690   return -__a;
16691 }
16692
16693 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
16694   return -__a;
16695 }
16696
16697 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
16698   return -__a;
16699 }
16700
16701 static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
16702   return - vec_abs(__a);
16703 }
16704
16705 #ifdef __VSX__
16706 static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
16707   return - vec_abs(__a);
16708 }
16709
16710 #endif
16711
16712 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
16713 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
16714   return __builtin_altivec_vminsd(__a, -__a);
16715 }
16716 #endif
16717
16718 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
16719   return __builtin_altivec_vminsw(__a, -__a);
16720 }
16721
16722 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
16723   return __builtin_altivec_vminsh(__a, -__a);
16724 }
16725
16726 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
16727   return __builtin_altivec_vminsb(__a, -__a);
16728 }
16729 #undef __ATTRS_o_ai
16730
16731 #endif /* __ALTIVEC_H */