]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
Update compiler-rt to 3.9.0 release, and update the build glue for
[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 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
40     vector signed char __a, vector signed char __b, vector unsigned char __c);
41
42 static __inline__ vector unsigned char __ATTRS_o_ai
43 vec_perm(vector unsigned char __a, vector unsigned char __b,
44          vector unsigned char __c);
45
46 static __inline__ vector bool char __ATTRS_o_ai
47 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
48
49 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
50                                                      vector signed short __b,
51                                                      vector unsigned char __c);
52
53 static __inline__ vector unsigned short __ATTRS_o_ai
54 vec_perm(vector unsigned short __a, vector unsigned short __b,
55          vector unsigned char __c);
56
57 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
58     vector bool short __a, vector bool short __b, vector unsigned char __c);
59
60 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
61                                                      vector pixel __b,
62                                                      vector unsigned char __c);
63
64 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
65                                                    vector signed int __b,
66                                                    vector unsigned char __c);
67
68 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
69     vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
70
71 static __inline__ vector bool int __ATTRS_o_ai
72 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
73
74 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
75                                                      vector float __b,
76                                                      vector unsigned char __c);
77
78 #ifdef __VSX__
79 static __inline__ vector long long __ATTRS_o_ai
80 vec_perm(vector signed long long __a, vector signed long long __b,
81          vector unsigned char __c);
82
83 static __inline__ vector unsigned long long __ATTRS_o_ai
84 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
85          vector unsigned char __c);
86
87 static __inline__ vector bool long long __ATTRS_o_ai
88 vec_perm(vector bool long long __a, vector bool long long __b,
89          vector unsigned char __c);
90
91 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
92                                                       vector double __b,
93                                                       vector unsigned char __c);
94 #endif
95
96 static __inline__ vector unsigned char __ATTRS_o_ai
97 vec_xor(vector unsigned char __a, vector unsigned char __b);
98
99 /* vec_abs */
100
101 #define __builtin_altivec_abs_v16qi vec_abs
102 #define __builtin_altivec_abs_v8hi vec_abs
103 #define __builtin_altivec_abs_v4si vec_abs
104
105 static __inline__ vector signed char __ATTRS_o_ai
106 vec_abs(vector signed char __a) {
107   return __builtin_altivec_vmaxsb(__a, -__a);
108 }
109
110 static __inline__ vector signed short __ATTRS_o_ai
111 vec_abs(vector signed short __a) {
112   return __builtin_altivec_vmaxsh(__a, -__a);
113 }
114
115 static __inline__ vector signed int __ATTRS_o_ai
116 vec_abs(vector signed int __a) {
117   return __builtin_altivec_vmaxsw(__a, -__a);
118 }
119
120 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
121 static __inline__ vector signed long long __ATTRS_o_ai
122 vec_abs(vector signed long long __a) {
123   return __builtin_altivec_vmaxsd(__a, -__a);
124 }
125 #endif
126
127 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
128 #ifdef __VSX__
129   return __builtin_vsx_xvabssp(__a);
130 #else
131   vector unsigned int __res =
132       (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
133   return (vector float)__res;
134 #endif
135 }
136
137 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
138 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
139   return __builtin_vsx_xvabsdp(__a);
140 }
141 #endif
142
143 /* vec_abss */
144 #define __builtin_altivec_abss_v16qi vec_abss
145 #define __builtin_altivec_abss_v8hi vec_abss
146 #define __builtin_altivec_abss_v4si vec_abss
147
148 static __inline__ vector signed char __ATTRS_o_ai
149 vec_abss(vector signed char __a) {
150   return __builtin_altivec_vmaxsb(
151       __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
152 }
153
154 static __inline__ vector signed short __ATTRS_o_ai
155 vec_abss(vector signed short __a) {
156   return __builtin_altivec_vmaxsh(
157       __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
158 }
159
160 static __inline__ vector signed int __ATTRS_o_ai
161 vec_abss(vector signed int __a) {
162   return __builtin_altivec_vmaxsw(
163       __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
164 }
165
166 /* vec_add */
167
168 static __inline__ vector signed char __ATTRS_o_ai
169 vec_add(vector signed char __a, vector signed char __b) {
170   return __a + __b;
171 }
172
173 static __inline__ vector signed char __ATTRS_o_ai
174 vec_add(vector bool char __a, vector signed char __b) {
175   return (vector signed char)__a + __b;
176 }
177
178 static __inline__ vector signed char __ATTRS_o_ai
179 vec_add(vector signed char __a, vector bool char __b) {
180   return __a + (vector signed char)__b;
181 }
182
183 static __inline__ vector unsigned char __ATTRS_o_ai
184 vec_add(vector unsigned char __a, vector unsigned char __b) {
185   return __a + __b;
186 }
187
188 static __inline__ vector unsigned char __ATTRS_o_ai
189 vec_add(vector bool char __a, vector unsigned char __b) {
190   return (vector unsigned char)__a + __b;
191 }
192
193 static __inline__ vector unsigned char __ATTRS_o_ai
194 vec_add(vector unsigned char __a, vector bool char __b) {
195   return __a + (vector unsigned char)__b;
196 }
197
198 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
199                                                     vector short __b) {
200   return __a + __b;
201 }
202
203 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
204                                                     vector short __b) {
205   return (vector short)__a + __b;
206 }
207
208 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
209                                                     vector bool short __b) {
210   return __a + (vector short)__b;
211 }
212
213 static __inline__ vector unsigned short __ATTRS_o_ai
214 vec_add(vector unsigned short __a, vector unsigned short __b) {
215   return __a + __b;
216 }
217
218 static __inline__ vector unsigned short __ATTRS_o_ai
219 vec_add(vector bool short __a, vector unsigned short __b) {
220   return (vector unsigned short)__a + __b;
221 }
222
223 static __inline__ vector unsigned short __ATTRS_o_ai
224 vec_add(vector unsigned short __a, vector bool short __b) {
225   return __a + (vector unsigned short)__b;
226 }
227
228 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
229                                                   vector int __b) {
230   return __a + __b;
231 }
232
233 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
234                                                   vector int __b) {
235   return (vector int)__a + __b;
236 }
237
238 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
239                                                   vector bool int __b) {
240   return __a + (vector int)__b;
241 }
242
243 static __inline__ vector unsigned int __ATTRS_o_ai
244 vec_add(vector unsigned int __a, vector unsigned int __b) {
245   return __a + __b;
246 }
247
248 static __inline__ vector unsigned int __ATTRS_o_ai
249 vec_add(vector bool int __a, vector unsigned int __b) {
250   return (vector unsigned int)__a + __b;
251 }
252
253 static __inline__ vector unsigned int __ATTRS_o_ai
254 vec_add(vector unsigned int __a, vector bool int __b) {
255   return __a + (vector unsigned int)__b;
256 }
257
258 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
259 static __inline__ vector signed long long __ATTRS_o_ai
260 vec_add(vector signed long long __a, vector signed long long __b) {
261   return __a + __b;
262 }
263
264 static __inline__ vector unsigned long long __ATTRS_o_ai
265 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
266   return __a + __b;
267 }
268
269 static __inline__ vector signed __int128 __ATTRS_o_ai
270 vec_add(vector signed __int128 __a, vector signed __int128 __b) {
271   return __a + __b;
272 }
273
274 static __inline__ vector unsigned __int128 __ATTRS_o_ai
275 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
276   return __a + __b;
277 }
278 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
279
280 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
281                                                     vector float __b) {
282   return __a + __b;
283 }
284
285 #ifdef __VSX__
286 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
287                                                      vector double __b) {
288   return __a + __b;
289 }
290 #endif // __VSX__
291
292 /* vec_adde */
293
294 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
295 static __inline__ vector signed __int128 __ATTRS_o_ai
296 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
297          vector signed __int128 __c) {
298   return __builtin_altivec_vaddeuqm(__a, __b, __c);
299 }
300
301 static __inline__ vector unsigned __int128 __ATTRS_o_ai
302 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
303          vector unsigned __int128 __c) {
304   return __builtin_altivec_vaddeuqm(__a, __b, __c);
305 }
306 #endif
307
308 /* vec_addec */
309
310 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
311 static __inline__ vector signed __int128 __ATTRS_o_ai
312 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
313           vector signed __int128 __c) {
314   return __builtin_altivec_vaddecuq(__a, __b, __c);
315 }
316
317 static __inline__ vector unsigned __int128 __ATTRS_o_ai
318 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
319           vector unsigned __int128 __c) {
320   return __builtin_altivec_vaddecuq(__a, __b, __c);
321 }
322 #endif
323
324 /* vec_vaddubm */
325
326 #define __builtin_altivec_vaddubm vec_vaddubm
327
328 static __inline__ vector signed char __ATTRS_o_ai
329 vec_vaddubm(vector signed char __a, vector signed char __b) {
330   return __a + __b;
331 }
332
333 static __inline__ vector signed char __ATTRS_o_ai
334 vec_vaddubm(vector bool char __a, vector signed char __b) {
335   return (vector signed char)__a + __b;
336 }
337
338 static __inline__ vector signed char __ATTRS_o_ai
339 vec_vaddubm(vector signed char __a, vector bool char __b) {
340   return __a + (vector signed char)__b;
341 }
342
343 static __inline__ vector unsigned char __ATTRS_o_ai
344 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
345   return __a + __b;
346 }
347
348 static __inline__ vector unsigned char __ATTRS_o_ai
349 vec_vaddubm(vector bool char __a, vector unsigned char __b) {
350   return (vector unsigned char)__a + __b;
351 }
352
353 static __inline__ vector unsigned char __ATTRS_o_ai
354 vec_vaddubm(vector unsigned char __a, vector bool char __b) {
355   return __a + (vector unsigned char)__b;
356 }
357
358 /* vec_vadduhm */
359
360 #define __builtin_altivec_vadduhm vec_vadduhm
361
362 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
363                                                         vector short __b) {
364   return __a + __b;
365 }
366
367 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
368                                                         vector short __b) {
369   return (vector short)__a + __b;
370 }
371
372 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
373                                                         vector bool short __b) {
374   return __a + (vector short)__b;
375 }
376
377 static __inline__ vector unsigned short __ATTRS_o_ai
378 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
379   return __a + __b;
380 }
381
382 static __inline__ vector unsigned short __ATTRS_o_ai
383 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
384   return (vector unsigned short)__a + __b;
385 }
386
387 static __inline__ vector unsigned short __ATTRS_o_ai
388 vec_vadduhm(vector unsigned short __a, vector bool short __b) {
389   return __a + (vector unsigned short)__b;
390 }
391
392 /* vec_vadduwm */
393
394 #define __builtin_altivec_vadduwm vec_vadduwm
395
396 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
397                                                       vector int __b) {
398   return __a + __b;
399 }
400
401 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
402                                                       vector int __b) {
403   return (vector int)__a + __b;
404 }
405
406 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
407                                                       vector bool int __b) {
408   return __a + (vector int)__b;
409 }
410
411 static __inline__ vector unsigned int __ATTRS_o_ai
412 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
413   return __a + __b;
414 }
415
416 static __inline__ vector unsigned int __ATTRS_o_ai
417 vec_vadduwm(vector bool int __a, vector unsigned int __b) {
418   return (vector unsigned int)__a + __b;
419 }
420
421 static __inline__ vector unsigned int __ATTRS_o_ai
422 vec_vadduwm(vector unsigned int __a, vector bool int __b) {
423   return __a + (vector unsigned int)__b;
424 }
425
426 /* vec_vaddfp */
427
428 #define __builtin_altivec_vaddfp vec_vaddfp
429
430 static __inline__ vector float __attribute__((__always_inline__))
431 vec_vaddfp(vector float __a, vector float __b) {
432   return __a + __b;
433 }
434
435 /* vec_addc */
436
437 static __inline__ vector signed int __ATTRS_o_ai
438 vec_addc(vector signed int __a, vector signed int __b) {
439   return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
440                                                       (vector unsigned int)__b);
441 }
442
443 static __inline__ vector unsigned int __ATTRS_o_ai
444 vec_addc(vector unsigned int __a, vector unsigned int __b) {
445   return __builtin_altivec_vaddcuw(__a, __b);
446 }
447
448 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
449 static __inline__ vector signed __int128 __ATTRS_o_ai
450 vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
451   return (vector signed __int128)__builtin_altivec_vaddcuq(
452       (vector unsigned __int128)__a, (vector unsigned __int128)__b);
453 }
454
455 static __inline__ vector unsigned __int128 __ATTRS_o_ai
456 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
457   return __builtin_altivec_vaddcuq(__a, __b);
458 }
459 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
460
461 /* vec_vaddcuw */
462
463 static __inline__ vector unsigned int __attribute__((__always_inline__))
464 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
465   return __builtin_altivec_vaddcuw(__a, __b);
466 }
467
468 /* vec_adds */
469
470 static __inline__ vector signed char __ATTRS_o_ai
471 vec_adds(vector signed char __a, vector signed char __b) {
472   return __builtin_altivec_vaddsbs(__a, __b);
473 }
474
475 static __inline__ vector signed char __ATTRS_o_ai
476 vec_adds(vector bool char __a, vector signed char __b) {
477   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
478 }
479
480 static __inline__ vector signed char __ATTRS_o_ai
481 vec_adds(vector signed char __a, vector bool char __b) {
482   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
483 }
484
485 static __inline__ vector unsigned char __ATTRS_o_ai
486 vec_adds(vector unsigned char __a, vector unsigned char __b) {
487   return __builtin_altivec_vaddubs(__a, __b);
488 }
489
490 static __inline__ vector unsigned char __ATTRS_o_ai
491 vec_adds(vector bool char __a, vector unsigned char __b) {
492   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
493 }
494
495 static __inline__ vector unsigned char __ATTRS_o_ai
496 vec_adds(vector unsigned char __a, vector bool char __b) {
497   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
498 }
499
500 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
501                                                      vector short __b) {
502   return __builtin_altivec_vaddshs(__a, __b);
503 }
504
505 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
506                                                      vector short __b) {
507   return __builtin_altivec_vaddshs((vector short)__a, __b);
508 }
509
510 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
511                                                      vector bool short __b) {
512   return __builtin_altivec_vaddshs(__a, (vector short)__b);
513 }
514
515 static __inline__ vector unsigned short __ATTRS_o_ai
516 vec_adds(vector unsigned short __a, vector unsigned short __b) {
517   return __builtin_altivec_vadduhs(__a, __b);
518 }
519
520 static __inline__ vector unsigned short __ATTRS_o_ai
521 vec_adds(vector bool short __a, vector unsigned short __b) {
522   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
523 }
524
525 static __inline__ vector unsigned short __ATTRS_o_ai
526 vec_adds(vector unsigned short __a, vector bool short __b) {
527   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
528 }
529
530 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
531                                                    vector int __b) {
532   return __builtin_altivec_vaddsws(__a, __b);
533 }
534
535 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
536                                                    vector int __b) {
537   return __builtin_altivec_vaddsws((vector int)__a, __b);
538 }
539
540 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
541                                                    vector bool int __b) {
542   return __builtin_altivec_vaddsws(__a, (vector int)__b);
543 }
544
545 static __inline__ vector unsigned int __ATTRS_o_ai
546 vec_adds(vector unsigned int __a, vector unsigned int __b) {
547   return __builtin_altivec_vadduws(__a, __b);
548 }
549
550 static __inline__ vector unsigned int __ATTRS_o_ai
551 vec_adds(vector bool int __a, vector unsigned int __b) {
552   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
553 }
554
555 static __inline__ vector unsigned int __ATTRS_o_ai
556 vec_adds(vector unsigned int __a, vector bool int __b) {
557   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
558 }
559
560 /* vec_vaddsbs */
561
562 static __inline__ vector signed char __ATTRS_o_ai
563 vec_vaddsbs(vector signed char __a, vector signed char __b) {
564   return __builtin_altivec_vaddsbs(__a, __b);
565 }
566
567 static __inline__ vector signed char __ATTRS_o_ai
568 vec_vaddsbs(vector bool char __a, vector signed char __b) {
569   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
570 }
571
572 static __inline__ vector signed char __ATTRS_o_ai
573 vec_vaddsbs(vector signed char __a, vector bool char __b) {
574   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
575 }
576
577 /* vec_vaddubs */
578
579 static __inline__ vector unsigned char __ATTRS_o_ai
580 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
581   return __builtin_altivec_vaddubs(__a, __b);
582 }
583
584 static __inline__ vector unsigned char __ATTRS_o_ai
585 vec_vaddubs(vector bool char __a, vector unsigned char __b) {
586   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
587 }
588
589 static __inline__ vector unsigned char __ATTRS_o_ai
590 vec_vaddubs(vector unsigned char __a, vector bool char __b) {
591   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
592 }
593
594 /* vec_vaddshs */
595
596 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
597                                                         vector short __b) {
598   return __builtin_altivec_vaddshs(__a, __b);
599 }
600
601 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
602                                                         vector short __b) {
603   return __builtin_altivec_vaddshs((vector short)__a, __b);
604 }
605
606 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
607                                                         vector bool short __b) {
608   return __builtin_altivec_vaddshs(__a, (vector short)__b);
609 }
610
611 /* vec_vadduhs */
612
613 static __inline__ vector unsigned short __ATTRS_o_ai
614 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
615   return __builtin_altivec_vadduhs(__a, __b);
616 }
617
618 static __inline__ vector unsigned short __ATTRS_o_ai
619 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
620   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
621 }
622
623 static __inline__ vector unsigned short __ATTRS_o_ai
624 vec_vadduhs(vector unsigned short __a, vector bool short __b) {
625   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
626 }
627
628 /* vec_vaddsws */
629
630 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
631                                                       vector int __b) {
632   return __builtin_altivec_vaddsws(__a, __b);
633 }
634
635 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
636                                                       vector int __b) {
637   return __builtin_altivec_vaddsws((vector int)__a, __b);
638 }
639
640 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
641                                                       vector bool int __b) {
642   return __builtin_altivec_vaddsws(__a, (vector int)__b);
643 }
644
645 /* vec_vadduws */
646
647 static __inline__ vector unsigned int __ATTRS_o_ai
648 vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
649   return __builtin_altivec_vadduws(__a, __b);
650 }
651
652 static __inline__ vector unsigned int __ATTRS_o_ai
653 vec_vadduws(vector bool int __a, vector unsigned int __b) {
654   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
655 }
656
657 static __inline__ vector unsigned int __ATTRS_o_ai
658 vec_vadduws(vector unsigned int __a, vector bool int __b) {
659   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
660 }
661
662 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
663 /* vec_vadduqm */
664
665 static __inline__ vector signed __int128 __ATTRS_o_ai
666 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
667   return __a + __b;
668 }
669
670 static __inline__ vector unsigned __int128 __ATTRS_o_ai
671 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
672   return __a + __b;
673 }
674
675 /* vec_vaddeuqm */
676
677 static __inline__ vector signed __int128 __ATTRS_o_ai
678 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
679              vector signed __int128 __c) {
680   return __builtin_altivec_vaddeuqm(__a, __b, __c);
681 }
682
683 static __inline__ vector unsigned __int128 __ATTRS_o_ai
684 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
685              vector unsigned __int128 __c) {
686   return __builtin_altivec_vaddeuqm(__a, __b, __c);
687 }
688
689 /* vec_vaddcuq */
690
691 static __inline__ vector signed __int128 __ATTRS_o_ai
692 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
693   return __builtin_altivec_vaddcuq(__a, __b);
694 }
695
696 static __inline__ vector unsigned __int128 __ATTRS_o_ai
697 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
698   return __builtin_altivec_vaddcuq(__a, __b);
699 }
700
701 /* vec_vaddecuq */
702
703 static __inline__ vector signed __int128 __ATTRS_o_ai
704 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
705              vector signed __int128 __c) {
706   return __builtin_altivec_vaddecuq(__a, __b, __c);
707 }
708
709 static __inline__ vector unsigned __int128 __ATTRS_o_ai
710 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
711              vector unsigned __int128 __c) {
712   return __builtin_altivec_vaddecuq(__a, __b, __c);
713 }
714 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
715
716 /* vec_and */
717
718 #define __builtin_altivec_vand vec_and
719
720 static __inline__ vector signed char __ATTRS_o_ai
721 vec_and(vector signed char __a, vector signed char __b) {
722   return __a & __b;
723 }
724
725 static __inline__ vector signed char __ATTRS_o_ai
726 vec_and(vector bool char __a, vector signed char __b) {
727   return (vector signed char)__a & __b;
728 }
729
730 static __inline__ vector signed char __ATTRS_o_ai
731 vec_and(vector signed char __a, vector bool char __b) {
732   return __a & (vector signed char)__b;
733 }
734
735 static __inline__ vector unsigned char __ATTRS_o_ai
736 vec_and(vector unsigned char __a, vector unsigned char __b) {
737   return __a & __b;
738 }
739
740 static __inline__ vector unsigned char __ATTRS_o_ai
741 vec_and(vector bool char __a, vector unsigned char __b) {
742   return (vector unsigned char)__a & __b;
743 }
744
745 static __inline__ vector unsigned char __ATTRS_o_ai
746 vec_and(vector unsigned char __a, vector bool char __b) {
747   return __a & (vector unsigned char)__b;
748 }
749
750 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
751                                                         vector bool char __b) {
752   return __a & __b;
753 }
754
755 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
756                                                     vector short __b) {
757   return __a & __b;
758 }
759
760 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
761                                                     vector short __b) {
762   return (vector short)__a & __b;
763 }
764
765 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
766                                                     vector bool short __b) {
767   return __a & (vector short)__b;
768 }
769
770 static __inline__ vector unsigned short __ATTRS_o_ai
771 vec_and(vector unsigned short __a, vector unsigned short __b) {
772   return __a & __b;
773 }
774
775 static __inline__ vector unsigned short __ATTRS_o_ai
776 vec_and(vector bool short __a, vector unsigned short __b) {
777   return (vector unsigned short)__a & __b;
778 }
779
780 static __inline__ vector unsigned short __ATTRS_o_ai
781 vec_and(vector unsigned short __a, vector bool short __b) {
782   return __a & (vector unsigned short)__b;
783 }
784
785 static __inline__ vector bool short __ATTRS_o_ai
786 vec_and(vector bool short __a, vector bool short __b) {
787   return __a & __b;
788 }
789
790 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
791                                                   vector int __b) {
792   return __a & __b;
793 }
794
795 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
796                                                   vector int __b) {
797   return (vector int)__a & __b;
798 }
799
800 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
801                                                   vector bool int __b) {
802   return __a & (vector int)__b;
803 }
804
805 static __inline__ vector unsigned int __ATTRS_o_ai
806 vec_and(vector unsigned int __a, vector unsigned int __b) {
807   return __a & __b;
808 }
809
810 static __inline__ vector unsigned int __ATTRS_o_ai
811 vec_and(vector bool int __a, vector unsigned int __b) {
812   return (vector unsigned int)__a & __b;
813 }
814
815 static __inline__ vector unsigned int __ATTRS_o_ai
816 vec_and(vector unsigned int __a, vector bool int __b) {
817   return __a & (vector unsigned int)__b;
818 }
819
820 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
821                                                        vector bool int __b) {
822   return __a & __b;
823 }
824
825 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
826                                                     vector float __b) {
827   vector unsigned int __res =
828       (vector unsigned int)__a & (vector unsigned int)__b;
829   return (vector float)__res;
830 }
831
832 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
833                                                     vector float __b) {
834   vector unsigned int __res =
835       (vector unsigned int)__a & (vector unsigned int)__b;
836   return (vector float)__res;
837 }
838
839 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
840                                                     vector bool int __b) {
841   vector unsigned int __res =
842       (vector unsigned int)__a & (vector unsigned int)__b;
843   return (vector float)__res;
844 }
845
846 #ifdef __VSX__
847 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
848                                                      vector double __b) {
849   vector unsigned long long __res =
850       (vector unsigned long long)__a & (vector unsigned long long)__b;
851   return (vector double)__res;
852 }
853
854 static __inline__ vector double __ATTRS_o_ai
855 vec_and(vector double __a, vector bool long long __b) {
856   vector unsigned long long __res =
857       (vector unsigned long long)__a & (vector unsigned long long)__b;
858   return (vector double)__res;
859 }
860
861 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
862                                                      vector double __b) {
863   vector unsigned long long __res =
864       (vector unsigned long long)__a & (vector unsigned long long)__b;
865   return (vector double)__res;
866 }
867
868 static __inline__ vector signed long long __ATTRS_o_ai
869 vec_and(vector signed long long __a, vector signed long long __b) {
870   return __a & __b;
871 }
872
873 static __inline__ vector signed long long __ATTRS_o_ai
874 vec_and(vector bool long long __a, vector signed long long __b) {
875   return (vector signed long long)__a & __b;
876 }
877
878 static __inline__ vector signed long long __ATTRS_o_ai
879 vec_and(vector signed long long __a, vector bool long long __b) {
880   return __a & (vector signed long long)__b;
881 }
882
883 static __inline__ vector unsigned long long __ATTRS_o_ai
884 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
885   return __a & __b;
886 }
887
888 static __inline__ vector unsigned long long __ATTRS_o_ai
889 vec_and(vector bool long long __a, vector unsigned long long __b) {
890   return (vector unsigned long long)__a & __b;
891 }
892
893 static __inline__ vector unsigned long long __ATTRS_o_ai
894 vec_and(vector unsigned long long __a, vector bool long long __b) {
895   return __a & (vector unsigned long long)__b;
896 }
897
898 static __inline__ vector bool long long __ATTRS_o_ai
899 vec_and(vector bool long long __a, vector bool long long __b) {
900   return __a & __b;
901 }
902 #endif
903
904 /* vec_vand */
905
906 static __inline__ vector signed char __ATTRS_o_ai
907 vec_vand(vector signed char __a, vector signed char __b) {
908   return __a & __b;
909 }
910
911 static __inline__ vector signed char __ATTRS_o_ai
912 vec_vand(vector bool char __a, vector signed char __b) {
913   return (vector signed char)__a & __b;
914 }
915
916 static __inline__ vector signed char __ATTRS_o_ai
917 vec_vand(vector signed char __a, vector bool char __b) {
918   return __a & (vector signed char)__b;
919 }
920
921 static __inline__ vector unsigned char __ATTRS_o_ai
922 vec_vand(vector unsigned char __a, vector unsigned char __b) {
923   return __a & __b;
924 }
925
926 static __inline__ vector unsigned char __ATTRS_o_ai
927 vec_vand(vector bool char __a, vector unsigned char __b) {
928   return (vector unsigned char)__a & __b;
929 }
930
931 static __inline__ vector unsigned char __ATTRS_o_ai
932 vec_vand(vector unsigned char __a, vector bool char __b) {
933   return __a & (vector unsigned char)__b;
934 }
935
936 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
937                                                          vector bool char __b) {
938   return __a & __b;
939 }
940
941 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
942                                                      vector short __b) {
943   return __a & __b;
944 }
945
946 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
947                                                      vector short __b) {
948   return (vector short)__a & __b;
949 }
950
951 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
952                                                      vector bool short __b) {
953   return __a & (vector short)__b;
954 }
955
956 static __inline__ vector unsigned short __ATTRS_o_ai
957 vec_vand(vector unsigned short __a, vector unsigned short __b) {
958   return __a & __b;
959 }
960
961 static __inline__ vector unsigned short __ATTRS_o_ai
962 vec_vand(vector bool short __a, vector unsigned short __b) {
963   return (vector unsigned short)__a & __b;
964 }
965
966 static __inline__ vector unsigned short __ATTRS_o_ai
967 vec_vand(vector unsigned short __a, vector bool short __b) {
968   return __a & (vector unsigned short)__b;
969 }
970
971 static __inline__ vector bool short __ATTRS_o_ai
972 vec_vand(vector bool short __a, vector bool short __b) {
973   return __a & __b;
974 }
975
976 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
977                                                    vector int __b) {
978   return __a & __b;
979 }
980
981 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
982                                                    vector int __b) {
983   return (vector int)__a & __b;
984 }
985
986 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
987                                                    vector bool int __b) {
988   return __a & (vector int)__b;
989 }
990
991 static __inline__ vector unsigned int __ATTRS_o_ai
992 vec_vand(vector unsigned int __a, vector unsigned int __b) {
993   return __a & __b;
994 }
995
996 static __inline__ vector unsigned int __ATTRS_o_ai
997 vec_vand(vector bool int __a, vector unsigned int __b) {
998   return (vector unsigned int)__a & __b;
999 }
1000
1001 static __inline__ vector unsigned int __ATTRS_o_ai
1002 vec_vand(vector unsigned int __a, vector bool int __b) {
1003   return __a & (vector unsigned int)__b;
1004 }
1005
1006 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1007                                                         vector bool int __b) {
1008   return __a & __b;
1009 }
1010
1011 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1012                                                      vector float __b) {
1013   vector unsigned int __res =
1014       (vector unsigned int)__a & (vector unsigned int)__b;
1015   return (vector float)__res;
1016 }
1017
1018 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1019                                                      vector float __b) {
1020   vector unsigned int __res =
1021       (vector unsigned int)__a & (vector unsigned int)__b;
1022   return (vector float)__res;
1023 }
1024
1025 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1026                                                      vector bool int __b) {
1027   vector unsigned int __res =
1028       (vector unsigned int)__a & (vector unsigned int)__b;
1029   return (vector float)__res;
1030 }
1031
1032 #ifdef __VSX__
1033 static __inline__ vector signed long long __ATTRS_o_ai
1034 vec_vand(vector signed long long __a, vector signed long long __b) {
1035   return __a & __b;
1036 }
1037
1038 static __inline__ vector signed long long __ATTRS_o_ai
1039 vec_vand(vector bool long long __a, vector signed long long __b) {
1040   return (vector signed long long)__a & __b;
1041 }
1042
1043 static __inline__ vector signed long long __ATTRS_o_ai
1044 vec_vand(vector signed long long __a, vector bool long long __b) {
1045   return __a & (vector signed long long)__b;
1046 }
1047
1048 static __inline__ vector unsigned long long __ATTRS_o_ai
1049 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1050   return __a & __b;
1051 }
1052
1053 static __inline__ vector unsigned long long __ATTRS_o_ai
1054 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1055   return (vector unsigned long long)__a & __b;
1056 }
1057
1058 static __inline__ vector unsigned long long __ATTRS_o_ai
1059 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1060   return __a & (vector unsigned long long)__b;
1061 }
1062
1063 static __inline__ vector bool long long __ATTRS_o_ai
1064 vec_vand(vector bool long long __a, vector bool long long __b) {
1065   return __a & __b;
1066 }
1067 #endif
1068
1069 /* vec_andc */
1070
1071 #define __builtin_altivec_vandc vec_andc
1072
1073 static __inline__ vector signed char __ATTRS_o_ai
1074 vec_andc(vector signed char __a, vector signed char __b) {
1075   return __a & ~__b;
1076 }
1077
1078 static __inline__ vector signed char __ATTRS_o_ai
1079 vec_andc(vector bool char __a, vector signed char __b) {
1080   return (vector signed char)__a & ~__b;
1081 }
1082
1083 static __inline__ vector signed char __ATTRS_o_ai
1084 vec_andc(vector signed char __a, vector bool char __b) {
1085   return __a & ~(vector signed char)__b;
1086 }
1087
1088 static __inline__ vector unsigned char __ATTRS_o_ai
1089 vec_andc(vector unsigned char __a, vector unsigned char __b) {
1090   return __a & ~__b;
1091 }
1092
1093 static __inline__ vector unsigned char __ATTRS_o_ai
1094 vec_andc(vector bool char __a, vector unsigned char __b) {
1095   return (vector unsigned char)__a & ~__b;
1096 }
1097
1098 static __inline__ vector unsigned char __ATTRS_o_ai
1099 vec_andc(vector unsigned char __a, vector bool char __b) {
1100   return __a & ~(vector unsigned char)__b;
1101 }
1102
1103 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1104                                                          vector bool char __b) {
1105   return __a & ~__b;
1106 }
1107
1108 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1109                                                      vector short __b) {
1110   return __a & ~__b;
1111 }
1112
1113 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1114                                                      vector short __b) {
1115   return (vector short)__a & ~__b;
1116 }
1117
1118 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1119                                                      vector bool short __b) {
1120   return __a & ~(vector short)__b;
1121 }
1122
1123 static __inline__ vector unsigned short __ATTRS_o_ai
1124 vec_andc(vector unsigned short __a, vector unsigned short __b) {
1125   return __a & ~__b;
1126 }
1127
1128 static __inline__ vector unsigned short __ATTRS_o_ai
1129 vec_andc(vector bool short __a, vector unsigned short __b) {
1130   return (vector unsigned short)__a & ~__b;
1131 }
1132
1133 static __inline__ vector unsigned short __ATTRS_o_ai
1134 vec_andc(vector unsigned short __a, vector bool short __b) {
1135   return __a & ~(vector unsigned short)__b;
1136 }
1137
1138 static __inline__ vector bool short __ATTRS_o_ai
1139 vec_andc(vector bool short __a, vector bool short __b) {
1140   return __a & ~__b;
1141 }
1142
1143 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1144                                                    vector int __b) {
1145   return __a & ~__b;
1146 }
1147
1148 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1149                                                    vector int __b) {
1150   return (vector int)__a & ~__b;
1151 }
1152
1153 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1154                                                    vector bool int __b) {
1155   return __a & ~(vector int)__b;
1156 }
1157
1158 static __inline__ vector unsigned int __ATTRS_o_ai
1159 vec_andc(vector unsigned int __a, vector unsigned int __b) {
1160   return __a & ~__b;
1161 }
1162
1163 static __inline__ vector unsigned int __ATTRS_o_ai
1164 vec_andc(vector bool int __a, vector unsigned int __b) {
1165   return (vector unsigned int)__a & ~__b;
1166 }
1167
1168 static __inline__ vector unsigned int __ATTRS_o_ai
1169 vec_andc(vector unsigned int __a, vector bool int __b) {
1170   return __a & ~(vector unsigned int)__b;
1171 }
1172
1173 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1174                                                         vector bool int __b) {
1175   return __a & ~__b;
1176 }
1177
1178 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1179                                                      vector float __b) {
1180   vector unsigned int __res =
1181       (vector unsigned int)__a & ~(vector unsigned int)__b;
1182   return (vector float)__res;
1183 }
1184
1185 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1186                                                      vector float __b) {
1187   vector unsigned int __res =
1188       (vector unsigned int)__a & ~(vector unsigned int)__b;
1189   return (vector float)__res;
1190 }
1191
1192 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1193                                                      vector bool int __b) {
1194   vector unsigned int __res =
1195       (vector unsigned int)__a & ~(vector unsigned int)__b;
1196   return (vector float)__res;
1197 }
1198
1199 #ifdef __VSX__
1200 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1201                                                       vector double __b) {
1202   vector unsigned long long __res =
1203       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1204   return (vector double)__res;
1205 }
1206
1207 static __inline__ vector double __ATTRS_o_ai
1208 vec_andc(vector double __a, vector bool long long __b) {
1209   vector unsigned long long __res =
1210       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1211   return (vector double)__res;
1212 }
1213
1214 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1215                                                       vector double __b) {
1216   vector unsigned long long __res =
1217       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1218   return (vector double)__res;
1219 }
1220
1221 static __inline__ vector signed long long __ATTRS_o_ai
1222 vec_andc(vector signed long long __a, vector signed long long __b) {
1223   return __a & ~__b;
1224 }
1225
1226 static __inline__ vector signed long long __ATTRS_o_ai
1227 vec_andc(vector bool long long __a, vector signed long long __b) {
1228   return (vector signed long long)__a & ~__b;
1229 }
1230
1231 static __inline__ vector signed long long __ATTRS_o_ai
1232 vec_andc(vector signed long long __a, vector bool long long __b) {
1233   return __a & ~(vector signed long long)__b;
1234 }
1235
1236 static __inline__ vector unsigned long long __ATTRS_o_ai
1237 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1238   return __a & ~__b;
1239 }
1240
1241 static __inline__ vector unsigned long long __ATTRS_o_ai
1242 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1243   return (vector unsigned long long)__a & ~__b;
1244 }
1245
1246 static __inline__ vector unsigned long long __ATTRS_o_ai
1247 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1248   return __a & ~(vector unsigned long long)__b;
1249 }
1250
1251 static __inline__ vector bool long long __ATTRS_o_ai
1252 vec_andc(vector bool long long __a, vector bool long long __b) {
1253   return __a & ~__b;
1254 }
1255 #endif
1256
1257 /* vec_vandc */
1258
1259 static __inline__ vector signed char __ATTRS_o_ai
1260 vec_vandc(vector signed char __a, vector signed char __b) {
1261   return __a & ~__b;
1262 }
1263
1264 static __inline__ vector signed char __ATTRS_o_ai
1265 vec_vandc(vector bool char __a, vector signed char __b) {
1266   return (vector signed char)__a & ~__b;
1267 }
1268
1269 static __inline__ vector signed char __ATTRS_o_ai
1270 vec_vandc(vector signed char __a, vector bool char __b) {
1271   return __a & ~(vector signed char)__b;
1272 }
1273
1274 static __inline__ vector unsigned char __ATTRS_o_ai
1275 vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1276   return __a & ~__b;
1277 }
1278
1279 static __inline__ vector unsigned char __ATTRS_o_ai
1280 vec_vandc(vector bool char __a, vector unsigned char __b) {
1281   return (vector unsigned char)__a & ~__b;
1282 }
1283
1284 static __inline__ vector unsigned char __ATTRS_o_ai
1285 vec_vandc(vector unsigned char __a, vector bool char __b) {
1286   return __a & ~(vector unsigned char)__b;
1287 }
1288
1289 static __inline__ vector bool char __ATTRS_o_ai
1290 vec_vandc(vector bool char __a, vector bool char __b) {
1291   return __a & ~__b;
1292 }
1293
1294 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1295                                                       vector short __b) {
1296   return __a & ~__b;
1297 }
1298
1299 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1300                                                       vector short __b) {
1301   return (vector short)__a & ~__b;
1302 }
1303
1304 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1305                                                       vector bool short __b) {
1306   return __a & ~(vector short)__b;
1307 }
1308
1309 static __inline__ vector unsigned short __ATTRS_o_ai
1310 vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1311   return __a & ~__b;
1312 }
1313
1314 static __inline__ vector unsigned short __ATTRS_o_ai
1315 vec_vandc(vector bool short __a, vector unsigned short __b) {
1316   return (vector unsigned short)__a & ~__b;
1317 }
1318
1319 static __inline__ vector unsigned short __ATTRS_o_ai
1320 vec_vandc(vector unsigned short __a, vector bool short __b) {
1321   return __a & ~(vector unsigned short)__b;
1322 }
1323
1324 static __inline__ vector bool short __ATTRS_o_ai
1325 vec_vandc(vector bool short __a, vector bool short __b) {
1326   return __a & ~__b;
1327 }
1328
1329 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1330                                                     vector int __b) {
1331   return __a & ~__b;
1332 }
1333
1334 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1335                                                     vector int __b) {
1336   return (vector int)__a & ~__b;
1337 }
1338
1339 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1340                                                     vector bool int __b) {
1341   return __a & ~(vector int)__b;
1342 }
1343
1344 static __inline__ vector unsigned int __ATTRS_o_ai
1345 vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1346   return __a & ~__b;
1347 }
1348
1349 static __inline__ vector unsigned int __ATTRS_o_ai
1350 vec_vandc(vector bool int __a, vector unsigned int __b) {
1351   return (vector unsigned int)__a & ~__b;
1352 }
1353
1354 static __inline__ vector unsigned int __ATTRS_o_ai
1355 vec_vandc(vector unsigned int __a, vector bool int __b) {
1356   return __a & ~(vector unsigned int)__b;
1357 }
1358
1359 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1360                                                          vector bool int __b) {
1361   return __a & ~__b;
1362 }
1363
1364 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1365                                                       vector float __b) {
1366   vector unsigned int __res =
1367       (vector unsigned int)__a & ~(vector unsigned int)__b;
1368   return (vector float)__res;
1369 }
1370
1371 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1372                                                       vector float __b) {
1373   vector unsigned int __res =
1374       (vector unsigned int)__a & ~(vector unsigned int)__b;
1375   return (vector float)__res;
1376 }
1377
1378 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1379                                                       vector bool int __b) {
1380   vector unsigned int __res =
1381       (vector unsigned int)__a & ~(vector unsigned int)__b;
1382   return (vector float)__res;
1383 }
1384
1385 #ifdef __VSX__
1386 static __inline__ vector signed long long __ATTRS_o_ai
1387 vec_vandc(vector signed long long __a, vector signed long long __b) {
1388   return __a & ~__b;
1389 }
1390
1391 static __inline__ vector signed long long __ATTRS_o_ai
1392 vec_vandc(vector bool long long __a, vector signed long long __b) {
1393   return (vector signed long long)__a & ~__b;
1394 }
1395
1396 static __inline__ vector signed long long __ATTRS_o_ai
1397 vec_vandc(vector signed long long __a, vector bool long long __b) {
1398   return __a & ~(vector signed long long)__b;
1399 }
1400
1401 static __inline__ vector unsigned long long __ATTRS_o_ai
1402 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1403   return __a & ~__b;
1404 }
1405
1406 static __inline__ vector unsigned long long __ATTRS_o_ai
1407 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1408   return (vector unsigned long long)__a & ~__b;
1409 }
1410
1411 static __inline__ vector unsigned long long __ATTRS_o_ai
1412 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1413   return __a & ~(vector unsigned long long)__b;
1414 }
1415
1416 static __inline__ vector bool long long __ATTRS_o_ai
1417 vec_vandc(vector bool long long __a, vector bool long long __b) {
1418   return __a & ~__b;
1419 }
1420 #endif
1421
1422 /* vec_avg */
1423
1424 static __inline__ vector signed char __ATTRS_o_ai
1425 vec_avg(vector signed char __a, vector signed char __b) {
1426   return __builtin_altivec_vavgsb(__a, __b);
1427 }
1428
1429 static __inline__ vector unsigned char __ATTRS_o_ai
1430 vec_avg(vector unsigned char __a, vector unsigned char __b) {
1431   return __builtin_altivec_vavgub(__a, __b);
1432 }
1433
1434 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1435                                                     vector short __b) {
1436   return __builtin_altivec_vavgsh(__a, __b);
1437 }
1438
1439 static __inline__ vector unsigned short __ATTRS_o_ai
1440 vec_avg(vector unsigned short __a, vector unsigned short __b) {
1441   return __builtin_altivec_vavguh(__a, __b);
1442 }
1443
1444 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1445                                                   vector int __b) {
1446   return __builtin_altivec_vavgsw(__a, __b);
1447 }
1448
1449 static __inline__ vector unsigned int __ATTRS_o_ai
1450 vec_avg(vector unsigned int __a, vector unsigned int __b) {
1451   return __builtin_altivec_vavguw(__a, __b);
1452 }
1453
1454 /* vec_vavgsb */
1455
1456 static __inline__ vector signed char __attribute__((__always_inline__))
1457 vec_vavgsb(vector signed char __a, vector signed char __b) {
1458   return __builtin_altivec_vavgsb(__a, __b);
1459 }
1460
1461 /* vec_vavgub */
1462
1463 static __inline__ vector unsigned char __attribute__((__always_inline__))
1464 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1465   return __builtin_altivec_vavgub(__a, __b);
1466 }
1467
1468 /* vec_vavgsh */
1469
1470 static __inline__ vector short __attribute__((__always_inline__))
1471 vec_vavgsh(vector short __a, vector short __b) {
1472   return __builtin_altivec_vavgsh(__a, __b);
1473 }
1474
1475 /* vec_vavguh */
1476
1477 static __inline__ vector unsigned short __attribute__((__always_inline__))
1478 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1479   return __builtin_altivec_vavguh(__a, __b);
1480 }
1481
1482 /* vec_vavgsw */
1483
1484 static __inline__ vector int __attribute__((__always_inline__))
1485 vec_vavgsw(vector int __a, vector int __b) {
1486   return __builtin_altivec_vavgsw(__a, __b);
1487 }
1488
1489 /* vec_vavguw */
1490
1491 static __inline__ vector unsigned int __attribute__((__always_inline__))
1492 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1493   return __builtin_altivec_vavguw(__a, __b);
1494 }
1495
1496 /* vec_ceil */
1497
1498 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1499 #ifdef __VSX__
1500   return __builtin_vsx_xvrspip(__a);
1501 #else
1502   return __builtin_altivec_vrfip(__a);
1503 #endif
1504 }
1505
1506 #ifdef __VSX__
1507 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1508   return __builtin_vsx_xvrdpip(__a);
1509 }
1510 #endif
1511
1512 /* vec_vrfip */
1513
1514 static __inline__ vector float __attribute__((__always_inline__))
1515 vec_vrfip(vector float __a) {
1516   return __builtin_altivec_vrfip(__a);
1517 }
1518
1519 /* vec_cmpb */
1520
1521 static __inline__ vector int __attribute__((__always_inline__))
1522 vec_cmpb(vector float __a, vector float __b) {
1523   return __builtin_altivec_vcmpbfp(__a, __b);
1524 }
1525
1526 /* vec_vcmpbfp */
1527
1528 static __inline__ vector int __attribute__((__always_inline__))
1529 vec_vcmpbfp(vector float __a, vector float __b) {
1530   return __builtin_altivec_vcmpbfp(__a, __b);
1531 }
1532
1533 /* vec_cmpeq */
1534
1535 static __inline__ vector bool char __ATTRS_o_ai
1536 vec_cmpeq(vector signed char __a, vector signed char __b) {
1537   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1538                                                       (vector char)__b);
1539 }
1540
1541 static __inline__ vector bool char __ATTRS_o_ai
1542 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1543   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1544                                                       (vector char)__b);
1545 }
1546
1547 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1548                                                            vector short __b) {
1549   return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1550 }
1551
1552 static __inline__ vector bool short __ATTRS_o_ai
1553 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1554   return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1555                                                        (vector short)__b);
1556 }
1557
1558 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1559                                                          vector int __b) {
1560   return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1561 }
1562
1563 static __inline__ vector bool int __ATTRS_o_ai
1564 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1565   return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1566                                                      (vector int)__b);
1567 }
1568
1569 #ifdef __POWER8_VECTOR__
1570 static __inline__ vector bool long long __ATTRS_o_ai
1571 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1572   return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1573 }
1574
1575 static __inline__ vector bool long long __ATTRS_o_ai
1576 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1577   return (vector bool long long)__builtin_altivec_vcmpequd(
1578       (vector long long)__a, (vector long long)__b);
1579 }
1580 #endif
1581
1582 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1583                                                          vector float __b) {
1584 #ifdef __VSX__
1585   return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1586 #else
1587   return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1588 #endif
1589 }
1590
1591 #ifdef __VSX__
1592 static __inline__ vector bool long long __ATTRS_o_ai
1593 vec_cmpeq(vector double __a, vector double __b) {
1594   return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1595 }
1596 #endif
1597
1598 /* vec_cmpgt */
1599
1600 static __inline__ vector bool char __ATTRS_o_ai
1601 vec_cmpgt(vector signed char __a, vector signed char __b) {
1602   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1603 }
1604
1605 static __inline__ vector bool char __ATTRS_o_ai
1606 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1607   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1608 }
1609
1610 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1611                                                            vector short __b) {
1612   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1613 }
1614
1615 static __inline__ vector bool short __ATTRS_o_ai
1616 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1617   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1618 }
1619
1620 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
1621                                                          vector int __b) {
1622   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1623 }
1624
1625 static __inline__ vector bool int __ATTRS_o_ai
1626 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1627   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1628 }
1629
1630 #ifdef __POWER8_VECTOR__
1631 static __inline__ vector bool long long __ATTRS_o_ai
1632 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1633   return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1634 }
1635
1636 static __inline__ vector bool long long __ATTRS_o_ai
1637 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1638   return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1639 }
1640 #endif
1641
1642 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1643                                                          vector float __b) {
1644 #ifdef __VSX__
1645   return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1646 #else
1647   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1648 #endif
1649 }
1650
1651 #ifdef __VSX__
1652 static __inline__ vector bool long long __ATTRS_o_ai
1653 vec_cmpgt(vector double __a, vector double __b) {
1654   return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1655 }
1656 #endif
1657
1658 /* vec_cmpge */
1659
1660 static __inline__ vector bool char __ATTRS_o_ai
1661 vec_cmpge(vector signed char __a, vector signed char __b) {
1662   return ~(vec_cmpgt(__b, __a));
1663 }
1664
1665 static __inline__ vector bool char __ATTRS_o_ai
1666 vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1667   return ~(vec_cmpgt(__b, __a));
1668 }
1669
1670 static __inline__ vector bool short __ATTRS_o_ai
1671 vec_cmpge(vector signed short __a, vector signed short __b) {
1672   return ~(vec_cmpgt(__b, __a));
1673 }
1674
1675 static __inline__ vector bool short __ATTRS_o_ai
1676 vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1677   return ~(vec_cmpgt(__b, __a));
1678 }
1679
1680 static __inline__ vector bool int __ATTRS_o_ai
1681 vec_cmpge(vector signed int __a, vector signed int __b) {
1682   return ~(vec_cmpgt(__b, __a));
1683 }
1684
1685 static __inline__ vector bool int __ATTRS_o_ai
1686 vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1687   return ~(vec_cmpgt(__b, __a));
1688 }
1689
1690 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
1691                                                          vector float __b) {
1692 #ifdef __VSX__
1693   return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
1694 #else
1695   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1696 #endif
1697 }
1698
1699 #ifdef __VSX__
1700 static __inline__ vector bool long long __ATTRS_o_ai
1701 vec_cmpge(vector double __a, vector double __b) {
1702   return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
1703 }
1704 #endif
1705
1706 #ifdef __POWER8_VECTOR__
1707 static __inline__ vector bool long long __ATTRS_o_ai
1708 vec_cmpge(vector signed long long __a, vector signed long long __b) {
1709   return ~(vec_cmpgt(__b, __a));
1710 }
1711
1712 static __inline__ vector bool long long __ATTRS_o_ai
1713 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1714   return ~(vec_cmpgt(__b, __a));
1715 }
1716 #endif
1717
1718 /* vec_vcmpgefp */
1719
1720 static __inline__ vector bool int __attribute__((__always_inline__))
1721 vec_vcmpgefp(vector float __a, vector float __b) {
1722   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1723 }
1724
1725 /* vec_vcmpgtsb */
1726
1727 static __inline__ vector bool char __attribute__((__always_inline__))
1728 vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
1729   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1730 }
1731
1732 /* vec_vcmpgtub */
1733
1734 static __inline__ vector bool char __attribute__((__always_inline__))
1735 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
1736   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1737 }
1738
1739 /* vec_vcmpgtsh */
1740
1741 static __inline__ vector bool short __attribute__((__always_inline__))
1742 vec_vcmpgtsh(vector short __a, vector short __b) {
1743   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1744 }
1745
1746 /* vec_vcmpgtuh */
1747
1748 static __inline__ vector bool short __attribute__((__always_inline__))
1749 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
1750   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1751 }
1752
1753 /* vec_vcmpgtsw */
1754
1755 static __inline__ vector bool int __attribute__((__always_inline__))
1756 vec_vcmpgtsw(vector int __a, vector int __b) {
1757   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1758 }
1759
1760 /* vec_vcmpgtuw */
1761
1762 static __inline__ vector bool int __attribute__((__always_inline__))
1763 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
1764   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1765 }
1766
1767 /* vec_vcmpgtfp */
1768
1769 static __inline__ vector bool int __attribute__((__always_inline__))
1770 vec_vcmpgtfp(vector float __a, vector float __b) {
1771   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1772 }
1773
1774 /* vec_cmple */
1775
1776 static __inline__ vector bool char __ATTRS_o_ai
1777 vec_cmple(vector signed char __a, vector signed char __b) {
1778   return vec_cmpge(__b, __a);
1779 }
1780
1781 static __inline__ vector bool char __ATTRS_o_ai
1782 vec_cmple(vector unsigned char __a, vector unsigned char __b) {
1783   return vec_cmpge(__b, __a);
1784 }
1785
1786 static __inline__ vector bool short __ATTRS_o_ai
1787 vec_cmple(vector signed short __a, vector signed short __b) {
1788   return vec_cmpge(__b, __a);
1789 }
1790
1791 static __inline__ vector bool short __ATTRS_o_ai
1792 vec_cmple(vector unsigned short __a, vector unsigned short __b) {
1793   return vec_cmpge(__b, __a);
1794 }
1795
1796 static __inline__ vector bool int __ATTRS_o_ai
1797 vec_cmple(vector signed int __a, vector signed int __b) {
1798   return vec_cmpge(__b, __a);
1799 }
1800
1801 static __inline__ vector bool int __ATTRS_o_ai
1802 vec_cmple(vector unsigned int __a, vector unsigned int __b) {
1803   return vec_cmpge(__b, __a);
1804 }
1805
1806 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
1807                                                          vector float __b) {
1808   return vec_cmpge(__b, __a);
1809 }
1810
1811 #ifdef __VSX__
1812 static __inline__ vector bool long long __ATTRS_o_ai
1813 vec_cmple(vector double __a, vector double __b) {
1814   return vec_cmpge(__b, __a);
1815 }
1816 #endif
1817
1818 #ifdef __POWER8_VECTOR__
1819 static __inline__ vector bool long long __ATTRS_o_ai
1820 vec_cmple(vector signed long long __a, vector signed long long __b) {
1821   return vec_cmpge(__b, __a);
1822 }
1823
1824 static __inline__ vector bool long long __ATTRS_o_ai
1825 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
1826   return vec_cmpge(__b, __a);
1827 }
1828 #endif
1829
1830 /* vec_cmplt */
1831
1832 static __inline__ vector bool char __ATTRS_o_ai
1833 vec_cmplt(vector signed char __a, vector signed char __b) {
1834   return vec_cmpgt(__b, __a);
1835 }
1836
1837 static __inline__ vector bool char __ATTRS_o_ai
1838 vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
1839   return vec_cmpgt(__b, __a);
1840 }
1841
1842 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
1843                                                            vector short __b) {
1844   return vec_cmpgt(__b, __a);
1845 }
1846
1847 static __inline__ vector bool short __ATTRS_o_ai
1848 vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
1849   return vec_cmpgt(__b, __a);
1850 }
1851
1852 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
1853                                                          vector int __b) {
1854   return vec_cmpgt(__b, __a);
1855 }
1856
1857 static __inline__ vector bool int __ATTRS_o_ai
1858 vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
1859   return vec_cmpgt(__b, __a);
1860 }
1861
1862 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
1863                                                          vector float __b) {
1864   return vec_cmpgt(__b, __a);
1865 }
1866
1867 #ifdef __VSX__
1868 static __inline__ vector bool long long __ATTRS_o_ai
1869 vec_cmplt(vector double __a, vector double __b) {
1870   return vec_cmpgt(__b, __a);
1871 }
1872 #endif
1873
1874 #ifdef __POWER8_VECTOR__
1875 static __inline__ vector bool long long __ATTRS_o_ai
1876 vec_cmplt(vector signed long long __a, vector signed long long __b) {
1877   return vec_cmpgt(__b, __a);
1878 }
1879
1880 static __inline__ vector bool long long __ATTRS_o_ai
1881 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
1882   return vec_cmpgt(__b, __a);
1883 }
1884
1885 /* vec_cntlz */
1886
1887 static __inline__ vector signed char __ATTRS_o_ai
1888 vec_cntlz(vector signed char __a) {
1889   return __builtin_altivec_vclzb(__a);
1890 }
1891 static __inline__ vector unsigned char __ATTRS_o_ai
1892 vec_cntlz(vector unsigned char __a) {
1893   return __builtin_altivec_vclzb(__a);
1894 }
1895 static __inline__ vector signed short __ATTRS_o_ai
1896 vec_cntlz(vector signed short __a) {
1897   return __builtin_altivec_vclzh(__a);
1898 }
1899 static __inline__ vector unsigned short __ATTRS_o_ai
1900 vec_cntlz(vector unsigned short __a) {
1901   return __builtin_altivec_vclzh(__a);
1902 }
1903 static __inline__ vector signed int __ATTRS_o_ai
1904 vec_cntlz(vector signed int __a) {
1905   return __builtin_altivec_vclzw(__a);
1906 }
1907 static __inline__ vector unsigned int __ATTRS_o_ai
1908 vec_cntlz(vector unsigned int __a) {
1909   return __builtin_altivec_vclzw(__a);
1910 }
1911 static __inline__ vector signed long long __ATTRS_o_ai
1912 vec_cntlz(vector signed long long __a) {
1913   return __builtin_altivec_vclzd(__a);
1914 }
1915 static __inline__ vector unsigned long long __ATTRS_o_ai
1916 vec_cntlz(vector unsigned long long __a) {
1917   return __builtin_altivec_vclzd(__a);
1918 }
1919 #endif
1920
1921 /* vec_cpsgn */
1922
1923 #ifdef __VSX__
1924 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
1925                                                       vector float __b) {
1926   return __builtin_vsx_xvcpsgnsp(__a, __b);
1927 }
1928
1929 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
1930                                                        vector double __b) {
1931   return __builtin_vsx_xvcpsgndp(__a, __b);
1932 }
1933 #endif
1934
1935 /* vec_ctf */
1936
1937 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
1938   return __builtin_altivec_vcfsx(__a, __b);
1939 }
1940
1941 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a,
1942                                                     int __b) {
1943   return __builtin_altivec_vcfux((vector int)__a, __b);
1944 }
1945
1946 #ifdef __VSX__
1947 static __inline__ vector double __ATTRS_o_ai
1948 vec_ctf(vector unsigned long long __a, int __b) {
1949   vector double __ret = __builtin_convertvector(__a, vector double);
1950   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1951   return __ret;
1952 }
1953
1954 static __inline__ vector double __ATTRS_o_ai
1955 vec_ctf(vector signed long long __a, int __b) {
1956   vector double __ret = __builtin_convertvector(__a, vector double);
1957   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1958   return __ret;
1959 }
1960 #endif
1961
1962 /* vec_vcfsx */
1963
1964 static __inline__ vector float __attribute__((__always_inline__))
1965 vec_vcfsx(vector int __a, int __b) {
1966   return __builtin_altivec_vcfsx(__a, __b);
1967 }
1968
1969 /* vec_vcfux */
1970
1971 static __inline__ vector float __attribute__((__always_inline__))
1972 vec_vcfux(vector unsigned int __a, int __b) {
1973   return __builtin_altivec_vcfux((vector int)__a, __b);
1974 }
1975
1976 /* vec_cts */
1977
1978 static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) {
1979   return __builtin_altivec_vctsxs(__a, __b);
1980 }
1981
1982 #ifdef __VSX__
1983 static __inline__ vector signed long long __ATTRS_o_ai
1984 vec_cts(vector double __a, int __b) {
1985   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
1986   return __builtin_convertvector(__a, vector signed long long);
1987 }
1988 #endif
1989
1990 /* vec_vctsxs */
1991
1992 static __inline__ vector int __attribute__((__always_inline__))
1993 vec_vctsxs(vector float __a, int __b) {
1994   return __builtin_altivec_vctsxs(__a, __b);
1995 }
1996
1997 /* vec_ctu */
1998
1999 static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a,
2000                                                            int __b) {
2001   return __builtin_altivec_vctuxs(__a, __b);
2002 }
2003
2004 #ifdef __VSX__
2005 static __inline__ vector unsigned long long __ATTRS_o_ai
2006 vec_ctu(vector double __a, int __b) {
2007   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
2008   return __builtin_convertvector(__a, vector unsigned long long);
2009 }
2010 #endif
2011
2012 /* vec_vctuxs */
2013
2014 static __inline__ vector unsigned int __attribute__((__always_inline__))
2015 vec_vctuxs(vector float __a, int __b) {
2016   return __builtin_altivec_vctuxs(__a, __b);
2017 }
2018
2019 /* vec_double */
2020
2021 #ifdef __VSX__
2022 static __inline__ vector double __ATTRS_o_ai
2023 vec_double(vector signed long long __a) {
2024   vector double __ret = {__a[0], __a[1]};
2025   return __ret;
2026 }
2027
2028 static __inline__ vector double __ATTRS_o_ai
2029 vec_double(vector unsigned long long __a) {
2030   vector double __ret = {__a[0], __a[1]};
2031   return __ret;
2032 }
2033 #endif
2034
2035 /* vec_div */
2036
2037 /* Integer vector divides (vectors are scalarized, elements divided
2038    and the vectors reassembled).
2039 */
2040 static __inline__ vector signed char __ATTRS_o_ai
2041 vec_div(vector signed char __a, vector signed char __b) {
2042   return __a / __b;
2043 }
2044
2045 static __inline__ vector unsigned char __ATTRS_o_ai
2046 vec_div(vector unsigned char __a, vector unsigned char __b) {
2047   return __a / __b;
2048 }
2049
2050 static __inline__ vector signed short __ATTRS_o_ai
2051 vec_div(vector signed short __a, vector signed short __b) {
2052   return __a / __b;
2053 }
2054
2055 static __inline__ vector unsigned short __ATTRS_o_ai
2056 vec_div(vector unsigned short __a, vector unsigned short __b) {
2057   return __a / __b;
2058 }
2059
2060 static __inline__ vector signed int __ATTRS_o_ai
2061 vec_div(vector signed int __a, vector signed int __b) {
2062   return __a / __b;
2063 }
2064
2065 static __inline__ vector unsigned int __ATTRS_o_ai
2066 vec_div(vector unsigned int __a, vector unsigned int __b) {
2067   return __a / __b;
2068 }
2069
2070 #ifdef __VSX__
2071 static __inline__ vector signed long long __ATTRS_o_ai
2072 vec_div(vector signed long long __a, vector signed long long __b) {
2073   return __a / __b;
2074 }
2075
2076 static __inline__ vector unsigned long long __ATTRS_o_ai
2077 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
2078   return __a / __b;
2079 }
2080
2081 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
2082                                                     vector float __b) {
2083   return __a / __b;
2084 }
2085
2086 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
2087                                                      vector double __b) {
2088   return __a / __b;
2089 }
2090 #endif
2091
2092 /* vec_dss */
2093
2094 static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
2095   __builtin_altivec_dss(__a);
2096 }
2097
2098 /* vec_dssall */
2099
2100 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
2101   __builtin_altivec_dssall();
2102 }
2103
2104 /* vec_dst */
2105 #define vec_dst(__PTR, __CW, __STR) \
2106   __extension__(                    \
2107       { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
2108
2109 /* vec_dstst */
2110 #define vec_dstst(__PTR, __CW, __STR) \
2111   __extension__(                      \
2112       { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
2113
2114 /* vec_dststt */
2115 #define vec_dststt(__PTR, __CW, __STR) \
2116   __extension__(                       \
2117       { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
2118
2119 /* vec_dstt */
2120 #define vec_dstt(__PTR, __CW, __STR) \
2121   __extension__(                     \
2122       { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
2123
2124 /* vec_eqv */
2125
2126 #ifdef __POWER8_VECTOR__
2127 static __inline__ vector signed char __ATTRS_o_ai
2128 vec_eqv(vector signed char __a, vector signed char __b) {
2129   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2130                                                   (vector unsigned int)__b);
2131 }
2132
2133 static __inline__ vector unsigned char __ATTRS_o_ai
2134 vec_eqv(vector unsigned char __a, vector unsigned char __b) {
2135   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2136                                                     (vector unsigned int)__b);
2137 }
2138
2139 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
2140                                                         vector bool char __b) {
2141   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2142                                                 (vector unsigned int)__b);
2143 }
2144
2145 static __inline__ vector signed short __ATTRS_o_ai
2146 vec_eqv(vector signed short __a, vector signed short __b) {
2147   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2148                                                    (vector unsigned int)__b);
2149 }
2150
2151 static __inline__ vector unsigned short __ATTRS_o_ai
2152 vec_eqv(vector unsigned short __a, vector unsigned short __b) {
2153   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2154                                                      (vector unsigned int)__b);
2155 }
2156
2157 static __inline__ vector bool short __ATTRS_o_ai
2158 vec_eqv(vector bool short __a, vector bool short __b) {
2159   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2160                                                  (vector unsigned int)__b);
2161 }
2162
2163 static __inline__ vector signed int __ATTRS_o_ai
2164 vec_eqv(vector signed int __a, vector signed int __b) {
2165   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2166                                                  (vector unsigned int)__b);
2167 }
2168
2169 static __inline__ vector unsigned int __ATTRS_o_ai
2170 vec_eqv(vector unsigned int __a, vector unsigned int __b) {
2171   return __builtin_vsx_xxleqv(__a, __b);
2172 }
2173
2174 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
2175                                                        vector bool int __b) {
2176   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2177                                                (vector unsigned int)__b);
2178 }
2179
2180 static __inline__ vector signed long long __ATTRS_o_ai
2181 vec_eqv(vector signed long long __a, vector signed long long __b) {
2182   return (vector signed long long)__builtin_vsx_xxleqv(
2183       (vector unsigned int)__a, (vector unsigned int)__b);
2184 }
2185
2186 static __inline__ vector unsigned long long __ATTRS_o_ai
2187 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
2188   return (vector unsigned long long)__builtin_vsx_xxleqv(
2189       (vector unsigned int)__a, (vector unsigned int)__b);
2190 }
2191
2192 static __inline__ vector bool long long __ATTRS_o_ai
2193 vec_eqv(vector bool long long __a, vector bool long long __b) {
2194   return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
2195                                                      (vector unsigned int)__b);
2196 }
2197
2198 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
2199                                                     vector float __b) {
2200   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
2201                                             (vector unsigned int)__b);
2202 }
2203
2204 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
2205                                                      vector double __b) {
2206   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
2207                                              (vector unsigned int)__b);
2208 }
2209 #endif
2210
2211 /* vec_expte */
2212
2213 static __inline__ vector float __attribute__((__always_inline__))
2214 vec_expte(vector float __a) {
2215   return __builtin_altivec_vexptefp(__a);
2216 }
2217
2218 /* vec_vexptefp */
2219
2220 static __inline__ vector float __attribute__((__always_inline__))
2221 vec_vexptefp(vector float __a) {
2222   return __builtin_altivec_vexptefp(__a);
2223 }
2224
2225 /* vec_floor */
2226
2227 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
2228 #ifdef __VSX__
2229   return __builtin_vsx_xvrspim(__a);
2230 #else
2231   return __builtin_altivec_vrfim(__a);
2232 #endif
2233 }
2234
2235 #ifdef __VSX__
2236 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
2237   return __builtin_vsx_xvrdpim(__a);
2238 }
2239 #endif
2240
2241 /* vec_vrfim */
2242
2243 static __inline__ vector float __attribute__((__always_inline__))
2244 vec_vrfim(vector float __a) {
2245   return __builtin_altivec_vrfim(__a);
2246 }
2247
2248 /* vec_ld */
2249
2250 static __inline__ vector signed char __ATTRS_o_ai
2251 vec_ld(int __a, const vector signed char *__b) {
2252   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2253 }
2254
2255 static __inline__ vector signed char __ATTRS_o_ai
2256 vec_ld(int __a, const signed char *__b) {
2257   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2258 }
2259
2260 static __inline__ vector unsigned char __ATTRS_o_ai
2261 vec_ld(int __a, const vector unsigned char *__b) {
2262   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2263 }
2264
2265 static __inline__ vector unsigned char __ATTRS_o_ai
2266 vec_ld(int __a, const unsigned char *__b) {
2267   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2268 }
2269
2270 static __inline__ vector bool char __ATTRS_o_ai
2271 vec_ld(int __a, const vector bool char *__b) {
2272   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2273 }
2274
2275 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
2276                                                    const vector short *__b) {
2277   return (vector short)__builtin_altivec_lvx(__a, __b);
2278 }
2279
2280 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
2281   return (vector short)__builtin_altivec_lvx(__a, __b);
2282 }
2283
2284 static __inline__ vector unsigned short __ATTRS_o_ai
2285 vec_ld(int __a, const vector unsigned short *__b) {
2286   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2287 }
2288
2289 static __inline__ vector unsigned short __ATTRS_o_ai
2290 vec_ld(int __a, const unsigned short *__b) {
2291   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2292 }
2293
2294 static __inline__ vector bool short __ATTRS_o_ai
2295 vec_ld(int __a, const vector bool short *__b) {
2296   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2297 }
2298
2299 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
2300                                                    const vector pixel *__b) {
2301   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2302 }
2303
2304 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
2305                                                  const vector int *__b) {
2306   return (vector int)__builtin_altivec_lvx(__a, __b);
2307 }
2308
2309 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
2310   return (vector int)__builtin_altivec_lvx(__a, __b);
2311 }
2312
2313 static __inline__ vector unsigned int __ATTRS_o_ai
2314 vec_ld(int __a, const vector unsigned int *__b) {
2315   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2316 }
2317
2318 static __inline__ vector unsigned int __ATTRS_o_ai
2319 vec_ld(int __a, const unsigned int *__b) {
2320   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2321 }
2322
2323 static __inline__ vector bool int __ATTRS_o_ai
2324 vec_ld(int __a, const vector bool int *__b) {
2325   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2326 }
2327
2328 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
2329                                                    const vector float *__b) {
2330   return (vector float)__builtin_altivec_lvx(__a, __b);
2331 }
2332
2333 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
2334   return (vector float)__builtin_altivec_lvx(__a, __b);
2335 }
2336
2337 /* vec_lvx */
2338
2339 static __inline__ vector signed char __ATTRS_o_ai
2340 vec_lvx(int __a, const vector signed char *__b) {
2341   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2342 }
2343
2344 static __inline__ vector signed char __ATTRS_o_ai
2345 vec_lvx(int __a, const signed char *__b) {
2346   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2347 }
2348
2349 static __inline__ vector unsigned char __ATTRS_o_ai
2350 vec_lvx(int __a, const vector unsigned char *__b) {
2351   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2352 }
2353
2354 static __inline__ vector unsigned char __ATTRS_o_ai
2355 vec_lvx(int __a, const unsigned char *__b) {
2356   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2357 }
2358
2359 static __inline__ vector bool char __ATTRS_o_ai
2360 vec_lvx(int __a, const vector bool char *__b) {
2361   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2362 }
2363
2364 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
2365                                                     const vector short *__b) {
2366   return (vector short)__builtin_altivec_lvx(__a, __b);
2367 }
2368
2369 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
2370   return (vector short)__builtin_altivec_lvx(__a, __b);
2371 }
2372
2373 static __inline__ vector unsigned short __ATTRS_o_ai
2374 vec_lvx(int __a, const vector unsigned short *__b) {
2375   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2376 }
2377
2378 static __inline__ vector unsigned short __ATTRS_o_ai
2379 vec_lvx(int __a, const unsigned short *__b) {
2380   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2381 }
2382
2383 static __inline__ vector bool short __ATTRS_o_ai
2384 vec_lvx(int __a, const vector bool short *__b) {
2385   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2386 }
2387
2388 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
2389                                                     const vector pixel *__b) {
2390   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2391 }
2392
2393 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
2394                                                   const vector int *__b) {
2395   return (vector int)__builtin_altivec_lvx(__a, __b);
2396 }
2397
2398 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
2399   return (vector int)__builtin_altivec_lvx(__a, __b);
2400 }
2401
2402 static __inline__ vector unsigned int __ATTRS_o_ai
2403 vec_lvx(int __a, const vector unsigned int *__b) {
2404   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2405 }
2406
2407 static __inline__ vector unsigned int __ATTRS_o_ai
2408 vec_lvx(int __a, const unsigned int *__b) {
2409   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2410 }
2411
2412 static __inline__ vector bool int __ATTRS_o_ai
2413 vec_lvx(int __a, const vector bool int *__b) {
2414   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2415 }
2416
2417 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
2418                                                     const vector float *__b) {
2419   return (vector float)__builtin_altivec_lvx(__a, __b);
2420 }
2421
2422 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
2423   return (vector float)__builtin_altivec_lvx(__a, __b);
2424 }
2425
2426 /* vec_lde */
2427
2428 static __inline__ vector signed char __ATTRS_o_ai
2429 vec_lde(int __a, const signed char *__b) {
2430   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2431 }
2432
2433 static __inline__ vector unsigned char __ATTRS_o_ai
2434 vec_lde(int __a, const unsigned char *__b) {
2435   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2436 }
2437
2438 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
2439   return (vector short)__builtin_altivec_lvehx(__a, __b);
2440 }
2441
2442 static __inline__ vector unsigned short __ATTRS_o_ai
2443 vec_lde(int __a, const unsigned short *__b) {
2444   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2445 }
2446
2447 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
2448   return (vector int)__builtin_altivec_lvewx(__a, __b);
2449 }
2450
2451 static __inline__ vector unsigned int __ATTRS_o_ai
2452 vec_lde(int __a, const unsigned int *__b) {
2453   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2454 }
2455
2456 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
2457   return (vector float)__builtin_altivec_lvewx(__a, __b);
2458 }
2459
2460 /* vec_lvebx */
2461
2462 static __inline__ vector signed char __ATTRS_o_ai
2463 vec_lvebx(int __a, const signed char *__b) {
2464   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2465 }
2466
2467 static __inline__ vector unsigned char __ATTRS_o_ai
2468 vec_lvebx(int __a, const unsigned char *__b) {
2469   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2470 }
2471
2472 /* vec_lvehx */
2473
2474 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
2475                                                       const short *__b) {
2476   return (vector short)__builtin_altivec_lvehx(__a, __b);
2477 }
2478
2479 static __inline__ vector unsigned short __ATTRS_o_ai
2480 vec_lvehx(int __a, const unsigned short *__b) {
2481   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2482 }
2483
2484 /* vec_lvewx */
2485
2486 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
2487   return (vector int)__builtin_altivec_lvewx(__a, __b);
2488 }
2489
2490 static __inline__ vector unsigned int __ATTRS_o_ai
2491 vec_lvewx(int __a, const unsigned int *__b) {
2492   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2493 }
2494
2495 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
2496                                                       const float *__b) {
2497   return (vector float)__builtin_altivec_lvewx(__a, __b);
2498 }
2499
2500 /* vec_ldl */
2501
2502 static __inline__ vector signed char __ATTRS_o_ai
2503 vec_ldl(int __a, const vector signed char *__b) {
2504   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2505 }
2506
2507 static __inline__ vector signed char __ATTRS_o_ai
2508 vec_ldl(int __a, const signed char *__b) {
2509   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2510 }
2511
2512 static __inline__ vector unsigned char __ATTRS_o_ai
2513 vec_ldl(int __a, const vector unsigned char *__b) {
2514   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2515 }
2516
2517 static __inline__ vector unsigned char __ATTRS_o_ai
2518 vec_ldl(int __a, const unsigned char *__b) {
2519   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2520 }
2521
2522 static __inline__ vector bool char __ATTRS_o_ai
2523 vec_ldl(int __a, const vector bool char *__b) {
2524   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2525 }
2526
2527 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
2528                                                     const vector short *__b) {
2529   return (vector short)__builtin_altivec_lvxl(__a, __b);
2530 }
2531
2532 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
2533   return (vector short)__builtin_altivec_lvxl(__a, __b);
2534 }
2535
2536 static __inline__ vector unsigned short __ATTRS_o_ai
2537 vec_ldl(int __a, const vector unsigned short *__b) {
2538   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2539 }
2540
2541 static __inline__ vector unsigned short __ATTRS_o_ai
2542 vec_ldl(int __a, const unsigned short *__b) {
2543   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2544 }
2545
2546 static __inline__ vector bool short __ATTRS_o_ai
2547 vec_ldl(int __a, const vector bool short *__b) {
2548   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2549 }
2550
2551 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
2552                                                     const vector pixel *__b) {
2553   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
2554 }
2555
2556 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
2557                                                   const vector int *__b) {
2558   return (vector int)__builtin_altivec_lvxl(__a, __b);
2559 }
2560
2561 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
2562   return (vector int)__builtin_altivec_lvxl(__a, __b);
2563 }
2564
2565 static __inline__ vector unsigned int __ATTRS_o_ai
2566 vec_ldl(int __a, const vector unsigned int *__b) {
2567   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2568 }
2569
2570 static __inline__ vector unsigned int __ATTRS_o_ai
2571 vec_ldl(int __a, const unsigned int *__b) {
2572   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2573 }
2574
2575 static __inline__ vector bool int __ATTRS_o_ai
2576 vec_ldl(int __a, const vector bool int *__b) {
2577   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2578 }
2579
2580 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
2581                                                     const vector float *__b) {
2582   return (vector float)__builtin_altivec_lvxl(__a, __b);
2583 }
2584
2585 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
2586   return (vector float)__builtin_altivec_lvxl(__a, __b);
2587 }
2588
2589 /* vec_lvxl */
2590
2591 static __inline__ vector signed char __ATTRS_o_ai
2592 vec_lvxl(int __a, const vector signed char *__b) {
2593   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2594 }
2595
2596 static __inline__ vector signed char __ATTRS_o_ai
2597 vec_lvxl(int __a, const signed char *__b) {
2598   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2599 }
2600
2601 static __inline__ vector unsigned char __ATTRS_o_ai
2602 vec_lvxl(int __a, const vector unsigned char *__b) {
2603   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2604 }
2605
2606 static __inline__ vector unsigned char __ATTRS_o_ai
2607 vec_lvxl(int __a, const unsigned char *__b) {
2608   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2609 }
2610
2611 static __inline__ vector bool char __ATTRS_o_ai
2612 vec_lvxl(int __a, const vector bool char *__b) {
2613   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2614 }
2615
2616 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
2617                                                      const vector short *__b) {
2618   return (vector short)__builtin_altivec_lvxl(__a, __b);
2619 }
2620
2621 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
2622                                                      const short *__b) {
2623   return (vector short)__builtin_altivec_lvxl(__a, __b);
2624 }
2625
2626 static __inline__ vector unsigned short __ATTRS_o_ai
2627 vec_lvxl(int __a, const vector unsigned short *__b) {
2628   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2629 }
2630
2631 static __inline__ vector unsigned short __ATTRS_o_ai
2632 vec_lvxl(int __a, const unsigned short *__b) {
2633   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2634 }
2635
2636 static __inline__ vector bool short __ATTRS_o_ai
2637 vec_lvxl(int __a, const vector bool short *__b) {
2638   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2639 }
2640
2641 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
2642                                                      const vector pixel *__b) {
2643   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
2644 }
2645
2646 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
2647                                                    const vector int *__b) {
2648   return (vector int)__builtin_altivec_lvxl(__a, __b);
2649 }
2650
2651 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
2652   return (vector int)__builtin_altivec_lvxl(__a, __b);
2653 }
2654
2655 static __inline__ vector unsigned int __ATTRS_o_ai
2656 vec_lvxl(int __a, const vector unsigned int *__b) {
2657   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2658 }
2659
2660 static __inline__ vector unsigned int __ATTRS_o_ai
2661 vec_lvxl(int __a, const unsigned int *__b) {
2662   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2663 }
2664
2665 static __inline__ vector bool int __ATTRS_o_ai
2666 vec_lvxl(int __a, const vector bool int *__b) {
2667   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2668 }
2669
2670 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
2671                                                      const vector float *__b) {
2672   return (vector float)__builtin_altivec_lvxl(__a, __b);
2673 }
2674
2675 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
2676                                                      const float *__b) {
2677   return (vector float)__builtin_altivec_lvxl(__a, __b);
2678 }
2679
2680 /* vec_loge */
2681
2682 static __inline__ vector float __attribute__((__always_inline__))
2683 vec_loge(vector float __a) {
2684   return __builtin_altivec_vlogefp(__a);
2685 }
2686
2687 /* vec_vlogefp */
2688
2689 static __inline__ vector float __attribute__((__always_inline__))
2690 vec_vlogefp(vector float __a) {
2691   return __builtin_altivec_vlogefp(__a);
2692 }
2693
2694 /* vec_lvsl */
2695
2696 #ifdef __LITTLE_ENDIAN__
2697 static __inline__ vector unsigned char __ATTRS_o_ai
2698     __attribute__((__deprecated__("use assignment for unaligned little endian \
2699 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2700   vector unsigned char mask =
2701       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2702   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2703                                   7,  6,  5,  4,  3,  2,  1, 0};
2704   return vec_perm(mask, mask, reverse);
2705 }
2706 #else
2707 static __inline__ vector unsigned char __ATTRS_o_ai
2708 vec_lvsl(int __a, const signed char *__b) {
2709   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2710 }
2711 #endif
2712
2713 #ifdef __LITTLE_ENDIAN__
2714 static __inline__ vector unsigned char __ATTRS_o_ai
2715     __attribute__((__deprecated__("use assignment for unaligned little endian \
2716 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
2717   vector unsigned char mask =
2718       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2719   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2720                                   7,  6,  5,  4,  3,  2,  1, 0};
2721   return vec_perm(mask, mask, reverse);
2722 }
2723 #else
2724 static __inline__ vector unsigned char __ATTRS_o_ai
2725 vec_lvsl(int __a, const unsigned char *__b) {
2726   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2727 }
2728 #endif
2729
2730 #ifdef __LITTLE_ENDIAN__
2731 static __inline__ vector unsigned char __ATTRS_o_ai
2732     __attribute__((__deprecated__("use assignment for unaligned little endian \
2733 loads/stores"))) vec_lvsl(int __a, const short *__b) {
2734   vector unsigned char mask =
2735       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2736   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2737                                   7,  6,  5,  4,  3,  2,  1, 0};
2738   return vec_perm(mask, mask, reverse);
2739 }
2740 #else
2741 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2742                                                              const short *__b) {
2743   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2744 }
2745 #endif
2746
2747 #ifdef __LITTLE_ENDIAN__
2748 static __inline__ vector unsigned char __ATTRS_o_ai
2749     __attribute__((__deprecated__("use assignment for unaligned little endian \
2750 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
2751   vector unsigned char mask =
2752       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2753   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2754                                   7,  6,  5,  4,  3,  2,  1, 0};
2755   return vec_perm(mask, mask, reverse);
2756 }
2757 #else
2758 static __inline__ vector unsigned char __ATTRS_o_ai
2759 vec_lvsl(int __a, const unsigned short *__b) {
2760   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2761 }
2762 #endif
2763
2764 #ifdef __LITTLE_ENDIAN__
2765 static __inline__ vector unsigned char __ATTRS_o_ai
2766     __attribute__((__deprecated__("use assignment for unaligned little endian \
2767 loads/stores"))) vec_lvsl(int __a, const int *__b) {
2768   vector unsigned char mask =
2769       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2770   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2771                                   7,  6,  5,  4,  3,  2,  1, 0};
2772   return vec_perm(mask, mask, reverse);
2773 }
2774 #else
2775 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2776                                                              const int *__b) {
2777   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2778 }
2779 #endif
2780
2781 #ifdef __LITTLE_ENDIAN__
2782 static __inline__ vector unsigned char __ATTRS_o_ai
2783     __attribute__((__deprecated__("use assignment for unaligned little endian \
2784 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
2785   vector unsigned char mask =
2786       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2787   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2788                                   7,  6,  5,  4,  3,  2,  1, 0};
2789   return vec_perm(mask, mask, reverse);
2790 }
2791 #else
2792 static __inline__ vector unsigned char __ATTRS_o_ai
2793 vec_lvsl(int __a, const unsigned int *__b) {
2794   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2795 }
2796 #endif
2797
2798 #ifdef __LITTLE_ENDIAN__
2799 static __inline__ vector unsigned char __ATTRS_o_ai
2800     __attribute__((__deprecated__("use assignment for unaligned little endian \
2801 loads/stores"))) vec_lvsl(int __a, const float *__b) {
2802   vector unsigned char mask =
2803       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2804   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2805                                   7,  6,  5,  4,  3,  2,  1, 0};
2806   return vec_perm(mask, mask, reverse);
2807 }
2808 #else
2809 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2810                                                              const float *__b) {
2811   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2812 }
2813 #endif
2814
2815 /* vec_lvsr */
2816
2817 #ifdef __LITTLE_ENDIAN__
2818 static __inline__ vector unsigned char __ATTRS_o_ai
2819     __attribute__((__deprecated__("use assignment for unaligned little endian \
2820 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
2821   vector unsigned char mask =
2822       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2823   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2824                                   7,  6,  5,  4,  3,  2,  1, 0};
2825   return vec_perm(mask, mask, reverse);
2826 }
2827 #else
2828 static __inline__ vector unsigned char __ATTRS_o_ai
2829 vec_lvsr(int __a, const signed char *__b) {
2830   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2831 }
2832 #endif
2833
2834 #ifdef __LITTLE_ENDIAN__
2835 static __inline__ vector unsigned char __ATTRS_o_ai
2836     __attribute__((__deprecated__("use assignment for unaligned little endian \
2837 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
2838   vector unsigned char mask =
2839       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2840   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2841                                   7,  6,  5,  4,  3,  2,  1, 0};
2842   return vec_perm(mask, mask, reverse);
2843 }
2844 #else
2845 static __inline__ vector unsigned char __ATTRS_o_ai
2846 vec_lvsr(int __a, const unsigned char *__b) {
2847   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2848 }
2849 #endif
2850
2851 #ifdef __LITTLE_ENDIAN__
2852 static __inline__ vector unsigned char __ATTRS_o_ai
2853     __attribute__((__deprecated__("use assignment for unaligned little endian \
2854 loads/stores"))) vec_lvsr(int __a, const short *__b) {
2855   vector unsigned char mask =
2856       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2857   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2858                                   7,  6,  5,  4,  3,  2,  1, 0};
2859   return vec_perm(mask, mask, reverse);
2860 }
2861 #else
2862 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2863                                                              const short *__b) {
2864   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2865 }
2866 #endif
2867
2868 #ifdef __LITTLE_ENDIAN__
2869 static __inline__ vector unsigned char __ATTRS_o_ai
2870     __attribute__((__deprecated__("use assignment for unaligned little endian \
2871 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
2872   vector unsigned char mask =
2873       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2874   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2875                                   7,  6,  5,  4,  3,  2,  1, 0};
2876   return vec_perm(mask, mask, reverse);
2877 }
2878 #else
2879 static __inline__ vector unsigned char __ATTRS_o_ai
2880 vec_lvsr(int __a, const unsigned short *__b) {
2881   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2882 }
2883 #endif
2884
2885 #ifdef __LITTLE_ENDIAN__
2886 static __inline__ vector unsigned char __ATTRS_o_ai
2887     __attribute__((__deprecated__("use assignment for unaligned little endian \
2888 loads/stores"))) vec_lvsr(int __a, const int *__b) {
2889   vector unsigned char mask =
2890       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2891   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2892                                   7,  6,  5,  4,  3,  2,  1, 0};
2893   return vec_perm(mask, mask, reverse);
2894 }
2895 #else
2896 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2897                                                              const int *__b) {
2898   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2899 }
2900 #endif
2901
2902 #ifdef __LITTLE_ENDIAN__
2903 static __inline__ vector unsigned char __ATTRS_o_ai
2904     __attribute__((__deprecated__("use assignment for unaligned little endian \
2905 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
2906   vector unsigned char mask =
2907       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2908   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2909                                   7,  6,  5,  4,  3,  2,  1, 0};
2910   return vec_perm(mask, mask, reverse);
2911 }
2912 #else
2913 static __inline__ vector unsigned char __ATTRS_o_ai
2914 vec_lvsr(int __a, const unsigned int *__b) {
2915   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2916 }
2917 #endif
2918
2919 #ifdef __LITTLE_ENDIAN__
2920 static __inline__ vector unsigned char __ATTRS_o_ai
2921     __attribute__((__deprecated__("use assignment for unaligned little endian \
2922 loads/stores"))) vec_lvsr(int __a, const float *__b) {
2923   vector unsigned char mask =
2924       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2925   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2926                                   7,  6,  5,  4,  3,  2,  1, 0};
2927   return vec_perm(mask, mask, reverse);
2928 }
2929 #else
2930 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2931                                                              const float *__b) {
2932   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2933 }
2934 #endif
2935
2936 /* vec_madd */
2937 static __inline__ vector signed short __ATTRS_o_ai
2938 vec_mladd(vector signed short, vector signed short, vector signed short);
2939 static __inline__ vector signed short __ATTRS_o_ai
2940 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
2941 static __inline__ vector signed short __ATTRS_o_ai
2942 vec_mladd(vector unsigned short, vector signed short, vector signed short);
2943 static __inline__ vector unsigned short __ATTRS_o_ai
2944 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
2945
2946 static __inline__ vector signed short __ATTRS_o_ai vec_madd(
2947     vector signed short __a, vector signed short __b, vector signed short __c) {
2948   return vec_mladd(__a, __b, __c);
2949 }
2950
2951 static __inline__ vector signed short __ATTRS_o_ai
2952 vec_madd(vector signed short __a, vector unsigned short __b,
2953          vector unsigned short __c) {
2954   return vec_mladd(__a, __b, __c);
2955 }
2956
2957 static __inline__ vector signed short __ATTRS_o_ai
2958 vec_madd(vector unsigned short __a, vector signed short __b,
2959          vector signed short __c) {
2960   return vec_mladd(__a, __b, __c);
2961 }
2962
2963 static __inline__ vector unsigned short __ATTRS_o_ai
2964 vec_madd(vector unsigned short __a, vector unsigned short __b,
2965          vector unsigned short __c) {
2966   return vec_mladd(__a, __b, __c);
2967 }
2968
2969 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
2970                                                      vector float __b,
2971                                                      vector float __c) {
2972 #ifdef __VSX__
2973   return __builtin_vsx_xvmaddasp(__a, __b, __c);
2974 #else
2975   return __builtin_altivec_vmaddfp(__a, __b, __c);
2976 #endif
2977 }
2978
2979 #ifdef __VSX__
2980 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
2981                                                       vector double __b,
2982                                                       vector double __c) {
2983   return __builtin_vsx_xvmaddadp(__a, __b, __c);
2984 }
2985 #endif
2986
2987 /* vec_vmaddfp */
2988
2989 static __inline__ vector float __attribute__((__always_inline__))
2990 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
2991   return __builtin_altivec_vmaddfp(__a, __b, __c);
2992 }
2993
2994 /* vec_madds */
2995
2996 static __inline__ vector signed short __attribute__((__always_inline__))
2997 vec_madds(vector signed short __a, vector signed short __b,
2998           vector signed short __c) {
2999   return __builtin_altivec_vmhaddshs(__a, __b, __c);
3000 }
3001
3002 /* vec_vmhaddshs */
3003 static __inline__ vector signed short __attribute__((__always_inline__))
3004 vec_vmhaddshs(vector signed short __a, vector signed short __b,
3005               vector signed short __c) {
3006   return __builtin_altivec_vmhaddshs(__a, __b, __c);
3007 }
3008
3009 /* vec_msub */
3010
3011 #ifdef __VSX__
3012 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
3013                                                      vector float __b,
3014                                                      vector float __c) {
3015   return __builtin_vsx_xvmsubasp(__a, __b, __c);
3016 }
3017
3018 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
3019                                                       vector double __b,
3020                                                       vector double __c) {
3021   return __builtin_vsx_xvmsubadp(__a, __b, __c);
3022 }
3023 #endif
3024
3025 /* vec_max */
3026
3027 static __inline__ vector signed char __ATTRS_o_ai
3028 vec_max(vector signed char __a, vector signed char __b) {
3029   return __builtin_altivec_vmaxsb(__a, __b);
3030 }
3031
3032 static __inline__ vector signed char __ATTRS_o_ai
3033 vec_max(vector bool char __a, vector signed char __b) {
3034   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3035 }
3036
3037 static __inline__ vector signed char __ATTRS_o_ai
3038 vec_max(vector signed char __a, vector bool char __b) {
3039   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3040 }
3041
3042 static __inline__ vector unsigned char __ATTRS_o_ai
3043 vec_max(vector unsigned char __a, vector unsigned char __b) {
3044   return __builtin_altivec_vmaxub(__a, __b);
3045 }
3046
3047 static __inline__ vector unsigned char __ATTRS_o_ai
3048 vec_max(vector bool char __a, vector unsigned char __b) {
3049   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3050 }
3051
3052 static __inline__ vector unsigned char __ATTRS_o_ai
3053 vec_max(vector unsigned char __a, vector bool char __b) {
3054   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3055 }
3056
3057 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3058                                                     vector short __b) {
3059   return __builtin_altivec_vmaxsh(__a, __b);
3060 }
3061
3062 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
3063                                                     vector short __b) {
3064   return __builtin_altivec_vmaxsh((vector short)__a, __b);
3065 }
3066
3067 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
3068                                                     vector bool short __b) {
3069   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3070 }
3071
3072 static __inline__ vector unsigned short __ATTRS_o_ai
3073 vec_max(vector unsigned short __a, vector unsigned short __b) {
3074   return __builtin_altivec_vmaxuh(__a, __b);
3075 }
3076
3077 static __inline__ vector unsigned short __ATTRS_o_ai
3078 vec_max(vector bool short __a, vector unsigned short __b) {
3079   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3080 }
3081
3082 static __inline__ vector unsigned short __ATTRS_o_ai
3083 vec_max(vector unsigned short __a, vector bool short __b) {
3084   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3085 }
3086
3087 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3088                                                   vector int __b) {
3089   return __builtin_altivec_vmaxsw(__a, __b);
3090 }
3091
3092 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
3093                                                   vector int __b) {
3094   return __builtin_altivec_vmaxsw((vector int)__a, __b);
3095 }
3096
3097 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
3098                                                   vector bool int __b) {
3099   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3100 }
3101
3102 static __inline__ vector unsigned int __ATTRS_o_ai
3103 vec_max(vector unsigned int __a, vector unsigned int __b) {
3104   return __builtin_altivec_vmaxuw(__a, __b);
3105 }
3106
3107 static __inline__ vector unsigned int __ATTRS_o_ai
3108 vec_max(vector bool int __a, vector unsigned int __b) {
3109   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3110 }
3111
3112 static __inline__ vector unsigned int __ATTRS_o_ai
3113 vec_max(vector unsigned int __a, vector bool int __b) {
3114   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3115 }
3116
3117 #ifdef __POWER8_VECTOR__
3118 static __inline__ vector signed long long __ATTRS_o_ai
3119 vec_max(vector signed long long __a, vector signed long long __b) {
3120   return __builtin_altivec_vmaxsd(__a, __b);
3121 }
3122
3123 static __inline__ vector signed long long __ATTRS_o_ai
3124 vec_max(vector bool long long __a, vector signed long long __b) {
3125   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
3126 }
3127
3128 static __inline__ vector signed long long __ATTRS_o_ai
3129 vec_max(vector signed long long __a, vector bool long long __b) {
3130   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
3131 }
3132
3133 static __inline__ vector unsigned long long __ATTRS_o_ai
3134 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
3135   return __builtin_altivec_vmaxud(__a, __b);
3136 }
3137
3138 static __inline__ vector unsigned long long __ATTRS_o_ai
3139 vec_max(vector bool long long __a, vector unsigned long long __b) {
3140   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
3141 }
3142
3143 static __inline__ vector unsigned long long __ATTRS_o_ai
3144 vec_max(vector unsigned long long __a, vector bool long long __b) {
3145   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
3146 }
3147 #endif
3148
3149 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
3150                                                     vector float __b) {
3151 #ifdef __VSX__
3152   return __builtin_vsx_xvmaxsp(__a, __b);
3153 #else
3154   return __builtin_altivec_vmaxfp(__a, __b);
3155 #endif
3156 }
3157
3158 #ifdef __VSX__
3159 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
3160                                                      vector double __b) {
3161   return __builtin_vsx_xvmaxdp(__a, __b);
3162 }
3163 #endif
3164
3165 /* vec_vmaxsb */
3166
3167 static __inline__ vector signed char __ATTRS_o_ai
3168 vec_vmaxsb(vector signed char __a, vector signed char __b) {
3169   return __builtin_altivec_vmaxsb(__a, __b);
3170 }
3171
3172 static __inline__ vector signed char __ATTRS_o_ai
3173 vec_vmaxsb(vector bool char __a, vector signed char __b) {
3174   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3175 }
3176
3177 static __inline__ vector signed char __ATTRS_o_ai
3178 vec_vmaxsb(vector signed char __a, vector bool char __b) {
3179   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3180 }
3181
3182 /* vec_vmaxub */
3183
3184 static __inline__ vector unsigned char __ATTRS_o_ai
3185 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
3186   return __builtin_altivec_vmaxub(__a, __b);
3187 }
3188
3189 static __inline__ vector unsigned char __ATTRS_o_ai
3190 vec_vmaxub(vector bool char __a, vector unsigned char __b) {
3191   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3192 }
3193
3194 static __inline__ vector unsigned char __ATTRS_o_ai
3195 vec_vmaxub(vector unsigned char __a, vector bool char __b) {
3196   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3197 }
3198
3199 /* vec_vmaxsh */
3200
3201 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3202                                                        vector short __b) {
3203   return __builtin_altivec_vmaxsh(__a, __b);
3204 }
3205
3206 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
3207                                                        vector short __b) {
3208   return __builtin_altivec_vmaxsh((vector short)__a, __b);
3209 }
3210
3211 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3212                                                        vector bool short __b) {
3213   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3214 }
3215
3216 /* vec_vmaxuh */
3217
3218 static __inline__ vector unsigned short __ATTRS_o_ai
3219 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
3220   return __builtin_altivec_vmaxuh(__a, __b);
3221 }
3222
3223 static __inline__ vector unsigned short __ATTRS_o_ai
3224 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
3225   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3226 }
3227
3228 static __inline__ vector unsigned short __ATTRS_o_ai
3229 vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
3230   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3231 }
3232
3233 /* vec_vmaxsw */
3234
3235 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3236                                                      vector int __b) {
3237   return __builtin_altivec_vmaxsw(__a, __b);
3238 }
3239
3240 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
3241                                                      vector int __b) {
3242   return __builtin_altivec_vmaxsw((vector int)__a, __b);
3243 }
3244
3245 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
3246                                                      vector bool int __b) {
3247   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3248 }
3249
3250 /* vec_vmaxuw */
3251
3252 static __inline__ vector unsigned int __ATTRS_o_ai
3253 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
3254   return __builtin_altivec_vmaxuw(__a, __b);
3255 }
3256
3257 static __inline__ vector unsigned int __ATTRS_o_ai
3258 vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
3259   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3260 }
3261
3262 static __inline__ vector unsigned int __ATTRS_o_ai
3263 vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
3264   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3265 }
3266
3267 /* vec_vmaxfp */
3268
3269 static __inline__ vector float __attribute__((__always_inline__))
3270 vec_vmaxfp(vector float __a, vector float __b) {
3271 #ifdef __VSX__
3272   return __builtin_vsx_xvmaxsp(__a, __b);
3273 #else
3274   return __builtin_altivec_vmaxfp(__a, __b);
3275 #endif
3276 }
3277
3278 /* vec_mergeh */
3279
3280 static __inline__ vector signed char __ATTRS_o_ai
3281 vec_mergeh(vector signed char __a, vector signed char __b) {
3282   return vec_perm(__a, __b,
3283                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3284                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3285                                          0x06, 0x16, 0x07, 0x17));
3286 }
3287
3288 static __inline__ vector unsigned char __ATTRS_o_ai
3289 vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
3290   return vec_perm(__a, __b,
3291                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3292                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3293                                          0x06, 0x16, 0x07, 0x17));
3294 }
3295
3296 static __inline__ vector bool char __ATTRS_o_ai
3297 vec_mergeh(vector bool char __a, vector bool char __b) {
3298   return vec_perm(__a, __b,
3299                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3300                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3301                                          0x06, 0x16, 0x07, 0x17));
3302 }
3303
3304 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
3305                                                        vector short __b) {
3306   return vec_perm(__a, __b,
3307                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3308                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3309                                          0x06, 0x07, 0x16, 0x17));
3310 }
3311
3312 static __inline__ vector unsigned short __ATTRS_o_ai
3313 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
3314   return vec_perm(__a, __b,
3315                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3316                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3317                                          0x06, 0x07, 0x16, 0x17));
3318 }
3319
3320 static __inline__ vector bool short __ATTRS_o_ai
3321 vec_mergeh(vector bool short __a, vector bool short __b) {
3322   return vec_perm(__a, __b,
3323                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3324                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3325                                          0x06, 0x07, 0x16, 0x17));
3326 }
3327
3328 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
3329                                                        vector pixel __b) {
3330   return vec_perm(__a, __b,
3331                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3332                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3333                                          0x06, 0x07, 0x16, 0x17));
3334 }
3335
3336 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
3337                                                      vector int __b) {
3338   return vec_perm(__a, __b,
3339                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3340                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3341                                          0x14, 0x15, 0x16, 0x17));
3342 }
3343
3344 static __inline__ vector unsigned int __ATTRS_o_ai
3345 vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
3346   return vec_perm(__a, __b,
3347                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3348                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3349                                          0x14, 0x15, 0x16, 0x17));
3350 }
3351
3352 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
3353                                                           vector bool int __b) {
3354   return vec_perm(__a, __b,
3355                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3356                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3357                                          0x14, 0x15, 0x16, 0x17));
3358 }
3359
3360 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
3361                                                        vector float __b) {
3362   return vec_perm(__a, __b,
3363                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3364                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3365                                          0x14, 0x15, 0x16, 0x17));
3366 }
3367
3368 #ifdef __VSX__
3369 static __inline__ vector signed long long __ATTRS_o_ai
3370 vec_mergeh(vector signed long long __a, vector signed long long __b) {
3371   return vec_perm(__a, __b,
3372                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3373                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3374                                          0x14, 0x15, 0x16, 0x17));
3375 }
3376
3377 static __inline__ vector signed long long __ATTRS_o_ai
3378 vec_mergeh(vector signed long long __a, vector bool long long __b) {
3379   return vec_perm(__a, (vector signed long long)__b,
3380                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3381                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3382                                          0x14, 0x15, 0x16, 0x17));
3383 }
3384
3385 static __inline__ vector signed long long __ATTRS_o_ai
3386 vec_mergeh(vector bool long long __a, vector signed long long __b) {
3387   return vec_perm((vector signed long long)__a, __b,
3388                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3389                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3390                                          0x14, 0x15, 0x16, 0x17));
3391 }
3392
3393 static __inline__ vector unsigned long long __ATTRS_o_ai
3394 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
3395   return vec_perm(__a, __b,
3396                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3397                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3398                                          0x14, 0x15, 0x16, 0x17));
3399 }
3400
3401 static __inline__ vector unsigned long long __ATTRS_o_ai
3402 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
3403   return vec_perm(__a, (vector unsigned long long)__b,
3404                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3405                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3406                                          0x14, 0x15, 0x16, 0x17));
3407 }
3408
3409 static __inline__ vector unsigned long long __ATTRS_o_ai
3410 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
3411   return vec_perm((vector unsigned long long)__a, __b,
3412                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3413                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3414                                          0x14, 0x15, 0x16, 0x17));
3415 }
3416
3417 static __inline__ vector bool long long __ATTRS_o_ai
3418 vec_mergeh(vector bool long long __a, vector bool long long __b) {
3419   return vec_perm(__a, __b,
3420                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3421                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3422                                          0x14, 0x15, 0x16, 0x17));
3423 }
3424
3425 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3426                                                         vector double __b) {
3427   return vec_perm(__a, __b,
3428                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3429                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3430                                          0x14, 0x15, 0x16, 0x17));
3431 }
3432 static __inline__ vector double __ATTRS_o_ai
3433 vec_mergeh(vector double __a, vector bool long long __b) {
3434   return vec_perm(__a, (vector double)__b,
3435                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3436                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3437                                          0x14, 0x15, 0x16, 0x17));
3438 }
3439 static __inline__ vector double __ATTRS_o_ai
3440 vec_mergeh(vector bool long long __a, vector double __b) {
3441   return vec_perm((vector double)__a, __b,
3442                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
3443                                          0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
3444                                          0x14, 0x15, 0x16, 0x17));
3445 }
3446 #endif
3447
3448 /* vec_vmrghb */
3449
3450 #define __builtin_altivec_vmrghb vec_vmrghb
3451
3452 static __inline__ vector signed char __ATTRS_o_ai
3453 vec_vmrghb(vector signed char __a, vector signed char __b) {
3454   return vec_perm(__a, __b,
3455                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3456                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3457                                          0x06, 0x16, 0x07, 0x17));
3458 }
3459
3460 static __inline__ vector unsigned char __ATTRS_o_ai
3461 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
3462   return vec_perm(__a, __b,
3463                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3464                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3465                                          0x06, 0x16, 0x07, 0x17));
3466 }
3467
3468 static __inline__ vector bool char __ATTRS_o_ai
3469 vec_vmrghb(vector bool char __a, vector bool char __b) {
3470   return vec_perm(__a, __b,
3471                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3472                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3473                                          0x06, 0x16, 0x07, 0x17));
3474 }
3475
3476 /* vec_vmrghh */
3477
3478 #define __builtin_altivec_vmrghh vec_vmrghh
3479
3480 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
3481                                                        vector short __b) {
3482   return vec_perm(__a, __b,
3483                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3484                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3485                                          0x06, 0x07, 0x16, 0x17));
3486 }
3487
3488 static __inline__ vector unsigned short __ATTRS_o_ai
3489 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
3490   return vec_perm(__a, __b,
3491                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3492                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3493                                          0x06, 0x07, 0x16, 0x17));
3494 }
3495
3496 static __inline__ vector bool short __ATTRS_o_ai
3497 vec_vmrghh(vector bool short __a, vector bool short __b) {
3498   return vec_perm(__a, __b,
3499                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3500                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3501                                          0x06, 0x07, 0x16, 0x17));
3502 }
3503
3504 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
3505                                                        vector pixel __b) {
3506   return vec_perm(__a, __b,
3507                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3508                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3509                                          0x06, 0x07, 0x16, 0x17));
3510 }
3511
3512 /* vec_vmrghw */
3513
3514 #define __builtin_altivec_vmrghw vec_vmrghw
3515
3516 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
3517                                                      vector int __b) {
3518   return vec_perm(__a, __b,
3519                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3520                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3521                                          0x14, 0x15, 0x16, 0x17));
3522 }
3523
3524 static __inline__ vector unsigned int __ATTRS_o_ai
3525 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
3526   return vec_perm(__a, __b,
3527                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3528                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3529                                          0x14, 0x15, 0x16, 0x17));
3530 }
3531
3532 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
3533                                                           vector bool int __b) {
3534   return vec_perm(__a, __b,
3535                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3536                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3537                                          0x14, 0x15, 0x16, 0x17));
3538 }
3539
3540 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
3541                                                        vector float __b) {
3542   return vec_perm(__a, __b,
3543                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3544                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3545                                          0x14, 0x15, 0x16, 0x17));
3546 }
3547
3548 /* vec_mergel */
3549
3550 static __inline__ vector signed char __ATTRS_o_ai
3551 vec_mergel(vector signed char __a, vector signed char __b) {
3552   return vec_perm(__a, __b,
3553                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3554                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3555                                          0x0E, 0x1E, 0x0F, 0x1F));
3556 }
3557
3558 static __inline__ vector unsigned char __ATTRS_o_ai
3559 vec_mergel(vector unsigned char __a, vector unsigned char __b) {
3560   return vec_perm(__a, __b,
3561                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3562                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3563                                          0x0E, 0x1E, 0x0F, 0x1F));
3564 }
3565
3566 static __inline__ vector bool char __ATTRS_o_ai
3567 vec_mergel(vector bool char __a, vector bool char __b) {
3568   return vec_perm(__a, __b,
3569                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3570                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3571                                          0x0E, 0x1E, 0x0F, 0x1F));
3572 }
3573
3574 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
3575                                                        vector short __b) {
3576   return vec_perm(__a, __b,
3577                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3578                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3579                                          0x0E, 0x0F, 0x1E, 0x1F));
3580 }
3581
3582 static __inline__ vector unsigned short __ATTRS_o_ai
3583 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
3584   return vec_perm(__a, __b,
3585                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3586                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3587                                          0x0E, 0x0F, 0x1E, 0x1F));
3588 }
3589
3590 static __inline__ vector bool short __ATTRS_o_ai
3591 vec_mergel(vector bool short __a, vector bool short __b) {
3592   return vec_perm(__a, __b,
3593                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3594                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3595                                          0x0E, 0x0F, 0x1E, 0x1F));
3596 }
3597
3598 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
3599                                                        vector pixel __b) {
3600   return vec_perm(__a, __b,
3601                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3602                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3603                                          0x0E, 0x0F, 0x1E, 0x1F));
3604 }
3605
3606 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
3607                                                      vector int __b) {
3608   return vec_perm(__a, __b,
3609                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3610                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3611                                          0x1C, 0x1D, 0x1E, 0x1F));
3612 }
3613
3614 static __inline__ vector unsigned int __ATTRS_o_ai
3615 vec_mergel(vector unsigned int __a, vector unsigned int __b) {
3616   return vec_perm(__a, __b,
3617                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3618                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3619                                          0x1C, 0x1D, 0x1E, 0x1F));
3620 }
3621
3622 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
3623                                                           vector bool int __b) {
3624   return vec_perm(__a, __b,
3625                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3626                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3627                                          0x1C, 0x1D, 0x1E, 0x1F));
3628 }
3629
3630 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
3631                                                        vector float __b) {
3632   return vec_perm(__a, __b,
3633                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3634                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3635                                          0x1C, 0x1D, 0x1E, 0x1F));
3636 }
3637
3638 #ifdef __VSX__
3639 static __inline__ vector signed long long __ATTRS_o_ai
3640 vec_mergel(vector signed long long __a, vector signed long long __b) {
3641   return vec_perm(__a, __b,
3642                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3643                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3644                                          0x1C, 0x1D, 0x1E, 0x1F));
3645 }
3646 static __inline__ vector signed long long __ATTRS_o_ai
3647 vec_mergel(vector signed long long __a, vector bool long long __b) {
3648   return vec_perm(__a, (vector signed long long)__b,
3649                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3650                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3651                                          0x1C, 0x1D, 0x1E, 0x1F));
3652 }
3653 static __inline__ vector signed long long __ATTRS_o_ai
3654 vec_mergel(vector bool long long __a, vector signed long long __b) {
3655   return vec_perm((vector signed long long)__a, __b,
3656                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3657                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3658                                          0x1C, 0x1D, 0x1E, 0x1F));
3659 }
3660 static __inline__ vector unsigned long long __ATTRS_o_ai
3661 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
3662   return vec_perm(__a, __b,
3663                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3664                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3665                                          0x1C, 0x1D, 0x1E, 0x1F));
3666 }
3667 static __inline__ vector unsigned long long __ATTRS_o_ai
3668 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
3669   return vec_perm(__a, (vector unsigned long long)__b,
3670                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3671                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3672                                          0x1C, 0x1D, 0x1E, 0x1F));
3673 }
3674 static __inline__ vector unsigned long long __ATTRS_o_ai
3675 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
3676   return vec_perm((vector unsigned long long)__a, __b,
3677                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3678                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3679                                          0x1C, 0x1D, 0x1E, 0x1F));
3680 }
3681 static __inline__ vector bool long long __ATTRS_o_ai
3682 vec_mergel(vector bool long long __a, vector bool long long __b) {
3683   return vec_perm(__a, __b,
3684                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3685                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3686                                          0x1C, 0x1D, 0x1E, 0x1F));
3687 }
3688 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
3689                                                         vector double __b) {
3690   return vec_perm(__a, __b,
3691                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3692                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3693                                          0x1C, 0x1D, 0x1E, 0x1F));
3694 }
3695 static __inline__ vector double __ATTRS_o_ai
3696 vec_mergel(vector double __a, vector bool long long __b) {
3697   return vec_perm(__a, (vector double)__b,
3698                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3699                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3700                                          0x1C, 0x1D, 0x1E, 0x1F));
3701 }
3702 static __inline__ vector double __ATTRS_o_ai
3703 vec_mergel(vector bool long long __a, vector double __b) {
3704   return vec_perm((vector double)__a, __b,
3705                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
3706                                          0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
3707                                          0x1C, 0x1D, 0x1E, 0x1F));
3708 }
3709 #endif
3710
3711 /* vec_vmrglb */
3712
3713 #define __builtin_altivec_vmrglb vec_vmrglb
3714
3715 static __inline__ vector signed char __ATTRS_o_ai
3716 vec_vmrglb(vector signed char __a, vector signed char __b) {
3717   return vec_perm(__a, __b,
3718                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3719                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3720                                          0x0E, 0x1E, 0x0F, 0x1F));
3721 }
3722
3723 static __inline__ vector unsigned char __ATTRS_o_ai
3724 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
3725   return vec_perm(__a, __b,
3726                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3727                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3728                                          0x0E, 0x1E, 0x0F, 0x1F));
3729 }
3730
3731 static __inline__ vector bool char __ATTRS_o_ai
3732 vec_vmrglb(vector bool char __a, vector bool char __b) {
3733   return vec_perm(__a, __b,
3734                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3735                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3736                                          0x0E, 0x1E, 0x0F, 0x1F));
3737 }
3738
3739 /* vec_vmrglh */
3740
3741 #define __builtin_altivec_vmrglh vec_vmrglh
3742
3743 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
3744                                                        vector short __b) {
3745   return vec_perm(__a, __b,
3746                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3747                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3748                                          0x0E, 0x0F, 0x1E, 0x1F));
3749 }
3750
3751 static __inline__ vector unsigned short __ATTRS_o_ai
3752 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
3753   return vec_perm(__a, __b,
3754                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3755                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3756                                          0x0E, 0x0F, 0x1E, 0x1F));
3757 }
3758
3759 static __inline__ vector bool short __ATTRS_o_ai
3760 vec_vmrglh(vector bool short __a, vector bool short __b) {
3761   return vec_perm(__a, __b,
3762                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3763                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3764                                          0x0E, 0x0F, 0x1E, 0x1F));
3765 }
3766
3767 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
3768                                                        vector pixel __b) {
3769   return vec_perm(__a, __b,
3770                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3771                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3772                                          0x0E, 0x0F, 0x1E, 0x1F));
3773 }
3774
3775 /* vec_vmrglw */
3776
3777 #define __builtin_altivec_vmrglw vec_vmrglw
3778
3779 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
3780                                                      vector int __b) {
3781   return vec_perm(__a, __b,
3782                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3783                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3784                                          0x1C, 0x1D, 0x1E, 0x1F));
3785 }
3786
3787 static __inline__ vector unsigned int __ATTRS_o_ai
3788 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
3789   return vec_perm(__a, __b,
3790                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3791                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3792                                          0x1C, 0x1D, 0x1E, 0x1F));
3793 }
3794
3795 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3796                                                           vector bool int __b) {
3797   return vec_perm(__a, __b,
3798                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3799                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3800                                          0x1C, 0x1D, 0x1E, 0x1F));
3801 }
3802
3803 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3804                                                        vector float __b) {
3805   return vec_perm(__a, __b,
3806                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3807                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3808                                          0x1C, 0x1D, 0x1E, 0x1F));
3809 }
3810
3811 #ifdef __POWER8_VECTOR__
3812 /* vec_mergee */
3813
3814 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
3815                                                           vector bool int __b) {
3816   return vec_perm(__a, __b,
3817                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3818                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3819                                          0x18, 0x19, 0x1A, 0x1B));
3820 }
3821
3822 static __inline__ vector signed int __ATTRS_o_ai
3823 vec_mergee(vector signed int __a, vector signed int __b) {
3824   return vec_perm(__a, __b,
3825                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3826                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3827                                          0x18, 0x19, 0x1A, 0x1B));
3828 }
3829
3830 static __inline__ vector unsigned int __ATTRS_o_ai
3831 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
3832   return vec_perm(__a, __b,
3833                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3834                                          0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
3835                                          0x18, 0x19, 0x1A, 0x1B));
3836 }
3837
3838 /* vec_mergeo */
3839
3840 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
3841                                                           vector bool int __b) {
3842   return vec_perm(__a, __b,
3843                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3844                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3845                                          0x1C, 0x1D, 0x1E, 0x1F));
3846 }
3847
3848 static __inline__ vector signed int __ATTRS_o_ai
3849 vec_mergeo(vector signed int __a, vector signed int __b) {
3850   return vec_perm(__a, __b,
3851                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3852                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3853                                          0x1C, 0x1D, 0x1E, 0x1F));
3854 }
3855
3856 static __inline__ vector unsigned int __ATTRS_o_ai
3857 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
3858   return vec_perm(__a, __b,
3859                   (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
3860                                          0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
3861                                          0x1C, 0x1D, 0x1E, 0x1F));
3862 }
3863
3864 #endif
3865
3866 /* vec_mfvscr */
3867
3868 static __inline__ vector unsigned short __attribute__((__always_inline__))
3869 vec_mfvscr(void) {
3870   return __builtin_altivec_mfvscr();
3871 }
3872
3873 /* vec_min */
3874
3875 static __inline__ vector signed char __ATTRS_o_ai
3876 vec_min(vector signed char __a, vector signed char __b) {
3877   return __builtin_altivec_vminsb(__a, __b);
3878 }
3879
3880 static __inline__ vector signed char __ATTRS_o_ai
3881 vec_min(vector bool char __a, vector signed char __b) {
3882   return __builtin_altivec_vminsb((vector signed char)__a, __b);
3883 }
3884
3885 static __inline__ vector signed char __ATTRS_o_ai
3886 vec_min(vector signed char __a, vector bool char __b) {
3887   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3888 }
3889
3890 static __inline__ vector unsigned char __ATTRS_o_ai
3891 vec_min(vector unsigned char __a, vector unsigned char __b) {
3892   return __builtin_altivec_vminub(__a, __b);
3893 }
3894
3895 static __inline__ vector unsigned char __ATTRS_o_ai
3896 vec_min(vector bool char __a, vector unsigned char __b) {
3897   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3898 }
3899
3900 static __inline__ vector unsigned char __ATTRS_o_ai
3901 vec_min(vector unsigned char __a, vector bool char __b) {
3902   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3903 }
3904
3905 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
3906                                                     vector short __b) {
3907   return __builtin_altivec_vminsh(__a, __b);
3908 }
3909
3910 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
3911                                                     vector short __b) {
3912   return __builtin_altivec_vminsh((vector short)__a, __b);
3913 }
3914
3915 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
3916                                                     vector bool short __b) {
3917   return __builtin_altivec_vminsh(__a, (vector short)__b);
3918 }
3919
3920 static __inline__ vector unsigned short __ATTRS_o_ai
3921 vec_min(vector unsigned short __a, vector unsigned short __b) {
3922   return __builtin_altivec_vminuh(__a, __b);
3923 }
3924
3925 static __inline__ vector unsigned short __ATTRS_o_ai
3926 vec_min(vector bool short __a, vector unsigned short __b) {
3927   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3928 }
3929
3930 static __inline__ vector unsigned short __ATTRS_o_ai
3931 vec_min(vector unsigned short __a, vector bool short __b) {
3932   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3933 }
3934
3935 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
3936                                                   vector int __b) {
3937   return __builtin_altivec_vminsw(__a, __b);
3938 }
3939
3940 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
3941                                                   vector int __b) {
3942   return __builtin_altivec_vminsw((vector int)__a, __b);
3943 }
3944
3945 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
3946                                                   vector bool int __b) {
3947   return __builtin_altivec_vminsw(__a, (vector int)__b);
3948 }
3949
3950 static __inline__ vector unsigned int __ATTRS_o_ai
3951 vec_min(vector unsigned int __a, vector unsigned int __b) {
3952   return __builtin_altivec_vminuw(__a, __b);
3953 }
3954
3955 static __inline__ vector unsigned int __ATTRS_o_ai
3956 vec_min(vector bool int __a, vector unsigned int __b) {
3957   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
3958 }
3959
3960 static __inline__ vector unsigned int __ATTRS_o_ai
3961 vec_min(vector unsigned int __a, vector bool int __b) {
3962   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
3963 }
3964
3965 #ifdef __POWER8_VECTOR__
3966 static __inline__ vector signed long long __ATTRS_o_ai
3967 vec_min(vector signed long long __a, vector signed long long __b) {
3968   return __builtin_altivec_vminsd(__a, __b);
3969 }
3970
3971 static __inline__ vector signed long long __ATTRS_o_ai
3972 vec_min(vector bool long long __a, vector signed long long __b) {
3973   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3974 }
3975
3976 static __inline__ vector signed long long __ATTRS_o_ai
3977 vec_min(vector signed long long __a, vector bool long long __b) {
3978   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3979 }
3980
3981 static __inline__ vector unsigned long long __ATTRS_o_ai
3982 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
3983   return __builtin_altivec_vminud(__a, __b);
3984 }
3985
3986 static __inline__ vector unsigned long long __ATTRS_o_ai
3987 vec_min(vector bool long long __a, vector unsigned long long __b) {
3988   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3989 }
3990
3991 static __inline__ vector unsigned long long __ATTRS_o_ai
3992 vec_min(vector unsigned long long __a, vector bool long long __b) {
3993   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3994 }
3995 #endif
3996
3997 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
3998                                                     vector float __b) {
3999 #ifdef __VSX__
4000   return __builtin_vsx_xvminsp(__a, __b);
4001 #else
4002   return __builtin_altivec_vminfp(__a, __b);
4003 #endif
4004 }
4005
4006 #ifdef __VSX__
4007 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
4008                                                      vector double __b) {
4009   return __builtin_vsx_xvmindp(__a, __b);
4010 }
4011 #endif
4012
4013 /* vec_vminsb */
4014
4015 static __inline__ vector signed char __ATTRS_o_ai
4016 vec_vminsb(vector signed char __a, vector signed char __b) {
4017   return __builtin_altivec_vminsb(__a, __b);
4018 }
4019
4020 static __inline__ vector signed char __ATTRS_o_ai
4021 vec_vminsb(vector bool char __a, vector signed char __b) {
4022   return __builtin_altivec_vminsb((vector signed char)__a, __b);
4023 }
4024
4025 static __inline__ vector signed char __ATTRS_o_ai
4026 vec_vminsb(vector signed char __a, vector bool char __b) {
4027   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
4028 }
4029
4030 /* vec_vminub */
4031
4032 static __inline__ vector unsigned char __ATTRS_o_ai
4033 vec_vminub(vector unsigned char __a, vector unsigned char __b) {
4034   return __builtin_altivec_vminub(__a, __b);
4035 }
4036
4037 static __inline__ vector unsigned char __ATTRS_o_ai
4038 vec_vminub(vector bool char __a, vector unsigned char __b) {
4039   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
4040 }
4041
4042 static __inline__ vector unsigned char __ATTRS_o_ai
4043 vec_vminub(vector unsigned char __a, vector bool char __b) {
4044   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
4045 }
4046
4047 /* vec_vminsh */
4048
4049 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4050                                                        vector short __b) {
4051   return __builtin_altivec_vminsh(__a, __b);
4052 }
4053
4054 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
4055                                                        vector short __b) {
4056   return __builtin_altivec_vminsh((vector short)__a, __b);
4057 }
4058
4059 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
4060                                                        vector bool short __b) {
4061   return __builtin_altivec_vminsh(__a, (vector short)__b);
4062 }
4063
4064 /* vec_vminuh */
4065
4066 static __inline__ vector unsigned short __ATTRS_o_ai
4067 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
4068   return __builtin_altivec_vminuh(__a, __b);
4069 }
4070
4071 static __inline__ vector unsigned short __ATTRS_o_ai
4072 vec_vminuh(vector bool short __a, vector unsigned short __b) {
4073   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
4074 }
4075
4076 static __inline__ vector unsigned short __ATTRS_o_ai
4077 vec_vminuh(vector unsigned short __a, vector bool short __b) {
4078   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
4079 }
4080
4081 /* vec_vminsw */
4082
4083 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4084                                                      vector int __b) {
4085   return __builtin_altivec_vminsw(__a, __b);
4086 }
4087
4088 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
4089                                                      vector int __b) {
4090   return __builtin_altivec_vminsw((vector int)__a, __b);
4091 }
4092
4093 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
4094                                                      vector bool int __b) {
4095   return __builtin_altivec_vminsw(__a, (vector int)__b);
4096 }
4097
4098 /* vec_vminuw */
4099
4100 static __inline__ vector unsigned int __ATTRS_o_ai
4101 vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
4102   return __builtin_altivec_vminuw(__a, __b);
4103 }
4104
4105 static __inline__ vector unsigned int __ATTRS_o_ai
4106 vec_vminuw(vector bool int __a, vector unsigned int __b) {
4107   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
4108 }
4109
4110 static __inline__ vector unsigned int __ATTRS_o_ai
4111 vec_vminuw(vector unsigned int __a, vector bool int __b) {
4112   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
4113 }
4114
4115 /* vec_vminfp */
4116
4117 static __inline__ vector float __attribute__((__always_inline__))
4118 vec_vminfp(vector float __a, vector float __b) {
4119 #ifdef __VSX__
4120   return __builtin_vsx_xvminsp(__a, __b);
4121 #else
4122   return __builtin_altivec_vminfp(__a, __b);
4123 #endif
4124 }
4125
4126 /* vec_mladd */
4127
4128 #define __builtin_altivec_vmladduhm vec_mladd
4129
4130 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
4131                                                       vector short __b,
4132                                                       vector short __c) {
4133   return __a * __b + __c;
4134 }
4135
4136 static __inline__ vector short __ATTRS_o_ai vec_mladd(
4137     vector short __a, vector unsigned short __b, vector unsigned short __c) {
4138   return __a * (vector short)__b + (vector short)__c;
4139 }
4140
4141 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4142                                                       vector short __b,
4143                                                       vector short __c) {
4144   return (vector short)__a * __b + __c;
4145 }
4146
4147 static __inline__ vector unsigned short __ATTRS_o_ai
4148 vec_mladd(vector unsigned short __a, vector unsigned short __b,
4149           vector unsigned short __c) {
4150   return __a * __b + __c;
4151 }
4152
4153 /* vec_vmladduhm */
4154
4155 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4156                                                           vector short __b,
4157                                                           vector short __c) {
4158   return __a * __b + __c;
4159 }
4160
4161 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
4162     vector short __a, vector unsigned short __b, vector unsigned short __c) {
4163   return __a * (vector short)__b + (vector short)__c;
4164 }
4165
4166 static __inline__ vector short __ATTRS_o_ai
4167 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
4168   return (vector short)__a * __b + __c;
4169 }
4170
4171 static __inline__ vector unsigned short __ATTRS_o_ai
4172 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
4173               vector unsigned short __c) {
4174   return __a * __b + __c;
4175 }
4176
4177 /* vec_mradds */
4178
4179 static __inline__ vector short __attribute__((__always_inline__))
4180 vec_mradds(vector short __a, vector short __b, vector short __c) {
4181   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4182 }
4183
4184 /* vec_vmhraddshs */
4185
4186 static __inline__ vector short __attribute__((__always_inline__))
4187 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
4188   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4189 }
4190
4191 /* vec_msum */
4192
4193 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
4194                                                    vector unsigned char __b,
4195                                                    vector int __c) {
4196   return __builtin_altivec_vmsummbm(__a, __b, __c);
4197 }
4198
4199 static __inline__ vector unsigned int __ATTRS_o_ai
4200 vec_msum(vector unsigned char __a, vector unsigned char __b,
4201          vector unsigned int __c) {
4202   return __builtin_altivec_vmsumubm(__a, __b, __c);
4203 }
4204
4205 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
4206                                                    vector short __b,
4207                                                    vector int __c) {
4208   return __builtin_altivec_vmsumshm(__a, __b, __c);
4209 }
4210
4211 static __inline__ vector unsigned int __ATTRS_o_ai
4212 vec_msum(vector unsigned short __a, vector unsigned short __b,
4213          vector unsigned int __c) {
4214   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4215 }
4216
4217 /* vec_vmsummbm */
4218
4219 static __inline__ vector int __attribute__((__always_inline__))
4220 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
4221   return __builtin_altivec_vmsummbm(__a, __b, __c);
4222 }
4223
4224 /* vec_vmsumubm */
4225
4226 static __inline__ vector unsigned int __attribute__((__always_inline__))
4227 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
4228              vector unsigned int __c) {
4229   return __builtin_altivec_vmsumubm(__a, __b, __c);
4230 }
4231
4232 /* vec_vmsumshm */
4233
4234 static __inline__ vector int __attribute__((__always_inline__))
4235 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
4236   return __builtin_altivec_vmsumshm(__a, __b, __c);
4237 }
4238
4239 /* vec_vmsumuhm */
4240
4241 static __inline__ vector unsigned int __attribute__((__always_inline__))
4242 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
4243              vector unsigned int __c) {
4244   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4245 }
4246
4247 /* vec_msums */
4248
4249 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
4250                                                     vector short __b,
4251                                                     vector int __c) {
4252   return __builtin_altivec_vmsumshs(__a, __b, __c);
4253 }
4254
4255 static __inline__ vector unsigned int __ATTRS_o_ai
4256 vec_msums(vector unsigned short __a, vector unsigned short __b,
4257           vector unsigned int __c) {
4258   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4259 }
4260
4261 /* vec_vmsumshs */
4262
4263 static __inline__ vector int __attribute__((__always_inline__))
4264 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
4265   return __builtin_altivec_vmsumshs(__a, __b, __c);
4266 }
4267
4268 /* vec_vmsumuhs */
4269
4270 static __inline__ vector unsigned int __attribute__((__always_inline__))
4271 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
4272              vector unsigned int __c) {
4273   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4274 }
4275
4276 /* vec_mtvscr */
4277
4278 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
4279   __builtin_altivec_mtvscr((vector int)__a);
4280 }
4281
4282 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
4283   __builtin_altivec_mtvscr((vector int)__a);
4284 }
4285
4286 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
4287   __builtin_altivec_mtvscr((vector int)__a);
4288 }
4289
4290 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
4291   __builtin_altivec_mtvscr((vector int)__a);
4292 }
4293
4294 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
4295   __builtin_altivec_mtvscr((vector int)__a);
4296 }
4297
4298 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
4299   __builtin_altivec_mtvscr((vector int)__a);
4300 }
4301
4302 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
4303   __builtin_altivec_mtvscr((vector int)__a);
4304 }
4305
4306 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
4307   __builtin_altivec_mtvscr((vector int)__a);
4308 }
4309
4310 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
4311   __builtin_altivec_mtvscr((vector int)__a);
4312 }
4313
4314 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
4315   __builtin_altivec_mtvscr((vector int)__a);
4316 }
4317
4318 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
4319   __builtin_altivec_mtvscr((vector int)__a);
4320 }
4321
4322 /* vec_mul */
4323
4324 /* Integer vector multiplication will involve multiplication of the odd/even
4325    elements separately, then truncating the results and moving to the
4326    result vector.
4327 */
4328 static __inline__ vector signed char __ATTRS_o_ai
4329 vec_mul(vector signed char __a, vector signed char __b) {
4330   return __a * __b;
4331 }
4332
4333 static __inline__ vector unsigned char __ATTRS_o_ai
4334 vec_mul(vector unsigned char __a, vector unsigned char __b) {
4335   return __a * __b;
4336 }
4337
4338 static __inline__ vector signed short __ATTRS_o_ai
4339 vec_mul(vector signed short __a, vector signed short __b) {
4340   return __a * __b;
4341 }
4342
4343 static __inline__ vector unsigned short __ATTRS_o_ai
4344 vec_mul(vector unsigned short __a, vector unsigned short __b) {
4345   return __a * __b;
4346 }
4347
4348 static __inline__ vector signed int __ATTRS_o_ai
4349 vec_mul(vector signed int __a, vector signed int __b) {
4350   return __a * __b;
4351 }
4352
4353 static __inline__ vector unsigned int __ATTRS_o_ai
4354 vec_mul(vector unsigned int __a, vector unsigned int __b) {
4355   return __a * __b;
4356 }
4357
4358 #ifdef __VSX__
4359 static __inline__ vector signed long long __ATTRS_o_ai
4360 vec_mul(vector signed long long __a, vector signed long long __b) {
4361   return __a * __b;
4362 }
4363
4364 static __inline__ vector unsigned long long __ATTRS_o_ai
4365 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
4366   return __a * __b;
4367 }
4368 #endif
4369
4370 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
4371                                                     vector float __b) {
4372   return __a * __b;
4373 }
4374
4375 #ifdef __VSX__
4376 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
4377                                                      vector double __b) {
4378   return __a * __b;
4379 }
4380 #endif
4381
4382 /* The vmulos* and vmules* instructions have a big endian bias, so
4383    we must reverse the meaning of "even" and "odd" for little endian.  */
4384
4385 /* vec_mule */
4386
4387 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
4388                                                      vector signed char __b) {
4389 #ifdef __LITTLE_ENDIAN__
4390   return __builtin_altivec_vmulosb(__a, __b);
4391 #else
4392   return __builtin_altivec_vmulesb(__a, __b);
4393 #endif
4394 }
4395
4396 static __inline__ vector unsigned short __ATTRS_o_ai
4397 vec_mule(vector unsigned char __a, vector unsigned char __b) {
4398 #ifdef __LITTLE_ENDIAN__
4399   return __builtin_altivec_vmuloub(__a, __b);
4400 #else
4401   return __builtin_altivec_vmuleub(__a, __b);
4402 #endif
4403 }
4404
4405 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
4406                                                    vector short __b) {
4407 #ifdef __LITTLE_ENDIAN__
4408   return __builtin_altivec_vmulosh(__a, __b);
4409 #else
4410   return __builtin_altivec_vmulesh(__a, __b);
4411 #endif
4412 }
4413
4414 static __inline__ vector unsigned int __ATTRS_o_ai
4415 vec_mule(vector unsigned short __a, vector unsigned short __b) {
4416 #ifdef __LITTLE_ENDIAN__
4417   return __builtin_altivec_vmulouh(__a, __b);
4418 #else
4419   return __builtin_altivec_vmuleuh(__a, __b);
4420 #endif
4421 }
4422
4423 #ifdef __POWER8_VECTOR__
4424 static __inline__ vector signed long long __ATTRS_o_ai
4425 vec_mule(vector signed int __a, vector signed int __b) {
4426 #ifdef __LITTLE_ENDIAN__
4427   return __builtin_altivec_vmulosw(__a, __b);
4428 #else
4429   return __builtin_altivec_vmulesw(__a, __b);
4430 #endif
4431 }
4432
4433 static __inline__ vector unsigned long long __ATTRS_o_ai
4434 vec_mule(vector unsigned int __a, vector unsigned int __b) {
4435 #ifdef __LITTLE_ENDIAN__
4436   return __builtin_altivec_vmulouw(__a, __b);
4437 #else
4438   return __builtin_altivec_vmuleuw(__a, __b);
4439 #endif
4440 }
4441 #endif
4442
4443 /* vec_vmulesb */
4444
4445 static __inline__ vector short __attribute__((__always_inline__))
4446 vec_vmulesb(vector signed char __a, vector signed char __b) {
4447 #ifdef __LITTLE_ENDIAN__
4448   return __builtin_altivec_vmulosb(__a, __b);
4449 #else
4450   return __builtin_altivec_vmulesb(__a, __b);
4451 #endif
4452 }
4453
4454 /* vec_vmuleub */
4455
4456 static __inline__ vector unsigned short __attribute__((__always_inline__))
4457 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
4458 #ifdef __LITTLE_ENDIAN__
4459   return __builtin_altivec_vmuloub(__a, __b);
4460 #else
4461   return __builtin_altivec_vmuleub(__a, __b);
4462 #endif
4463 }
4464
4465 /* vec_vmulesh */
4466
4467 static __inline__ vector int __attribute__((__always_inline__))
4468 vec_vmulesh(vector short __a, vector short __b) {
4469 #ifdef __LITTLE_ENDIAN__
4470   return __builtin_altivec_vmulosh(__a, __b);
4471 #else
4472   return __builtin_altivec_vmulesh(__a, __b);
4473 #endif
4474 }
4475
4476 /* vec_vmuleuh */
4477
4478 static __inline__ vector unsigned int __attribute__((__always_inline__))
4479 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
4480 #ifdef __LITTLE_ENDIAN__
4481   return __builtin_altivec_vmulouh(__a, __b);
4482 #else
4483   return __builtin_altivec_vmuleuh(__a, __b);
4484 #endif
4485 }
4486
4487 /* vec_mulo */
4488
4489 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
4490                                                      vector signed char __b) {
4491 #ifdef __LITTLE_ENDIAN__
4492   return __builtin_altivec_vmulesb(__a, __b);
4493 #else
4494   return __builtin_altivec_vmulosb(__a, __b);
4495 #endif
4496 }
4497
4498 static __inline__ vector unsigned short __ATTRS_o_ai
4499 vec_mulo(vector unsigned char __a, vector unsigned char __b) {
4500 #ifdef __LITTLE_ENDIAN__
4501   return __builtin_altivec_vmuleub(__a, __b);
4502 #else
4503   return __builtin_altivec_vmuloub(__a, __b);
4504 #endif
4505 }
4506
4507 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
4508                                                    vector short __b) {
4509 #ifdef __LITTLE_ENDIAN__
4510   return __builtin_altivec_vmulesh(__a, __b);
4511 #else
4512   return __builtin_altivec_vmulosh(__a, __b);
4513 #endif
4514 }
4515
4516 static __inline__ vector unsigned int __ATTRS_o_ai
4517 vec_mulo(vector unsigned short __a, vector unsigned short __b) {
4518 #ifdef __LITTLE_ENDIAN__
4519   return __builtin_altivec_vmuleuh(__a, __b);
4520 #else
4521   return __builtin_altivec_vmulouh(__a, __b);
4522 #endif
4523 }
4524
4525 #ifdef __POWER8_VECTOR__
4526 static __inline__ vector signed long long __ATTRS_o_ai
4527 vec_mulo(vector signed int __a, vector signed int __b) {
4528 #ifdef __LITTLE_ENDIAN__
4529   return __builtin_altivec_vmulesw(__a, __b);
4530 #else
4531   return __builtin_altivec_vmulosw(__a, __b);
4532 #endif
4533 }
4534
4535 static __inline__ vector unsigned long long __ATTRS_o_ai
4536 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
4537 #ifdef __LITTLE_ENDIAN__
4538   return __builtin_altivec_vmuleuw(__a, __b);
4539 #else
4540   return __builtin_altivec_vmulouw(__a, __b);
4541 #endif
4542 }
4543 #endif
4544
4545 /* vec_vmulosb */
4546
4547 static __inline__ vector short __attribute__((__always_inline__))
4548 vec_vmulosb(vector signed char __a, vector signed char __b) {
4549 #ifdef __LITTLE_ENDIAN__
4550   return __builtin_altivec_vmulesb(__a, __b);
4551 #else
4552   return __builtin_altivec_vmulosb(__a, __b);
4553 #endif
4554 }
4555
4556 /* vec_vmuloub */
4557
4558 static __inline__ vector unsigned short __attribute__((__always_inline__))
4559 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
4560 #ifdef __LITTLE_ENDIAN__
4561   return __builtin_altivec_vmuleub(__a, __b);
4562 #else
4563   return __builtin_altivec_vmuloub(__a, __b);
4564 #endif
4565 }
4566
4567 /* vec_vmulosh */
4568
4569 static __inline__ vector int __attribute__((__always_inline__))
4570 vec_vmulosh(vector short __a, vector short __b) {
4571 #ifdef __LITTLE_ENDIAN__
4572   return __builtin_altivec_vmulesh(__a, __b);
4573 #else
4574   return __builtin_altivec_vmulosh(__a, __b);
4575 #endif
4576 }
4577
4578 /* vec_vmulouh */
4579
4580 static __inline__ vector unsigned int __attribute__((__always_inline__))
4581 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
4582 #ifdef __LITTLE_ENDIAN__
4583   return __builtin_altivec_vmuleuh(__a, __b);
4584 #else
4585   return __builtin_altivec_vmulouh(__a, __b);
4586 #endif
4587 }
4588
4589 /*  vec_nand */
4590
4591 #ifdef __POWER8_VECTOR__
4592 static __inline__ vector signed char __ATTRS_o_ai
4593 vec_nand(vector signed char __a, vector signed char __b) {
4594   return ~(__a & __b);
4595 }
4596
4597 static __inline__ vector signed char __ATTRS_o_ai
4598 vec_nand(vector signed char __a, vector bool char __b) {
4599   return ~(__a & __b);
4600 }
4601
4602 static __inline__ vector signed char __ATTRS_o_ai
4603 vec_nand(vector bool char __a, vector signed char __b) {
4604   return ~(__a & __b);
4605 }
4606
4607 static __inline__ vector unsigned char __ATTRS_o_ai
4608 vec_nand(vector unsigned char __a, vector unsigned char __b) {
4609   return ~(__a & __b);
4610 }
4611
4612 static __inline__ vector unsigned char __ATTRS_o_ai
4613 vec_nand(vector unsigned char __a, vector bool char __b) {
4614   return ~(__a & __b);
4615 }
4616
4617 static __inline__ vector unsigned char __ATTRS_o_ai
4618 vec_nand(vector bool char __a, vector unsigned char __b) {
4619   return ~(__a & __b);
4620 }
4621
4622 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
4623                                                          vector bool char __b) {
4624   return ~(__a & __b);
4625 }
4626
4627 static __inline__ vector signed short __ATTRS_o_ai
4628 vec_nand(vector signed short __a, vector signed short __b) {
4629   return ~(__a & __b);
4630 }
4631
4632 static __inline__ vector signed short __ATTRS_o_ai
4633 vec_nand(vector signed short __a, vector bool short __b) {
4634   return ~(__a & __b);
4635 }
4636
4637 static __inline__ vector signed short __ATTRS_o_ai
4638 vec_nand(vector bool short __a, vector signed short __b) {
4639   return ~(__a & __b);
4640 }
4641
4642 static __inline__ vector unsigned short __ATTRS_o_ai
4643 vec_nand(vector unsigned short __a, vector unsigned short __b) {
4644   return ~(__a & __b);
4645 }
4646
4647 static __inline__ vector unsigned short __ATTRS_o_ai
4648 vec_nand(vector unsigned short __a, vector bool short __b) {
4649   return ~(__a & __b);
4650 }
4651
4652 static __inline__ vector bool short __ATTRS_o_ai
4653 vec_nand(vector bool short __a, vector bool short __b) {
4654   return ~(__a & __b);
4655 }
4656
4657 static __inline__ vector signed int __ATTRS_o_ai
4658 vec_nand(vector signed int __a, vector signed int __b) {
4659   return ~(__a & __b);
4660 }
4661
4662 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4663                                                           vector bool int __b) {
4664   return ~(__a & __b);
4665 }
4666
4667 static __inline__ vector signed int __ATTRS_o_ai
4668 vec_nand(vector bool int __a, vector signed int __b) {
4669   return ~(__a & __b);
4670 }
4671
4672 static __inline__ vector unsigned int __ATTRS_o_ai
4673 vec_nand(vector unsigned int __a, vector unsigned int __b) {
4674   return ~(__a & __b);
4675 }
4676
4677 static __inline__ vector unsigned int __ATTRS_o_ai
4678 vec_nand(vector unsigned int __a, vector bool int __b) {
4679   return ~(__a & __b);
4680 }
4681
4682 static __inline__ vector unsigned int __ATTRS_o_ai
4683 vec_nand(vector bool int __a, vector unsigned int __b) {
4684   return ~(__a & __b);
4685 }
4686
4687 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
4688                                                         vector bool int __b) {
4689   return ~(__a & __b);
4690 }
4691
4692 static __inline__ vector signed long long __ATTRS_o_ai
4693 vec_nand(vector signed long long __a, vector signed long long __b) {
4694   return ~(__a & __b);
4695 }
4696
4697 static __inline__ vector signed long long __ATTRS_o_ai
4698 vec_nand(vector signed long long __a, vector bool long long __b) {
4699   return ~(__a & __b);
4700 }
4701
4702 static __inline__ vector signed long long __ATTRS_o_ai
4703 vec_nand(vector bool long long __a, vector signed long long __b) {
4704   return ~(__a & __b);
4705 }
4706
4707 static __inline__ vector unsigned long long __ATTRS_o_ai
4708 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
4709   return ~(__a & __b);
4710 }
4711
4712 static __inline__ vector unsigned long long __ATTRS_o_ai
4713 vec_nand(vector unsigned long long __a, vector bool long long __b) {
4714   return ~(__a & __b);
4715 }
4716
4717 static __inline__ vector unsigned long long __ATTRS_o_ai
4718 vec_nand(vector bool long long __a, vector unsigned long long __b) {
4719   return ~(__a & __b);
4720 }
4721
4722 static __inline__ vector bool long long __ATTRS_o_ai
4723 vec_nand(vector bool long long __a, vector bool long long __b) {
4724   return ~(__a & __b);
4725 }
4726
4727 #endif
4728
4729 /* vec_nmadd */
4730
4731 #ifdef __VSX__
4732 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
4733                                                       vector float __b,
4734                                                       vector float __c) {
4735   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
4736 }
4737
4738 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
4739                                                        vector double __b,
4740                                                        vector double __c) {
4741   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
4742 }
4743 #endif
4744
4745 /* vec_nmsub */
4746
4747 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
4748                                                       vector float __b,
4749                                                       vector float __c) {
4750 #ifdef __VSX__
4751   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
4752 #else
4753   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4754 #endif
4755 }
4756
4757 #ifdef __VSX__
4758 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
4759                                                        vector double __b,
4760                                                        vector double __c) {
4761   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
4762 }
4763 #endif
4764
4765 /* vec_vnmsubfp */
4766
4767 static __inline__ vector float __attribute__((__always_inline__))
4768 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
4769   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4770 }
4771
4772 /* vec_nor */
4773
4774 #define __builtin_altivec_vnor vec_nor
4775
4776 static __inline__ vector signed char __ATTRS_o_ai
4777 vec_nor(vector signed char __a, vector signed char __b) {
4778   return ~(__a | __b);
4779 }
4780
4781 static __inline__ vector unsigned char __ATTRS_o_ai
4782 vec_nor(vector unsigned char __a, vector unsigned char __b) {
4783   return ~(__a | __b);
4784 }
4785
4786 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
4787                                                         vector bool char __b) {
4788   return ~(__a | __b);
4789 }
4790
4791 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
4792                                                     vector short __b) {
4793   return ~(__a | __b);
4794 }
4795
4796 static __inline__ vector unsigned short __ATTRS_o_ai
4797 vec_nor(vector unsigned short __a, vector unsigned short __b) {
4798   return ~(__a | __b);
4799 }
4800
4801 static __inline__ vector bool short __ATTRS_o_ai
4802 vec_nor(vector bool short __a, vector bool short __b) {
4803   return ~(__a | __b);
4804 }
4805
4806 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
4807                                                   vector int __b) {
4808   return ~(__a | __b);
4809 }
4810
4811 static __inline__ vector unsigned int __ATTRS_o_ai
4812 vec_nor(vector unsigned int __a, vector unsigned int __b) {
4813   return ~(__a | __b);
4814 }
4815
4816 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
4817                                                        vector bool int __b) {
4818   return ~(__a | __b);
4819 }
4820
4821 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
4822                                                     vector float __b) {
4823   vector unsigned int __res =
4824       ~((vector unsigned int)__a | (vector unsigned int)__b);
4825   return (vector float)__res;
4826 }
4827
4828 #ifdef __VSX__
4829 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
4830                                                      vector double __b) {
4831   vector unsigned long long __res =
4832       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
4833   return (vector double)__res;
4834 }
4835 #endif
4836
4837 /* vec_vnor */
4838
4839 static __inline__ vector signed char __ATTRS_o_ai
4840 vec_vnor(vector signed char __a, vector signed char __b) {
4841   return ~(__a | __b);
4842 }
4843
4844 static __inline__ vector unsigned char __ATTRS_o_ai
4845 vec_vnor(vector unsigned char __a, vector unsigned char __b) {
4846   return ~(__a | __b);
4847 }
4848
4849 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
4850                                                          vector bool char __b) {
4851   return ~(__a | __b);
4852 }
4853
4854 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
4855                                                      vector short __b) {
4856   return ~(__a | __b);
4857 }
4858
4859 static __inline__ vector unsigned short __ATTRS_o_ai
4860 vec_vnor(vector unsigned short __a, vector unsigned short __b) {
4861   return ~(__a | __b);
4862 }
4863
4864 static __inline__ vector bool short __ATTRS_o_ai
4865 vec_vnor(vector bool short __a, vector bool short __b) {
4866   return ~(__a | __b);
4867 }
4868
4869 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
4870                                                    vector int __b) {
4871   return ~(__a | __b);
4872 }
4873
4874 static __inline__ vector unsigned int __ATTRS_o_ai
4875 vec_vnor(vector unsigned int __a, vector unsigned int __b) {
4876   return ~(__a | __b);
4877 }
4878
4879 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
4880                                                         vector bool int __b) {
4881   return ~(__a | __b);
4882 }
4883
4884 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
4885                                                      vector float __b) {
4886   vector unsigned int __res =
4887       ~((vector unsigned int)__a | (vector unsigned int)__b);
4888   return (vector float)__res;
4889 }
4890
4891 #ifdef __VSX__
4892 static __inline__ vector signed long long __ATTRS_o_ai
4893 vec_nor(vector signed long long __a, vector signed long long __b) {
4894   return ~(__a | __b);
4895 }
4896
4897 static __inline__ vector unsigned long long __ATTRS_o_ai
4898 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
4899   return ~(__a | __b);
4900 }
4901
4902 static __inline__ vector bool long long __ATTRS_o_ai
4903 vec_nor(vector bool long long __a, vector bool long long __b) {
4904   return ~(__a | __b);
4905 }
4906 #endif
4907
4908 /* vec_or */
4909
4910 #define __builtin_altivec_vor vec_or
4911
4912 static __inline__ vector signed char __ATTRS_o_ai
4913 vec_or(vector signed char __a, vector signed char __b) {
4914   return __a | __b;
4915 }
4916
4917 static __inline__ vector signed char __ATTRS_o_ai
4918 vec_or(vector bool char __a, vector signed char __b) {
4919   return (vector signed char)__a | __b;
4920 }
4921
4922 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4923                                                          vector bool char __b) {
4924   return __a | (vector signed char)__b;
4925 }
4926
4927 static __inline__ vector unsigned char __ATTRS_o_ai
4928 vec_or(vector unsigned char __a, vector unsigned char __b) {
4929   return __a | __b;
4930 }
4931
4932 static __inline__ vector unsigned char __ATTRS_o_ai
4933 vec_or(vector bool char __a, vector unsigned char __b) {
4934   return (vector unsigned char)__a | __b;
4935 }
4936
4937 static __inline__ vector unsigned char __ATTRS_o_ai
4938 vec_or(vector unsigned char __a, vector bool char __b) {
4939   return __a | (vector unsigned char)__b;
4940 }
4941
4942 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4943                                                        vector bool char __b) {
4944   return __a | __b;
4945 }
4946
4947 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
4948                                                    vector short __b) {
4949   return __a | __b;
4950 }
4951
4952 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
4953                                                    vector short __b) {
4954   return (vector short)__a | __b;
4955 }
4956
4957 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
4958                                                    vector bool short __b) {
4959   return __a | (vector short)__b;
4960 }
4961
4962 static __inline__ vector unsigned short __ATTRS_o_ai
4963 vec_or(vector unsigned short __a, vector unsigned short __b) {
4964   return __a | __b;
4965 }
4966
4967 static __inline__ vector unsigned short __ATTRS_o_ai
4968 vec_or(vector bool short __a, vector unsigned short __b) {
4969   return (vector unsigned short)__a | __b;
4970 }
4971
4972 static __inline__ vector unsigned short __ATTRS_o_ai
4973 vec_or(vector unsigned short __a, vector bool short __b) {
4974   return __a | (vector unsigned short)__b;
4975 }
4976
4977 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4978                                                         vector bool short __b) {
4979   return __a | __b;
4980 }
4981
4982 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
4983                                                  vector int __b) {
4984   return __a | __b;
4985 }
4986
4987 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
4988                                                  vector int __b) {
4989   return (vector int)__a | __b;
4990 }
4991
4992 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
4993                                                  vector bool int __b) {
4994   return __a | (vector int)__b;
4995 }
4996
4997 static __inline__ vector unsigned int __ATTRS_o_ai
4998 vec_or(vector unsigned int __a, vector unsigned int __b) {
4999   return __a | __b;
5000 }
5001
5002 static __inline__ vector unsigned int __ATTRS_o_ai
5003 vec_or(vector bool int __a, vector unsigned int __b) {
5004   return (vector unsigned int)__a | __b;
5005 }
5006
5007 static __inline__ vector unsigned int __ATTRS_o_ai
5008 vec_or(vector unsigned int __a, vector bool int __b) {
5009   return __a | (vector unsigned int)__b;
5010 }
5011
5012 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
5013                                                       vector bool int __b) {
5014   return __a | __b;
5015 }
5016
5017 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5018                                                    vector float __b) {
5019   vector unsigned int __res =
5020       (vector unsigned int)__a | (vector unsigned int)__b;
5021   return (vector float)__res;
5022 }
5023
5024 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
5025                                                    vector float __b) {
5026   vector unsigned int __res =
5027       (vector unsigned int)__a | (vector unsigned int)__b;
5028   return (vector float)__res;
5029 }
5030
5031 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
5032                                                    vector bool int __b) {
5033   vector unsigned int __res =
5034       (vector unsigned int)__a | (vector unsigned int)__b;
5035   return (vector float)__res;
5036 }
5037
5038 #ifdef __VSX__
5039 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
5040                                                     vector double __b) {
5041   return (vector unsigned long long)__a | (vector unsigned long long)__b;
5042 }
5043
5044 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5045                                                     vector bool long long __b) {
5046   return (vector unsigned long long)__a | (vector unsigned long long)__b;
5047 }
5048
5049 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
5050                                                     vector double __b) {
5051   vector unsigned long long __res =
5052       (vector unsigned long long)__a | (vector unsigned long long)__b;
5053   return (vector double)__res;
5054 }
5055
5056 static __inline__ vector signed long long __ATTRS_o_ai
5057 vec_or(vector signed long long __a, vector signed long long __b) {
5058   return __a | __b;
5059 }
5060
5061 static __inline__ vector signed long long __ATTRS_o_ai
5062 vec_or(vector bool long long __a, vector signed long long __b) {
5063   return (vector signed long long)__a | __b;
5064 }
5065
5066 static __inline__ vector signed long long __ATTRS_o_ai
5067 vec_or(vector signed long long __a, vector bool long long __b) {
5068   return __a | (vector signed long long)__b;
5069 }
5070
5071 static __inline__ vector unsigned long long __ATTRS_o_ai
5072 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
5073   return __a | __b;
5074 }
5075
5076 static __inline__ vector unsigned long long __ATTRS_o_ai
5077 vec_or(vector bool long long __a, vector unsigned long long __b) {
5078   return (vector unsigned long long)__a | __b;
5079 }
5080
5081 static __inline__ vector unsigned long long __ATTRS_o_ai
5082 vec_or(vector unsigned long long __a, vector bool long long __b) {
5083   return __a | (vector unsigned long long)__b;
5084 }
5085
5086 static __inline__ vector bool long long __ATTRS_o_ai
5087 vec_or(vector bool long long __a, vector bool long long __b) {
5088   return __a | __b;
5089 }
5090 #endif
5091
5092 #ifdef __POWER8_VECTOR__
5093 static __inline__ vector signed char __ATTRS_o_ai
5094 vec_orc(vector signed char __a, vector signed char __b) {
5095   return __a | ~__b;
5096 }
5097
5098 static __inline__ vector signed char __ATTRS_o_ai
5099 vec_orc(vector signed char __a, vector bool char __b) {
5100   return __a | ~__b;
5101 }
5102
5103 static __inline__ vector signed char __ATTRS_o_ai
5104 vec_orc(vector bool char __a, vector signed char __b) {
5105   return __a | ~__b;
5106 }
5107
5108 static __inline__ vector unsigned char __ATTRS_o_ai
5109 vec_orc(vector unsigned char __a, vector unsigned char __b) {
5110   return __a | ~__b;
5111 }
5112
5113 static __inline__ vector unsigned char __ATTRS_o_ai
5114 vec_orc(vector unsigned char __a, vector bool char __b) {
5115   return __a | ~__b;
5116 }
5117
5118 static __inline__ vector unsigned char __ATTRS_o_ai
5119 vec_orc(vector bool char __a, vector unsigned char __b) {
5120   return __a | ~__b;
5121 }
5122
5123 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
5124                                                         vector bool char __b) {
5125   return __a | ~__b;
5126 }
5127
5128 static __inline__ vector signed short __ATTRS_o_ai
5129 vec_orc(vector signed short __a, vector signed short __b) {
5130   return __a | ~__b;
5131 }
5132
5133 static __inline__ vector signed short __ATTRS_o_ai
5134 vec_orc(vector signed short __a, vector bool short __b) {
5135   return __a | ~__b;
5136 }
5137
5138 static __inline__ vector signed short __ATTRS_o_ai
5139 vec_orc(vector bool short __a, vector signed short __b) {
5140   return __a | ~__b;
5141 }
5142
5143 static __inline__ vector unsigned short __ATTRS_o_ai
5144 vec_orc(vector unsigned short __a, vector unsigned short __b) {
5145   return __a | ~__b;
5146 }
5147
5148 static __inline__ vector unsigned short __ATTRS_o_ai
5149 vec_orc(vector unsigned short __a, vector bool short __b) {
5150   return __a | ~__b;
5151 }
5152
5153 static __inline__ vector unsigned short __ATTRS_o_ai
5154 vec_orc(vector bool short __a, vector unsigned short __b) {
5155   return __a | ~__b;
5156 }
5157
5158 static __inline__ vector bool short __ATTRS_o_ai
5159 vec_orc(vector bool short __a, vector bool short __b) {
5160   return __a | ~__b;
5161 }
5162
5163 static __inline__ vector signed int __ATTRS_o_ai
5164 vec_orc(vector signed int __a, vector signed int __b) {
5165   return __a | ~__b;
5166 }
5167
5168 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5169                                                          vector bool int __b) {
5170   return __a | ~__b;
5171 }
5172
5173 static __inline__ vector signed int __ATTRS_o_ai
5174 vec_orc(vector bool int __a, vector signed int __b) {
5175   return __a | ~__b;
5176 }
5177
5178 static __inline__ vector unsigned int __ATTRS_o_ai
5179 vec_orc(vector unsigned int __a, vector unsigned int __b) {
5180   return __a | ~__b;
5181 }
5182
5183 static __inline__ vector unsigned int __ATTRS_o_ai
5184 vec_orc(vector unsigned int __a, vector bool int __b) {
5185   return __a | ~__b;
5186 }
5187
5188 static __inline__ vector unsigned int __ATTRS_o_ai
5189 vec_orc(vector bool int __a, vector unsigned int __b) {
5190   return __a | ~__b;
5191 }
5192
5193 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
5194                                                        vector bool int __b) {
5195   return __a | ~__b;
5196 }
5197
5198 static __inline__ vector signed long long __ATTRS_o_ai
5199 vec_orc(vector signed long long __a, vector signed long long __b) {
5200   return __a | ~__b;
5201 }
5202
5203 static __inline__ vector signed long long __ATTRS_o_ai
5204 vec_orc(vector signed long long __a, vector bool long long __b) {
5205   return __a | ~__b;
5206 }
5207
5208 static __inline__ vector signed long long __ATTRS_o_ai
5209 vec_orc(vector bool long long __a, vector signed long long __b) {
5210   return __a | ~__b;
5211 }
5212
5213 static __inline__ vector unsigned long long __ATTRS_o_ai
5214 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
5215   return __a | ~__b;
5216 }
5217
5218 static __inline__ vector unsigned long long __ATTRS_o_ai
5219 vec_orc(vector unsigned long long __a, vector bool long long __b) {
5220   return __a | ~__b;
5221 }
5222
5223 static __inline__ vector unsigned long long __ATTRS_o_ai
5224 vec_orc(vector bool long long __a, vector unsigned long long __b) {
5225   return __a | ~__b;
5226 }
5227
5228 static __inline__ vector bool long long __ATTRS_o_ai
5229 vec_orc(vector bool long long __a, vector bool long long __b) {
5230   return __a | ~__b;
5231 }
5232 #endif
5233
5234 /* vec_vor */
5235
5236 static __inline__ vector signed char __ATTRS_o_ai
5237 vec_vor(vector signed char __a, vector signed char __b) {
5238   return __a | __b;
5239 }
5240
5241 static __inline__ vector signed char __ATTRS_o_ai
5242 vec_vor(vector bool char __a, vector signed char __b) {
5243   return (vector signed char)__a | __b;
5244 }
5245
5246 static __inline__ vector signed char __ATTRS_o_ai
5247 vec_vor(vector signed char __a, vector bool char __b) {
5248   return __a | (vector signed char)__b;
5249 }
5250
5251 static __inline__ vector unsigned char __ATTRS_o_ai
5252 vec_vor(vector unsigned char __a, vector unsigned char __b) {
5253   return __a | __b;
5254 }
5255
5256 static __inline__ vector unsigned char __ATTRS_o_ai
5257 vec_vor(vector bool char __a, vector unsigned char __b) {
5258   return (vector unsigned char)__a | __b;
5259 }
5260
5261 static __inline__ vector unsigned char __ATTRS_o_ai
5262 vec_vor(vector unsigned char __a, vector bool char __b) {
5263   return __a | (vector unsigned char)__b;
5264 }
5265
5266 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
5267                                                         vector bool char __b) {
5268   return __a | __b;
5269 }
5270
5271 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
5272                                                     vector short __b) {
5273   return __a | __b;
5274 }
5275
5276 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
5277                                                     vector short __b) {
5278   return (vector short)__a | __b;
5279 }
5280
5281 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
5282                                                     vector bool short __b) {
5283   return __a | (vector short)__b;
5284 }
5285
5286 static __inline__ vector unsigned short __ATTRS_o_ai
5287 vec_vor(vector unsigned short __a, vector unsigned short __b) {
5288   return __a | __b;
5289 }
5290
5291 static __inline__ vector unsigned short __ATTRS_o_ai
5292 vec_vor(vector bool short __a, vector unsigned short __b) {
5293   return (vector unsigned short)__a | __b;
5294 }
5295
5296 static __inline__ vector unsigned short __ATTRS_o_ai
5297 vec_vor(vector unsigned short __a, vector bool short __b) {
5298   return __a | (vector unsigned short)__b;
5299 }
5300
5301 static __inline__ vector bool short __ATTRS_o_ai
5302 vec_vor(vector bool short __a, vector bool short __b) {
5303   return __a | __b;
5304 }
5305
5306 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
5307                                                   vector int __b) {
5308   return __a | __b;
5309 }
5310
5311 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
5312                                                   vector int __b) {
5313   return (vector int)__a | __b;
5314 }
5315
5316 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
5317                                                   vector bool int __b) {
5318   return __a | (vector int)__b;
5319 }
5320
5321 static __inline__ vector unsigned int __ATTRS_o_ai
5322 vec_vor(vector unsigned int __a, vector unsigned int __b) {
5323   return __a | __b;
5324 }
5325
5326 static __inline__ vector unsigned int __ATTRS_o_ai
5327 vec_vor(vector bool int __a, vector unsigned int __b) {
5328   return (vector unsigned int)__a | __b;
5329 }
5330
5331 static __inline__ vector unsigned int __ATTRS_o_ai
5332 vec_vor(vector unsigned int __a, vector bool int __b) {
5333   return __a | (vector unsigned int)__b;
5334 }
5335
5336 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
5337                                                        vector bool int __b) {
5338   return __a | __b;
5339 }
5340
5341 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
5342                                                     vector float __b) {
5343   vector unsigned int __res =
5344       (vector unsigned int)__a | (vector unsigned int)__b;
5345   return (vector float)__res;
5346 }
5347
5348 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
5349                                                     vector float __b) {
5350   vector unsigned int __res =
5351       (vector unsigned int)__a | (vector unsigned int)__b;
5352   return (vector float)__res;
5353 }
5354
5355 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
5356                                                     vector bool int __b) {
5357   vector unsigned int __res =
5358       (vector unsigned int)__a | (vector unsigned int)__b;
5359   return (vector float)__res;
5360 }
5361
5362 #ifdef __VSX__
5363 static __inline__ vector signed long long __ATTRS_o_ai
5364 vec_vor(vector signed long long __a, vector signed long long __b) {
5365   return __a | __b;
5366 }
5367
5368 static __inline__ vector signed long long __ATTRS_o_ai
5369 vec_vor(vector bool long long __a, vector signed long long __b) {
5370   return (vector signed long long)__a | __b;
5371 }
5372
5373 static __inline__ vector signed long long __ATTRS_o_ai
5374 vec_vor(vector signed long long __a, vector bool long long __b) {
5375   return __a | (vector signed long long)__b;
5376 }
5377
5378 static __inline__ vector unsigned long long __ATTRS_o_ai
5379 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
5380   return __a | __b;
5381 }
5382
5383 static __inline__ vector unsigned long long __ATTRS_o_ai
5384 vec_vor(vector bool long long __a, vector unsigned long long __b) {
5385   return (vector unsigned long long)__a | __b;
5386 }
5387
5388 static __inline__ vector unsigned long long __ATTRS_o_ai
5389 vec_vor(vector unsigned long long __a, vector bool long long __b) {
5390   return __a | (vector unsigned long long)__b;
5391 }
5392
5393 static __inline__ vector bool long long __ATTRS_o_ai
5394 vec_vor(vector bool long long __a, vector bool long long __b) {
5395   return __a | __b;
5396 }
5397 #endif
5398
5399 /* vec_pack */
5400
5401 /* The various vector pack instructions have a big-endian bias, so for
5402    little endian we must handle reversed element numbering.  */
5403
5404 static __inline__ vector signed char __ATTRS_o_ai
5405 vec_pack(vector signed short __a, vector signed short __b) {
5406 #ifdef __LITTLE_ENDIAN__
5407   return (vector signed char)vec_perm(
5408       __a, __b,
5409       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5410                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5411 #else
5412   return (vector signed char)vec_perm(
5413       __a, __b,
5414       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5415                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5416 #endif
5417 }
5418
5419 static __inline__ vector unsigned char __ATTRS_o_ai
5420 vec_pack(vector unsigned short __a, vector unsigned short __b) {
5421 #ifdef __LITTLE_ENDIAN__
5422   return (vector unsigned char)vec_perm(
5423       __a, __b,
5424       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5425                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5426 #else
5427   return (vector unsigned char)vec_perm(
5428       __a, __b,
5429       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5430                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5431 #endif
5432 }
5433
5434 static __inline__ vector bool char __ATTRS_o_ai
5435 vec_pack(vector bool short __a, vector bool short __b) {
5436 #ifdef __LITTLE_ENDIAN__
5437   return (vector bool char)vec_perm(
5438       __a, __b,
5439       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5440                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5441 #else
5442   return (vector bool char)vec_perm(
5443       __a, __b,
5444       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5445                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5446 #endif
5447 }
5448
5449 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
5450                                                      vector int __b) {
5451 #ifdef __LITTLE_ENDIAN__
5452   return (vector short)vec_perm(
5453       __a, __b,
5454       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5455                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5456 #else
5457   return (vector short)vec_perm(
5458       __a, __b,
5459       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5460                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5461 #endif
5462 }
5463
5464 static __inline__ vector unsigned short __ATTRS_o_ai
5465 vec_pack(vector unsigned int __a, vector unsigned int __b) {
5466 #ifdef __LITTLE_ENDIAN__
5467   return (vector unsigned short)vec_perm(
5468       __a, __b,
5469       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5470                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5471 #else
5472   return (vector unsigned short)vec_perm(
5473       __a, __b,
5474       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5475                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5476 #endif
5477 }
5478
5479 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
5480                                                           vector bool int __b) {
5481 #ifdef __LITTLE_ENDIAN__
5482   return (vector bool short)vec_perm(
5483       __a, __b,
5484       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5485                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5486 #else
5487   return (vector bool short)vec_perm(
5488       __a, __b,
5489       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5490                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5491 #endif
5492 }
5493
5494 #ifdef __VSX__
5495 static __inline__ vector signed int __ATTRS_o_ai
5496 vec_pack(vector signed long long __a, vector signed long long __b) {
5497 #ifdef __LITTLE_ENDIAN__
5498   return (vector signed int)vec_perm(
5499       __a, __b,
5500       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5501                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5502 #else
5503   return (vector signed int)vec_perm(
5504       __a, __b,
5505       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5506                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5507 #endif
5508 }
5509 static __inline__ vector unsigned int __ATTRS_o_ai
5510 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
5511 #ifdef __LITTLE_ENDIAN__
5512   return (vector unsigned int)vec_perm(
5513       __a, __b,
5514       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5515                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5516 #else
5517   return (vector unsigned int)vec_perm(
5518       __a, __b,
5519       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5520                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5521 #endif
5522 }
5523
5524 static __inline__ vector bool int __ATTRS_o_ai
5525 vec_pack(vector bool long long __a, vector bool long long __b) {
5526 #ifdef __LITTLE_ENDIAN__
5527   return (vector bool int)vec_perm(
5528       __a, __b,
5529       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5530                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5531 #else
5532   return (vector bool int)vec_perm(
5533       __a, __b,
5534       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5535                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5536 #endif
5537 }
5538
5539 #endif
5540
5541 /* vec_vpkuhum */
5542
5543 #define __builtin_altivec_vpkuhum vec_vpkuhum
5544
5545 static __inline__ vector signed char __ATTRS_o_ai
5546 vec_vpkuhum(vector signed short __a, vector signed short __b) {
5547 #ifdef __LITTLE_ENDIAN__
5548   return (vector signed char)vec_perm(
5549       __a, __b,
5550       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5551                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5552 #else
5553   return (vector signed char)vec_perm(
5554       __a, __b,
5555       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5556                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5557 #endif
5558 }
5559
5560 static __inline__ vector unsigned char __ATTRS_o_ai
5561 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
5562 #ifdef __LITTLE_ENDIAN__
5563   return (vector unsigned char)vec_perm(
5564       __a, __b,
5565       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5566                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5567 #else
5568   return (vector unsigned char)vec_perm(
5569       __a, __b,
5570       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5571                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5572 #endif
5573 }
5574
5575 static __inline__ vector bool char __ATTRS_o_ai
5576 vec_vpkuhum(vector bool short __a, vector bool short __b) {
5577 #ifdef __LITTLE_ENDIAN__
5578   return (vector bool char)vec_perm(
5579       __a, __b,
5580       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5581                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5582 #else
5583   return (vector bool char)vec_perm(
5584       __a, __b,
5585       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5586                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5587 #endif
5588 }
5589
5590 /* vec_vpkuwum */
5591
5592 #define __builtin_altivec_vpkuwum vec_vpkuwum
5593
5594 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
5595                                                         vector int __b) {
5596 #ifdef __LITTLE_ENDIAN__
5597   return (vector short)vec_perm(
5598       __a, __b,
5599       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5600                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5601 #else
5602   return (vector short)vec_perm(
5603       __a, __b,
5604       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5605                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5606 #endif
5607 }
5608
5609 static __inline__ vector unsigned short __ATTRS_o_ai
5610 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
5611 #ifdef __LITTLE_ENDIAN__
5612   return (vector unsigned short)vec_perm(
5613       __a, __b,
5614       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5615                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5616 #else
5617   return (vector unsigned short)vec_perm(
5618       __a, __b,
5619       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5620                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5621 #endif
5622 }
5623
5624 static __inline__ vector bool short __ATTRS_o_ai
5625 vec_vpkuwum(vector bool int __a, vector bool int __b) {
5626 #ifdef __LITTLE_ENDIAN__
5627   return (vector bool short)vec_perm(
5628       __a, __b,
5629       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5630                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5631 #else
5632   return (vector bool short)vec_perm(
5633       __a, __b,
5634       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5635                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5636 #endif
5637 }
5638
5639 /* vec_vpkudum */
5640
5641 #ifdef __POWER8_VECTOR__
5642 #define __builtin_altivec_vpkudum vec_vpkudum
5643
5644 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
5645                                                       vector long long __b) {
5646 #ifdef __LITTLE_ENDIAN__
5647   return (vector int)vec_perm(
5648       __a, __b,
5649       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5650                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5651 #else
5652   return (vector int)vec_perm(
5653       __a, __b,
5654       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5655                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5656 #endif
5657 }
5658
5659 static __inline__ vector unsigned int __ATTRS_o_ai
5660 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
5661 #ifdef __LITTLE_ENDIAN__
5662   return (vector unsigned int)vec_perm(
5663       __a, __b,
5664       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5665                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5666 #else
5667   return (vector unsigned int)vec_perm(
5668       __a, __b,
5669       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5670                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5671 #endif
5672 }
5673
5674 static __inline__ vector bool int __ATTRS_o_ai
5675 vec_vpkudum(vector bool long long __a, vector bool long long __b) {
5676 #ifdef __LITTLE_ENDIAN__
5677   return (vector bool int)vec_perm(
5678       (vector long long)__a, (vector long long)__b,
5679       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5680                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5681 #else
5682   return (vector bool int)vec_perm(
5683       (vector long long)__a, (vector long long)__b,
5684       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5685                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5686 #endif
5687 }
5688 #endif
5689
5690 /* vec_packpx */
5691
5692 static __inline__ vector pixel __attribute__((__always_inline__))
5693 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
5694 #ifdef __LITTLE_ENDIAN__
5695   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5696 #else
5697   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5698 #endif
5699 }
5700
5701 /* vec_vpkpx */
5702
5703 static __inline__ vector pixel __attribute__((__always_inline__))
5704 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
5705 #ifdef __LITTLE_ENDIAN__
5706   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5707 #else
5708   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5709 #endif
5710 }
5711
5712 /* vec_packs */
5713
5714 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
5715                                                             vector short __b) {
5716 #ifdef __LITTLE_ENDIAN__
5717   return __builtin_altivec_vpkshss(__b, __a);
5718 #else
5719   return __builtin_altivec_vpkshss(__a, __b);
5720 #endif
5721 }
5722
5723 static __inline__ vector unsigned char __ATTRS_o_ai
5724 vec_packs(vector unsigned short __a, vector unsigned short __b) {
5725 #ifdef __LITTLE_ENDIAN__
5726   return __builtin_altivec_vpkuhus(__b, __a);
5727 #else
5728   return __builtin_altivec_vpkuhus(__a, __b);
5729 #endif
5730 }
5731
5732 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
5733                                                              vector int __b) {
5734 #ifdef __LITTLE_ENDIAN__
5735   return __builtin_altivec_vpkswss(__b, __a);
5736 #else
5737   return __builtin_altivec_vpkswss(__a, __b);
5738 #endif
5739 }
5740
5741 static __inline__ vector unsigned short __ATTRS_o_ai
5742 vec_packs(vector unsigned int __a, vector unsigned int __b) {
5743 #ifdef __LITTLE_ENDIAN__
5744   return __builtin_altivec_vpkuwus(__b, __a);
5745 #else
5746   return __builtin_altivec_vpkuwus(__a, __b);
5747 #endif
5748 }
5749
5750 #ifdef __POWER8_VECTOR__
5751 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
5752                                                     vector long long __b) {
5753 #ifdef __LITTLE_ENDIAN__
5754   return __builtin_altivec_vpksdss(__b, __a);
5755 #else
5756   return __builtin_altivec_vpksdss(__a, __b);
5757 #endif
5758 }
5759
5760 static __inline__ vector unsigned int __ATTRS_o_ai
5761 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
5762 #ifdef __LITTLE_ENDIAN__
5763   return __builtin_altivec_vpkudus(__b, __a);
5764 #else
5765   return __builtin_altivec_vpkudus(__a, __b);
5766 #endif
5767 }
5768 #endif
5769
5770 /* vec_vpkshss */
5771
5772 static __inline__ vector signed char __attribute__((__always_inline__))
5773 vec_vpkshss(vector short __a, vector short __b) {
5774 #ifdef __LITTLE_ENDIAN__
5775   return __builtin_altivec_vpkshss(__b, __a);
5776 #else
5777   return __builtin_altivec_vpkshss(__a, __b);
5778 #endif
5779 }
5780
5781 /* vec_vpksdss */
5782
5783 #ifdef __POWER8_VECTOR__
5784 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
5785                                                       vector long long __b) {
5786 #ifdef __LITTLE_ENDIAN__
5787   return __builtin_altivec_vpksdss(__b, __a);
5788 #else
5789   return __builtin_altivec_vpksdss(__a, __b);
5790 #endif
5791 }
5792 #endif
5793
5794 /* vec_vpkuhus */
5795
5796 static __inline__ vector unsigned char __attribute__((__always_inline__))
5797 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
5798 #ifdef __LITTLE_ENDIAN__
5799   return __builtin_altivec_vpkuhus(__b, __a);
5800 #else
5801   return __builtin_altivec_vpkuhus(__a, __b);
5802 #endif
5803 }
5804
5805 /* vec_vpkudus */
5806
5807 #ifdef __POWER8_VECTOR__
5808 static __inline__ vector unsigned int __attribute__((__always_inline__))
5809 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
5810 #ifdef __LITTLE_ENDIAN__
5811   return __builtin_altivec_vpkudus(__b, __a);
5812 #else
5813   return __builtin_altivec_vpkudus(__a, __b);
5814 #endif
5815 }
5816 #endif
5817
5818 /* vec_vpkswss */
5819
5820 static __inline__ vector signed short __attribute__((__always_inline__))
5821 vec_vpkswss(vector int __a, vector int __b) {
5822 #ifdef __LITTLE_ENDIAN__
5823   return __builtin_altivec_vpkswss(__b, __a);
5824 #else
5825   return __builtin_altivec_vpkswss(__a, __b);
5826 #endif
5827 }
5828
5829 /* vec_vpkuwus */
5830
5831 static __inline__ vector unsigned short __attribute__((__always_inline__))
5832 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
5833 #ifdef __LITTLE_ENDIAN__
5834   return __builtin_altivec_vpkuwus(__b, __a);
5835 #else
5836   return __builtin_altivec_vpkuwus(__a, __b);
5837 #endif
5838 }
5839
5840 /* vec_packsu */
5841
5842 static __inline__ vector unsigned char __ATTRS_o_ai
5843 vec_packsu(vector short __a, vector short __b) {
5844 #ifdef __LITTLE_ENDIAN__
5845   return __builtin_altivec_vpkshus(__b, __a);
5846 #else
5847   return __builtin_altivec_vpkshus(__a, __b);
5848 #endif
5849 }
5850
5851 static __inline__ vector unsigned char __ATTRS_o_ai
5852 vec_packsu(vector unsigned short __a, vector unsigned short __b) {
5853 #ifdef __LITTLE_ENDIAN__
5854   return __builtin_altivec_vpkuhus(__b, __a);
5855 #else
5856   return __builtin_altivec_vpkuhus(__a, __b);
5857 #endif
5858 }
5859
5860 static __inline__ vector unsigned short __ATTRS_o_ai
5861 vec_packsu(vector int __a, vector int __b) {
5862 #ifdef __LITTLE_ENDIAN__
5863   return __builtin_altivec_vpkswus(__b, __a);
5864 #else
5865   return __builtin_altivec_vpkswus(__a, __b);
5866 #endif
5867 }
5868
5869 static __inline__ vector unsigned short __ATTRS_o_ai
5870 vec_packsu(vector unsigned int __a, vector unsigned int __b) {
5871 #ifdef __LITTLE_ENDIAN__
5872   return __builtin_altivec_vpkuwus(__b, __a);
5873 #else
5874   return __builtin_altivec_vpkuwus(__a, __b);
5875 #endif
5876 }
5877
5878 #ifdef __POWER8_VECTOR__
5879 static __inline__ vector unsigned int __ATTRS_o_ai
5880 vec_packsu(vector long long __a, vector long long __b) {
5881 #ifdef __LITTLE_ENDIAN__
5882   return __builtin_altivec_vpksdus(__b, __a);
5883 #else
5884   return __builtin_altivec_vpksdus(__a, __b);
5885 #endif
5886 }
5887
5888 static __inline__ vector unsigned int __ATTRS_o_ai
5889 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
5890 #ifdef __LITTLE_ENDIAN__
5891   return __builtin_altivec_vpkudus(__b, __a);
5892 #else
5893   return __builtin_altivec_vpkudus(__a, __b);
5894 #endif
5895 }
5896 #endif
5897
5898 /* vec_vpkshus */
5899
5900 static __inline__ vector unsigned char __ATTRS_o_ai
5901 vec_vpkshus(vector short __a, vector short __b) {
5902 #ifdef __LITTLE_ENDIAN__
5903   return __builtin_altivec_vpkshus(__b, __a);
5904 #else
5905   return __builtin_altivec_vpkshus(__a, __b);
5906 #endif
5907 }
5908
5909 static __inline__ vector unsigned char __ATTRS_o_ai
5910 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
5911 #ifdef __LITTLE_ENDIAN__
5912   return __builtin_altivec_vpkuhus(__b, __a);
5913 #else
5914   return __builtin_altivec_vpkuhus(__a, __b);
5915 #endif
5916 }
5917
5918 /* vec_vpkswus */
5919
5920 static __inline__ vector unsigned short __ATTRS_o_ai
5921 vec_vpkswus(vector int __a, vector int __b) {
5922 #ifdef __LITTLE_ENDIAN__
5923   return __builtin_altivec_vpkswus(__b, __a);
5924 #else
5925   return __builtin_altivec_vpkswus(__a, __b);
5926 #endif
5927 }
5928
5929 static __inline__ vector unsigned short __ATTRS_o_ai
5930 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
5931 #ifdef __LITTLE_ENDIAN__
5932   return __builtin_altivec_vpkuwus(__b, __a);
5933 #else
5934   return __builtin_altivec_vpkuwus(__a, __b);
5935 #endif
5936 }
5937
5938 /* vec_vpksdus */
5939
5940 #ifdef __POWER8_VECTOR__
5941 static __inline__ vector unsigned int __ATTRS_o_ai
5942 vec_vpksdus(vector long long __a, vector long long __b) {
5943 #ifdef __LITTLE_ENDIAN__
5944   return __builtin_altivec_vpksdus(__b, __a);
5945 #else
5946   return __builtin_altivec_vpksdus(__a, __b);
5947 #endif
5948 }
5949 #endif
5950
5951 /* vec_perm */
5952
5953 // The vperm instruction is defined architecturally with a big-endian bias.
5954 // For little endian, we swap the input operands and invert the permute
5955 // control vector.  Only the rightmost 5 bits matter, so we could use
5956 // a vector of all 31s instead of all 255s to perform the inversion.
5957 // However, when the PCV is not a constant, using 255 has an advantage
5958 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
5959 // later, possibly a vec_nand).
5960
5961 static __inline__ vector signed char __ATTRS_o_ai vec_perm(
5962     vector signed char __a, vector signed char __b, vector unsigned char __c) {
5963 #ifdef __LITTLE_ENDIAN__
5964   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5965                               255, 255, 255, 255, 255, 255, 255, 255};
5966   __d = vec_xor(__c, __d);
5967   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
5968                                                          (vector int)__a, __d);
5969 #else
5970   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
5971                                                          (vector int)__b, __c);
5972 #endif
5973 }
5974
5975 static __inline__ vector unsigned char __ATTRS_o_ai
5976 vec_perm(vector unsigned char __a, vector unsigned char __b,
5977          vector unsigned char __c) {
5978 #ifdef __LITTLE_ENDIAN__
5979   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5980                               255, 255, 255, 255, 255, 255, 255, 255};
5981   __d = vec_xor(__c, __d);
5982   return (vector unsigned char)__builtin_altivec_vperm_4si(
5983       (vector int)__b, (vector int)__a, __d);
5984 #else
5985   return (vector unsigned char)__builtin_altivec_vperm_4si(
5986       (vector int)__a, (vector int)__b, __c);
5987 #endif
5988 }
5989
5990 static __inline__ vector bool char __ATTRS_o_ai
5991 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
5992 #ifdef __LITTLE_ENDIAN__
5993   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5994                               255, 255, 255, 255, 255, 255, 255, 255};
5995   __d = vec_xor(__c, __d);
5996   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
5997                                                        (vector int)__a, __d);
5998 #else
5999   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
6000                                                        (vector int)__b, __c);
6001 #endif
6002 }
6003
6004 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
6005                                                      vector signed short __b,
6006                                                      vector unsigned char __c) {
6007 #ifdef __LITTLE_ENDIAN__
6008   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6009                               255, 255, 255, 255, 255, 255, 255, 255};
6010   __d = vec_xor(__c, __d);
6011   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
6012                                                           (vector int)__a, __d);
6013 #else
6014   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
6015                                                           (vector int)__b, __c);
6016 #endif
6017 }
6018
6019 static __inline__ vector unsigned short __ATTRS_o_ai
6020 vec_perm(vector unsigned short __a, vector unsigned short __b,
6021          vector unsigned char __c) {
6022 #ifdef __LITTLE_ENDIAN__
6023   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6024                               255, 255, 255, 255, 255, 255, 255, 255};
6025   __d = vec_xor(__c, __d);
6026   return (vector unsigned short)__builtin_altivec_vperm_4si(
6027       (vector int)__b, (vector int)__a, __d);
6028 #else
6029   return (vector unsigned short)__builtin_altivec_vperm_4si(
6030       (vector int)__a, (vector int)__b, __c);
6031 #endif
6032 }
6033
6034 static __inline__ vector bool short __ATTRS_o_ai vec_perm(
6035     vector bool short __a, vector bool short __b, vector unsigned char __c) {
6036 #ifdef __LITTLE_ENDIAN__
6037   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6038                               255, 255, 255, 255, 255, 255, 255, 255};
6039   __d = vec_xor(__c, __d);
6040   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
6041                                                         (vector int)__a, __d);
6042 #else
6043   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
6044                                                         (vector int)__b, __c);
6045 #endif
6046 }
6047
6048 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
6049                                                      vector pixel __b,
6050                                                      vector unsigned char __c) {
6051 #ifdef __LITTLE_ENDIAN__
6052   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6053                               255, 255, 255, 255, 255, 255, 255, 255};
6054   __d = vec_xor(__c, __d);
6055   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
6056                                                    (vector int)__a, __d);
6057 #else
6058   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
6059                                                    (vector int)__b, __c);
6060 #endif
6061 }
6062
6063 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
6064                                                    vector signed int __b,
6065                                                    vector unsigned char __c) {
6066 #ifdef __LITTLE_ENDIAN__
6067   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6068                               255, 255, 255, 255, 255, 255, 255, 255};
6069   __d = vec_xor(__c, __d);
6070   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
6071 #else
6072   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
6073 #endif
6074 }
6075
6076 static __inline__ vector unsigned int __ATTRS_o_ai
6077 vec_perm(vector unsigned int __a, vector unsigned int __b,
6078          vector unsigned char __c) {
6079 #ifdef __LITTLE_ENDIAN__
6080   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6081                               255, 255, 255, 255, 255, 255, 255, 255};
6082   __d = vec_xor(__c, __d);
6083   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
6084                                                           (vector int)__a, __d);
6085 #else
6086   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
6087                                                           (vector int)__b, __c);
6088 #endif
6089 }
6090
6091 static __inline__ vector bool int __ATTRS_o_ai
6092 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6093 #ifdef __LITTLE_ENDIAN__
6094   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6095                               255, 255, 255, 255, 255, 255, 255, 255};
6096   __d = vec_xor(__c, __d);
6097   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
6098                                                       (vector int)__a, __d);
6099 #else
6100   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
6101                                                       (vector int)__b, __c);
6102 #endif
6103 }
6104
6105 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
6106                                                      vector float __b,
6107                                                      vector unsigned char __c) {
6108 #ifdef __LITTLE_ENDIAN__
6109   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6110                               255, 255, 255, 255, 255, 255, 255, 255};
6111   __d = vec_xor(__c, __d);
6112   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
6113                                                    (vector int)__a, __d);
6114 #else
6115   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
6116                                                    (vector int)__b, __c);
6117 #endif
6118 }
6119
6120 #ifdef __VSX__
6121 static __inline__ vector long long __ATTRS_o_ai
6122 vec_perm(vector signed long long __a, vector signed long long __b,
6123          vector unsigned char __c) {
6124 #ifdef __LITTLE_ENDIAN__
6125   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6126                               255, 255, 255, 255, 255, 255, 255, 255};
6127   __d = vec_xor(__c, __d);
6128   return (vector signed long long)__builtin_altivec_vperm_4si(
6129       (vector int)__b, (vector int)__a, __d);
6130 #else
6131   return (vector signed long long)__builtin_altivec_vperm_4si(
6132       (vector int)__a, (vector int)__b, __c);
6133 #endif
6134 }
6135
6136 static __inline__ vector unsigned long long __ATTRS_o_ai
6137 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
6138          vector unsigned char __c) {
6139 #ifdef __LITTLE_ENDIAN__
6140   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6141                               255, 255, 255, 255, 255, 255, 255, 255};
6142   __d = vec_xor(__c, __d);
6143   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6144       (vector int)__b, (vector int)__a, __d);
6145 #else
6146   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6147       (vector int)__a, (vector int)__b, __c);
6148 #endif
6149 }
6150
6151 static __inline__ vector bool long long __ATTRS_o_ai
6152 vec_perm(vector bool long long __a, vector bool long long __b,
6153          vector unsigned char __c) {
6154 #ifdef __LITTLE_ENDIAN__
6155   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6156                               255, 255, 255, 255, 255, 255, 255, 255};
6157   __d = vec_xor(__c, __d);
6158   return (vector bool long long)__builtin_altivec_vperm_4si(
6159       (vector int)__b, (vector int)__a, __d);
6160 #else
6161   return (vector bool long long)__builtin_altivec_vperm_4si(
6162       (vector int)__a, (vector int)__b, __c);
6163 #endif
6164 }
6165
6166 static __inline__ vector double __ATTRS_o_ai
6167 vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
6168 #ifdef __LITTLE_ENDIAN__
6169   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6170                               255, 255, 255, 255, 255, 255, 255, 255};
6171   __d = vec_xor(__c, __d);
6172   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
6173                                                     (vector int)__a, __d);
6174 #else
6175   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
6176                                                     (vector int)__b, __c);
6177 #endif
6178 }
6179 #endif
6180
6181 /* vec_vperm */
6182
6183 static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
6184     vector signed char __a, vector signed char __b, vector unsigned char __c) {
6185   return vec_perm(__a, __b, __c);
6186 }
6187
6188 static __inline__ vector unsigned char __ATTRS_o_ai
6189 vec_vperm(vector unsigned char __a, vector unsigned char __b,
6190           vector unsigned char __c) {
6191   return vec_perm(__a, __b, __c);
6192 }
6193
6194 static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
6195     vector bool char __a, vector bool char __b, vector unsigned char __c) {
6196   return vec_perm(__a, __b, __c);
6197 }
6198
6199 static __inline__ vector short __ATTRS_o_ai
6200 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
6201   return vec_perm(__a, __b, __c);
6202 }
6203
6204 static __inline__ vector unsigned short __ATTRS_o_ai
6205 vec_vperm(vector unsigned short __a, vector unsigned short __b,
6206           vector unsigned char __c) {
6207   return vec_perm(__a, __b, __c);
6208 }
6209
6210 static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
6211     vector bool short __a, vector bool short __b, vector unsigned char __c) {
6212   return vec_perm(__a, __b, __c);
6213 }
6214
6215 static __inline__ vector pixel __ATTRS_o_ai
6216 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
6217   return vec_perm(__a, __b, __c);
6218 }
6219
6220 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
6221                                                     vector int __b,
6222                                                     vector unsigned char __c) {
6223   return vec_perm(__a, __b, __c);
6224 }
6225
6226 static __inline__ vector unsigned int __ATTRS_o_ai
6227 vec_vperm(vector unsigned int __a, vector unsigned int __b,
6228           vector unsigned char __c) {
6229   return vec_perm(__a, __b, __c);
6230 }
6231
6232 static __inline__ vector bool int __ATTRS_o_ai
6233 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
6234   return vec_perm(__a, __b, __c);
6235 }
6236
6237 static __inline__ vector float __ATTRS_o_ai
6238 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
6239   return vec_perm(__a, __b, __c);
6240 }
6241
6242 #ifdef __VSX__
6243 static __inline__ vector long long __ATTRS_o_ai vec_vperm(
6244     vector long long __a, vector long long __b, vector unsigned char __c) {
6245   return vec_perm(__a, __b, __c);
6246 }
6247
6248 static __inline__ vector unsigned long long __ATTRS_o_ai
6249 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
6250           vector unsigned char __c) {
6251   return vec_perm(__a, __b, __c);
6252 }
6253
6254 static __inline__ vector double __ATTRS_o_ai
6255 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
6256   return vec_perm(__a, __b, __c);
6257 }
6258 #endif
6259
6260 /* vec_re */
6261
6262 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
6263 #ifdef __VSX__
6264   return __builtin_vsx_xvresp(__a);
6265 #else
6266   return __builtin_altivec_vrefp(__a);
6267 #endif
6268 }
6269
6270 #ifdef __VSX__
6271 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
6272   return __builtin_vsx_xvredp(__a);
6273 }
6274 #endif
6275
6276 /* vec_vrefp */
6277
6278 static __inline__ vector float __attribute__((__always_inline__))
6279 vec_vrefp(vector float __a) {
6280   return __builtin_altivec_vrefp(__a);
6281 }
6282
6283 /* vec_rl */
6284
6285 static __inline__ vector signed char __ATTRS_o_ai
6286 vec_rl(vector signed char __a, vector unsigned char __b) {
6287   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6288 }
6289
6290 static __inline__ vector unsigned char __ATTRS_o_ai
6291 vec_rl(vector unsigned char __a, vector unsigned char __b) {
6292   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6293 }
6294
6295 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
6296                                                    vector unsigned short __b) {
6297   return __builtin_altivec_vrlh(__a, __b);
6298 }
6299
6300 static __inline__ vector unsigned short __ATTRS_o_ai
6301 vec_rl(vector unsigned short __a, vector unsigned short __b) {
6302   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6303 }
6304
6305 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
6306                                                  vector unsigned int __b) {
6307   return __builtin_altivec_vrlw(__a, __b);
6308 }
6309
6310 static __inline__ vector unsigned int __ATTRS_o_ai
6311 vec_rl(vector unsigned int __a, vector unsigned int __b) {
6312   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6313 }
6314
6315 #ifdef __POWER8_VECTOR__
6316 static __inline__ vector signed long long __ATTRS_o_ai
6317 vec_rl(vector signed long long __a, vector unsigned long long __b) {
6318   return __builtin_altivec_vrld(__a, __b);
6319 }
6320
6321 static __inline__ vector unsigned long long __ATTRS_o_ai
6322 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
6323   return __builtin_altivec_vrld(__a, __b);
6324 }
6325 #endif
6326
6327 /* vec_vrlb */
6328
6329 static __inline__ vector signed char __ATTRS_o_ai
6330 vec_vrlb(vector signed char __a, vector unsigned char __b) {
6331   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6332 }
6333
6334 static __inline__ vector unsigned char __ATTRS_o_ai
6335 vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
6336   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6337 }
6338
6339 /* vec_vrlh */
6340
6341 static __inline__ vector short __ATTRS_o_ai
6342 vec_vrlh(vector short __a, vector unsigned short __b) {
6343   return __builtin_altivec_vrlh(__a, __b);
6344 }
6345
6346 static __inline__ vector unsigned short __ATTRS_o_ai
6347 vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
6348   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6349 }
6350
6351 /* vec_vrlw */
6352
6353 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
6354                                                    vector unsigned int __b) {
6355   return __builtin_altivec_vrlw(__a, __b);
6356 }
6357
6358 static __inline__ vector unsigned int __ATTRS_o_ai
6359 vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
6360   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6361 }
6362
6363 /* vec_round */
6364
6365 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
6366 #ifdef __VSX__
6367   return __builtin_vsx_xvrspi(__a);
6368 #else
6369   return __builtin_altivec_vrfin(__a);
6370 #endif
6371 }
6372
6373 #ifdef __VSX__
6374 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
6375   return __builtin_vsx_xvrdpi(__a);
6376 }
6377
6378 /* vec_rint */
6379
6380 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
6381   return __builtin_vsx_xvrspic(__a);
6382 }
6383
6384 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
6385   return __builtin_vsx_xvrdpic(__a);
6386 }
6387
6388 /* vec_nearbyint */
6389
6390 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
6391   return __builtin_vsx_xvrspi(__a);
6392 }
6393
6394 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
6395   return __builtin_vsx_xvrdpi(__a);
6396 }
6397 #endif
6398
6399 /* vec_vrfin */
6400
6401 static __inline__ vector float __attribute__((__always_inline__))
6402 vec_vrfin(vector float __a) {
6403   return __builtin_altivec_vrfin(__a);
6404 }
6405
6406 /* vec_sqrt */
6407
6408 #ifdef __VSX__
6409 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
6410   return __builtin_vsx_xvsqrtsp(__a);
6411 }
6412
6413 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
6414   return __builtin_vsx_xvsqrtdp(__a);
6415 }
6416 #endif
6417
6418 /* vec_rsqrte */
6419
6420 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
6421 #ifdef __VSX__
6422   return __builtin_vsx_xvrsqrtesp(__a);
6423 #else
6424   return __builtin_altivec_vrsqrtefp(__a);
6425 #endif
6426 }
6427
6428 #ifdef __VSX__
6429 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
6430   return __builtin_vsx_xvrsqrtedp(__a);
6431 }
6432 #endif
6433
6434 /* vec_vrsqrtefp */
6435
6436 static __inline__ __vector float __attribute__((__always_inline__))
6437 vec_vrsqrtefp(vector float __a) {
6438   return __builtin_altivec_vrsqrtefp(__a);
6439 }
6440
6441 /* vec_sel */
6442
6443 #define __builtin_altivec_vsel_4si vec_sel
6444
6445 static __inline__ vector signed char __ATTRS_o_ai vec_sel(
6446     vector signed char __a, vector signed char __b, vector unsigned char __c) {
6447   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6448 }
6449
6450 static __inline__ vector signed char __ATTRS_o_ai
6451 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
6452   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6453 }
6454
6455 static __inline__ vector unsigned char __ATTRS_o_ai
6456 vec_sel(vector unsigned char __a, vector unsigned char __b,
6457         vector unsigned char __c) {
6458   return (__a & ~__c) | (__b & __c);
6459 }
6460
6461 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
6462     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
6463   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6464 }
6465
6466 static __inline__ vector bool char __ATTRS_o_ai
6467 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
6468   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6469 }
6470
6471 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6472                                                         vector bool char __b,
6473                                                         vector bool char __c) {
6474   return (__a & ~__c) | (__b & __c);
6475 }
6476
6477 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
6478                                                     vector short __b,
6479                                                     vector unsigned short __c) {
6480   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6481 }
6482
6483 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
6484                                                     vector short __b,
6485                                                     vector bool short __c) {
6486   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6487 }
6488
6489 static __inline__ vector unsigned short __ATTRS_o_ai
6490 vec_sel(vector unsigned short __a, vector unsigned short __b,
6491         vector unsigned short __c) {
6492   return (__a & ~__c) | (__b & __c);
6493 }
6494
6495 static __inline__ vector unsigned short __ATTRS_o_ai
6496 vec_sel(vector unsigned short __a, vector unsigned short __b,
6497         vector bool short __c) {
6498   return (__a & ~(vector unsigned short)__c) |
6499          (__b & (vector unsigned short)__c);
6500 }
6501
6502 static __inline__ vector bool short __ATTRS_o_ai vec_sel(
6503     vector bool short __a, vector bool short __b, vector unsigned short __c) {
6504   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6505 }
6506
6507 static __inline__ vector bool short __ATTRS_o_ai
6508 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
6509   return (__a & ~__c) | (__b & __c);
6510 }
6511
6512 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
6513                                                   vector int __b,
6514                                                   vector unsigned int __c) {
6515   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6516 }
6517
6518 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
6519                                                   vector int __b,
6520                                                   vector bool int __c) {
6521   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6522 }
6523
6524 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
6525     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
6526   return (__a & ~__c) | (__b & __c);
6527 }
6528
6529 static __inline__ vector unsigned int __ATTRS_o_ai
6530 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
6531   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6532 }
6533
6534 static __inline__ vector bool int __ATTRS_o_ai
6535 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
6536   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6537 }
6538
6539 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6540                                                        vector bool int __b,
6541                                                        vector bool int __c) {
6542   return (__a & ~__c) | (__b & __c);
6543 }
6544
6545 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
6546                                                     vector float __b,
6547                                                     vector unsigned int __c) {
6548   vector int __res = ((vector int)__a & ~(vector int)__c) |
6549                      ((vector int)__b & (vector int)__c);
6550   return (vector float)__res;
6551 }
6552
6553 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
6554                                                     vector float __b,
6555                                                     vector bool int __c) {
6556   vector int __res = ((vector int)__a & ~(vector int)__c) |
6557                      ((vector int)__b & (vector int)__c);
6558   return (vector float)__res;
6559 }
6560
6561 #ifdef __VSX__
6562 static __inline__ vector double __ATTRS_o_ai
6563 vec_sel(vector double __a, vector double __b, vector bool long long __c) {
6564   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6565                            ((vector long long)__b & (vector long long)__c);
6566   return (vector double)__res;
6567 }
6568
6569 static __inline__ vector double __ATTRS_o_ai
6570 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
6571   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6572                            ((vector long long)__b & (vector long long)__c);
6573   return (vector double)__res;
6574 }
6575 #endif
6576
6577 /* vec_vsel */
6578
6579 static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
6580     vector signed char __a, vector signed char __b, vector unsigned char __c) {
6581   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6582 }
6583
6584 static __inline__ vector signed char __ATTRS_o_ai
6585 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
6586   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6587 }
6588
6589 static __inline__ vector unsigned char __ATTRS_o_ai
6590 vec_vsel(vector unsigned char __a, vector unsigned char __b,
6591          vector unsigned char __c) {
6592   return (__a & ~__c) | (__b & __c);
6593 }
6594
6595 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
6596     vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
6597   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6598 }
6599
6600 static __inline__ vector bool char __ATTRS_o_ai
6601 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
6602   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6603 }
6604
6605 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6606                                                          vector bool char __b,
6607                                                          vector bool char __c) {
6608   return (__a & ~__c) | (__b & __c);
6609 }
6610
6611 static __inline__ vector short __ATTRS_o_ai
6612 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
6613   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6614 }
6615
6616 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
6617                                                      vector short __b,
6618                                                      vector bool short __c) {
6619   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6620 }
6621
6622 static __inline__ vector unsigned short __ATTRS_o_ai
6623 vec_vsel(vector unsigned short __a, vector unsigned short __b,
6624          vector unsigned short __c) {
6625   return (__a & ~__c) | (__b & __c);
6626 }
6627
6628 static __inline__ vector unsigned short __ATTRS_o_ai
6629 vec_vsel(vector unsigned short __a, vector unsigned short __b,
6630          vector bool short __c) {
6631   return (__a & ~(vector unsigned short)__c) |
6632          (__b & (vector unsigned short)__c);
6633 }
6634
6635 static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
6636     vector bool short __a, vector bool short __b, vector unsigned short __c) {
6637   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6638 }
6639
6640 static __inline__ vector bool short __ATTRS_o_ai
6641 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
6642   return (__a & ~__c) | (__b & __c);
6643 }
6644
6645 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
6646                                                    vector int __b,
6647                                                    vector unsigned int __c) {
6648   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6649 }
6650
6651 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
6652                                                    vector int __b,
6653                                                    vector bool int __c) {
6654   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6655 }
6656
6657 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
6658     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
6659   return (__a & ~__c) | (__b & __c);
6660 }
6661
6662 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
6663     vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
6664   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6665 }
6666
6667 static __inline__ vector bool int __ATTRS_o_ai
6668 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
6669   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6670 }
6671
6672 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6673                                                         vector bool int __b,
6674                                                         vector bool int __c) {
6675   return (__a & ~__c) | (__b & __c);
6676 }
6677
6678 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
6679                                                      vector float __b,
6680                                                      vector unsigned int __c) {
6681   vector int __res = ((vector int)__a & ~(vector int)__c) |
6682                      ((vector int)__b & (vector int)__c);
6683   return (vector float)__res;
6684 }
6685
6686 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
6687                                                      vector float __b,
6688                                                      vector bool int __c) {
6689   vector int __res = ((vector int)__a & ~(vector int)__c) |
6690                      ((vector int)__b & (vector int)__c);
6691   return (vector float)__res;
6692 }
6693
6694 /* vec_sl */
6695
6696 static __inline__ vector signed char __ATTRS_o_ai
6697 vec_sl(vector signed char __a, vector unsigned char __b) {
6698   return __a << (vector signed char)__b;
6699 }
6700
6701 static __inline__ vector unsigned char __ATTRS_o_ai
6702 vec_sl(vector unsigned char __a, vector unsigned char __b) {
6703   return __a << __b;
6704 }
6705
6706 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
6707                                                    vector unsigned short __b) {
6708   return __a << (vector short)__b;
6709 }
6710
6711 static __inline__ vector unsigned short __ATTRS_o_ai
6712 vec_sl(vector unsigned short __a, vector unsigned short __b) {
6713   return __a << __b;
6714 }
6715
6716 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
6717                                                  vector unsigned int __b) {
6718   return __a << (vector int)__b;
6719 }
6720
6721 static __inline__ vector unsigned int __ATTRS_o_ai
6722 vec_sl(vector unsigned int __a, vector unsigned int __b) {
6723   return __a << __b;
6724 }
6725
6726 #ifdef __POWER8_VECTOR__
6727 static __inline__ vector signed long long __ATTRS_o_ai
6728 vec_sl(vector signed long long __a, vector unsigned long long __b) {
6729   return __a << (vector long long)__b;
6730 }
6731
6732 static __inline__ vector unsigned long long __ATTRS_o_ai
6733 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
6734   return __a << __b;
6735 }
6736 #endif
6737
6738 /* vec_vslb */
6739
6740 #define __builtin_altivec_vslb vec_vslb
6741
6742 static __inline__ vector signed char __ATTRS_o_ai
6743 vec_vslb(vector signed char __a, vector unsigned char __b) {
6744   return vec_sl(__a, __b);
6745 }
6746
6747 static __inline__ vector unsigned char __ATTRS_o_ai
6748 vec_vslb(vector unsigned char __a, vector unsigned char __b) {
6749   return vec_sl(__a, __b);
6750 }
6751
6752 /* vec_vslh */
6753
6754 #define __builtin_altivec_vslh vec_vslh
6755
6756 static __inline__ vector short __ATTRS_o_ai
6757 vec_vslh(vector short __a, vector unsigned short __b) {
6758   return vec_sl(__a, __b);
6759 }
6760
6761 static __inline__ vector unsigned short __ATTRS_o_ai
6762 vec_vslh(vector unsigned short __a, vector unsigned short __b) {
6763   return vec_sl(__a, __b);
6764 }
6765
6766 /* vec_vslw */
6767
6768 #define __builtin_altivec_vslw vec_vslw
6769
6770 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
6771                                                    vector unsigned int __b) {
6772   return vec_sl(__a, __b);
6773 }
6774
6775 static __inline__ vector unsigned int __ATTRS_o_ai
6776 vec_vslw(vector unsigned int __a, vector unsigned int __b) {
6777   return vec_sl(__a, __b);
6778 }
6779
6780 /* vec_sld */
6781
6782 #define __builtin_altivec_vsldoi_4si vec_sld
6783
6784 static __inline__ vector signed char __ATTRS_o_ai vec_sld(
6785     vector signed char __a, vector signed char __b, unsigned const int __c) {
6786   unsigned char __d = __c & 0x0F;
6787 #ifdef __LITTLE_ENDIAN__
6788   return vec_perm(
6789       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6790                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6791                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6792                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6793 #else
6794   return vec_perm(
6795       __a, __b,
6796       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6797                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6798                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6799 #endif
6800 }
6801
6802 static __inline__ vector unsigned char __ATTRS_o_ai
6803 vec_sld(vector unsigned char __a, vector unsigned char __b,
6804         unsigned const int __c) {
6805   unsigned char __d = __c & 0x0F;
6806 #ifdef __LITTLE_ENDIAN__
6807   return vec_perm(
6808       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6809                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6810                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6811                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6812 #else
6813   return vec_perm(
6814       __a, __b,
6815       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6816                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6817                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6818 #endif
6819 }
6820
6821 static __inline__ vector bool char __ATTRS_o_ai
6822 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
6823   unsigned char __d = __c & 0x0F;
6824 #ifdef __LITTLE_ENDIAN__
6825   return vec_perm(
6826       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6827                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6828                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6829                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6830 #else
6831   return vec_perm(
6832       __a, __b,
6833       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6834                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6835                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6836 #endif
6837 }
6838
6839 static __inline__ vector signed short __ATTRS_o_ai vec_sld(
6840     vector signed short __a, vector signed short __b, unsigned const int __c) {
6841   unsigned char __d = __c & 0x0F;
6842 #ifdef __LITTLE_ENDIAN__
6843   return vec_perm(
6844       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6845                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6846                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6847                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6848 #else
6849   return vec_perm(
6850       __a, __b,
6851       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6852                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6853                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6854 #endif
6855 }
6856
6857 static __inline__ vector unsigned short __ATTRS_o_ai
6858 vec_sld(vector unsigned short __a, vector unsigned short __b,
6859         unsigned const int __c) {
6860   unsigned char __d = __c & 0x0F;
6861 #ifdef __LITTLE_ENDIAN__
6862   return vec_perm(
6863       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6864                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6865                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6866                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6867 #else
6868   return vec_perm(
6869       __a, __b,
6870       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6871                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6872                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6873 #endif
6874 }
6875
6876 static __inline__ vector bool short __ATTRS_o_ai
6877 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
6878   unsigned char __d = __c & 0x0F;
6879 #ifdef __LITTLE_ENDIAN__
6880   return vec_perm(
6881       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6882                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6883                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6884                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6885 #else
6886   return vec_perm(
6887       __a, __b,
6888       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6889                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6890                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6891 #endif
6892 }
6893
6894 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
6895                                                     vector pixel __b,
6896                                                     unsigned const int __c) {
6897   unsigned char __d = __c & 0x0F;
6898 #ifdef __LITTLE_ENDIAN__
6899   return vec_perm(
6900       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6901                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6902                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6903                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6904 #else
6905   return vec_perm(
6906       __a, __b,
6907       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6908                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6909                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6910 #endif
6911 }
6912
6913 static __inline__ vector signed int __ATTRS_o_ai
6914 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
6915   unsigned char __d = __c & 0x0F;
6916 #ifdef __LITTLE_ENDIAN__
6917   return vec_perm(
6918       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6919                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6920                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6921                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6922 #else
6923   return vec_perm(
6924       __a, __b,
6925       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6926                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6927                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6928 #endif
6929 }
6930
6931 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
6932     vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
6933   unsigned char __d = __c & 0x0F;
6934 #ifdef __LITTLE_ENDIAN__
6935   return vec_perm(
6936       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6937                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6938                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6939                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6940 #else
6941   return vec_perm(
6942       __a, __b,
6943       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6944                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6945                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6946 #endif
6947 }
6948
6949 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
6950                                                        vector bool int __b,
6951                                                        unsigned const int __c) {
6952   unsigned char __d = __c & 0x0F;
6953 #ifdef __LITTLE_ENDIAN__
6954   return vec_perm(
6955       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6956                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6957                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6958                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6959 #else
6960   return vec_perm(
6961       __a, __b,
6962       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6963                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6964                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6965 #endif
6966 }
6967
6968 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
6969                                                     vector float __b,
6970                                                     unsigned const int __c) {
6971   unsigned char __d = __c & 0x0F;
6972 #ifdef __LITTLE_ENDIAN__
6973   return vec_perm(
6974       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6975                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6976                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6977                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6978 #else
6979   return vec_perm(
6980       __a, __b,
6981       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6982                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6983                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6984 #endif
6985 }
6986
6987 /* vec_vsldoi */
6988
6989 static __inline__ vector signed char __ATTRS_o_ai
6990 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
6991   unsigned char __d = __c & 0x0F;
6992 #ifdef __LITTLE_ENDIAN__
6993   return vec_perm(
6994       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
6995                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
6996                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
6997                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
6998 #else
6999   return vec_perm(
7000       __a, __b,
7001       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7002                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7003                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7004 #endif
7005 }
7006
7007 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
7008     vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
7009   unsigned char __d = __c & 0x0F;
7010 #ifdef __LITTLE_ENDIAN__
7011   return vec_perm(
7012       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7013                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7014                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7015                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7016 #else
7017   return vec_perm(
7018       __a, __b,
7019       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7020                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7021                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7022 #endif
7023 }
7024
7025 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
7026                                                        vector short __b,
7027                                                        unsigned char __c) {
7028   unsigned char __d = __c & 0x0F;
7029 #ifdef __LITTLE_ENDIAN__
7030   return vec_perm(
7031       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7032                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7033                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7034                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7035 #else
7036   return vec_perm(
7037       __a, __b,
7038       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7039                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7040                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7041 #endif
7042 }
7043
7044 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
7045     vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
7046   unsigned char __d = __c & 0x0F;
7047 #ifdef __LITTLE_ENDIAN__
7048   return vec_perm(
7049       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7050                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7051                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7052                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7053 #else
7054   return vec_perm(
7055       __a, __b,
7056       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7057                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7058                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7059 #endif
7060 }
7061
7062 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
7063                                                        vector pixel __b,
7064                                                        unsigned char __c) {
7065   unsigned char __d = __c & 0x0F;
7066 #ifdef __LITTLE_ENDIAN__
7067   return vec_perm(
7068       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7069                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7070                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7071                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7072 #else
7073   return vec_perm(
7074       __a, __b,
7075       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7076                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7077                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7078 #endif
7079 }
7080
7081 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
7082                                                      vector int __b,
7083                                                      unsigned char __c) {
7084   unsigned char __d = __c & 0x0F;
7085 #ifdef __LITTLE_ENDIAN__
7086   return vec_perm(
7087       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7088                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7089                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7090                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7091 #else
7092   return vec_perm(
7093       __a, __b,
7094       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7095                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7096                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7097 #endif
7098 }
7099
7100 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
7101     vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
7102   unsigned char __d = __c & 0x0F;
7103 #ifdef __LITTLE_ENDIAN__
7104   return vec_perm(
7105       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7106                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7107                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7108                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7109 #else
7110   return vec_perm(
7111       __a, __b,
7112       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7113                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7114                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7115 #endif
7116 }
7117
7118 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
7119                                                        vector float __b,
7120                                                        unsigned char __c) {
7121   unsigned char __d = __c & 0x0F;
7122 #ifdef __LITTLE_ENDIAN__
7123   return vec_perm(
7124       __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
7125                                        20 - __d, 21 - __d, 22 - __d, 23 - __d,
7126                                        24 - __d, 25 - __d, 26 - __d, 27 - __d,
7127                                        28 - __d, 29 - __d, 30 - __d, 31 - __d));
7128 #else
7129   return vec_perm(
7130       __a, __b,
7131       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7132                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7133                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7134 #endif
7135 }
7136
7137 /* vec_sll */
7138
7139 static __inline__ vector signed char __ATTRS_o_ai
7140 vec_sll(vector signed char __a, vector unsigned char __b) {
7141   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7142                                                    (vector int)__b);
7143 }
7144
7145 static __inline__ vector signed char __ATTRS_o_ai
7146 vec_sll(vector signed char __a, vector unsigned short __b) {
7147   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7148                                                    (vector int)__b);
7149 }
7150
7151 static __inline__ vector signed char __ATTRS_o_ai
7152 vec_sll(vector signed char __a, vector unsigned int __b) {
7153   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7154                                                    (vector int)__b);
7155 }
7156
7157 static __inline__ vector unsigned char __ATTRS_o_ai
7158 vec_sll(vector unsigned char __a, vector unsigned char __b) {
7159   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7160                                                      (vector int)__b);
7161 }
7162
7163 static __inline__ vector unsigned char __ATTRS_o_ai
7164 vec_sll(vector unsigned char __a, vector unsigned short __b) {
7165   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7166                                                      (vector int)__b);
7167 }
7168
7169 static __inline__ vector unsigned char __ATTRS_o_ai
7170 vec_sll(vector unsigned char __a, vector unsigned int __b) {
7171   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7172                                                      (vector int)__b);
7173 }
7174
7175 static __inline__ vector bool char __ATTRS_o_ai
7176 vec_sll(vector bool char __a, vector unsigned char __b) {
7177   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7178                                                  (vector int)__b);
7179 }
7180
7181 static __inline__ vector bool char __ATTRS_o_ai
7182 vec_sll(vector bool char __a, vector unsigned short __b) {
7183   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7184                                                  (vector int)__b);
7185 }
7186
7187 static __inline__ vector bool char __ATTRS_o_ai
7188 vec_sll(vector bool char __a, vector unsigned int __b) {
7189   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7190                                                  (vector int)__b);
7191 }
7192
7193 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7194                                                     vector unsigned char __b) {
7195   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7196 }
7197
7198 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7199                                                     vector unsigned short __b) {
7200   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7201 }
7202
7203 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
7204                                                     vector unsigned int __b) {
7205   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7206 }
7207
7208 static __inline__ vector unsigned short __ATTRS_o_ai
7209 vec_sll(vector unsigned short __a, vector unsigned char __b) {
7210   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7211                                                       (vector int)__b);
7212 }
7213
7214 static __inline__ vector unsigned short __ATTRS_o_ai
7215 vec_sll(vector unsigned short __a, vector unsigned short __b) {
7216   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7217                                                       (vector int)__b);
7218 }
7219
7220 static __inline__ vector unsigned short __ATTRS_o_ai
7221 vec_sll(vector unsigned short __a, vector unsigned int __b) {
7222   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7223                                                       (vector int)__b);
7224 }
7225
7226 static __inline__ vector bool short __ATTRS_o_ai
7227 vec_sll(vector bool short __a, vector unsigned char __b) {
7228   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7229                                                   (vector int)__b);
7230 }
7231
7232 static __inline__ vector bool short __ATTRS_o_ai
7233 vec_sll(vector bool short __a, vector unsigned short __b) {
7234   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7235                                                   (vector int)__b);
7236 }
7237
7238 static __inline__ vector bool short __ATTRS_o_ai
7239 vec_sll(vector bool short __a, vector unsigned int __b) {
7240   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7241                                                   (vector int)__b);
7242 }
7243
7244 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7245                                                     vector unsigned char __b) {
7246   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7247 }
7248
7249 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7250                                                     vector unsigned short __b) {
7251   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7252 }
7253
7254 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7255                                                     vector unsigned int __b) {
7256   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7257 }
7258
7259 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7260                                                   vector unsigned char __b) {
7261   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7262 }
7263
7264 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7265                                                   vector unsigned short __b) {
7266   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7267 }
7268
7269 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
7270                                                   vector unsigned int __b) {
7271   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7272 }
7273
7274 static __inline__ vector unsigned int __ATTRS_o_ai
7275 vec_sll(vector unsigned int __a, vector unsigned char __b) {
7276   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7277                                                     (vector int)__b);
7278 }
7279
7280 static __inline__ vector unsigned int __ATTRS_o_ai
7281 vec_sll(vector unsigned int __a, vector unsigned short __b) {
7282   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7283                                                     (vector int)__b);
7284 }
7285
7286 static __inline__ vector unsigned int __ATTRS_o_ai
7287 vec_sll(vector unsigned int __a, vector unsigned int __b) {
7288   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7289                                                     (vector int)__b);
7290 }
7291
7292 static __inline__ vector bool int __ATTRS_o_ai
7293 vec_sll(vector bool int __a, vector unsigned char __b) {
7294   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7295                                                 (vector int)__b);
7296 }
7297
7298 static __inline__ vector bool int __ATTRS_o_ai
7299 vec_sll(vector bool int __a, vector unsigned short __b) {
7300   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7301                                                 (vector int)__b);
7302 }
7303
7304 static __inline__ vector bool int __ATTRS_o_ai
7305 vec_sll(vector bool int __a, vector unsigned int __b) {
7306   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7307                                                 (vector int)__b);
7308 }
7309
7310 /* vec_vsl */
7311
7312 static __inline__ vector signed char __ATTRS_o_ai
7313 vec_vsl(vector signed char __a, vector unsigned char __b) {
7314   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7315                                                    (vector int)__b);
7316 }
7317
7318 static __inline__ vector signed char __ATTRS_o_ai
7319 vec_vsl(vector signed char __a, vector unsigned short __b) {
7320   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7321                                                    (vector int)__b);
7322 }
7323
7324 static __inline__ vector signed char __ATTRS_o_ai
7325 vec_vsl(vector signed char __a, vector unsigned int __b) {
7326   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7327                                                    (vector int)__b);
7328 }
7329
7330 static __inline__ vector unsigned char __ATTRS_o_ai
7331 vec_vsl(vector unsigned char __a, vector unsigned char __b) {
7332   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7333                                                      (vector int)__b);
7334 }
7335
7336 static __inline__ vector unsigned char __ATTRS_o_ai
7337 vec_vsl(vector unsigned char __a, vector unsigned short __b) {
7338   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7339                                                      (vector int)__b);
7340 }
7341
7342 static __inline__ vector unsigned char __ATTRS_o_ai
7343 vec_vsl(vector unsigned char __a, vector unsigned int __b) {
7344   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7345                                                      (vector int)__b);
7346 }
7347
7348 static __inline__ vector bool char __ATTRS_o_ai
7349 vec_vsl(vector bool char __a, vector unsigned char __b) {
7350   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7351                                                  (vector int)__b);
7352 }
7353
7354 static __inline__ vector bool char __ATTRS_o_ai
7355 vec_vsl(vector bool char __a, vector unsigned short __b) {
7356   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7357                                                  (vector int)__b);
7358 }
7359
7360 static __inline__ vector bool char __ATTRS_o_ai
7361 vec_vsl(vector bool char __a, vector unsigned int __b) {
7362   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7363                                                  (vector int)__b);
7364 }
7365
7366 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7367                                                     vector unsigned char __b) {
7368   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7369 }
7370
7371 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7372                                                     vector unsigned short __b) {
7373   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7374 }
7375
7376 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
7377                                                     vector unsigned int __b) {
7378   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7379 }
7380
7381 static __inline__ vector unsigned short __ATTRS_o_ai
7382 vec_vsl(vector unsigned short __a, vector unsigned char __b) {
7383   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7384                                                       (vector int)__b);
7385 }
7386
7387 static __inline__ vector unsigned short __ATTRS_o_ai
7388 vec_vsl(vector unsigned short __a, vector unsigned short __b) {
7389   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7390                                                       (vector int)__b);
7391 }
7392
7393 static __inline__ vector unsigned short __ATTRS_o_ai
7394 vec_vsl(vector unsigned short __a, vector unsigned int __b) {
7395   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7396                                                       (vector int)__b);
7397 }
7398
7399 static __inline__ vector bool short __ATTRS_o_ai
7400 vec_vsl(vector bool short __a, vector unsigned char __b) {
7401   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7402                                                   (vector int)__b);
7403 }
7404
7405 static __inline__ vector bool short __ATTRS_o_ai
7406 vec_vsl(vector bool short __a, vector unsigned short __b) {
7407   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7408                                                   (vector int)__b);
7409 }
7410
7411 static __inline__ vector bool short __ATTRS_o_ai
7412 vec_vsl(vector bool short __a, vector unsigned int __b) {
7413   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7414                                                   (vector int)__b);
7415 }
7416
7417 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7418                                                     vector unsigned char __b) {
7419   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7420 }
7421
7422 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7423                                                     vector unsigned short __b) {
7424   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7425 }
7426
7427 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7428                                                     vector unsigned int __b) {
7429   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7430 }
7431
7432 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7433                                                   vector unsigned char __b) {
7434   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7435 }
7436
7437 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7438                                                   vector unsigned short __b) {
7439   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7440 }
7441
7442 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
7443                                                   vector unsigned int __b) {
7444   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7445 }
7446
7447 static __inline__ vector unsigned int __ATTRS_o_ai
7448 vec_vsl(vector unsigned int __a, vector unsigned char __b) {
7449   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7450                                                     (vector int)__b);
7451 }
7452
7453 static __inline__ vector unsigned int __ATTRS_o_ai
7454 vec_vsl(vector unsigned int __a, vector unsigned short __b) {
7455   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7456                                                     (vector int)__b);
7457 }
7458
7459 static __inline__ vector unsigned int __ATTRS_o_ai
7460 vec_vsl(vector unsigned int __a, vector unsigned int __b) {
7461   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7462                                                     (vector int)__b);
7463 }
7464
7465 static __inline__ vector bool int __ATTRS_o_ai
7466 vec_vsl(vector bool int __a, vector unsigned char __b) {
7467   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7468                                                 (vector int)__b);
7469 }
7470
7471 static __inline__ vector bool int __ATTRS_o_ai
7472 vec_vsl(vector bool int __a, vector unsigned short __b) {
7473   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7474                                                 (vector int)__b);
7475 }
7476
7477 static __inline__ vector bool int __ATTRS_o_ai
7478 vec_vsl(vector bool int __a, vector unsigned int __b) {
7479   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7480                                                 (vector int)__b);
7481 }
7482
7483 /* vec_slo */
7484
7485 static __inline__ vector signed char __ATTRS_o_ai
7486 vec_slo(vector signed char __a, vector signed char __b) {
7487   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7488                                                     (vector int)__b);
7489 }
7490
7491 static __inline__ vector signed char __ATTRS_o_ai
7492 vec_slo(vector signed char __a, vector unsigned char __b) {
7493   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7494                                                     (vector int)__b);
7495 }
7496
7497 static __inline__ vector unsigned char __ATTRS_o_ai
7498 vec_slo(vector unsigned char __a, vector signed char __b) {
7499   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7500                                                       (vector int)__b);
7501 }
7502
7503 static __inline__ vector unsigned char __ATTRS_o_ai
7504 vec_slo(vector unsigned char __a, vector unsigned char __b) {
7505   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7506                                                       (vector int)__b);
7507 }
7508
7509 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
7510                                                     vector signed char __b) {
7511   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7512 }
7513
7514 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
7515                                                     vector unsigned char __b) {
7516   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7517 }
7518
7519 static __inline__ vector unsigned short __ATTRS_o_ai
7520 vec_slo(vector unsigned short __a, vector signed char __b) {
7521   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7522                                                        (vector int)__b);
7523 }
7524
7525 static __inline__ vector unsigned short __ATTRS_o_ai
7526 vec_slo(vector unsigned short __a, vector unsigned char __b) {
7527   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7528                                                        (vector int)__b);
7529 }
7530
7531 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7532                                                     vector signed char __b) {
7533   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7534 }
7535
7536 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7537                                                     vector unsigned char __b) {
7538   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7539 }
7540
7541 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
7542                                                   vector signed char __b) {
7543   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7544 }
7545
7546 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
7547                                                   vector unsigned char __b) {
7548   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7549 }
7550
7551 static __inline__ vector unsigned int __ATTRS_o_ai
7552 vec_slo(vector unsigned int __a, vector signed char __b) {
7553   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7554                                                      (vector int)__b);
7555 }
7556
7557 static __inline__ vector unsigned int __ATTRS_o_ai
7558 vec_slo(vector unsigned int __a, vector unsigned char __b) {
7559   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7560                                                      (vector int)__b);
7561 }
7562
7563 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
7564                                                     vector signed char __b) {
7565   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7566 }
7567
7568 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
7569                                                     vector unsigned char __b) {
7570   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7571 }
7572
7573 /* vec_vslo */
7574
7575 static __inline__ vector signed char __ATTRS_o_ai
7576 vec_vslo(vector signed char __a, vector signed char __b) {
7577   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7578                                                     (vector int)__b);
7579 }
7580
7581 static __inline__ vector signed char __ATTRS_o_ai
7582 vec_vslo(vector signed char __a, vector unsigned char __b) {
7583   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7584                                                     (vector int)__b);
7585 }
7586
7587 static __inline__ vector unsigned char __ATTRS_o_ai
7588 vec_vslo(vector unsigned char __a, vector signed char __b) {
7589   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7590                                                       (vector int)__b);
7591 }
7592
7593 static __inline__ vector unsigned char __ATTRS_o_ai
7594 vec_vslo(vector unsigned char __a, vector unsigned char __b) {
7595   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7596                                                       (vector int)__b);
7597 }
7598
7599 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
7600                                                      vector signed char __b) {
7601   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7602 }
7603
7604 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
7605                                                      vector unsigned char __b) {
7606   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7607 }
7608
7609 static __inline__ vector unsigned short __ATTRS_o_ai
7610 vec_vslo(vector unsigned short __a, vector signed char __b) {
7611   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7612                                                        (vector int)__b);
7613 }
7614
7615 static __inline__ vector unsigned short __ATTRS_o_ai
7616 vec_vslo(vector unsigned short __a, vector unsigned char __b) {
7617   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7618                                                        (vector int)__b);
7619 }
7620
7621 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7622                                                      vector signed char __b) {
7623   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7624 }
7625
7626 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7627                                                      vector unsigned char __b) {
7628   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7629 }
7630
7631 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
7632                                                    vector signed char __b) {
7633   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7634 }
7635
7636 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
7637                                                    vector unsigned char __b) {
7638   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7639 }
7640
7641 static __inline__ vector unsigned int __ATTRS_o_ai
7642 vec_vslo(vector unsigned int __a, vector signed char __b) {
7643   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7644                                                      (vector int)__b);
7645 }
7646
7647 static __inline__ vector unsigned int __ATTRS_o_ai
7648 vec_vslo(vector unsigned int __a, vector unsigned char __b) {
7649   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7650                                                      (vector int)__b);
7651 }
7652
7653 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
7654                                                      vector signed char __b) {
7655   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7656 }
7657
7658 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
7659                                                      vector unsigned char __b) {
7660   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7661 }
7662
7663 /* vec_splat */
7664
7665 static __inline__ vector signed char __ATTRS_o_ai
7666 vec_splat(vector signed char __a, unsigned const int __b) {
7667   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7668 }
7669
7670 static __inline__ vector unsigned char __ATTRS_o_ai
7671 vec_splat(vector unsigned char __a, unsigned const int __b) {
7672   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7673 }
7674
7675 static __inline__ vector bool char __ATTRS_o_ai
7676 vec_splat(vector bool char __a, unsigned const int __b) {
7677   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7678 }
7679
7680 static __inline__ vector signed short __ATTRS_o_ai
7681 vec_splat(vector signed short __a, unsigned const int __b) {
7682   unsigned char b0 = (__b & 0x07) * 2;
7683   unsigned char b1 = b0 + 1;
7684   return vec_perm(__a, __a,
7685                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7686                                          b0, b1, b0, b1, b0, b1));
7687 }
7688
7689 static __inline__ vector unsigned short __ATTRS_o_ai
7690 vec_splat(vector unsigned short __a, unsigned const int __b) {
7691   unsigned char b0 = (__b & 0x07) * 2;
7692   unsigned char b1 = b0 + 1;
7693   return vec_perm(__a, __a,
7694                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7695                                          b0, b1, b0, b1, b0, b1));
7696 }
7697
7698 static __inline__ vector bool short __ATTRS_o_ai
7699 vec_splat(vector bool short __a, unsigned const int __b) {
7700   unsigned char b0 = (__b & 0x07) * 2;
7701   unsigned char b1 = b0 + 1;
7702   return vec_perm(__a, __a,
7703                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7704                                          b0, b1, b0, b1, b0, b1));
7705 }
7706
7707 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
7708                                                       unsigned const int __b) {
7709   unsigned char b0 = (__b & 0x07) * 2;
7710   unsigned char b1 = b0 + 1;
7711   return vec_perm(__a, __a,
7712                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
7713                                          b0, b1, b0, b1, b0, b1));
7714 }
7715
7716 static __inline__ vector signed int __ATTRS_o_ai
7717 vec_splat(vector signed int __a, unsigned const int __b) {
7718   unsigned char b0 = (__b & 0x03) * 4;
7719   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7720   return vec_perm(__a, __a,
7721                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7722                                          b2, b3, b0, b1, b2, b3));
7723 }
7724
7725 static __inline__ vector unsigned int __ATTRS_o_ai
7726 vec_splat(vector unsigned int __a, unsigned const int __b) {
7727   unsigned char b0 = (__b & 0x03) * 4;
7728   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7729   return vec_perm(__a, __a,
7730                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7731                                          b2, b3, b0, b1, b2, b3));
7732 }
7733
7734 static __inline__ vector bool int __ATTRS_o_ai
7735 vec_splat(vector bool int __a, unsigned const int __b) {
7736   unsigned char b0 = (__b & 0x03) * 4;
7737   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7738   return vec_perm(__a, __a,
7739                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7740                                          b2, b3, b0, b1, b2, b3));
7741 }
7742
7743 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
7744                                                       unsigned const int __b) {
7745   unsigned char b0 = (__b & 0x03) * 4;
7746   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7747   return vec_perm(__a, __a,
7748                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
7749                                          b2, b3, b0, b1, b2, b3));
7750 }
7751
7752 #ifdef __VSX__
7753 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
7754                                                        unsigned const int __b) {
7755   unsigned char b0 = (__b & 0x01) * 8;
7756   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7757                 b6 = b0 + 6, b7 = b0 + 7;
7758   return vec_perm(__a, __a,
7759                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7760                                          b2, b3, b4, b5, b6, b7));
7761 }
7762 static __inline__ vector bool long long __ATTRS_o_ai
7763 vec_splat(vector bool long long __a, unsigned const int __b) {
7764   unsigned char b0 = (__b & 0x01) * 8;
7765   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7766                 b6 = b0 + 6, b7 = b0 + 7;
7767   return vec_perm(__a, __a,
7768                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7769                                          b2, b3, b4, b5, b6, b7));
7770 }
7771 static __inline__ vector signed long long __ATTRS_o_ai
7772 vec_splat(vector signed long long __a, unsigned const int __b) {
7773   unsigned char b0 = (__b & 0x01) * 8;
7774   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7775                 b6 = b0 + 6, b7 = b0 + 7;
7776   return vec_perm(__a, __a,
7777                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7778                                          b2, b3, b4, b5, b6, b7));
7779 }
7780 static __inline__ vector unsigned long long __ATTRS_o_ai
7781 vec_splat(vector unsigned long long __a, unsigned const int __b) {
7782   unsigned char b0 = (__b & 0x01) * 8;
7783   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
7784                 b6 = b0 + 6, b7 = b0 + 7;
7785   return vec_perm(__a, __a,
7786                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
7787                                          b2, b3, b4, b5, b6, b7));
7788 }
7789 #endif
7790
7791 /* vec_vspltb */
7792
7793 #define __builtin_altivec_vspltb vec_vspltb
7794
7795 static __inline__ vector signed char __ATTRS_o_ai
7796 vec_vspltb(vector signed char __a, unsigned char __b) {
7797   return vec_perm(__a, __a, (vector unsigned char)(__b));
7798 }
7799
7800 static __inline__ vector unsigned char __ATTRS_o_ai
7801 vec_vspltb(vector unsigned char __a, unsigned char __b) {
7802   return vec_perm(__a, __a, (vector unsigned char)(__b));
7803 }
7804
7805 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
7806                                                            unsigned char __b) {
7807   return vec_perm(__a, __a, (vector unsigned char)(__b));
7808 }
7809
7810 /* vec_vsplth */
7811
7812 #define __builtin_altivec_vsplth vec_vsplth
7813
7814 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
7815                                                        unsigned char __b) {
7816   __b *= 2;
7817   unsigned char b1 = __b + 1;
7818   return vec_perm(__a, __a,
7819                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7820                                          __b, b1, __b, b1, __b, b1, __b, b1));
7821 }
7822
7823 static __inline__ vector unsigned short __ATTRS_o_ai
7824 vec_vsplth(vector unsigned short __a, unsigned char __b) {
7825   __b *= 2;
7826   unsigned char b1 = __b + 1;
7827   return vec_perm(__a, __a,
7828                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7829                                          __b, b1, __b, b1, __b, b1, __b, b1));
7830 }
7831
7832 static __inline__ vector bool short __ATTRS_o_ai
7833 vec_vsplth(vector bool short __a, unsigned char __b) {
7834   __b *= 2;
7835   unsigned char b1 = __b + 1;
7836   return vec_perm(__a, __a,
7837                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7838                                          __b, b1, __b, b1, __b, b1, __b, b1));
7839 }
7840
7841 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
7842                                                        unsigned char __b) {
7843   __b *= 2;
7844   unsigned char b1 = __b + 1;
7845   return vec_perm(__a, __a,
7846                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7847                                          __b, b1, __b, b1, __b, b1, __b, b1));
7848 }
7849
7850 /* vec_vspltw */
7851
7852 #define __builtin_altivec_vspltw vec_vspltw
7853
7854 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
7855                                                      unsigned char __b) {
7856   __b *= 4;
7857   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7858   return vec_perm(__a, __a,
7859                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7860                                          b1, b2, b3, __b, b1, b2, b3));
7861 }
7862
7863 static __inline__ vector unsigned int __ATTRS_o_ai
7864 vec_vspltw(vector unsigned int __a, unsigned char __b) {
7865   __b *= 4;
7866   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7867   return vec_perm(__a, __a,
7868                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7869                                          b1, b2, b3, __b, b1, b2, b3));
7870 }
7871
7872 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
7873                                                           unsigned char __b) {
7874   __b *= 4;
7875   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7876   return vec_perm(__a, __a,
7877                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7878                                          b1, b2, b3, __b, b1, b2, b3));
7879 }
7880
7881 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
7882                                                        unsigned char __b) {
7883   __b *= 4;
7884   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7885   return vec_perm(__a, __a,
7886                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7887                                          b1, b2, b3, __b, b1, b2, b3));
7888 }
7889
7890 /* vec_splat_s8 */
7891
7892 #define __builtin_altivec_vspltisb vec_splat_s8
7893
7894 // FIXME: parameter should be treated as 5-bit signed literal
7895 static __inline__ vector signed char __ATTRS_o_ai
7896 vec_splat_s8(signed char __a) {
7897   return (vector signed char)(__a);
7898 }
7899
7900 /* vec_vspltisb */
7901
7902 // FIXME: parameter should be treated as 5-bit signed literal
7903 static __inline__ vector signed char __ATTRS_o_ai
7904 vec_vspltisb(signed char __a) {
7905   return (vector signed char)(__a);
7906 }
7907
7908 /* vec_splat_s16 */
7909
7910 #define __builtin_altivec_vspltish vec_splat_s16
7911
7912 // FIXME: parameter should be treated as 5-bit signed literal
7913 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
7914   return (vector short)(__a);
7915 }
7916
7917 /* vec_vspltish */
7918
7919 // FIXME: parameter should be treated as 5-bit signed literal
7920 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
7921   return (vector short)(__a);
7922 }
7923
7924 /* vec_splat_s32 */
7925
7926 #define __builtin_altivec_vspltisw vec_splat_s32
7927
7928 // FIXME: parameter should be treated as 5-bit signed literal
7929 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
7930   return (vector int)(__a);
7931 }
7932
7933 /* vec_vspltisw */
7934
7935 // FIXME: parameter should be treated as 5-bit signed literal
7936 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
7937   return (vector int)(__a);
7938 }
7939
7940 /* vec_splat_u8 */
7941
7942 // FIXME: parameter should be treated as 5-bit signed literal
7943 static __inline__ vector unsigned char __ATTRS_o_ai
7944 vec_splat_u8(unsigned char __a) {
7945   return (vector unsigned char)(__a);
7946 }
7947
7948 /* vec_splat_u16 */
7949
7950 // FIXME: parameter should be treated as 5-bit signed literal
7951 static __inline__ vector unsigned short __ATTRS_o_ai
7952 vec_splat_u16(signed char __a) {
7953   return (vector unsigned short)(__a);
7954 }
7955
7956 /* vec_splat_u32 */
7957
7958 // FIXME: parameter should be treated as 5-bit signed literal
7959 static __inline__ vector unsigned int __ATTRS_o_ai
7960 vec_splat_u32(signed char __a) {
7961   return (vector unsigned int)(__a);
7962 }
7963
7964 /* vec_sr */
7965
7966 static __inline__ vector signed char __ATTRS_o_ai
7967 vec_sr(vector signed char __a, vector unsigned char __b) {
7968   vector unsigned char __res = (vector unsigned char)__a >> __b;
7969   return (vector signed char)__res;
7970 }
7971
7972 static __inline__ vector unsigned char __ATTRS_o_ai
7973 vec_sr(vector unsigned char __a, vector unsigned char __b) {
7974   return __a >> __b;
7975 }
7976
7977 static __inline__ vector signed short __ATTRS_o_ai
7978 vec_sr(vector signed short __a, vector unsigned short __b) {
7979   vector unsigned short __res = (vector unsigned short)__a >> __b;
7980   return (vector signed short)__res;
7981 }
7982
7983 static __inline__ vector unsigned short __ATTRS_o_ai
7984 vec_sr(vector unsigned short __a, vector unsigned short __b) {
7985   return __a >> __b;
7986 }
7987
7988 static __inline__ vector signed int __ATTRS_o_ai
7989 vec_sr(vector signed int __a, vector unsigned int __b) {
7990   vector unsigned int __res = (vector unsigned int)__a >> __b;
7991   return (vector signed int)__res;
7992 }
7993
7994 static __inline__ vector unsigned int __ATTRS_o_ai
7995 vec_sr(vector unsigned int __a, vector unsigned int __b) {
7996   return __a >> __b;
7997 }
7998
7999 #ifdef __POWER8_VECTOR__
8000 static __inline__ vector signed long long __ATTRS_o_ai
8001 vec_sr(vector signed long long __a, vector unsigned long long __b) {
8002   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
8003   return (vector signed long long)__res;
8004 }
8005
8006 static __inline__ vector unsigned long long __ATTRS_o_ai
8007 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
8008   return __a >> __b;
8009 }
8010 #endif
8011
8012 /* vec_vsrb */
8013
8014 #define __builtin_altivec_vsrb vec_vsrb
8015
8016 static __inline__ vector signed char __ATTRS_o_ai
8017 vec_vsrb(vector signed char __a, vector unsigned char __b) {
8018   return __a >> (vector signed char)__b;
8019 }
8020
8021 static __inline__ vector unsigned char __ATTRS_o_ai
8022 vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
8023   return __a >> __b;
8024 }
8025
8026 /* vec_vsrh */
8027
8028 #define __builtin_altivec_vsrh vec_vsrh
8029
8030 static __inline__ vector short __ATTRS_o_ai
8031 vec_vsrh(vector short __a, vector unsigned short __b) {
8032   return __a >> (vector short)__b;
8033 }
8034
8035 static __inline__ vector unsigned short __ATTRS_o_ai
8036 vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
8037   return __a >> __b;
8038 }
8039
8040 /* vec_vsrw */
8041
8042 #define __builtin_altivec_vsrw vec_vsrw
8043
8044 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
8045                                                    vector unsigned int __b) {
8046   return __a >> (vector int)__b;
8047 }
8048
8049 static __inline__ vector unsigned int __ATTRS_o_ai
8050 vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
8051   return __a >> __b;
8052 }
8053
8054 /* vec_sra */
8055
8056 static __inline__ vector signed char __ATTRS_o_ai
8057 vec_sra(vector signed char __a, vector unsigned char __b) {
8058   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8059 }
8060
8061 static __inline__ vector unsigned char __ATTRS_o_ai
8062 vec_sra(vector unsigned char __a, vector unsigned char __b) {
8063   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8064 }
8065
8066 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
8067                                                     vector unsigned short __b) {
8068   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8069 }
8070
8071 static __inline__ vector unsigned short __ATTRS_o_ai
8072 vec_sra(vector unsigned short __a, vector unsigned short __b) {
8073   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8074 }
8075
8076 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
8077                                                   vector unsigned int __b) {
8078   return __builtin_altivec_vsraw(__a, __b);
8079 }
8080
8081 static __inline__ vector unsigned int __ATTRS_o_ai
8082 vec_sra(vector unsigned int __a, vector unsigned int __b) {
8083   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8084 }
8085
8086 #ifdef __POWER8_VECTOR__
8087 static __inline__ vector signed long long __ATTRS_o_ai
8088 vec_sra(vector signed long long __a, vector unsigned long long __b) {
8089   return __a >> __b;
8090 }
8091
8092 static __inline__ vector unsigned long long __ATTRS_o_ai
8093 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
8094   return (vector unsigned long long)((vector signed long long)__a >> __b);
8095 }
8096 #endif
8097
8098 /* vec_vsrab */
8099
8100 static __inline__ vector signed char __ATTRS_o_ai
8101 vec_vsrab(vector signed char __a, vector unsigned char __b) {
8102   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8103 }
8104
8105 static __inline__ vector unsigned char __ATTRS_o_ai
8106 vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
8107   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8108 }
8109
8110 /* vec_vsrah */
8111
8112 static __inline__ vector short __ATTRS_o_ai
8113 vec_vsrah(vector short __a, vector unsigned short __b) {
8114   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8115 }
8116
8117 static __inline__ vector unsigned short __ATTRS_o_ai
8118 vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
8119   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8120 }
8121
8122 /* vec_vsraw */
8123
8124 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
8125                                                     vector unsigned int __b) {
8126   return __builtin_altivec_vsraw(__a, __b);
8127 }
8128
8129 static __inline__ vector unsigned int __ATTRS_o_ai
8130 vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
8131   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8132 }
8133
8134 /* vec_srl */
8135
8136 static __inline__ vector signed char __ATTRS_o_ai
8137 vec_srl(vector signed char __a, vector unsigned char __b) {
8138   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8139                                                    (vector int)__b);
8140 }
8141
8142 static __inline__ vector signed char __ATTRS_o_ai
8143 vec_srl(vector signed char __a, vector unsigned short __b) {
8144   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8145                                                    (vector int)__b);
8146 }
8147
8148 static __inline__ vector signed char __ATTRS_o_ai
8149 vec_srl(vector signed char __a, vector unsigned int __b) {
8150   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8151                                                    (vector int)__b);
8152 }
8153
8154 static __inline__ vector unsigned char __ATTRS_o_ai
8155 vec_srl(vector unsigned char __a, vector unsigned char __b) {
8156   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8157                                                      (vector int)__b);
8158 }
8159
8160 static __inline__ vector unsigned char __ATTRS_o_ai
8161 vec_srl(vector unsigned char __a, vector unsigned short __b) {
8162   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8163                                                      (vector int)__b);
8164 }
8165
8166 static __inline__ vector unsigned char __ATTRS_o_ai
8167 vec_srl(vector unsigned char __a, vector unsigned int __b) {
8168   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8169                                                      (vector int)__b);
8170 }
8171
8172 static __inline__ vector bool char __ATTRS_o_ai
8173 vec_srl(vector bool char __a, vector unsigned char __b) {
8174   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8175                                                  (vector int)__b);
8176 }
8177
8178 static __inline__ vector bool char __ATTRS_o_ai
8179 vec_srl(vector bool char __a, vector unsigned short __b) {
8180   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8181                                                  (vector int)__b);
8182 }
8183
8184 static __inline__ vector bool char __ATTRS_o_ai
8185 vec_srl(vector bool char __a, vector unsigned int __b) {
8186   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8187                                                  (vector int)__b);
8188 }
8189
8190 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8191                                                     vector unsigned char __b) {
8192   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8193 }
8194
8195 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8196                                                     vector unsigned short __b) {
8197   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8198 }
8199
8200 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
8201                                                     vector unsigned int __b) {
8202   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8203 }
8204
8205 static __inline__ vector unsigned short __ATTRS_o_ai
8206 vec_srl(vector unsigned short __a, vector unsigned char __b) {
8207   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8208                                                       (vector int)__b);
8209 }
8210
8211 static __inline__ vector unsigned short __ATTRS_o_ai
8212 vec_srl(vector unsigned short __a, vector unsigned short __b) {
8213   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8214                                                       (vector int)__b);
8215 }
8216
8217 static __inline__ vector unsigned short __ATTRS_o_ai
8218 vec_srl(vector unsigned short __a, vector unsigned int __b) {
8219   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8220                                                       (vector int)__b);
8221 }
8222
8223 static __inline__ vector bool short __ATTRS_o_ai
8224 vec_srl(vector bool short __a, vector unsigned char __b) {
8225   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8226                                                   (vector int)__b);
8227 }
8228
8229 static __inline__ vector bool short __ATTRS_o_ai
8230 vec_srl(vector bool short __a, vector unsigned short __b) {
8231   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8232                                                   (vector int)__b);
8233 }
8234
8235 static __inline__ vector bool short __ATTRS_o_ai
8236 vec_srl(vector bool short __a, vector unsigned int __b) {
8237   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8238                                                   (vector int)__b);
8239 }
8240
8241 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8242                                                     vector unsigned char __b) {
8243   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8244 }
8245
8246 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8247                                                     vector unsigned short __b) {
8248   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8249 }
8250
8251 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8252                                                     vector unsigned int __b) {
8253   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8254 }
8255
8256 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8257                                                   vector unsigned char __b) {
8258   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8259 }
8260
8261 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8262                                                   vector unsigned short __b) {
8263   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8264 }
8265
8266 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
8267                                                   vector unsigned int __b) {
8268   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8269 }
8270
8271 static __inline__ vector unsigned int __ATTRS_o_ai
8272 vec_srl(vector unsigned int __a, vector unsigned char __b) {
8273   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8274                                                     (vector int)__b);
8275 }
8276
8277 static __inline__ vector unsigned int __ATTRS_o_ai
8278 vec_srl(vector unsigned int __a, vector unsigned short __b) {
8279   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8280                                                     (vector int)__b);
8281 }
8282
8283 static __inline__ vector unsigned int __ATTRS_o_ai
8284 vec_srl(vector unsigned int __a, vector unsigned int __b) {
8285   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8286                                                     (vector int)__b);
8287 }
8288
8289 static __inline__ vector bool int __ATTRS_o_ai
8290 vec_srl(vector bool int __a, vector unsigned char __b) {
8291   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8292                                                 (vector int)__b);
8293 }
8294
8295 static __inline__ vector bool int __ATTRS_o_ai
8296 vec_srl(vector bool int __a, vector unsigned short __b) {
8297   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8298                                                 (vector int)__b);
8299 }
8300
8301 static __inline__ vector bool int __ATTRS_o_ai
8302 vec_srl(vector bool int __a, vector unsigned int __b) {
8303   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8304                                                 (vector int)__b);
8305 }
8306
8307 /* vec_vsr */
8308
8309 static __inline__ vector signed char __ATTRS_o_ai
8310 vec_vsr(vector signed char __a, vector unsigned char __b) {
8311   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8312                                                    (vector int)__b);
8313 }
8314
8315 static __inline__ vector signed char __ATTRS_o_ai
8316 vec_vsr(vector signed char __a, vector unsigned short __b) {
8317   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8318                                                    (vector int)__b);
8319 }
8320
8321 static __inline__ vector signed char __ATTRS_o_ai
8322 vec_vsr(vector signed char __a, vector unsigned int __b) {
8323   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8324                                                    (vector int)__b);
8325 }
8326
8327 static __inline__ vector unsigned char __ATTRS_o_ai
8328 vec_vsr(vector unsigned char __a, vector unsigned char __b) {
8329   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8330                                                      (vector int)__b);
8331 }
8332
8333 static __inline__ vector unsigned char __ATTRS_o_ai
8334 vec_vsr(vector unsigned char __a, vector unsigned short __b) {
8335   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8336                                                      (vector int)__b);
8337 }
8338
8339 static __inline__ vector unsigned char __ATTRS_o_ai
8340 vec_vsr(vector unsigned char __a, vector unsigned int __b) {
8341   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8342                                                      (vector int)__b);
8343 }
8344
8345 static __inline__ vector bool char __ATTRS_o_ai
8346 vec_vsr(vector bool char __a, vector unsigned char __b) {
8347   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8348                                                  (vector int)__b);
8349 }
8350
8351 static __inline__ vector bool char __ATTRS_o_ai
8352 vec_vsr(vector bool char __a, vector unsigned short __b) {
8353   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8354                                                  (vector int)__b);
8355 }
8356
8357 static __inline__ vector bool char __ATTRS_o_ai
8358 vec_vsr(vector bool char __a, vector unsigned int __b) {
8359   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8360                                                  (vector int)__b);
8361 }
8362
8363 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8364                                                     vector unsigned char __b) {
8365   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8366 }
8367
8368 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8369                                                     vector unsigned short __b) {
8370   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8371 }
8372
8373 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
8374                                                     vector unsigned int __b) {
8375   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8376 }
8377
8378 static __inline__ vector unsigned short __ATTRS_o_ai
8379 vec_vsr(vector unsigned short __a, vector unsigned char __b) {
8380   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8381                                                       (vector int)__b);
8382 }
8383
8384 static __inline__ vector unsigned short __ATTRS_o_ai
8385 vec_vsr(vector unsigned short __a, vector unsigned short __b) {
8386   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8387                                                       (vector int)__b);
8388 }
8389
8390 static __inline__ vector unsigned short __ATTRS_o_ai
8391 vec_vsr(vector unsigned short __a, vector unsigned int __b) {
8392   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8393                                                       (vector int)__b);
8394 }
8395
8396 static __inline__ vector bool short __ATTRS_o_ai
8397 vec_vsr(vector bool short __a, vector unsigned char __b) {
8398   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8399                                                   (vector int)__b);
8400 }
8401
8402 static __inline__ vector bool short __ATTRS_o_ai
8403 vec_vsr(vector bool short __a, vector unsigned short __b) {
8404   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8405                                                   (vector int)__b);
8406 }
8407
8408 static __inline__ vector bool short __ATTRS_o_ai
8409 vec_vsr(vector bool short __a, vector unsigned int __b) {
8410   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8411                                                   (vector int)__b);
8412 }
8413
8414 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8415                                                     vector unsigned char __b) {
8416   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8417 }
8418
8419 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8420                                                     vector unsigned short __b) {
8421   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8422 }
8423
8424 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8425                                                     vector unsigned int __b) {
8426   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8427 }
8428
8429 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8430                                                   vector unsigned char __b) {
8431   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8432 }
8433
8434 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8435                                                   vector unsigned short __b) {
8436   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8437 }
8438
8439 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
8440                                                   vector unsigned int __b) {
8441   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8442 }
8443
8444 static __inline__ vector unsigned int __ATTRS_o_ai
8445 vec_vsr(vector unsigned int __a, vector unsigned char __b) {
8446   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8447                                                     (vector int)__b);
8448 }
8449
8450 static __inline__ vector unsigned int __ATTRS_o_ai
8451 vec_vsr(vector unsigned int __a, vector unsigned short __b) {
8452   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8453                                                     (vector int)__b);
8454 }
8455
8456 static __inline__ vector unsigned int __ATTRS_o_ai
8457 vec_vsr(vector unsigned int __a, vector unsigned int __b) {
8458   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8459                                                     (vector int)__b);
8460 }
8461
8462 static __inline__ vector bool int __ATTRS_o_ai
8463 vec_vsr(vector bool int __a, vector unsigned char __b) {
8464   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8465                                                 (vector int)__b);
8466 }
8467
8468 static __inline__ vector bool int __ATTRS_o_ai
8469 vec_vsr(vector bool int __a, vector unsigned short __b) {
8470   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8471                                                 (vector int)__b);
8472 }
8473
8474 static __inline__ vector bool int __ATTRS_o_ai
8475 vec_vsr(vector bool int __a, vector unsigned int __b) {
8476   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8477                                                 (vector int)__b);
8478 }
8479
8480 /* vec_sro */
8481
8482 static __inline__ vector signed char __ATTRS_o_ai
8483 vec_sro(vector signed char __a, vector signed char __b) {
8484   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8485                                                     (vector int)__b);
8486 }
8487
8488 static __inline__ vector signed char __ATTRS_o_ai
8489 vec_sro(vector signed char __a, vector unsigned char __b) {
8490   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8491                                                     (vector int)__b);
8492 }
8493
8494 static __inline__ vector unsigned char __ATTRS_o_ai
8495 vec_sro(vector unsigned char __a, vector signed char __b) {
8496   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8497                                                       (vector int)__b);
8498 }
8499
8500 static __inline__ vector unsigned char __ATTRS_o_ai
8501 vec_sro(vector unsigned char __a, vector unsigned char __b) {
8502   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8503                                                       (vector int)__b);
8504 }
8505
8506 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
8507                                                     vector signed char __b) {
8508   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8509 }
8510
8511 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
8512                                                     vector unsigned char __b) {
8513   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8514 }
8515
8516 static __inline__ vector unsigned short __ATTRS_o_ai
8517 vec_sro(vector unsigned short __a, vector signed char __b) {
8518   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8519                                                        (vector int)__b);
8520 }
8521
8522 static __inline__ vector unsigned short __ATTRS_o_ai
8523 vec_sro(vector unsigned short __a, vector unsigned char __b) {
8524   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8525                                                        (vector int)__b);
8526 }
8527
8528 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8529                                                     vector signed char __b) {
8530   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8531 }
8532
8533 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8534                                                     vector unsigned char __b) {
8535   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8536 }
8537
8538 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
8539                                                   vector signed char __b) {
8540   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8541 }
8542
8543 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
8544                                                   vector unsigned char __b) {
8545   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8546 }
8547
8548 static __inline__ vector unsigned int __ATTRS_o_ai
8549 vec_sro(vector unsigned int __a, vector signed char __b) {
8550   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8551                                                      (vector int)__b);
8552 }
8553
8554 static __inline__ vector unsigned int __ATTRS_o_ai
8555 vec_sro(vector unsigned int __a, vector unsigned char __b) {
8556   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8557                                                      (vector int)__b);
8558 }
8559
8560 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
8561                                                     vector signed char __b) {
8562   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8563 }
8564
8565 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
8566                                                     vector unsigned char __b) {
8567   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8568 }
8569
8570 /* vec_vsro */
8571
8572 static __inline__ vector signed char __ATTRS_o_ai
8573 vec_vsro(vector signed char __a, vector signed char __b) {
8574   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8575                                                     (vector int)__b);
8576 }
8577
8578 static __inline__ vector signed char __ATTRS_o_ai
8579 vec_vsro(vector signed char __a, vector unsigned char __b) {
8580   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8581                                                     (vector int)__b);
8582 }
8583
8584 static __inline__ vector unsigned char __ATTRS_o_ai
8585 vec_vsro(vector unsigned char __a, vector signed char __b) {
8586   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8587                                                       (vector int)__b);
8588 }
8589
8590 static __inline__ vector unsigned char __ATTRS_o_ai
8591 vec_vsro(vector unsigned char __a, vector unsigned char __b) {
8592   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8593                                                       (vector int)__b);
8594 }
8595
8596 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
8597                                                      vector signed char __b) {
8598   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8599 }
8600
8601 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
8602                                                      vector unsigned char __b) {
8603   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8604 }
8605
8606 static __inline__ vector unsigned short __ATTRS_o_ai
8607 vec_vsro(vector unsigned short __a, vector signed char __b) {
8608   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8609                                                        (vector int)__b);
8610 }
8611
8612 static __inline__ vector unsigned short __ATTRS_o_ai
8613 vec_vsro(vector unsigned short __a, vector unsigned char __b) {
8614   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8615                                                        (vector int)__b);
8616 }
8617
8618 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8619                                                      vector signed char __b) {
8620   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8621 }
8622
8623 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8624                                                      vector unsigned char __b) {
8625   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8626 }
8627
8628 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
8629                                                    vector signed char __b) {
8630   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8631 }
8632
8633 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
8634                                                    vector unsigned char __b) {
8635   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8636 }
8637
8638 static __inline__ vector unsigned int __ATTRS_o_ai
8639 vec_vsro(vector unsigned int __a, vector signed char __b) {
8640   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8641                                                      (vector int)__b);
8642 }
8643
8644 static __inline__ vector unsigned int __ATTRS_o_ai
8645 vec_vsro(vector unsigned int __a, vector unsigned char __b) {
8646   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8647                                                      (vector int)__b);
8648 }
8649
8650 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
8651                                                      vector signed char __b) {
8652   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8653 }
8654
8655 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
8656                                                      vector unsigned char __b) {
8657   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8658 }
8659
8660 /* vec_st */
8661
8662 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8663                                            vector signed char *__c) {
8664   __builtin_altivec_stvx((vector int)__a, __b, __c);
8665 }
8666
8667 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8668                                            signed char *__c) {
8669   __builtin_altivec_stvx((vector int)__a, __b, __c);
8670 }
8671
8672 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8673                                            vector unsigned char *__c) {
8674   __builtin_altivec_stvx((vector int)__a, __b, __c);
8675 }
8676
8677 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8678                                            unsigned char *__c) {
8679   __builtin_altivec_stvx((vector int)__a, __b, __c);
8680 }
8681
8682 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8683                                            signed char *__c) {
8684   __builtin_altivec_stvx((vector int)__a, __b, __c);
8685 }
8686
8687 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8688                                            unsigned char *__c) {
8689   __builtin_altivec_stvx((vector int)__a, __b, __c);
8690 }
8691
8692 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8693                                            vector bool char *__c) {
8694   __builtin_altivec_stvx((vector int)__a, __b, __c);
8695 }
8696
8697 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
8698                                            vector short *__c) {
8699   __builtin_altivec_stvx((vector int)__a, __b, __c);
8700 }
8701
8702 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
8703                                            short *__c) {
8704   __builtin_altivec_stvx((vector int)__a, __b, __c);
8705 }
8706
8707 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8708                                            vector unsigned short *__c) {
8709   __builtin_altivec_stvx((vector int)__a, __b, __c);
8710 }
8711
8712 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8713                                            unsigned short *__c) {
8714   __builtin_altivec_stvx((vector int)__a, __b, __c);
8715 }
8716
8717 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8718                                            short *__c) {
8719   __builtin_altivec_stvx((vector int)__a, __b, __c);
8720 }
8721
8722 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8723                                            unsigned short *__c) {
8724   __builtin_altivec_stvx((vector int)__a, __b, __c);
8725 }
8726
8727 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8728                                            vector bool short *__c) {
8729   __builtin_altivec_stvx((vector int)__a, __b, __c);
8730 }
8731
8732 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8733                                            short *__c) {
8734   __builtin_altivec_stvx((vector int)__a, __b, __c);
8735 }
8736
8737 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8738                                            unsigned short *__c) {
8739   __builtin_altivec_stvx((vector int)__a, __b, __c);
8740 }
8741
8742 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8743                                            vector pixel *__c) {
8744   __builtin_altivec_stvx((vector int)__a, __b, __c);
8745 }
8746
8747 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
8748                                            vector int *__c) {
8749   __builtin_altivec_stvx(__a, __b, __c);
8750 }
8751
8752 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
8753   __builtin_altivec_stvx(__a, __b, __c);
8754 }
8755
8756 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8757                                            vector unsigned int *__c) {
8758   __builtin_altivec_stvx((vector int)__a, __b, __c);
8759 }
8760
8761 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8762                                            unsigned int *__c) {
8763   __builtin_altivec_stvx((vector int)__a, __b, __c);
8764 }
8765
8766 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8767                                            int *__c) {
8768   __builtin_altivec_stvx((vector int)__a, __b, __c);
8769 }
8770
8771 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8772                                            unsigned int *__c) {
8773   __builtin_altivec_stvx((vector int)__a, __b, __c);
8774 }
8775
8776 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8777                                            vector bool int *__c) {
8778   __builtin_altivec_stvx((vector int)__a, __b, __c);
8779 }
8780
8781 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
8782                                            vector float *__c) {
8783   __builtin_altivec_stvx((vector int)__a, __b, __c);
8784 }
8785
8786 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
8787                                            float *__c) {
8788   __builtin_altivec_stvx((vector int)__a, __b, __c);
8789 }
8790
8791 /* vec_stvx */
8792
8793 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8794                                              vector signed char *__c) {
8795   __builtin_altivec_stvx((vector int)__a, __b, __c);
8796 }
8797
8798 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8799                                              signed char *__c) {
8800   __builtin_altivec_stvx((vector int)__a, __b, __c);
8801 }
8802
8803 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8804                                              vector unsigned char *__c) {
8805   __builtin_altivec_stvx((vector int)__a, __b, __c);
8806 }
8807
8808 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8809                                              unsigned char *__c) {
8810   __builtin_altivec_stvx((vector int)__a, __b, __c);
8811 }
8812
8813 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8814                                              signed char *__c) {
8815   __builtin_altivec_stvx((vector int)__a, __b, __c);
8816 }
8817
8818 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8819                                              unsigned char *__c) {
8820   __builtin_altivec_stvx((vector int)__a, __b, __c);
8821 }
8822
8823 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8824                                              vector bool char *__c) {
8825   __builtin_altivec_stvx((vector int)__a, __b, __c);
8826 }
8827
8828 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8829                                              vector short *__c) {
8830   __builtin_altivec_stvx((vector int)__a, __b, __c);
8831 }
8832
8833 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8834                                              short *__c) {
8835   __builtin_altivec_stvx((vector int)__a, __b, __c);
8836 }
8837
8838 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8839                                              vector unsigned short *__c) {
8840   __builtin_altivec_stvx((vector int)__a, __b, __c);
8841 }
8842
8843 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8844                                              unsigned short *__c) {
8845   __builtin_altivec_stvx((vector int)__a, __b, __c);
8846 }
8847
8848 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8849                                              short *__c) {
8850   __builtin_altivec_stvx((vector int)__a, __b, __c);
8851 }
8852
8853 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8854                                              unsigned short *__c) {
8855   __builtin_altivec_stvx((vector int)__a, __b, __c);
8856 }
8857
8858 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8859                                              vector bool short *__c) {
8860   __builtin_altivec_stvx((vector int)__a, __b, __c);
8861 }
8862
8863 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8864                                              short *__c) {
8865   __builtin_altivec_stvx((vector int)__a, __b, __c);
8866 }
8867
8868 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8869                                              unsigned short *__c) {
8870   __builtin_altivec_stvx((vector int)__a, __b, __c);
8871 }
8872
8873 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8874                                              vector pixel *__c) {
8875   __builtin_altivec_stvx((vector int)__a, __b, __c);
8876 }
8877
8878 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
8879                                              vector int *__c) {
8880   __builtin_altivec_stvx(__a, __b, __c);
8881 }
8882
8883 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
8884                                              int *__c) {
8885   __builtin_altivec_stvx(__a, __b, __c);
8886 }
8887
8888 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8889                                              vector unsigned int *__c) {
8890   __builtin_altivec_stvx((vector int)__a, __b, __c);
8891 }
8892
8893 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8894                                              unsigned int *__c) {
8895   __builtin_altivec_stvx((vector int)__a, __b, __c);
8896 }
8897
8898 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8899                                              int *__c) {
8900   __builtin_altivec_stvx((vector int)__a, __b, __c);
8901 }
8902
8903 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8904                                              unsigned int *__c) {
8905   __builtin_altivec_stvx((vector int)__a, __b, __c);
8906 }
8907
8908 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8909                                              vector bool int *__c) {
8910   __builtin_altivec_stvx((vector int)__a, __b, __c);
8911 }
8912
8913 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8914                                              vector float *__c) {
8915   __builtin_altivec_stvx((vector int)__a, __b, __c);
8916 }
8917
8918 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8919                                              float *__c) {
8920   __builtin_altivec_stvx((vector int)__a, __b, __c);
8921 }
8922
8923 /* vec_ste */
8924
8925 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
8926                                             signed char *__c) {
8927   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8928 }
8929
8930 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
8931                                             unsigned char *__c) {
8932   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8933 }
8934
8935 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8936                                             signed char *__c) {
8937   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8938 }
8939
8940 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8941                                             unsigned char *__c) {
8942   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8943 }
8944
8945 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
8946                                             short *__c) {
8947   __builtin_altivec_stvehx(__a, __b, __c);
8948 }
8949
8950 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
8951                                             unsigned short *__c) {
8952   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8953 }
8954
8955 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8956                                             short *__c) {
8957   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8958 }
8959
8960 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8961                                             unsigned short *__c) {
8962   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8963 }
8964
8965 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8966                                             short *__c) {
8967   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8968 }
8969
8970 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8971                                             unsigned short *__c) {
8972   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8973 }
8974
8975 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
8976   __builtin_altivec_stvewx(__a, __b, __c);
8977 }
8978
8979 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
8980                                             unsigned int *__c) {
8981   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8982 }
8983
8984 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8985                                             int *__c) {
8986   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8987 }
8988
8989 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8990                                             unsigned int *__c) {
8991   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8992 }
8993
8994 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
8995                                             float *__c) {
8996   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8997 }
8998
8999 /* vec_stvebx */
9000
9001 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
9002                                                signed char *__c) {
9003   __builtin_altivec_stvebx((vector char)__a, __b, __c);
9004 }
9005
9006 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
9007                                                int __b, unsigned char *__c) {
9008   __builtin_altivec_stvebx((vector char)__a, __b, __c);
9009 }
9010
9011 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9012                                                signed char *__c) {
9013   __builtin_altivec_stvebx((vector char)__a, __b, __c);
9014 }
9015
9016 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
9017                                                unsigned char *__c) {
9018   __builtin_altivec_stvebx((vector char)__a, __b, __c);
9019 }
9020
9021 /* vec_stvehx */
9022
9023 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
9024                                                short *__c) {
9025   __builtin_altivec_stvehx(__a, __b, __c);
9026 }
9027
9028 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
9029                                                int __b, unsigned short *__c) {
9030   __builtin_altivec_stvehx((vector short)__a, __b, __c);
9031 }
9032
9033 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9034                                                short *__c) {
9035   __builtin_altivec_stvehx((vector short)__a, __b, __c);
9036 }
9037
9038 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
9039                                                unsigned short *__c) {
9040   __builtin_altivec_stvehx((vector short)__a, __b, __c);
9041 }
9042
9043 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9044                                                short *__c) {
9045   __builtin_altivec_stvehx((vector short)__a, __b, __c);
9046 }
9047
9048 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
9049                                                unsigned short *__c) {
9050   __builtin_altivec_stvehx((vector short)__a, __b, __c);
9051 }
9052
9053 /* vec_stvewx */
9054
9055 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
9056                                                int *__c) {
9057   __builtin_altivec_stvewx(__a, __b, __c);
9058 }
9059
9060 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
9061                                                unsigned int *__c) {
9062   __builtin_altivec_stvewx((vector int)__a, __b, __c);
9063 }
9064
9065 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
9066                                                int *__c) {
9067   __builtin_altivec_stvewx((vector int)__a, __b, __c);
9068 }
9069
9070 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
9071                                                unsigned int *__c) {
9072   __builtin_altivec_stvewx((vector int)__a, __b, __c);
9073 }
9074
9075 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
9076                                                float *__c) {
9077   __builtin_altivec_stvewx((vector int)__a, __b, __c);
9078 }
9079
9080 /* vec_stl */
9081
9082 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
9083                                             vector signed char *__c) {
9084   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9085 }
9086
9087 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
9088                                             signed char *__c) {
9089   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9090 }
9091
9092 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
9093                                             vector unsigned char *__c) {
9094   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9095 }
9096
9097 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
9098                                             unsigned char *__c) {
9099   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9100 }
9101
9102 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9103                                             signed char *__c) {
9104   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9105 }
9106
9107 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9108                                             unsigned char *__c) {
9109   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9110 }
9111
9112 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9113                                             vector bool char *__c) {
9114   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9115 }
9116
9117 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
9118                                             vector short *__c) {
9119   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9120 }
9121
9122 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
9123                                             short *__c) {
9124   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9125 }
9126
9127 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9128                                             vector unsigned short *__c) {
9129   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9130 }
9131
9132 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9133                                             unsigned short *__c) {
9134   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9135 }
9136
9137 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9138                                             short *__c) {
9139   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9140 }
9141
9142 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9143                                             unsigned short *__c) {
9144   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9145 }
9146
9147 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9148                                             vector bool short *__c) {
9149   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9150 }
9151
9152 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9153                                             short *__c) {
9154   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9155 }
9156
9157 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9158                                             unsigned short *__c) {
9159   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9160 }
9161
9162 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9163                                             vector pixel *__c) {
9164   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9165 }
9166
9167 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
9168                                             vector int *__c) {
9169   __builtin_altivec_stvxl(__a, __b, __c);
9170 }
9171
9172 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
9173   __builtin_altivec_stvxl(__a, __b, __c);
9174 }
9175
9176 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9177                                             vector unsigned int *__c) {
9178   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9179 }
9180
9181 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9182                                             unsigned int *__c) {
9183   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9184 }
9185
9186 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9187                                             int *__c) {
9188   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9189 }
9190
9191 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9192                                             unsigned int *__c) {
9193   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9194 }
9195
9196 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9197                                             vector bool int *__c) {
9198   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9199 }
9200
9201 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
9202                                             vector float *__c) {
9203   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9204 }
9205
9206 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
9207                                             float *__c) {
9208   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9209 }
9210
9211 /* vec_stvxl */
9212
9213 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9214                                               vector signed char *__c) {
9215   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9216 }
9217
9218 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9219                                               signed char *__c) {
9220   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9221 }
9222
9223 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9224                                               vector unsigned char *__c) {
9225   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9226 }
9227
9228 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9229                                               unsigned char *__c) {
9230   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9231 }
9232
9233 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9234                                               signed char *__c) {
9235   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9236 }
9237
9238 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9239                                               unsigned char *__c) {
9240   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9241 }
9242
9243 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9244                                               vector bool char *__c) {
9245   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9246 }
9247
9248 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9249                                               vector short *__c) {
9250   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9251 }
9252
9253 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9254                                               short *__c) {
9255   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9256 }
9257
9258 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
9259                                               int __b,
9260                                               vector unsigned short *__c) {
9261   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9262 }
9263
9264 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
9265                                               int __b, unsigned short *__c) {
9266   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9267 }
9268
9269 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9270                                               short *__c) {
9271   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9272 }
9273
9274 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9275                                               unsigned short *__c) {
9276   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9277 }
9278
9279 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9280                                               vector bool short *__c) {
9281   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9282 }
9283
9284 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9285                                               short *__c) {
9286   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9287 }
9288
9289 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9290                                               unsigned short *__c) {
9291   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9292 }
9293
9294 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9295                                               vector pixel *__c) {
9296   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9297 }
9298
9299 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
9300                                               vector int *__c) {
9301   __builtin_altivec_stvxl(__a, __b, __c);
9302 }
9303
9304 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
9305                                               int *__c) {
9306   __builtin_altivec_stvxl(__a, __b, __c);
9307 }
9308
9309 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9310                                               vector unsigned int *__c) {
9311   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9312 }
9313
9314 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9315                                               unsigned int *__c) {
9316   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9317 }
9318
9319 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9320                                               int *__c) {
9321   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9322 }
9323
9324 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9325                                               unsigned int *__c) {
9326   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9327 }
9328
9329 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9330                                               vector bool int *__c) {
9331   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9332 }
9333
9334 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9335                                               vector float *__c) {
9336   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9337 }
9338
9339 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9340                                               float *__c) {
9341   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9342 }
9343
9344 /* vec_sub */
9345
9346 static __inline__ vector signed char __ATTRS_o_ai
9347 vec_sub(vector signed char __a, vector signed char __b) {
9348   return __a - __b;
9349 }
9350
9351 static __inline__ vector signed char __ATTRS_o_ai
9352 vec_sub(vector bool char __a, vector signed char __b) {
9353   return (vector signed char)__a - __b;
9354 }
9355
9356 static __inline__ vector signed char __ATTRS_o_ai
9357 vec_sub(vector signed char __a, vector bool char __b) {
9358   return __a - (vector signed char)__b;
9359 }
9360
9361 static __inline__ vector unsigned char __ATTRS_o_ai
9362 vec_sub(vector unsigned char __a, vector unsigned char __b) {
9363   return __a - __b;
9364 }
9365
9366 static __inline__ vector unsigned char __ATTRS_o_ai
9367 vec_sub(vector bool char __a, vector unsigned char __b) {
9368   return (vector unsigned char)__a - __b;
9369 }
9370
9371 static __inline__ vector unsigned char __ATTRS_o_ai
9372 vec_sub(vector unsigned char __a, vector bool char __b) {
9373   return __a - (vector unsigned char)__b;
9374 }
9375
9376 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
9377                                                     vector short __b) {
9378   return __a - __b;
9379 }
9380
9381 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
9382                                                     vector short __b) {
9383   return (vector short)__a - __b;
9384 }
9385
9386 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
9387                                                     vector bool short __b) {
9388   return __a - (vector short)__b;
9389 }
9390
9391 static __inline__ vector unsigned short __ATTRS_o_ai
9392 vec_sub(vector unsigned short __a, vector unsigned short __b) {
9393   return __a - __b;
9394 }
9395
9396 static __inline__ vector unsigned short __ATTRS_o_ai
9397 vec_sub(vector bool short __a, vector unsigned short __b) {
9398   return (vector unsigned short)__a - __b;
9399 }
9400
9401 static __inline__ vector unsigned short __ATTRS_o_ai
9402 vec_sub(vector unsigned short __a, vector bool short __b) {
9403   return __a - (vector unsigned short)__b;
9404 }
9405
9406 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
9407                                                   vector int __b) {
9408   return __a - __b;
9409 }
9410
9411 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
9412                                                   vector int __b) {
9413   return (vector int)__a - __b;
9414 }
9415
9416 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
9417                                                   vector bool int __b) {
9418   return __a - (vector int)__b;
9419 }
9420
9421 static __inline__ vector unsigned int __ATTRS_o_ai
9422 vec_sub(vector unsigned int __a, vector unsigned int __b) {
9423   return __a - __b;
9424 }
9425
9426 static __inline__ vector unsigned int __ATTRS_o_ai
9427 vec_sub(vector bool int __a, vector unsigned int __b) {
9428   return (vector unsigned int)__a - __b;
9429 }
9430
9431 static __inline__ vector unsigned int __ATTRS_o_ai
9432 vec_sub(vector unsigned int __a, vector bool int __b) {
9433   return __a - (vector unsigned int)__b;
9434 }
9435
9436 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9437 static __inline__ vector signed __int128 __ATTRS_o_ai
9438 vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
9439   return __a - __b;
9440 }
9441
9442 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9443 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9444   return __a - __b;
9445 }
9446 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9447
9448 #ifdef __VSX__
9449 static __inline__ vector signed long long __ATTRS_o_ai
9450 vec_sub(vector signed long long __a, vector signed long long __b) {
9451   return __a - __b;
9452 }
9453
9454 static __inline__ vector unsigned long long __ATTRS_o_ai
9455 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
9456   return __a - __b;
9457 }
9458
9459 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
9460                                                      vector double __b) {
9461   return __a - __b;
9462 }
9463 #endif
9464
9465 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
9466                                                     vector float __b) {
9467   return __a - __b;
9468 }
9469
9470 /* vec_vsububm */
9471
9472 #define __builtin_altivec_vsububm vec_vsububm
9473
9474 static __inline__ vector signed char __ATTRS_o_ai
9475 vec_vsububm(vector signed char __a, vector signed char __b) {
9476   return __a - __b;
9477 }
9478
9479 static __inline__ vector signed char __ATTRS_o_ai
9480 vec_vsububm(vector bool char __a, vector signed char __b) {
9481   return (vector signed char)__a - __b;
9482 }
9483
9484 static __inline__ vector signed char __ATTRS_o_ai
9485 vec_vsububm(vector signed char __a, vector bool char __b) {
9486   return __a - (vector signed char)__b;
9487 }
9488
9489 static __inline__ vector unsigned char __ATTRS_o_ai
9490 vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
9491   return __a - __b;
9492 }
9493
9494 static __inline__ vector unsigned char __ATTRS_o_ai
9495 vec_vsububm(vector bool char __a, vector unsigned char __b) {
9496   return (vector unsigned char)__a - __b;
9497 }
9498
9499 static __inline__ vector unsigned char __ATTRS_o_ai
9500 vec_vsububm(vector unsigned char __a, vector bool char __b) {
9501   return __a - (vector unsigned char)__b;
9502 }
9503
9504 /* vec_vsubuhm */
9505
9506 #define __builtin_altivec_vsubuhm vec_vsubuhm
9507
9508 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9509                                                         vector short __b) {
9510   return __a - __b;
9511 }
9512
9513 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
9514                                                         vector short __b) {
9515   return (vector short)__a - __b;
9516 }
9517
9518 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9519                                                         vector bool short __b) {
9520   return __a - (vector short)__b;
9521 }
9522
9523 static __inline__ vector unsigned short __ATTRS_o_ai
9524 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
9525   return __a - __b;
9526 }
9527
9528 static __inline__ vector unsigned short __ATTRS_o_ai
9529 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
9530   return (vector unsigned short)__a - __b;
9531 }
9532
9533 static __inline__ vector unsigned short __ATTRS_o_ai
9534 vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
9535   return __a - (vector unsigned short)__b;
9536 }
9537
9538 /* vec_vsubuwm */
9539
9540 #define __builtin_altivec_vsubuwm vec_vsubuwm
9541
9542 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9543                                                       vector int __b) {
9544   return __a - __b;
9545 }
9546
9547 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9548                                                       vector int __b) {
9549   return (vector int)__a - __b;
9550 }
9551
9552 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9553                                                       vector bool int __b) {
9554   return __a - (vector int)__b;
9555 }
9556
9557 static __inline__ vector unsigned int __ATTRS_o_ai
9558 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
9559   return __a - __b;
9560 }
9561
9562 static __inline__ vector unsigned int __ATTRS_o_ai
9563 vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
9564   return (vector unsigned int)__a - __b;
9565 }
9566
9567 static __inline__ vector unsigned int __ATTRS_o_ai
9568 vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
9569   return __a - (vector unsigned int)__b;
9570 }
9571
9572 /* vec_vsubfp */
9573
9574 #define __builtin_altivec_vsubfp vec_vsubfp
9575
9576 static __inline__ vector float __attribute__((__always_inline__))
9577 vec_vsubfp(vector float __a, vector float __b) {
9578   return __a - __b;
9579 }
9580
9581 /* vec_subc */
9582
9583 static __inline__ vector unsigned int __ATTRS_o_ai
9584 vec_subc(vector unsigned int __a, vector unsigned int __b) {
9585   return __builtin_altivec_vsubcuw(__a, __b);
9586 }
9587
9588 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9589 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9590 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9591   return __builtin_altivec_vsubcuq(__a, __b);
9592 }
9593
9594 static __inline__ vector signed __int128 __ATTRS_o_ai
9595 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
9596   return __builtin_altivec_vsubcuq(__a, __b);
9597 }
9598 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9599
9600 /* vec_vsubcuw */
9601
9602 static __inline__ vector unsigned int __attribute__((__always_inline__))
9603 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
9604   return __builtin_altivec_vsubcuw(__a, __b);
9605 }
9606
9607 /* vec_subs */
9608
9609 static __inline__ vector signed char __ATTRS_o_ai
9610 vec_subs(vector signed char __a, vector signed char __b) {
9611   return __builtin_altivec_vsubsbs(__a, __b);
9612 }
9613
9614 static __inline__ vector signed char __ATTRS_o_ai
9615 vec_subs(vector bool char __a, vector signed char __b) {
9616   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9617 }
9618
9619 static __inline__ vector signed char __ATTRS_o_ai
9620 vec_subs(vector signed char __a, vector bool char __b) {
9621   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9622 }
9623
9624 static __inline__ vector unsigned char __ATTRS_o_ai
9625 vec_subs(vector unsigned char __a, vector unsigned char __b) {
9626   return __builtin_altivec_vsububs(__a, __b);
9627 }
9628
9629 static __inline__ vector unsigned char __ATTRS_o_ai
9630 vec_subs(vector bool char __a, vector unsigned char __b) {
9631   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9632 }
9633
9634 static __inline__ vector unsigned char __ATTRS_o_ai
9635 vec_subs(vector unsigned char __a, vector bool char __b) {
9636   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9637 }
9638
9639 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
9640                                                      vector short __b) {
9641   return __builtin_altivec_vsubshs(__a, __b);
9642 }
9643
9644 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
9645                                                      vector short __b) {
9646   return __builtin_altivec_vsubshs((vector short)__a, __b);
9647 }
9648
9649 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
9650                                                      vector bool short __b) {
9651   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9652 }
9653
9654 static __inline__ vector unsigned short __ATTRS_o_ai
9655 vec_subs(vector unsigned short __a, vector unsigned short __b) {
9656   return __builtin_altivec_vsubuhs(__a, __b);
9657 }
9658
9659 static __inline__ vector unsigned short __ATTRS_o_ai
9660 vec_subs(vector bool short __a, vector unsigned short __b) {
9661   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9662 }
9663
9664 static __inline__ vector unsigned short __ATTRS_o_ai
9665 vec_subs(vector unsigned short __a, vector bool short __b) {
9666   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9667 }
9668
9669 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
9670                                                    vector int __b) {
9671   return __builtin_altivec_vsubsws(__a, __b);
9672 }
9673
9674 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
9675                                                    vector int __b) {
9676   return __builtin_altivec_vsubsws((vector int)__a, __b);
9677 }
9678
9679 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
9680                                                    vector bool int __b) {
9681   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9682 }
9683
9684 static __inline__ vector unsigned int __ATTRS_o_ai
9685 vec_subs(vector unsigned int __a, vector unsigned int __b) {
9686   return __builtin_altivec_vsubuws(__a, __b);
9687 }
9688
9689 static __inline__ vector unsigned int __ATTRS_o_ai
9690 vec_subs(vector bool int __a, vector unsigned int __b) {
9691   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9692 }
9693
9694 static __inline__ vector unsigned int __ATTRS_o_ai
9695 vec_subs(vector unsigned int __a, vector bool int __b) {
9696   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9697 }
9698
9699 /* vec_vsubsbs */
9700
9701 static __inline__ vector signed char __ATTRS_o_ai
9702 vec_vsubsbs(vector signed char __a, vector signed char __b) {
9703   return __builtin_altivec_vsubsbs(__a, __b);
9704 }
9705
9706 static __inline__ vector signed char __ATTRS_o_ai
9707 vec_vsubsbs(vector bool char __a, vector signed char __b) {
9708   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9709 }
9710
9711 static __inline__ vector signed char __ATTRS_o_ai
9712 vec_vsubsbs(vector signed char __a, vector bool char __b) {
9713   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9714 }
9715
9716 /* vec_vsububs */
9717
9718 static __inline__ vector unsigned char __ATTRS_o_ai
9719 vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
9720   return __builtin_altivec_vsububs(__a, __b);
9721 }
9722
9723 static __inline__ vector unsigned char __ATTRS_o_ai
9724 vec_vsububs(vector bool char __a, vector unsigned char __b) {
9725   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9726 }
9727
9728 static __inline__ vector unsigned char __ATTRS_o_ai
9729 vec_vsububs(vector unsigned char __a, vector bool char __b) {
9730   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9731 }
9732
9733 /* vec_vsubshs */
9734
9735 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9736                                                         vector short __b) {
9737   return __builtin_altivec_vsubshs(__a, __b);
9738 }
9739
9740 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
9741                                                         vector short __b) {
9742   return __builtin_altivec_vsubshs((vector short)__a, __b);
9743 }
9744
9745 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9746                                                         vector bool short __b) {
9747   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9748 }
9749
9750 /* vec_vsubuhs */
9751
9752 static __inline__ vector unsigned short __ATTRS_o_ai
9753 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
9754   return __builtin_altivec_vsubuhs(__a, __b);
9755 }
9756
9757 static __inline__ vector unsigned short __ATTRS_o_ai
9758 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
9759   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9760 }
9761
9762 static __inline__ vector unsigned short __ATTRS_o_ai
9763 vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
9764   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9765 }
9766
9767 /* vec_vsubsws */
9768
9769 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9770                                                       vector int __b) {
9771   return __builtin_altivec_vsubsws(__a, __b);
9772 }
9773
9774 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
9775                                                       vector int __b) {
9776   return __builtin_altivec_vsubsws((vector int)__a, __b);
9777 }
9778
9779 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9780                                                       vector bool int __b) {
9781   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9782 }
9783
9784 /* vec_vsubuws */
9785
9786 static __inline__ vector unsigned int __ATTRS_o_ai
9787 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
9788   return __builtin_altivec_vsubuws(__a, __b);
9789 }
9790
9791 static __inline__ vector unsigned int __ATTRS_o_ai
9792 vec_vsubuws(vector bool int __a, vector unsigned int __b) {
9793   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9794 }
9795
9796 static __inline__ vector unsigned int __ATTRS_o_ai
9797 vec_vsubuws(vector unsigned int __a, vector bool int __b) {
9798   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9799 }
9800
9801 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9802 /* vec_vsubuqm */
9803
9804 static __inline__ vector signed __int128 __ATTRS_o_ai
9805 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
9806   return __a - __b;
9807 }
9808
9809 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9810 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9811   return __a - __b;
9812 }
9813
9814 /* vec_vsubeuqm */
9815
9816 static __inline__ vector signed __int128 __ATTRS_o_ai
9817 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9818              vector signed __int128 __c) {
9819   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9820 }
9821
9822 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9823 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9824              vector unsigned __int128 __c) {
9825   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9826 }
9827
9828 /* vec_vsubcuq */
9829
9830 static __inline__ vector signed __int128 __ATTRS_o_ai
9831 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
9832   return __builtin_altivec_vsubcuq(__a, __b);
9833 }
9834
9835 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9836 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9837   return __builtin_altivec_vsubcuq(__a, __b);
9838 }
9839
9840 /* vec_vsubecuq */
9841
9842 static __inline__ vector signed __int128 __ATTRS_o_ai
9843 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9844              vector signed __int128 __c) {
9845   return __builtin_altivec_vsubecuq(__a, __b, __c);
9846 }
9847
9848 static __inline__ vector unsigned __int128 __ATTRS_o_ai
9849 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9850              vector unsigned __int128 __c) {
9851   return __builtin_altivec_vsubecuq(__a, __b, __c);
9852 }
9853 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9854
9855 /* vec_sum4s */
9856
9857 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
9858                                                     vector int __b) {
9859   return __builtin_altivec_vsum4sbs(__a, __b);
9860 }
9861
9862 static __inline__ vector unsigned int __ATTRS_o_ai
9863 vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
9864   return __builtin_altivec_vsum4ubs(__a, __b);
9865 }
9866
9867 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
9868                                                     vector int __b) {
9869   return __builtin_altivec_vsum4shs(__a, __b);
9870 }
9871
9872 /* vec_vsum4sbs */
9873
9874 static __inline__ vector int __attribute__((__always_inline__))
9875 vec_vsum4sbs(vector signed char __a, vector int __b) {
9876   return __builtin_altivec_vsum4sbs(__a, __b);
9877 }
9878
9879 /* vec_vsum4ubs */
9880
9881 static __inline__ vector unsigned int __attribute__((__always_inline__))
9882 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
9883   return __builtin_altivec_vsum4ubs(__a, __b);
9884 }
9885
9886 /* vec_vsum4shs */
9887
9888 static __inline__ vector int __attribute__((__always_inline__))
9889 vec_vsum4shs(vector signed short __a, vector int __b) {
9890   return __builtin_altivec_vsum4shs(__a, __b);
9891 }
9892
9893 /* vec_sum2s */
9894
9895 /* The vsum2sws instruction has a big-endian bias, so that the second
9896    input vector and the result always reference big-endian elements
9897    1 and 3 (little-endian element 0 and 2).  For ease of porting the
9898    programmer wants elements 1 and 3 in both cases, so for little
9899    endian we must perform some permutes.  */
9900
9901 static __inline__ vector signed int __attribute__((__always_inline__))
9902 vec_sum2s(vector int __a, vector int __b) {
9903 #ifdef __LITTLE_ENDIAN__
9904   vector int __c = (vector signed int)vec_perm(
9905       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9906                                        8, 9, 10, 11));
9907   __c = __builtin_altivec_vsum2sws(__a, __c);
9908   return (vector signed int)vec_perm(
9909       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9910                                        8, 9, 10, 11));
9911 #else
9912   return __builtin_altivec_vsum2sws(__a, __b);
9913 #endif
9914 }
9915
9916 /* vec_vsum2sws */
9917
9918 static __inline__ vector signed int __attribute__((__always_inline__))
9919 vec_vsum2sws(vector int __a, vector int __b) {
9920 #ifdef __LITTLE_ENDIAN__
9921   vector int __c = (vector signed int)vec_perm(
9922       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9923                                        8, 9, 10, 11));
9924   __c = __builtin_altivec_vsum2sws(__a, __c);
9925   return (vector signed int)vec_perm(
9926       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9927                                        8, 9, 10, 11));
9928 #else
9929   return __builtin_altivec_vsum2sws(__a, __b);
9930 #endif
9931 }
9932
9933 /* vec_sums */
9934
9935 /* The vsumsws instruction has a big-endian bias, so that the second
9936    input vector and the result always reference big-endian element 3
9937    (little-endian element 0).  For ease of porting the programmer
9938    wants element 3 in both cases, so for little endian we must perform
9939    some permutes.  */
9940
9941 static __inline__ vector signed int __attribute__((__always_inline__))
9942 vec_sums(vector signed int __a, vector signed int __b) {
9943 #ifdef __LITTLE_ENDIAN__
9944   __b = (vector signed int)vec_splat(__b, 3);
9945   __b = __builtin_altivec_vsumsws(__a, __b);
9946   return (vector signed int)(0, 0, 0, __b[0]);
9947 #else
9948   return __builtin_altivec_vsumsws(__a, __b);
9949 #endif
9950 }
9951
9952 /* vec_vsumsws */
9953
9954 static __inline__ vector signed int __attribute__((__always_inline__))
9955 vec_vsumsws(vector signed int __a, vector signed int __b) {
9956 #ifdef __LITTLE_ENDIAN__
9957   __b = (vector signed int)vec_splat(__b, 3);
9958   __b = __builtin_altivec_vsumsws(__a, __b);
9959   return (vector signed int)(0, 0, 0, __b[0]);
9960 #else
9961   return __builtin_altivec_vsumsws(__a, __b);
9962 #endif
9963 }
9964
9965 /* vec_trunc */
9966
9967 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
9968 #ifdef __VSX__
9969   return __builtin_vsx_xvrspiz(__a);
9970 #else
9971   return __builtin_altivec_vrfiz(__a);
9972 #endif
9973 }
9974
9975 #ifdef __VSX__
9976 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
9977   return __builtin_vsx_xvrdpiz(__a);
9978 }
9979 #endif
9980
9981 /* vec_vrfiz */
9982
9983 static __inline__ vector float __attribute__((__always_inline__))
9984 vec_vrfiz(vector float __a) {
9985   return __builtin_altivec_vrfiz(__a);
9986 }
9987
9988 /* vec_unpackh */
9989
9990 /* The vector unpack instructions all have a big-endian bias, so for
9991    little endian we must reverse the meanings of "high" and "low."  */
9992
9993 static __inline__ vector short __ATTRS_o_ai
9994 vec_unpackh(vector signed char __a) {
9995 #ifdef __LITTLE_ENDIAN__
9996   return __builtin_altivec_vupklsb((vector char)__a);
9997 #else
9998   return __builtin_altivec_vupkhsb((vector char)__a);
9999 #endif
10000 }
10001
10002 static __inline__ vector bool short __ATTRS_o_ai
10003 vec_unpackh(vector bool char __a) {
10004 #ifdef __LITTLE_ENDIAN__
10005   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10006 #else
10007   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10008 #endif
10009 }
10010
10011 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
10012 #ifdef __LITTLE_ENDIAN__
10013   return __builtin_altivec_vupklsh(__a);
10014 #else
10015   return __builtin_altivec_vupkhsh(__a);
10016 #endif
10017 }
10018
10019 static __inline__ vector bool int __ATTRS_o_ai
10020 vec_unpackh(vector bool short __a) {
10021 #ifdef __LITTLE_ENDIAN__
10022   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10023 #else
10024   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10025 #endif
10026 }
10027
10028 static __inline__ vector unsigned int __ATTRS_o_ai
10029 vec_unpackh(vector pixel __a) {
10030 #ifdef __LITTLE_ENDIAN__
10031   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10032 #else
10033   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10034 #endif
10035 }
10036
10037 #ifdef __POWER8_VECTOR__
10038 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
10039 #ifdef __LITTLE_ENDIAN__
10040   return __builtin_altivec_vupklsw(__a);
10041 #else
10042   return __builtin_altivec_vupkhsw(__a);
10043 #endif
10044 }
10045
10046 static __inline__ vector bool long long __ATTRS_o_ai
10047 vec_unpackh(vector bool int __a) {
10048 #ifdef __LITTLE_ENDIAN__
10049   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10050 #else
10051   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10052 #endif
10053 }
10054 #endif
10055
10056 /* vec_vupkhsb */
10057
10058 static __inline__ vector short __ATTRS_o_ai
10059 vec_vupkhsb(vector signed char __a) {
10060 #ifdef __LITTLE_ENDIAN__
10061   return __builtin_altivec_vupklsb((vector char)__a);
10062 #else
10063   return __builtin_altivec_vupkhsb((vector char)__a);
10064 #endif
10065 }
10066
10067 static __inline__ vector bool short __ATTRS_o_ai
10068 vec_vupkhsb(vector bool char __a) {
10069 #ifdef __LITTLE_ENDIAN__
10070   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10071 #else
10072   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10073 #endif
10074 }
10075
10076 /* vec_vupkhsh */
10077
10078 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
10079 #ifdef __LITTLE_ENDIAN__
10080   return __builtin_altivec_vupklsh(__a);
10081 #else
10082   return __builtin_altivec_vupkhsh(__a);
10083 #endif
10084 }
10085
10086 static __inline__ vector bool int __ATTRS_o_ai
10087 vec_vupkhsh(vector bool short __a) {
10088 #ifdef __LITTLE_ENDIAN__
10089   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10090 #else
10091   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10092 #endif
10093 }
10094
10095 static __inline__ vector unsigned int __ATTRS_o_ai
10096 vec_vupkhsh(vector pixel __a) {
10097 #ifdef __LITTLE_ENDIAN__
10098   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10099 #else
10100   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10101 #endif
10102 }
10103
10104 /* vec_vupkhsw */
10105
10106 #ifdef __POWER8_VECTOR__
10107 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
10108 #ifdef __LITTLE_ENDIAN__
10109   return __builtin_altivec_vupklsw(__a);
10110 #else
10111   return __builtin_altivec_vupkhsw(__a);
10112 #endif
10113 }
10114
10115 static __inline__ vector bool long long __ATTRS_o_ai
10116 vec_vupkhsw(vector bool int __a) {
10117 #ifdef __LITTLE_ENDIAN__
10118   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10119 #else
10120   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10121 #endif
10122 }
10123 #endif
10124
10125 /* vec_unpackl */
10126
10127 static __inline__ vector short __ATTRS_o_ai
10128 vec_unpackl(vector signed char __a) {
10129 #ifdef __LITTLE_ENDIAN__
10130   return __builtin_altivec_vupkhsb((vector char)__a);
10131 #else
10132   return __builtin_altivec_vupklsb((vector char)__a);
10133 #endif
10134 }
10135
10136 static __inline__ vector bool short __ATTRS_o_ai
10137 vec_unpackl(vector bool char __a) {
10138 #ifdef __LITTLE_ENDIAN__
10139   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10140 #else
10141   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10142 #endif
10143 }
10144
10145 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
10146 #ifdef __LITTLE_ENDIAN__
10147   return __builtin_altivec_vupkhsh(__a);
10148 #else
10149   return __builtin_altivec_vupklsh(__a);
10150 #endif
10151 }
10152
10153 static __inline__ vector bool int __ATTRS_o_ai
10154 vec_unpackl(vector bool short __a) {
10155 #ifdef __LITTLE_ENDIAN__
10156   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10157 #else
10158   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10159 #endif
10160 }
10161
10162 static __inline__ vector unsigned int __ATTRS_o_ai
10163 vec_unpackl(vector pixel __a) {
10164 #ifdef __LITTLE_ENDIAN__
10165   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10166 #else
10167   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10168 #endif
10169 }
10170
10171 #ifdef __POWER8_VECTOR__
10172 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
10173 #ifdef __LITTLE_ENDIAN__
10174   return __builtin_altivec_vupkhsw(__a);
10175 #else
10176   return __builtin_altivec_vupklsw(__a);
10177 #endif
10178 }
10179
10180 static __inline__ vector bool long long __ATTRS_o_ai
10181 vec_unpackl(vector bool int __a) {
10182 #ifdef __LITTLE_ENDIAN__
10183   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10184 #else
10185   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10186 #endif
10187 }
10188 #endif
10189
10190 /* vec_vupklsb */
10191
10192 static __inline__ vector short __ATTRS_o_ai
10193 vec_vupklsb(vector signed char __a) {
10194 #ifdef __LITTLE_ENDIAN__
10195   return __builtin_altivec_vupkhsb((vector char)__a);
10196 #else
10197   return __builtin_altivec_vupklsb((vector char)__a);
10198 #endif
10199 }
10200
10201 static __inline__ vector bool short __ATTRS_o_ai
10202 vec_vupklsb(vector bool char __a) {
10203 #ifdef __LITTLE_ENDIAN__
10204   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10205 #else
10206   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10207 #endif
10208 }
10209
10210 /* vec_vupklsh */
10211
10212 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
10213 #ifdef __LITTLE_ENDIAN__
10214   return __builtin_altivec_vupkhsh(__a);
10215 #else
10216   return __builtin_altivec_vupklsh(__a);
10217 #endif
10218 }
10219
10220 static __inline__ vector bool int __ATTRS_o_ai
10221 vec_vupklsh(vector bool short __a) {
10222 #ifdef __LITTLE_ENDIAN__
10223   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10224 #else
10225   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10226 #endif
10227 }
10228
10229 static __inline__ vector unsigned int __ATTRS_o_ai
10230 vec_vupklsh(vector pixel __a) {
10231 #ifdef __LITTLE_ENDIAN__
10232   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10233 #else
10234   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10235 #endif
10236 }
10237
10238 /* vec_vupklsw */
10239
10240 #ifdef __POWER8_VECTOR__
10241 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
10242 #ifdef __LITTLE_ENDIAN__
10243   return __builtin_altivec_vupkhsw(__a);
10244 #else
10245   return __builtin_altivec_vupklsw(__a);
10246 #endif
10247 }
10248
10249 static __inline__ vector bool long long __ATTRS_o_ai
10250 vec_vupklsw(vector bool int __a) {
10251 #ifdef __LITTLE_ENDIAN__
10252   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10253 #else
10254   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10255 #endif
10256 }
10257 #endif
10258
10259 /* vec_vsx_ld */
10260
10261 #ifdef __VSX__
10262
10263 static __inline__ vector bool int __ATTRS_o_ai
10264 vec_vsx_ld(int __a, const vector bool int *__b) {
10265   return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
10266 }
10267
10268 static __inline__ vector signed int __ATTRS_o_ai
10269 vec_vsx_ld(int __a, const vector signed int *__b) {
10270   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10271 }
10272
10273 static __inline__ vector signed int __ATTRS_o_ai
10274 vec_vsx_ld(int __a, const signed int *__b) {
10275   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10276 }
10277
10278 static __inline__ vector unsigned int __ATTRS_o_ai
10279 vec_vsx_ld(int __a, const vector unsigned int *__b) {
10280   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10281 }
10282
10283 static __inline__ vector unsigned int __ATTRS_o_ai
10284 vec_vsx_ld(int __a, const unsigned int *__b) {
10285   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10286 }
10287
10288 static __inline__ vector float __ATTRS_o_ai
10289 vec_vsx_ld(int __a, const vector float *__b) {
10290   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10291 }
10292
10293 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
10294                                                        const float *__b) {
10295   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10296 }
10297
10298 static __inline__ vector signed long long __ATTRS_o_ai
10299 vec_vsx_ld(int __a, const vector signed long long *__b) {
10300   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
10301 }
10302
10303 static __inline__ vector unsigned long long __ATTRS_o_ai
10304 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
10305   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
10306 }
10307
10308 static __inline__ vector double __ATTRS_o_ai
10309 vec_vsx_ld(int __a, const vector double *__b) {
10310   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10311 }
10312
10313 static __inline__ vector double __ATTRS_o_ai
10314 vec_vsx_ld(int __a, const double *__b) {
10315   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10316 }
10317
10318 static __inline__ vector bool short __ATTRS_o_ai
10319 vec_vsx_ld(int __a, const vector bool short *__b) {
10320   return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
10321 }
10322
10323 static __inline__ vector signed short __ATTRS_o_ai
10324 vec_vsx_ld(int __a, const vector signed short *__b) {
10325   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
10326 }
10327
10328 static __inline__ vector signed short __ATTRS_o_ai
10329 vec_vsx_ld(int __a, const signed short *__b) {
10330   return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
10331 }
10332
10333 static __inline__ vector unsigned short __ATTRS_o_ai
10334 vec_vsx_ld(int __a, const vector unsigned short *__b) {
10335   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
10336 }
10337
10338 static __inline__ vector unsigned short __ATTRS_o_ai
10339 vec_vsx_ld(int __a, const unsigned short *__b) {
10340   return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
10341 }
10342
10343 static __inline__ vector bool char __ATTRS_o_ai
10344 vec_vsx_ld(int __a, const vector bool char *__b) {
10345   return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
10346 }
10347
10348 static __inline__ vector signed char __ATTRS_o_ai
10349 vec_vsx_ld(int __a, const vector signed char *__b) {
10350   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
10351 }
10352
10353 static __inline__ vector signed char __ATTRS_o_ai
10354 vec_vsx_ld(int __a, const signed char *__b) {
10355   return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
10356 }
10357
10358 static __inline__ vector unsigned char __ATTRS_o_ai
10359 vec_vsx_ld(int __a, const vector unsigned char *__b) {
10360   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
10361 }
10362
10363 static __inline__ vector unsigned char __ATTRS_o_ai
10364 vec_vsx_ld(int __a, const unsigned char *__b) {
10365   return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
10366 }
10367
10368 #endif
10369
10370 /* vec_vsx_st */
10371
10372 #ifdef __VSX__
10373
10374 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10375                                                vector bool int *__c) {
10376   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10377 }
10378
10379 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10380                                                signed int *__c) {
10381   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10382 }
10383
10384 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
10385                                                unsigned int *__c) {
10386   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10387 }
10388
10389 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10390                                                vector signed int *__c) {
10391   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10392 }
10393
10394 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10395                                                signed int *__c) {
10396   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10397 }
10398
10399 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10400                                                vector unsigned int *__c) {
10401   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10402 }
10403
10404 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10405                                                unsigned int *__c) {
10406   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10407 }
10408
10409 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10410                                                vector float *__c) {
10411   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10412 }
10413
10414 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10415                                                float *__c) {
10416   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10417 }
10418
10419 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
10420                                                int __b,
10421                                                vector signed long long *__c) {
10422   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10423 }
10424
10425 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
10426                                                int __b,
10427                                                vector unsigned long long *__c) {
10428   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10429 }
10430
10431 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10432                                                vector double *__c) {
10433   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10434 }
10435
10436 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10437                                                double *__c) {
10438   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10439 }
10440
10441 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10442                                                vector bool short *__c) {
10443   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10444 }
10445
10446 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10447                                                signed short *__c) {
10448   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10449 }
10450
10451 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
10452                                                unsigned short *__c) {
10453   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10454 }
10455 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
10456                                                vector signed short *__c) {
10457   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10458 }
10459
10460 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
10461                                                signed short *__c) {
10462   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10463 }
10464
10465 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
10466                                                int __b,
10467                                                vector unsigned short *__c) {
10468   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10469 }
10470
10471 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
10472                                                int __b, unsigned short *__c) {
10473   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10474 }
10475
10476 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10477                                                vector bool char *__c) {
10478   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10479 }
10480
10481 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10482                                                signed char *__c) {
10483   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10484 }
10485
10486 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
10487                                                unsigned char *__c) {
10488   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10489 }
10490
10491 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
10492                                                vector signed char *__c) {
10493   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10494 }
10495
10496 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
10497                                                signed char *__c) {
10498   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10499 }
10500
10501 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
10502                                                int __b,
10503                                                vector unsigned char *__c) {
10504   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10505 }
10506
10507 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
10508                                                int __b, unsigned char *__c) {
10509   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10510 }
10511
10512 #endif
10513
10514 /* vec_xor */
10515
10516 #define __builtin_altivec_vxor vec_xor
10517
10518 static __inline__ vector signed char __ATTRS_o_ai
10519 vec_xor(vector signed char __a, vector signed char __b) {
10520   return __a ^ __b;
10521 }
10522
10523 static __inline__ vector signed char __ATTRS_o_ai
10524 vec_xor(vector bool char __a, vector signed char __b) {
10525   return (vector signed char)__a ^ __b;
10526 }
10527
10528 static __inline__ vector signed char __ATTRS_o_ai
10529 vec_xor(vector signed char __a, vector bool char __b) {
10530   return __a ^ (vector signed char)__b;
10531 }
10532
10533 static __inline__ vector unsigned char __ATTRS_o_ai
10534 vec_xor(vector unsigned char __a, vector unsigned char __b) {
10535   return __a ^ __b;
10536 }
10537
10538 static __inline__ vector unsigned char __ATTRS_o_ai
10539 vec_xor(vector bool char __a, vector unsigned char __b) {
10540   return (vector unsigned char)__a ^ __b;
10541 }
10542
10543 static __inline__ vector unsigned char __ATTRS_o_ai
10544 vec_xor(vector unsigned char __a, vector bool char __b) {
10545   return __a ^ (vector unsigned char)__b;
10546 }
10547
10548 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
10549                                                         vector bool char __b) {
10550   return __a ^ __b;
10551 }
10552
10553 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
10554                                                     vector short __b) {
10555   return __a ^ __b;
10556 }
10557
10558 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
10559                                                     vector short __b) {
10560   return (vector short)__a ^ __b;
10561 }
10562
10563 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
10564                                                     vector bool short __b) {
10565   return __a ^ (vector short)__b;
10566 }
10567
10568 static __inline__ vector unsigned short __ATTRS_o_ai
10569 vec_xor(vector unsigned short __a, vector unsigned short __b) {
10570   return __a ^ __b;
10571 }
10572
10573 static __inline__ vector unsigned short __ATTRS_o_ai
10574 vec_xor(vector bool short __a, vector unsigned short __b) {
10575   return (vector unsigned short)__a ^ __b;
10576 }
10577
10578 static __inline__ vector unsigned short __ATTRS_o_ai
10579 vec_xor(vector unsigned short __a, vector bool short __b) {
10580   return __a ^ (vector unsigned short)__b;
10581 }
10582
10583 static __inline__ vector bool short __ATTRS_o_ai
10584 vec_xor(vector bool short __a, vector bool short __b) {
10585   return __a ^ __b;
10586 }
10587
10588 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
10589                                                   vector int __b) {
10590   return __a ^ __b;
10591 }
10592
10593 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
10594                                                   vector int __b) {
10595   return (vector int)__a ^ __b;
10596 }
10597
10598 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
10599                                                   vector bool int __b) {
10600   return __a ^ (vector int)__b;
10601 }
10602
10603 static __inline__ vector unsigned int __ATTRS_o_ai
10604 vec_xor(vector unsigned int __a, vector unsigned int __b) {
10605   return __a ^ __b;
10606 }
10607
10608 static __inline__ vector unsigned int __ATTRS_o_ai
10609 vec_xor(vector bool int __a, vector unsigned int __b) {
10610   return (vector unsigned int)__a ^ __b;
10611 }
10612
10613 static __inline__ vector unsigned int __ATTRS_o_ai
10614 vec_xor(vector unsigned int __a, vector bool int __b) {
10615   return __a ^ (vector unsigned int)__b;
10616 }
10617
10618 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
10619                                                        vector bool int __b) {
10620   return __a ^ __b;
10621 }
10622
10623 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
10624                                                     vector float __b) {
10625   vector unsigned int __res =
10626       (vector unsigned int)__a ^ (vector unsigned int)__b;
10627   return (vector float)__res;
10628 }
10629
10630 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
10631                                                     vector float __b) {
10632   vector unsigned int __res =
10633       (vector unsigned int)__a ^ (vector unsigned int)__b;
10634   return (vector float)__res;
10635 }
10636
10637 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
10638                                                     vector bool int __b) {
10639   vector unsigned int __res =
10640       (vector unsigned int)__a ^ (vector unsigned int)__b;
10641   return (vector float)__res;
10642 }
10643
10644 #ifdef __VSX__
10645 static __inline__ vector signed long long __ATTRS_o_ai
10646 vec_xor(vector signed long long __a, vector signed long long __b) {
10647   return __a ^ __b;
10648 }
10649
10650 static __inline__ vector signed long long __ATTRS_o_ai
10651 vec_xor(vector bool long long __a, vector signed long long __b) {
10652   return (vector signed long long)__a ^ __b;
10653 }
10654
10655 static __inline__ vector signed long long __ATTRS_o_ai
10656 vec_xor(vector signed long long __a, vector bool long long __b) {
10657   return __a ^ (vector signed long long)__b;
10658 }
10659
10660 static __inline__ vector unsigned long long __ATTRS_o_ai
10661 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
10662   return __a ^ __b;
10663 }
10664
10665 static __inline__ vector unsigned long long __ATTRS_o_ai
10666 vec_xor(vector bool long long __a, vector unsigned long long __b) {
10667   return (vector unsigned long long)__a ^ __b;
10668 }
10669
10670 static __inline__ vector unsigned long long __ATTRS_o_ai
10671 vec_xor(vector unsigned long long __a, vector bool long long __b) {
10672   return __a ^ (vector unsigned long long)__b;
10673 }
10674
10675 static __inline__ vector bool long long __ATTRS_o_ai
10676 vec_xor(vector bool long long __a, vector bool long long __b) {
10677   return __a ^ __b;
10678 }
10679
10680 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
10681                                                      vector double __b) {
10682   return (vector double)((vector unsigned long long)__a ^
10683                          (vector unsigned long long)__b);
10684 }
10685
10686 static __inline__ vector double __ATTRS_o_ai
10687 vec_xor(vector double __a, vector bool long long __b) {
10688   return (vector double)((vector unsigned long long)__a ^
10689                          (vector unsigned long long)__b);
10690 }
10691
10692 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
10693                                                      vector double __b) {
10694   return (vector double)((vector unsigned long long)__a ^
10695                          (vector unsigned long long)__b);
10696 }
10697 #endif
10698
10699 /* vec_vxor */
10700
10701 static __inline__ vector signed char __ATTRS_o_ai
10702 vec_vxor(vector signed char __a, vector signed char __b) {
10703   return __a ^ __b;
10704 }
10705
10706 static __inline__ vector signed char __ATTRS_o_ai
10707 vec_vxor(vector bool char __a, vector signed char __b) {
10708   return (vector signed char)__a ^ __b;
10709 }
10710
10711 static __inline__ vector signed char __ATTRS_o_ai
10712 vec_vxor(vector signed char __a, vector bool char __b) {
10713   return __a ^ (vector signed char)__b;
10714 }
10715
10716 static __inline__ vector unsigned char __ATTRS_o_ai
10717 vec_vxor(vector unsigned char __a, vector unsigned char __b) {
10718   return __a ^ __b;
10719 }
10720
10721 static __inline__ vector unsigned char __ATTRS_o_ai
10722 vec_vxor(vector bool char __a, vector unsigned char __b) {
10723   return (vector unsigned char)__a ^ __b;
10724 }
10725
10726 static __inline__ vector unsigned char __ATTRS_o_ai
10727 vec_vxor(vector unsigned char __a, vector bool char __b) {
10728   return __a ^ (vector unsigned char)__b;
10729 }
10730
10731 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
10732                                                          vector bool char __b) {
10733   return __a ^ __b;
10734 }
10735
10736 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
10737                                                      vector short __b) {
10738   return __a ^ __b;
10739 }
10740
10741 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
10742                                                      vector short __b) {
10743   return (vector short)__a ^ __b;
10744 }
10745
10746 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
10747                                                      vector bool short __b) {
10748   return __a ^ (vector short)__b;
10749 }
10750
10751 static __inline__ vector unsigned short __ATTRS_o_ai
10752 vec_vxor(vector unsigned short __a, vector unsigned short __b) {
10753   return __a ^ __b;
10754 }
10755
10756 static __inline__ vector unsigned short __ATTRS_o_ai
10757 vec_vxor(vector bool short __a, vector unsigned short __b) {
10758   return (vector unsigned short)__a ^ __b;
10759 }
10760
10761 static __inline__ vector unsigned short __ATTRS_o_ai
10762 vec_vxor(vector unsigned short __a, vector bool short __b) {
10763   return __a ^ (vector unsigned short)__b;
10764 }
10765
10766 static __inline__ vector bool short __ATTRS_o_ai
10767 vec_vxor(vector bool short __a, vector bool short __b) {
10768   return __a ^ __b;
10769 }
10770
10771 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
10772                                                    vector int __b) {
10773   return __a ^ __b;
10774 }
10775
10776 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
10777                                                    vector int __b) {
10778   return (vector int)__a ^ __b;
10779 }
10780
10781 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
10782                                                    vector bool int __b) {
10783   return __a ^ (vector int)__b;
10784 }
10785
10786 static __inline__ vector unsigned int __ATTRS_o_ai
10787 vec_vxor(vector unsigned int __a, vector unsigned int __b) {
10788   return __a ^ __b;
10789 }
10790
10791 static __inline__ vector unsigned int __ATTRS_o_ai
10792 vec_vxor(vector bool int __a, vector unsigned int __b) {
10793   return (vector unsigned int)__a ^ __b;
10794 }
10795
10796 static __inline__ vector unsigned int __ATTRS_o_ai
10797 vec_vxor(vector unsigned int __a, vector bool int __b) {
10798   return __a ^ (vector unsigned int)__b;
10799 }
10800
10801 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
10802                                                         vector bool int __b) {
10803   return __a ^ __b;
10804 }
10805
10806 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
10807                                                      vector float __b) {
10808   vector unsigned int __res =
10809       (vector unsigned int)__a ^ (vector unsigned int)__b;
10810   return (vector float)__res;
10811 }
10812
10813 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
10814                                                      vector float __b) {
10815   vector unsigned int __res =
10816       (vector unsigned int)__a ^ (vector unsigned int)__b;
10817   return (vector float)__res;
10818 }
10819
10820 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
10821                                                      vector bool int __b) {
10822   vector unsigned int __res =
10823       (vector unsigned int)__a ^ (vector unsigned int)__b;
10824   return (vector float)__res;
10825 }
10826
10827 #ifdef __VSX__
10828 static __inline__ vector signed long long __ATTRS_o_ai
10829 vec_vxor(vector signed long long __a, vector signed long long __b) {
10830   return __a ^ __b;
10831 }
10832
10833 static __inline__ vector signed long long __ATTRS_o_ai
10834 vec_vxor(vector bool long long __a, vector signed long long __b) {
10835   return (vector signed long long)__a ^ __b;
10836 }
10837
10838 static __inline__ vector signed long long __ATTRS_o_ai
10839 vec_vxor(vector signed long long __a, vector bool long long __b) {
10840   return __a ^ (vector signed long long)__b;
10841 }
10842
10843 static __inline__ vector unsigned long long __ATTRS_o_ai
10844 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
10845   return __a ^ __b;
10846 }
10847
10848 static __inline__ vector unsigned long long __ATTRS_o_ai
10849 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
10850   return (vector unsigned long long)__a ^ __b;
10851 }
10852
10853 static __inline__ vector unsigned long long __ATTRS_o_ai
10854 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
10855   return __a ^ (vector unsigned long long)__b;
10856 }
10857
10858 static __inline__ vector bool long long __ATTRS_o_ai
10859 vec_vxor(vector bool long long __a, vector bool long long __b) {
10860   return __a ^ __b;
10861 }
10862 #endif
10863
10864 /* ------------------------ extensions for CBEA ----------------------------- */
10865
10866 /* vec_extract */
10867
10868 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
10869                                                        int __b) {
10870   return __a[__b];
10871 }
10872
10873 static __inline__ unsigned char __ATTRS_o_ai
10874 vec_extract(vector unsigned char __a, int __b) {
10875   return __a[__b];
10876 }
10877
10878 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
10879                                                          int __b) {
10880   return __a[__b];
10881 }
10882
10883 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
10884                                                         int __b) {
10885   return __a[__b];
10886 }
10887
10888 static __inline__ unsigned short __ATTRS_o_ai
10889 vec_extract(vector unsigned short __a, int __b) {
10890   return __a[__b];
10891 }
10892
10893 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
10894                                                           int __b) {
10895   return __a[__b];
10896 }
10897
10898 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
10899                                                       int __b) {
10900   return __a[__b];
10901 }
10902
10903 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
10904                                                         int __b) {
10905   return __a[__b];
10906 }
10907
10908 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
10909                                                         int __b) {
10910   return __a[__b];
10911 }
10912
10913 #ifdef __VSX__
10914 static __inline__ signed long long __ATTRS_o_ai
10915 vec_extract(vector signed long long __a, int __b) {
10916   return __a[__b];
10917 }
10918
10919 static __inline__ unsigned long long __ATTRS_o_ai
10920 vec_extract(vector unsigned long long __a, int __b) {
10921   return __a[__b];
10922 }
10923
10924 static __inline__ unsigned long long __ATTRS_o_ai
10925 vec_extract(vector bool long long __a, int __b) {
10926   return __a[__b];
10927 }
10928
10929 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
10930   return __a[__b];
10931 }
10932 #endif
10933
10934 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
10935   return __a[__b];
10936 }
10937
10938 /* vec_insert */
10939
10940 static __inline__ vector signed char __ATTRS_o_ai
10941 vec_insert(signed char __a, vector signed char __b, int __c) {
10942   __b[__c] = __a;
10943   return __b;
10944 }
10945
10946 static __inline__ vector unsigned char __ATTRS_o_ai
10947 vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
10948   __b[__c] = __a;
10949   return __b;
10950 }
10951
10952 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
10953                                                            vector bool char __b,
10954                                                            int __c) {
10955   __b[__c] = __a;
10956   return __b;
10957 }
10958
10959 static __inline__ vector signed short __ATTRS_o_ai
10960 vec_insert(signed short __a, vector signed short __b, int __c) {
10961   __b[__c] = __a;
10962   return __b;
10963 }
10964
10965 static __inline__ vector unsigned short __ATTRS_o_ai
10966 vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
10967   __b[__c] = __a;
10968   return __b;
10969 }
10970
10971 static __inline__ vector bool short __ATTRS_o_ai
10972 vec_insert(unsigned short __a, vector bool short __b, int __c) {
10973   __b[__c] = __a;
10974   return __b;
10975 }
10976
10977 static __inline__ vector signed int __ATTRS_o_ai
10978 vec_insert(signed int __a, vector signed int __b, int __c) {
10979   __b[__c] = __a;
10980   return __b;
10981 }
10982
10983 static __inline__ vector unsigned int __ATTRS_o_ai
10984 vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
10985   __b[__c] = __a;
10986   return __b;
10987 }
10988
10989 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
10990                                                           vector bool int __b,
10991                                                           int __c) {
10992   __b[__c] = __a;
10993   return __b;
10994 }
10995
10996 #ifdef __VSX__
10997 static __inline__ vector signed long long __ATTRS_o_ai
10998 vec_insert(signed long long __a, vector signed long long __b, int __c) {
10999   __b[__c] = __a;
11000   return __b;
11001 }
11002
11003 static __inline__ vector unsigned long long __ATTRS_o_ai
11004 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
11005   __b[__c] = __a;
11006   return __b;
11007 }
11008
11009 static __inline__ vector bool long long __ATTRS_o_ai
11010 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
11011   __b[__c] = __a;
11012   return __b;
11013 }
11014 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
11015                                                         vector double __b,
11016                                                         int __c) {
11017   __b[__c] = __a;
11018   return __b;
11019 }
11020 #endif
11021
11022 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
11023                                                        vector float __b,
11024                                                        int __c) {
11025   __b[__c] = __a;
11026   return __b;
11027 }
11028
11029 /* vec_lvlx */
11030
11031 static __inline__ vector signed char __ATTRS_o_ai
11032 vec_lvlx(int __a, const signed char *__b) {
11033   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11034                   vec_lvsl(__a, __b));
11035 }
11036
11037 static __inline__ vector signed char __ATTRS_o_ai
11038 vec_lvlx(int __a, const vector signed char *__b) {
11039   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
11040                   vec_lvsl(__a, (unsigned char *)__b));
11041 }
11042
11043 static __inline__ vector unsigned char __ATTRS_o_ai
11044 vec_lvlx(int __a, const unsigned char *__b) {
11045   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11046                   vec_lvsl(__a, __b));
11047 }
11048
11049 static __inline__ vector unsigned char __ATTRS_o_ai
11050 vec_lvlx(int __a, const vector unsigned char *__b) {
11051   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
11052                   vec_lvsl(__a, (unsigned char *)__b));
11053 }
11054
11055 static __inline__ vector bool char __ATTRS_o_ai
11056 vec_lvlx(int __a, const vector bool char *__b) {
11057   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
11058                   vec_lvsl(__a, (unsigned char *)__b));
11059 }
11060
11061 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
11062                                                      const short *__b) {
11063   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
11064 }
11065
11066 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
11067                                                      const vector short *__b) {
11068   return vec_perm(vec_ld(__a, __b), (vector short)(0),
11069                   vec_lvsl(__a, (unsigned char *)__b));
11070 }
11071
11072 static __inline__ vector unsigned short __ATTRS_o_ai
11073 vec_lvlx(int __a, const unsigned short *__b) {
11074   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
11075                   vec_lvsl(__a, __b));
11076 }
11077
11078 static __inline__ vector unsigned short __ATTRS_o_ai
11079 vec_lvlx(int __a, const vector unsigned short *__b) {
11080   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
11081                   vec_lvsl(__a, (unsigned char *)__b));
11082 }
11083
11084 static __inline__ vector bool short __ATTRS_o_ai
11085 vec_lvlx(int __a, const vector bool short *__b) {
11086   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
11087                   vec_lvsl(__a, (unsigned char *)__b));
11088 }
11089
11090 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
11091                                                      const vector pixel *__b) {
11092   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
11093                   vec_lvsl(__a, (unsigned char *)__b));
11094 }
11095
11096 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
11097   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
11098 }
11099
11100 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
11101                                                    const vector int *__b) {
11102   return vec_perm(vec_ld(__a, __b), (vector int)(0),
11103                   vec_lvsl(__a, (unsigned char *)__b));
11104 }
11105
11106 static __inline__ vector unsigned int __ATTRS_o_ai
11107 vec_lvlx(int __a, const unsigned int *__b) {
11108   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
11109                   vec_lvsl(__a, __b));
11110 }
11111
11112 static __inline__ vector unsigned int __ATTRS_o_ai
11113 vec_lvlx(int __a, const vector unsigned int *__b) {
11114   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
11115                   vec_lvsl(__a, (unsigned char *)__b));
11116 }
11117
11118 static __inline__ vector bool int __ATTRS_o_ai
11119 vec_lvlx(int __a, const vector bool int *__b) {
11120   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
11121                   vec_lvsl(__a, (unsigned char *)__b));
11122 }
11123
11124 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
11125                                                      const float *__b) {
11126   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
11127 }
11128
11129 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
11130                                                      const vector float *__b) {
11131   return vec_perm(vec_ld(__a, __b), (vector float)(0),
11132                   vec_lvsl(__a, (unsigned char *)__b));
11133 }
11134
11135 /* vec_lvlxl */
11136
11137 static __inline__ vector signed char __ATTRS_o_ai
11138 vec_lvlxl(int __a, const signed char *__b) {
11139   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
11140                   vec_lvsl(__a, __b));
11141 }
11142
11143 static __inline__ vector signed char __ATTRS_o_ai
11144 vec_lvlxl(int __a, const vector signed char *__b) {
11145   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
11146                   vec_lvsl(__a, (unsigned char *)__b));
11147 }
11148
11149 static __inline__ vector unsigned char __ATTRS_o_ai
11150 vec_lvlxl(int __a, const unsigned char *__b) {
11151   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
11152                   vec_lvsl(__a, __b));
11153 }
11154
11155 static __inline__ vector unsigned char __ATTRS_o_ai
11156 vec_lvlxl(int __a, const vector unsigned char *__b) {
11157   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
11158                   vec_lvsl(__a, (unsigned char *)__b));
11159 }
11160
11161 static __inline__ vector bool char __ATTRS_o_ai
11162 vec_lvlxl(int __a, const vector bool char *__b) {
11163   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
11164                   vec_lvsl(__a, (unsigned char *)__b));
11165 }
11166
11167 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
11168                                                       const short *__b) {
11169   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
11170 }
11171
11172 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
11173                                                       const vector short *__b) {
11174   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
11175                   vec_lvsl(__a, (unsigned char *)__b));
11176 }
11177
11178 static __inline__ vector unsigned short __ATTRS_o_ai
11179 vec_lvlxl(int __a, const unsigned short *__b) {
11180   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
11181                   vec_lvsl(__a, __b));
11182 }
11183
11184 static __inline__ vector unsigned short __ATTRS_o_ai
11185 vec_lvlxl(int __a, const vector unsigned short *__b) {
11186   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
11187                   vec_lvsl(__a, (unsigned char *)__b));
11188 }
11189
11190 static __inline__ vector bool short __ATTRS_o_ai
11191 vec_lvlxl(int __a, const vector bool short *__b) {
11192   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
11193                   vec_lvsl(__a, (unsigned char *)__b));
11194 }
11195
11196 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
11197                                                       const vector pixel *__b) {
11198   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
11199                   vec_lvsl(__a, (unsigned char *)__b));
11200 }
11201
11202 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
11203   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
11204 }
11205
11206 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
11207                                                     const vector int *__b) {
11208   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
11209                   vec_lvsl(__a, (unsigned char *)__b));
11210 }
11211
11212 static __inline__ vector unsigned int __ATTRS_o_ai
11213 vec_lvlxl(int __a, const unsigned int *__b) {
11214   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
11215                   vec_lvsl(__a, __b));
11216 }
11217
11218 static __inline__ vector unsigned int __ATTRS_o_ai
11219 vec_lvlxl(int __a, const vector unsigned int *__b) {
11220   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
11221                   vec_lvsl(__a, (unsigned char *)__b));
11222 }
11223
11224 static __inline__ vector bool int __ATTRS_o_ai
11225 vec_lvlxl(int __a, const vector bool int *__b) {
11226   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
11227                   vec_lvsl(__a, (unsigned char *)__b));
11228 }
11229
11230 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
11231                                                       const float *__b) {
11232   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
11233 }
11234
11235 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
11236                                                       vector float *__b) {
11237   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
11238                   vec_lvsl(__a, (unsigned char *)__b));
11239 }
11240
11241 /* vec_lvrx */
11242
11243 static __inline__ vector signed char __ATTRS_o_ai
11244 vec_lvrx(int __a, const signed char *__b) {
11245   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
11246                   vec_lvsl(__a, __b));
11247 }
11248
11249 static __inline__ vector signed char __ATTRS_o_ai
11250 vec_lvrx(int __a, const vector signed char *__b) {
11251   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
11252                   vec_lvsl(__a, (unsigned char *)__b));
11253 }
11254
11255 static __inline__ vector unsigned char __ATTRS_o_ai
11256 vec_lvrx(int __a, const unsigned char *__b) {
11257   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
11258                   vec_lvsl(__a, __b));
11259 }
11260
11261 static __inline__ vector unsigned char __ATTRS_o_ai
11262 vec_lvrx(int __a, const vector unsigned char *__b) {
11263   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
11264                   vec_lvsl(__a, (unsigned char *)__b));
11265 }
11266
11267 static __inline__ vector bool char __ATTRS_o_ai
11268 vec_lvrx(int __a, const vector bool char *__b) {
11269   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
11270                   vec_lvsl(__a, (unsigned char *)__b));
11271 }
11272
11273 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
11274                                                      const short *__b) {
11275   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11276 }
11277
11278 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
11279                                                      const vector short *__b) {
11280   return vec_perm((vector short)(0), vec_ld(__a, __b),
11281                   vec_lvsl(__a, (unsigned char *)__b));
11282 }
11283
11284 static __inline__ vector unsigned short __ATTRS_o_ai
11285 vec_lvrx(int __a, const unsigned short *__b) {
11286   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
11287                   vec_lvsl(__a, __b));
11288 }
11289
11290 static __inline__ vector unsigned short __ATTRS_o_ai
11291 vec_lvrx(int __a, const vector unsigned short *__b) {
11292   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
11293                   vec_lvsl(__a, (unsigned char *)__b));
11294 }
11295
11296 static __inline__ vector bool short __ATTRS_o_ai
11297 vec_lvrx(int __a, const vector bool short *__b) {
11298   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
11299                   vec_lvsl(__a, (unsigned char *)__b));
11300 }
11301
11302 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
11303                                                      const vector pixel *__b) {
11304   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
11305                   vec_lvsl(__a, (unsigned char *)__b));
11306 }
11307
11308 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
11309   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11310 }
11311
11312 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
11313                                                    const vector int *__b) {
11314   return vec_perm((vector int)(0), vec_ld(__a, __b),
11315                   vec_lvsl(__a, (unsigned char *)__b));
11316 }
11317
11318 static __inline__ vector unsigned int __ATTRS_o_ai
11319 vec_lvrx(int __a, const unsigned int *__b) {
11320   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
11321                   vec_lvsl(__a, __b));
11322 }
11323
11324 static __inline__ vector unsigned int __ATTRS_o_ai
11325 vec_lvrx(int __a, const vector unsigned int *__b) {
11326   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
11327                   vec_lvsl(__a, (unsigned char *)__b));
11328 }
11329
11330 static __inline__ vector bool int __ATTRS_o_ai
11331 vec_lvrx(int __a, const vector bool int *__b) {
11332   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
11333                   vec_lvsl(__a, (unsigned char *)__b));
11334 }
11335
11336 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
11337                                                      const float *__b) {
11338   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
11339 }
11340
11341 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
11342                                                      const vector float *__b) {
11343   return vec_perm((vector float)(0), vec_ld(__a, __b),
11344                   vec_lvsl(__a, (unsigned char *)__b));
11345 }
11346
11347 /* vec_lvrxl */
11348
11349 static __inline__ vector signed char __ATTRS_o_ai
11350 vec_lvrxl(int __a, const signed char *__b) {
11351   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
11352                   vec_lvsl(__a, __b));
11353 }
11354
11355 static __inline__ vector signed char __ATTRS_o_ai
11356 vec_lvrxl(int __a, const vector signed char *__b) {
11357   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
11358                   vec_lvsl(__a, (unsigned char *)__b));
11359 }
11360
11361 static __inline__ vector unsigned char __ATTRS_o_ai
11362 vec_lvrxl(int __a, const unsigned char *__b) {
11363   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11364                   vec_lvsl(__a, __b));
11365 }
11366
11367 static __inline__ vector unsigned char __ATTRS_o_ai
11368 vec_lvrxl(int __a, const vector unsigned char *__b) {
11369   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11370                   vec_lvsl(__a, (unsigned char *)__b));
11371 }
11372
11373 static __inline__ vector bool char __ATTRS_o_ai
11374 vec_lvrxl(int __a, const vector bool char *__b) {
11375   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
11376                   vec_lvsl(__a, (unsigned char *)__b));
11377 }
11378
11379 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
11380                                                       const short *__b) {
11381   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11382 }
11383
11384 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
11385                                                       const vector short *__b) {
11386   return vec_perm((vector short)(0), vec_ldl(__a, __b),
11387                   vec_lvsl(__a, (unsigned char *)__b));
11388 }
11389
11390 static __inline__ vector unsigned short __ATTRS_o_ai
11391 vec_lvrxl(int __a, const unsigned short *__b) {
11392   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11393                   vec_lvsl(__a, __b));
11394 }
11395
11396 static __inline__ vector unsigned short __ATTRS_o_ai
11397 vec_lvrxl(int __a, const vector unsigned short *__b) {
11398   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11399                   vec_lvsl(__a, (unsigned char *)__b));
11400 }
11401
11402 static __inline__ vector bool short __ATTRS_o_ai
11403 vec_lvrxl(int __a, const vector bool short *__b) {
11404   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
11405                   vec_lvsl(__a, (unsigned char *)__b));
11406 }
11407
11408 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
11409                                                       const vector pixel *__b) {
11410   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
11411                   vec_lvsl(__a, (unsigned char *)__b));
11412 }
11413
11414 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
11415   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11416 }
11417
11418 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
11419                                                     const vector int *__b) {
11420   return vec_perm((vector int)(0), vec_ldl(__a, __b),
11421                   vec_lvsl(__a, (unsigned char *)__b));
11422 }
11423
11424 static __inline__ vector unsigned int __ATTRS_o_ai
11425 vec_lvrxl(int __a, const unsigned int *__b) {
11426   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11427                   vec_lvsl(__a, __b));
11428 }
11429
11430 static __inline__ vector unsigned int __ATTRS_o_ai
11431 vec_lvrxl(int __a, const vector unsigned int *__b) {
11432   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11433                   vec_lvsl(__a, (unsigned char *)__b));
11434 }
11435
11436 static __inline__ vector bool int __ATTRS_o_ai
11437 vec_lvrxl(int __a, const vector bool int *__b) {
11438   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
11439                   vec_lvsl(__a, (unsigned char *)__b));
11440 }
11441
11442 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
11443                                                       const float *__b) {
11444   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11445 }
11446
11447 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
11448                                                       const vector float *__b) {
11449   return vec_perm((vector float)(0), vec_ldl(__a, __b),
11450                   vec_lvsl(__a, (unsigned char *)__b));
11451 }
11452
11453 /* vec_stvlx */
11454
11455 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11456                                               signed char *__c) {
11457   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11458                 __c);
11459 }
11460
11461 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11462                                               vector signed char *__c) {
11463   return vec_st(
11464       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11465       __b, __c);
11466 }
11467
11468 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11469                                               unsigned char *__c) {
11470   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11471                 __c);
11472 }
11473
11474 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11475                                               vector unsigned char *__c) {
11476   return vec_st(
11477       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11478       __b, __c);
11479 }
11480
11481 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
11482                                               vector bool char *__c) {
11483   return vec_st(
11484       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11485       __b, __c);
11486 }
11487
11488 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11489                                               short *__c) {
11490   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11491                 __c);
11492 }
11493
11494 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11495                                               vector short *__c) {
11496   return vec_st(
11497       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11498       __b, __c);
11499 }
11500
11501 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
11502                                               int __b, unsigned short *__c) {
11503   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11504                 __c);
11505 }
11506
11507 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
11508                                               int __b,
11509                                               vector unsigned short *__c) {
11510   return vec_st(
11511       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11512       __b, __c);
11513 }
11514
11515 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
11516                                               vector bool short *__c) {
11517   return vec_st(
11518       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11519       __b, __c);
11520 }
11521
11522 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
11523                                               vector pixel *__c) {
11524   return vec_st(
11525       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11526       __b, __c);
11527 }
11528
11529 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
11530                                               int *__c) {
11531   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11532                 __c);
11533 }
11534
11535 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
11536                                               vector int *__c) {
11537   return vec_st(
11538       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11539       __b, __c);
11540 }
11541
11542 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11543                                               unsigned int *__c) {
11544   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11545                 __c);
11546 }
11547
11548 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11549                                               vector unsigned int *__c) {
11550   return vec_st(
11551       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11552       __b, __c);
11553 }
11554
11555 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
11556                                               vector bool int *__c) {
11557   return vec_st(
11558       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11559       __b, __c);
11560 }
11561
11562 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
11563                                               vector float *__c) {
11564   return vec_st(
11565       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11566       __b, __c);
11567 }
11568
11569 /* vec_stvlxl */
11570
11571 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11572                                                signed char *__c) {
11573   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11574                  __c);
11575 }
11576
11577 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11578                                                vector signed char *__c) {
11579   return vec_stl(
11580       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11581       __b, __c);
11582 }
11583
11584 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
11585                                                int __b, unsigned char *__c) {
11586   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11587                  __c);
11588 }
11589
11590 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
11591                                                int __b,
11592                                                vector unsigned char *__c) {
11593   return vec_stl(
11594       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11595       __b, __c);
11596 }
11597
11598 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
11599                                                vector bool char *__c) {
11600   return vec_stl(
11601       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11602       __b, __c);
11603 }
11604
11605 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11606                                                short *__c) {
11607   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11608                  __c);
11609 }
11610
11611 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11612                                                vector short *__c) {
11613   return vec_stl(
11614       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11615       __b, __c);
11616 }
11617
11618 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
11619                                                int __b, unsigned short *__c) {
11620   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11621                  __c);
11622 }
11623
11624 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
11625                                                int __b,
11626                                                vector unsigned short *__c) {
11627   return vec_stl(
11628       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11629       __b, __c);
11630 }
11631
11632 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
11633                                                vector bool short *__c) {
11634   return vec_stl(
11635       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11636       __b, __c);
11637 }
11638
11639 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
11640                                                vector pixel *__c) {
11641   return vec_stl(
11642       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11643       __b, __c);
11644 }
11645
11646 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
11647                                                int *__c) {
11648   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11649                  __c);
11650 }
11651
11652 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
11653                                                vector int *__c) {
11654   return vec_stl(
11655       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11656       __b, __c);
11657 }
11658
11659 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11660                                                unsigned int *__c) {
11661   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11662                  __c);
11663 }
11664
11665 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11666                                                vector unsigned int *__c) {
11667   return vec_stl(
11668       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11669       __b, __c);
11670 }
11671
11672 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
11673                                                vector bool int *__c) {
11674   return vec_stl(
11675       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11676       __b, __c);
11677 }
11678
11679 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
11680                                                vector float *__c) {
11681   return vec_stl(
11682       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11683       __b, __c);
11684 }
11685
11686 /* vec_stvrx */
11687
11688 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11689                                               signed char *__c) {
11690   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11691                 __c);
11692 }
11693
11694 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11695                                               vector signed char *__c) {
11696   return vec_st(
11697       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11698       __b, __c);
11699 }
11700
11701 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11702                                               unsigned char *__c) {
11703   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11704                 __c);
11705 }
11706
11707 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11708                                               vector unsigned char *__c) {
11709   return vec_st(
11710       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11711       __b, __c);
11712 }
11713
11714 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
11715                                               vector bool char *__c) {
11716   return vec_st(
11717       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11718       __b, __c);
11719 }
11720
11721 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11722                                               short *__c) {
11723   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11724                 __c);
11725 }
11726
11727 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11728                                               vector short *__c) {
11729   return vec_st(
11730       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11731       __b, __c);
11732 }
11733
11734 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
11735                                               int __b, unsigned short *__c) {
11736   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11737                 __c);
11738 }
11739
11740 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
11741                                               int __b,
11742                                               vector unsigned short *__c) {
11743   return vec_st(
11744       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11745       __b, __c);
11746 }
11747
11748 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
11749                                               vector bool short *__c) {
11750   return vec_st(
11751       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11752       __b, __c);
11753 }
11754
11755 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
11756                                               vector pixel *__c) {
11757   return vec_st(
11758       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11759       __b, __c);
11760 }
11761
11762 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
11763                                               int *__c) {
11764   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11765                 __c);
11766 }
11767
11768 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
11769                                               vector int *__c) {
11770   return vec_st(
11771       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11772       __b, __c);
11773 }
11774
11775 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11776                                               unsigned int *__c) {
11777   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11778                 __c);
11779 }
11780
11781 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11782                                               vector unsigned int *__c) {
11783   return vec_st(
11784       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11785       __b, __c);
11786 }
11787
11788 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
11789                                               vector bool int *__c) {
11790   return vec_st(
11791       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11792       __b, __c);
11793 }
11794
11795 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
11796                                               vector float *__c) {
11797   return vec_st(
11798       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11799       __b, __c);
11800 }
11801
11802 /* vec_stvrxl */
11803
11804 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11805                                                signed char *__c) {
11806   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11807                  __c);
11808 }
11809
11810 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11811                                                vector signed char *__c) {
11812   return vec_stl(
11813       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11814       __b, __c);
11815 }
11816
11817 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
11818                                                int __b, unsigned char *__c) {
11819   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11820                  __c);
11821 }
11822
11823 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
11824                                                int __b,
11825                                                vector unsigned char *__c) {
11826   return vec_stl(
11827       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11828       __b, __c);
11829 }
11830
11831 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
11832                                                vector bool char *__c) {
11833   return vec_stl(
11834       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11835       __b, __c);
11836 }
11837
11838 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11839                                                short *__c) {
11840   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11841                  __c);
11842 }
11843
11844 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11845                                                vector short *__c) {
11846   return vec_stl(
11847       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11848       __b, __c);
11849 }
11850
11851 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
11852                                                int __b, unsigned short *__c) {
11853   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11854                  __c);
11855 }
11856
11857 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
11858                                                int __b,
11859                                                vector unsigned short *__c) {
11860   return vec_stl(
11861       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11862       __b, __c);
11863 }
11864
11865 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
11866                                                vector bool short *__c) {
11867   return vec_stl(
11868       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11869       __b, __c);
11870 }
11871
11872 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
11873                                                vector pixel *__c) {
11874   return vec_stl(
11875       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11876       __b, __c);
11877 }
11878
11879 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
11880                                                int *__c) {
11881   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11882                  __c);
11883 }
11884
11885 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
11886                                                vector int *__c) {
11887   return vec_stl(
11888       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11889       __b, __c);
11890 }
11891
11892 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11893                                                unsigned int *__c) {
11894   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11895                  __c);
11896 }
11897
11898 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11899                                                vector unsigned int *__c) {
11900   return vec_stl(
11901       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11902       __b, __c);
11903 }
11904
11905 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
11906                                                vector bool int *__c) {
11907   return vec_stl(
11908       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11909       __b, __c);
11910 }
11911
11912 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
11913                                                vector float *__c) {
11914   return vec_stl(
11915       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11916       __b, __c);
11917 }
11918
11919 /* vec_promote */
11920
11921 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
11922                                                               int __b) {
11923   vector signed char __res = (vector signed char)(0);
11924   __res[__b] = __a;
11925   return __res;
11926 }
11927
11928 static __inline__ vector unsigned char __ATTRS_o_ai
11929 vec_promote(unsigned char __a, int __b) {
11930   vector unsigned char __res = (vector unsigned char)(0);
11931   __res[__b] = __a;
11932   return __res;
11933 }
11934
11935 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
11936   vector short __res = (vector short)(0);
11937   __res[__b] = __a;
11938   return __res;
11939 }
11940
11941 static __inline__ vector unsigned short __ATTRS_o_ai
11942 vec_promote(unsigned short __a, int __b) {
11943   vector unsigned short __res = (vector unsigned short)(0);
11944   __res[__b] = __a;
11945   return __res;
11946 }
11947
11948 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
11949   vector int __res = (vector int)(0);
11950   __res[__b] = __a;
11951   return __res;
11952 }
11953
11954 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
11955                                                                int __b) {
11956   vector unsigned int __res = (vector unsigned int)(0);
11957   __res[__b] = __a;
11958   return __res;
11959 }
11960
11961 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
11962   vector float __res = (vector float)(0);
11963   __res[__b] = __a;
11964   return __res;
11965 }
11966
11967 /* vec_splats */
11968
11969 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
11970   return (vector signed char)(__a);
11971 }
11972
11973 static __inline__ vector unsigned char __ATTRS_o_ai
11974 vec_splats(unsigned char __a) {
11975   return (vector unsigned char)(__a);
11976 }
11977
11978 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
11979   return (vector short)(__a);
11980 }
11981
11982 static __inline__ vector unsigned short __ATTRS_o_ai
11983 vec_splats(unsigned short __a) {
11984   return (vector unsigned short)(__a);
11985 }
11986
11987 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
11988   return (vector int)(__a);
11989 }
11990
11991 static __inline__ vector unsigned int __ATTRS_o_ai
11992 vec_splats(unsigned int __a) {
11993   return (vector unsigned int)(__a);
11994 }
11995
11996 #ifdef __VSX__
11997 static __inline__ vector signed long long __ATTRS_o_ai
11998 vec_splats(signed long long __a) {
11999   return (vector signed long long)(__a);
12000 }
12001
12002 static __inline__ vector unsigned long long __ATTRS_o_ai
12003 vec_splats(unsigned long long __a) {
12004   return (vector unsigned long long)(__a);
12005 }
12006
12007 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
12008 static __inline__ vector signed __int128 __ATTRS_o_ai
12009 vec_splats(signed __int128 __a) {
12010   return (vector signed __int128)(__a);
12011 }
12012
12013 static __inline__ vector unsigned __int128 __ATTRS_o_ai
12014 vec_splats(unsigned __int128 __a) {
12015   return (vector unsigned __int128)(__a);
12016 }
12017
12018 #endif
12019
12020 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
12021   return (vector double)(__a);
12022 }
12023 #endif
12024
12025 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
12026   return (vector float)(__a);
12027 }
12028
12029 /* ----------------------------- predicates --------------------------------- */
12030
12031 /* vec_all_eq */
12032
12033 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12034                                               vector signed char __b) {
12035   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12036                                       (vector char)__b);
12037 }
12038
12039 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
12040                                               vector bool char __b) {
12041   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12042                                       (vector char)__b);
12043 }
12044
12045 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12046                                               vector unsigned char __b) {
12047   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12048                                       (vector char)__b);
12049 }
12050
12051 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
12052                                               vector bool char __b) {
12053   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12054                                       (vector char)__b);
12055 }
12056
12057 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12058                                               vector signed char __b) {
12059   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12060                                       (vector char)__b);
12061 }
12062
12063 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12064                                               vector unsigned char __b) {
12065   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12066                                       (vector char)__b);
12067 }
12068
12069 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
12070                                               vector bool char __b) {
12071   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
12072                                       (vector char)__b);
12073 }
12074
12075 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
12076                                               vector short __b) {
12077   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
12078 }
12079
12080 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
12081                                               vector bool short __b) {
12082   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
12083 }
12084
12085 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
12086                                               vector unsigned short __b) {
12087   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12088                                       (vector short)__b);
12089 }
12090
12091 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
12092                                               vector bool short __b) {
12093   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12094                                       (vector short)__b);
12095 }
12096
12097 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12098                                               vector short __b) {
12099   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12100                                       (vector short)__b);
12101 }
12102
12103 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12104                                               vector unsigned short __b) {
12105   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12106                                       (vector short)__b);
12107 }
12108
12109 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
12110                                               vector bool short __b) {
12111   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12112                                       (vector short)__b);
12113 }
12114
12115 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
12116                                               vector pixel __b) {
12117   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
12118                                       (vector short)__b);
12119 }
12120
12121 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
12122   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
12123 }
12124
12125 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
12126                                               vector bool int __b) {
12127   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
12128 }
12129
12130 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
12131                                               vector unsigned int __b) {
12132   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12133                                       (vector int)__b);
12134 }
12135
12136 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
12137                                               vector bool int __b) {
12138   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12139                                       (vector int)__b);
12140 }
12141
12142 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12143                                               vector int __b) {
12144   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12145                                       (vector int)__b);
12146 }
12147
12148 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12149                                               vector unsigned int __b) {
12150   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12151                                       (vector int)__b);
12152 }
12153
12154 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
12155                                               vector bool int __b) {
12156   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
12157                                       (vector int)__b);
12158 }
12159
12160 #ifdef __POWER8_VECTOR__
12161 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
12162                                               vector signed long long __b) {
12163   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
12164 }
12165
12166 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
12167                                               vector bool long long __b) {
12168   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
12169 }
12170
12171 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
12172                                               vector unsigned long long __b) {
12173   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12174                                       (vector long long)__b);
12175 }
12176
12177 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
12178                                               vector bool long long __b) {
12179   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12180                                       (vector long long)__b);
12181 }
12182
12183 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12184                                               vector long long __b) {
12185   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12186                                       (vector long long)__b);
12187 }
12188
12189 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12190                                               vector unsigned long long __b) {
12191   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12192                                       (vector long long)__b);
12193 }
12194
12195 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
12196                                               vector bool long long __b) {
12197   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
12198                                       (vector long long)__b);
12199 }
12200 #endif
12201
12202 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
12203                                               vector float __b) {
12204 #ifdef __VSX__
12205   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
12206 #else
12207   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
12208 #endif
12209 }
12210
12211 #ifdef __VSX__
12212 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
12213                                               vector double __b) {
12214   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
12215 }
12216 #endif
12217
12218 /* vec_all_ge */
12219
12220 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
12221                                               vector signed char __b) {
12222   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
12223 }
12224
12225 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
12226                                               vector bool char __b) {
12227   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
12228 }
12229
12230 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
12231                                               vector unsigned char __b) {
12232   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
12233 }
12234
12235 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
12236                                               vector bool char __b) {
12237   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
12238 }
12239
12240 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12241                                               vector signed char __b) {
12242   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
12243                                       (vector unsigned char)__a);
12244 }
12245
12246 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12247                                               vector unsigned char __b) {
12248   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
12249 }
12250
12251 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
12252                                               vector bool char __b) {
12253   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
12254                                       (vector unsigned char)__a);
12255 }
12256
12257 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
12258                                               vector short __b) {
12259   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
12260 }
12261
12262 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
12263                                               vector bool short __b) {
12264   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
12265 }
12266
12267 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
12268                                               vector unsigned short __b) {
12269   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
12270 }
12271
12272 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
12273                                               vector bool short __b) {
12274   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12275                                       __a);
12276 }
12277
12278 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12279                                               vector short __b) {
12280   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12281                                       (vector unsigned short)__a);
12282 }
12283
12284 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12285                                               vector unsigned short __b) {
12286   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
12287                                       (vector unsigned short)__a);
12288 }
12289
12290 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
12291                                               vector bool short __b) {
12292   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
12293                                       (vector unsigned short)__a);
12294 }
12295
12296 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
12297   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
12298 }
12299
12300 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
12301                                               vector bool int __b) {
12302   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
12303 }
12304
12305 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
12306                                               vector unsigned int __b) {
12307   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
12308 }
12309
12310 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
12311                                               vector bool int __b) {
12312   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
12313 }
12314
12315 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12316                                               vector int __b) {
12317   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
12318                                       (vector unsigned int)__a);
12319 }
12320
12321 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12322                                               vector unsigned int __b) {
12323   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
12324 }
12325
12326 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
12327                                               vector bool int __b) {
12328   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
12329                                       (vector unsigned int)__a);
12330 }
12331
12332 #ifdef __POWER8_VECTOR__
12333 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
12334                                               vector signed long long __b) {
12335   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
12336 }
12337 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
12338                                               vector bool long long __b) {
12339   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
12340                                       __a);
12341 }
12342
12343 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
12344                                               vector unsigned long long __b) {
12345   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
12346 }
12347
12348 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
12349                                               vector bool long long __b) {
12350   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12351                                       __a);
12352 }
12353
12354 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12355                                               vector signed long long __b) {
12356   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12357                                       (vector unsigned long long)__a);
12358 }
12359
12360 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12361                                               vector unsigned long long __b) {
12362   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
12363                                       (vector unsigned long long)__a);
12364 }
12365
12366 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
12367                                               vector bool long long __b) {
12368   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
12369                                       (vector unsigned long long)__a);
12370 }
12371 #endif
12372
12373 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
12374                                               vector float __b) {
12375 #ifdef __VSX__
12376   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
12377 #else
12378   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
12379 #endif
12380 }
12381
12382 #ifdef __VSX__
12383 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
12384                                               vector double __b) {
12385   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
12386 }
12387 #endif
12388
12389 /* vec_all_gt */
12390
12391 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
12392                                               vector signed char __b) {
12393   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
12394 }
12395
12396 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
12397                                               vector bool char __b) {
12398   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
12399 }
12400
12401 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
12402                                               vector unsigned char __b) {
12403   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
12404 }
12405
12406 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
12407                                               vector bool char __b) {
12408   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
12409 }
12410
12411 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12412                                               vector signed char __b) {
12413   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
12414                                       (vector unsigned char)__b);
12415 }
12416
12417 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12418                                               vector unsigned char __b) {
12419   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
12420 }
12421
12422 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12423                                               vector bool char __b) {
12424   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
12425                                       (vector unsigned char)__b);
12426 }
12427
12428 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
12429                                               vector short __b) {
12430   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
12431 }
12432
12433 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
12434                                               vector bool short __b) {
12435   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
12436 }
12437
12438 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12439                                               vector unsigned short __b) {
12440   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
12441 }
12442
12443 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12444                                               vector bool short __b) {
12445   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
12446                                       (vector unsigned short)__b);
12447 }
12448
12449 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12450                                               vector short __b) {
12451   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12452                                       (vector unsigned short)__b);
12453 }
12454
12455 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12456                                               vector unsigned short __b) {
12457   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12458                                       __b);
12459 }
12460
12461 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12462                                               vector bool short __b) {
12463   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12464                                       (vector unsigned short)__b);
12465 }
12466
12467 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
12468   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
12469 }
12470
12471 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
12472                                               vector bool int __b) {
12473   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
12474 }
12475
12476 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12477                                               vector unsigned int __b) {
12478   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
12479 }
12480
12481 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12482                                               vector bool int __b) {
12483   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
12484 }
12485
12486 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12487                                               vector int __b) {
12488   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12489                                       (vector unsigned int)__b);
12490 }
12491
12492 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12493                                               vector unsigned int __b) {
12494   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
12495 }
12496
12497 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12498                                               vector bool int __b) {
12499   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12500                                       (vector unsigned int)__b);
12501 }
12502
12503 #ifdef __POWER8_VECTOR__
12504 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12505                                               vector signed long long __b) {
12506   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
12507 }
12508 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12509                                               vector bool long long __b) {
12510   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
12511                                       (vector signed long long)__b);
12512 }
12513
12514 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12515                                               vector unsigned long long __b) {
12516   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
12517 }
12518
12519 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12520                                               vector bool long long __b) {
12521   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
12522                                       (vector unsigned long long)__b);
12523 }
12524
12525 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12526                                               vector signed long long __b) {
12527   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12528                                       (vector unsigned long long)__b);
12529 }
12530
12531 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12532                                               vector unsigned long long __b) {
12533   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12534                                       __b);
12535 }
12536
12537 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12538                                               vector bool long long __b) {
12539   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12540                                       (vector unsigned long long)__b);
12541 }
12542 #endif
12543
12544 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
12545                                               vector float __b) {
12546 #ifdef __VSX__
12547   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
12548 #else
12549   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
12550 #endif
12551 }
12552
12553 #ifdef __VSX__
12554 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
12555                                               vector double __b) {
12556   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
12557 }
12558 #endif
12559
12560 /* vec_all_in */
12561
12562 static __inline__ int __attribute__((__always_inline__))
12563 vec_all_in(vector float __a, vector float __b) {
12564   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
12565 }
12566
12567 /* vec_all_le */
12568
12569 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
12570                                               vector signed char __b) {
12571   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
12572 }
12573
12574 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
12575                                               vector bool char __b) {
12576   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
12577 }
12578
12579 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12580                                               vector unsigned char __b) {
12581   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
12582 }
12583
12584 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12585                                               vector bool char __b) {
12586   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
12587 }
12588
12589 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12590                                               vector signed char __b) {
12591   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12592                                       (vector unsigned char)__b);
12593 }
12594
12595 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12596                                               vector unsigned char __b) {
12597   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
12598 }
12599
12600 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
12601                                               vector bool char __b) {
12602   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12603                                       (vector unsigned char)__b);
12604 }
12605
12606 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
12607                                               vector short __b) {
12608   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
12609 }
12610
12611 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
12612                                               vector bool short __b) {
12613   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
12614 }
12615
12616 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12617                                               vector unsigned short __b) {
12618   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
12619 }
12620
12621 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12622                                               vector bool short __b) {
12623   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
12624                                       (vector unsigned short)__b);
12625 }
12626
12627 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12628                                               vector short __b) {
12629   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12630                                       (vector unsigned short)__b);
12631 }
12632
12633 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12634                                               vector unsigned short __b) {
12635   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12636                                       __b);
12637 }
12638
12639 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
12640                                               vector bool short __b) {
12641   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12642                                       (vector unsigned short)__b);
12643 }
12644
12645 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
12646   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
12647 }
12648
12649 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
12650                                               vector bool int __b) {
12651   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
12652 }
12653
12654 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12655                                               vector unsigned int __b) {
12656   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
12657 }
12658
12659 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12660                                               vector bool int __b) {
12661   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
12662 }
12663
12664 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12665                                               vector int __b) {
12666   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12667                                       (vector unsigned int)__b);
12668 }
12669
12670 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12671                                               vector unsigned int __b) {
12672   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
12673 }
12674
12675 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
12676                                               vector bool int __b) {
12677   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12678                                       (vector unsigned int)__b);
12679 }
12680
12681 #ifdef __POWER8_VECTOR__
12682 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12683                                               vector signed long long __b) {
12684   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
12685 }
12686
12687 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12688                                               vector unsigned long long __b) {
12689   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
12690 }
12691
12692 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12693                                               vector bool long long __b) {
12694   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
12695                                       (vector signed long long)__b);
12696 }
12697
12698 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12699                                               vector bool long long __b) {
12700   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
12701                                       (vector unsigned long long)__b);
12702 }
12703
12704 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12705                                               vector signed long long __b) {
12706   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12707                                       (vector unsigned long long)__b);
12708 }
12709
12710 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12711                                               vector unsigned long long __b) {
12712   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12713                                       __b);
12714 }
12715
12716 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12717                                               vector bool long long __b) {
12718   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12719                                       (vector unsigned long long)__b);
12720 }
12721 #endif
12722
12723 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
12724                                               vector float __b) {
12725 #ifdef __VSX__
12726   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
12727 #else
12728   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
12729 #endif
12730 }
12731
12732 #ifdef __VSX__
12733 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
12734                                               vector double __b) {
12735   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
12736 }
12737 #endif
12738
12739 /* vec_all_lt */
12740
12741 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12742                                               vector signed char __b) {
12743   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
12744 }
12745
12746 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12747                                               vector bool char __b) {
12748   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
12749 }
12750
12751 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12752                                               vector unsigned char __b) {
12753   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
12754 }
12755
12756 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12757                                               vector bool char __b) {
12758   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
12759 }
12760
12761 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12762                                               vector signed char __b) {
12763   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12764                                       (vector unsigned char)__a);
12765 }
12766
12767 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12768                                               vector unsigned char __b) {
12769   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
12770 }
12771
12772 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12773                                               vector bool char __b) {
12774   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12775                                       (vector unsigned char)__a);
12776 }
12777
12778 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
12779                                               vector short __b) {
12780   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
12781 }
12782
12783 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
12784                                               vector bool short __b) {
12785   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
12786 }
12787
12788 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12789                                               vector unsigned short __b) {
12790   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
12791 }
12792
12793 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12794                                               vector bool short __b) {
12795   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12796                                       __a);
12797 }
12798
12799 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12800                                               vector short __b) {
12801   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12802                                       (vector unsigned short)__a);
12803 }
12804
12805 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12806                                               vector unsigned short __b) {
12807   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
12808                                       (vector unsigned short)__a);
12809 }
12810
12811 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12812                                               vector bool short __b) {
12813   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12814                                       (vector unsigned short)__a);
12815 }
12816
12817 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
12818   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
12819 }
12820
12821 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
12822                                               vector bool int __b) {
12823   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
12824 }
12825
12826 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12827                                               vector unsigned int __b) {
12828   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
12829 }
12830
12831 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12832                                               vector bool int __b) {
12833   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
12834 }
12835
12836 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12837                                               vector int __b) {
12838   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12839                                       (vector unsigned int)__a);
12840 }
12841
12842 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12843                                               vector unsigned int __b) {
12844   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
12845 }
12846
12847 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12848                                               vector bool int __b) {
12849   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12850                                       (vector unsigned int)__a);
12851 }
12852
12853 #ifdef __POWER8_VECTOR__
12854 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12855                                               vector signed long long __b) {
12856   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12857 }
12858
12859 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12860                                               vector unsigned long long __b) {
12861   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12862 }
12863
12864 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12865                                               vector bool long long __b) {
12866   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12867                                       __a);
12868 }
12869
12870 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12871                                               vector bool long long __b) {
12872   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12873                                       __a);
12874 }
12875
12876 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12877                                               vector signed long long __b) {
12878   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12879                                       (vector unsigned long long)__a);
12880 }
12881
12882 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12883                                               vector unsigned long long __b) {
12884   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12885                                       (vector unsigned long long)__a);
12886 }
12887
12888 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12889                                               vector bool long long __b) {
12890   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12891                                       (vector unsigned long long)__a);
12892 }
12893 #endif
12894
12895 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
12896                                               vector float __b) {
12897 #ifdef __VSX__
12898   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
12899 #else
12900   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
12901 #endif
12902 }
12903
12904 #ifdef __VSX__
12905 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
12906                                               vector double __b) {
12907   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
12908 }
12909 #endif
12910
12911 /* vec_all_nan */
12912
12913 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
12914 #ifdef __VSX__
12915   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
12916 #else
12917   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
12918 #endif
12919 }
12920
12921 #ifdef __VSX__
12922 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
12923   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
12924 }
12925 #endif
12926
12927 /* vec_all_ne */
12928
12929 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12930                                               vector signed char __b) {
12931   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12932                                       (vector char)__b);
12933 }
12934
12935 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12936                                               vector bool char __b) {
12937   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12938                                       (vector char)__b);
12939 }
12940
12941 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12942                                               vector unsigned char __b) {
12943   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12944                                       (vector char)__b);
12945 }
12946
12947 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12948                                               vector bool char __b) {
12949   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12950                                       (vector char)__b);
12951 }
12952
12953 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12954                                               vector signed char __b) {
12955   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12956                                       (vector char)__b);
12957 }
12958
12959 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12960                                               vector unsigned char __b) {
12961   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12962                                       (vector char)__b);
12963 }
12964
12965 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12966                                               vector bool char __b) {
12967   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12968                                       (vector char)__b);
12969 }
12970
12971 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
12972                                               vector short __b) {
12973   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
12974 }
12975
12976 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
12977                                               vector bool short __b) {
12978   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
12979 }
12980
12981 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12982                                               vector unsigned short __b) {
12983   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12984                                       (vector short)__b);
12985 }
12986
12987 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12988                                               vector bool short __b) {
12989   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12990                                       (vector short)__b);
12991 }
12992
12993 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12994                                               vector short __b) {
12995   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12996                                       (vector short)__b);
12997 }
12998
12999 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13000                                               vector unsigned short __b) {
13001   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13002                                       (vector short)__b);
13003 }
13004
13005 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
13006                                               vector bool short __b) {
13007   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13008                                       (vector short)__b);
13009 }
13010
13011 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
13012                                               vector pixel __b) {
13013   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
13014                                       (vector short)__b);
13015 }
13016
13017 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
13018   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
13019 }
13020
13021 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
13022                                               vector bool int __b) {
13023   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
13024 }
13025
13026 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13027                                               vector unsigned int __b) {
13028   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13029                                       (vector int)__b);
13030 }
13031
13032 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
13033                                               vector bool int __b) {
13034   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13035                                       (vector int)__b);
13036 }
13037
13038 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13039                                               vector int __b) {
13040   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13041                                       (vector int)__b);
13042 }
13043
13044 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13045                                               vector unsigned int __b) {
13046   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13047                                       (vector int)__b);
13048 }
13049
13050 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
13051                                               vector bool int __b) {
13052   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
13053                                       (vector int)__b);
13054 }
13055
13056 #ifdef __POWER8_VECTOR__
13057 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
13058                                               vector signed long long __b) {
13059   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
13060 }
13061
13062 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
13063                                               vector unsigned long long __b) {
13064   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
13065                                       (vector long long)__b);
13066 }
13067
13068 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
13069                                               vector bool long long __b) {
13070   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
13071                                       (vector signed long long)__b);
13072 }
13073
13074 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
13075                                               vector bool long long __b) {
13076   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13077                                       (vector signed long long)__b);
13078 }
13079
13080 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13081                                               vector signed long long __b) {
13082   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13083                                       (vector signed long long)__b);
13084 }
13085
13086 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13087                                               vector unsigned long long __b) {
13088   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13089                                       (vector signed long long)__b);
13090 }
13091
13092 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
13093                                               vector bool long long __b) {
13094   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
13095                                       (vector signed long long)__b);
13096 }
13097 #endif
13098
13099 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
13100                                               vector float __b) {
13101 #ifdef __VSX__
13102   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
13103 #else
13104   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
13105 #endif
13106 }
13107
13108 #ifdef __VSX__
13109 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
13110                                               vector double __b) {
13111   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
13112 }
13113 #endif
13114
13115 /* vec_all_nge */
13116
13117 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
13118                                                vector float __b) {
13119 #ifdef __VSX__
13120   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
13121 #else
13122   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
13123 #endif
13124 }
13125
13126 #ifdef __VSX__
13127 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
13128                                                vector double __b) {
13129   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
13130 }
13131 #endif
13132
13133 /* vec_all_ngt */
13134
13135 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
13136                                                vector float __b) {
13137 #ifdef __VSX__
13138   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
13139 #else
13140   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
13141 #endif
13142 }
13143
13144 #ifdef __VSX__
13145 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
13146                                                vector double __b) {
13147   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
13148 }
13149 #endif
13150
13151 /* vec_all_nle */
13152
13153 static __inline__ int __attribute__((__always_inline__))
13154 vec_all_nle(vector float __a, vector float __b) {
13155   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
13156 }
13157
13158 /* vec_all_nlt */
13159
13160 static __inline__ int __attribute__((__always_inline__))
13161 vec_all_nlt(vector float __a, vector float __b) {
13162   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
13163 }
13164
13165 /* vec_all_numeric */
13166
13167 static __inline__ int __attribute__((__always_inline__))
13168 vec_all_numeric(vector float __a) {
13169   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
13170 }
13171
13172 /* vec_any_eq */
13173
13174 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
13175                                               vector signed char __b) {
13176   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13177                                       (vector char)__b);
13178 }
13179
13180 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
13181                                               vector bool char __b) {
13182   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13183                                       (vector char)__b);
13184 }
13185
13186 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
13187                                               vector unsigned char __b) {
13188   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13189                                       (vector char)__b);
13190 }
13191
13192 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
13193                                               vector bool char __b) {
13194   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13195                                       (vector char)__b);
13196 }
13197
13198 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13199                                               vector signed char __b) {
13200   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13201                                       (vector char)__b);
13202 }
13203
13204 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13205                                               vector unsigned char __b) {
13206   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13207                                       (vector char)__b);
13208 }
13209
13210 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
13211                                               vector bool char __b) {
13212   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
13213                                       (vector char)__b);
13214 }
13215
13216 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
13217                                               vector short __b) {
13218   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
13219 }
13220
13221 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
13222                                               vector bool short __b) {
13223   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
13224 }
13225
13226 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
13227                                               vector unsigned short __b) {
13228   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13229                                       (vector short)__b);
13230 }
13231
13232 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
13233                                               vector bool short __b) {
13234   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13235                                       (vector short)__b);
13236 }
13237
13238 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13239                                               vector short __b) {
13240   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13241                                       (vector short)__b);
13242 }
13243
13244 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13245                                               vector unsigned short __b) {
13246   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13247                                       (vector short)__b);
13248 }
13249
13250 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
13251                                               vector bool short __b) {
13252   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13253                                       (vector short)__b);
13254 }
13255
13256 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
13257                                               vector pixel __b) {
13258   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
13259                                       (vector short)__b);
13260 }
13261
13262 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
13263   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
13264 }
13265
13266 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
13267                                               vector bool int __b) {
13268   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
13269 }
13270
13271 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
13272                                               vector unsigned int __b) {
13273   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13274                                       (vector int)__b);
13275 }
13276
13277 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
13278                                               vector bool int __b) {
13279   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13280                                       (vector int)__b);
13281 }
13282
13283 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13284                                               vector int __b) {
13285   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13286                                       (vector int)__b);
13287 }
13288
13289 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13290                                               vector unsigned int __b) {
13291   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13292                                       (vector int)__b);
13293 }
13294
13295 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
13296                                               vector bool int __b) {
13297   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
13298                                       (vector int)__b);
13299 }
13300
13301 #ifdef __POWER8_VECTOR__
13302 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
13303                                               vector signed long long __b) {
13304   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
13305 }
13306
13307 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
13308                                               vector unsigned long long __b) {
13309   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
13310                                       (vector long long)__b);
13311 }
13312
13313 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
13314                                               vector bool long long __b) {
13315   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
13316                                       (vector signed long long)__b);
13317 }
13318
13319 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
13320                                               vector bool long long __b) {
13321   return __builtin_altivec_vcmpequd_p(
13322       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13323 }
13324
13325 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13326                                               vector signed long long __b) {
13327   return __builtin_altivec_vcmpequd_p(
13328       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13329 }
13330
13331 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13332                                               vector unsigned long long __b) {
13333   return __builtin_altivec_vcmpequd_p(
13334       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13335 }
13336
13337 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
13338                                               vector bool long long __b) {
13339   return __builtin_altivec_vcmpequd_p(
13340       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
13341 }
13342 #endif
13343
13344 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
13345                                               vector float __b) {
13346 #ifdef __VSX__
13347   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
13348 #else
13349   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
13350 #endif
13351 }
13352
13353 #ifdef __VSX__
13354 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
13355                                               vector double __b) {
13356   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
13357 }
13358 #endif
13359
13360 /* vec_any_ge */
13361
13362 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
13363                                               vector signed char __b) {
13364   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
13365 }
13366
13367 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
13368                                               vector bool char __b) {
13369   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
13370                                       __a);
13371 }
13372
13373 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
13374                                               vector unsigned char __b) {
13375   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
13376 }
13377
13378 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
13379                                               vector bool char __b) {
13380   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13381                                       __a);
13382 }
13383
13384 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13385                                               vector signed char __b) {
13386   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13387                                       (vector unsigned char)__a);
13388 }
13389
13390 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13391                                               vector unsigned char __b) {
13392   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
13393                                       (vector unsigned char)__a);
13394 }
13395
13396 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
13397                                               vector bool char __b) {
13398   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
13399                                       (vector unsigned char)__a);
13400 }
13401
13402 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
13403                                               vector short __b) {
13404   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
13405 }
13406
13407 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
13408                                               vector bool short __b) {
13409   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
13410 }
13411
13412 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
13413                                               vector unsigned short __b) {
13414   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
13415 }
13416
13417 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
13418                                               vector bool short __b) {
13419   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13420                                       __a);
13421 }
13422
13423 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13424                                               vector short __b) {
13425   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13426                                       (vector unsigned short)__a);
13427 }
13428
13429 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13430                                               vector unsigned short __b) {
13431   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
13432                                       (vector unsigned short)__a);
13433 }
13434
13435 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
13436                                               vector bool short __b) {
13437   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
13438                                       (vector unsigned short)__a);
13439 }
13440
13441 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
13442   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
13443 }
13444
13445 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
13446                                               vector bool int __b) {
13447   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
13448 }
13449
13450 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
13451                                               vector unsigned int __b) {
13452   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
13453 }
13454
13455 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
13456                                               vector bool int __b) {
13457   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13458                                       __a);
13459 }
13460
13461 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13462                                               vector int __b) {
13463   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13464                                       (vector unsigned int)__a);
13465 }
13466
13467 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13468                                               vector unsigned int __b) {
13469   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
13470                                       (vector unsigned int)__a);
13471 }
13472
13473 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
13474                                               vector bool int __b) {
13475   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13476                                       (vector unsigned int)__a);
13477 }
13478
13479 #ifdef __POWER8_VECTOR__
13480 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13481                                               vector signed long long __b) {
13482   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
13483 }
13484
13485 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13486                                               vector unsigned long long __b) {
13487   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
13488 }
13489
13490 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13491                                               vector bool long long __b) {
13492   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
13493                                       (vector signed long long)__b, __a);
13494 }
13495
13496 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13497                                               vector bool long long __b) {
13498   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13499                                       (vector unsigned long long)__b, __a);
13500 }
13501
13502 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13503                                               vector signed long long __b) {
13504   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13505                                       (vector unsigned long long)__b,
13506                                       (vector unsigned long long)__a);
13507 }
13508
13509 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13510                                               vector unsigned long long __b) {
13511   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
13512                                       (vector unsigned long long)__a);
13513 }
13514
13515 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13516                                               vector bool long long __b) {
13517   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13518                                       (vector unsigned long long)__b,
13519                                       (vector unsigned long long)__a);
13520 }
13521 #endif
13522
13523 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
13524                                               vector float __b) {
13525 #ifdef __VSX__
13526   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
13527 #else
13528   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
13529 #endif
13530 }
13531
13532 #ifdef __VSX__
13533 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
13534                                               vector double __b) {
13535   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
13536 }
13537 #endif
13538
13539 /* vec_any_gt */
13540
13541 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13542                                               vector signed char __b) {
13543   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
13544 }
13545
13546 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13547                                               vector bool char __b) {
13548   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
13549                                       (vector signed char)__b);
13550 }
13551
13552 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13553                                               vector unsigned char __b) {
13554   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
13555 }
13556
13557 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13558                                               vector bool char __b) {
13559   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
13560                                       (vector unsigned char)__b);
13561 }
13562
13563 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13564                                               vector signed char __b) {
13565   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13566                                       (vector unsigned char)__b);
13567 }
13568
13569 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13570                                               vector unsigned char __b) {
13571   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13572                                       __b);
13573 }
13574
13575 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13576                                               vector bool char __b) {
13577   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13578                                       (vector unsigned char)__b);
13579 }
13580
13581 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
13582                                               vector short __b) {
13583   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
13584 }
13585
13586 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
13587                                               vector bool short __b) {
13588   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
13589 }
13590
13591 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13592                                               vector unsigned short __b) {
13593   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
13594 }
13595
13596 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13597                                               vector bool short __b) {
13598   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
13599                                       (vector unsigned short)__b);
13600 }
13601
13602 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13603                                               vector short __b) {
13604   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13605                                       (vector unsigned short)__b);
13606 }
13607
13608 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13609                                               vector unsigned short __b) {
13610   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13611                                       __b);
13612 }
13613
13614 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13615                                               vector bool short __b) {
13616   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13617                                       (vector unsigned short)__b);
13618 }
13619
13620 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
13621   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
13622 }
13623
13624 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
13625                                               vector bool int __b) {
13626   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
13627 }
13628
13629 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13630                                               vector unsigned int __b) {
13631   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
13632 }
13633
13634 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13635                                               vector bool int __b) {
13636   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
13637                                       (vector unsigned int)__b);
13638 }
13639
13640 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13641                                               vector int __b) {
13642   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13643                                       (vector unsigned int)__b);
13644 }
13645
13646 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13647                                               vector unsigned int __b) {
13648   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13649                                       __b);
13650 }
13651
13652 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13653                                               vector bool int __b) {
13654   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13655                                       (vector unsigned int)__b);
13656 }
13657
13658 #ifdef __POWER8_VECTOR__
13659 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13660                                               vector signed long long __b) {
13661   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
13662 }
13663
13664 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13665                                               vector unsigned long long __b) {
13666   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
13667 }
13668
13669 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13670                                               vector bool long long __b) {
13671   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
13672                                       (vector signed long long)__b);
13673 }
13674
13675 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13676                                               vector bool long long __b) {
13677   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
13678                                       (vector unsigned long long)__b);
13679 }
13680
13681 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13682                                               vector signed long long __b) {
13683   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13684                                       (vector unsigned long long)__a,
13685                                       (vector unsigned long long)__b);
13686 }
13687
13688 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13689                                               vector unsigned long long __b) {
13690   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13691                                       (vector unsigned long long)__a, __b);
13692 }
13693
13694 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13695                                               vector bool long long __b) {
13696   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13697                                       (vector unsigned long long)__a,
13698                                       (vector unsigned long long)__b);
13699 }
13700 #endif
13701
13702 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
13703                                               vector float __b) {
13704 #ifdef __VSX__
13705   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
13706 #else
13707   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
13708 #endif
13709 }
13710
13711 #ifdef __VSX__
13712 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
13713                                               vector double __b) {
13714   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
13715 }
13716 #endif
13717
13718 /* vec_any_le */
13719
13720 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
13721                                               vector signed char __b) {
13722   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
13723 }
13724
13725 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
13726                                               vector bool char __b) {
13727   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
13728                                       (vector signed char)__b);
13729 }
13730
13731 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13732                                               vector unsigned char __b) {
13733   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
13734 }
13735
13736 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13737                                               vector bool char __b) {
13738   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
13739                                       (vector unsigned char)__b);
13740 }
13741
13742 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13743                                               vector signed char __b) {
13744   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13745                                       (vector unsigned char)__b);
13746 }
13747
13748 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13749                                               vector unsigned char __b) {
13750   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13751                                       __b);
13752 }
13753
13754 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
13755                                               vector bool char __b) {
13756   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13757                                       (vector unsigned char)__b);
13758 }
13759
13760 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
13761                                               vector short __b) {
13762   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
13763 }
13764
13765 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
13766                                               vector bool short __b) {
13767   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
13768 }
13769
13770 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13771                                               vector unsigned short __b) {
13772   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
13773 }
13774
13775 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13776                                               vector bool short __b) {
13777   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
13778                                       (vector unsigned short)__b);
13779 }
13780
13781 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13782                                               vector short __b) {
13783   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13784                                       (vector unsigned short)__b);
13785 }
13786
13787 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13788                                               vector unsigned short __b) {
13789   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13790                                       __b);
13791 }
13792
13793 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
13794                                               vector bool short __b) {
13795   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13796                                       (vector unsigned short)__b);
13797 }
13798
13799 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
13800   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
13801 }
13802
13803 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
13804                                               vector bool int __b) {
13805   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
13806 }
13807
13808 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13809                                               vector unsigned int __b) {
13810   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
13811 }
13812
13813 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13814                                               vector bool int __b) {
13815   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
13816                                       (vector unsigned int)__b);
13817 }
13818
13819 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13820                                               vector int __b) {
13821   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13822                                       (vector unsigned int)__b);
13823 }
13824
13825 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13826                                               vector unsigned int __b) {
13827   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13828                                       __b);
13829 }
13830
13831 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
13832                                               vector bool int __b) {
13833   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13834                                       (vector unsigned int)__b);
13835 }
13836
13837 #ifdef __POWER8_VECTOR__
13838 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13839                                               vector signed long long __b) {
13840   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13841 }
13842
13843 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13844                                               vector unsigned long long __b) {
13845   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13846 }
13847
13848 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13849                                               vector bool long long __b) {
13850   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13851                                       (vector signed long long)__b);
13852 }
13853
13854 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13855                                               vector bool long long __b) {
13856   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13857                                       (vector unsigned long long)__b);
13858 }
13859
13860 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13861                                               vector signed long long __b) {
13862   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13863                                       (vector unsigned long long)__a,
13864                                       (vector unsigned long long)__b);
13865 }
13866
13867 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13868                                               vector unsigned long long __b) {
13869   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13870                                       (vector unsigned long long)__a, __b);
13871 }
13872
13873 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13874                                               vector bool long long __b) {
13875   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13876                                       (vector unsigned long long)__a,
13877                                       (vector unsigned long long)__b);
13878 }
13879 #endif
13880
13881 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
13882                                               vector float __b) {
13883 #ifdef __VSX__
13884   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
13885 #else
13886   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
13887 #endif
13888 }
13889
13890 #ifdef __VSX__
13891 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
13892                                               vector double __b) {
13893   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
13894 }
13895 #endif
13896
13897 /* vec_any_lt */
13898
13899 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13900                                               vector signed char __b) {
13901   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
13902 }
13903
13904 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13905                                               vector bool char __b) {
13906   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
13907                                       __a);
13908 }
13909
13910 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13911                                               vector unsigned char __b) {
13912   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
13913 }
13914
13915 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13916                                               vector bool char __b) {
13917   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13918                                       __a);
13919 }
13920
13921 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13922                                               vector signed char __b) {
13923   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13924                                       (vector unsigned char)__a);
13925 }
13926
13927 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13928                                               vector unsigned char __b) {
13929   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
13930                                       (vector unsigned char)__a);
13931 }
13932
13933 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13934                                               vector bool char __b) {
13935   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13936                                       (vector unsigned char)__a);
13937 }
13938
13939 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
13940                                               vector short __b) {
13941   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
13942 }
13943
13944 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
13945                                               vector bool short __b) {
13946   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
13947 }
13948
13949 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13950                                               vector unsigned short __b) {
13951   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
13952 }
13953
13954 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13955                                               vector bool short __b) {
13956   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13957                                       __a);
13958 }
13959
13960 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13961                                               vector short __b) {
13962   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13963                                       (vector unsigned short)__a);
13964 }
13965
13966 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13967                                               vector unsigned short __b) {
13968   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
13969                                       (vector unsigned short)__a);
13970 }
13971
13972 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13973                                               vector bool short __b) {
13974   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13975                                       (vector unsigned short)__a);
13976 }
13977
13978 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
13979   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
13980 }
13981
13982 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
13983                                               vector bool int __b) {
13984   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
13985 }
13986
13987 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13988                                               vector unsigned int __b) {
13989   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
13990 }
13991
13992 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13993                                               vector bool int __b) {
13994   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13995                                       __a);
13996 }
13997
13998 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
13999                                               vector int __b) {
14000   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14001                                       (vector unsigned int)__a);
14002 }
14003
14004 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14005                                               vector unsigned int __b) {
14006   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
14007                                       (vector unsigned int)__a);
14008 }
14009
14010 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
14011                                               vector bool int __b) {
14012   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
14013                                       (vector unsigned int)__a);
14014 }
14015
14016 #ifdef __POWER8_VECTOR__
14017 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14018                                               vector signed long long __b) {
14019   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
14020 }
14021
14022 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14023                                               vector unsigned long long __b) {
14024   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
14025 }
14026
14027 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
14028                                               vector bool long long __b) {
14029   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
14030                                       (vector signed long long)__b, __a);
14031 }
14032
14033 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
14034                                               vector bool long long __b) {
14035   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14036                                       (vector unsigned long long)__b, __a);
14037 }
14038
14039 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14040                                               vector signed long long __b) {
14041   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14042                                       (vector unsigned long long)__b,
14043                                       (vector unsigned long long)__a);
14044 }
14045
14046 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14047                                               vector unsigned long long __b) {
14048   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
14049                                       (vector unsigned long long)__a);
14050 }
14051
14052 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
14053                                               vector bool long long __b) {
14054   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
14055                                       (vector unsigned long long)__b,
14056                                       (vector unsigned long long)__a);
14057 }
14058 #endif
14059
14060 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
14061                                               vector float __b) {
14062 #ifdef __VSX__
14063   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
14064 #else
14065   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
14066 #endif
14067 }
14068
14069 #ifdef __VSX__
14070 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
14071                                               vector double __b) {
14072   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
14073 }
14074 #endif
14075
14076 /* vec_any_nan */
14077
14078 static __inline__ int __attribute__((__always_inline__))
14079 vec_any_nan(vector float __a) {
14080   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
14081 }
14082
14083 /* vec_any_ne */
14084
14085 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
14086                                               vector signed char __b) {
14087   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14088                                       (vector char)__b);
14089 }
14090
14091 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
14092                                               vector bool char __b) {
14093   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14094                                       (vector char)__b);
14095 }
14096
14097 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
14098                                               vector unsigned char __b) {
14099   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14100                                       (vector char)__b);
14101 }
14102
14103 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
14104                                               vector bool char __b) {
14105   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14106                                       (vector char)__b);
14107 }
14108
14109 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14110                                               vector signed char __b) {
14111   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14112                                       (vector char)__b);
14113 }
14114
14115 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14116                                               vector unsigned char __b) {
14117   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14118                                       (vector char)__b);
14119 }
14120
14121 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
14122                                               vector bool char __b) {
14123   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
14124                                       (vector char)__b);
14125 }
14126
14127 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
14128                                               vector short __b) {
14129   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
14130 }
14131
14132 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
14133                                               vector bool short __b) {
14134   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
14135 }
14136
14137 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
14138                                               vector unsigned short __b) {
14139   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14140                                       (vector short)__b);
14141 }
14142
14143 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
14144                                               vector bool short __b) {
14145   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14146                                       (vector short)__b);
14147 }
14148
14149 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14150                                               vector short __b) {
14151   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14152                                       (vector short)__b);
14153 }
14154
14155 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14156                                               vector unsigned short __b) {
14157   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14158                                       (vector short)__b);
14159 }
14160
14161 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
14162                                               vector bool short __b) {
14163   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14164                                       (vector short)__b);
14165 }
14166
14167 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
14168                                               vector pixel __b) {
14169   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
14170                                       (vector short)__b);
14171 }
14172
14173 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
14174   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
14175 }
14176
14177 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
14178                                               vector bool int __b) {
14179   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
14180 }
14181
14182 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
14183                                               vector unsigned int __b) {
14184   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14185                                       (vector int)__b);
14186 }
14187
14188 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
14189                                               vector bool int __b) {
14190   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14191                                       (vector int)__b);
14192 }
14193
14194 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14195                                               vector int __b) {
14196   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14197                                       (vector int)__b);
14198 }
14199
14200 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14201                                               vector unsigned int __b) {
14202   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14203                                       (vector int)__b);
14204 }
14205
14206 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
14207                                               vector bool int __b) {
14208   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
14209                                       (vector int)__b);
14210 }
14211
14212 #ifdef __POWER8_VECTOR__
14213 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
14214                                               vector signed long long __b) {
14215   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
14216 }
14217
14218 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
14219                                               vector unsigned long long __b) {
14220   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
14221                                       (vector long long)__b);
14222 }
14223
14224 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
14225                                               vector bool long long __b) {
14226   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
14227                                       (vector signed long long)__b);
14228 }
14229
14230 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
14231                                               vector bool long long __b) {
14232   return __builtin_altivec_vcmpequd_p(
14233       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14234 }
14235
14236 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14237                                               vector signed long long __b) {
14238   return __builtin_altivec_vcmpequd_p(
14239       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14240 }
14241
14242 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14243                                               vector unsigned long long __b) {
14244   return __builtin_altivec_vcmpequd_p(
14245       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14246 }
14247
14248 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
14249                                               vector bool long long __b) {
14250   return __builtin_altivec_vcmpequd_p(
14251       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
14252 }
14253 #endif
14254
14255 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
14256                                               vector float __b) {
14257 #ifdef __VSX__
14258   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
14259 #else
14260   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
14261 #endif
14262 }
14263
14264 #ifdef __VSX__
14265 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
14266                                               vector double __b) {
14267   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
14268 }
14269 #endif
14270
14271 /* vec_any_nge */
14272
14273 static __inline__ int __attribute__((__always_inline__))
14274 vec_any_nge(vector float __a, vector float __b) {
14275   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
14276 }
14277
14278 /* vec_any_ngt */
14279
14280 static __inline__ int __attribute__((__always_inline__))
14281 vec_any_ngt(vector float __a, vector float __b) {
14282   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
14283 }
14284
14285 /* vec_any_nle */
14286
14287 static __inline__ int __attribute__((__always_inline__))
14288 vec_any_nle(vector float __a, vector float __b) {
14289   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
14290 }
14291
14292 /* vec_any_nlt */
14293
14294 static __inline__ int __attribute__((__always_inline__))
14295 vec_any_nlt(vector float __a, vector float __b) {
14296   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
14297 }
14298
14299 /* vec_any_numeric */
14300
14301 static __inline__ int __attribute__((__always_inline__))
14302 vec_any_numeric(vector float __a) {
14303   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
14304 }
14305
14306 /* vec_any_out */
14307
14308 static __inline__ int __attribute__((__always_inline__))
14309 vec_any_out(vector float __a, vector float __b) {
14310   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
14311 }
14312
14313 /* Power 8 Crypto functions
14314 Note: We diverge from the current GCC implementation with regard
14315 to cryptography and related functions as follows:
14316 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
14317 - The remaining ones are only available on Power8 and up so
14318   require -mpower8-vector
14319 The justification for this is that export requirements require that
14320 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
14321 support). As a result, we need to be able to turn off support for those.
14322 The remaining ones (currently controlled by -mcrypto for GCC) still
14323 need to be provided on compliant hardware even if Vector.Crypto is not
14324 provided.
14325 */
14326 #ifdef __CRYPTO__
14327 #define vec_sbox_be __builtin_altivec_crypto_vsbox
14328 #define vec_cipher_be __builtin_altivec_crypto_vcipher
14329 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
14330 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
14331 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
14332
14333 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14334 __builtin_crypto_vsbox(vector unsigned long long __a) {
14335   return __builtin_altivec_crypto_vsbox(__a);
14336 }
14337
14338 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14339 __builtin_crypto_vcipher(vector unsigned long long __a,
14340                          vector unsigned long long __b) {
14341   return __builtin_altivec_crypto_vcipher(__a, __b);
14342 }
14343
14344 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14345 __builtin_crypto_vcipherlast(vector unsigned long long __a,
14346                              vector unsigned long long __b) {
14347   return __builtin_altivec_crypto_vcipherlast(__a, __b);
14348 }
14349
14350 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14351 __builtin_crypto_vncipher(vector unsigned long long __a,
14352                           vector unsigned long long __b) {
14353   return __builtin_altivec_crypto_vncipher(__a, __b);
14354 }
14355
14356 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14357 __builtin_crypto_vncipherlast(vector unsigned long long __a,
14358                               vector unsigned long long __b) {
14359   return __builtin_altivec_crypto_vncipherlast(__a, __b);
14360 }
14361
14362 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
14363 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
14364
14365 #define vec_shasigma_be(X, Y, Z)                                               \
14366   _Generic((X), vector unsigned int                                            \
14367            : __builtin_crypto_vshasigmaw, vector unsigned long long            \
14368            : __builtin_crypto_vshasigmad)((X), (Y), (Z))
14369 #endif
14370
14371 #ifdef __POWER8_VECTOR__
14372 static __inline__ vector unsigned char __ATTRS_o_ai
14373 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
14374                           vector unsigned char __c) {
14375   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
14376 }
14377
14378 static __inline__ vector unsigned short __ATTRS_o_ai
14379 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
14380                           vector unsigned short __c) {
14381   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
14382       (vector unsigned char)__a, (vector unsigned char)__b,
14383       (vector unsigned char)__c);
14384 }
14385
14386 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
14387     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
14388   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
14389       (vector unsigned char)__a, (vector unsigned char)__b,
14390       (vector unsigned char)__c);
14391 }
14392
14393 static __inline__ vector unsigned long long __ATTRS_o_ai
14394 __builtin_crypto_vpermxor(vector unsigned long long __a,
14395                           vector unsigned long long __b,
14396                           vector unsigned long long __c) {
14397   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
14398       (vector unsigned char)__a, (vector unsigned char)__b,
14399       (vector unsigned char)__c);
14400 }
14401
14402 static __inline__ vector unsigned char __ATTRS_o_ai
14403 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
14404   return __builtin_altivec_crypto_vpmsumb(__a, __b);
14405 }
14406
14407 static __inline__ vector unsigned short __ATTRS_o_ai
14408 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
14409   return __builtin_altivec_crypto_vpmsumh(__a, __b);
14410 }
14411
14412 static __inline__ vector unsigned int __ATTRS_o_ai
14413 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
14414   return __builtin_altivec_crypto_vpmsumw(__a, __b);
14415 }
14416
14417 static __inline__ vector unsigned long long __ATTRS_o_ai
14418 __builtin_crypto_vpmsumb(vector unsigned long long __a,
14419                          vector unsigned long long __b) {
14420   return __builtin_altivec_crypto_vpmsumd(__a, __b);
14421 }
14422
14423 static __inline__ vector signed char __ATTRS_o_ai
14424 vec_vgbbd(vector signed char __a) {
14425   return __builtin_altivec_vgbbd((vector unsigned char)__a);
14426 }
14427
14428 #define vec_pmsum_be __builtin_crypto_vpmsumb
14429 #define vec_gb __builtin_altivec_vgbbd
14430
14431 static __inline__ vector unsigned char __ATTRS_o_ai
14432 vec_vgbbd(vector unsigned char __a) {
14433   return __builtin_altivec_vgbbd(__a);
14434 }
14435
14436 static __inline__ vector long long __ATTRS_o_ai
14437 vec_vbpermq(vector signed char __a, vector signed char __b) {
14438   return __builtin_altivec_vbpermq((vector unsigned char)__a,
14439                                    (vector unsigned char)__b);
14440 }
14441
14442 static __inline__ vector long long __ATTRS_o_ai
14443 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
14444   return __builtin_altivec_vbpermq(__a, __b);
14445 }
14446
14447 #ifdef __powerpc64__
14448 static __inline__ vector unsigned long long __attribute__((__always_inline__))
14449 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
14450   return __builtin_altivec_vbpermq((vector unsigned char)__a,
14451                                    (vector unsigned char)__b);
14452 }
14453 #endif
14454 #endif
14455
14456 #undef __ATTRS_o_ai
14457
14458 #endif /* __ALTIVEC_H */