]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
MFV r308265: Update tzdata to 2016i.
[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 vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
40                                                 vector signed char __b,
41                                                 vector unsigned char __c);
42
43 static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
44                                                   vector unsigned char __b,
45                                                   vector unsigned char __c);
46
47 static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
48                                               vector bool char __b,
49                                               vector unsigned char __c);
50
51 static vector short __ATTRS_o_ai vec_perm(vector signed short __a,
52                                           vector signed short __b,
53                                           vector unsigned char __c);
54
55 static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
56                                                    vector unsigned short __b,
57                                                    vector unsigned char __c);
58
59 static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
60                                                vector bool short __b,
61                                                vector unsigned char __c);
62
63 static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
64                                           vector unsigned char __c);
65
66 static vector int __ATTRS_o_ai vec_perm(vector signed int __a,
67                                         vector signed int __b,
68                                         vector unsigned char __c);
69
70 static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
71                                                  vector unsigned int __b,
72                                                  vector unsigned char __c);
73
74 static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
75                                              vector bool int __b,
76                                              vector unsigned char __c);
77
78 static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
79                                           vector unsigned char __c);
80
81 #ifdef __VSX__
82 static vector long long __ATTRS_o_ai vec_perm(vector signed long long __a,
83                                               vector signed long long __b,
84                                               vector unsigned char __c);
85
86 static vector unsigned long long __ATTRS_o_ai
87 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
88          vector unsigned char __c);
89
90 static vector bool long long __ATTRS_o_ai
91 vec_perm(vector bool long long __a, vector bool long long __b,
92          vector unsigned char __c);
93
94 static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
95                                            vector unsigned char __c);
96 #endif
97
98 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
99                                                  vector unsigned char __b);
100
101 /* vec_abs */
102
103 #define __builtin_altivec_abs_v16qi vec_abs
104 #define __builtin_altivec_abs_v8hi vec_abs
105 #define __builtin_altivec_abs_v4si vec_abs
106
107 static vector signed char __ATTRS_o_ai vec_abs(vector signed char __a) {
108   return __builtin_altivec_vmaxsb(__a, -__a);
109 }
110
111 static vector signed short __ATTRS_o_ai vec_abs(vector signed short __a) {
112   return __builtin_altivec_vmaxsh(__a, -__a);
113 }
114
115 static vector signed int __ATTRS_o_ai vec_abs(vector signed int __a) {
116   return __builtin_altivec_vmaxsw(__a, -__a);
117 }
118
119 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
120 static vector signed long long __ATTRS_o_ai
121 vec_abs(vector signed long long __a) {
122   return __builtin_altivec_vmaxsd(__a, -__a);
123 }
124 #endif
125
126 static vector float __ATTRS_o_ai vec_abs(vector float __a) {
127   vector unsigned int __res =
128       (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
129   return (vector float)__res;
130 }
131
132 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
133 static vector double __ATTRS_o_ai vec_abs(vector double __a) {
134   vector unsigned long long __res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF };
135   __res &= (vector unsigned int)__a;
136   return (vector double)__res;
137 }
138 #endif
139
140 /* vec_abss */
141 #define __builtin_altivec_abss_v16qi vec_abss
142 #define __builtin_altivec_abss_v8hi vec_abss
143 #define __builtin_altivec_abss_v4si vec_abss
144
145 static vector signed char __ATTRS_o_ai vec_abss(vector signed char __a) {
146   return __builtin_altivec_vmaxsb(
147       __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
148 }
149
150 static vector signed short __ATTRS_o_ai vec_abss(vector signed short __a) {
151   return __builtin_altivec_vmaxsh(
152       __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
153 }
154
155 static vector signed int __ATTRS_o_ai vec_abss(vector signed int __a) {
156   return __builtin_altivec_vmaxsw(
157       __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
158 }
159
160 /* vec_add */
161
162 static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
163                                                vector signed char __b) {
164   return __a + __b;
165 }
166
167 static vector signed char __ATTRS_o_ai vec_add(vector bool char __a,
168                                                vector signed char __b) {
169   return (vector signed char)__a + __b;
170 }
171
172 static vector signed char __ATTRS_o_ai vec_add(vector signed char __a,
173                                                vector bool char __b) {
174   return __a + (vector signed char)__b;
175 }
176
177 static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
178                                                  vector unsigned char __b) {
179   return __a + __b;
180 }
181
182 static vector unsigned char __ATTRS_o_ai vec_add(vector bool char __a,
183                                                  vector unsigned char __b) {
184   return (vector unsigned char)__a + __b;
185 }
186
187 static vector unsigned char __ATTRS_o_ai vec_add(vector unsigned char __a,
188                                                  vector bool char __b) {
189   return __a + (vector unsigned char)__b;
190 }
191
192 static vector short __ATTRS_o_ai vec_add(vector short __a, vector short __b) {
193   return __a + __b;
194 }
195
196 static vector short __ATTRS_o_ai vec_add(vector bool short __a,
197                                          vector short __b) {
198   return (vector short)__a + __b;
199 }
200
201 static vector short __ATTRS_o_ai vec_add(vector short __a,
202                                          vector bool short __b) {
203   return __a + (vector short)__b;
204 }
205
206 static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
207                                                   vector unsigned short __b) {
208   return __a + __b;
209 }
210
211 static vector unsigned short __ATTRS_o_ai vec_add(vector bool short __a,
212                                                   vector unsigned short __b) {
213   return (vector unsigned short)__a + __b;
214 }
215
216 static vector unsigned short __ATTRS_o_ai vec_add(vector unsigned short __a,
217                                                   vector bool short __b) {
218   return __a + (vector unsigned short)__b;
219 }
220
221 static vector int __ATTRS_o_ai vec_add(vector int __a, vector int __b) {
222   return __a + __b;
223 }
224
225 static vector int __ATTRS_o_ai vec_add(vector bool int __a, vector int __b) {
226   return (vector int)__a + __b;
227 }
228
229 static vector int __ATTRS_o_ai vec_add(vector int __a, vector bool int __b) {
230   return __a + (vector int)__b;
231 }
232
233 static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
234                                                 vector unsigned int __b) {
235   return __a + __b;
236 }
237
238 static vector unsigned int __ATTRS_o_ai vec_add(vector bool int __a,
239                                                 vector unsigned int __b) {
240   return (vector unsigned int)__a + __b;
241 }
242
243 static vector unsigned int __ATTRS_o_ai vec_add(vector unsigned int __a,
244                                                 vector bool int __b) {
245   return __a + (vector unsigned int)__b;
246 }
247
248 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
249 static vector signed long long __ATTRS_o_ai
250 vec_add(vector signed long long __a, vector signed long long __b) {
251   return __a + __b;
252 }
253
254 static vector unsigned long long __ATTRS_o_ai
255 vec_add(vector unsigned long long __a, vector unsigned long long __b) {
256   return __a + __b;
257 }
258
259 static vector signed __int128 __ATTRS_o_ai vec_add(vector signed __int128 __a,
260                                                    vector signed __int128 __b) {
261   return __a + __b;
262 }
263
264 static vector unsigned __int128 __ATTRS_o_ai
265 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
266   return __a + __b;
267 }
268 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
269
270 static vector float __ATTRS_o_ai vec_add(vector float __a, vector float __b) {
271   return __a + __b;
272 }
273
274 #ifdef __VSX__
275 static vector double __ATTRS_o_ai
276 vec_add(vector double __a, vector double __b) {
277   return __a + __b;
278 }
279 #endif // __VSX__
280
281 /* vec_adde */
282
283 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
284 static vector signed __int128 __ATTRS_o_ai
285 vec_adde(vector signed __int128 __a, vector signed __int128 __b,
286          vector signed __int128 __c) {
287   return __builtin_altivec_vaddeuqm(__a, __b, __c);
288 }
289
290 static vector unsigned __int128 __ATTRS_o_ai
291 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
292          vector unsigned __int128 __c) {
293   return __builtin_altivec_vaddeuqm(__a, __b, __c);
294 }
295 #endif
296
297 /* vec_addec */
298
299 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
300 static vector signed __int128 __ATTRS_o_ai
301 vec_addec(vector signed __int128 __a, vector signed __int128 __b,
302           vector signed __int128 __c) {
303   return __builtin_altivec_vaddecuq(__a, __b, __c);
304 }
305
306 static vector unsigned __int128 __ATTRS_o_ai
307 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
308           vector unsigned __int128 __c) {
309   return __builtin_altivec_vaddecuq(__a, __b, __c);
310 }
311 #endif
312
313 /* vec_vaddubm */
314
315 #define __builtin_altivec_vaddubm vec_vaddubm
316
317 static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
318                                                    vector signed char __b) {
319   return __a + __b;
320 }
321
322 static vector signed char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
323                                                    vector signed char __b) {
324   return (vector signed char)__a + __b;
325 }
326
327 static vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a,
328                                                    vector bool char __b) {
329   return __a + (vector signed char)__b;
330 }
331
332 static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
333                                                      vector unsigned char __b) {
334   return __a + __b;
335 }
336
337 static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector bool char __a,
338                                                      vector unsigned char __b) {
339   return (vector unsigned char)__a + __b;
340 }
341
342 static vector unsigned char __ATTRS_o_ai vec_vaddubm(vector unsigned char __a,
343                                                      vector bool char __b) {
344   return __a + (vector unsigned char)__b;
345 }
346
347 /* vec_vadduhm */
348
349 #define __builtin_altivec_vadduhm vec_vadduhm
350
351 static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
352                                              vector short __b) {
353   return __a + __b;
354 }
355
356 static vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
357                                              vector short __b) {
358   return (vector short)__a + __b;
359 }
360
361 static vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
362                                              vector bool short __b) {
363   return __a + (vector short)__b;
364 }
365
366 static vector unsigned short __ATTRS_o_ai
367 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
368   return __a + __b;
369 }
370
371 static vector unsigned short __ATTRS_o_ai
372 vec_vadduhm(vector bool short __a, vector unsigned short __b) {
373   return (vector unsigned short)__a + __b;
374 }
375
376 static vector unsigned short __ATTRS_o_ai vec_vadduhm(vector unsigned short __a,
377                                                       vector bool short __b) {
378   return __a + (vector unsigned short)__b;
379 }
380
381 /* vec_vadduwm */
382
383 #define __builtin_altivec_vadduwm vec_vadduwm
384
385 static vector int __ATTRS_o_ai vec_vadduwm(vector int __a, vector int __b) {
386   return __a + __b;
387 }
388
389 static vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
390                                            vector int __b) {
391   return (vector int)__a + __b;
392 }
393
394 static vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
395                                            vector bool int __b) {
396   return __a + (vector int)__b;
397 }
398
399 static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
400                                                     vector unsigned int __b) {
401   return __a + __b;
402 }
403
404 static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
405                                                     vector unsigned int __b) {
406   return (vector unsigned int)__a + __b;
407 }
408
409 static vector unsigned int __ATTRS_o_ai vec_vadduwm(vector unsigned int __a,
410                                                     vector bool int __b) {
411   return __a + (vector unsigned int)__b;
412 }
413
414 /* vec_vaddfp */
415
416 #define __builtin_altivec_vaddfp vec_vaddfp
417
418 static vector float __attribute__((__always_inline__))
419 vec_vaddfp(vector float __a, vector float __b) {
420   return __a + __b;
421 }
422
423 /* vec_addc */
424
425 static vector signed int __ATTRS_o_ai vec_addc(vector signed int __a,
426                                                vector signed int __b) {
427   return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
428                                                       (vector unsigned int)__b);
429 }
430
431 static vector unsigned int __ATTRS_o_ai vec_addc(vector unsigned int __a,
432                                                  vector unsigned int __b) {
433   return __builtin_altivec_vaddcuw(__a, __b);
434 }
435
436 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
437 static vector signed __int128 __ATTRS_o_ai
438 vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
439   return (vector signed __int128)__builtin_altivec_vaddcuq(
440     (vector unsigned __int128)__a,
441     (vector unsigned __int128)__b);
442 }
443
444 static vector unsigned __int128 __ATTRS_o_ai
445 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
446   return __builtin_altivec_vaddcuq(__a, __b);
447 }
448 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
449
450 /* vec_vaddcuw */
451
452 static vector unsigned int __attribute__((__always_inline__))
453 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
454   return __builtin_altivec_vaddcuw(__a, __b);
455 }
456
457 /* vec_adds */
458
459 static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
460                                                 vector signed char __b) {
461   return __builtin_altivec_vaddsbs(__a, __b);
462 }
463
464 static vector signed char __ATTRS_o_ai vec_adds(vector bool char __a,
465                                                 vector signed char __b) {
466   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
467 }
468
469 static vector signed char __ATTRS_o_ai vec_adds(vector signed char __a,
470                                                 vector bool char __b) {
471   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
472 }
473
474 static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
475                                                   vector unsigned char __b) {
476   return __builtin_altivec_vaddubs(__a, __b);
477 }
478
479 static vector unsigned char __ATTRS_o_ai vec_adds(vector bool char __a,
480                                                   vector unsigned char __b) {
481   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
482 }
483
484 static vector unsigned char __ATTRS_o_ai vec_adds(vector unsigned char __a,
485                                                   vector bool char __b) {
486   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
487 }
488
489 static vector short __ATTRS_o_ai vec_adds(vector short __a, vector short __b) {
490   return __builtin_altivec_vaddshs(__a, __b);
491 }
492
493 static vector short __ATTRS_o_ai vec_adds(vector bool short __a,
494                                           vector short __b) {
495   return __builtin_altivec_vaddshs((vector short)__a, __b);
496 }
497
498 static vector short __ATTRS_o_ai vec_adds(vector short __a,
499                                           vector bool short __b) {
500   return __builtin_altivec_vaddshs(__a, (vector short)__b);
501 }
502
503 static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
504                                                    vector unsigned short __b) {
505   return __builtin_altivec_vadduhs(__a, __b);
506 }
507
508 static vector unsigned short __ATTRS_o_ai vec_adds(vector bool short __a,
509                                                    vector unsigned short __b) {
510   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
511 }
512
513 static vector unsigned short __ATTRS_o_ai vec_adds(vector unsigned short __a,
514                                                    vector bool short __b) {
515   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
516 }
517
518 static vector int __ATTRS_o_ai vec_adds(vector int __a, vector int __b) {
519   return __builtin_altivec_vaddsws(__a, __b);
520 }
521
522 static vector int __ATTRS_o_ai vec_adds(vector bool int __a, vector int __b) {
523   return __builtin_altivec_vaddsws((vector int)__a, __b);
524 }
525
526 static vector int __ATTRS_o_ai vec_adds(vector int __a, vector bool int __b) {
527   return __builtin_altivec_vaddsws(__a, (vector int)__b);
528 }
529
530 static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
531                                                  vector unsigned int __b) {
532   return __builtin_altivec_vadduws(__a, __b);
533 }
534
535 static vector unsigned int __ATTRS_o_ai vec_adds(vector bool int __a,
536                                                  vector unsigned int __b) {
537   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
538 }
539
540 static vector unsigned int __ATTRS_o_ai vec_adds(vector unsigned int __a,
541                                                  vector bool int __b) {
542   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
543 }
544
545 /* vec_vaddsbs */
546
547 static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
548                                                    vector signed char __b) {
549   return __builtin_altivec_vaddsbs(__a, __b);
550 }
551
552 static vector signed char __ATTRS_o_ai vec_vaddsbs(vector bool char __a,
553                                                    vector signed char __b) {
554   return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
555 }
556
557 static vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a,
558                                                    vector bool char __b) {
559   return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
560 }
561
562 /* vec_vaddubs */
563
564 static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
565                                                      vector unsigned char __b) {
566   return __builtin_altivec_vaddubs(__a, __b);
567 }
568
569 static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector bool char __a,
570                                                      vector unsigned char __b) {
571   return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
572 }
573
574 static vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a,
575                                                      vector bool char __b) {
576   return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
577 }
578
579 /* vec_vaddshs */
580
581 static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
582                                              vector short __b) {
583   return __builtin_altivec_vaddshs(__a, __b);
584 }
585
586 static vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
587                                              vector short __b) {
588   return __builtin_altivec_vaddshs((vector short)__a, __b);
589 }
590
591 static vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
592                                              vector bool short __b) {
593   return __builtin_altivec_vaddshs(__a, (vector short)__b);
594 }
595
596 /* vec_vadduhs */
597
598 static vector unsigned short __ATTRS_o_ai
599 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
600   return __builtin_altivec_vadduhs(__a, __b);
601 }
602
603 static vector unsigned short __ATTRS_o_ai
604 vec_vadduhs(vector bool short __a, vector unsigned short __b) {
605   return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
606 }
607
608 static vector unsigned short __ATTRS_o_ai vec_vadduhs(vector unsigned short __a,
609                                                       vector bool short __b) {
610   return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
611 }
612
613 /* vec_vaddsws */
614
615 static vector int __ATTRS_o_ai vec_vaddsws(vector int __a, vector int __b) {
616   return __builtin_altivec_vaddsws(__a, __b);
617 }
618
619 static vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
620                                            vector int __b) {
621   return __builtin_altivec_vaddsws((vector int)__a, __b);
622 }
623
624 static vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
625                                            vector bool int __b) {
626   return __builtin_altivec_vaddsws(__a, (vector int)__b);
627 }
628
629 /* vec_vadduws */
630
631 static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
632                                                     vector unsigned int __b) {
633   return __builtin_altivec_vadduws(__a, __b);
634 }
635
636 static vector unsigned int __ATTRS_o_ai vec_vadduws(vector bool int __a,
637                                                     vector unsigned int __b) {
638   return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
639 }
640
641 static vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a,
642                                                     vector bool int __b) {
643   return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
644 }
645
646 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
647 /* vec_vadduqm */
648
649 static vector signed __int128 __ATTRS_o_ai
650 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
651   return __a + __b;
652 }
653
654 static vector unsigned __int128 __ATTRS_o_ai
655 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
656   return __a + __b;
657 }
658
659 /* vec_vaddeuqm */
660
661 static vector signed __int128 __ATTRS_o_ai
662 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
663              vector signed __int128 __c) {
664   return __builtin_altivec_vaddeuqm(__a, __b, __c);
665 }
666
667 static vector unsigned __int128 __ATTRS_o_ai
668 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
669              vector unsigned __int128 __c) {
670   return __builtin_altivec_vaddeuqm(__a, __b, __c);
671 }
672
673 /* vec_vaddcuq */
674
675 static vector signed __int128 __ATTRS_o_ai
676 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
677   return __builtin_altivec_vaddcuq(__a, __b);
678 }
679
680 static vector unsigned __int128 __ATTRS_o_ai
681 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
682   return __builtin_altivec_vaddcuq(__a, __b);
683 }
684
685 /* vec_vaddecuq */
686
687 static vector signed __int128 __ATTRS_o_ai
688 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
689              vector signed __int128 __c) {
690   return __builtin_altivec_vaddecuq(__a, __b, __c);
691 }
692
693 static vector unsigned __int128 __ATTRS_o_ai
694 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
695              vector unsigned __int128 __c) {
696   return __builtin_altivec_vaddecuq(__a, __b, __c);
697 }
698 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
699
700 /* vec_and */
701
702 #define __builtin_altivec_vand vec_and
703
704 static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
705                                                vector signed char __b) {
706   return __a & __b;
707 }
708
709 static vector signed char __ATTRS_o_ai vec_and(vector bool char __a,
710                                                vector signed char __b) {
711   return (vector signed char)__a & __b;
712 }
713
714 static vector signed char __ATTRS_o_ai vec_and(vector signed char __a,
715                                                vector bool char __b) {
716   return __a & (vector signed char)__b;
717 }
718
719 static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
720                                                  vector unsigned char __b) {
721   return __a & __b;
722 }
723
724 static vector unsigned char __ATTRS_o_ai vec_and(vector bool char __a,
725                                                  vector unsigned char __b) {
726   return (vector unsigned char)__a & __b;
727 }
728
729 static vector unsigned char __ATTRS_o_ai vec_and(vector unsigned char __a,
730                                                  vector bool char __b) {
731   return __a & (vector unsigned char)__b;
732 }
733
734 static vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
735                                              vector bool char __b) {
736   return __a & __b;
737 }
738
739 static vector short __ATTRS_o_ai vec_and(vector short __a, vector short __b) {
740   return __a & __b;
741 }
742
743 static vector short __ATTRS_o_ai vec_and(vector bool short __a,
744                                          vector short __b) {
745   return (vector short)__a & __b;
746 }
747
748 static vector short __ATTRS_o_ai vec_and(vector short __a,
749                                          vector bool short __b) {
750   return __a & (vector short)__b;
751 }
752
753 static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
754                                                   vector unsigned short __b) {
755   return __a & __b;
756 }
757
758 static vector unsigned short __ATTRS_o_ai vec_and(vector bool short __a,
759                                                   vector unsigned short __b) {
760   return (vector unsigned short)__a & __b;
761 }
762
763 static vector unsigned short __ATTRS_o_ai vec_and(vector unsigned short __a,
764                                                   vector bool short __b) {
765   return __a & (vector unsigned short)__b;
766 }
767
768 static vector bool short __ATTRS_o_ai vec_and(vector bool short __a,
769                                               vector bool short __b) {
770   return __a & __b;
771 }
772
773 static vector int __ATTRS_o_ai vec_and(vector int __a, vector int __b) {
774   return __a & __b;
775 }
776
777 static vector int __ATTRS_o_ai vec_and(vector bool int __a, vector int __b) {
778   return (vector int)__a & __b;
779 }
780
781 static vector int __ATTRS_o_ai vec_and(vector int __a, vector bool int __b) {
782   return __a & (vector int)__b;
783 }
784
785 static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
786                                                 vector unsigned int __b) {
787   return __a & __b;
788 }
789
790 static vector unsigned int __ATTRS_o_ai vec_and(vector bool int __a,
791                                                 vector unsigned int __b) {
792   return (vector unsigned int)__a & __b;
793 }
794
795 static vector unsigned int __ATTRS_o_ai vec_and(vector unsigned int __a,
796                                                 vector bool int __b) {
797   return __a & (vector unsigned int)__b;
798 }
799
800 static vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
801                                             vector bool int __b) {
802   return __a & __b;
803 }
804
805 static vector float __ATTRS_o_ai vec_and(vector float __a, vector float __b) {
806   vector unsigned int __res =
807       (vector unsigned int)__a & (vector unsigned int)__b;
808   return (vector float)__res;
809 }
810
811 static vector float __ATTRS_o_ai vec_and(vector bool int __a,
812                                          vector float __b) {
813   vector unsigned int __res =
814       (vector unsigned int)__a & (vector unsigned int)__b;
815   return (vector float)__res;
816 }
817
818 static vector float __ATTRS_o_ai vec_and(vector float __a,
819                                          vector bool int __b) {
820   vector unsigned int __res =
821       (vector unsigned int)__a & (vector unsigned int)__b;
822   return (vector float)__res;
823 }
824
825 #ifdef __VSX__
826 static vector double __ATTRS_o_ai vec_and(vector bool long long __a, vector double __b) {
827   vector unsigned long long __res =
828       (vector unsigned long long)__a & (vector unsigned long long)__b;
829   return (vector double)__res;
830 }
831
832 static vector double __ATTRS_o_ai vec_and(vector double __a, vector bool long long __b) {
833   vector unsigned long long __res =
834       (vector unsigned long long)__a & (vector unsigned long long)__b;
835   return (vector double)__res;
836 }
837
838 static vector double __ATTRS_o_ai vec_and(vector double __a, vector double __b) {
839   vector unsigned long long __res =
840       (vector unsigned long long)__a & (vector unsigned long long)__b;
841   return (vector double)__res;
842 }
843
844 static vector signed long long __ATTRS_o_ai
845 vec_and(vector signed long long __a, vector signed long long __b) {
846   return __a & __b;
847 }
848
849 static vector signed long long __ATTRS_o_ai
850 vec_and(vector bool long long __a, vector signed long long __b) {
851   return (vector signed long long)__a & __b;
852 }
853
854 static vector signed long long __ATTRS_o_ai vec_and(vector signed long long __a,
855                                                     vector bool long long __b) {
856   return __a & (vector signed long long)__b;
857 }
858
859 static vector unsigned long long __ATTRS_o_ai
860 vec_and(vector unsigned long long __a, vector unsigned long long __b) {
861   return __a & __b;
862 }
863
864 static vector unsigned long long __ATTRS_o_ai
865 vec_and(vector bool long long __a, vector unsigned long long __b) {
866   return (vector unsigned long long)__a & __b;
867 }
868
869 static vector unsigned long long __ATTRS_o_ai
870 vec_and(vector unsigned long long __a, vector bool long long __b) {
871   return __a & (vector unsigned long long)__b;
872 }
873
874 static vector bool long long __ATTRS_o_ai vec_and(vector bool long long __a,
875                                                   vector bool long long __b) {
876   return __a & __b;
877 }
878 #endif
879
880 /* vec_vand */
881
882 static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
883                                                 vector signed char __b) {
884   return __a & __b;
885 }
886
887 static vector signed char __ATTRS_o_ai vec_vand(vector bool char __a,
888                                                 vector signed char __b) {
889   return (vector signed char)__a & __b;
890 }
891
892 static vector signed char __ATTRS_o_ai vec_vand(vector signed char __a,
893                                                 vector bool char __b) {
894   return __a & (vector signed char)__b;
895 }
896
897 static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
898                                                   vector unsigned char __b) {
899   return __a & __b;
900 }
901
902 static vector unsigned char __ATTRS_o_ai vec_vand(vector bool char __a,
903                                                   vector unsigned char __b) {
904   return (vector unsigned char)__a & __b;
905 }
906
907 static vector unsigned char __ATTRS_o_ai vec_vand(vector unsigned char __a,
908                                                   vector bool char __b) {
909   return __a & (vector unsigned char)__b;
910 }
911
912 static vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
913                                               vector bool char __b) {
914   return __a & __b;
915 }
916
917 static vector short __ATTRS_o_ai vec_vand(vector short __a, vector short __b) {
918   return __a & __b;
919 }
920
921 static vector short __ATTRS_o_ai vec_vand(vector bool short __a,
922                                           vector short __b) {
923   return (vector short)__a & __b;
924 }
925
926 static vector short __ATTRS_o_ai vec_vand(vector short __a,
927                                           vector bool short __b) {
928   return __a & (vector short)__b;
929 }
930
931 static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
932                                                    vector unsigned short __b) {
933   return __a & __b;
934 }
935
936 static vector unsigned short __ATTRS_o_ai vec_vand(vector bool short __a,
937                                                    vector unsigned short __b) {
938   return (vector unsigned short)__a & __b;
939 }
940
941 static vector unsigned short __ATTRS_o_ai vec_vand(vector unsigned short __a,
942                                                    vector bool short __b) {
943   return __a & (vector unsigned short)__b;
944 }
945
946 static vector bool short __ATTRS_o_ai vec_vand(vector bool short __a,
947                                                vector bool short __b) {
948   return __a & __b;
949 }
950
951 static vector int __ATTRS_o_ai vec_vand(vector int __a, vector int __b) {
952   return __a & __b;
953 }
954
955 static vector int __ATTRS_o_ai vec_vand(vector bool int __a, vector int __b) {
956   return (vector int)__a & __b;
957 }
958
959 static vector int __ATTRS_o_ai vec_vand(vector int __a, vector bool int __b) {
960   return __a & (vector int)__b;
961 }
962
963 static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
964                                                  vector unsigned int __b) {
965   return __a & __b;
966 }
967
968 static vector unsigned int __ATTRS_o_ai vec_vand(vector bool int __a,
969                                                  vector unsigned int __b) {
970   return (vector unsigned int)__a & __b;
971 }
972
973 static vector unsigned int __ATTRS_o_ai vec_vand(vector unsigned int __a,
974                                                  vector bool int __b) {
975   return __a & (vector unsigned int)__b;
976 }
977
978 static vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
979                                              vector bool int __b) {
980   return __a & __b;
981 }
982
983 static vector float __ATTRS_o_ai vec_vand(vector float __a, vector float __b) {
984   vector unsigned int __res =
985       (vector unsigned int)__a & (vector unsigned int)__b;
986   return (vector float)__res;
987 }
988
989 static vector float __ATTRS_o_ai vec_vand(vector bool int __a,
990                                           vector float __b) {
991   vector unsigned int __res =
992       (vector unsigned int)__a & (vector unsigned int)__b;
993   return (vector float)__res;
994 }
995
996 static vector float __ATTRS_o_ai vec_vand(vector float __a,
997                                           vector bool int __b) {
998   vector unsigned int __res =
999       (vector unsigned int)__a & (vector unsigned int)__b;
1000   return (vector float)__res;
1001 }
1002
1003 #ifdef __VSX__
1004 static vector signed long long __ATTRS_o_ai
1005 vec_vand(vector signed long long __a, vector signed long long __b) {
1006   return __a & __b;
1007 }
1008
1009 static vector signed long long __ATTRS_o_ai
1010 vec_vand(vector bool long long __a, vector signed long long __b) {
1011   return (vector signed long long)__a & __b;
1012 }
1013
1014 static vector signed long long __ATTRS_o_ai
1015 vec_vand(vector signed long long __a, vector bool long long __b) {
1016   return __a & (vector signed long long)__b;
1017 }
1018
1019 static vector unsigned long long __ATTRS_o_ai
1020 vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1021   return __a & __b;
1022 }
1023
1024 static vector unsigned long long __ATTRS_o_ai
1025 vec_vand(vector bool long long __a, vector unsigned long long __b) {
1026   return (vector unsigned long long)__a & __b;
1027 }
1028
1029 static vector unsigned long long __ATTRS_o_ai
1030 vec_vand(vector unsigned long long __a, vector bool long long __b) {
1031   return __a & (vector unsigned long long)__b;
1032 }
1033
1034 static vector bool long long __ATTRS_o_ai vec_vand(vector bool long long __a,
1035                                                    vector bool long long __b) {
1036   return __a & __b;
1037 }
1038 #endif
1039
1040 /* vec_andc */
1041
1042 #define __builtin_altivec_vandc vec_andc
1043
1044 static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
1045                                                 vector signed char __b) {
1046   return __a & ~__b;
1047 }
1048
1049 static vector signed char __ATTRS_o_ai vec_andc(vector bool char __a,
1050                                                 vector signed char __b) {
1051   return (vector signed char)__a & ~__b;
1052 }
1053
1054 static vector signed char __ATTRS_o_ai vec_andc(vector signed char __a,
1055                                                 vector bool char __b) {
1056   return __a & ~(vector signed char)__b;
1057 }
1058
1059 static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
1060                                                   vector unsigned char __b) {
1061   return __a & ~__b;
1062 }
1063
1064 static vector unsigned char __ATTRS_o_ai vec_andc(vector bool char __a,
1065                                                   vector unsigned char __b) {
1066   return (vector unsigned char)__a & ~__b;
1067 }
1068
1069 static vector unsigned char __ATTRS_o_ai vec_andc(vector unsigned char __a,
1070                                                   vector bool char __b) {
1071   return __a & ~(vector unsigned char)__b;
1072 }
1073
1074 static vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1075                                               vector bool char __b) {
1076   return __a & ~__b;
1077 }
1078
1079 static vector short __ATTRS_o_ai vec_andc(vector short __a, vector short __b) {
1080   return __a & ~__b;
1081 }
1082
1083 static vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1084                                           vector short __b) {
1085   return (vector short)__a & ~__b;
1086 }
1087
1088 static vector short __ATTRS_o_ai vec_andc(vector short __a,
1089                                           vector bool short __b) {
1090   return __a & ~(vector short)__b;
1091 }
1092
1093 static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
1094                                                    vector unsigned short __b) {
1095   return __a & ~__b;
1096 }
1097
1098 static vector unsigned short __ATTRS_o_ai vec_andc(vector bool short __a,
1099                                                    vector unsigned short __b) {
1100   return (vector unsigned short)__a & ~__b;
1101 }
1102
1103 static vector unsigned short __ATTRS_o_ai vec_andc(vector unsigned short __a,
1104                                                    vector bool short __b) {
1105   return __a & ~(vector unsigned short)__b;
1106 }
1107
1108 static vector bool short __ATTRS_o_ai vec_andc(vector bool short __a,
1109                                                vector bool short __b) {
1110   return __a & ~__b;
1111 }
1112
1113 static vector int __ATTRS_o_ai vec_andc(vector int __a, vector int __b) {
1114   return __a & ~__b;
1115 }
1116
1117 static vector int __ATTRS_o_ai vec_andc(vector bool int __a, vector int __b) {
1118   return (vector int)__a & ~__b;
1119 }
1120
1121 static vector int __ATTRS_o_ai vec_andc(vector int __a, vector bool int __b) {
1122   return __a & ~(vector int)__b;
1123 }
1124
1125 static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1126                                                  vector unsigned int __b) {
1127   return __a & ~__b;
1128 }
1129
1130 static vector unsigned int __ATTRS_o_ai vec_andc(vector bool int __a,
1131                                                  vector unsigned int __b) {
1132   return (vector unsigned int)__a & ~__b;
1133 }
1134
1135 static vector unsigned int __ATTRS_o_ai vec_andc(vector unsigned int __a,
1136                                                  vector bool int __b) {
1137   return __a & ~(vector unsigned int)__b;
1138 }
1139
1140 static vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1141                                              vector bool int __b) {
1142   return __a & ~__b;
1143 }
1144
1145 static vector float __ATTRS_o_ai vec_andc(vector float __a, vector float __b) {
1146   vector unsigned int __res =
1147       (vector unsigned int)__a & ~(vector unsigned int)__b;
1148   return (vector float)__res;
1149 }
1150
1151 static vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1152                                           vector float __b) {
1153   vector unsigned int __res =
1154       (vector unsigned int)__a & ~(vector unsigned int)__b;
1155   return (vector float)__res;
1156 }
1157
1158 static vector float __ATTRS_o_ai vec_andc(vector float __a,
1159                                           vector bool int __b) {
1160   vector unsigned int __res =
1161       (vector unsigned int)__a & ~(vector unsigned int)__b;
1162   return (vector float)__res;
1163 }
1164
1165 #ifdef __VSX__
1166 static vector double __ATTRS_o_ai
1167 vec_andc(vector bool long long __a, vector double __b) {
1168   vector unsigned long long __res =
1169       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1170   return (vector double)__res;
1171 }
1172
1173 static vector double __ATTRS_o_ai
1174 vec_andc(vector double __a, vector bool long long __b) {
1175   vector unsigned long long __res =
1176       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1177   return (vector double)__res;
1178 }
1179
1180 static vector double __ATTRS_o_ai vec_andc(vector double __a, vector double __b) {
1181   vector unsigned long long __res =
1182       (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1183   return (vector double)__res;
1184 }
1185
1186 static vector signed long long __ATTRS_o_ai
1187 vec_andc(vector signed long long __a, vector signed long long __b) {
1188   return __a & ~__b;
1189 }
1190
1191 static vector signed long long __ATTRS_o_ai
1192 vec_andc(vector bool long long __a, vector signed long long __b) {
1193   return (vector signed long long)__a & ~__b;
1194 }
1195
1196 static vector signed long long __ATTRS_o_ai
1197 vec_andc(vector signed long long __a, vector bool long long __b) {
1198   return __a & ~(vector signed long long)__b;
1199 }
1200
1201 static vector unsigned long long __ATTRS_o_ai
1202 vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1203   return __a & ~__b;
1204 }
1205
1206 static vector unsigned long long __ATTRS_o_ai
1207 vec_andc(vector bool long long __a, vector unsigned long long __b) {
1208   return (vector unsigned long long)__a & ~__b;
1209 }
1210
1211 static vector unsigned long long __ATTRS_o_ai
1212 vec_andc(vector unsigned long long __a, vector bool long long __b) {
1213   return __a & ~(vector unsigned long long)__b;
1214 }
1215
1216 static vector bool long long __ATTRS_o_ai vec_andc(vector bool long long __a,
1217                                                    vector bool long long __b) {
1218   return __a & ~__b;
1219 }
1220 #endif
1221
1222 /* vec_vandc */
1223
1224 static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1225                                                  vector signed char __b) {
1226   return __a & ~__b;
1227 }
1228
1229 static vector signed char __ATTRS_o_ai vec_vandc(vector bool char __a,
1230                                                  vector signed char __b) {
1231   return (vector signed char)__a & ~__b;
1232 }
1233
1234 static vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a,
1235                                                  vector bool char __b) {
1236   return __a & ~(vector signed char)__b;
1237 }
1238
1239 static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1240                                                    vector unsigned char __b) {
1241   return __a & ~__b;
1242 }
1243
1244 static vector unsigned char __ATTRS_o_ai vec_vandc(vector bool char __a,
1245                                                    vector unsigned char __b) {
1246   return (vector unsigned char)__a & ~__b;
1247 }
1248
1249 static vector unsigned char __ATTRS_o_ai vec_vandc(vector unsigned char __a,
1250                                                    vector bool char __b) {
1251   return __a & ~(vector unsigned char)__b;
1252 }
1253
1254 static vector bool char __ATTRS_o_ai vec_vandc(vector bool char __a,
1255                                                vector bool char __b) {
1256   return __a & ~__b;
1257 }
1258
1259 static vector short __ATTRS_o_ai vec_vandc(vector short __a, vector short __b) {
1260   return __a & ~__b;
1261 }
1262
1263 static vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1264                                            vector short __b) {
1265   return (vector short)__a & ~__b;
1266 }
1267
1268 static vector short __ATTRS_o_ai vec_vandc(vector short __a,
1269                                            vector bool short __b) {
1270   return __a & ~(vector short)__b;
1271 }
1272
1273 static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1274                                                     vector unsigned short __b) {
1275   return __a & ~__b;
1276 }
1277
1278 static vector unsigned short __ATTRS_o_ai vec_vandc(vector bool short __a,
1279                                                     vector unsigned short __b) {
1280   return (vector unsigned short)__a & ~__b;
1281 }
1282
1283 static vector unsigned short __ATTRS_o_ai vec_vandc(vector unsigned short __a,
1284                                                     vector bool short __b) {
1285   return __a & ~(vector unsigned short)__b;
1286 }
1287
1288 static vector bool short __ATTRS_o_ai vec_vandc(vector bool short __a,
1289                                                 vector bool short __b) {
1290   return __a & ~__b;
1291 }
1292
1293 static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector int __b) {
1294   return __a & ~__b;
1295 }
1296
1297 static vector int __ATTRS_o_ai vec_vandc(vector bool int __a, vector int __b) {
1298   return (vector int)__a & ~__b;
1299 }
1300
1301 static vector int __ATTRS_o_ai vec_vandc(vector int __a, vector bool int __b) {
1302   return __a & ~(vector int)__b;
1303 }
1304
1305 static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1306                                                   vector unsigned int __b) {
1307   return __a & ~__b;
1308 }
1309
1310 static vector unsigned int __ATTRS_o_ai vec_vandc(vector bool int __a,
1311                                                   vector unsigned int __b) {
1312   return (vector unsigned int)__a & ~__b;
1313 }
1314
1315 static vector unsigned int __ATTRS_o_ai vec_vandc(vector unsigned int __a,
1316                                                   vector bool int __b) {
1317   return __a & ~(vector unsigned int)__b;
1318 }
1319
1320 static vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1321                                               vector bool int __b) {
1322   return __a & ~__b;
1323 }
1324
1325 static vector float __ATTRS_o_ai vec_vandc(vector float __a, vector float __b) {
1326   vector unsigned int __res =
1327       (vector unsigned int)__a & ~(vector unsigned int)__b;
1328   return (vector float)__res;
1329 }
1330
1331 static vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1332                                            vector float __b) {
1333   vector unsigned int __res =
1334       (vector unsigned int)__a & ~(vector unsigned int)__b;
1335   return (vector float)__res;
1336 }
1337
1338 static vector float __ATTRS_o_ai vec_vandc(vector float __a,
1339                                            vector bool int __b) {
1340   vector unsigned int __res =
1341       (vector unsigned int)__a & ~(vector unsigned int)__b;
1342   return (vector float)__res;
1343 }
1344
1345 #ifdef __VSX__
1346 static vector signed long long __ATTRS_o_ai
1347 vec_vandc(vector signed long long __a, vector signed long long __b) {
1348   return __a & ~__b;
1349 }
1350
1351 static vector signed long long __ATTRS_o_ai
1352 vec_vandc(vector bool long long __a, vector signed long long __b) {
1353   return (vector signed long long)__a & ~__b;
1354 }
1355
1356 static vector signed long long __ATTRS_o_ai
1357 vec_vandc(vector signed long long __a, vector bool long long __b) {
1358   return __a & ~(vector signed long long)__b;
1359 }
1360
1361 static vector unsigned long long __ATTRS_o_ai
1362 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1363   return __a & ~__b;
1364 }
1365
1366 static vector unsigned long long __ATTRS_o_ai
1367 vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1368   return (vector unsigned long long)__a & ~__b;
1369 }
1370
1371 static vector unsigned long long __ATTRS_o_ai
1372 vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1373   return __a & ~(vector unsigned long long)__b;
1374 }
1375
1376 static vector bool long long __ATTRS_o_ai vec_vandc(vector bool long long __a,
1377                                                     vector bool long long __b) {
1378   return __a & ~__b;
1379 }
1380 #endif
1381
1382 /* vec_avg */
1383
1384 static vector signed char __ATTRS_o_ai vec_avg(vector signed char __a,
1385                                                vector signed char __b) {
1386   return __builtin_altivec_vavgsb(__a, __b);
1387 }
1388
1389 static vector unsigned char __ATTRS_o_ai vec_avg(vector unsigned char __a,
1390                                                  vector unsigned char __b) {
1391   return __builtin_altivec_vavgub(__a, __b);
1392 }
1393
1394 static vector short __ATTRS_o_ai vec_avg(vector short __a, vector short __b) {
1395   return __builtin_altivec_vavgsh(__a, __b);
1396 }
1397
1398 static vector unsigned short __ATTRS_o_ai vec_avg(vector unsigned short __a,
1399                                                   vector unsigned short __b) {
1400   return __builtin_altivec_vavguh(__a, __b);
1401 }
1402
1403 static vector int __ATTRS_o_ai vec_avg(vector int __a, vector int __b) {
1404   return __builtin_altivec_vavgsw(__a, __b);
1405 }
1406
1407 static vector unsigned int __ATTRS_o_ai vec_avg(vector unsigned int __a,
1408                                                 vector unsigned int __b) {
1409   return __builtin_altivec_vavguw(__a, __b);
1410 }
1411
1412 /* vec_vavgsb */
1413
1414 static vector signed char __attribute__((__always_inline__))
1415 vec_vavgsb(vector signed char __a, vector signed char __b) {
1416   return __builtin_altivec_vavgsb(__a, __b);
1417 }
1418
1419 /* vec_vavgub */
1420
1421 static vector unsigned char __attribute__((__always_inline__))
1422 vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1423   return __builtin_altivec_vavgub(__a, __b);
1424 }
1425
1426 /* vec_vavgsh */
1427
1428 static vector short __attribute__((__always_inline__))
1429 vec_vavgsh(vector short __a, vector short __b) {
1430   return __builtin_altivec_vavgsh(__a, __b);
1431 }
1432
1433 /* vec_vavguh */
1434
1435 static vector unsigned short __attribute__((__always_inline__))
1436 vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1437   return __builtin_altivec_vavguh(__a, __b);
1438 }
1439
1440 /* vec_vavgsw */
1441
1442 static vector int __attribute__((__always_inline__))
1443 vec_vavgsw(vector int __a, vector int __b) {
1444   return __builtin_altivec_vavgsw(__a, __b);
1445 }
1446
1447 /* vec_vavguw */
1448
1449 static vector unsigned int __attribute__((__always_inline__))
1450 vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1451   return __builtin_altivec_vavguw(__a, __b);
1452 }
1453
1454 /* vec_ceil */
1455
1456 static vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1457 #ifdef __VSX__
1458   return __builtin_vsx_xvrspip(__a);
1459 #else
1460   return __builtin_altivec_vrfip(__a);
1461 #endif
1462 }
1463
1464 #ifdef __VSX__
1465 static vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1466   return __builtin_vsx_xvrdpip(__a);
1467 }
1468 #endif
1469
1470 /* vec_vrfip */
1471
1472 static vector float __attribute__((__always_inline__))
1473 vec_vrfip(vector float __a) {
1474   return __builtin_altivec_vrfip(__a);
1475 }
1476
1477 /* vec_cmpb */
1478
1479 static vector int __attribute__((__always_inline__))
1480 vec_cmpb(vector float __a, vector float __b) {
1481   return __builtin_altivec_vcmpbfp(__a, __b);
1482 }
1483
1484 /* vec_vcmpbfp */
1485
1486 static vector int __attribute__((__always_inline__))
1487 vec_vcmpbfp(vector float __a, vector float __b) {
1488   return __builtin_altivec_vcmpbfp(__a, __b);
1489 }
1490
1491 /* vec_cmpeq */
1492
1493 static vector bool char __ATTRS_o_ai vec_cmpeq(vector signed char __a,
1494                                                vector signed char __b) {
1495   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1496                                                       (vector char)__b);
1497 }
1498
1499 static vector bool char __ATTRS_o_ai vec_cmpeq(vector unsigned char __a,
1500                                                vector unsigned char __b) {
1501   return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1502                                                       (vector char)__b);
1503 }
1504
1505 static vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1506                                                 vector short __b) {
1507   return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1508 }
1509
1510 static vector bool short __ATTRS_o_ai vec_cmpeq(vector unsigned short __a,
1511                                                 vector unsigned short __b) {
1512   return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1513                                                        (vector short)__b);
1514 }
1515
1516 static vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, vector int __b) {
1517   return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1518 }
1519
1520 static vector bool int __ATTRS_o_ai vec_cmpeq(vector unsigned int __a,
1521                                               vector unsigned int __b) {
1522   return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1523                                                      (vector int)__b);
1524 }
1525
1526 #ifdef __POWER8_VECTOR__
1527 static vector bool long long __ATTRS_o_ai
1528 vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1529   return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1530 }
1531
1532 static vector bool long long __ATTRS_o_ai
1533 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1534   return (vector bool long long)__builtin_altivec_vcmpequd(
1535       (vector long long)__a, (vector long long)__b);
1536 }
1537 #endif
1538
1539 static vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1540                                               vector float __b) {
1541 #ifdef __VSX__
1542   return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1543 #else
1544   return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1545 #endif
1546 }
1547
1548 #ifdef __VSX__
1549 static vector bool long long __ATTRS_o_ai
1550 vec_cmpeq(vector double __a, vector double __b) {
1551   return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1552 }
1553 #endif
1554
1555
1556 /* vec_cmpgt */
1557
1558 static vector bool char __ATTRS_o_ai vec_cmpgt(vector signed char __a,
1559                                                vector signed char __b) {
1560   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1561 }
1562
1563 static vector bool char __ATTRS_o_ai vec_cmpgt(vector unsigned char __a,
1564                                                vector unsigned char __b) {
1565   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1566 }
1567
1568 static vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
1569                                                 vector short __b) {
1570   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1571 }
1572
1573 static vector bool short __ATTRS_o_ai vec_cmpgt(vector unsigned short __a,
1574                                                 vector unsigned short __b) {
1575   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1576 }
1577
1578 static vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, vector int __b) {
1579   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1580 }
1581
1582 static vector bool int __ATTRS_o_ai vec_cmpgt(vector unsigned int __a,
1583                                               vector unsigned int __b) {
1584   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1585 }
1586
1587 #ifdef __POWER8_VECTOR__
1588 static vector bool long long __ATTRS_o_ai
1589 vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1590   return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1591 }
1592
1593 static vector bool long long __ATTRS_o_ai
1594 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1595   return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1596 }
1597 #endif
1598
1599 static vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
1600                                               vector float __b) {
1601 #ifdef __VSX__
1602   return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
1603 #else
1604   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1605 #endif
1606 }
1607
1608 #ifdef __VSX__
1609 static vector bool long long __ATTRS_o_ai
1610 vec_cmpgt(vector double __a, vector double __b) {
1611   return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
1612 }
1613 #endif
1614
1615 /* vec_cmpge */
1616
1617 static vector bool char __ATTRS_o_ai
1618 vec_cmpge (vector signed char __a, vector signed char __b) {
1619   return ~(vec_cmpgt(__b, __a));
1620 }
1621
1622 static vector bool char __ATTRS_o_ai
1623 vec_cmpge (vector unsigned char __a, vector unsigned char __b) {
1624   return ~(vec_cmpgt(__b, __a));
1625 }
1626
1627 static vector bool short __ATTRS_o_ai
1628 vec_cmpge (vector signed short __a, vector signed short __b) {
1629   return ~(vec_cmpgt(__b, __a));
1630 }
1631
1632 static vector bool short __ATTRS_o_ai
1633 vec_cmpge (vector unsigned short __a, vector unsigned short __b) {
1634   return ~(vec_cmpgt(__b, __a));
1635 }
1636
1637 static vector bool int __ATTRS_o_ai
1638 vec_cmpge (vector signed int __a, vector signed int __b) {
1639   return ~(vec_cmpgt(__b, __a));
1640 }
1641
1642 static vector bool int __ATTRS_o_ai
1643 vec_cmpge (vector unsigned int __a, vector unsigned int __b) {
1644   return ~(vec_cmpgt(__b, __a));
1645 }
1646
1647 static vector bool int __ATTRS_o_ai
1648 vec_cmpge(vector float __a, vector float __b) {
1649 #ifdef __VSX__
1650   return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
1651 #else
1652   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1653 #endif
1654 }
1655
1656 #ifdef __VSX__
1657 static vector bool long long __ATTRS_o_ai
1658 vec_cmpge(vector double __a, vector double __b) {
1659   return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
1660 }
1661 #endif
1662
1663 #ifdef __POWER8_VECTOR__
1664 static vector bool long long __ATTRS_o_ai
1665 vec_cmpge(vector signed long long __a, vector signed long long __b) {
1666   return ~(vec_cmpgt(__b, __a));
1667 }
1668
1669 static vector bool long long __ATTRS_o_ai
1670 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1671   return ~(vec_cmpgt(__b, __a));
1672 }
1673 #endif
1674
1675 /* vec_vcmpgefp */
1676
1677 static vector bool int __attribute__((__always_inline__))
1678 vec_vcmpgefp(vector float __a, vector float __b) {
1679   return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
1680 }
1681
1682 /* vec_vcmpgtsb */
1683
1684 static vector bool char __attribute__((__always_inline__))
1685 vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
1686   return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
1687 }
1688
1689 /* vec_vcmpgtub */
1690
1691 static vector bool char __attribute__((__always_inline__))
1692 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
1693   return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
1694 }
1695
1696 /* vec_vcmpgtsh */
1697
1698 static vector bool short __attribute__((__always_inline__))
1699 vec_vcmpgtsh(vector short __a, vector short __b) {
1700   return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
1701 }
1702
1703 /* vec_vcmpgtuh */
1704
1705 static vector bool short __attribute__((__always_inline__))
1706 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
1707   return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
1708 }
1709
1710 /* vec_vcmpgtsw */
1711
1712 static vector bool int __attribute__((__always_inline__))
1713 vec_vcmpgtsw(vector int __a, vector int __b) {
1714   return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
1715 }
1716
1717 /* vec_vcmpgtuw */
1718
1719 static vector bool int __attribute__((__always_inline__))
1720 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
1721   return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
1722 }
1723
1724 /* vec_vcmpgtfp */
1725
1726 static vector bool int __attribute__((__always_inline__))
1727 vec_vcmpgtfp(vector float __a, vector float __b) {
1728   return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
1729 }
1730
1731 /* vec_cmple */
1732
1733 static vector bool char __ATTRS_o_ai
1734 vec_cmple (vector signed char __a, vector signed char __b) {
1735   return vec_cmpge(__b, __a);
1736 }
1737
1738 static vector bool char __ATTRS_o_ai
1739 vec_cmple (vector unsigned char __a, vector unsigned char __b) {
1740   return vec_cmpge(__b, __a);
1741 }
1742
1743 static vector bool short __ATTRS_o_ai
1744 vec_cmple (vector signed short __a, vector signed short __b) {
1745   return vec_cmpge(__b, __a);
1746 }
1747
1748 static vector bool short __ATTRS_o_ai
1749 vec_cmple (vector unsigned short __a, vector unsigned short __b) {
1750   return vec_cmpge(__b, __a);
1751 }
1752
1753 static vector bool int __ATTRS_o_ai
1754 vec_cmple (vector signed int __a, vector signed int __b) {
1755   return vec_cmpge(__b, __a);
1756 }
1757
1758 static vector bool int __ATTRS_o_ai
1759 vec_cmple (vector unsigned int __a, vector unsigned int __b) {
1760   return vec_cmpge(__b, __a);
1761 }
1762
1763 static vector bool int __ATTRS_o_ai
1764 vec_cmple(vector float __a, vector float __b) {
1765   return vec_cmpge(__b, __a);
1766 }
1767
1768 #ifdef __VSX__
1769 static vector bool long long __ATTRS_o_ai
1770 vec_cmple(vector double __a, vector double __b) {
1771   return vec_cmpge(__b, __a);
1772 }
1773 #endif
1774
1775 #ifdef __POWER8_VECTOR__
1776 static vector bool long long __ATTRS_o_ai
1777 vec_cmple(vector signed long long __a, vector signed long long __b) {
1778   return vec_cmpge(__b, __a);
1779 }
1780
1781 static vector bool long long __ATTRS_o_ai
1782 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
1783   return vec_cmpge(__b, __a);
1784 }
1785 #endif
1786
1787 /* vec_cmplt */
1788
1789 static vector bool char __ATTRS_o_ai vec_cmplt(vector signed char __a,
1790                                                vector signed char __b) {
1791   return vec_cmpgt(__b, __a);
1792 }
1793
1794 static vector bool char __ATTRS_o_ai vec_cmplt(vector unsigned char __a,
1795                                                vector unsigned char __b) {
1796   return vec_cmpgt(__b, __a);
1797 }
1798
1799 static vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
1800                                                 vector short __b) {
1801   return vec_cmpgt(__b, __a);
1802 }
1803
1804 static vector bool short __ATTRS_o_ai vec_cmplt(vector unsigned short __a,
1805                                                 vector unsigned short __b) {
1806   return vec_cmpgt(__b, __a);
1807 }
1808
1809 static vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, vector int __b) {
1810   return vec_cmpgt(__b, __a);
1811 }
1812
1813 static vector bool int __ATTRS_o_ai vec_cmplt(vector unsigned int __a,
1814                                               vector unsigned int __b) {
1815   return vec_cmpgt(__b, __a);
1816 }
1817
1818 static vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
1819                                               vector float __b) {
1820   return vec_cmpgt(__b, __a);
1821 }
1822
1823 #ifdef __VSX__
1824 static vector bool long long __ATTRS_o_ai
1825 vec_cmplt(vector double __a, vector double __b) {
1826   return vec_cmpgt(__b, __a);
1827 }
1828 #endif
1829
1830 #ifdef __POWER8_VECTOR__
1831 static vector bool long long __ATTRS_o_ai
1832 vec_cmplt(vector signed long long __a, vector signed long long __b) {
1833   return vec_cmpgt(__b, __a);
1834 }
1835
1836 static vector bool long long __ATTRS_o_ai
1837 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
1838   return vec_cmpgt(__b, __a);
1839 }
1840
1841 /* vec_cntlz */
1842
1843 static vector signed char __ATTRS_o_ai vec_cntlz(vector signed char __a) {
1844   return __builtin_altivec_vclzb(__a);
1845 }
1846 static vector unsigned char __ATTRS_o_ai vec_cntlz(vector unsigned char __a) {
1847   return __builtin_altivec_vclzb(__a);
1848 }
1849 static vector signed short __ATTRS_o_ai vec_cntlz(vector signed short __a) {
1850   return __builtin_altivec_vclzh(__a);
1851 }
1852 static vector unsigned short __ATTRS_o_ai vec_cntlz(vector unsigned short __a) {
1853   return __builtin_altivec_vclzh(__a);
1854 }
1855 static vector signed int __ATTRS_o_ai vec_cntlz(vector signed int __a) {
1856   return __builtin_altivec_vclzw(__a);
1857 }
1858 static vector unsigned int __ATTRS_o_ai vec_cntlz(vector unsigned int __a) {
1859   return __builtin_altivec_vclzw(__a);
1860 }
1861 static vector signed long long __ATTRS_o_ai
1862 vec_cntlz(vector signed long long __a) {
1863   return __builtin_altivec_vclzd(__a);
1864 }
1865 static vector unsigned long long __ATTRS_o_ai
1866 vec_cntlz(vector unsigned long long __a) {
1867   return __builtin_altivec_vclzd(__a);
1868 }
1869 #endif
1870
1871 /* vec_cpsgn */
1872
1873 #ifdef __VSX__
1874 static vector float __ATTRS_o_ai vec_cpsgn(vector float __a, vector float __b) {
1875   return __builtin_vsx_xvcpsgnsp(__a, __b);
1876 }
1877
1878 static vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
1879                                             vector double __b) {
1880   return __builtin_vsx_xvcpsgndp(__a, __b);
1881 }
1882 #endif
1883
1884 /* vec_ctf */
1885
1886 static vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) {
1887   return __builtin_altivec_vcfsx(__a, __b);
1888 }
1889
1890 static vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a, int __b) {
1891   return __builtin_altivec_vcfux((vector int)__a, __b);
1892 }
1893
1894 #ifdef __VSX__
1895 static vector double __ATTRS_o_ai vec_ctf(vector unsigned long long __a,
1896                                           int __b) {
1897   vector double __ret = __builtin_convertvector(__a, vector double);
1898   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1899   return __ret;
1900 }
1901
1902 static vector double __ATTRS_o_ai vec_ctf(vector signed long long __a,
1903                                           int __b) {
1904   vector double __ret = __builtin_convertvector(__a, vector double);
1905   __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
1906   return __ret;
1907 }
1908 #endif
1909
1910 /* vec_vcfsx */
1911
1912 static vector float __attribute__((__always_inline__))
1913 vec_vcfsx(vector int __a, int __b) {
1914   return __builtin_altivec_vcfsx(__a, __b);
1915 }
1916
1917 /* vec_vcfux */
1918
1919 static vector float __attribute__((__always_inline__))
1920 vec_vcfux(vector unsigned int __a, int __b) {
1921   return __builtin_altivec_vcfux((vector int)__a, __b);
1922 }
1923
1924 /* vec_cts */
1925
1926 static vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) {
1927   return __builtin_altivec_vctsxs(__a, __b);
1928 }
1929
1930 #ifdef __VSX__
1931 static vector signed long long __ATTRS_o_ai vec_cts(vector double __a,
1932                                                     int __b) {
1933   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
1934   return __builtin_convertvector(__a, vector signed long long);
1935 }
1936 #endif
1937
1938 /* vec_vctsxs */
1939
1940 static vector int __attribute__((__always_inline__))
1941 vec_vctsxs(vector float __a, int __b) {
1942   return __builtin_altivec_vctsxs(__a, __b);
1943 }
1944
1945 /* vec_ctu */
1946
1947 static vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a, int __b) {
1948   return __builtin_altivec_vctuxs(__a, __b);
1949 }
1950
1951 #ifdef __VSX__
1952 static vector unsigned long long __ATTRS_o_ai vec_ctu(vector double __a,
1953                                                       int __b) {
1954   __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
1955   return __builtin_convertvector(__a, vector unsigned long long);
1956 }
1957 #endif
1958
1959 /* vec_vctuxs */
1960
1961 static vector unsigned int __attribute__((__always_inline__))
1962 vec_vctuxs(vector float __a, int __b) {
1963   return __builtin_altivec_vctuxs(__a, __b);
1964 }
1965
1966 /* vec_double */
1967
1968 #ifdef __VSX__
1969 static vector double __ATTRS_o_ai vec_double (vector signed long long __a) {
1970   vector double __ret = { __a[0], __a[1] };
1971   return __ret;
1972 }
1973
1974 static vector double __ATTRS_o_ai vec_double (vector unsigned long long __a) {
1975   vector double __ret = { __a[0], __a[1] };
1976   return __ret;
1977 }
1978 #endif
1979
1980 /* vec_div */
1981
1982 /* Integer vector divides (vectors are scalarized, elements divided
1983    and the vectors reassembled).
1984 */
1985 static vector signed char __ATTRS_o_ai vec_div(vector signed char __a,
1986                                                vector signed char __b) {
1987   return __a / __b;
1988 }
1989
1990 static vector unsigned char __ATTRS_o_ai vec_div(vector unsigned char __a,
1991                                                  vector unsigned char __b) {
1992   return __a / __b;
1993 }
1994
1995 static vector signed short __ATTRS_o_ai vec_div(vector signed short __a,
1996                                                 vector signed short __b) {
1997   return __a / __b;
1998 }
1999
2000 static vector unsigned short __ATTRS_o_ai vec_div(vector unsigned short __a,
2001                                                   vector unsigned short __b) {
2002   return __a / __b;
2003 }
2004
2005 static vector signed int __ATTRS_o_ai vec_div(vector signed int __a,
2006                                               vector signed int __b) {
2007   return __a / __b;
2008 }
2009
2010 static vector unsigned int __ATTRS_o_ai vec_div(vector unsigned int __a,
2011                                                 vector unsigned int __b) {
2012   return __a / __b;
2013 }
2014
2015 #ifdef __VSX__
2016 static vector signed long long __ATTRS_o_ai
2017 vec_div(vector signed long long __a, vector signed long long __b) {
2018   return __a / __b;
2019 }
2020
2021 static vector unsigned long long __ATTRS_o_ai
2022 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
2023   return __a / __b;
2024 }
2025
2026 static vector float __ATTRS_o_ai vec_div(vector float __a, vector float __b) {
2027   return __a / __b;
2028 }
2029
2030 static vector double __ATTRS_o_ai vec_div(vector double __a,
2031                                           vector double __b) {
2032   return __a / __b;
2033 }
2034 #endif
2035
2036 /* vec_dss */
2037
2038 static void __attribute__((__always_inline__)) vec_dss(int __a) {
2039   __builtin_altivec_dss(__a);
2040 }
2041
2042 /* vec_dssall */
2043
2044 static void __attribute__((__always_inline__)) vec_dssall(void) {
2045   __builtin_altivec_dssall();
2046 }
2047
2048 /* vec_dst */
2049
2050 static void __attribute__((__always_inline__))
2051 vec_dst(const void *__a, int __b, int __c) {
2052   __builtin_altivec_dst(__a, __b, __c);
2053 }
2054
2055 /* vec_dstst */
2056
2057 static void __attribute__((__always_inline__))
2058 vec_dstst(const void *__a, int __b, int __c) {
2059   __builtin_altivec_dstst(__a, __b, __c);
2060 }
2061
2062 /* vec_dststt */
2063
2064 static void __attribute__((__always_inline__))
2065 vec_dststt(const void *__a, int __b, int __c) {
2066   __builtin_altivec_dststt(__a, __b, __c);
2067 }
2068
2069 /* vec_dstt */
2070
2071 static void __attribute__((__always_inline__))
2072 vec_dstt(const void *__a, int __b, int __c) {
2073   __builtin_altivec_dstt(__a, __b, __c);
2074 }
2075
2076 /* vec_eqv */
2077
2078 #ifdef __POWER8_VECTOR__
2079 static vector signed char __ATTRS_o_ai vec_eqv(vector signed char __a,
2080                                                vector signed char __b) {
2081   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2082                                                   (vector unsigned int)__b);
2083 }
2084
2085 static vector unsigned char __ATTRS_o_ai vec_eqv(vector unsigned char __a,
2086                                                  vector unsigned char __b) {
2087   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2088                                                     (vector unsigned int)__b);
2089 }
2090
2091 static vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
2092                                              vector bool char __b) {
2093   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2094                                                 (vector unsigned int)__b);
2095 }
2096
2097 static vector signed short __ATTRS_o_ai vec_eqv(vector signed short __a,
2098                                                 vector signed short __b) {
2099   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2100                                                    (vector unsigned int)__b);
2101 }
2102
2103 static vector unsigned short __ATTRS_o_ai vec_eqv(vector unsigned short __a,
2104                                                   vector unsigned short __b) {
2105   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2106                                                      (vector unsigned int)__b);
2107 }
2108
2109 static vector bool short __ATTRS_o_ai vec_eqv(vector bool short __a,
2110                                               vector bool short __b) {
2111   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2112                                                  (vector unsigned int)__b);
2113 }
2114
2115 static vector signed int __ATTRS_o_ai vec_eqv(vector signed int __a,
2116                                               vector signed int __b) {
2117   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2118                                                  (vector unsigned int)__b);
2119 }
2120
2121 static vector unsigned int __ATTRS_o_ai vec_eqv(vector unsigned int __a,
2122                                                 vector unsigned int __b) {
2123   return __builtin_vsx_xxleqv(__a, __b);
2124 }
2125
2126 static vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
2127                                             vector bool int __b) {
2128   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2129                                                  (vector unsigned int)__b);
2130 }
2131
2132 static vector signed long long __ATTRS_o_ai
2133 vec_eqv(vector signed long long __a, vector signed long long __b) {
2134   return (vector signed long long)
2135     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2136 }
2137
2138 static vector unsigned long long __ATTRS_o_ai
2139 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
2140   return (vector unsigned long long)
2141     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2142 }
2143
2144 static vector bool long long __ATTRS_o_ai
2145 vec_eqv(vector bool long long __a, vector bool long long __b) {
2146   return (vector bool long long)
2147     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2148 }
2149
2150 static vector float __ATTRS_o_ai vec_eqv(vector float __a, vector float __b) {
2151   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
2152                                             (vector unsigned int)__b);
2153 }
2154
2155 static vector double __ATTRS_o_ai vec_eqv(vector double __a,
2156                                           vector double __b) {
2157   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
2158                                              (vector unsigned int)__b);
2159 }
2160 #endif
2161
2162 /* vec_expte */
2163
2164 static vector float __attribute__((__always_inline__))
2165 vec_expte(vector float __a) {
2166   return __builtin_altivec_vexptefp(__a);
2167 }
2168
2169 /* vec_vexptefp */
2170
2171 static vector float __attribute__((__always_inline__))
2172 vec_vexptefp(vector float __a) {
2173   return __builtin_altivec_vexptefp(__a);
2174 }
2175
2176 /* vec_floor */
2177
2178 static vector float __ATTRS_o_ai vec_floor(vector float __a) {
2179 #ifdef __VSX__
2180   return __builtin_vsx_xvrspim(__a);
2181 #else
2182   return __builtin_altivec_vrfim(__a);
2183 #endif
2184 }
2185
2186 #ifdef __VSX__
2187 static vector double __ATTRS_o_ai vec_floor(vector double __a) {
2188   return __builtin_vsx_xvrdpim(__a);
2189 }
2190 #endif
2191
2192 /* vec_vrfim */
2193
2194 static vector float __attribute__((__always_inline__))
2195 vec_vrfim(vector float __a) {
2196   return __builtin_altivec_vrfim(__a);
2197 }
2198
2199 /* vec_ld */
2200
2201 static vector signed char __ATTRS_o_ai vec_ld(int __a,
2202                                               const vector signed char *__b) {
2203   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2204 }
2205
2206 static vector signed char __ATTRS_o_ai vec_ld(int __a, const signed char *__b) {
2207   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2208 }
2209
2210 static vector unsigned char __ATTRS_o_ai
2211 vec_ld(int __a, const vector unsigned char *__b) {
2212   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2213 }
2214
2215 static vector unsigned char __ATTRS_o_ai vec_ld(int __a,
2216                                                 const unsigned char *__b) {
2217   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2218 }
2219
2220 static vector bool char __ATTRS_o_ai vec_ld(int __a,
2221                                             const vector bool char *__b) {
2222   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2223 }
2224
2225 static vector short __ATTRS_o_ai vec_ld(int __a, const vector short *__b) {
2226   return (vector short)__builtin_altivec_lvx(__a, __b);
2227 }
2228
2229 static vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
2230   return (vector short)__builtin_altivec_lvx(__a, __b);
2231 }
2232
2233 static vector unsigned short __ATTRS_o_ai
2234 vec_ld(int __a, const vector unsigned short *__b) {
2235   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2236 }
2237
2238 static vector unsigned short __ATTRS_o_ai vec_ld(int __a,
2239                                                  const unsigned short *__b) {
2240   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2241 }
2242
2243 static vector bool short __ATTRS_o_ai vec_ld(int __a,
2244                                              const vector bool short *__b) {
2245   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2246 }
2247
2248 static vector pixel __ATTRS_o_ai vec_ld(int __a, const vector pixel *__b) {
2249   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2250 }
2251
2252 static vector int __ATTRS_o_ai vec_ld(int __a, const vector int *__b) {
2253   return (vector int)__builtin_altivec_lvx(__a, __b);
2254 }
2255
2256 static vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
2257   return (vector int)__builtin_altivec_lvx(__a, __b);
2258 }
2259
2260 static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
2261                                                const vector unsigned int *__b) {
2262   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2263 }
2264
2265 static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
2266                                                const unsigned int *__b) {
2267   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2268 }
2269
2270 static vector bool int __ATTRS_o_ai vec_ld(int __a,
2271                                            const vector bool int *__b) {
2272   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2273 }
2274
2275 static vector float __ATTRS_o_ai vec_ld(int __a, const vector float *__b) {
2276   return (vector float)__builtin_altivec_lvx(__a, __b);
2277 }
2278
2279 static vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
2280   return (vector float)__builtin_altivec_lvx(__a, __b);
2281 }
2282
2283 /* vec_lvx */
2284
2285 static vector signed char __ATTRS_o_ai vec_lvx(int __a,
2286                                                const vector signed char *__b) {
2287   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2288 }
2289
2290 static vector signed char __ATTRS_o_ai vec_lvx(int __a,
2291                                                const signed char *__b) {
2292   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2293 }
2294
2295 static vector unsigned char __ATTRS_o_ai
2296 vec_lvx(int __a, const vector unsigned char *__b) {
2297   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2298 }
2299
2300 static vector unsigned char __ATTRS_o_ai vec_lvx(int __a,
2301                                                  const unsigned char *__b) {
2302   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2303 }
2304
2305 static vector bool char __ATTRS_o_ai vec_lvx(int __a,
2306                                              const vector bool char *__b) {
2307   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2308 }
2309
2310 static vector short __ATTRS_o_ai vec_lvx(int __a, const vector short *__b) {
2311   return (vector short)__builtin_altivec_lvx(__a, __b);
2312 }
2313
2314 static vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
2315   return (vector short)__builtin_altivec_lvx(__a, __b);
2316 }
2317
2318 static vector unsigned short __ATTRS_o_ai
2319 vec_lvx(int __a, const vector unsigned short *__b) {
2320   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2321 }
2322
2323 static vector unsigned short __ATTRS_o_ai vec_lvx(int __a,
2324                                                   const unsigned short *__b) {
2325   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2326 }
2327
2328 static vector bool short __ATTRS_o_ai vec_lvx(int __a,
2329                                               const vector bool short *__b) {
2330   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2331 }
2332
2333 static vector pixel __ATTRS_o_ai vec_lvx(int __a, const vector pixel *__b) {
2334   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2335 }
2336
2337 static vector int __ATTRS_o_ai vec_lvx(int __a, const vector int *__b) {
2338   return (vector int)__builtin_altivec_lvx(__a, __b);
2339 }
2340
2341 static vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
2342   return (vector int)__builtin_altivec_lvx(__a, __b);
2343 }
2344
2345 static vector unsigned int __ATTRS_o_ai
2346 vec_lvx(int __a, const vector unsigned int *__b) {
2347   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2348 }
2349
2350 static vector unsigned int __ATTRS_o_ai vec_lvx(int __a,
2351                                                 const unsigned int *__b) {
2352   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2353 }
2354
2355 static vector bool int __ATTRS_o_ai vec_lvx(int __a,
2356                                             const vector bool int *__b) {
2357   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2358 }
2359
2360 static vector float __ATTRS_o_ai vec_lvx(int __a, const vector float *__b) {
2361   return (vector float)__builtin_altivec_lvx(__a, __b);
2362 }
2363
2364 static vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
2365   return (vector float)__builtin_altivec_lvx(__a, __b);
2366 }
2367
2368 /* vec_lde */
2369
2370 static vector signed char __ATTRS_o_ai vec_lde(int __a,
2371                                                const signed char *__b) {
2372   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2373 }
2374
2375 static vector unsigned char __ATTRS_o_ai vec_lde(int __a,
2376                                                  const unsigned char *__b) {
2377   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2378 }
2379
2380 static vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
2381   return (vector short)__builtin_altivec_lvehx(__a, __b);
2382 }
2383
2384 static vector unsigned short __ATTRS_o_ai vec_lde(int __a,
2385                                                   const unsigned short *__b) {
2386   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2387 }
2388
2389 static vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
2390   return (vector int)__builtin_altivec_lvewx(__a, __b);
2391 }
2392
2393 static vector unsigned int __ATTRS_o_ai vec_lde(int __a,
2394                                                 const unsigned int *__b) {
2395   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2396 }
2397
2398 static vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
2399   return (vector float)__builtin_altivec_lvewx(__a, __b);
2400 }
2401
2402 /* vec_lvebx */
2403
2404 static vector signed char __ATTRS_o_ai vec_lvebx(int __a,
2405                                                  const signed char *__b) {
2406   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2407 }
2408
2409 static vector unsigned char __ATTRS_o_ai vec_lvebx(int __a,
2410                                                    const unsigned char *__b) {
2411   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2412 }
2413
2414 /* vec_lvehx */
2415
2416 static vector short __ATTRS_o_ai vec_lvehx(int __a, const short *__b) {
2417   return (vector short)__builtin_altivec_lvehx(__a, __b);
2418 }
2419
2420 static vector unsigned short __ATTRS_o_ai vec_lvehx(int __a,
2421                                                     const unsigned short *__b) {
2422   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2423 }
2424
2425 /* vec_lvewx */
2426
2427 static vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
2428   return (vector int)__builtin_altivec_lvewx(__a, __b);
2429 }
2430
2431 static vector unsigned int __ATTRS_o_ai vec_lvewx(int __a,
2432                                                   const unsigned int *__b) {
2433   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2434 }
2435
2436 static vector float __ATTRS_o_ai vec_lvewx(int __a, const float *__b) {
2437   return (vector float)__builtin_altivec_lvewx(__a, __b);
2438 }
2439
2440 /* vec_ldl */
2441
2442 static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2443                                                const vector signed char *__b) {
2444   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2445 }
2446
2447 static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2448                                                const signed char *__b) {
2449   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2450 }
2451
2452 static vector unsigned char __ATTRS_o_ai
2453 vec_ldl(int __a, const vector unsigned char *__b) {
2454   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2455 }
2456
2457 static vector unsigned char __ATTRS_o_ai vec_ldl(int __a,
2458                                                  const unsigned char *__b) {
2459   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2460 }
2461
2462 static vector bool char __ATTRS_o_ai vec_ldl(int __a,
2463                                              const vector bool char *__b) {
2464   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2465 }
2466
2467 static vector short __ATTRS_o_ai vec_ldl(int __a, const vector short *__b) {
2468   return (vector short)__builtin_altivec_lvxl(__a, __b);
2469 }
2470
2471 static vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
2472   return (vector short)__builtin_altivec_lvxl(__a, __b);
2473 }
2474
2475 static vector unsigned short __ATTRS_o_ai
2476 vec_ldl(int __a, const vector unsigned short *__b) {
2477   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2478 }
2479
2480 static vector unsigned short __ATTRS_o_ai vec_ldl(int __a,
2481                                                   const unsigned short *__b) {
2482   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2483 }
2484
2485 static vector bool short __ATTRS_o_ai vec_ldl(int __a,
2486                                               const vector bool short *__b) {
2487   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2488 }
2489
2490 static vector pixel __ATTRS_o_ai vec_ldl(int __a, const vector pixel *__b) {
2491   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
2492 }
2493
2494 static vector int __ATTRS_o_ai vec_ldl(int __a, const vector int *__b) {
2495   return (vector int)__builtin_altivec_lvxl(__a, __b);
2496 }
2497
2498 static vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
2499   return (vector int)__builtin_altivec_lvxl(__a, __b);
2500 }
2501
2502 static vector unsigned int __ATTRS_o_ai
2503 vec_ldl(int __a, const vector unsigned int *__b) {
2504   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2505 }
2506
2507 static vector unsigned int __ATTRS_o_ai vec_ldl(int __a,
2508                                                 const unsigned int *__b) {
2509   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2510 }
2511
2512 static vector bool int __ATTRS_o_ai vec_ldl(int __a,
2513                                             const vector bool int *__b) {
2514   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2515 }
2516
2517 static vector float __ATTRS_o_ai vec_ldl(int __a, const vector float *__b) {
2518   return (vector float)__builtin_altivec_lvxl(__a, __b);
2519 }
2520
2521 static vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
2522   return (vector float)__builtin_altivec_lvxl(__a, __b);
2523 }
2524
2525 /* vec_lvxl */
2526
2527 static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2528                                                 const vector signed char *__b) {
2529   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2530 }
2531
2532 static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2533                                                 const signed char *__b) {
2534   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2535 }
2536
2537 static vector unsigned char __ATTRS_o_ai
2538 vec_lvxl(int __a, const vector unsigned char *__b) {
2539   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2540 }
2541
2542 static vector unsigned char __ATTRS_o_ai vec_lvxl(int __a,
2543                                                   const unsigned char *__b) {
2544   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2545 }
2546
2547 static vector bool char __ATTRS_o_ai vec_lvxl(int __a,
2548                                               const vector bool char *__b) {
2549   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2550 }
2551
2552 static vector short __ATTRS_o_ai vec_lvxl(int __a, const vector short *__b) {
2553   return (vector short)__builtin_altivec_lvxl(__a, __b);
2554 }
2555
2556 static vector short __ATTRS_o_ai vec_lvxl(int __a, const short *__b) {
2557   return (vector short)__builtin_altivec_lvxl(__a, __b);
2558 }
2559
2560 static vector unsigned short __ATTRS_o_ai
2561 vec_lvxl(int __a, const vector unsigned short *__b) {
2562   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2563 }
2564
2565 static vector unsigned short __ATTRS_o_ai vec_lvxl(int __a,
2566                                                    const unsigned short *__b) {
2567   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2568 }
2569
2570 static vector bool short __ATTRS_o_ai vec_lvxl(int __a,
2571                                                const vector bool short *__b) {
2572   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2573 }
2574
2575 static vector pixel __ATTRS_o_ai vec_lvxl(int __a, const vector pixel *__b) {
2576   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
2577 }
2578
2579 static vector int __ATTRS_o_ai vec_lvxl(int __a, const vector int *__b) {
2580   return (vector int)__builtin_altivec_lvxl(__a, __b);
2581 }
2582
2583 static vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
2584   return (vector int)__builtin_altivec_lvxl(__a, __b);
2585 }
2586
2587 static vector unsigned int __ATTRS_o_ai
2588 vec_lvxl(int __a, const vector unsigned int *__b) {
2589   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2590 }
2591
2592 static vector unsigned int __ATTRS_o_ai vec_lvxl(int __a,
2593                                                  const unsigned int *__b) {
2594   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2595 }
2596
2597 static vector bool int __ATTRS_o_ai vec_lvxl(int __a,
2598                                              const vector bool int *__b) {
2599   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2600 }
2601
2602 static vector float __ATTRS_o_ai vec_lvxl(int __a, const vector float *__b) {
2603   return (vector float)__builtin_altivec_lvxl(__a, __b);
2604 }
2605
2606 static vector float __ATTRS_o_ai vec_lvxl(int __a, const float *__b) {
2607   return (vector float)__builtin_altivec_lvxl(__a, __b);
2608 }
2609
2610 /* vec_loge */
2611
2612 static vector float __attribute__((__always_inline__))
2613 vec_loge(vector float __a) {
2614   return __builtin_altivec_vlogefp(__a);
2615 }
2616
2617 /* vec_vlogefp */
2618
2619 static vector float __attribute__((__always_inline__))
2620 vec_vlogefp(vector float __a) {
2621   return __builtin_altivec_vlogefp(__a);
2622 }
2623
2624 /* vec_lvsl */
2625
2626 #ifdef __LITTLE_ENDIAN__
2627 static vector unsigned char __ATTRS_o_ai
2628     __attribute__((__deprecated__("use assignment for unaligned little endian \
2629 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2630   vector unsigned char mask =
2631       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2632   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2633                                   7,  6,  5,  4,  3,  2,  1, 0};
2634   return vec_perm(mask, mask, reverse);
2635 }
2636 #else
2637 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2638                                                   const signed char *__b) {
2639   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2640 }
2641 #endif
2642
2643 #ifdef __LITTLE_ENDIAN__
2644 static vector unsigned char __ATTRS_o_ai
2645     __attribute__((__deprecated__("use assignment for unaligned little endian \
2646 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
2647   vector unsigned char mask =
2648       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2649   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2650                                   7,  6,  5,  4,  3,  2,  1, 0};
2651   return vec_perm(mask, mask, reverse);
2652 }
2653 #else
2654 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2655                                                   const unsigned char *__b) {
2656   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2657 }
2658 #endif
2659
2660 #ifdef __LITTLE_ENDIAN__
2661 static vector unsigned char __ATTRS_o_ai
2662     __attribute__((__deprecated__("use assignment for unaligned little endian \
2663 loads/stores"))) vec_lvsl(int __a, const short *__b) {
2664   vector unsigned char mask =
2665       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2666   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2667                                   7,  6,  5,  4,  3,  2,  1, 0};
2668   return vec_perm(mask, mask, reverse);
2669 }
2670 #else
2671 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const short *__b) {
2672   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2673 }
2674 #endif
2675
2676 #ifdef __LITTLE_ENDIAN__
2677 static vector unsigned char __ATTRS_o_ai
2678     __attribute__((__deprecated__("use assignment for unaligned little endian \
2679 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
2680   vector unsigned char mask =
2681       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2682   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2683                                   7,  6,  5,  4,  3,  2,  1, 0};
2684   return vec_perm(mask, mask, reverse);
2685 }
2686 #else
2687 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2688                                                   const unsigned short *__b) {
2689   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2690 }
2691 #endif
2692
2693 #ifdef __LITTLE_ENDIAN__
2694 static vector unsigned char __ATTRS_o_ai
2695     __attribute__((__deprecated__("use assignment for unaligned little endian \
2696 loads/stores"))) vec_lvsl(int __a, const int *__b) {
2697   vector unsigned char mask =
2698       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2699   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2700                                   7,  6,  5,  4,  3,  2,  1, 0};
2701   return vec_perm(mask, mask, reverse);
2702 }
2703 #else
2704 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const int *__b) {
2705   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2706 }
2707 #endif
2708
2709 #ifdef __LITTLE_ENDIAN__
2710 static vector unsigned char __ATTRS_o_ai
2711     __attribute__((__deprecated__("use assignment for unaligned little endian \
2712 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
2713   vector unsigned char mask =
2714       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2715   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2716                                   7,  6,  5,  4,  3,  2,  1, 0};
2717   return vec_perm(mask, mask, reverse);
2718 }
2719 #else
2720 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2721                                                   const unsigned int *__b) {
2722   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2723 }
2724 #endif
2725
2726 #ifdef __LITTLE_ENDIAN__
2727 static vector unsigned char __ATTRS_o_ai
2728     __attribute__((__deprecated__("use assignment for unaligned little endian \
2729 loads/stores"))) vec_lvsl(int __a, const float *__b) {
2730   vector unsigned char mask =
2731       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2732   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2733                                   7,  6,  5,  4,  3,  2,  1, 0};
2734   return vec_perm(mask, mask, reverse);
2735 }
2736 #else
2737 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const float *__b) {
2738   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2739 }
2740 #endif
2741
2742 /* vec_lvsr */
2743
2744 #ifdef __LITTLE_ENDIAN__
2745 static vector unsigned char __ATTRS_o_ai
2746     __attribute__((__deprecated__("use assignment for unaligned little endian \
2747 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
2748   vector unsigned char mask =
2749       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2750   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2751                                   7,  6,  5,  4,  3,  2,  1, 0};
2752   return vec_perm(mask, mask, reverse);
2753 }
2754 #else
2755 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2756                                                   const signed char *__b) {
2757   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2758 }
2759 #endif
2760
2761 #ifdef __LITTLE_ENDIAN__
2762 static vector unsigned char __ATTRS_o_ai
2763     __attribute__((__deprecated__("use assignment for unaligned little endian \
2764 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
2765   vector unsigned char mask =
2766       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2767   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2768                                   7,  6,  5,  4,  3,  2,  1, 0};
2769   return vec_perm(mask, mask, reverse);
2770 }
2771 #else
2772 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2773                                                   const unsigned char *__b) {
2774   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2775 }
2776 #endif
2777
2778 #ifdef __LITTLE_ENDIAN__
2779 static vector unsigned char __ATTRS_o_ai
2780     __attribute__((__deprecated__("use assignment for unaligned little endian \
2781 loads/stores"))) vec_lvsr(int __a, const short *__b) {
2782   vector unsigned char mask =
2783       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2784   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2785                                   7,  6,  5,  4,  3,  2,  1, 0};
2786   return vec_perm(mask, mask, reverse);
2787 }
2788 #else
2789 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const short *__b) {
2790   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2791 }
2792 #endif
2793
2794 #ifdef __LITTLE_ENDIAN__
2795 static vector unsigned char __ATTRS_o_ai
2796     __attribute__((__deprecated__("use assignment for unaligned little endian \
2797 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
2798   vector unsigned char mask =
2799       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2800   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2801                                   7,  6,  5,  4,  3,  2,  1, 0};
2802   return vec_perm(mask, mask, reverse);
2803 }
2804 #else
2805 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2806                                                   const unsigned short *__b) {
2807   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2808 }
2809 #endif
2810
2811 #ifdef __LITTLE_ENDIAN__
2812 static vector unsigned char __ATTRS_o_ai
2813     __attribute__((__deprecated__("use assignment for unaligned little endian \
2814 loads/stores"))) vec_lvsr(int __a, const int *__b) {
2815   vector unsigned char mask =
2816       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2817   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2818                                   7,  6,  5,  4,  3,  2,  1, 0};
2819   return vec_perm(mask, mask, reverse);
2820 }
2821 #else
2822 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const int *__b) {
2823   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2824 }
2825 #endif
2826
2827 #ifdef __LITTLE_ENDIAN__
2828 static vector unsigned char __ATTRS_o_ai
2829     __attribute__((__deprecated__("use assignment for unaligned little endian \
2830 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
2831   vector unsigned char mask =
2832       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2833   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2834                                   7,  6,  5,  4,  3,  2,  1, 0};
2835   return vec_perm(mask, mask, reverse);
2836 }
2837 #else
2838 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2839                                                   const unsigned int *__b) {
2840   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2841 }
2842 #endif
2843
2844 #ifdef __LITTLE_ENDIAN__
2845 static vector unsigned char __ATTRS_o_ai
2846     __attribute__((__deprecated__("use assignment for unaligned little endian \
2847 loads/stores"))) vec_lvsr(int __a, const float *__b) {
2848   vector unsigned char mask =
2849       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2850   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2851                                   7,  6,  5,  4,  3,  2,  1, 0};
2852   return vec_perm(mask, mask, reverse);
2853 }
2854 #else
2855 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const float *__b) {
2856   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2857 }
2858 #endif
2859
2860 /* vec_madd */
2861 static vector signed short __ATTRS_o_ai
2862 vec_mladd(vector signed short, vector signed short, vector signed short);
2863 static vector signed short __ATTRS_o_ai
2864 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
2865 static vector signed short __ATTRS_o_ai
2866 vec_mladd(vector unsigned short, vector signed short, vector signed short);
2867 static vector unsigned short __ATTRS_o_ai
2868 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
2869
2870 static vector signed short __ATTRS_o_ai
2871 vec_madd(vector signed short __a, vector signed short __b,
2872          vector signed short __c) {
2873   return  vec_mladd(__a, __b, __c);
2874 }
2875
2876 static vector signed short __ATTRS_o_ai
2877 vec_madd(vector signed short __a, vector unsigned short __b,
2878          vector unsigned short __c) {
2879   return vec_mladd(__a, __b, __c);
2880 }
2881
2882 static vector signed short __ATTRS_o_ai
2883 vec_madd(vector unsigned short __a, vector signed short __b,
2884          vector signed short __c) {
2885   return vec_mladd(__a, __b, __c);
2886 }
2887
2888 static vector unsigned short __ATTRS_o_ai
2889 vec_madd(vector unsigned short __a, vector unsigned short __b,
2890          vector unsigned short __c) {
2891   return vec_mladd(__a, __b, __c);
2892 }
2893
2894 static vector float __ATTRS_o_ai
2895 vec_madd(vector float __a, vector float __b, vector float __c) {
2896 #ifdef __VSX__
2897   return __builtin_vsx_xvmaddasp(__a, __b, __c);
2898 #else
2899   return __builtin_altivec_vmaddfp(__a, __b, __c);
2900 #endif
2901 }
2902
2903 #ifdef __VSX__
2904 static vector double __ATTRS_o_ai
2905 vec_madd(vector double __a, vector double __b, vector double __c) {
2906   return __builtin_vsx_xvmaddadp(__a, __b, __c);
2907 }
2908 #endif
2909
2910 /* vec_vmaddfp */
2911
2912 static vector float __attribute__((__always_inline__))
2913 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
2914   return __builtin_altivec_vmaddfp(__a, __b, __c);
2915 }
2916
2917 /* vec_madds */
2918
2919 static vector signed short __attribute__((__always_inline__))
2920 vec_madds(vector signed short __a, vector signed short __b,
2921           vector signed short __c) {
2922   return __builtin_altivec_vmhaddshs(__a, __b, __c);
2923 }
2924
2925 /* vec_vmhaddshs */
2926 static vector signed short __attribute__((__always_inline__))
2927 vec_vmhaddshs(vector signed short __a, vector signed short __b,
2928               vector signed short __c) {
2929   return __builtin_altivec_vmhaddshs(__a, __b, __c);
2930 }
2931
2932 /* vec_msub */
2933
2934 #ifdef __VSX__
2935 static vector float __ATTRS_o_ai
2936 vec_msub(vector float __a, vector float __b, vector float __c) {
2937   return __builtin_vsx_xvmsubasp(__a, __b, __c);
2938 }
2939
2940 static vector double __ATTRS_o_ai
2941 vec_msub(vector double __a, vector double __b, vector double __c) {
2942   return __builtin_vsx_xvmsubadp(__a, __b, __c);
2943 }
2944 #endif
2945
2946 /* vec_max */
2947
2948 static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2949                                                vector signed char __b) {
2950   return __builtin_altivec_vmaxsb(__a, __b);
2951 }
2952
2953 static vector signed char __ATTRS_o_ai vec_max(vector bool char __a,
2954                                                vector signed char __b) {
2955   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
2956 }
2957
2958 static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2959                                                vector bool char __b) {
2960   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
2961 }
2962
2963 static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2964                                                  vector unsigned char __b) {
2965   return __builtin_altivec_vmaxub(__a, __b);
2966 }
2967
2968 static vector unsigned char __ATTRS_o_ai vec_max(vector bool char __a,
2969                                                  vector unsigned char __b) {
2970   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
2971 }
2972
2973 static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2974                                                  vector bool char __b) {
2975   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
2976 }
2977
2978 static vector short __ATTRS_o_ai vec_max(vector short __a, vector short __b) {
2979   return __builtin_altivec_vmaxsh(__a, __b);
2980 }
2981
2982 static vector short __ATTRS_o_ai vec_max(vector bool short __a,
2983                                          vector short __b) {
2984   return __builtin_altivec_vmaxsh((vector short)__a, __b);
2985 }
2986
2987 static vector short __ATTRS_o_ai vec_max(vector short __a,
2988                                          vector bool short __b) {
2989   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
2990 }
2991
2992 static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2993                                                   vector unsigned short __b) {
2994   return __builtin_altivec_vmaxuh(__a, __b);
2995 }
2996
2997 static vector unsigned short __ATTRS_o_ai vec_max(vector bool short __a,
2998                                                   vector unsigned short __b) {
2999   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3000 }
3001
3002 static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
3003                                                   vector bool short __b) {
3004   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3005 }
3006
3007 static vector int __ATTRS_o_ai vec_max(vector int __a, vector int __b) {
3008   return __builtin_altivec_vmaxsw(__a, __b);
3009 }
3010
3011 static vector int __ATTRS_o_ai vec_max(vector bool int __a, vector int __b) {
3012   return __builtin_altivec_vmaxsw((vector int)__a, __b);
3013 }
3014
3015 static vector int __ATTRS_o_ai vec_max(vector int __a, vector bool int __b) {
3016   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3017 }
3018
3019 static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
3020                                                 vector unsigned int __b) {
3021   return __builtin_altivec_vmaxuw(__a, __b);
3022 }
3023
3024 static vector unsigned int __ATTRS_o_ai vec_max(vector bool int __a,
3025                                                 vector unsigned int __b) {
3026   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3027 }
3028
3029 static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
3030                                                 vector bool int __b) {
3031   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3032 }
3033
3034 #ifdef __POWER8_VECTOR__
3035 static vector signed long long __ATTRS_o_ai
3036 vec_max(vector signed long long __a, vector signed long long __b) {
3037   return __builtin_altivec_vmaxsd(__a, __b);
3038 }
3039
3040 static vector signed long long __ATTRS_o_ai
3041 vec_max(vector bool long long __a, vector signed long long __b) {
3042   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
3043 }
3044
3045 static vector signed long long __ATTRS_o_ai vec_max(vector signed long long __a,
3046                                                     vector bool long long __b) {
3047   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
3048 }
3049
3050 static vector unsigned long long __ATTRS_o_ai
3051 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
3052   return __builtin_altivec_vmaxud(__a, __b);
3053 }
3054
3055 static vector unsigned long long __ATTRS_o_ai
3056 vec_max(vector bool long long __a, vector unsigned long long __b) {
3057   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
3058 }
3059
3060 static vector unsigned long long __ATTRS_o_ai
3061 vec_max(vector unsigned long long __a, vector bool long long __b) {
3062   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
3063 }
3064 #endif
3065
3066 static vector float __ATTRS_o_ai vec_max(vector float __a, vector float __b) {
3067 #ifdef __VSX__
3068   return __builtin_vsx_xvmaxsp(__a, __b);
3069 #else
3070   return __builtin_altivec_vmaxfp(__a, __b);
3071 #endif
3072 }
3073
3074 #ifdef __VSX__
3075 static vector double __ATTRS_o_ai vec_max(vector double __a,
3076                                           vector double __b) {
3077   return __builtin_vsx_xvmaxdp(__a, __b);
3078 }
3079 #endif
3080
3081 /* vec_vmaxsb */
3082
3083 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
3084                                                   vector signed char __b) {
3085   return __builtin_altivec_vmaxsb(__a, __b);
3086 }
3087
3088 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector bool char __a,
3089                                                   vector signed char __b) {
3090   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3091 }
3092
3093 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
3094                                                   vector bool char __b) {
3095   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3096 }
3097
3098 /* vec_vmaxub */
3099
3100 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
3101                                                     vector unsigned char __b) {
3102   return __builtin_altivec_vmaxub(__a, __b);
3103 }
3104
3105 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector bool char __a,
3106                                                     vector unsigned char __b) {
3107   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3108 }
3109
3110 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
3111                                                     vector bool char __b) {
3112   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3113 }
3114
3115 /* vec_vmaxsh */
3116
3117 static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3118                                             vector short __b) {
3119   return __builtin_altivec_vmaxsh(__a, __b);
3120 }
3121
3122 static vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
3123                                             vector short __b) {
3124   return __builtin_altivec_vmaxsh((vector short)__a, __b);
3125 }
3126
3127 static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3128                                             vector bool short __b) {
3129   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3130 }
3131
3132 /* vec_vmaxuh */
3133
3134 static vector unsigned short __ATTRS_o_ai
3135 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
3136   return __builtin_altivec_vmaxuh(__a, __b);
3137 }
3138
3139 static vector unsigned short __ATTRS_o_ai
3140 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
3141   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3142 }
3143
3144 static vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a,
3145                                                      vector bool short __b) {
3146   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3147 }
3148
3149 /* vec_vmaxsw */
3150
3151 static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b) {
3152   return __builtin_altivec_vmaxsw(__a, __b);
3153 }
3154
3155 static vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, vector int __b) {
3156   return __builtin_altivec_vmaxsw((vector int)__a, __b);
3157 }
3158
3159 static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector bool int __b) {
3160   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3161 }
3162
3163 /* vec_vmaxuw */
3164
3165 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
3166                                                    vector unsigned int __b) {
3167   return __builtin_altivec_vmaxuw(__a, __b);
3168 }
3169
3170 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector bool int __a,
3171                                                    vector unsigned int __b) {
3172   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3173 }
3174
3175 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
3176                                                    vector bool int __b) {
3177   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3178 }
3179
3180 /* vec_vmaxfp */
3181
3182 static vector float __attribute__((__always_inline__))
3183 vec_vmaxfp(vector float __a, vector float __b) {
3184 #ifdef __VSX__
3185   return __builtin_vsx_xvmaxsp(__a, __b);
3186 #else
3187   return __builtin_altivec_vmaxfp(__a, __b);
3188 #endif
3189 }
3190
3191 /* vec_mergeh */
3192
3193 static vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a,
3194                                                   vector signed char __b) {
3195   return vec_perm(__a, __b,
3196                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3197                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3198                                          0x06, 0x16, 0x07, 0x17));
3199 }
3200
3201 static vector unsigned char __ATTRS_o_ai vec_mergeh(vector unsigned char __a,
3202                                                     vector unsigned char __b) {
3203   return vec_perm(__a, __b,
3204                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3205                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3206                                          0x06, 0x16, 0x07, 0x17));
3207 }
3208
3209 static vector bool char __ATTRS_o_ai vec_mergeh(vector bool char __a,
3210                                                 vector bool char __b) {
3211   return vec_perm(__a, __b,
3212                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3213                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3214                                          0x06, 0x16, 0x07, 0x17));
3215 }
3216
3217 static vector short __ATTRS_o_ai vec_mergeh(vector short __a,
3218                                             vector short __b) {
3219   return vec_perm(__a, __b,
3220                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3221                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3222                                          0x06, 0x07, 0x16, 0x17));
3223 }
3224
3225 static vector unsigned short __ATTRS_o_ai
3226 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
3227   return vec_perm(__a, __b,
3228                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3229                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3230                                          0x06, 0x07, 0x16, 0x17));
3231 }
3232
3233 static vector bool short __ATTRS_o_ai vec_mergeh(vector bool short __a,
3234                                                  vector bool short __b) {
3235   return vec_perm(__a, __b,
3236                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3237                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3238                                          0x06, 0x07, 0x16, 0x17));
3239 }
3240
3241 static vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
3242                                             vector pixel __b) {
3243   return vec_perm(__a, __b,
3244                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3245                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3246                                          0x06, 0x07, 0x16, 0x17));
3247 }
3248
3249 static vector int __ATTRS_o_ai vec_mergeh(vector int __a, vector int __b) {
3250   return vec_perm(__a, __b,
3251                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3252                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3253                                          0x14, 0x15, 0x16, 0x17));
3254 }
3255
3256 static vector unsigned int __ATTRS_o_ai vec_mergeh(vector unsigned int __a,
3257                                                    vector unsigned int __b) {
3258   return vec_perm(__a, __b,
3259                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3260                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3261                                          0x14, 0x15, 0x16, 0x17));
3262 }
3263
3264 static vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
3265                                                vector bool int __b) {
3266   return vec_perm(__a, __b,
3267                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3268                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3269                                          0x14, 0x15, 0x16, 0x17));
3270 }
3271
3272 static vector float __ATTRS_o_ai vec_mergeh(vector float __a,
3273                                             vector float __b) {
3274   return vec_perm(__a, __b,
3275                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3276                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3277                                          0x14, 0x15, 0x16, 0x17));
3278 }
3279
3280 #ifdef __VSX__
3281 static vector signed long long __ATTRS_o_ai
3282 vec_mergeh(vector signed long long __a, vector signed long long __b) {
3283   return vec_perm(__a, __b,
3284                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3285                                          0x04, 0x05, 0x06, 0x07,
3286                                          0x10, 0x11, 0x12, 0x13,
3287                                          0x14, 0x15, 0x16, 0x17));
3288 }
3289
3290 static vector signed long long __ATTRS_o_ai
3291 vec_mergeh(vector signed long long __a, vector bool long long __b) {
3292   return vec_perm(__a, (vector signed long long)__b,
3293                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3294                                          0x04, 0x05, 0x06, 0x07,
3295                                          0x10, 0x11, 0x12, 0x13,
3296                                          0x14, 0x15, 0x16, 0x17));
3297 }
3298
3299 static vector signed long long __ATTRS_o_ai
3300 vec_mergeh(vector bool long long __a, vector signed long long __b) {
3301   return vec_perm((vector signed long long)__a, __b,
3302                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3303                                          0x04, 0x05, 0x06, 0x07,
3304                                          0x10, 0x11, 0x12, 0x13,
3305                                          0x14, 0x15, 0x16, 0x17));
3306 }
3307
3308 static vector unsigned long long __ATTRS_o_ai
3309 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
3310   return vec_perm(__a, __b,
3311                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3312                                          0x04, 0x05, 0x06, 0x07,
3313                                          0x10, 0x11, 0x12, 0x13,
3314                                          0x14, 0x15, 0x16, 0x17));
3315 }
3316
3317 static vector unsigned long long __ATTRS_o_ai
3318 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
3319   return vec_perm(__a, (vector unsigned long long)__b,
3320                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3321                                          0x04, 0x05, 0x06, 0x07,
3322                                          0x10, 0x11, 0x12, 0x13,
3323                                          0x14, 0x15, 0x16, 0x17));
3324 }
3325
3326 static vector unsigned long long __ATTRS_o_ai
3327 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
3328   return vec_perm((vector unsigned long long)__a, __b,
3329                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3330                                          0x04, 0x05, 0x06, 0x07,
3331                                          0x10, 0x11, 0x12, 0x13,
3332                                          0x14, 0x15, 0x16, 0x17));
3333 }
3334
3335 static vector bool long long __ATTRS_o_ai
3336 vec_mergeh(vector bool long long __a, vector bool long long __b) {
3337   return vec_perm(__a, __b,
3338                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3339                                         0x04, 0x05, 0x06, 0x07,
3340                                         0x10, 0x11, 0x12, 0x13,
3341                                         0x14, 0x15, 0x16, 0x17));
3342 }
3343
3344 static vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3345                                              vector double __b) {
3346   return vec_perm(__a, __b,
3347                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3348                                          0x04, 0x05, 0x06, 0x07,
3349                                          0x10, 0x11, 0x12, 0x13,
3350                                          0x14, 0x15, 0x16, 0x17));
3351 }
3352 static vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3353                                              vector bool long long __b) {
3354   return vec_perm(__a, (vector double)__b,
3355                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3356                                          0x04, 0x05, 0x06, 0x07,
3357                                          0x10, 0x11, 0x12, 0x13,
3358                                          0x14, 0x15, 0x16, 0x17));
3359 }
3360 static vector double __ATTRS_o_ai vec_mergeh(vector bool long long __a,
3361                                              vector double __b) {
3362   return vec_perm((vector double)__a, __b,
3363                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3364                                          0x04, 0x05, 0x06, 0x07,
3365                                          0x10, 0x11, 0x12, 0x13,
3366                                          0x14, 0x15, 0x16, 0x17));
3367 }
3368 #endif
3369
3370 /* vec_vmrghb */
3371
3372 #define __builtin_altivec_vmrghb vec_vmrghb
3373
3374 static vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a,
3375                                                   vector signed char __b) {
3376   return vec_perm(__a, __b,
3377                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3378                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3379                                          0x06, 0x16, 0x07, 0x17));
3380 }
3381
3382 static vector unsigned char __ATTRS_o_ai vec_vmrghb(vector unsigned char __a,
3383                                                     vector unsigned char __b) {
3384   return vec_perm(__a, __b,
3385                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3386                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3387                                          0x06, 0x16, 0x07, 0x17));
3388 }
3389
3390 static vector bool char __ATTRS_o_ai vec_vmrghb(vector bool char __a,
3391                                                 vector bool char __b) {
3392   return vec_perm(__a, __b,
3393                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3394                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3395                                          0x06, 0x16, 0x07, 0x17));
3396 }
3397
3398 /* vec_vmrghh */
3399
3400 #define __builtin_altivec_vmrghh vec_vmrghh
3401
3402 static vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
3403                                             vector short __b) {
3404   return vec_perm(__a, __b,
3405                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3406                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3407                                          0x06, 0x07, 0x16, 0x17));
3408 }
3409
3410 static vector unsigned short __ATTRS_o_ai
3411 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
3412   return vec_perm(__a, __b,
3413                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3414                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3415                                          0x06, 0x07, 0x16, 0x17));
3416 }
3417
3418 static vector bool short __ATTRS_o_ai vec_vmrghh(vector bool short __a,
3419                                                  vector bool short __b) {
3420   return vec_perm(__a, __b,
3421                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3422                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3423                                          0x06, 0x07, 0x16, 0x17));
3424 }
3425
3426 static vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
3427                                             vector pixel __b) {
3428   return vec_perm(__a, __b,
3429                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3430                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3431                                          0x06, 0x07, 0x16, 0x17));
3432 }
3433
3434 /* vec_vmrghw */
3435
3436 #define __builtin_altivec_vmrghw vec_vmrghw
3437
3438 static vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b) {
3439   return vec_perm(__a, __b,
3440                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3441                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3442                                          0x14, 0x15, 0x16, 0x17));
3443 }
3444
3445 static vector unsigned int __ATTRS_o_ai vec_vmrghw(vector unsigned int __a,
3446                                                    vector unsigned int __b) {
3447   return vec_perm(__a, __b,
3448                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3449                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3450                                          0x14, 0x15, 0x16, 0x17));
3451 }
3452
3453 static vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
3454                                                vector bool int __b) {
3455   return vec_perm(__a, __b,
3456                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3457                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3458                                          0x14, 0x15, 0x16, 0x17));
3459 }
3460
3461 static vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
3462                                             vector float __b) {
3463   return vec_perm(__a, __b,
3464                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3465                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3466                                          0x14, 0x15, 0x16, 0x17));
3467 }
3468
3469 /* vec_mergel */
3470
3471 static vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a,
3472                                                   vector signed char __b) {
3473   return vec_perm(__a, __b,
3474                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3475                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3476                                          0x0E, 0x1E, 0x0F, 0x1F));
3477 }
3478
3479 static vector unsigned char __ATTRS_o_ai vec_mergel(vector unsigned char __a,
3480                                                     vector unsigned char __b) {
3481   return vec_perm(__a, __b,
3482                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3483                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3484                                          0x0E, 0x1E, 0x0F, 0x1F));
3485 }
3486
3487 static vector bool char __ATTRS_o_ai vec_mergel(vector bool char __a,
3488                                                 vector bool char __b) {
3489   return vec_perm(__a, __b,
3490                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3491                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3492                                          0x0E, 0x1E, 0x0F, 0x1F));
3493 }
3494
3495 static vector short __ATTRS_o_ai vec_mergel(vector short __a,
3496                                             vector short __b) {
3497   return vec_perm(__a, __b,
3498                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3499                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3500                                          0x0E, 0x0F, 0x1E, 0x1F));
3501 }
3502
3503 static vector unsigned short __ATTRS_o_ai
3504 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
3505   return vec_perm(__a, __b,
3506                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3507                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3508                                          0x0E, 0x0F, 0x1E, 0x1F));
3509 }
3510
3511 static vector bool short __ATTRS_o_ai vec_mergel(vector bool short __a,
3512                                                  vector bool short __b) {
3513   return vec_perm(__a, __b,
3514                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3515                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3516                                          0x0E, 0x0F, 0x1E, 0x1F));
3517 }
3518
3519 static vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
3520                                             vector pixel __b) {
3521   return vec_perm(__a, __b,
3522                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3523                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3524                                          0x0E, 0x0F, 0x1E, 0x1F));
3525 }
3526
3527 static vector int __ATTRS_o_ai vec_mergel(vector int __a, vector int __b) {
3528   return vec_perm(__a, __b,
3529                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3530                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3531                                          0x1C, 0x1D, 0x1E, 0x1F));
3532 }
3533
3534 static vector unsigned int __ATTRS_o_ai vec_mergel(vector unsigned int __a,
3535                                                    vector unsigned int __b) {
3536   return vec_perm(__a, __b,
3537                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3538                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3539                                          0x1C, 0x1D, 0x1E, 0x1F));
3540 }
3541
3542 static vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
3543                                                vector bool int __b) {
3544   return vec_perm(__a, __b,
3545                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3546                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3547                                          0x1C, 0x1D, 0x1E, 0x1F));
3548 }
3549
3550 static vector float __ATTRS_o_ai vec_mergel(vector float __a,
3551                                             vector float __b) {
3552   return vec_perm(__a, __b,
3553                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3554                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3555                                          0x1C, 0x1D, 0x1E, 0x1F));
3556 }
3557
3558 #ifdef __VSX__
3559 static vector signed long long __ATTRS_o_ai
3560 vec_mergel(vector signed long long __a, vector signed long long __b) {
3561   return vec_perm(__a, __b,
3562                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3563                                          0x0C, 0x0D, 0x0E, 0x0F,
3564                                          0x18, 0X19, 0x1A, 0x1B,
3565                                          0x1C, 0x1D, 0x1E, 0x1F));
3566 }
3567 static vector signed long long __ATTRS_o_ai
3568 vec_mergel(vector signed long long __a, vector bool long long __b) {
3569   return vec_perm(__a, (vector signed long long)__b,
3570                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3571                                          0x0C, 0x0D, 0x0E, 0x0F,
3572                                          0x18, 0X19, 0x1A, 0x1B,
3573                                          0x1C, 0x1D, 0x1E, 0x1F));
3574 }
3575 static vector signed long long __ATTRS_o_ai
3576 vec_mergel(vector bool long long __a, vector signed long long __b) {
3577   return vec_perm((vector signed long long)__a, __b,
3578                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3579                                          0x0C, 0x0D, 0x0E, 0x0F,
3580                                          0x18, 0X19, 0x1A, 0x1B,
3581                                          0x1C, 0x1D, 0x1E, 0x1F));
3582 }
3583 static vector unsigned long long __ATTRS_o_ai
3584 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
3585   return vec_perm(__a, __b,
3586                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3587                                          0x0C, 0x0D, 0x0E, 0x0F,
3588                                          0x18, 0X19, 0x1A, 0x1B,
3589                                          0x1C, 0x1D, 0x1E, 0x1F));
3590 }
3591 static vector unsigned long long __ATTRS_o_ai
3592 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
3593   return vec_perm(__a, (vector unsigned long long)__b,
3594                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3595                                          0x0C, 0x0D, 0x0E, 0x0F,
3596                                          0x18, 0X19, 0x1A, 0x1B,
3597                                          0x1C, 0x1D, 0x1E, 0x1F));
3598 }
3599 static vector unsigned long long __ATTRS_o_ai
3600 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
3601   return vec_perm((vector unsigned long long)__a, __b,
3602                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3603                                          0x0C, 0x0D, 0x0E, 0x0F,
3604                                          0x18, 0X19, 0x1A, 0x1B,
3605                                          0x1C, 0x1D, 0x1E, 0x1F));
3606 }
3607 static vector bool long long __ATTRS_o_ai
3608 vec_mergel(vector bool long long __a, vector bool long long __b) {
3609   return vec_perm(__a, __b,
3610                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3611                                          0x0C, 0x0D, 0x0E, 0x0F,
3612                                          0x18, 0X19, 0x1A, 0x1B,
3613                                          0x1C, 0x1D, 0x1E, 0x1F));
3614 }
3615 static vector double __ATTRS_o_ai
3616 vec_mergel(vector double __a, vector double __b) {
3617   return vec_perm(__a, __b,
3618                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3619                                          0x0C, 0x0D, 0x0E, 0x0F,
3620                                          0x18, 0X19, 0x1A, 0x1B,
3621                                          0x1C, 0x1D, 0x1E, 0x1F));
3622 }
3623 static vector double __ATTRS_o_ai
3624 vec_mergel(vector double __a, vector bool long long __b) {
3625   return vec_perm(__a, (vector double)__b,
3626                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3627                                          0x0C, 0x0D, 0x0E, 0x0F,
3628                                          0x18, 0X19, 0x1A, 0x1B,
3629                                          0x1C, 0x1D, 0x1E, 0x1F));
3630 }
3631 static vector double __ATTRS_o_ai
3632 vec_mergel(vector bool long long __a, vector double __b) {
3633   return vec_perm((vector double)__a, __b,
3634                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3635                                          0x0C, 0x0D, 0x0E, 0x0F,
3636                                          0x18, 0X19, 0x1A, 0x1B,
3637                                          0x1C, 0x1D, 0x1E, 0x1F));
3638 }
3639 #endif
3640
3641 /* vec_vmrglb */
3642
3643 #define __builtin_altivec_vmrglb vec_vmrglb
3644
3645 static vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a,
3646                                                   vector signed char __b) {
3647   return vec_perm(__a, __b,
3648                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3649                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3650                                          0x0E, 0x1E, 0x0F, 0x1F));
3651 }
3652
3653 static vector unsigned char __ATTRS_o_ai vec_vmrglb(vector unsigned char __a,
3654                                                     vector unsigned char __b) {
3655   return vec_perm(__a, __b,
3656                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3657                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3658                                          0x0E, 0x1E, 0x0F, 0x1F));
3659 }
3660
3661 static vector bool char __ATTRS_o_ai vec_vmrglb(vector bool char __a,
3662                                                 vector bool char __b) {
3663   return vec_perm(__a, __b,
3664                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3665                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3666                                          0x0E, 0x1E, 0x0F, 0x1F));
3667 }
3668
3669 /* vec_vmrglh */
3670
3671 #define __builtin_altivec_vmrglh vec_vmrglh
3672
3673 static vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
3674                                             vector short __b) {
3675   return vec_perm(__a, __b,
3676                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3677                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3678                                          0x0E, 0x0F, 0x1E, 0x1F));
3679 }
3680
3681 static vector unsigned short __ATTRS_o_ai
3682 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
3683   return vec_perm(__a, __b,
3684                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3685                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3686                                          0x0E, 0x0F, 0x1E, 0x1F));
3687 }
3688
3689 static vector bool short __ATTRS_o_ai vec_vmrglh(vector bool short __a,
3690                                                  vector bool short __b) {
3691   return vec_perm(__a, __b,
3692                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3693                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3694                                          0x0E, 0x0F, 0x1E, 0x1F));
3695 }
3696
3697 static vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
3698                                             vector pixel __b) {
3699   return vec_perm(__a, __b,
3700                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3701                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3702                                          0x0E, 0x0F, 0x1E, 0x1F));
3703 }
3704
3705 /* vec_vmrglw */
3706
3707 #define __builtin_altivec_vmrglw vec_vmrglw
3708
3709 static vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b) {
3710   return vec_perm(__a, __b,
3711                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3712                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3713                                          0x1C, 0x1D, 0x1E, 0x1F));
3714 }
3715
3716 static vector unsigned int __ATTRS_o_ai vec_vmrglw(vector unsigned int __a,
3717                                                    vector unsigned int __b) {
3718   return vec_perm(__a, __b,
3719                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3720                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3721                                          0x1C, 0x1D, 0x1E, 0x1F));
3722 }
3723
3724 static vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3725                                                vector bool int __b) {
3726   return vec_perm(__a, __b,
3727                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3728                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3729                                          0x1C, 0x1D, 0x1E, 0x1F));
3730 }
3731
3732 static vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3733                                             vector float __b) {
3734   return vec_perm(__a, __b,
3735                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3736                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3737                                          0x1C, 0x1D, 0x1E, 0x1F));
3738 }
3739
3740
3741 #ifdef __POWER8_VECTOR__
3742 /* vec_mergee */
3743
3744 static vector bool int __ATTRS_o_ai
3745 vec_mergee(vector bool int __a, vector bool int __b) {
3746   return vec_perm(__a, __b, (vector unsigned char)
3747                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3748                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3749 }
3750
3751 static vector signed int __ATTRS_o_ai
3752 vec_mergee(vector signed int __a, vector signed int __b) {
3753   return vec_perm(__a, __b, (vector unsigned char)
3754                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3755                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3756 }
3757
3758 static vector unsigned int __ATTRS_o_ai
3759 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
3760   return vec_perm(__a, __b, (vector unsigned char)
3761                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3762                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3763 }
3764
3765 /* vec_mergeo */
3766
3767 static vector bool int  __ATTRS_o_ai
3768 vec_mergeo(vector bool int __a, vector bool int __b) {
3769   return vec_perm(__a, __b, (vector unsigned char)
3770                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3771                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3772 }
3773
3774 static vector signed int  __ATTRS_o_ai
3775 vec_mergeo(vector signed int __a, vector signed int __b) {
3776   return vec_perm(__a, __b, (vector unsigned char)
3777                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3778                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3779 }
3780
3781 static vector unsigned int  __ATTRS_o_ai
3782 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
3783   return vec_perm(__a, __b, (vector unsigned char)
3784                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3785                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3786 }
3787
3788 #endif
3789
3790 /* vec_mfvscr */
3791
3792 static vector unsigned short __attribute__((__always_inline__))
3793 vec_mfvscr(void) {
3794   return __builtin_altivec_mfvscr();
3795 }
3796
3797 /* vec_min */
3798
3799 static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3800                                                vector signed char __b) {
3801   return __builtin_altivec_vminsb(__a, __b);
3802 }
3803
3804 static vector signed char __ATTRS_o_ai vec_min(vector bool char __a,
3805                                                vector signed char __b) {
3806   return __builtin_altivec_vminsb((vector signed char)__a, __b);
3807 }
3808
3809 static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3810                                                vector bool char __b) {
3811   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3812 }
3813
3814 static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3815                                                  vector unsigned char __b) {
3816   return __builtin_altivec_vminub(__a, __b);
3817 }
3818
3819 static vector unsigned char __ATTRS_o_ai vec_min(vector bool char __a,
3820                                                  vector unsigned char __b) {
3821   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3822 }
3823
3824 static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3825                                                  vector bool char __b) {
3826   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3827 }
3828
3829 static vector short __ATTRS_o_ai vec_min(vector short __a, vector short __b) {
3830   return __builtin_altivec_vminsh(__a, __b);
3831 }
3832
3833 static vector short __ATTRS_o_ai vec_min(vector bool short __a,
3834                                          vector short __b) {
3835   return __builtin_altivec_vminsh((vector short)__a, __b);
3836 }
3837
3838 static vector short __ATTRS_o_ai vec_min(vector short __a,
3839                                          vector bool short __b) {
3840   return __builtin_altivec_vminsh(__a, (vector short)__b);
3841 }
3842
3843 static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3844                                                   vector unsigned short __b) {
3845   return __builtin_altivec_vminuh(__a, __b);
3846 }
3847
3848 static vector unsigned short __ATTRS_o_ai vec_min(vector bool short __a,
3849                                                   vector unsigned short __b) {
3850   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3851 }
3852
3853 static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3854                                                   vector bool short __b) {
3855   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3856 }
3857
3858 static vector int __ATTRS_o_ai vec_min(vector int __a, vector int __b) {
3859   return __builtin_altivec_vminsw(__a, __b);
3860 }
3861
3862 static vector int __ATTRS_o_ai vec_min(vector bool int __a, vector int __b) {
3863   return __builtin_altivec_vminsw((vector int)__a, __b);
3864 }
3865
3866 static vector int __ATTRS_o_ai vec_min(vector int __a, vector bool int __b) {
3867   return __builtin_altivec_vminsw(__a, (vector int)__b);
3868 }
3869
3870 static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3871                                                 vector unsigned int __b) {
3872   return __builtin_altivec_vminuw(__a, __b);
3873 }
3874
3875 static vector unsigned int __ATTRS_o_ai vec_min(vector bool int __a,
3876                                                 vector unsigned int __b) {
3877   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
3878 }
3879
3880 static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3881                                                 vector bool int __b) {
3882   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
3883 }
3884
3885 #ifdef __POWER8_VECTOR__
3886 static vector signed long long __ATTRS_o_ai
3887 vec_min(vector signed long long __a, vector signed long long __b) {
3888   return __builtin_altivec_vminsd(__a, __b);
3889 }
3890
3891 static vector signed long long __ATTRS_o_ai
3892 vec_min(vector bool long long __a, vector signed long long __b) {
3893   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3894 }
3895
3896 static vector signed long long __ATTRS_o_ai vec_min(vector signed long long __a,
3897                                                     vector bool long long __b) {
3898   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3899 }
3900
3901 static vector unsigned long long __ATTRS_o_ai
3902 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
3903   return __builtin_altivec_vminud(__a, __b);
3904 }
3905
3906 static vector unsigned long long __ATTRS_o_ai
3907 vec_min(vector bool long long __a, vector unsigned long long __b) {
3908   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3909 }
3910
3911 static vector unsigned long long __ATTRS_o_ai
3912 vec_min(vector unsigned long long __a, vector bool long long __b) {
3913   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3914 }
3915 #endif
3916
3917 static vector float __ATTRS_o_ai vec_min(vector float __a, vector float __b) {
3918 #ifdef __VSX__
3919   return __builtin_vsx_xvminsp(__a, __b);
3920 #else
3921   return __builtin_altivec_vminfp(__a, __b);
3922 #endif
3923 }
3924
3925 #ifdef __VSX__
3926 static vector double __ATTRS_o_ai vec_min(vector double __a,
3927                                           vector double __b) {
3928   return __builtin_vsx_xvmindp(__a, __b);
3929 }
3930 #endif
3931
3932 /* vec_vminsb */
3933
3934 static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3935                                                   vector signed char __b) {
3936   return __builtin_altivec_vminsb(__a, __b);
3937 }
3938
3939 static vector signed char __ATTRS_o_ai vec_vminsb(vector bool char __a,
3940                                                   vector signed char __b) {
3941   return __builtin_altivec_vminsb((vector signed char)__a, __b);
3942 }
3943
3944 static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3945                                                   vector bool char __b) {
3946   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3947 }
3948
3949 /* vec_vminub */
3950
3951 static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3952                                                     vector unsigned char __b) {
3953   return __builtin_altivec_vminub(__a, __b);
3954 }
3955
3956 static vector unsigned char __ATTRS_o_ai vec_vminub(vector bool char __a,
3957                                                     vector unsigned char __b) {
3958   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3959 }
3960
3961 static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3962                                                     vector bool char __b) {
3963   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3964 }
3965
3966 /* vec_vminsh */
3967
3968 static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3969                                             vector short __b) {
3970   return __builtin_altivec_vminsh(__a, __b);
3971 }
3972
3973 static vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
3974                                             vector short __b) {
3975   return __builtin_altivec_vminsh((vector short)__a, __b);
3976 }
3977
3978 static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3979                                             vector bool short __b) {
3980   return __builtin_altivec_vminsh(__a, (vector short)__b);
3981 }
3982
3983 /* vec_vminuh */
3984
3985 static vector unsigned short __ATTRS_o_ai
3986 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
3987   return __builtin_altivec_vminuh(__a, __b);
3988 }
3989
3990 static vector unsigned short __ATTRS_o_ai
3991 vec_vminuh(vector bool short __a, vector unsigned short __b) {
3992   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3993 }
3994
3995 static vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a,
3996                                                      vector bool short __b) {
3997   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3998 }
3999
4000 /* vec_vminsw */
4001
4002 static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b) {
4003   return __builtin_altivec_vminsw(__a, __b);
4004 }
4005
4006 static vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, vector int __b) {
4007   return __builtin_altivec_vminsw((vector int)__a, __b);
4008 }
4009
4010 static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector bool int __b) {
4011   return __builtin_altivec_vminsw(__a, (vector int)__b);
4012 }
4013
4014 /* vec_vminuw */
4015
4016 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
4017                                                    vector unsigned int __b) {
4018   return __builtin_altivec_vminuw(__a, __b);
4019 }
4020
4021 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector bool int __a,
4022                                                    vector unsigned int __b) {
4023   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
4024 }
4025
4026 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
4027                                                    vector bool int __b) {
4028   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
4029 }
4030
4031 /* vec_vminfp */
4032
4033 static vector float __attribute__((__always_inline__))
4034 vec_vminfp(vector float __a, vector float __b) {
4035 #ifdef __VSX__
4036   return __builtin_vsx_xvminsp(__a, __b);
4037 #else
4038   return __builtin_altivec_vminfp(__a, __b);
4039 #endif
4040 }
4041
4042 /* vec_mladd */
4043
4044 #define __builtin_altivec_vmladduhm vec_mladd
4045
4046 static vector short __ATTRS_o_ai vec_mladd(vector short __a, vector short __b,
4047                                            vector short __c) {
4048   return __a * __b + __c;
4049 }
4050
4051 static vector short __ATTRS_o_ai vec_mladd(vector short __a,
4052                                            vector unsigned short __b,
4053                                            vector unsigned short __c) {
4054   return __a * (vector short)__b + (vector short)__c;
4055 }
4056
4057 static vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4058                                            vector short __b, vector short __c) {
4059   return (vector short)__a * __b + __c;
4060 }
4061
4062 static vector unsigned short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4063                                                     vector unsigned short __b,
4064                                                     vector unsigned short __c) {
4065   return __a * __b + __c;
4066 }
4067
4068 /* vec_vmladduhm */
4069
4070 static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4071                                                vector short __b,
4072                                                vector short __c) {
4073   return __a * __b + __c;
4074 }
4075
4076 static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4077                                                vector unsigned short __b,
4078                                                vector unsigned short __c) {
4079   return __a * (vector short)__b + (vector short)__c;
4080 }
4081
4082 static vector short __ATTRS_o_ai vec_vmladduhm(vector unsigned short __a,
4083                                                vector short __b,
4084                                                vector short __c) {
4085   return (vector short)__a * __b + __c;
4086 }
4087
4088 static vector unsigned short __ATTRS_o_ai
4089 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
4090               vector unsigned short __c) {
4091   return __a * __b + __c;
4092 }
4093
4094 /* vec_mradds */
4095
4096 static vector short __attribute__((__always_inline__))
4097 vec_mradds(vector short __a, vector short __b, vector short __c) {
4098   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4099 }
4100
4101 /* vec_vmhraddshs */
4102
4103 static vector short __attribute__((__always_inline__))
4104 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
4105   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4106 }
4107
4108 /* vec_msum */
4109
4110 static vector int __ATTRS_o_ai vec_msum(vector signed char __a,
4111                                         vector unsigned char __b,
4112                                         vector int __c) {
4113   return __builtin_altivec_vmsummbm(__a, __b, __c);
4114 }
4115
4116 static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned char __a,
4117                                                  vector unsigned char __b,
4118                                                  vector unsigned int __c) {
4119   return __builtin_altivec_vmsumubm(__a, __b, __c);
4120 }
4121
4122 static vector int __ATTRS_o_ai vec_msum(vector short __a, vector short __b,
4123                                         vector int __c) {
4124   return __builtin_altivec_vmsumshm(__a, __b, __c);
4125 }
4126
4127 static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned short __a,
4128                                                  vector unsigned short __b,
4129                                                  vector unsigned int __c) {
4130   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4131 }
4132
4133 /* vec_vmsummbm */
4134
4135 static vector int __attribute__((__always_inline__))
4136 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
4137   return __builtin_altivec_vmsummbm(__a, __b, __c);
4138 }
4139
4140 /* vec_vmsumubm */
4141
4142 static vector unsigned int __attribute__((__always_inline__))
4143 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
4144              vector unsigned int __c) {
4145   return __builtin_altivec_vmsumubm(__a, __b, __c);
4146 }
4147
4148 /* vec_vmsumshm */
4149
4150 static vector int __attribute__((__always_inline__))
4151 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
4152   return __builtin_altivec_vmsumshm(__a, __b, __c);
4153 }
4154
4155 /* vec_vmsumuhm */
4156
4157 static vector unsigned int __attribute__((__always_inline__))
4158 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
4159              vector unsigned int __c) {
4160   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4161 }
4162
4163 /* vec_msums */
4164
4165 static vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b,
4166                                          vector int __c) {
4167   return __builtin_altivec_vmsumshs(__a, __b, __c);
4168 }
4169
4170 static vector unsigned int __ATTRS_o_ai vec_msums(vector unsigned short __a,
4171                                                   vector unsigned short __b,
4172                                                   vector unsigned int __c) {
4173   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4174 }
4175
4176 /* vec_vmsumshs */
4177
4178 static vector int __attribute__((__always_inline__))
4179 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
4180   return __builtin_altivec_vmsumshs(__a, __b, __c);
4181 }
4182
4183 /* vec_vmsumuhs */
4184
4185 static vector unsigned int __attribute__((__always_inline__))
4186 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
4187              vector unsigned int __c) {
4188   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4189 }
4190
4191 /* vec_mtvscr */
4192
4193 static void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
4194   __builtin_altivec_mtvscr((vector int)__a);
4195 }
4196
4197 static void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
4198   __builtin_altivec_mtvscr((vector int)__a);
4199 }
4200
4201 static void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
4202   __builtin_altivec_mtvscr((vector int)__a);
4203 }
4204
4205 static void __ATTRS_o_ai vec_mtvscr(vector short __a) {
4206   __builtin_altivec_mtvscr((vector int)__a);
4207 }
4208
4209 static void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
4210   __builtin_altivec_mtvscr((vector int)__a);
4211 }
4212
4213 static void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
4214   __builtin_altivec_mtvscr((vector int)__a);
4215 }
4216
4217 static void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
4218   __builtin_altivec_mtvscr((vector int)__a);
4219 }
4220
4221 static void __ATTRS_o_ai vec_mtvscr(vector int __a) {
4222   __builtin_altivec_mtvscr((vector int)__a);
4223 }
4224
4225 static void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
4226   __builtin_altivec_mtvscr((vector int)__a);
4227 }
4228
4229 static void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
4230   __builtin_altivec_mtvscr((vector int)__a);
4231 }
4232
4233 static void __ATTRS_o_ai vec_mtvscr(vector float __a) {
4234   __builtin_altivec_mtvscr((vector int)__a);
4235 }
4236
4237 /* vec_mul */
4238
4239 /* Integer vector multiplication will involve multiplication of the odd/even
4240    elements separately, then truncating the results and moving to the
4241    result vector.
4242 */
4243 static vector signed char __ATTRS_o_ai vec_mul(vector signed char __a,
4244                                                vector signed char __b) {
4245   return __a * __b;
4246 }
4247
4248 static vector unsigned char __ATTRS_o_ai vec_mul(vector unsigned char __a,
4249                                                  vector unsigned char __b) {
4250   return __a * __b;
4251 }
4252
4253 static vector signed short __ATTRS_o_ai vec_mul(vector signed short __a,
4254                                                 vector signed short __b) {
4255   return __a * __b;
4256 }
4257
4258 static vector unsigned short __ATTRS_o_ai vec_mul(vector unsigned short __a,
4259                                                   vector unsigned short __b) {
4260   return __a * __b;
4261 }
4262
4263 static vector signed int __ATTRS_o_ai vec_mul(vector signed int __a,
4264                                               vector signed int __b) {
4265   return __a * __b;
4266 }
4267
4268 static vector unsigned int __ATTRS_o_ai vec_mul(vector unsigned int __a,
4269                                                 vector unsigned int __b) {
4270   return __a * __b;
4271 }
4272
4273 #ifdef __VSX__
4274 static vector signed long long __ATTRS_o_ai
4275 vec_mul(vector signed long long __a, vector signed long long __b) {
4276   return __a * __b;
4277 }
4278
4279 static vector unsigned long long __ATTRS_o_ai
4280 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
4281   return __a * __b;
4282 }
4283 #endif
4284
4285 static vector float __ATTRS_o_ai vec_mul(vector float __a, vector float __b) {
4286   return __a * __b;
4287 }
4288
4289 #ifdef __VSX__
4290 static vector double __ATTRS_o_ai
4291 vec_mul(vector double __a, vector double __b) {
4292   return __a * __b;
4293 }
4294 #endif
4295
4296 /* The vmulos* and vmules* instructions have a big endian bias, so
4297    we must reverse the meaning of "even" and "odd" for little endian.  */
4298
4299 /* vec_mule */
4300
4301 static vector short __ATTRS_o_ai vec_mule(vector signed char __a,
4302                                           vector signed char __b) {
4303 #ifdef __LITTLE_ENDIAN__
4304   return __builtin_altivec_vmulosb(__a, __b);
4305 #else
4306   return __builtin_altivec_vmulesb(__a, __b);
4307 #endif
4308 }
4309
4310 static vector unsigned short __ATTRS_o_ai vec_mule(vector unsigned char __a,
4311                                                    vector unsigned char __b) {
4312 #ifdef __LITTLE_ENDIAN__
4313   return __builtin_altivec_vmuloub(__a, __b);
4314 #else
4315   return __builtin_altivec_vmuleub(__a, __b);
4316 #endif
4317 }
4318
4319 static vector int __ATTRS_o_ai vec_mule(vector short __a, vector short __b) {
4320 #ifdef __LITTLE_ENDIAN__
4321   return __builtin_altivec_vmulosh(__a, __b);
4322 #else
4323   return __builtin_altivec_vmulesh(__a, __b);
4324 #endif
4325 }
4326
4327 static vector unsigned int __ATTRS_o_ai vec_mule(vector unsigned short __a,
4328                                                  vector unsigned short __b) {
4329 #ifdef __LITTLE_ENDIAN__
4330   return __builtin_altivec_vmulouh(__a, __b);
4331 #else
4332   return __builtin_altivec_vmuleuh(__a, __b);
4333 #endif
4334 }
4335
4336 #ifdef __POWER8_VECTOR__
4337 static vector signed long long __ATTRS_o_ai vec_mule(vector signed int __a,
4338                                                      vector signed int __b) {
4339 #ifdef __LITTLE_ENDIAN__
4340   return __builtin_altivec_vmulosw(__a, __b);
4341 #else
4342   return __builtin_altivec_vmulesw(__a, __b);
4343 #endif
4344 }
4345
4346 static vector unsigned long long __ATTRS_o_ai
4347 vec_mule(vector unsigned int __a, vector unsigned int __b) {
4348 #ifdef __LITTLE_ENDIAN__
4349   return __builtin_altivec_vmulouw(__a, __b);
4350 #else
4351   return __builtin_altivec_vmuleuw(__a, __b);
4352 #endif
4353 }
4354 #endif
4355
4356 /* vec_vmulesb */
4357
4358 static vector short __attribute__((__always_inline__))
4359 vec_vmulesb(vector signed char __a, vector signed char __b) {
4360 #ifdef __LITTLE_ENDIAN__
4361   return __builtin_altivec_vmulosb(__a, __b);
4362 #else
4363   return __builtin_altivec_vmulesb(__a, __b);
4364 #endif
4365 }
4366
4367 /* vec_vmuleub */
4368
4369 static vector unsigned short __attribute__((__always_inline__))
4370 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
4371 #ifdef __LITTLE_ENDIAN__
4372   return __builtin_altivec_vmuloub(__a, __b);
4373 #else
4374   return __builtin_altivec_vmuleub(__a, __b);
4375 #endif
4376 }
4377
4378 /* vec_vmulesh */
4379
4380 static vector int __attribute__((__always_inline__))
4381 vec_vmulesh(vector short __a, vector short __b) {
4382 #ifdef __LITTLE_ENDIAN__
4383   return __builtin_altivec_vmulosh(__a, __b);
4384 #else
4385   return __builtin_altivec_vmulesh(__a, __b);
4386 #endif
4387 }
4388
4389 /* vec_vmuleuh */
4390
4391 static vector unsigned int __attribute__((__always_inline__))
4392 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
4393 #ifdef __LITTLE_ENDIAN__
4394   return __builtin_altivec_vmulouh(__a, __b);
4395 #else
4396   return __builtin_altivec_vmuleuh(__a, __b);
4397 #endif
4398 }
4399
4400 /* vec_mulo */
4401
4402 static vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
4403                                           vector signed char __b) {
4404 #ifdef __LITTLE_ENDIAN__
4405   return __builtin_altivec_vmulesb(__a, __b);
4406 #else
4407   return __builtin_altivec_vmulosb(__a, __b);
4408 #endif
4409 }
4410
4411 static vector unsigned short __ATTRS_o_ai vec_mulo(vector unsigned char __a,
4412                                                    vector unsigned char __b) {
4413 #ifdef __LITTLE_ENDIAN__
4414   return __builtin_altivec_vmuleub(__a, __b);
4415 #else
4416   return __builtin_altivec_vmuloub(__a, __b);
4417 #endif
4418 }
4419
4420 static vector int __ATTRS_o_ai vec_mulo(vector short __a, vector short __b) {
4421 #ifdef __LITTLE_ENDIAN__
4422   return __builtin_altivec_vmulesh(__a, __b);
4423 #else
4424   return __builtin_altivec_vmulosh(__a, __b);
4425 #endif
4426 }
4427
4428 static vector unsigned int __ATTRS_o_ai vec_mulo(vector unsigned short __a,
4429                                                  vector unsigned short __b) {
4430 #ifdef __LITTLE_ENDIAN__
4431   return __builtin_altivec_vmuleuh(__a, __b);
4432 #else
4433   return __builtin_altivec_vmulouh(__a, __b);
4434 #endif
4435 }
4436
4437 #ifdef __POWER8_VECTOR__
4438 static vector signed long long __ATTRS_o_ai vec_mulo(vector signed int __a,
4439                                                      vector signed int __b) {
4440 #ifdef __LITTLE_ENDIAN__
4441   return __builtin_altivec_vmulesw(__a, __b);
4442 #else
4443   return __builtin_altivec_vmulosw(__a, __b);
4444 #endif
4445 }
4446
4447 static vector unsigned long long __ATTRS_o_ai
4448 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
4449 #ifdef __LITTLE_ENDIAN__
4450   return __builtin_altivec_vmuleuw(__a, __b);
4451 #else
4452   return __builtin_altivec_vmulouw(__a, __b);
4453 #endif
4454 }
4455 #endif
4456
4457 /* vec_vmulosb */
4458
4459 static vector short __attribute__((__always_inline__))
4460 vec_vmulosb(vector signed char __a, vector signed char __b) {
4461 #ifdef __LITTLE_ENDIAN__
4462   return __builtin_altivec_vmulesb(__a, __b);
4463 #else
4464   return __builtin_altivec_vmulosb(__a, __b);
4465 #endif
4466 }
4467
4468 /* vec_vmuloub */
4469
4470 static vector unsigned short __attribute__((__always_inline__))
4471 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
4472 #ifdef __LITTLE_ENDIAN__
4473   return __builtin_altivec_vmuleub(__a, __b);
4474 #else
4475   return __builtin_altivec_vmuloub(__a, __b);
4476 #endif
4477 }
4478
4479 /* vec_vmulosh */
4480
4481 static vector int __attribute__((__always_inline__))
4482 vec_vmulosh(vector short __a, vector short __b) {
4483 #ifdef __LITTLE_ENDIAN__
4484   return __builtin_altivec_vmulesh(__a, __b);
4485 #else
4486   return __builtin_altivec_vmulosh(__a, __b);
4487 #endif
4488 }
4489
4490 /* vec_vmulouh */
4491
4492 static vector unsigned int __attribute__((__always_inline__))
4493 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
4494 #ifdef __LITTLE_ENDIAN__
4495   return __builtin_altivec_vmuleuh(__a, __b);
4496 #else
4497   return __builtin_altivec_vmulouh(__a, __b);
4498 #endif
4499 }
4500
4501 /*  vec_nand */
4502
4503 #ifdef __POWER8_VECTOR__
4504 static vector signed char __ATTRS_o_ai vec_nand(vector signed char __a,
4505                                                 vector signed char __b) {
4506   return ~(__a & __b);
4507 }
4508
4509 static vector signed char __ATTRS_o_ai vec_nand(vector signed char __a,
4510                                                 vector bool char __b) {
4511   return ~(__a & __b);
4512 }
4513
4514 static vector signed char __ATTRS_o_ai vec_nand(vector bool char __a,
4515                                                 vector signed char __b) {
4516   return ~(__a & __b);
4517 }
4518
4519 static vector unsigned char __ATTRS_o_ai vec_nand(vector unsigned char __a,
4520                                                   vector unsigned char __b) {
4521   return ~(__a & __b);
4522 }
4523
4524 static vector unsigned char __ATTRS_o_ai vec_nand(vector unsigned char __a,
4525                                                   vector bool char __b) {
4526   return ~(__a & __b);
4527
4528 }
4529
4530 static vector unsigned char __ATTRS_o_ai vec_nand(vector bool char __a,
4531                                                   vector unsigned char __b) {
4532   return ~(__a & __b);
4533 }
4534
4535 static vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
4536                                               vector bool char __b) {
4537   return ~(__a & __b);
4538 }
4539
4540 static vector signed short __ATTRS_o_ai vec_nand(vector signed short __a,
4541                                                  vector signed short __b) {
4542   return ~(__a & __b);
4543 }
4544
4545 static vector signed short __ATTRS_o_ai vec_nand(vector signed short __a,
4546                                                  vector bool short __b) {
4547   return ~(__a & __b);
4548 }
4549
4550 static vector signed short __ATTRS_o_ai vec_nand(vector bool short __a,
4551                                                  vector signed short __b) {
4552   return ~(__a & __b);
4553 }
4554
4555 static vector unsigned short __ATTRS_o_ai vec_nand(vector unsigned short __a,
4556                                                    vector unsigned short __b) {
4557   return ~(__a & __b);
4558 }
4559
4560 static vector unsigned short __ATTRS_o_ai vec_nand(vector unsigned short __a,
4561                                                    vector bool short __b) {
4562   return ~(__a & __b);
4563
4564 }
4565
4566 static vector bool short __ATTRS_o_ai vec_nand(vector bool short __a,
4567                                                vector bool short __b) {
4568   return ~(__a & __b);
4569
4570 }
4571
4572 static vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4573                                                vector signed int __b) {
4574   return ~(__a & __b);
4575 }
4576
4577 static vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4578                                                vector bool int __b) {
4579   return ~(__a & __b);
4580 }
4581
4582 static vector signed int __ATTRS_o_ai vec_nand(vector bool int __a,
4583                                                vector signed int __b) {
4584   return ~(__a & __b);
4585 }
4586
4587 static vector unsigned int __ATTRS_o_ai vec_nand(vector unsigned int __a,
4588                                                  vector unsigned int __b) {
4589   return ~(__a & __b);
4590 }
4591
4592 static vector unsigned int __ATTRS_o_ai vec_nand(vector unsigned int __a,
4593                                                  vector bool int __b) {
4594   return ~(__a & __b);
4595 }
4596
4597 static vector unsigned int __ATTRS_o_ai vec_nand(vector bool int __a,
4598                                                  vector unsigned int __b) {
4599   return ~(__a & __b);
4600 }
4601
4602 static vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
4603                                              vector bool int __b) {
4604   return ~(__a & __b);
4605 }
4606
4607 static vector signed long long __ATTRS_o_ai
4608 vec_nand(vector signed long long __a, vector signed long long __b) {
4609   return ~(__a & __b);
4610 }
4611
4612 static vector signed long long __ATTRS_o_ai
4613 vec_nand(vector signed long long __a, vector bool long long __b) {
4614   return ~(__a & __b);
4615 }
4616
4617 static vector signed long long __ATTRS_o_ai
4618 vec_nand(vector bool long long __a, vector signed long long __b) {
4619   return ~(__a & __b);
4620 }
4621
4622 static vector unsigned long long __ATTRS_o_ai
4623 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
4624   return ~(__a & __b);
4625 }
4626
4627 static vector unsigned long long __ATTRS_o_ai
4628 vec_nand(vector unsigned long long __a, vector bool long long __b) {
4629   return ~(__a & __b);
4630 }
4631
4632 static vector unsigned long long __ATTRS_o_ai
4633 vec_nand(vector bool long long __a, vector unsigned long long __b) {
4634   return ~(__a & __b);
4635 }
4636
4637 static vector bool long long __ATTRS_o_ai
4638 vec_nand(vector bool long long __a, vector bool long long __b) {
4639   return ~(__a & __b);
4640 }
4641
4642 #endif
4643
4644 /* vec_nmadd */
4645
4646 #ifdef __VSX__
4647 static vector float __ATTRS_o_ai
4648 vec_nmadd(vector float __a, vector float __b, vector float __c) {
4649   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
4650 }
4651
4652 static vector double __ATTRS_o_ai
4653 vec_nmadd(vector double __a, vector double __b, vector double __c) {
4654   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
4655 }
4656 #endif
4657
4658 /* vec_nmsub */
4659
4660 static vector float __ATTRS_o_ai
4661 vec_nmsub(vector float __a, vector float __b, vector float __c) {
4662 #ifdef __VSX__
4663   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
4664 #else
4665   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4666 #endif
4667 }
4668
4669 #ifdef __VSX__
4670 static vector double __ATTRS_o_ai
4671 vec_nmsub(vector double __a, vector double __b, vector double __c) {
4672   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
4673 }
4674 #endif
4675
4676 /* vec_vnmsubfp */
4677
4678 static vector float __attribute__((__always_inline__))
4679 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
4680   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4681 }
4682
4683 /* vec_nor */
4684
4685 #define __builtin_altivec_vnor vec_nor
4686
4687 static vector signed char __ATTRS_o_ai vec_nor(vector signed char __a,
4688                                                vector signed char __b) {
4689   return ~(__a | __b);
4690 }
4691
4692 static vector unsigned char __ATTRS_o_ai vec_nor(vector unsigned char __a,
4693                                                  vector unsigned char __b) {
4694   return ~(__a | __b);
4695 }
4696
4697 static vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
4698                                              vector bool char __b) {
4699   return ~(__a | __b);
4700 }
4701
4702 static vector short __ATTRS_o_ai vec_nor(vector short __a, vector short __b) {
4703   return ~(__a | __b);
4704 }
4705
4706 static vector unsigned short __ATTRS_o_ai vec_nor(vector unsigned short __a,
4707                                                   vector unsigned short __b) {
4708   return ~(__a | __b);
4709 }
4710
4711 static vector bool short __ATTRS_o_ai vec_nor(vector bool short __a,
4712                                               vector bool short __b) {
4713   return ~(__a | __b);
4714 }
4715
4716 static vector int __ATTRS_o_ai vec_nor(vector int __a, vector int __b) {
4717   return ~(__a | __b);
4718 }
4719
4720 static vector unsigned int __ATTRS_o_ai vec_nor(vector unsigned int __a,
4721                                                 vector unsigned int __b) {
4722   return ~(__a | __b);
4723 }
4724
4725 static vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
4726                                             vector bool int __b) {
4727   return ~(__a | __b);
4728 }
4729
4730 static vector float __ATTRS_o_ai vec_nor(vector float __a, vector float __b) {
4731   vector unsigned int __res =
4732       ~((vector unsigned int)__a | (vector unsigned int)__b);
4733   return (vector float)__res;
4734 }
4735
4736 #ifdef __VSX__
4737 static vector double __ATTRS_o_ai
4738 vec_nor(vector double __a, vector double __b) {
4739   vector unsigned long long __res =
4740       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
4741   return (vector double)__res;
4742 }
4743 #endif
4744
4745 /* vec_vnor */
4746
4747 static vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a,
4748                                                 vector signed char __b) {
4749   return ~(__a | __b);
4750 }
4751
4752 static vector unsigned char __ATTRS_o_ai vec_vnor(vector unsigned char __a,
4753                                                   vector unsigned char __b) {
4754   return ~(__a | __b);
4755 }
4756
4757 static vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
4758                                               vector bool char __b) {
4759   return ~(__a | __b);
4760 }
4761
4762 static vector short __ATTRS_o_ai vec_vnor(vector short __a, vector short __b) {
4763   return ~(__a | __b);
4764 }
4765
4766 static vector unsigned short __ATTRS_o_ai vec_vnor(vector unsigned short __a,
4767                                                    vector unsigned short __b) {
4768   return ~(__a | __b);
4769 }
4770
4771 static vector bool short __ATTRS_o_ai vec_vnor(vector bool short __a,
4772                                                vector bool short __b) {
4773   return ~(__a | __b);
4774 }
4775
4776 static vector int __ATTRS_o_ai vec_vnor(vector int __a, vector int __b) {
4777   return ~(__a | __b);
4778 }
4779
4780 static vector unsigned int __ATTRS_o_ai vec_vnor(vector unsigned int __a,
4781                                                  vector unsigned int __b) {
4782   return ~(__a | __b);
4783 }
4784
4785 static vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
4786                                              vector bool int __b) {
4787   return ~(__a | __b);
4788 }
4789
4790 static vector float __ATTRS_o_ai vec_vnor(vector float __a, vector float __b) {
4791   vector unsigned int __res =
4792       ~((vector unsigned int)__a | (vector unsigned int)__b);
4793   return (vector float)__res;
4794 }
4795
4796 #ifdef __VSX__
4797 static vector signed long long __ATTRS_o_ai
4798 vec_nor(vector signed long long __a, vector signed long long __b) {
4799   return ~(__a | __b);
4800 }
4801
4802 static vector unsigned long long __ATTRS_o_ai
4803 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
4804   return ~(__a | __b);
4805 }
4806
4807 static vector bool long long __ATTRS_o_ai vec_nor(vector bool long long __a,
4808                                                   vector bool long long __b) {
4809   return ~(__a | __b);
4810 }
4811 #endif
4812
4813 /* vec_or */
4814
4815 #define __builtin_altivec_vor vec_or
4816
4817 static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4818                                               vector signed char __b) {
4819   return __a | __b;
4820 }
4821
4822 static vector signed char __ATTRS_o_ai vec_or(vector bool char __a,
4823                                               vector signed char __b) {
4824   return (vector signed char)__a | __b;
4825 }
4826
4827 static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4828                                               vector bool char __b) {
4829   return __a | (vector signed char)__b;
4830 }
4831
4832 static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4833                                                 vector unsigned char __b) {
4834   return __a | __b;
4835 }
4836
4837 static vector unsigned char __ATTRS_o_ai vec_or(vector bool char __a,
4838                                                 vector unsigned char __b) {
4839   return (vector unsigned char)__a | __b;
4840 }
4841
4842 static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4843                                                 vector bool char __b) {
4844   return __a | (vector unsigned char)__b;
4845 }
4846
4847 static vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4848                                             vector bool char __b) {
4849   return __a | __b;
4850 }
4851
4852 static vector short __ATTRS_o_ai vec_or(vector short __a, vector short __b) {
4853   return __a | __b;
4854 }
4855
4856 static vector short __ATTRS_o_ai vec_or(vector bool short __a,
4857                                         vector short __b) {
4858   return (vector short)__a | __b;
4859 }
4860
4861 static vector short __ATTRS_o_ai vec_or(vector short __a,
4862                                         vector bool short __b) {
4863   return __a | (vector short)__b;
4864 }
4865
4866 static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4867                                                  vector unsigned short __b) {
4868   return __a | __b;
4869 }
4870
4871 static vector unsigned short __ATTRS_o_ai vec_or(vector bool short __a,
4872                                                  vector unsigned short __b) {
4873   return (vector unsigned short)__a | __b;
4874 }
4875
4876 static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4877                                                  vector bool short __b) {
4878   return __a | (vector unsigned short)__b;
4879 }
4880
4881 static vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4882                                              vector bool short __b) {
4883   return __a | __b;
4884 }
4885
4886 static vector int __ATTRS_o_ai vec_or(vector int __a, vector int __b) {
4887   return __a | __b;
4888 }
4889
4890 static vector int __ATTRS_o_ai vec_or(vector bool int __a, vector int __b) {
4891   return (vector int)__a | __b;
4892 }
4893
4894 static vector int __ATTRS_o_ai vec_or(vector int __a, vector bool int __b) {
4895   return __a | (vector int)__b;
4896 }
4897
4898 static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4899                                                vector unsigned int __b) {
4900   return __a | __b;
4901 }
4902
4903 static vector unsigned int __ATTRS_o_ai vec_or(vector bool int __a,
4904                                                vector unsigned int __b) {
4905   return (vector unsigned int)__a | __b;
4906 }
4907
4908 static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4909                                                vector bool int __b) {
4910   return __a | (vector unsigned int)__b;
4911 }
4912
4913 static vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
4914                                            vector bool int __b) {
4915   return __a | __b;
4916 }
4917
4918 static vector float __ATTRS_o_ai vec_or(vector float __a, vector float __b) {
4919   vector unsigned int __res =
4920       (vector unsigned int)__a | (vector unsigned int)__b;
4921   return (vector float)__res;
4922 }
4923
4924 static vector float __ATTRS_o_ai vec_or(vector bool int __a, vector float __b) {
4925   vector unsigned int __res =
4926       (vector unsigned int)__a | (vector unsigned int)__b;
4927   return (vector float)__res;
4928 }
4929
4930 static vector float __ATTRS_o_ai vec_or(vector float __a, vector bool int __b) {
4931   vector unsigned int __res =
4932       (vector unsigned int)__a | (vector unsigned int)__b;
4933   return (vector float)__res;
4934 }
4935
4936 #ifdef __VSX__
4937 static vector double __ATTRS_o_ai vec_or(vector bool long long __a,
4938                                          vector double __b) {
4939   return (vector unsigned long long)__a | (vector unsigned long long)__b;
4940 }
4941
4942 static vector double __ATTRS_o_ai vec_or(vector double __a,
4943                                          vector bool long long __b) {
4944   return (vector unsigned long long)__a | (vector unsigned long long)__b;
4945 }
4946
4947 static vector double __ATTRS_o_ai vec_or(vector double __a, vector double __b) {
4948   vector unsigned long long __res =
4949       (vector unsigned long long)__a | (vector unsigned long long)__b;
4950   return (vector double)__res;
4951 }
4952
4953 static vector signed long long __ATTRS_o_ai
4954 vec_or(vector signed long long __a, vector signed long long __b) {
4955   return __a | __b;
4956 }
4957
4958 static vector signed long long __ATTRS_o_ai
4959 vec_or(vector bool long long __a, vector signed long long __b) {
4960   return (vector signed long long)__a | __b;
4961 }
4962
4963 static vector signed long long __ATTRS_o_ai vec_or(vector signed long long __a,
4964                                                    vector bool long long __b) {
4965   return __a | (vector signed long long)__b;
4966 }
4967
4968 static vector unsigned long long __ATTRS_o_ai
4969 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
4970   return __a | __b;
4971 }
4972
4973 static vector unsigned long long __ATTRS_o_ai
4974 vec_or(vector bool long long __a, vector unsigned long long __b) {
4975   return (vector unsigned long long)__a | __b;
4976 }
4977
4978 static vector unsigned long long __ATTRS_o_ai
4979 vec_or(vector unsigned long long __a, vector bool long long __b) {
4980   return __a | (vector unsigned long long)__b;
4981 }
4982
4983 static vector bool long long __ATTRS_o_ai vec_or(vector bool long long __a,
4984                                                  vector bool long long __b) {
4985   return __a | __b;
4986 }
4987 #endif
4988
4989 #ifdef __POWER8_VECTOR__
4990 static vector signed char __ATTRS_o_ai vec_orc(vector signed char __a,
4991                                                vector signed char __b) {
4992   return __a | ~__b;
4993 }
4994
4995 static vector signed char __ATTRS_o_ai vec_orc(vector signed char __a,
4996                                                vector bool char __b) {
4997   return __a | ~__b;
4998 }
4999
5000 static vector signed char __ATTRS_o_ai vec_orc(vector bool char __a,
5001                                                vector signed char __b) {
5002   return __a | ~__b;
5003 }
5004
5005 static vector unsigned char __ATTRS_o_ai vec_orc(vector unsigned char __a,
5006                                                  vector unsigned char __b) {
5007   return __a | ~__b;
5008 }
5009
5010 static vector unsigned char __ATTRS_o_ai vec_orc(vector unsigned char __a,
5011                                                  vector bool char __b) {
5012   return __a | ~__b;
5013 }
5014
5015 static vector unsigned char __ATTRS_o_ai vec_orc(vector bool char __a,
5016                                                  vector unsigned char __b) {
5017   return __a | ~__b;
5018 }
5019
5020 static vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
5021                                              vector bool char __b) {
5022   return __a | ~__b;
5023 }
5024
5025 static vector signed short __ATTRS_o_ai vec_orc(vector signed short __a,
5026                                                 vector signed short __b) {
5027   return __a | ~__b;
5028 }
5029
5030 static vector signed short __ATTRS_o_ai vec_orc(vector signed short __a,
5031                                                 vector bool short __b) {
5032   return __a | ~__b;
5033 }
5034
5035 static vector signed short __ATTRS_o_ai vec_orc(vector bool short __a,
5036                                                 vector signed short __b) {
5037   return __a | ~__b;
5038 }
5039
5040 static vector unsigned short __ATTRS_o_ai vec_orc(vector unsigned short __a,
5041                                                   vector unsigned short __b) {
5042   return __a | ~__b;
5043 }
5044
5045 static vector unsigned short __ATTRS_o_ai vec_orc(vector unsigned short __a,
5046                                                   vector bool short __b) {
5047   return __a | ~__b;
5048 }
5049
5050 static vector unsigned short __ATTRS_o_ai
5051 vec_orc(vector bool short __a, vector unsigned short __b) {
5052   return __a | ~__b;
5053 }
5054
5055 static vector bool short __ATTRS_o_ai vec_orc(vector bool short __a,
5056                                               vector bool short __b) {
5057   return __a | ~__b;
5058 }
5059
5060 static vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5061                                               vector signed int __b) {
5062   return __a | ~__b;
5063 }
5064
5065 static vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5066                                               vector bool int __b) {
5067   return __a | ~__b;
5068 }
5069
5070 static vector signed int __ATTRS_o_ai vec_orc(vector bool int __a,
5071                                               vector signed int __b) {
5072   return __a | ~__b;
5073 }
5074
5075 static vector unsigned int __ATTRS_o_ai vec_orc(vector unsigned int __a,
5076                                                 vector unsigned int __b) {
5077   return __a | ~__b;
5078 }
5079
5080 static vector unsigned int __ATTRS_o_ai vec_orc(vector unsigned int __a,
5081                                                 vector bool int __b) {
5082   return __a | ~__b;
5083 }
5084
5085 static vector unsigned int __ATTRS_o_ai vec_orc(vector bool int __a,
5086                                                 vector unsigned int __b) {
5087   return __a | ~__b;
5088 }
5089
5090 static vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
5091                                             vector bool int __b) {
5092   return __a | ~__b;
5093 }
5094
5095 static vector signed long long __ATTRS_o_ai
5096 vec_orc(vector signed long long __a, vector signed long long __b) {
5097   return __a | ~__b;
5098 }
5099
5100 static vector signed long long __ATTRS_o_ai vec_orc(vector signed long long __a,
5101                                                     vector bool long long __b) {
5102   return __a | ~__b;
5103 }
5104
5105 static vector signed long long __ATTRS_o_ai
5106 vec_orc(vector bool long long __a, vector signed long long __b) {
5107   return __a | ~__b;
5108 }
5109
5110 static vector unsigned long long __ATTRS_o_ai
5111 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
5112   return __a | ~__b;
5113 }
5114
5115 static vector unsigned long long __ATTRS_o_ai
5116 vec_orc(vector unsigned long long __a, vector bool long long __b) {
5117   return __a | ~__b;
5118 }
5119
5120 static vector unsigned long long __ATTRS_o_ai
5121 vec_orc(vector bool long long __a, vector unsigned long long __b) {
5122   return __a | ~__b;
5123 }
5124
5125 static vector bool long long __ATTRS_o_ai
5126 vec_orc(vector bool long long __a, vector bool long long __b) {
5127   return __a | ~__b;
5128 }
5129 #endif
5130
5131 /* vec_vor */
5132
5133 static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
5134                                                vector signed char __b) {
5135   return __a | __b;
5136 }
5137
5138 static vector signed char __ATTRS_o_ai vec_vor(vector bool char __a,
5139                                                vector signed char __b) {
5140   return (vector signed char)__a | __b;
5141 }
5142
5143 static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
5144                                                vector bool char __b) {
5145   return __a | (vector signed char)__b;
5146 }
5147
5148 static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
5149                                                  vector unsigned char __b) {
5150   return __a | __b;
5151 }
5152
5153 static vector unsigned char __ATTRS_o_ai vec_vor(vector bool char __a,
5154                                                  vector unsigned char __b) {
5155   return (vector unsigned char)__a | __b;
5156 }
5157
5158 static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
5159                                                  vector bool char __b) {
5160   return __a | (vector unsigned char)__b;
5161 }
5162
5163 static vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
5164                                              vector bool char __b) {
5165   return __a | __b;
5166 }
5167
5168 static vector short __ATTRS_o_ai vec_vor(vector short __a, vector short __b) {
5169   return __a | __b;
5170 }
5171
5172 static vector short __ATTRS_o_ai vec_vor(vector bool short __a,
5173                                          vector short __b) {
5174   return (vector short)__a | __b;
5175 }
5176
5177 static vector short __ATTRS_o_ai vec_vor(vector short __a,
5178                                          vector bool short __b) {
5179   return __a | (vector short)__b;
5180 }
5181
5182 static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
5183                                                   vector unsigned short __b) {
5184   return __a | __b;
5185 }
5186
5187 static vector unsigned short __ATTRS_o_ai vec_vor(vector bool short __a,
5188                                                   vector unsigned short __b) {
5189   return (vector unsigned short)__a | __b;
5190 }
5191
5192 static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
5193                                                   vector bool short __b) {
5194   return __a | (vector unsigned short)__b;
5195 }
5196
5197 static vector bool short __ATTRS_o_ai vec_vor(vector bool short __a,
5198                                               vector bool short __b) {
5199   return __a | __b;
5200 }
5201
5202 static vector int __ATTRS_o_ai vec_vor(vector int __a, vector int __b) {
5203   return __a | __b;
5204 }
5205
5206 static vector int __ATTRS_o_ai vec_vor(vector bool int __a, vector int __b) {
5207   return (vector int)__a | __b;
5208 }
5209
5210 static vector int __ATTRS_o_ai vec_vor(vector int __a, vector bool int __b) {
5211   return __a | (vector int)__b;
5212 }
5213
5214 static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
5215                                                 vector unsigned int __b) {
5216   return __a | __b;
5217 }
5218
5219 static vector unsigned int __ATTRS_o_ai vec_vor(vector bool int __a,
5220                                                 vector unsigned int __b) {
5221   return (vector unsigned int)__a | __b;
5222 }
5223
5224 static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
5225                                                 vector bool int __b) {
5226   return __a | (vector unsigned int)__b;
5227 }
5228
5229 static vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
5230                                             vector bool int __b) {
5231   return __a | __b;
5232 }
5233
5234 static vector float __ATTRS_o_ai vec_vor(vector float __a, vector float __b) {
5235   vector unsigned int __res =
5236       (vector unsigned int)__a | (vector unsigned int)__b;
5237   return (vector float)__res;
5238 }
5239
5240 static vector float __ATTRS_o_ai vec_vor(vector bool int __a,
5241                                          vector float __b) {
5242   vector unsigned int __res =
5243       (vector unsigned int)__a | (vector unsigned int)__b;
5244   return (vector float)__res;
5245 }
5246
5247 static vector float __ATTRS_o_ai vec_vor(vector float __a,
5248                                          vector bool int __b) {
5249   vector unsigned int __res =
5250       (vector unsigned int)__a | (vector unsigned int)__b;
5251   return (vector float)__res;
5252 }
5253
5254 #ifdef __VSX__
5255 static vector signed long long __ATTRS_o_ai
5256 vec_vor(vector signed long long __a, vector signed long long __b) {
5257   return __a | __b;
5258 }
5259
5260 static vector signed long long __ATTRS_o_ai
5261 vec_vor(vector bool long long __a, vector signed long long __b) {
5262   return (vector signed long long)__a | __b;
5263 }
5264
5265 static vector signed long long __ATTRS_o_ai vec_vor(vector signed long long __a,
5266                                                     vector bool long long __b) {
5267   return __a | (vector signed long long)__b;
5268 }
5269
5270 static vector unsigned long long __ATTRS_o_ai
5271 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
5272   return __a | __b;
5273 }
5274
5275 static vector unsigned long long __ATTRS_o_ai
5276 vec_vor(vector bool long long __a, vector unsigned long long __b) {
5277   return (vector unsigned long long)__a | __b;
5278 }
5279
5280 static vector unsigned long long __ATTRS_o_ai
5281 vec_vor(vector unsigned long long __a, vector bool long long __b) {
5282   return __a | (vector unsigned long long)__b;
5283 }
5284
5285 static vector bool long long __ATTRS_o_ai vec_vor(vector bool long long __a,
5286                                                   vector bool long long __b) {
5287   return __a | __b;
5288 }
5289 #endif
5290
5291 /* vec_pack */
5292
5293 /* The various vector pack instructions have a big-endian bias, so for
5294    little endian we must handle reversed element numbering.  */
5295
5296 static vector signed char __ATTRS_o_ai vec_pack(vector signed short __a,
5297                                                 vector signed short __b) {
5298 #ifdef __LITTLE_ENDIAN__
5299   return (vector signed char)vec_perm(
5300       __a, __b,
5301       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5302                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5303 #else
5304   return (vector signed char)vec_perm(
5305       __a, __b,
5306       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5307                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5308 #endif
5309 }
5310
5311 static vector unsigned char __ATTRS_o_ai vec_pack(vector unsigned short __a,
5312                                                   vector unsigned short __b) {
5313 #ifdef __LITTLE_ENDIAN__
5314   return (vector unsigned char)vec_perm(
5315       __a, __b,
5316       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5317                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5318 #else
5319   return (vector unsigned char)vec_perm(
5320       __a, __b,
5321       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5322                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5323 #endif
5324 }
5325
5326 static vector bool char __ATTRS_o_ai vec_pack(vector bool short __a,
5327                                               vector bool short __b) {
5328 #ifdef __LITTLE_ENDIAN__
5329   return (vector bool char)vec_perm(
5330       __a, __b,
5331       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5332                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5333 #else
5334   return (vector bool char)vec_perm(
5335       __a, __b,
5336       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5337                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5338 #endif
5339 }
5340
5341 static vector short __ATTRS_o_ai vec_pack(vector int __a, vector int __b) {
5342 #ifdef __LITTLE_ENDIAN__
5343   return (vector short)vec_perm(
5344       __a, __b,
5345       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5346                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5347 #else
5348   return (vector short)vec_perm(
5349       __a, __b,
5350       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5351                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5352 #endif
5353 }
5354
5355 static vector unsigned short __ATTRS_o_ai vec_pack(vector unsigned int __a,
5356                                                    vector unsigned int __b) {
5357 #ifdef __LITTLE_ENDIAN__
5358   return (vector unsigned short)vec_perm(
5359       __a, __b,
5360       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5361                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5362 #else
5363   return (vector unsigned short)vec_perm(
5364       __a, __b,
5365       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5366                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5367 #endif
5368 }
5369
5370 static vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
5371                                                vector bool int __b) {
5372 #ifdef __LITTLE_ENDIAN__
5373   return (vector bool short)vec_perm(
5374       __a, __b,
5375       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5376                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5377 #else
5378   return (vector bool short)vec_perm(
5379       __a, __b,
5380       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5381                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5382 #endif
5383 }
5384
5385 #ifdef __VSX__
5386 static vector signed int __ATTRS_o_ai vec_pack(vector signed long long __a,
5387                                                vector signed long long __b) {
5388 #ifdef __LITTLE_ENDIAN__
5389   return (vector signed int)vec_perm(
5390       __a, __b,
5391       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5392                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5393 #else
5394   return (vector signed int)vec_perm(
5395       __a, __b,
5396       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5397                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5398 #endif
5399 }
5400 static vector unsigned int __ATTRS_o_ai
5401 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
5402 #ifdef __LITTLE_ENDIAN__
5403   return (vector unsigned int)vec_perm(
5404       __a, __b,
5405       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5406                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5407 #else
5408   return (vector unsigned int)vec_perm(
5409       __a, __b,
5410       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5411                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5412 #endif
5413 }
5414
5415 static vector bool int __ATTRS_o_ai vec_pack(vector bool long long __a,
5416                                              vector bool long long __b) {
5417 #ifdef __LITTLE_ENDIAN__
5418   return (vector bool int)vec_perm(
5419       __a, __b,
5420       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5421                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5422 #else
5423   return (vector bool int)vec_perm(
5424       __a, __b,
5425       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5426                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5427 #endif
5428 }
5429
5430 #endif
5431
5432 /* vec_vpkuhum */
5433
5434 #define __builtin_altivec_vpkuhum vec_vpkuhum
5435
5436 static vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a,
5437                                                    vector signed short __b) {
5438 #ifdef __LITTLE_ENDIAN__
5439   return (vector signed char)vec_perm(
5440       __a, __b,
5441       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5442                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5443 #else
5444   return (vector signed char)vec_perm(
5445       __a, __b,
5446       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5447                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5448 #endif
5449 }
5450
5451 static vector unsigned char __ATTRS_o_ai
5452 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
5453 #ifdef __LITTLE_ENDIAN__
5454   return (vector unsigned char)vec_perm(
5455       __a, __b,
5456       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5457                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5458 #else
5459   return (vector unsigned char)vec_perm(
5460       __a, __b,
5461       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5462                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5463 #endif
5464 }
5465
5466 static vector bool char __ATTRS_o_ai vec_vpkuhum(vector bool short __a,
5467                                                  vector bool short __b) {
5468 #ifdef __LITTLE_ENDIAN__
5469   return (vector bool char)vec_perm(
5470       __a, __b,
5471       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5472                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5473 #else
5474   return (vector bool char)vec_perm(
5475       __a, __b,
5476       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5477                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5478 #endif
5479 }
5480
5481 /* vec_vpkuwum */
5482
5483 #define __builtin_altivec_vpkuwum vec_vpkuwum
5484
5485 static vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b) {
5486 #ifdef __LITTLE_ENDIAN__
5487   return (vector short)vec_perm(
5488       __a, __b,
5489       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5490                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5491 #else
5492   return (vector short)vec_perm(
5493       __a, __b,
5494       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5495                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5496 #endif
5497 }
5498
5499 static vector unsigned short __ATTRS_o_ai vec_vpkuwum(vector unsigned int __a,
5500                                                       vector unsigned int __b) {
5501 #ifdef __LITTLE_ENDIAN__
5502   return (vector unsigned short)vec_perm(
5503       __a, __b,
5504       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5505                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5506 #else
5507   return (vector unsigned short)vec_perm(
5508       __a, __b,
5509       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5510                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5511 #endif
5512 }
5513
5514 static vector bool short __ATTRS_o_ai vec_vpkuwum(vector bool int __a,
5515                                                   vector bool int __b) {
5516 #ifdef __LITTLE_ENDIAN__
5517   return (vector bool short)vec_perm(
5518       __a, __b,
5519       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5520                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5521 #else
5522   return (vector bool short)vec_perm(
5523       __a, __b,
5524       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5525                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5526 #endif
5527 }
5528
5529 /* vec_vpkudum */
5530
5531 #ifdef __POWER8_VECTOR__
5532 #define __builtin_altivec_vpkudum vec_vpkudum
5533
5534 static vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
5535                                            vector long long __b) {
5536 #ifdef __LITTLE_ENDIAN__
5537   return (vector int)vec_perm(
5538       __a, __b,
5539       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5540                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5541 #else
5542   return (vector int)vec_perm(
5543       __a, __b,
5544       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5545                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5546 #endif
5547 }
5548
5549 static vector unsigned int __ATTRS_o_ai
5550 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
5551 #ifdef __LITTLE_ENDIAN__
5552   return (vector unsigned int)vec_perm(
5553       __a, __b,
5554       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5555                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5556 #else
5557   return (vector unsigned int)vec_perm(
5558       __a, __b,
5559       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5560                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5561 #endif
5562 }
5563
5564 static vector bool int __ATTRS_o_ai vec_vpkudum(vector bool long long __a,
5565                                                 vector bool long long __b) {
5566 #ifdef __LITTLE_ENDIAN__
5567   return (vector bool int)vec_perm(
5568       (vector long long)__a, (vector long long)__b,
5569       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5570                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5571 #else
5572   return (vector bool int)vec_perm(
5573       (vector long long)__a, (vector long long)__b,
5574       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5575                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5576 #endif
5577 }
5578 #endif
5579
5580 /* vec_packpx */
5581
5582 static vector pixel __attribute__((__always_inline__))
5583 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
5584 #ifdef __LITTLE_ENDIAN__
5585   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5586 #else
5587   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5588 #endif
5589 }
5590
5591 /* vec_vpkpx */
5592
5593 static vector pixel __attribute__((__always_inline__))
5594 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
5595 #ifdef __LITTLE_ENDIAN__
5596   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5597 #else
5598   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5599 #endif
5600 }
5601
5602 /* vec_packs */
5603
5604 static vector signed char __ATTRS_o_ai vec_packs(vector short __a,
5605                                                  vector short __b) {
5606 #ifdef __LITTLE_ENDIAN__
5607   return __builtin_altivec_vpkshss(__b, __a);
5608 #else
5609   return __builtin_altivec_vpkshss(__a, __b);
5610 #endif
5611 }
5612
5613 static vector unsigned char __ATTRS_o_ai vec_packs(vector unsigned short __a,
5614                                                    vector unsigned short __b) {
5615 #ifdef __LITTLE_ENDIAN__
5616   return __builtin_altivec_vpkuhus(__b, __a);
5617 #else
5618   return __builtin_altivec_vpkuhus(__a, __b);
5619 #endif
5620 }
5621
5622 static vector signed short __ATTRS_o_ai vec_packs(vector int __a,
5623                                                   vector int __b) {
5624 #ifdef __LITTLE_ENDIAN__
5625   return __builtin_altivec_vpkswss(__b, __a);
5626 #else
5627   return __builtin_altivec_vpkswss(__a, __b);
5628 #endif
5629 }
5630
5631 static vector unsigned short __ATTRS_o_ai vec_packs(vector unsigned int __a,
5632                                                     vector unsigned int __b) {
5633 #ifdef __LITTLE_ENDIAN__
5634   return __builtin_altivec_vpkuwus(__b, __a);
5635 #else
5636   return __builtin_altivec_vpkuwus(__a, __b);
5637 #endif
5638 }
5639
5640 #ifdef __POWER8_VECTOR__
5641 static vector int __ATTRS_o_ai vec_packs(vector long long __a,
5642                                          vector long long __b) {
5643 #ifdef __LITTLE_ENDIAN__
5644   return __builtin_altivec_vpksdss(__b, __a);
5645 #else
5646   return __builtin_altivec_vpksdss(__a, __b);
5647 #endif
5648 }
5649
5650 static vector unsigned int __ATTRS_o_ai
5651 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
5652 #ifdef __LITTLE_ENDIAN__
5653   return __builtin_altivec_vpkudus(__b, __a);
5654 #else
5655   return __builtin_altivec_vpkudus(__a, __b);
5656 #endif
5657 }
5658 #endif
5659
5660 /* vec_vpkshss */
5661
5662 static vector signed char __attribute__((__always_inline__))
5663 vec_vpkshss(vector short __a, vector short __b) {
5664 #ifdef __LITTLE_ENDIAN__
5665   return __builtin_altivec_vpkshss(__b, __a);
5666 #else
5667   return __builtin_altivec_vpkshss(__a, __b);
5668 #endif
5669 }
5670
5671 /* vec_vpksdss */
5672
5673 #ifdef __POWER8_VECTOR__
5674 static vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
5675                                            vector long long __b) {
5676 #ifdef __LITTLE_ENDIAN__
5677   return __builtin_altivec_vpksdss(__b, __a);
5678 #else
5679   return __builtin_altivec_vpksdss(__a, __b);
5680 #endif
5681 }
5682 #endif
5683
5684 /* vec_vpkuhus */
5685
5686 static vector unsigned char __attribute__((__always_inline__))
5687 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
5688 #ifdef __LITTLE_ENDIAN__
5689   return __builtin_altivec_vpkuhus(__b, __a);
5690 #else
5691   return __builtin_altivec_vpkuhus(__a, __b);
5692 #endif
5693 }
5694
5695 /* vec_vpkudus */
5696
5697 #ifdef __POWER8_VECTOR__
5698 static vector unsigned int __attribute__((__always_inline__))
5699 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
5700 #ifdef __LITTLE_ENDIAN__
5701   return __builtin_altivec_vpkudus(__b, __a);
5702 #else
5703   return __builtin_altivec_vpkudus(__a, __b);
5704 #endif
5705 }
5706 #endif
5707
5708 /* vec_vpkswss */
5709
5710 static vector signed short __attribute__((__always_inline__))
5711 vec_vpkswss(vector int __a, vector int __b) {
5712 #ifdef __LITTLE_ENDIAN__
5713   return __builtin_altivec_vpkswss(__b, __a);
5714 #else
5715   return __builtin_altivec_vpkswss(__a, __b);
5716 #endif
5717 }
5718
5719 /* vec_vpkuwus */
5720
5721 static vector unsigned short __attribute__((__always_inline__))
5722 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
5723 #ifdef __LITTLE_ENDIAN__
5724   return __builtin_altivec_vpkuwus(__b, __a);
5725 #else
5726   return __builtin_altivec_vpkuwus(__a, __b);
5727 #endif
5728 }
5729
5730 /* vec_packsu */
5731
5732 static vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a,
5733                                                     vector short __b) {
5734 #ifdef __LITTLE_ENDIAN__
5735   return __builtin_altivec_vpkshus(__b, __a);
5736 #else
5737   return __builtin_altivec_vpkshus(__a, __b);
5738 #endif
5739 }
5740
5741 static vector unsigned char __ATTRS_o_ai vec_packsu(vector unsigned short __a,
5742                                                     vector unsigned short __b) {
5743 #ifdef __LITTLE_ENDIAN__
5744   return __builtin_altivec_vpkuhus(__b, __a);
5745 #else
5746   return __builtin_altivec_vpkuhus(__a, __b);
5747 #endif
5748 }
5749
5750 static vector unsigned short __ATTRS_o_ai vec_packsu(vector int __a,
5751                                                      vector int __b) {
5752 #ifdef __LITTLE_ENDIAN__
5753   return __builtin_altivec_vpkswus(__b, __a);
5754 #else
5755   return __builtin_altivec_vpkswus(__a, __b);
5756 #endif
5757 }
5758
5759 static vector unsigned short __ATTRS_o_ai vec_packsu(vector unsigned int __a,
5760                                                      vector unsigned int __b) {
5761 #ifdef __LITTLE_ENDIAN__
5762   return __builtin_altivec_vpkuwus(__b, __a);
5763 #else
5764   return __builtin_altivec_vpkuwus(__a, __b);
5765 #endif
5766 }
5767
5768 #ifdef __POWER8_VECTOR__
5769 static vector unsigned int __ATTRS_o_ai vec_packsu(vector long long __a,
5770                                                    vector long long __b) {
5771 #ifdef __LITTLE_ENDIAN__
5772   return __builtin_altivec_vpksdus(__b, __a);
5773 #else
5774   return __builtin_altivec_vpksdus(__a, __b);
5775 #endif
5776 }
5777
5778 static vector unsigned int __ATTRS_o_ai
5779 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
5780 #ifdef __LITTLE_ENDIAN__
5781   return __builtin_altivec_vpkudus(__b, __a);
5782 #else
5783   return __builtin_altivec_vpkudus(__a, __b);
5784 #endif
5785 }
5786 #endif
5787
5788 /* vec_vpkshus */
5789
5790 static vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a,
5791                                                      vector short __b) {
5792 #ifdef __LITTLE_ENDIAN__
5793   return __builtin_altivec_vpkshus(__b, __a);
5794 #else
5795   return __builtin_altivec_vpkshus(__a, __b);
5796 #endif
5797 }
5798
5799 static vector unsigned char __ATTRS_o_ai
5800 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
5801 #ifdef __LITTLE_ENDIAN__
5802   return __builtin_altivec_vpkuhus(__b, __a);
5803 #else
5804   return __builtin_altivec_vpkuhus(__a, __b);
5805 #endif
5806 }
5807
5808 /* vec_vpkswus */
5809
5810 static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a,
5811                                                       vector int __b) {
5812 #ifdef __LITTLE_ENDIAN__
5813   return __builtin_altivec_vpkswus(__b, __a);
5814 #else
5815   return __builtin_altivec_vpkswus(__a, __b);
5816 #endif
5817 }
5818
5819 static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector unsigned int __a,
5820                                                       vector unsigned int __b) {
5821 #ifdef __LITTLE_ENDIAN__
5822   return __builtin_altivec_vpkuwus(__b, __a);
5823 #else
5824   return __builtin_altivec_vpkuwus(__a, __b);
5825 #endif
5826 }
5827
5828 /* vec_vpksdus */
5829
5830 #ifdef __POWER8_VECTOR__
5831 static vector unsigned int __ATTRS_o_ai vec_vpksdus(vector long long __a,
5832                                                     vector long long __b) {
5833 #ifdef __LITTLE_ENDIAN__
5834   return __builtin_altivec_vpksdus(__b, __a);
5835 #else
5836   return __builtin_altivec_vpksdus(__a, __b);
5837 #endif
5838 }
5839 #endif
5840
5841 /* vec_perm */
5842
5843 // The vperm instruction is defined architecturally with a big-endian bias.
5844 // For little endian, we swap the input operands and invert the permute
5845 // control vector.  Only the rightmost 5 bits matter, so we could use
5846 // a vector of all 31s instead of all 255s to perform the inversion.
5847 // However, when the PCV is not a constant, using 255 has an advantage
5848 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
5849 // later, possibly a vec_nand).
5850
5851 static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
5852                                                 vector signed char __b,
5853                                                 vector unsigned char __c) {
5854 #ifdef __LITTLE_ENDIAN__
5855   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5856                               255, 255, 255, 255, 255, 255, 255, 255};
5857   __d = vec_xor(__c, __d);
5858   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
5859                                                          (vector int)__a, __d);
5860 #else
5861   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
5862                                                          (vector int)__b, __c);
5863 #endif
5864 }
5865
5866 static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
5867                                                   vector unsigned char __b,
5868                                                   vector unsigned char __c) {
5869 #ifdef __LITTLE_ENDIAN__
5870   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5871                               255, 255, 255, 255, 255, 255, 255, 255};
5872   __d = vec_xor(__c, __d);
5873   return (vector unsigned char)__builtin_altivec_vperm_4si(
5874       (vector int)__b, (vector int)__a, __d);
5875 #else
5876   return (vector unsigned char)__builtin_altivec_vperm_4si(
5877       (vector int)__a, (vector int)__b, __c);
5878 #endif
5879 }
5880
5881 static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
5882                                               vector bool char __b,
5883                                               vector unsigned char __c) {
5884 #ifdef __LITTLE_ENDIAN__
5885   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5886                               255, 255, 255, 255, 255, 255, 255, 255};
5887   __d = vec_xor(__c, __d);
5888   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
5889                                                        (vector int)__a, __d);
5890 #else
5891   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
5892                                                        (vector int)__b, __c);
5893 #endif
5894 }
5895
5896 static vector short __ATTRS_o_ai vec_perm(vector signed short __a,
5897                                           vector signed short __b,
5898                                           vector unsigned char __c) {
5899 #ifdef __LITTLE_ENDIAN__
5900   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5901                               255, 255, 255, 255, 255, 255, 255, 255};
5902   __d = vec_xor(__c, __d);
5903   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
5904                                                           (vector int)__a, __d);
5905 #else
5906   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
5907                                                           (vector int)__b, __c);
5908 #endif
5909 }
5910
5911 static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
5912                                                    vector unsigned short __b,
5913                                                    vector unsigned char __c) {
5914 #ifdef __LITTLE_ENDIAN__
5915   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5916                               255, 255, 255, 255, 255, 255, 255, 255};
5917   __d = vec_xor(__c, __d);
5918   return (vector unsigned short)__builtin_altivec_vperm_4si(
5919       (vector int)__b, (vector int)__a, __d);
5920 #else
5921   return (vector unsigned short)__builtin_altivec_vperm_4si(
5922       (vector int)__a, (vector int)__b, __c);
5923 #endif
5924 }
5925
5926 static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
5927                                                vector bool short __b,
5928                                                vector unsigned char __c) {
5929 #ifdef __LITTLE_ENDIAN__
5930   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5931                               255, 255, 255, 255, 255, 255, 255, 255};
5932   __d = vec_xor(__c, __d);
5933   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
5934                                                         (vector int)__a, __d);
5935 #else
5936   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
5937                                                         (vector int)__b, __c);
5938 #endif
5939 }
5940
5941 static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
5942                                           vector unsigned char __c) {
5943 #ifdef __LITTLE_ENDIAN__
5944   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5945                               255, 255, 255, 255, 255, 255, 255, 255};
5946   __d = vec_xor(__c, __d);
5947   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
5948                                                    (vector int)__a, __d);
5949 #else
5950   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
5951                                                    (vector int)__b, __c);
5952 #endif
5953 }
5954
5955 static vector int __ATTRS_o_ai vec_perm(vector signed int __a,
5956                                         vector signed int __b,
5957                                         vector unsigned char __c) {
5958 #ifdef __LITTLE_ENDIAN__
5959   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5960                               255, 255, 255, 255, 255, 255, 255, 255};
5961   __d = vec_xor(__c, __d);
5962   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
5963 #else
5964   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
5965 #endif
5966 }
5967
5968 static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
5969                                                  vector unsigned int __b,
5970                                                  vector unsigned char __c) {
5971 #ifdef __LITTLE_ENDIAN__
5972   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5973                               255, 255, 255, 255, 255, 255, 255, 255};
5974   __d = vec_xor(__c, __d);
5975   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
5976                                                           (vector int)__a, __d);
5977 #else
5978   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
5979                                                           (vector int)__b, __c);
5980 #endif
5981 }
5982
5983 static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
5984                                              vector bool int __b,
5985                                              vector unsigned char __c) {
5986 #ifdef __LITTLE_ENDIAN__
5987   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5988                               255, 255, 255, 255, 255, 255, 255, 255};
5989   __d = vec_xor(__c, __d);
5990   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
5991                                                       (vector int)__a, __d);
5992 #else
5993   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
5994                                                       (vector int)__b, __c);
5995 #endif
5996 }
5997
5998 static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
5999                                           vector unsigned char __c) {
6000 #ifdef __LITTLE_ENDIAN__
6001   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6002                               255, 255, 255, 255, 255, 255, 255, 255};
6003   __d = vec_xor(__c, __d);
6004   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
6005                                                    (vector int)__a, __d);
6006 #else
6007   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
6008                                                    (vector int)__b, __c);
6009 #endif
6010 }
6011
6012 #ifdef __VSX__
6013 static vector long long __ATTRS_o_ai vec_perm(vector signed long long __a,
6014                                               vector signed long long __b,
6015                                               vector unsigned char __c) {
6016 #ifdef __LITTLE_ENDIAN__
6017   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6018                               255, 255, 255, 255, 255, 255, 255, 255};
6019   __d = vec_xor(__c, __d);
6020   return (vector signed long long)__builtin_altivec_vperm_4si(
6021       (vector int)__b, (vector int)__a, __d);
6022 #else
6023   return (vector signed long long)__builtin_altivec_vperm_4si(
6024       (vector int)__a, (vector int)__b, __c);
6025 #endif
6026 }
6027
6028 static vector unsigned long long __ATTRS_o_ai
6029 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
6030          vector unsigned char __c) {
6031 #ifdef __LITTLE_ENDIAN__
6032   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6033                               255, 255, 255, 255, 255, 255, 255, 255};
6034   __d = vec_xor(__c, __d);
6035   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6036       (vector int)__b, (vector int)__a, __d);
6037 #else
6038   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6039       (vector int)__a, (vector int)__b, __c);
6040 #endif
6041 }
6042
6043 static vector bool long long __ATTRS_o_ai
6044 vec_perm(vector bool long long __a, vector bool long long __b,
6045          vector unsigned char __c) {
6046 #ifdef __LITTLE_ENDIAN__
6047   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6048                               255, 255, 255, 255, 255, 255, 255, 255};
6049   __d = vec_xor(__c, __d);
6050   return (vector bool long long)__builtin_altivec_vperm_4si(
6051       (vector int)__b, (vector int)__a, __d);
6052 #else
6053   return (vector bool long long)__builtin_altivec_vperm_4si(
6054       (vector int)__a, (vector int)__b, __c);
6055 #endif
6056 }
6057
6058 static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
6059                                            vector unsigned char __c) {
6060 #ifdef __LITTLE_ENDIAN__
6061   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6062                               255, 255, 255, 255, 255, 255, 255, 255};
6063   __d = vec_xor(__c, __d);
6064   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
6065                                                     (vector int)__a, __d);
6066 #else
6067   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
6068                                                     (vector int)__b, __c);
6069 #endif
6070 }
6071 #endif
6072
6073 /* vec_vperm */
6074
6075 static vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a,
6076                                                  vector signed char __b,
6077                                                  vector unsigned char __c) {
6078   return vec_perm(__a, __b, __c);
6079 }
6080
6081 static vector unsigned char __ATTRS_o_ai vec_vperm(vector unsigned char __a,
6082                                                    vector unsigned char __b,
6083                                                    vector unsigned char __c) {
6084   return vec_perm(__a, __b, __c);
6085 }
6086
6087 static vector bool char __ATTRS_o_ai vec_vperm(vector bool char __a,
6088                                                vector bool char __b,
6089                                                vector unsigned char __c) {
6090   return vec_perm(__a, __b, __c);
6091 }
6092
6093 static vector short __ATTRS_o_ai vec_vperm(vector short __a, vector short __b,
6094                                            vector unsigned char __c) {
6095   return vec_perm(__a, __b, __c);
6096 }
6097
6098 static vector unsigned short __ATTRS_o_ai vec_vperm(vector unsigned short __a,
6099                                                     vector unsigned short __b,
6100                                                     vector unsigned char __c) {
6101   return vec_perm(__a, __b, __c);
6102 }
6103
6104 static vector bool short __ATTRS_o_ai vec_vperm(vector bool short __a,
6105                                                 vector bool short __b,
6106                                                 vector unsigned char __c) {
6107   return vec_perm(__a, __b, __c);
6108 }
6109
6110 static vector pixel __ATTRS_o_ai vec_vperm(vector pixel __a, vector pixel __b,
6111                                            vector unsigned char __c) {
6112   return vec_perm(__a, __b, __c);
6113 }
6114
6115 static vector int __ATTRS_o_ai vec_vperm(vector int __a, vector int __b,
6116                                          vector unsigned char __c) {
6117   return vec_perm(__a, __b, __c);
6118 }
6119
6120 static vector unsigned int __ATTRS_o_ai vec_vperm(vector unsigned int __a,
6121                                                   vector unsigned int __b,
6122                                                   vector unsigned char __c) {
6123   return vec_perm(__a, __b, __c);
6124 }
6125
6126 static vector bool int __ATTRS_o_ai vec_vperm(vector bool int __a,
6127                                               vector bool int __b,
6128                                               vector unsigned char __c) {
6129   return vec_perm(__a, __b, __c);
6130 }
6131
6132 static vector float __ATTRS_o_ai vec_vperm(vector float __a, vector float __b,
6133                                            vector unsigned char __c) {
6134   return vec_perm(__a, __b, __c);
6135 }
6136
6137 #ifdef __VSX__
6138 static vector long long __ATTRS_o_ai vec_vperm(vector long long __a,
6139                                                vector long long __b,
6140                                                vector unsigned char __c) {
6141   return vec_perm(__a, __b, __c);
6142 }
6143
6144 static vector unsigned long long __ATTRS_o_ai
6145 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
6146           vector unsigned char __c) {
6147   return vec_perm(__a, __b, __c);
6148 }
6149
6150 static vector double __ATTRS_o_ai vec_vperm(vector double __a,
6151                                             vector double __b,
6152                                             vector unsigned char __c) {
6153   return vec_perm(__a, __b, __c);
6154 }
6155 #endif
6156
6157 /* vec_re */
6158
6159 static vector float __ATTRS_o_ai
6160 vec_re(vector float __a) {
6161 #ifdef __VSX__
6162   return __builtin_vsx_xvresp(__a);
6163 #else
6164   return __builtin_altivec_vrefp(__a);
6165 #endif
6166 }
6167
6168 #ifdef __VSX__
6169 static vector double __ATTRS_o_ai vec_re(vector double __a) {
6170   return __builtin_vsx_xvredp(__a);
6171 }
6172 #endif
6173
6174 /* vec_vrefp */
6175
6176 static vector float __attribute__((__always_inline__))
6177 vec_vrefp(vector float __a) {
6178   return __builtin_altivec_vrefp(__a);
6179 }
6180
6181 /* vec_rl */
6182
6183 static vector signed char __ATTRS_o_ai vec_rl(vector signed char __a,
6184                                               vector unsigned char __b) {
6185   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6186 }
6187
6188 static vector unsigned char __ATTRS_o_ai vec_rl(vector unsigned char __a,
6189                                                 vector unsigned char __b) {
6190   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6191 }
6192
6193 static vector short __ATTRS_o_ai vec_rl(vector short __a,
6194                                         vector unsigned short __b) {
6195   return __builtin_altivec_vrlh(__a, __b);
6196 }
6197
6198 static vector unsigned short __ATTRS_o_ai vec_rl(vector unsigned short __a,
6199                                                  vector unsigned short __b) {
6200   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6201 }
6202
6203 static vector int __ATTRS_o_ai vec_rl(vector int __a, vector unsigned int __b) {
6204   return __builtin_altivec_vrlw(__a, __b);
6205 }
6206
6207 static vector unsigned int __ATTRS_o_ai vec_rl(vector unsigned int __a,
6208                                                vector unsigned int __b) {
6209   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6210 }
6211
6212 #ifdef __POWER8_VECTOR__
6213 static vector signed long long __ATTRS_o_ai
6214 vec_rl(vector signed long long __a, vector unsigned long long __b) {
6215   return __builtin_altivec_vrld(__a, __b);
6216 }
6217
6218 static vector unsigned long long __ATTRS_o_ai
6219 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
6220   return __builtin_altivec_vrld(__a, __b);
6221 }
6222 #endif
6223
6224 /* vec_vrlb */
6225
6226 static vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a,
6227                                                 vector unsigned char __b) {
6228   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6229 }
6230
6231 static vector unsigned char __ATTRS_o_ai vec_vrlb(vector unsigned char __a,
6232                                                   vector unsigned char __b) {
6233   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6234 }
6235
6236 /* vec_vrlh */
6237
6238 static vector short __ATTRS_o_ai vec_vrlh(vector short __a,
6239                                           vector unsigned short __b) {
6240   return __builtin_altivec_vrlh(__a, __b);
6241 }
6242
6243 static vector unsigned short __ATTRS_o_ai vec_vrlh(vector unsigned short __a,
6244                                                    vector unsigned short __b) {
6245   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6246 }
6247
6248 /* vec_vrlw */
6249
6250 static vector int __ATTRS_o_ai vec_vrlw(vector int __a,
6251                                         vector unsigned int __b) {
6252   return __builtin_altivec_vrlw(__a, __b);
6253 }
6254
6255 static vector unsigned int __ATTRS_o_ai vec_vrlw(vector unsigned int __a,
6256                                                  vector unsigned int __b) {
6257   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6258 }
6259
6260 /* vec_round */
6261
6262 static vector float __ATTRS_o_ai vec_round(vector float __a) {
6263 #ifdef __VSX__
6264   return __builtin_vsx_xvrspi(__a);
6265 #else
6266   return __builtin_altivec_vrfin(__a);
6267 #endif
6268 }
6269
6270 #ifdef __VSX__
6271 static vector double __ATTRS_o_ai vec_round(vector double __a) {
6272   return __builtin_vsx_xvrdpi(__a);
6273 }
6274
6275 /* vec_rint */
6276
6277 static vector float __ATTRS_o_ai
6278 vec_rint(vector float __a) {
6279   return __builtin_vsx_xvrspic(__a);
6280 }
6281
6282 static vector double __ATTRS_o_ai
6283 vec_rint(vector double __a) {
6284   return __builtin_vsx_xvrdpic(__a);
6285 }
6286
6287 /* vec_nearbyint */
6288
6289 static vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
6290   return __builtin_vsx_xvrspi(__a);
6291 }
6292
6293 static vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
6294   return __builtin_vsx_xvrdpi(__a);
6295 }
6296 #endif
6297
6298 /* vec_vrfin */
6299
6300 static vector float __attribute__((__always_inline__))
6301 vec_vrfin(vector float __a) {
6302   return __builtin_altivec_vrfin(__a);
6303 }
6304
6305 /* vec_sqrt */
6306
6307 #ifdef __VSX__
6308 static vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
6309   return __builtin_vsx_xvsqrtsp(__a);
6310 }
6311
6312 static vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
6313   return __builtin_vsx_xvsqrtdp(__a);
6314 }
6315 #endif
6316
6317 /* vec_rsqrte */
6318
6319 static vector float __ATTRS_o_ai
6320 vec_rsqrte(vector float __a) {
6321 #ifdef __VSX__
6322   return __builtin_vsx_xvrsqrtesp(__a);
6323 #else
6324   return __builtin_altivec_vrsqrtefp(__a);
6325 #endif
6326 }
6327
6328 #ifdef __VSX__
6329 static vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
6330   return __builtin_vsx_xvrsqrtedp(__a);
6331 }
6332 #endif
6333
6334 /* vec_vrsqrtefp */
6335
6336 static __vector float __attribute__((__always_inline__))
6337 vec_vrsqrtefp(vector float __a) {
6338   return __builtin_altivec_vrsqrtefp(__a);
6339 }
6340
6341 /* vec_sel */
6342
6343 #define __builtin_altivec_vsel_4si vec_sel
6344
6345 static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
6346                                                vector signed char __b,
6347                                                vector unsigned char __c) {
6348   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6349 }
6350
6351 static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
6352                                                vector signed char __b,
6353                                                vector bool char __c) {
6354   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6355 }
6356
6357 static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
6358                                                  vector unsigned char __b,
6359                                                  vector unsigned char __c) {
6360   return (__a & ~__c) | (__b & __c);
6361 }
6362
6363 static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
6364                                                  vector unsigned char __b,
6365                                                  vector bool char __c) {
6366   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6367 }
6368
6369 static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6370                                              vector bool char __b,
6371                                              vector unsigned char __c) {
6372   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6373 }
6374
6375 static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6376                                              vector bool char __b,
6377                                              vector bool char __c) {
6378   return (__a & ~__c) | (__b & __c);
6379 }
6380
6381 static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
6382                                          vector unsigned short __c) {
6383   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6384 }
6385
6386 static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
6387                                          vector bool short __c) {
6388   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6389 }
6390
6391 static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
6392                                                   vector unsigned short __b,
6393                                                   vector unsigned short __c) {
6394   return (__a & ~__c) | (__b & __c);
6395 }
6396
6397 static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
6398                                                   vector unsigned short __b,
6399                                                   vector bool short __c) {
6400   return (__a & ~(vector unsigned short)__c) |
6401          (__b & (vector unsigned short)__c);
6402 }
6403
6404 static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
6405                                               vector bool short __b,
6406                                               vector unsigned short __c) {
6407   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6408 }
6409
6410 static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
6411                                               vector bool short __b,
6412                                               vector bool short __c) {
6413   return (__a & ~__c) | (__b & __c);
6414 }
6415
6416 static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
6417                                        vector unsigned int __c) {
6418   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6419 }
6420
6421 static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
6422                                        vector bool int __c) {
6423   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6424 }
6425
6426 static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
6427                                                 vector unsigned int __b,
6428                                                 vector unsigned int __c) {
6429   return (__a & ~__c) | (__b & __c);
6430 }
6431
6432 static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
6433                                                 vector unsigned int __b,
6434                                                 vector bool int __c) {
6435   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6436 }
6437
6438 static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6439                                             vector bool int __b,
6440                                             vector unsigned int __c) {
6441   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6442 }
6443
6444 static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6445                                             vector bool int __b,
6446                                             vector bool int __c) {
6447   return (__a & ~__c) | (__b & __c);
6448 }
6449
6450 static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
6451                                          vector unsigned int __c) {
6452   vector int __res = ((vector int)__a & ~(vector int)__c) |
6453                      ((vector int)__b & (vector int)__c);
6454   return (vector float)__res;
6455 }
6456
6457 static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
6458                                          vector bool int __c) {
6459   vector int __res = ((vector int)__a & ~(vector int)__c) |
6460                      ((vector int)__b & (vector int)__c);
6461   return (vector float)__res;
6462 }
6463
6464 #ifdef __VSX__
6465 static vector double __ATTRS_o_ai vec_sel(vector double __a, vector double __b,
6466                                           vector bool long long __c) {
6467   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6468                      ((vector long long)__b & (vector long long)__c);
6469   return (vector double)__res;
6470 }
6471
6472 static vector double __ATTRS_o_ai vec_sel(vector double __a, vector double __b,
6473                                           vector unsigned long long __c) {
6474   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6475                      ((vector long long)__b & (vector long long)__c);
6476   return (vector double)__res;
6477 }
6478 #endif
6479
6480 /* vec_vsel */
6481
6482 static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
6483                                                 vector signed char __b,
6484                                                 vector unsigned char __c) {
6485   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6486 }
6487
6488 static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
6489                                                 vector signed char __b,
6490                                                 vector bool char __c) {
6491   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6492 }
6493
6494 static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
6495                                                   vector unsigned char __b,
6496                                                   vector unsigned char __c) {
6497   return (__a & ~__c) | (__b & __c);
6498 }
6499
6500 static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
6501                                                   vector unsigned char __b,
6502                                                   vector bool char __c) {
6503   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6504 }
6505
6506 static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6507                                               vector bool char __b,
6508                                               vector unsigned char __c) {
6509   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6510 }
6511
6512 static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6513                                               vector bool char __b,
6514                                               vector bool char __c) {
6515   return (__a & ~__c) | (__b & __c);
6516 }
6517
6518 static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
6519                                           vector unsigned short __c) {
6520   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6521 }
6522
6523 static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
6524                                           vector bool short __c) {
6525   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6526 }
6527
6528 static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
6529                                                    vector unsigned short __b,
6530                                                    vector unsigned short __c) {
6531   return (__a & ~__c) | (__b & __c);
6532 }
6533
6534 static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
6535                                                    vector unsigned short __b,
6536                                                    vector bool short __c) {
6537   return (__a & ~(vector unsigned short)__c) |
6538          (__b & (vector unsigned short)__c);
6539 }
6540
6541 static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
6542                                                vector bool short __b,
6543                                                vector unsigned short __c) {
6544   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6545 }
6546
6547 static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
6548                                                vector bool short __b,
6549                                                vector bool short __c) {
6550   return (__a & ~__c) | (__b & __c);
6551 }
6552
6553 static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
6554                                         vector unsigned int __c) {
6555   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6556 }
6557
6558 static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
6559                                         vector bool int __c) {
6560   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6561 }
6562
6563 static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
6564                                                  vector unsigned int __b,
6565                                                  vector unsigned int __c) {
6566   return (__a & ~__c) | (__b & __c);
6567 }
6568
6569 static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
6570                                                  vector unsigned int __b,
6571                                                  vector bool int __c) {
6572   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6573 }
6574
6575 static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6576                                              vector bool int __b,
6577                                              vector unsigned int __c) {
6578   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6579 }
6580
6581 static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6582                                              vector bool int __b,
6583                                              vector bool int __c) {
6584   return (__a & ~__c) | (__b & __c);
6585 }
6586
6587 static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
6588                                           vector unsigned int __c) {
6589   vector int __res = ((vector int)__a & ~(vector int)__c) |
6590                      ((vector int)__b & (vector int)__c);
6591   return (vector float)__res;
6592 }
6593
6594 static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
6595                                           vector bool int __c) {
6596   vector int __res = ((vector int)__a & ~(vector int)__c) |
6597                      ((vector int)__b & (vector int)__c);
6598   return (vector float)__res;
6599 }
6600
6601 /* vec_sl */
6602
6603 static vector signed char __ATTRS_o_ai vec_sl(vector signed char __a,
6604                                               vector unsigned char __b) {
6605   return __a << (vector signed char)__b;
6606 }
6607
6608 static vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a,
6609                                                 vector unsigned char __b) {
6610   return __a << __b;
6611 }
6612
6613 static vector short __ATTRS_o_ai vec_sl(vector short __a,
6614                                         vector unsigned short __b) {
6615   return __a << (vector short)__b;
6616 }
6617
6618 static vector unsigned short __ATTRS_o_ai vec_sl(vector unsigned short __a,
6619                                                  vector unsigned short __b) {
6620   return __a << __b;
6621 }
6622
6623 static vector int __ATTRS_o_ai vec_sl(vector int __a, vector unsigned int __b) {
6624   return __a << (vector int)__b;
6625 }
6626
6627 static vector unsigned int __ATTRS_o_ai vec_sl(vector unsigned int __a,
6628                                                vector unsigned int __b) {
6629   return __a << __b;
6630 }
6631
6632 #ifdef __POWER8_VECTOR__
6633 static vector signed long long __ATTRS_o_ai
6634 vec_sl(vector signed long long __a, vector unsigned long long __b) {
6635   return __a << (vector long long)__b;
6636 }
6637
6638 static vector unsigned long long __ATTRS_o_ai
6639 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
6640   return __a << __b;
6641 }
6642 #endif
6643
6644 /* vec_vslb */
6645
6646 #define __builtin_altivec_vslb vec_vslb
6647
6648 static vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a,
6649                                                 vector unsigned char __b) {
6650   return vec_sl(__a, __b);
6651 }
6652
6653 static vector unsigned char __ATTRS_o_ai vec_vslb(vector unsigned char __a,
6654                                                   vector unsigned char __b) {
6655   return vec_sl(__a, __b);
6656 }
6657
6658 /* vec_vslh */
6659
6660 #define __builtin_altivec_vslh vec_vslh
6661
6662 static vector short __ATTRS_o_ai vec_vslh(vector short __a,
6663                                           vector unsigned short __b) {
6664   return vec_sl(__a, __b);
6665 }
6666
6667 static vector unsigned short __ATTRS_o_ai vec_vslh(vector unsigned short __a,
6668                                                    vector unsigned short __b) {
6669   return vec_sl(__a, __b);
6670 }
6671
6672 /* vec_vslw */
6673
6674 #define __builtin_altivec_vslw vec_vslw
6675
6676 static vector int __ATTRS_o_ai vec_vslw(vector int __a,
6677                                         vector unsigned int __b) {
6678   return vec_sl(__a, __b);
6679 }
6680
6681 static vector unsigned int __ATTRS_o_ai vec_vslw(vector unsigned int __a,
6682                                                  vector unsigned int __b) {
6683   return vec_sl(__a, __b);
6684 }
6685
6686 /* vec_sld */
6687
6688 #define __builtin_altivec_vsldoi_4si vec_sld
6689
6690 static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
6691                                                vector signed char __b,
6692                                                unsigned const int __c) {
6693   unsigned char __d = __c & 0x0F;
6694 #ifdef __LITTLE_ENDIAN__
6695   return vec_perm(
6696       __b, __a,
6697       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6698                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6699                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6700                              31 - __d));
6701 #else
6702   return vec_perm(
6703       __a, __b,
6704       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6705                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6706                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6707 #endif
6708 }
6709
6710 static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
6711                                                  vector unsigned char __b,
6712                                                  unsigned const int __c) {
6713   unsigned char __d = __c & 0x0F;
6714 #ifdef __LITTLE_ENDIAN__
6715   return vec_perm(
6716       __b, __a,
6717       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6718                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6719                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6720                              31 - __d));
6721 #else
6722   return vec_perm(
6723       __a, __b,
6724       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6725                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6726                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6727 #endif
6728 }
6729
6730 static vector bool char __ATTRS_o_ai vec_sld(vector bool char __a,
6731                                              vector bool char __b,
6732                                              unsigned const int __c) {
6733   unsigned char __d = __c & 0x0F;
6734 #ifdef __LITTLE_ENDIAN__
6735   return vec_perm(
6736       __b, __a,
6737       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6738                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6739                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6740                              31 - __d));
6741 #else
6742   return vec_perm(
6743       __a, __b,
6744       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6745                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6746                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6747 #endif
6748 }
6749
6750 static vector signed short __ATTRS_o_ai vec_sld(vector signed short __a,
6751                                                 vector signed short __b,
6752                                                 unsigned const int __c) {
6753   unsigned char __d = __c & 0x0F;
6754 #ifdef __LITTLE_ENDIAN__
6755   return vec_perm(
6756       __b, __a,
6757       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6758                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6759                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6760                              31 - __d));
6761 #else
6762   return vec_perm(
6763       __a, __b,
6764       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6765                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6766                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6767 #endif
6768 }
6769
6770 static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
6771                                                   vector unsigned short __b,
6772                                                   unsigned const int __c) {
6773   unsigned char __d = __c & 0x0F;
6774 #ifdef __LITTLE_ENDIAN__
6775   return vec_perm(
6776       __b, __a,
6777       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6778                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6779                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6780                              31 - __d));
6781 #else
6782   return vec_perm(
6783       __a, __b,
6784       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6785                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6786                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6787 #endif
6788 }
6789
6790 static vector bool short __ATTRS_o_ai vec_sld(vector bool short __a,
6791                                               vector bool short __b,
6792                                               unsigned const int __c) {
6793   unsigned char __d = __c & 0x0F;
6794 #ifdef __LITTLE_ENDIAN__
6795   return vec_perm(
6796       __b, __a,
6797       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6798                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6799                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6800                              31 - __d));
6801 #else
6802   return vec_perm(
6803       __a, __b,
6804       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6805                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6806                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6807 #endif
6808 }
6809
6810 static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
6811                                          unsigned const int __c) {
6812   unsigned char __d = __c & 0x0F;
6813 #ifdef __LITTLE_ENDIAN__
6814   return vec_perm(
6815       __b, __a,
6816       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6817                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6818                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6819                              31 - __d));
6820 #else
6821   return vec_perm(
6822       __a, __b,
6823       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6824                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6825                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6826 #endif
6827 }
6828
6829 static vector signed int __ATTRS_o_ai vec_sld(vector signed int __a,
6830                                               vector signed int __b,
6831                                               unsigned const int __c) {
6832   unsigned char __d = __c & 0x0F;
6833 #ifdef __LITTLE_ENDIAN__
6834   return vec_perm(
6835       __b, __a,
6836       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6837                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6838                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6839                              31 - __d));
6840 #else
6841   return vec_perm(
6842       __a, __b,
6843       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6844                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6845                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6846 #endif
6847 }
6848
6849 static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
6850                                                 vector unsigned int __b,
6851                                                 unsigned const int __c) {
6852   unsigned char __d = __c & 0x0F;
6853 #ifdef __LITTLE_ENDIAN__
6854   return vec_perm(
6855       __b, __a,
6856       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6857                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6858                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6859                              31 - __d));
6860 #else
6861   return vec_perm(
6862       __a, __b,
6863       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6864                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6865                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6866 #endif
6867 }
6868
6869 static vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
6870                                             vector bool int __b,
6871                                             unsigned const int __c) {
6872   unsigned char __d = __c & 0x0F;
6873 #ifdef __LITTLE_ENDIAN__
6874   return vec_perm(
6875       __b, __a,
6876       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6877                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6878                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6879                              31 - __d));
6880 #else
6881   return vec_perm(
6882       __a, __b,
6883       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6884                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6885                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6886 #endif
6887 }
6888
6889 static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
6890                                          unsigned const int __c) {
6891   unsigned char __d = __c & 0x0F;
6892 #ifdef __LITTLE_ENDIAN__
6893   return vec_perm(
6894       __b, __a,
6895       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6896                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6897                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6898                              31 - __d));
6899 #else
6900   return vec_perm(
6901       __a, __b,
6902       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6903                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6904                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6905 #endif
6906 }
6907
6908 /* vec_vsldoi */
6909
6910 static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
6911                                                   vector signed char __b,
6912                                                   unsigned char __c) {
6913   unsigned char __d = __c & 0x0F;
6914 #ifdef __LITTLE_ENDIAN__
6915   return vec_perm(
6916       __b, __a,
6917       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6918                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6919                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6920                              31 - __d));
6921 #else
6922   return vec_perm(
6923       __a, __b,
6924       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6925                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6926                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6927 #endif
6928 }
6929
6930 static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
6931                                                     vector unsigned char __b,
6932                                                     unsigned char __c) {
6933   unsigned char __d = __c & 0x0F;
6934 #ifdef __LITTLE_ENDIAN__
6935   return vec_perm(
6936       __b, __a,
6937       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6938                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6939                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6940                              31 - __d));
6941 #else
6942   return vec_perm(
6943       __a, __b,
6944       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6945                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6946                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6947 #endif
6948 }
6949
6950 static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
6951                                             unsigned char __c) {
6952   unsigned char __d = __c & 0x0F;
6953 #ifdef __LITTLE_ENDIAN__
6954   return vec_perm(
6955       __b, __a,
6956       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6957                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6958                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6959                              31 - __d));
6960 #else
6961   return vec_perm(
6962       __a, __b,
6963       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6964                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6965                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6966 #endif
6967 }
6968
6969 static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
6970                                                      vector unsigned short __b,
6971                                                      unsigned char __c) {
6972   unsigned char __d = __c & 0x0F;
6973 #ifdef __LITTLE_ENDIAN__
6974   return vec_perm(
6975       __b, __a,
6976       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6977                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6978                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6979                              31 - __d));
6980 #else
6981   return vec_perm(
6982       __a, __b,
6983       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6984                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6985                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6986 #endif
6987 }
6988
6989 static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
6990                                             unsigned char __c) {
6991   unsigned char __d = __c & 0x0F;
6992 #ifdef __LITTLE_ENDIAN__
6993   return vec_perm(
6994       __b, __a,
6995       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6996                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6997                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6998                              31 - __d));
6999 #else
7000   return vec_perm(
7001       __a, __b,
7002       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7003                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7004                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7005 #endif
7006 }
7007
7008 static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
7009                                           unsigned char __c) {
7010   unsigned char __d = __c & 0x0F;
7011 #ifdef __LITTLE_ENDIAN__
7012   return vec_perm(
7013       __b, __a,
7014       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
7015                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
7016                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
7017                              31 - __d));
7018 #else
7019   return vec_perm(
7020       __a, __b,
7021       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7022                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7023                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7024 #endif
7025 }
7026
7027 static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
7028                                                    vector unsigned int __b,
7029                                                    unsigned char __c) {
7030   unsigned char __d = __c & 0x0F;
7031 #ifdef __LITTLE_ENDIAN__
7032   return vec_perm(
7033       __b, __a,
7034       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
7035                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
7036                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
7037                              31 - __d));
7038 #else
7039   return vec_perm(
7040       __a, __b,
7041       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7042                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7043                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7044 #endif
7045 }
7046
7047 static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
7048                                             unsigned char __c) {
7049   unsigned char __d = __c & 0x0F;
7050 #ifdef __LITTLE_ENDIAN__
7051   return vec_perm(
7052       __b, __a,
7053       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
7054                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
7055                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
7056                              31 - __d));
7057 #else
7058   return vec_perm(
7059       __a, __b,
7060       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7061                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7062                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7063 #endif
7064 }
7065
7066 /* vec_sll */
7067
7068 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7069                                                vector unsigned char __b) {
7070   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7071                                                    (vector int)__b);
7072 }
7073
7074 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7075                                                vector unsigned short __b) {
7076   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7077                                                    (vector int)__b);
7078 }
7079
7080 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7081                                                vector unsigned int __b) {
7082   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7083                                                    (vector int)__b);
7084 }
7085
7086 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7087                                                  vector unsigned char __b) {
7088   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7089                                                      (vector int)__b);
7090 }
7091
7092 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7093                                                  vector unsigned short __b) {
7094   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7095                                                      (vector int)__b);
7096 }
7097
7098 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7099                                                  vector unsigned int __b) {
7100   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7101                                                      (vector int)__b);
7102 }
7103
7104 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7105                                              vector unsigned char __b) {
7106   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7107                                                  (vector int)__b);
7108 }
7109
7110 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7111                                              vector unsigned short __b) {
7112   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7113                                                  (vector int)__b);
7114 }
7115
7116 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7117                                              vector unsigned int __b) {
7118   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7119                                                  (vector int)__b);
7120 }
7121
7122 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7123                                          vector unsigned char __b) {
7124   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7125 }
7126
7127 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7128                                          vector unsigned short __b) {
7129   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7130 }
7131
7132 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7133                                          vector unsigned int __b) {
7134   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7135 }
7136
7137 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7138                                                   vector unsigned char __b) {
7139   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7140                                                       (vector int)__b);
7141 }
7142
7143 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7144                                                   vector unsigned short __b) {
7145   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7146                                                       (vector int)__b);
7147 }
7148
7149 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7150                                                   vector unsigned int __b) {
7151   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7152                                                       (vector int)__b);
7153 }
7154
7155 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7156                                               vector unsigned char __b) {
7157   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7158                                                   (vector int)__b);
7159 }
7160
7161 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7162                                               vector unsigned short __b) {
7163   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7164                                                   (vector int)__b);
7165 }
7166
7167 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7168                                               vector unsigned int __b) {
7169   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7170                                                   (vector int)__b);
7171 }
7172
7173 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7174                                          vector unsigned char __b) {
7175   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7176 }
7177
7178 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7179                                          vector unsigned short __b) {
7180   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7181 }
7182
7183 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7184                                          vector unsigned int __b) {
7185   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7186 }
7187
7188 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7189                                        vector unsigned char __b) {
7190   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7191 }
7192
7193 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7194                                        vector unsigned short __b) {
7195   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7196 }
7197
7198 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7199                                        vector unsigned int __b) {
7200   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7201 }
7202
7203 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7204                                                 vector unsigned char __b) {
7205   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7206                                                     (vector int)__b);
7207 }
7208
7209 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7210                                                 vector unsigned short __b) {
7211   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7212                                                     (vector int)__b);
7213 }
7214
7215 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7216                                                 vector unsigned int __b) {
7217   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7218                                                     (vector int)__b);
7219 }
7220
7221 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7222                                             vector unsigned char __b) {
7223   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7224                                                 (vector int)__b);
7225 }
7226
7227 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7228                                             vector unsigned short __b) {
7229   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7230                                                 (vector int)__b);
7231 }
7232
7233 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7234                                             vector unsigned int __b) {
7235   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7236                                                 (vector int)__b);
7237 }
7238
7239 /* vec_vsl */
7240
7241 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7242                                                vector unsigned char __b) {
7243   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7244                                                    (vector int)__b);
7245 }
7246
7247 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7248                                                vector unsigned short __b) {
7249   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7250                                                    (vector int)__b);
7251 }
7252
7253 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7254                                                vector unsigned int __b) {
7255   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7256                                                    (vector int)__b);
7257 }
7258
7259 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7260                                                  vector unsigned char __b) {
7261   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7262                                                      (vector int)__b);
7263 }
7264
7265 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7266                                                  vector unsigned short __b) {
7267   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7268                                                      (vector int)__b);
7269 }
7270
7271 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7272                                                  vector unsigned int __b) {
7273   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7274                                                      (vector int)__b);
7275 }
7276
7277 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7278                                              vector unsigned char __b) {
7279   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7280                                                  (vector int)__b);
7281 }
7282
7283 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7284                                              vector unsigned short __b) {
7285   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7286                                                  (vector int)__b);
7287 }
7288
7289 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7290                                              vector unsigned int __b) {
7291   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7292                                                  (vector int)__b);
7293 }
7294
7295 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7296                                          vector unsigned char __b) {
7297   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7298 }
7299
7300 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7301                                          vector unsigned short __b) {
7302   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7303 }
7304
7305 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7306                                          vector unsigned int __b) {
7307   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7308 }
7309
7310 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7311                                                   vector unsigned char __b) {
7312   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7313                                                       (vector int)__b);
7314 }
7315
7316 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7317                                                   vector unsigned short __b) {
7318   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7319                                                       (vector int)__b);
7320 }
7321
7322 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7323                                                   vector unsigned int __b) {
7324   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7325                                                       (vector int)__b);
7326 }
7327
7328 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7329                                               vector unsigned char __b) {
7330   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7331                                                   (vector int)__b);
7332 }
7333
7334 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7335                                               vector unsigned short __b) {
7336   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7337                                                   (vector int)__b);
7338 }
7339
7340 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7341                                               vector unsigned int __b) {
7342   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7343                                                   (vector int)__b);
7344 }
7345
7346 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7347                                          vector unsigned char __b) {
7348   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7349 }
7350
7351 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7352                                          vector unsigned short __b) {
7353   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7354 }
7355
7356 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7357                                          vector unsigned int __b) {
7358   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7359 }
7360
7361 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7362                                        vector unsigned char __b) {
7363   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7364 }
7365
7366 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7367                                        vector unsigned short __b) {
7368   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7369 }
7370
7371 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7372                                        vector unsigned int __b) {
7373   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7374 }
7375
7376 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7377                                                 vector unsigned char __b) {
7378   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7379                                                     (vector int)__b);
7380 }
7381
7382 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7383                                                 vector unsigned short __b) {
7384   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7385                                                     (vector int)__b);
7386 }
7387
7388 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7389                                                 vector unsigned int __b) {
7390   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7391                                                     (vector int)__b);
7392 }
7393
7394 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7395                                             vector unsigned char __b) {
7396   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7397                                                 (vector int)__b);
7398 }
7399
7400 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7401                                             vector unsigned short __b) {
7402   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7403                                                 (vector int)__b);
7404 }
7405
7406 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7407                                             vector unsigned int __b) {
7408   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7409                                                 (vector int)__b);
7410 }
7411
7412 /* vec_slo */
7413
7414 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7415                                                vector signed char __b) {
7416   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7417                                                     (vector int)__b);
7418 }
7419
7420 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7421                                                vector unsigned char __b) {
7422   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7423                                                     (vector int)__b);
7424 }
7425
7426 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7427                                                  vector signed char __b) {
7428   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7429                                                       (vector int)__b);
7430 }
7431
7432 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7433                                                  vector unsigned char __b) {
7434   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7435                                                       (vector int)__b);
7436 }
7437
7438 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7439                                          vector signed char __b) {
7440   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7441 }
7442
7443 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7444                                          vector unsigned char __b) {
7445   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7446 }
7447
7448 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7449                                                   vector signed char __b) {
7450   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7451                                                        (vector int)__b);
7452 }
7453
7454 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7455                                                   vector unsigned char __b) {
7456   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7457                                                        (vector int)__b);
7458 }
7459
7460 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7461                                          vector signed char __b) {
7462   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7463 }
7464
7465 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7466                                          vector unsigned char __b) {
7467   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7468 }
7469
7470 static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
7471   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7472 }
7473
7474 static vector int __ATTRS_o_ai vec_slo(vector int __a,
7475                                        vector unsigned char __b) {
7476   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7477 }
7478
7479 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7480                                                 vector signed char __b) {
7481   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7482                                                      (vector int)__b);
7483 }
7484
7485 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7486                                                 vector unsigned char __b) {
7487   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7488                                                      (vector int)__b);
7489 }
7490
7491 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7492                                          vector signed char __b) {
7493   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7494 }
7495
7496 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7497                                          vector unsigned char __b) {
7498   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7499 }
7500
7501 /* vec_vslo */
7502
7503 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7504                                                 vector signed char __b) {
7505   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7506                                                     (vector int)__b);
7507 }
7508
7509 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7510                                                 vector unsigned char __b) {
7511   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7512                                                     (vector int)__b);
7513 }
7514
7515 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7516                                                   vector signed char __b) {
7517   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7518                                                       (vector int)__b);
7519 }
7520
7521 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7522                                                   vector unsigned char __b) {
7523   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7524                                                       (vector int)__b);
7525 }
7526
7527 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7528                                           vector signed char __b) {
7529   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7530 }
7531
7532 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7533                                           vector unsigned char __b) {
7534   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7535 }
7536
7537 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7538                                                    vector signed char __b) {
7539   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7540                                                        (vector int)__b);
7541 }
7542
7543 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7544                                                    vector unsigned char __b) {
7545   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7546                                                        (vector int)__b);
7547 }
7548
7549 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7550                                           vector signed char __b) {
7551   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7552 }
7553
7554 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7555                                           vector unsigned char __b) {
7556   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7557 }
7558
7559 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7560                                         vector signed char __b) {
7561   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7562 }
7563
7564 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7565                                         vector unsigned char __b) {
7566   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7567 }
7568
7569 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7570                                                  vector signed char __b) {
7571   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7572                                                      (vector int)__b);
7573 }
7574
7575 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7576                                                  vector unsigned char __b) {
7577   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7578                                                      (vector int)__b);
7579 }
7580
7581 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7582                                           vector signed char __b) {
7583   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7584 }
7585
7586 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7587                                           vector unsigned char __b) {
7588   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7589 }
7590
7591 /* vec_splat */
7592
7593 static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
7594                                                  unsigned const int __b) {
7595   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7596 }
7597
7598 static vector unsigned char __ATTRS_o_ai vec_splat(vector unsigned char __a,
7599                                                    unsigned const int __b) {
7600   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7601 }
7602
7603 static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
7604                                                unsigned const int __b) {
7605   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7606 }
7607
7608 static vector signed short __ATTRS_o_ai vec_splat(vector signed short __a,
7609                                                   unsigned const int __b) {
7610   unsigned char b0 = (__b & 0x07) * 2;
7611   unsigned char b1 = b0 + 1;
7612   return vec_perm(__a, __a,
7613                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7614                                          b0, b1, b0, b1, b0, b1, b0, b1));
7615 }
7616
7617 static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
7618                                                     unsigned const int __b) {
7619   unsigned char b0 = (__b & 0x07) * 2;
7620   unsigned char b1 = b0 + 1;
7621   return vec_perm(__a, __a,
7622                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7623                                          b0, b1, b0, b1, b0, b1, b0, b1));
7624 }
7625
7626 static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
7627                                                 unsigned const int __b) {
7628   unsigned char b0 = (__b & 0x07) * 2;
7629   unsigned char b1 = b0 + 1;
7630   return vec_perm(__a, __a,
7631                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7632                                          b0, b1, b0, b1, b0, b1, b0, b1));
7633 }
7634
7635 static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
7636                                            unsigned const int __b) {
7637   unsigned char b0 = (__b & 0x07) * 2;
7638   unsigned char b1 = b0 + 1;
7639   return vec_perm(__a, __a,
7640                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7641                                          b0, b1, b0, b1, b0, b1, b0, b1));
7642 }
7643
7644 static vector signed int __ATTRS_o_ai vec_splat(vector signed int __a,
7645                                                 unsigned const int __b) {
7646   unsigned char b0 = (__b & 0x03) * 4;
7647   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7648   return vec_perm(__a, __a,
7649                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7650                                          b1, b2, b3, b0, b1, b2, b3));
7651 }
7652
7653 static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
7654                                                   unsigned const int __b) {
7655   unsigned char b0 = (__b & 0x03) * 4;
7656   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7657   return vec_perm(__a, __a,
7658                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7659                                          b1, b2, b3, b0, b1, b2, b3));
7660 }
7661
7662 static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
7663                                               unsigned const int __b) {
7664   unsigned char b0 = (__b & 0x03) * 4;
7665   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7666   return vec_perm(__a, __a,
7667                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7668                                          b1, b2, b3, b0, b1, b2, b3));
7669 }
7670
7671 static vector float __ATTRS_o_ai vec_splat(vector float __a,
7672                                            unsigned const int __b) {
7673   unsigned char b0 = (__b & 0x03) * 4;
7674   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7675   return vec_perm(__a, __a,
7676                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7677                                          b1, b2, b3, b0, b1, b2, b3));
7678 }
7679
7680 #ifdef __VSX__
7681 static vector double __ATTRS_o_ai vec_splat(vector double __a,
7682                                             unsigned const int __b) {
7683   unsigned char b0 = (__b & 0x01) * 8;
7684   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7685                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7686   return vec_perm(__a, __a,
7687                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7688                                          b0, b1, b2, b3, b4, b5, b6, b7));
7689 }
7690 static vector bool long long __ATTRS_o_ai vec_splat(vector bool long long __a,
7691                                                     unsigned const int __b) {
7692   unsigned char b0 = (__b & 0x01) * 8;
7693   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7694                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7695   return vec_perm(__a, __a,
7696                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7697                                          b0, b1, b2, b3, b4, b5, b6, b7));
7698 }
7699 static vector signed long long __ATTRS_o_ai
7700 vec_splat(vector signed long long __a, unsigned const int __b) {
7701   unsigned char b0 = (__b & 0x01) * 8;
7702   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7703                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7704   return vec_perm(__a, __a,
7705                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7706                                          b0, b1, b2, b3, b4, b5, b6, b7));
7707 }
7708 static vector unsigned long long __ATTRS_o_ai
7709 vec_splat(vector unsigned long long __a, unsigned const int __b) {
7710   unsigned char b0 = (__b & 0x01) * 8;
7711   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7712                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7713   return vec_perm(__a, __a,
7714                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7715                                          b0, b1, b2, b3, b4, b5, b6, b7));
7716 }
7717 #endif
7718
7719 /* vec_vspltb */
7720
7721 #define __builtin_altivec_vspltb vec_vspltb
7722
7723 static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
7724                                                   unsigned char __b) {
7725   return vec_perm(__a, __a, (vector unsigned char)(__b));
7726 }
7727
7728 static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
7729                                                     unsigned char __b) {
7730   return vec_perm(__a, __a, (vector unsigned char)(__b));
7731 }
7732
7733 static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
7734                                                 unsigned char __b) {
7735   return vec_perm(__a, __a, (vector unsigned char)(__b));
7736 }
7737
7738 /* vec_vsplth */
7739
7740 #define __builtin_altivec_vsplth vec_vsplth
7741
7742 static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
7743                                             unsigned char __b) {
7744   __b *= 2;
7745   unsigned char b1 = __b + 1;
7746   return vec_perm(__a, __a,
7747                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7748                                          __b, b1, __b, b1, __b, b1, __b, b1));
7749 }
7750
7751 static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
7752                                                      unsigned char __b) {
7753   __b *= 2;
7754   unsigned char b1 = __b + 1;
7755   return vec_perm(__a, __a,
7756                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7757                                          __b, b1, __b, b1, __b, b1, __b, b1));
7758 }
7759
7760 static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
7761                                                  unsigned char __b) {
7762   __b *= 2;
7763   unsigned char b1 = __b + 1;
7764   return vec_perm(__a, __a,
7765                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7766                                          __b, b1, __b, b1, __b, b1, __b, b1));
7767 }
7768
7769 static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
7770                                             unsigned char __b) {
7771   __b *= 2;
7772   unsigned char b1 = __b + 1;
7773   return vec_perm(__a, __a,
7774                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7775                                          __b, b1, __b, b1, __b, b1, __b, b1));
7776 }
7777
7778 /* vec_vspltw */
7779
7780 #define __builtin_altivec_vspltw vec_vspltw
7781
7782 static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
7783   __b *= 4;
7784   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7785   return vec_perm(__a, __a,
7786                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7787                                          b1, b2, b3, __b, b1, b2, b3));
7788 }
7789
7790 static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
7791                                                    unsigned char __b) {
7792   __b *= 4;
7793   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7794   return vec_perm(__a, __a,
7795                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7796                                          b1, b2, b3, __b, b1, b2, b3));
7797 }
7798
7799 static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
7800                                                unsigned char __b) {
7801   __b *= 4;
7802   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7803   return vec_perm(__a, __a,
7804                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7805                                          b1, b2, b3, __b, b1, b2, b3));
7806 }
7807
7808 static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
7809                                             unsigned char __b) {
7810   __b *= 4;
7811   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7812   return vec_perm(__a, __a,
7813                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7814                                          b1, b2, b3, __b, b1, b2, b3));
7815 }
7816
7817 /* vec_splat_s8 */
7818
7819 #define __builtin_altivec_vspltisb vec_splat_s8
7820
7821 // FIXME: parameter should be treated as 5-bit signed literal
7822 static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
7823   return (vector signed char)(__a);
7824 }
7825
7826 /* vec_vspltisb */
7827
7828 // FIXME: parameter should be treated as 5-bit signed literal
7829 static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
7830   return (vector signed char)(__a);
7831 }
7832
7833 /* vec_splat_s16 */
7834
7835 #define __builtin_altivec_vspltish vec_splat_s16
7836
7837 // FIXME: parameter should be treated as 5-bit signed literal
7838 static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
7839   return (vector short)(__a);
7840 }
7841
7842 /* vec_vspltish */
7843
7844 // FIXME: parameter should be treated as 5-bit signed literal
7845 static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
7846   return (vector short)(__a);
7847 }
7848
7849 /* vec_splat_s32 */
7850
7851 #define __builtin_altivec_vspltisw vec_splat_s32
7852
7853 // FIXME: parameter should be treated as 5-bit signed literal
7854 static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
7855   return (vector int)(__a);
7856 }
7857
7858 /* vec_vspltisw */
7859
7860 // FIXME: parameter should be treated as 5-bit signed literal
7861 static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
7862   return (vector int)(__a);
7863 }
7864
7865 /* vec_splat_u8 */
7866
7867 // FIXME: parameter should be treated as 5-bit signed literal
7868 static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
7869   return (vector unsigned char)(__a);
7870 }
7871
7872 /* vec_splat_u16 */
7873
7874 // FIXME: parameter should be treated as 5-bit signed literal
7875 static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
7876   return (vector unsigned short)(__a);
7877 }
7878
7879 /* vec_splat_u32 */
7880
7881 // FIXME: parameter should be treated as 5-bit signed literal
7882 static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
7883   return (vector unsigned int)(__a);
7884 }
7885
7886 /* vec_sr */
7887
7888 static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
7889                                               vector unsigned char __b) {
7890   vector unsigned char __res = (vector unsigned char)__a >> __b;
7891   return (vector signed char)__res;
7892 }
7893
7894 static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
7895                                                 vector unsigned char __b) {
7896   return __a >> __b;
7897 }
7898
7899 static vector signed short __ATTRS_o_ai vec_sr(vector signed short __a,
7900                                         vector unsigned short __b) {
7901   vector unsigned short __res = (vector unsigned short)__a >> __b;
7902   return (vector signed short)__res;
7903 }
7904
7905 static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
7906                                                  vector unsigned short __b) {
7907   return __a >> __b;
7908 }
7909
7910 static vector signed int __ATTRS_o_ai vec_sr(vector signed int __a,
7911                                              vector unsigned int __b) {
7912   vector unsigned int __res = (vector unsigned int)__a >> __b;
7913   return (vector signed int)__res;
7914 }
7915
7916 static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
7917                                                vector unsigned int __b) {
7918   return __a >> __b;
7919 }
7920
7921 #ifdef __POWER8_VECTOR__
7922 static vector signed long long __ATTRS_o_ai
7923 vec_sr(vector signed long long __a, vector unsigned long long __b) {
7924   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
7925   return (vector signed long long)__res;
7926 }
7927
7928 static vector unsigned long long __ATTRS_o_ai
7929 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
7930   return __a >> __b;
7931 }
7932 #endif
7933
7934 /* vec_vsrb */
7935
7936 #define __builtin_altivec_vsrb vec_vsrb
7937
7938 static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
7939                                                 vector unsigned char __b) {
7940   return __a >> (vector signed char)__b;
7941 }
7942
7943 static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
7944                                                   vector unsigned char __b) {
7945   return __a >> __b;
7946 }
7947
7948 /* vec_vsrh */
7949
7950 #define __builtin_altivec_vsrh vec_vsrh
7951
7952 static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
7953                                           vector unsigned short __b) {
7954   return __a >> (vector short)__b;
7955 }
7956
7957 static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
7958                                                    vector unsigned short __b) {
7959   return __a >> __b;
7960 }
7961
7962 /* vec_vsrw */
7963
7964 #define __builtin_altivec_vsrw vec_vsrw
7965
7966 static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
7967                                         vector unsigned int __b) {
7968   return __a >> (vector int)__b;
7969 }
7970
7971 static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
7972                                                  vector unsigned int __b) {
7973   return __a >> __b;
7974 }
7975
7976 /* vec_sra */
7977
7978 static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
7979                                                vector unsigned char __b) {
7980   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
7981 }
7982
7983 static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
7984                                                  vector unsigned char __b) {
7985   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
7986 }
7987
7988 static vector short __ATTRS_o_ai vec_sra(vector short __a,
7989                                          vector unsigned short __b) {
7990   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
7991 }
7992
7993 static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
7994                                                   vector unsigned short __b) {
7995   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
7996 }
7997
7998 static vector int __ATTRS_o_ai vec_sra(vector int __a,
7999                                        vector unsigned int __b) {
8000   return __builtin_altivec_vsraw(__a, __b);
8001 }
8002
8003 static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
8004                                                 vector unsigned int __b) {
8005   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8006 }
8007
8008 #ifdef __POWER8_VECTOR__
8009 static vector signed long long __ATTRS_o_ai
8010 vec_sra(vector signed long long __a, vector unsigned long long __b) {
8011   return __a >> __b;
8012 }
8013
8014 static vector unsigned long long __ATTRS_o_ai
8015 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
8016   return (vector unsigned long long)((vector signed long long)__a >> __b);
8017 }
8018 #endif
8019
8020 /* vec_vsrab */
8021
8022 static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
8023                                                  vector unsigned char __b) {
8024   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
8025 }
8026
8027 static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
8028                                                    vector unsigned char __b) {
8029   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8030 }
8031
8032 /* vec_vsrah */
8033
8034 static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
8035                                            vector unsigned short __b) {
8036   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8037 }
8038
8039 static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
8040                                                     vector unsigned short __b) {
8041   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8042 }
8043
8044 /* vec_vsraw */
8045
8046 static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
8047                                          vector unsigned int __b) {
8048   return __builtin_altivec_vsraw(__a, __b);
8049 }
8050
8051 static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
8052                                                   vector unsigned int __b) {
8053   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8054 }
8055
8056 /* vec_srl */
8057
8058 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8059                                                vector unsigned char __b) {
8060   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8061                                                    (vector int)__b);
8062 }
8063
8064 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8065                                                vector unsigned short __b) {
8066   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8067                                                    (vector int)__b);
8068 }
8069
8070 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8071                                                vector unsigned int __b) {
8072   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8073                                                    (vector int)__b);
8074 }
8075
8076 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8077                                                  vector unsigned char __b) {
8078   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8079                                                      (vector int)__b);
8080 }
8081
8082 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8083                                                  vector unsigned short __b) {
8084   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8085                                                      (vector int)__b);
8086 }
8087
8088 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8089                                                  vector unsigned int __b) {
8090   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8091                                                      (vector int)__b);
8092 }
8093
8094 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8095                                              vector unsigned char __b) {
8096   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8097                                                  (vector int)__b);
8098 }
8099
8100 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8101                                              vector unsigned short __b) {
8102   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8103                                                  (vector int)__b);
8104 }
8105
8106 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8107                                              vector unsigned int __b) {
8108   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8109                                                  (vector int)__b);
8110 }
8111
8112 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8113                                          vector unsigned char __b) {
8114   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8115 }
8116
8117 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8118                                          vector unsigned short __b) {
8119   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8120 }
8121
8122 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8123                                          vector unsigned int __b) {
8124   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8125 }
8126
8127 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8128                                                   vector unsigned char __b) {
8129   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8130                                                       (vector int)__b);
8131 }
8132
8133 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8134                                                   vector unsigned short __b) {
8135   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8136                                                       (vector int)__b);
8137 }
8138
8139 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8140                                                   vector unsigned int __b) {
8141   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8142                                                       (vector int)__b);
8143 }
8144
8145 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8146                                               vector unsigned char __b) {
8147   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8148                                                   (vector int)__b);
8149 }
8150
8151 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8152                                               vector unsigned short __b) {
8153   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8154                                                   (vector int)__b);
8155 }
8156
8157 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8158                                               vector unsigned int __b) {
8159   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8160                                                   (vector int)__b);
8161 }
8162
8163 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8164                                          vector unsigned char __b) {
8165   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8166 }
8167
8168 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8169                                          vector unsigned short __b) {
8170   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8171 }
8172
8173 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8174                                          vector unsigned int __b) {
8175   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8176 }
8177
8178 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8179                                        vector unsigned char __b) {
8180   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8181 }
8182
8183 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8184                                        vector unsigned short __b) {
8185   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8186 }
8187
8188 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8189                                        vector unsigned int __b) {
8190   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8191 }
8192
8193 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8194                                                 vector unsigned char __b) {
8195   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8196                                                     (vector int)__b);
8197 }
8198
8199 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8200                                                 vector unsigned short __b) {
8201   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8202                                                     (vector int)__b);
8203 }
8204
8205 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8206                                                 vector unsigned int __b) {
8207   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8208                                                     (vector int)__b);
8209 }
8210
8211 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8212                                             vector unsigned char __b) {
8213   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8214                                                 (vector int)__b);
8215 }
8216
8217 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8218                                             vector unsigned short __b) {
8219   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8220                                                 (vector int)__b);
8221 }
8222
8223 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8224                                             vector unsigned int __b) {
8225   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8226                                                 (vector int)__b);
8227 }
8228
8229 /* vec_vsr */
8230
8231 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8232                                                vector unsigned char __b) {
8233   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8234                                                    (vector int)__b);
8235 }
8236
8237 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8238                                                vector unsigned short __b) {
8239   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8240                                                    (vector int)__b);
8241 }
8242
8243 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8244                                                vector unsigned int __b) {
8245   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8246                                                    (vector int)__b);
8247 }
8248
8249 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8250                                                  vector unsigned char __b) {
8251   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8252                                                      (vector int)__b);
8253 }
8254
8255 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8256                                                  vector unsigned short __b) {
8257   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8258                                                      (vector int)__b);
8259 }
8260
8261 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8262                                                  vector unsigned int __b) {
8263   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8264                                                      (vector int)__b);
8265 }
8266
8267 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8268                                              vector unsigned char __b) {
8269   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8270                                                  (vector int)__b);
8271 }
8272
8273 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8274                                              vector unsigned short __b) {
8275   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8276                                                  (vector int)__b);
8277 }
8278
8279 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8280                                              vector unsigned int __b) {
8281   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8282                                                  (vector int)__b);
8283 }
8284
8285 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8286                                          vector unsigned char __b) {
8287   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8288 }
8289
8290 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8291                                          vector unsigned short __b) {
8292   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8293 }
8294
8295 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8296                                          vector unsigned int __b) {
8297   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8298 }
8299
8300 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8301                                                   vector unsigned char __b) {
8302   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8303                                                       (vector int)__b);
8304 }
8305
8306 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8307                                                   vector unsigned short __b) {
8308   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8309                                                       (vector int)__b);
8310 }
8311
8312 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8313                                                   vector unsigned int __b) {
8314   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8315                                                       (vector int)__b);
8316 }
8317
8318 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8319                                               vector unsigned char __b) {
8320   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8321                                                   (vector int)__b);
8322 }
8323
8324 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8325                                               vector unsigned short __b) {
8326   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8327                                                   (vector int)__b);
8328 }
8329
8330 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8331                                               vector unsigned int __b) {
8332   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8333                                                   (vector int)__b);
8334 }
8335
8336 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8337                                          vector unsigned char __b) {
8338   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8339 }
8340
8341 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8342                                          vector unsigned short __b) {
8343   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8344 }
8345
8346 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8347                                          vector unsigned int __b) {
8348   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8349 }
8350
8351 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8352                                        vector unsigned char __b) {
8353   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8354 }
8355
8356 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8357                                        vector unsigned short __b) {
8358   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8359 }
8360
8361 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8362                                        vector unsigned int __b) {
8363   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8364 }
8365
8366 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8367                                                 vector unsigned char __b) {
8368   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8369                                                     (vector int)__b);
8370 }
8371
8372 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8373                                                 vector unsigned short __b) {
8374   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8375                                                     (vector int)__b);
8376 }
8377
8378 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8379                                                 vector unsigned int __b) {
8380   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8381                                                     (vector int)__b);
8382 }
8383
8384 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8385                                             vector unsigned char __b) {
8386   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8387                                                 (vector int)__b);
8388 }
8389
8390 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8391                                             vector unsigned short __b) {
8392   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8393                                                 (vector int)__b);
8394 }
8395
8396 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8397                                             vector unsigned int __b) {
8398   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8399                                                 (vector int)__b);
8400 }
8401
8402 /* vec_sro */
8403
8404 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8405                                                vector signed char __b) {
8406   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8407                                                     (vector int)__b);
8408 }
8409
8410 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8411                                                vector unsigned char __b) {
8412   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8413                                                     (vector int)__b);
8414 }
8415
8416 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8417                                                  vector signed char __b) {
8418   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8419                                                       (vector int)__b);
8420 }
8421
8422 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8423                                                  vector unsigned char __b) {
8424   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8425                                                       (vector int)__b);
8426 }
8427
8428 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8429                                          vector signed char __b) {
8430   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8431 }
8432
8433 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8434                                          vector unsigned char __b) {
8435   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8436 }
8437
8438 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8439                                                   vector signed char __b) {
8440   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8441                                                        (vector int)__b);
8442 }
8443
8444 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8445                                                   vector unsigned char __b) {
8446   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8447                                                        (vector int)__b);
8448 }
8449
8450 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8451                                          vector signed char __b) {
8452   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8453 }
8454
8455 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8456                                          vector unsigned char __b) {
8457   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8458 }
8459
8460 static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
8461   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8462 }
8463
8464 static vector int __ATTRS_o_ai vec_sro(vector int __a,
8465                                        vector unsigned char __b) {
8466   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8467 }
8468
8469 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8470                                                 vector signed char __b) {
8471   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8472                                                      (vector int)__b);
8473 }
8474
8475 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8476                                                 vector unsigned char __b) {
8477   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8478                                                      (vector int)__b);
8479 }
8480
8481 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8482                                          vector signed char __b) {
8483   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8484 }
8485
8486 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8487                                          vector unsigned char __b) {
8488   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8489 }
8490
8491 /* vec_vsro */
8492
8493 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8494                                                 vector signed char __b) {
8495   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8496                                                     (vector int)__b);
8497 }
8498
8499 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8500                                                 vector unsigned char __b) {
8501   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8502                                                     (vector int)__b);
8503 }
8504
8505 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8506                                                   vector signed char __b) {
8507   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8508                                                       (vector int)__b);
8509 }
8510
8511 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8512                                                   vector unsigned char __b) {
8513   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8514                                                       (vector int)__b);
8515 }
8516
8517 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8518                                           vector signed char __b) {
8519   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8520 }
8521
8522 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8523                                           vector unsigned char __b) {
8524   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8525 }
8526
8527 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8528                                                    vector signed char __b) {
8529   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8530                                                        (vector int)__b);
8531 }
8532
8533 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8534                                                    vector unsigned char __b) {
8535   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8536                                                        (vector int)__b);
8537 }
8538
8539 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8540                                           vector signed char __b) {
8541   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8542 }
8543
8544 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8545                                           vector unsigned char __b) {
8546   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8547 }
8548
8549 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8550                                         vector signed char __b) {
8551   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8552 }
8553
8554 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8555                                         vector unsigned char __b) {
8556   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8557 }
8558
8559 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8560                                                  vector signed char __b) {
8561   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8562                                                      (vector int)__b);
8563 }
8564
8565 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8566                                                  vector unsigned char __b) {
8567   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8568                                                      (vector int)__b);
8569 }
8570
8571 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8572                                           vector signed char __b) {
8573   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8574 }
8575
8576 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8577                                           vector unsigned char __b) {
8578   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8579 }
8580
8581 /* vec_st */
8582
8583 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8584                                 vector signed char *__c) {
8585   __builtin_altivec_stvx((vector int)__a, __b, __c);
8586 }
8587
8588 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8589                                 signed char *__c) {
8590   __builtin_altivec_stvx((vector int)__a, __b, __c);
8591 }
8592
8593 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8594                                 vector unsigned char *__c) {
8595   __builtin_altivec_stvx((vector int)__a, __b, __c);
8596 }
8597
8598 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8599                                 unsigned char *__c) {
8600   __builtin_altivec_stvx((vector int)__a, __b, __c);
8601 }
8602
8603 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8604                                 signed char *__c) {
8605   __builtin_altivec_stvx((vector int)__a, __b, __c);
8606 }
8607
8608 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8609                                 unsigned char *__c) {
8610   __builtin_altivec_stvx((vector int)__a, __b, __c);
8611 }
8612
8613 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8614                                 vector bool char *__c) {
8615   __builtin_altivec_stvx((vector int)__a, __b, __c);
8616 }
8617
8618 static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
8619   __builtin_altivec_stvx((vector int)__a, __b, __c);
8620 }
8621
8622 static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
8623   __builtin_altivec_stvx((vector int)__a, __b, __c);
8624 }
8625
8626 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8627                                 vector unsigned short *__c) {
8628   __builtin_altivec_stvx((vector int)__a, __b, __c);
8629 }
8630
8631 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8632                                 unsigned short *__c) {
8633   __builtin_altivec_stvx((vector int)__a, __b, __c);
8634 }
8635
8636 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
8637   __builtin_altivec_stvx((vector int)__a, __b, __c);
8638 }
8639
8640 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8641                                 unsigned short *__c) {
8642   __builtin_altivec_stvx((vector int)__a, __b, __c);
8643 }
8644
8645 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8646                                 vector bool short *__c) {
8647   __builtin_altivec_stvx((vector int)__a, __b, __c);
8648 }
8649
8650 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
8651   __builtin_altivec_stvx((vector int)__a, __b, __c);
8652 }
8653
8654 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8655                                 unsigned short *__c) {
8656   __builtin_altivec_stvx((vector int)__a, __b, __c);
8657 }
8658
8659 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__c) {
8660   __builtin_altivec_stvx((vector int)__a, __b, __c);
8661 }
8662
8663 static void __ATTRS_o_ai vec_st(vector int __a, int __b, vector int *__c) {
8664   __builtin_altivec_stvx(__a, __b, __c);
8665 }
8666
8667 static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
8668   __builtin_altivec_stvx(__a, __b, __c);
8669 }
8670
8671 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8672                                 vector unsigned int *__c) {
8673   __builtin_altivec_stvx((vector int)__a, __b, __c);
8674 }
8675
8676 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8677                                 unsigned int *__c) {
8678   __builtin_altivec_stvx((vector int)__a, __b, __c);
8679 }
8680
8681 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b, int *__c) {
8682   __builtin_altivec_stvx((vector int)__a, __b, __c);
8683 }
8684
8685 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8686                                 unsigned int *__c) {
8687   __builtin_altivec_stvx((vector int)__a, __b, __c);
8688 }
8689
8690 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8691                                 vector bool int *__c) {
8692   __builtin_altivec_stvx((vector int)__a, __b, __c);
8693 }
8694
8695 static void __ATTRS_o_ai vec_st(vector float __a, int __b, vector float *__c) {
8696   __builtin_altivec_stvx((vector int)__a, __b, __c);
8697 }
8698
8699 static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
8700   __builtin_altivec_stvx((vector int)__a, __b, __c);
8701 }
8702
8703 /* vec_stvx */
8704
8705 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8706                                   vector signed char *__c) {
8707   __builtin_altivec_stvx((vector int)__a, __b, __c);
8708 }
8709
8710 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8711                                   signed char *__c) {
8712   __builtin_altivec_stvx((vector int)__a, __b, __c);
8713 }
8714
8715 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8716                                   vector unsigned char *__c) {
8717   __builtin_altivec_stvx((vector int)__a, __b, __c);
8718 }
8719
8720 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8721                                   unsigned char *__c) {
8722   __builtin_altivec_stvx((vector int)__a, __b, __c);
8723 }
8724
8725 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8726                                   signed char *__c) {
8727   __builtin_altivec_stvx((vector int)__a, __b, __c);
8728 }
8729
8730 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8731                                   unsigned char *__c) {
8732   __builtin_altivec_stvx((vector int)__a, __b, __c);
8733 }
8734
8735 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8736                                   vector bool char *__c) {
8737   __builtin_altivec_stvx((vector int)__a, __b, __c);
8738 }
8739
8740 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8741                                   vector short *__c) {
8742   __builtin_altivec_stvx((vector int)__a, __b, __c);
8743 }
8744
8745 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__c) {
8746   __builtin_altivec_stvx((vector int)__a, __b, __c);
8747 }
8748
8749 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8750                                   vector unsigned short *__c) {
8751   __builtin_altivec_stvx((vector int)__a, __b, __c);
8752 }
8753
8754 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8755                                   unsigned short *__c) {
8756   __builtin_altivec_stvx((vector int)__a, __b, __c);
8757 }
8758
8759 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, short *__c) {
8760   __builtin_altivec_stvx((vector int)__a, __b, __c);
8761 }
8762
8763 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8764                                   unsigned short *__c) {
8765   __builtin_altivec_stvx((vector int)__a, __b, __c);
8766 }
8767
8768 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8769                                   vector bool short *__c) {
8770   __builtin_altivec_stvx((vector int)__a, __b, __c);
8771 }
8772
8773 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
8774   __builtin_altivec_stvx((vector int)__a, __b, __c);
8775 }
8776
8777 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8778                                   unsigned short *__c) {
8779   __builtin_altivec_stvx((vector int)__a, __b, __c);
8780 }
8781
8782 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8783                                   vector pixel *__c) {
8784   __builtin_altivec_stvx((vector int)__a, __b, __c);
8785 }
8786
8787 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
8788   __builtin_altivec_stvx(__a, __b, __c);
8789 }
8790
8791 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
8792   __builtin_altivec_stvx(__a, __b, __c);
8793 }
8794
8795 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8796                                   vector unsigned int *__c) {
8797   __builtin_altivec_stvx((vector int)__a, __b, __c);
8798 }
8799
8800 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8801                                   unsigned int *__c) {
8802   __builtin_altivec_stvx((vector int)__a, __b, __c);
8803 }
8804
8805 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
8806   __builtin_altivec_stvx((vector int)__a, __b, __c);
8807 }
8808
8809 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8810                                   unsigned int *__c) {
8811   __builtin_altivec_stvx((vector int)__a, __b, __c);
8812 }
8813
8814 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8815                                   vector bool int *__c) {
8816   __builtin_altivec_stvx((vector int)__a, __b, __c);
8817 }
8818
8819 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8820                                   vector float *__c) {
8821   __builtin_altivec_stvx((vector int)__a, __b, __c);
8822 }
8823
8824 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
8825   __builtin_altivec_stvx((vector int)__a, __b, __c);
8826 }
8827
8828 /* vec_ste */
8829
8830 static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
8831                                  signed char *__c) {
8832   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8833 }
8834
8835 static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
8836                                  unsigned char *__c) {
8837   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8838 }
8839
8840 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8841                                  signed char *__c) {
8842   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8843 }
8844
8845 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8846                                  unsigned char *__c) {
8847   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8848 }
8849
8850 static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
8851   __builtin_altivec_stvehx(__a, __b, __c);
8852 }
8853
8854 static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
8855                                  unsigned short *__c) {
8856   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8857 }
8858
8859 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
8860   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8861 }
8862
8863 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8864                                  unsigned short *__c) {
8865   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8866 }
8867
8868 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
8869   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8870 }
8871
8872 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8873                                  unsigned short *__c) {
8874   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8875 }
8876
8877 static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
8878   __builtin_altivec_stvewx(__a, __b, __c);
8879 }
8880
8881 static void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
8882                                  unsigned int *__c) {
8883   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8884 }
8885
8886 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, int *__c) {
8887   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8888 }
8889
8890 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8891                                  unsigned int *__c) {
8892   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8893 }
8894
8895 static void __ATTRS_o_ai vec_ste(vector float __a, int __b, float *__c) {
8896   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8897 }
8898
8899 /* vec_stvebx */
8900
8901 static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
8902                                     signed char *__c) {
8903   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8904 }
8905
8906 static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
8907                                     unsigned char *__c) {
8908   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8909 }
8910
8911 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8912                                     signed char *__c) {
8913   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8914 }
8915
8916 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8917                                     unsigned char *__c) {
8918   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8919 }
8920
8921 /* vec_stvehx */
8922
8923 static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
8924   __builtin_altivec_stvehx(__a, __b, __c);
8925 }
8926
8927 static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
8928                                     unsigned short *__c) {
8929   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8930 }
8931
8932 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8933                                     short *__c) {
8934   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8935 }
8936
8937 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8938                                     unsigned short *__c) {
8939   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8940 }
8941
8942 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
8943   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8944 }
8945
8946 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
8947                                     unsigned short *__c) {
8948   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8949 }
8950
8951 /* vec_stvewx */
8952
8953 static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
8954   __builtin_altivec_stvewx(__a, __b, __c);
8955 }
8956
8957 static void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
8958                                     unsigned int *__c) {
8959   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8960 }
8961
8962 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
8963   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8964 }
8965
8966 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
8967                                     unsigned int *__c) {
8968   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8969 }
8970
8971 static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
8972   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8973 }
8974
8975 /* vec_stl */
8976
8977 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8978                                  vector signed char *__c) {
8979   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8980 }
8981
8982 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8983                                  signed char *__c) {
8984   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8985 }
8986
8987 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8988                                  vector unsigned char *__c) {
8989   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8990 }
8991
8992 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8993                                  unsigned char *__c) {
8994   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8995 }
8996
8997 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8998                                  signed char *__c) {
8999   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9000 }
9001
9002 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9003                                  unsigned char *__c) {
9004   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9005 }
9006
9007 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
9008                                  vector bool char *__c) {
9009   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9010 }
9011
9012 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
9013   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9014 }
9015
9016 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
9017   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9018 }
9019
9020 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9021                                  vector unsigned short *__c) {
9022   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9023 }
9024
9025 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
9026                                  unsigned short *__c) {
9027   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9028 }
9029
9030 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
9031   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9032 }
9033
9034 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9035                                  unsigned short *__c) {
9036   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9037 }
9038
9039 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9040                                  vector bool short *__c) {
9041   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9042 }
9043
9044 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
9045   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9046 }
9047
9048 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9049                                  unsigned short *__c) {
9050   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9051 }
9052
9053 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__c) {
9054   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9055 }
9056
9057 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, vector int *__c) {
9058   __builtin_altivec_stvxl(__a, __b, __c);
9059 }
9060
9061 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
9062   __builtin_altivec_stvxl(__a, __b, __c);
9063 }
9064
9065 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9066                                  vector unsigned int *__c) {
9067   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9068 }
9069
9070 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9071                                  unsigned int *__c) {
9072   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9073 }
9074
9075 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, int *__c) {
9076   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9077 }
9078
9079 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9080                                  unsigned int *__c) {
9081   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9082 }
9083
9084 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9085                                  vector bool int *__c) {
9086   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9087 }
9088
9089 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, vector float *__c) {
9090   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9091 }
9092
9093 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, float *__c) {
9094   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9095 }
9096
9097 /* vec_stvxl */
9098
9099 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9100                                    vector signed char *__c) {
9101   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9102 }
9103
9104 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9105                                    signed char *__c) {
9106   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9107 }
9108
9109 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9110                                    vector unsigned char *__c) {
9111   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9112 }
9113
9114 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9115                                    unsigned char *__c) {
9116   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9117 }
9118
9119 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9120                                    signed char *__c) {
9121   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9122 }
9123
9124 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9125                                    unsigned char *__c) {
9126   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9127 }
9128
9129 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9130                                    vector bool char *__c) {
9131   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9132 }
9133
9134 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9135                                    vector short *__c) {
9136   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9137 }
9138
9139 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__c) {
9140   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9141 }
9142
9143 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9144                                    vector unsigned short *__c) {
9145   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9146 }
9147
9148 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9149                                    unsigned short *__c) {
9150   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9151 }
9152
9153 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, short *__c) {
9154   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9155 }
9156
9157 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9158                                    unsigned short *__c) {
9159   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9160 }
9161
9162 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9163                                    vector bool short *__c) {
9164   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9165 }
9166
9167 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
9168   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9169 }
9170
9171 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9172                                    unsigned short *__c) {
9173   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9174 }
9175
9176 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9177                                    vector pixel *__c) {
9178   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9179 }
9180
9181 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
9182   __builtin_altivec_stvxl(__a, __b, __c);
9183 }
9184
9185 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
9186   __builtin_altivec_stvxl(__a, __b, __c);
9187 }
9188
9189 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9190                                    vector unsigned int *__c) {
9191   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9192 }
9193
9194 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9195                                    unsigned int *__c) {
9196   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9197 }
9198
9199 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
9200   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9201 }
9202
9203 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9204                                    unsigned int *__c) {
9205   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9206 }
9207
9208 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9209                                    vector bool int *__c) {
9210   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9211 }
9212
9213 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9214                                    vector float *__c) {
9215   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9216 }
9217
9218 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
9219   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9220 }
9221
9222 /* vec_sub */
9223
9224 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9225                                                vector signed char __b) {
9226   return __a - __b;
9227 }
9228
9229 static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
9230                                                vector signed char __b) {
9231   return (vector signed char)__a - __b;
9232 }
9233
9234 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9235                                                vector bool char __b) {
9236   return __a - (vector signed char)__b;
9237 }
9238
9239 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9240                                                  vector unsigned char __b) {
9241   return __a - __b;
9242 }
9243
9244 static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
9245                                                  vector unsigned char __b) {
9246   return (vector unsigned char)__a - __b;
9247 }
9248
9249 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9250                                                  vector bool char __b) {
9251   return __a - (vector unsigned char)__b;
9252 }
9253
9254 static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
9255   return __a - __b;
9256 }
9257
9258 static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
9259                                          vector short __b) {
9260   return (vector short)__a - __b;
9261 }
9262
9263 static vector short __ATTRS_o_ai vec_sub(vector short __a,
9264                                          vector bool short __b) {
9265   return __a - (vector short)__b;
9266 }
9267
9268 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9269                                                   vector unsigned short __b) {
9270   return __a - __b;
9271 }
9272
9273 static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
9274                                                   vector unsigned short __b) {
9275   return (vector unsigned short)__a - __b;
9276 }
9277
9278 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9279                                                   vector bool short __b) {
9280   return __a - (vector unsigned short)__b;
9281 }
9282
9283 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
9284   return __a - __b;
9285 }
9286
9287 static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
9288   return (vector int)__a - __b;
9289 }
9290
9291 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
9292   return __a - (vector int)__b;
9293 }
9294
9295 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9296                                                 vector unsigned int __b) {
9297   return __a - __b;
9298 }
9299
9300 static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
9301                                                 vector unsigned int __b) {
9302   return (vector unsigned int)__a - __b;
9303 }
9304
9305 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9306                                                 vector bool int __b) {
9307   return __a - (vector unsigned int)__b;
9308 }
9309
9310 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9311 static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
9312                                                    vector signed __int128 __b) {
9313   return __a - __b;
9314 }
9315
9316 static vector unsigned __int128 __ATTRS_o_ai
9317 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9318   return __a - __b;
9319 }
9320 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9321
9322 #ifdef __VSX__
9323 static vector signed long long __ATTRS_o_ai
9324 vec_sub(vector signed long long __a, vector signed long long __b) {
9325   return __a - __b;
9326 }
9327
9328 static vector unsigned long long __ATTRS_o_ai
9329 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
9330   return __a - __b;
9331 }
9332
9333 static vector double __ATTRS_o_ai
9334 vec_sub(vector double __a, vector double __b) {
9335   return __a - __b;
9336 }
9337 #endif
9338
9339 static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
9340   return __a - __b;
9341 }
9342
9343 /* vec_vsububm */
9344
9345 #define __builtin_altivec_vsububm vec_vsububm
9346
9347 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9348                                                    vector signed char __b) {
9349   return __a - __b;
9350 }
9351
9352 static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9353                                                    vector signed char __b) {
9354   return (vector signed char)__a - __b;
9355 }
9356
9357 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9358                                                    vector bool char __b) {
9359   return __a - (vector signed char)__b;
9360 }
9361
9362 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9363                                                      vector unsigned char __b) {
9364   return __a - __b;
9365 }
9366
9367 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9368                                                      vector unsigned char __b) {
9369   return (vector unsigned char)__a - __b;
9370 }
9371
9372 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9373                                                      vector bool char __b) {
9374   return __a - (vector unsigned char)__b;
9375 }
9376
9377 /* vec_vsubuhm */
9378
9379 #define __builtin_altivec_vsubuhm vec_vsubuhm
9380
9381 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9382                                              vector short __b) {
9383   return __a - __b;
9384 }
9385
9386 static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
9387                                              vector short __b) {
9388   return (vector short)__a - __b;
9389 }
9390
9391 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9392                                              vector bool short __b) {
9393   return __a - (vector short)__b;
9394 }
9395
9396 static vector unsigned short __ATTRS_o_ai
9397 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
9398   return __a - __b;
9399 }
9400
9401 static vector unsigned short __ATTRS_o_ai
9402 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
9403   return (vector unsigned short)__a - __b;
9404 }
9405
9406 static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
9407                                                       vector bool short __b) {
9408   return __a - (vector unsigned short)__b;
9409 }
9410
9411 /* vec_vsubuwm */
9412
9413 #define __builtin_altivec_vsubuwm vec_vsubuwm
9414
9415 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
9416   return __a - __b;
9417 }
9418
9419 static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9420                                            vector int __b) {
9421   return (vector int)__a - __b;
9422 }
9423
9424 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9425                                            vector bool int __b) {
9426   return __a - (vector int)__b;
9427 }
9428
9429 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9430                                                     vector unsigned int __b) {
9431   return __a - __b;
9432 }
9433
9434 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9435                                                     vector unsigned int __b) {
9436   return (vector unsigned int)__a - __b;
9437 }
9438
9439 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9440                                                     vector bool int __b) {
9441   return __a - (vector unsigned int)__b;
9442 }
9443
9444 /* vec_vsubfp */
9445
9446 #define __builtin_altivec_vsubfp vec_vsubfp
9447
9448 static vector float __attribute__((__always_inline__))
9449 vec_vsubfp(vector float __a, vector float __b) {
9450   return __a - __b;
9451 }
9452
9453 /* vec_subc */
9454
9455 static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
9456                                                  vector unsigned int __b) {
9457   return __builtin_altivec_vsubcuw(__a, __b);
9458 }
9459
9460 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9461 static vector unsigned __int128 __ATTRS_o_ai
9462 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9463   return __builtin_altivec_vsubcuq(__a, __b);
9464 }
9465
9466 static vector signed __int128 __ATTRS_o_ai
9467 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
9468   return __builtin_altivec_vsubcuq(__a, __b);
9469 }
9470 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9471
9472 /* vec_vsubcuw */
9473
9474 static vector unsigned int __attribute__((__always_inline__))
9475 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
9476   return __builtin_altivec_vsubcuw(__a, __b);
9477 }
9478
9479 /* vec_subs */
9480
9481 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9482                                                 vector signed char __b) {
9483   return __builtin_altivec_vsubsbs(__a, __b);
9484 }
9485
9486 static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
9487                                                 vector signed char __b) {
9488   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9489 }
9490
9491 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9492                                                 vector bool char __b) {
9493   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9494 }
9495
9496 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9497                                                   vector unsigned char __b) {
9498   return __builtin_altivec_vsububs(__a, __b);
9499 }
9500
9501 static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
9502                                                   vector unsigned char __b) {
9503   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9504 }
9505
9506 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9507                                                   vector bool char __b) {
9508   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9509 }
9510
9511 static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
9512   return __builtin_altivec_vsubshs(__a, __b);
9513 }
9514
9515 static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
9516                                           vector short __b) {
9517   return __builtin_altivec_vsubshs((vector short)__a, __b);
9518 }
9519
9520 static vector short __ATTRS_o_ai vec_subs(vector short __a,
9521                                           vector bool short __b) {
9522   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9523 }
9524
9525 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9526                                                    vector unsigned short __b) {
9527   return __builtin_altivec_vsubuhs(__a, __b);
9528 }
9529
9530 static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
9531                                                    vector unsigned short __b) {
9532   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9533 }
9534
9535 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9536                                                    vector bool short __b) {
9537   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9538 }
9539
9540 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
9541   return __builtin_altivec_vsubsws(__a, __b);
9542 }
9543
9544 static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
9545   return __builtin_altivec_vsubsws((vector int)__a, __b);
9546 }
9547
9548 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
9549   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9550 }
9551
9552 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9553                                                  vector unsigned int __b) {
9554   return __builtin_altivec_vsubuws(__a, __b);
9555 }
9556
9557 static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
9558                                                  vector unsigned int __b) {
9559   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9560 }
9561
9562 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9563                                                  vector bool int __b) {
9564   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9565 }
9566
9567 /* vec_vsubsbs */
9568
9569 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9570                                                    vector signed char __b) {
9571   return __builtin_altivec_vsubsbs(__a, __b);
9572 }
9573
9574 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
9575                                                    vector signed char __b) {
9576   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9577 }
9578
9579 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9580                                                    vector bool char __b) {
9581   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9582 }
9583
9584 /* vec_vsububs */
9585
9586 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9587                                                      vector unsigned char __b) {
9588   return __builtin_altivec_vsububs(__a, __b);
9589 }
9590
9591 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
9592                                                      vector unsigned char __b) {
9593   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9594 }
9595
9596 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9597                                                      vector bool char __b) {
9598   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9599 }
9600
9601 /* vec_vsubshs */
9602
9603 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9604                                              vector short __b) {
9605   return __builtin_altivec_vsubshs(__a, __b);
9606 }
9607
9608 static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
9609                                              vector short __b) {
9610   return __builtin_altivec_vsubshs((vector short)__a, __b);
9611 }
9612
9613 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9614                                              vector bool short __b) {
9615   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9616 }
9617
9618 /* vec_vsubuhs */
9619
9620 static vector unsigned short __ATTRS_o_ai
9621 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
9622   return __builtin_altivec_vsubuhs(__a, __b);
9623 }
9624
9625 static vector unsigned short __ATTRS_o_ai
9626 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
9627   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9628 }
9629
9630 static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
9631                                                       vector bool short __b) {
9632   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9633 }
9634
9635 /* vec_vsubsws */
9636
9637 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
9638   return __builtin_altivec_vsubsws(__a, __b);
9639 }
9640
9641 static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
9642                                            vector int __b) {
9643   return __builtin_altivec_vsubsws((vector int)__a, __b);
9644 }
9645
9646 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9647                                            vector bool int __b) {
9648   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9649 }
9650
9651 /* vec_vsubuws */
9652
9653 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9654                                                     vector unsigned int __b) {
9655   return __builtin_altivec_vsubuws(__a, __b);
9656 }
9657
9658 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
9659                                                     vector unsigned int __b) {
9660   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9661 }
9662
9663 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9664                                                     vector bool int __b) {
9665   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9666 }
9667
9668 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9669 /* vec_vsubuqm */
9670
9671 static vector signed __int128 __ATTRS_o_ai
9672 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
9673   return __a - __b;
9674 }
9675
9676 static vector unsigned __int128 __ATTRS_o_ai
9677 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9678   return __a - __b;
9679 }
9680
9681 /* vec_vsubeuqm */
9682
9683 static vector signed __int128 __ATTRS_o_ai
9684 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9685              vector signed __int128 __c) {
9686   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9687 }
9688
9689 static vector unsigned __int128 __ATTRS_o_ai
9690 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9691              vector unsigned __int128 __c) {
9692   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9693 }
9694
9695 /* vec_vsubcuq */
9696
9697 static vector signed __int128 __ATTRS_o_ai
9698 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
9699   return __builtin_altivec_vsubcuq(__a, __b);
9700 }
9701
9702 static vector unsigned __int128 __ATTRS_o_ai
9703 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9704   return __builtin_altivec_vsubcuq(__a, __b);
9705 }
9706
9707 /* vec_vsubecuq */
9708
9709 static vector signed __int128 __ATTRS_o_ai
9710 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9711              vector signed __int128 __c) {
9712   return __builtin_altivec_vsubecuq(__a, __b, __c);
9713 }
9714
9715 static vector unsigned __int128 __ATTRS_o_ai
9716 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9717              vector unsigned __int128 __c) {
9718   return __builtin_altivec_vsubecuq(__a, __b, __c);
9719 }
9720 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9721
9722 /* vec_sum4s */
9723
9724 static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
9725                                          vector int __b) {
9726   return __builtin_altivec_vsum4sbs(__a, __b);
9727 }
9728
9729 static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
9730                                                   vector unsigned int __b) {
9731   return __builtin_altivec_vsum4ubs(__a, __b);
9732 }
9733
9734 static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
9735                                          vector int __b) {
9736   return __builtin_altivec_vsum4shs(__a, __b);
9737 }
9738
9739 /* vec_vsum4sbs */
9740
9741 static vector int __attribute__((__always_inline__))
9742 vec_vsum4sbs(vector signed char __a, vector int __b) {
9743   return __builtin_altivec_vsum4sbs(__a, __b);
9744 }
9745
9746 /* vec_vsum4ubs */
9747
9748 static vector unsigned int __attribute__((__always_inline__))
9749 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
9750   return __builtin_altivec_vsum4ubs(__a, __b);
9751 }
9752
9753 /* vec_vsum4shs */
9754
9755 static vector int __attribute__((__always_inline__))
9756 vec_vsum4shs(vector signed short __a, vector int __b) {
9757   return __builtin_altivec_vsum4shs(__a, __b);
9758 }
9759
9760 /* vec_sum2s */
9761
9762 /* The vsum2sws instruction has a big-endian bias, so that the second
9763    input vector and the result always reference big-endian elements
9764    1 and 3 (little-endian element 0 and 2).  For ease of porting the
9765    programmer wants elements 1 and 3 in both cases, so for little
9766    endian we must perform some permutes.  */
9767
9768 static vector signed int __attribute__((__always_inline__))
9769 vec_sum2s(vector int __a, vector int __b) {
9770 #ifdef __LITTLE_ENDIAN__
9771   vector int __c = (vector signed int)vec_perm(
9772       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9773                                        8, 9, 10, 11));
9774   __c = __builtin_altivec_vsum2sws(__a, __c);
9775   return (vector signed int)vec_perm(
9776       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9777                                        8, 9, 10, 11));
9778 #else
9779   return __builtin_altivec_vsum2sws(__a, __b);
9780 #endif
9781 }
9782
9783 /* vec_vsum2sws */
9784
9785 static vector signed int __attribute__((__always_inline__))
9786 vec_vsum2sws(vector int __a, vector int __b) {
9787 #ifdef __LITTLE_ENDIAN__
9788   vector int __c = (vector signed int)vec_perm(
9789       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9790                                        8, 9, 10, 11));
9791   __c = __builtin_altivec_vsum2sws(__a, __c);
9792   return (vector signed int)vec_perm(
9793       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9794                                        8, 9, 10, 11));
9795 #else
9796   return __builtin_altivec_vsum2sws(__a, __b);
9797 #endif
9798 }
9799
9800 /* vec_sums */
9801
9802 /* The vsumsws instruction has a big-endian bias, so that the second
9803    input vector and the result always reference big-endian element 3
9804    (little-endian element 0).  For ease of porting the programmer
9805    wants element 3 in both cases, so for little endian we must perform
9806    some permutes.  */
9807
9808 static vector signed int __attribute__((__always_inline__))
9809 vec_sums(vector signed int __a, vector signed int __b) {
9810 #ifdef __LITTLE_ENDIAN__
9811   __b = (vector signed int)vec_splat(__b, 3);
9812   __b = __builtin_altivec_vsumsws(__a, __b);
9813   return (vector signed int)(0, 0, 0, __b[0]);
9814 #else
9815   return __builtin_altivec_vsumsws(__a, __b);
9816 #endif
9817 }
9818
9819 /* vec_vsumsws */
9820
9821 static vector signed int __attribute__((__always_inline__))
9822 vec_vsumsws(vector signed int __a, vector signed int __b) {
9823 #ifdef __LITTLE_ENDIAN__
9824   __b = (vector signed int)vec_splat(__b, 3);
9825   __b = __builtin_altivec_vsumsws(__a, __b);
9826   return (vector signed int)(0, 0, 0, __b[0]);
9827 #else
9828   return __builtin_altivec_vsumsws(__a, __b);
9829 #endif
9830 }
9831
9832 /* vec_trunc */
9833
9834 static vector float __ATTRS_o_ai
9835 vec_trunc(vector float __a) {
9836 #ifdef __VSX__
9837   return __builtin_vsx_xvrspiz(__a);
9838 #else
9839   return __builtin_altivec_vrfiz(__a);
9840 #endif
9841 }
9842
9843 #ifdef __VSX__
9844 static vector double __ATTRS_o_ai vec_trunc(vector double __a) {
9845   return __builtin_vsx_xvrdpiz(__a);
9846 }
9847 #endif
9848
9849 /* vec_vrfiz */
9850
9851 static vector float __attribute__((__always_inline__))
9852 vec_vrfiz(vector float __a) {
9853   return __builtin_altivec_vrfiz(__a);
9854 }
9855
9856 /* vec_unpackh */
9857
9858 /* The vector unpack instructions all have a big-endian bias, so for
9859    little endian we must reverse the meanings of "high" and "low."  */
9860
9861 static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
9862 #ifdef __LITTLE_ENDIAN__
9863   return __builtin_altivec_vupklsb((vector char)__a);
9864 #else
9865   return __builtin_altivec_vupkhsb((vector char)__a);
9866 #endif
9867 }
9868
9869 static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
9870 #ifdef __LITTLE_ENDIAN__
9871   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9872 #else
9873   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9874 #endif
9875 }
9876
9877 static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
9878 #ifdef __LITTLE_ENDIAN__
9879   return __builtin_altivec_vupklsh(__a);
9880 #else
9881   return __builtin_altivec_vupkhsh(__a);
9882 #endif
9883 }
9884
9885 static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
9886 #ifdef __LITTLE_ENDIAN__
9887   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9888 #else
9889   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9890 #endif
9891 }
9892
9893 static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
9894 #ifdef __LITTLE_ENDIAN__
9895   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9896 #else
9897   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9898 #endif
9899 }
9900
9901 #ifdef __POWER8_VECTOR__
9902 static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
9903 #ifdef __LITTLE_ENDIAN__
9904   return __builtin_altivec_vupklsw(__a);
9905 #else
9906   return __builtin_altivec_vupkhsw(__a);
9907 #endif
9908 }
9909
9910 static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
9911 #ifdef __LITTLE_ENDIAN__
9912   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9913 #else
9914   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9915 #endif
9916 }
9917 #endif
9918
9919 /* vec_vupkhsb */
9920
9921 static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
9922 #ifdef __LITTLE_ENDIAN__
9923   return __builtin_altivec_vupklsb((vector char)__a);
9924 #else
9925   return __builtin_altivec_vupkhsb((vector char)__a);
9926 #endif
9927 }
9928
9929 static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
9930 #ifdef __LITTLE_ENDIAN__
9931   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9932 #else
9933   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9934 #endif
9935 }
9936
9937 /* vec_vupkhsh */
9938
9939 static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
9940 #ifdef __LITTLE_ENDIAN__
9941   return __builtin_altivec_vupklsh(__a);
9942 #else
9943   return __builtin_altivec_vupkhsh(__a);
9944 #endif
9945 }
9946
9947 static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
9948 #ifdef __LITTLE_ENDIAN__
9949   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9950 #else
9951   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9952 #endif
9953 }
9954
9955 static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
9956 #ifdef __LITTLE_ENDIAN__
9957   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9958 #else
9959   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9960 #endif
9961 }
9962
9963 /* vec_vupkhsw */
9964
9965 #ifdef __POWER8_VECTOR__
9966 static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
9967 #ifdef __LITTLE_ENDIAN__
9968   return __builtin_altivec_vupklsw(__a);
9969 #else
9970   return __builtin_altivec_vupkhsw(__a);
9971 #endif
9972 }
9973
9974 static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
9975 #ifdef __LITTLE_ENDIAN__
9976   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9977 #else
9978   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9979 #endif
9980 }
9981 #endif
9982
9983 /* vec_unpackl */
9984
9985 static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
9986 #ifdef __LITTLE_ENDIAN__
9987   return __builtin_altivec_vupkhsb((vector char)__a);
9988 #else
9989   return __builtin_altivec_vupklsb((vector char)__a);
9990 #endif
9991 }
9992
9993 static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
9994 #ifdef __LITTLE_ENDIAN__
9995   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9996 #else
9997   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9998 #endif
9999 }
10000
10001 static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
10002 #ifdef __LITTLE_ENDIAN__
10003   return __builtin_altivec_vupkhsh(__a);
10004 #else
10005   return __builtin_altivec_vupklsh(__a);
10006 #endif
10007 }
10008
10009 static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
10010 #ifdef __LITTLE_ENDIAN__
10011   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10012 #else
10013   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10014 #endif
10015 }
10016
10017 static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
10018 #ifdef __LITTLE_ENDIAN__
10019   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10020 #else
10021   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10022 #endif
10023 }
10024
10025 #ifdef __POWER8_VECTOR__
10026 static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
10027 #ifdef __LITTLE_ENDIAN__
10028   return __builtin_altivec_vupkhsw(__a);
10029 #else
10030   return __builtin_altivec_vupklsw(__a);
10031 #endif
10032 }
10033
10034 static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
10035 #ifdef __LITTLE_ENDIAN__
10036   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10037 #else
10038   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10039 #endif
10040 }
10041 #endif
10042
10043 /* vec_vupklsb */
10044
10045 static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
10046 #ifdef __LITTLE_ENDIAN__
10047   return __builtin_altivec_vupkhsb((vector char)__a);
10048 #else
10049   return __builtin_altivec_vupklsb((vector char)__a);
10050 #endif
10051 }
10052
10053 static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
10054 #ifdef __LITTLE_ENDIAN__
10055   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10056 #else
10057   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10058 #endif
10059 }
10060
10061 /* vec_vupklsh */
10062
10063 static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
10064 #ifdef __LITTLE_ENDIAN__
10065   return __builtin_altivec_vupkhsh(__a);
10066 #else
10067   return __builtin_altivec_vupklsh(__a);
10068 #endif
10069 }
10070
10071 static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
10072 #ifdef __LITTLE_ENDIAN__
10073   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10074 #else
10075   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10076 #endif
10077 }
10078
10079 static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
10080 #ifdef __LITTLE_ENDIAN__
10081   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10082 #else
10083   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10084 #endif
10085 }
10086
10087 /* vec_vupklsw */
10088
10089 #ifdef __POWER8_VECTOR__
10090 static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
10091 #ifdef __LITTLE_ENDIAN__
10092   return __builtin_altivec_vupkhsw(__a);
10093 #else
10094   return __builtin_altivec_vupklsw(__a);
10095 #endif
10096 }
10097
10098 static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
10099 #ifdef __LITTLE_ENDIAN__
10100   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10101 #else
10102   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10103 #endif
10104 }
10105 #endif
10106
10107 /* vec_vsx_ld */
10108
10109 #ifdef __VSX__
10110
10111 static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
10112                                                  const vector signed int *__b) {
10113   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10114 }
10115
10116 static vector unsigned int __ATTRS_o_ai
10117 vec_vsx_ld(int __a, const vector unsigned int *__b) {
10118   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10119 }
10120
10121 static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
10122   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10123 }
10124
10125 static vector signed long long __ATTRS_o_ai
10126 vec_vsx_ld(int __a, const vector signed long long *__b) {
10127   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
10128 }
10129
10130 static vector unsigned long long __ATTRS_o_ai
10131 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
10132   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
10133 }
10134
10135 static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
10136                                              const vector double *__b) {
10137   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10138 }
10139
10140 #endif
10141
10142 /* vec_vsx_st */
10143
10144 #ifdef __VSX__
10145
10146 static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10147                                     vector signed int *__c) {
10148   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10149 }
10150
10151 static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10152                                     vector unsigned int *__c) {
10153   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10154 }
10155
10156 static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10157                                     vector float *__c) {
10158   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10159 }
10160
10161 static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
10162                                     vector signed long long *__c) {
10163   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10164 }
10165
10166 static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
10167                                     vector unsigned long long *__c) {
10168   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10169 }
10170
10171 static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10172                                     vector double *__c) {
10173   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10174 }
10175
10176 #endif
10177
10178 /* vec_xor */
10179
10180 #define __builtin_altivec_vxor vec_xor
10181
10182 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10183                                                vector signed char __b) {
10184   return __a ^ __b;
10185 }
10186
10187 static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
10188                                                vector signed char __b) {
10189   return (vector signed char)__a ^ __b;
10190 }
10191
10192 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10193                                                vector bool char __b) {
10194   return __a ^ (vector signed char)__b;
10195 }
10196
10197 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10198                                                  vector unsigned char __b) {
10199   return __a ^ __b;
10200 }
10201
10202 static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
10203                                                  vector unsigned char __b) {
10204   return (vector unsigned char)__a ^ __b;
10205 }
10206
10207 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10208                                                  vector bool char __b) {
10209   return __a ^ (vector unsigned char)__b;
10210 }
10211
10212 static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
10213                                              vector bool char __b) {
10214   return __a ^ __b;
10215 }
10216
10217 static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
10218   return __a ^ __b;
10219 }
10220
10221 static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
10222                                          vector short __b) {
10223   return (vector short)__a ^ __b;
10224 }
10225
10226 static vector short __ATTRS_o_ai vec_xor(vector short __a,
10227                                          vector bool short __b) {
10228   return __a ^ (vector short)__b;
10229 }
10230
10231 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10232                                                   vector unsigned short __b) {
10233   return __a ^ __b;
10234 }
10235
10236 static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
10237                                                   vector unsigned short __b) {
10238   return (vector unsigned short)__a ^ __b;
10239 }
10240
10241 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10242                                                   vector bool short __b) {
10243   return __a ^ (vector unsigned short)__b;
10244 }
10245
10246 static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
10247                                               vector bool short __b) {
10248   return __a ^ __b;
10249 }
10250
10251 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
10252   return __a ^ __b;
10253 }
10254
10255 static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
10256   return (vector int)__a ^ __b;
10257 }
10258
10259 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
10260   return __a ^ (vector int)__b;
10261 }
10262
10263 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10264                                                 vector unsigned int __b) {
10265   return __a ^ __b;
10266 }
10267
10268 static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
10269                                                 vector unsigned int __b) {
10270   return (vector unsigned int)__a ^ __b;
10271 }
10272
10273 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10274                                                 vector bool int __b) {
10275   return __a ^ (vector unsigned int)__b;
10276 }
10277
10278 static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
10279                                             vector bool int __b) {
10280   return __a ^ __b;
10281 }
10282
10283 static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
10284   vector unsigned int __res =
10285       (vector unsigned int)__a ^ (vector unsigned int)__b;
10286   return (vector float)__res;
10287 }
10288
10289 static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
10290                                          vector float __b) {
10291   vector unsigned int __res =
10292       (vector unsigned int)__a ^ (vector unsigned int)__b;
10293   return (vector float)__res;
10294 }
10295
10296 static vector float __ATTRS_o_ai vec_xor(vector float __a,
10297                                          vector bool int __b) {
10298   vector unsigned int __res =
10299       (vector unsigned int)__a ^ (vector unsigned int)__b;
10300   return (vector float)__res;
10301 }
10302
10303 #ifdef __VSX__
10304 static vector signed long long __ATTRS_o_ai
10305 vec_xor(vector signed long long __a, vector signed long long __b) {
10306   return __a ^ __b;
10307 }
10308
10309 static vector signed long long __ATTRS_o_ai
10310 vec_xor(vector bool long long __a, vector signed long long __b) {
10311   return (vector signed long long)__a ^ __b;
10312 }
10313
10314 static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
10315                                                     vector bool long long __b) {
10316   return __a ^ (vector signed long long)__b;
10317 }
10318
10319 static vector unsigned long long __ATTRS_o_ai
10320 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
10321   return __a ^ __b;
10322 }
10323
10324 static vector unsigned long long __ATTRS_o_ai
10325 vec_xor(vector bool long long __a, vector unsigned long long __b) {
10326   return (vector unsigned long long)__a ^ __b;
10327 }
10328
10329 static vector unsigned long long __ATTRS_o_ai
10330 vec_xor(vector unsigned long long __a, vector bool long long __b) {
10331   return __a ^ (vector unsigned long long)__b;
10332 }
10333
10334 static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
10335                                                   vector bool long long __b) {
10336   return __a ^ __b;
10337 }
10338
10339 static vector double __ATTRS_o_ai
10340 vec_xor(vector double __a, vector double __b) {
10341   return (vector double)((vector unsigned long long)__a ^
10342                           (vector unsigned long long)__b);
10343 }
10344
10345 static vector double __ATTRS_o_ai
10346 vec_xor(vector double __a, vector bool long long __b) {
10347   return (vector double)((vector unsigned long long)__a ^
10348                          (vector unsigned long long) __b);
10349 }
10350
10351 static vector double __ATTRS_o_ai
10352 vec_xor(vector bool long long __a, vector double __b) {
10353   return (vector double)((vector unsigned long long)__a ^
10354                          (vector unsigned long long)__b);
10355 }
10356 #endif
10357
10358 /* vec_vxor */
10359
10360 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10361                                                 vector signed char __b) {
10362   return __a ^ __b;
10363 }
10364
10365 static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
10366                                                 vector signed char __b) {
10367   return (vector signed char)__a ^ __b;
10368 }
10369
10370 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10371                                                 vector bool char __b) {
10372   return __a ^ (vector signed char)__b;
10373 }
10374
10375 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10376                                                   vector unsigned char __b) {
10377   return __a ^ __b;
10378 }
10379
10380 static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
10381                                                   vector unsigned char __b) {
10382   return (vector unsigned char)__a ^ __b;
10383 }
10384
10385 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10386                                                   vector bool char __b) {
10387   return __a ^ (vector unsigned char)__b;
10388 }
10389
10390 static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
10391                                               vector bool char __b) {
10392   return __a ^ __b;
10393 }
10394
10395 static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
10396   return __a ^ __b;
10397 }
10398
10399 static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
10400                                           vector short __b) {
10401   return (vector short)__a ^ __b;
10402 }
10403
10404 static vector short __ATTRS_o_ai vec_vxor(vector short __a,
10405                                           vector bool short __b) {
10406   return __a ^ (vector short)__b;
10407 }
10408
10409 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10410                                                    vector unsigned short __b) {
10411   return __a ^ __b;
10412 }
10413
10414 static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
10415                                                    vector unsigned short __b) {
10416   return (vector unsigned short)__a ^ __b;
10417 }
10418
10419 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10420                                                    vector bool short __b) {
10421   return __a ^ (vector unsigned short)__b;
10422 }
10423
10424 static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
10425                                                vector bool short __b) {
10426   return __a ^ __b;
10427 }
10428
10429 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
10430   return __a ^ __b;
10431 }
10432
10433 static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
10434   return (vector int)__a ^ __b;
10435 }
10436
10437 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
10438   return __a ^ (vector int)__b;
10439 }
10440
10441 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10442                                                  vector unsigned int __b) {
10443   return __a ^ __b;
10444 }
10445
10446 static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
10447                                                  vector unsigned int __b) {
10448   return (vector unsigned int)__a ^ __b;
10449 }
10450
10451 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10452                                                  vector bool int __b) {
10453   return __a ^ (vector unsigned int)__b;
10454 }
10455
10456 static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
10457                                              vector bool int __b) {
10458   return __a ^ __b;
10459 }
10460
10461 static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
10462   vector unsigned int __res =
10463       (vector unsigned int)__a ^ (vector unsigned int)__b;
10464   return (vector float)__res;
10465 }
10466
10467 static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
10468                                           vector float __b) {
10469   vector unsigned int __res =
10470       (vector unsigned int)__a ^ (vector unsigned int)__b;
10471   return (vector float)__res;
10472 }
10473
10474 static vector float __ATTRS_o_ai vec_vxor(vector float __a,
10475                                           vector bool int __b) {
10476   vector unsigned int __res =
10477       (vector unsigned int)__a ^ (vector unsigned int)__b;
10478   return (vector float)__res;
10479 }
10480
10481 #ifdef __VSX__
10482 static vector signed long long __ATTRS_o_ai
10483 vec_vxor(vector signed long long __a, vector signed long long __b) {
10484   return __a ^ __b;
10485 }
10486
10487 static vector signed long long __ATTRS_o_ai
10488 vec_vxor(vector bool long long __a, vector signed long long __b) {
10489   return (vector signed long long)__a ^ __b;
10490 }
10491
10492 static vector signed long long __ATTRS_o_ai
10493 vec_vxor(vector signed long long __a, vector bool long long __b) {
10494   return __a ^ (vector signed long long)__b;
10495 }
10496
10497 static vector unsigned long long __ATTRS_o_ai
10498 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
10499   return __a ^ __b;
10500 }
10501
10502 static vector unsigned long long __ATTRS_o_ai
10503 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
10504   return (vector unsigned long long)__a ^ __b;
10505 }
10506
10507 static vector unsigned long long __ATTRS_o_ai
10508 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
10509   return __a ^ (vector unsigned long long)__b;
10510 }
10511
10512 static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
10513                                                    vector bool long long __b) {
10514   return __a ^ __b;
10515 }
10516 #endif
10517
10518 /* ------------------------ extensions for CBEA ----------------------------- */
10519
10520 /* vec_extract */
10521
10522 static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
10523   return __a[__b];
10524 }
10525
10526 static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
10527                                               int __b) {
10528   return __a[__b];
10529 }
10530
10531 static unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
10532                                               int __b) {
10533   return __a[__b];
10534 }
10535
10536 static signed short __ATTRS_o_ai vec_extract(vector signed short __a, int __b) {
10537   return __a[__b];
10538 }
10539
10540 static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
10541                                                int __b) {
10542   return __a[__b];
10543 }
10544
10545 static unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
10546                                                int __b) {
10547   return __a[__b];
10548 }
10549
10550 static signed int __ATTRS_o_ai vec_extract(vector signed int __a, int __b) {
10551   return __a[__b];
10552 }
10553
10554 static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
10555   return __a[__b];
10556 }
10557
10558 static unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, int __b) {
10559   return __a[__b];
10560 }
10561
10562 #ifdef __VSX__
10563 static signed long long __ATTRS_o_ai vec_extract(vector signed long long __a,
10564                                                  int __b) {
10565   return __a[__b];
10566 }
10567
10568 static unsigned long long __ATTRS_o_ai
10569 vec_extract(vector unsigned long long __a, int __b) {
10570   return __a[__b];
10571 }
10572
10573 static unsigned long long __ATTRS_o_ai vec_extract(vector bool long long __a,
10574                                                    int __b) {
10575   return __a[__b];
10576 }
10577
10578 static double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
10579   return __a[__b];
10580 }
10581 #endif
10582
10583 static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
10584   return __a[__b];
10585 }
10586
10587 /* vec_insert */
10588
10589 static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
10590                                                   vector signed char __b,
10591                                                   int __c) {
10592   __b[__c] = __a;
10593   return __b;
10594 }
10595
10596 static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
10597                                                     vector unsigned char __b,
10598                                                     int __c) {
10599   __b[__c] = __a;
10600   return __b;
10601 }
10602
10603 static vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
10604                                                 vector bool char __b,
10605                                                 int __c) {
10606   __b[__c] = __a;
10607   return __b;
10608 }
10609
10610 static vector signed short __ATTRS_o_ai vec_insert(signed short __a,
10611                                                    vector signed short __b,
10612                                                    int __c) {
10613   __b[__c] = __a;
10614   return __b;
10615 }
10616
10617 static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
10618                                                      vector unsigned short __b,
10619                                                      int __c) {
10620   __b[__c] = __a;
10621   return __b;
10622 }
10623
10624 static vector bool short __ATTRS_o_ai vec_insert(unsigned short __a,
10625                                                  vector bool short __b,
10626                                                  int __c) {
10627   __b[__c] = __a;
10628   return __b;
10629 }
10630
10631 static vector signed int __ATTRS_o_ai vec_insert(signed int __a,
10632                                                  vector signed int __b,
10633                                                  int __c) {
10634   __b[__c] = __a;
10635   return __b;
10636 }
10637
10638 static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
10639                                                    vector unsigned int __b,
10640                                                    int __c) {
10641   __b[__c] = __a;
10642   return __b;
10643 }
10644
10645 static vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
10646                                                vector bool int __b,
10647                                                int __c) {
10648   __b[__c] = __a;
10649   return __b;
10650 }
10651
10652 #ifdef __VSX__
10653 static vector signed long long __ATTRS_o_ai
10654 vec_insert(signed long long __a, vector signed long long __b, int __c) {
10655   __b[__c] = __a;
10656   return __b;
10657 }
10658
10659 static vector unsigned long long __ATTRS_o_ai
10660 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
10661   __b[__c] = __a;
10662   return __b;
10663 }
10664
10665 static vector bool long long __ATTRS_o_ai
10666 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
10667   __b[__c] = __a;
10668   return __b;
10669 }
10670 static vector double __ATTRS_o_ai vec_insert(double __a, vector double __b,
10671                                              int __c) {
10672   __b[__c] = __a;
10673   return __b;
10674 }
10675 #endif
10676
10677 static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
10678                                             int __c) {
10679   __b[__c] = __a;
10680   return __b;
10681 }
10682
10683 /* vec_lvlx */
10684
10685 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10686                                                 const signed char *__b) {
10687   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10688                   vec_lvsl(__a, __b));
10689 }
10690
10691 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10692                                                 const vector signed char *__b) {
10693   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10694                   vec_lvsl(__a, (unsigned char *)__b));
10695 }
10696
10697 static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
10698                                                   const unsigned char *__b) {
10699   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10700                   vec_lvsl(__a, __b));
10701 }
10702
10703 static vector unsigned char __ATTRS_o_ai
10704 vec_lvlx(int __a, const vector unsigned char *__b) {
10705   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10706                   vec_lvsl(__a, (unsigned char *)__b));
10707 }
10708
10709 static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
10710                                               const vector bool char *__b) {
10711   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
10712                   vec_lvsl(__a, (unsigned char *)__b));
10713 }
10714
10715 static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
10716   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10717 }
10718
10719 static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
10720   return vec_perm(vec_ld(__a, __b), (vector short)(0),
10721                   vec_lvsl(__a, (unsigned char *)__b));
10722 }
10723
10724 static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
10725                                                    const unsigned short *__b) {
10726   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10727                   vec_lvsl(__a, __b));
10728 }
10729
10730 static vector unsigned short __ATTRS_o_ai
10731 vec_lvlx(int __a, const vector unsigned short *__b) {
10732   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10733                   vec_lvsl(__a, (unsigned char *)__b));
10734 }
10735
10736 static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
10737                                                const vector bool short *__b) {
10738   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
10739                   vec_lvsl(__a, (unsigned char *)__b));
10740 }
10741
10742 static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
10743   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
10744                   vec_lvsl(__a, (unsigned char *)__b));
10745 }
10746
10747 static vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
10748   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10749 }
10750
10751 static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
10752   return vec_perm(vec_ld(__a, __b), (vector int)(0),
10753                   vec_lvsl(__a, (unsigned char *)__b));
10754 }
10755
10756 static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
10757                                                  const unsigned int *__b) {
10758   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10759                   vec_lvsl(__a, __b));
10760 }
10761
10762 static vector unsigned int __ATTRS_o_ai
10763 vec_lvlx(int __a, const vector unsigned int *__b) {
10764   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10765                   vec_lvsl(__a, (unsigned char *)__b));
10766 }
10767
10768 static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
10769                                              const vector bool int *__b) {
10770   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
10771                   vec_lvsl(__a, (unsigned char *)__b));
10772 }
10773
10774 static vector float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
10775   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10776 }
10777
10778 static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
10779   return vec_perm(vec_ld(__a, __b), (vector float)(0),
10780                   vec_lvsl(__a, (unsigned char *)__b));
10781 }
10782
10783 /* vec_lvlxl */
10784
10785 static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
10786                                                  const signed char *__b) {
10787   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10788                   vec_lvsl(__a, __b));
10789 }
10790
10791 static vector signed char __ATTRS_o_ai
10792 vec_lvlxl(int __a, const vector signed char *__b) {
10793   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10794                   vec_lvsl(__a, (unsigned char *)__b));
10795 }
10796
10797 static vector unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
10798                                                    const unsigned char *__b) {
10799   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10800                   vec_lvsl(__a, __b));
10801 }
10802
10803 static vector unsigned char __ATTRS_o_ai
10804 vec_lvlxl(int __a, const vector unsigned char *__b) {
10805   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10806                   vec_lvsl(__a, (unsigned char *)__b));
10807 }
10808
10809 static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
10810                                                const vector bool char *__b) {
10811   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
10812                   vec_lvsl(__a, (unsigned char *)__b));
10813 }
10814
10815 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
10816   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10817 }
10818
10819 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
10820   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
10821                   vec_lvsl(__a, (unsigned char *)__b));
10822 }
10823
10824 static vector unsigned short __ATTRS_o_ai vec_lvlxl(int __a,
10825                                                     const unsigned short *__b) {
10826   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10827                   vec_lvsl(__a, __b));
10828 }
10829
10830 static vector unsigned short __ATTRS_o_ai
10831 vec_lvlxl(int __a, const vector unsigned short *__b) {
10832   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10833                   vec_lvsl(__a, (unsigned char *)__b));
10834 }
10835
10836 static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
10837                                                 const vector bool short *__b) {
10838   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
10839                   vec_lvsl(__a, (unsigned char *)__b));
10840 }
10841
10842 static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
10843   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
10844                   vec_lvsl(__a, (unsigned char *)__b));
10845 }
10846
10847 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
10848   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10849 }
10850
10851 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
10852   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
10853                   vec_lvsl(__a, (unsigned char *)__b));
10854 }
10855
10856 static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
10857                                                   const unsigned int *__b) {
10858   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10859                   vec_lvsl(__a, __b));
10860 }
10861
10862 static vector unsigned int __ATTRS_o_ai
10863 vec_lvlxl(int __a, const vector unsigned int *__b) {
10864   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10865                   vec_lvsl(__a, (unsigned char *)__b));
10866 }
10867
10868 static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
10869                                               const vector bool int *__b) {
10870   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
10871                   vec_lvsl(__a, (unsigned char *)__b));
10872 }
10873
10874 static vector float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
10875   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10876 }
10877
10878 static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
10879   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
10880                   vec_lvsl(__a, (unsigned char *)__b));
10881 }
10882
10883 /* vec_lvrx */
10884
10885 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10886                                                 const signed char *__b) {
10887   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10888                   vec_lvsl(__a, __b));
10889 }
10890
10891 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10892                                                 const vector signed char *__b) {
10893   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10894                   vec_lvsl(__a, (unsigned char *)__b));
10895 }
10896
10897 static vector unsigned char __ATTRS_o_ai vec_lvrx(int __a,
10898                                                   const unsigned char *__b) {
10899   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10900                   vec_lvsl(__a, __b));
10901 }
10902
10903 static vector unsigned char __ATTRS_o_ai
10904 vec_lvrx(int __a, const vector unsigned char *__b) {
10905   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10906                   vec_lvsl(__a, (unsigned char *)__b));
10907 }
10908
10909 static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
10910                                               const vector bool char *__b) {
10911   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
10912                   vec_lvsl(__a, (unsigned char *)__b));
10913 }
10914
10915 static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
10916   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10917 }
10918
10919 static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
10920   return vec_perm((vector short)(0), vec_ld(__a, __b),
10921                   vec_lvsl(__a, (unsigned char *)__b));
10922 }
10923
10924 static vector unsigned short __ATTRS_o_ai vec_lvrx(int __a,
10925                                                    const unsigned short *__b) {
10926   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10927                   vec_lvsl(__a, __b));
10928 }
10929
10930 static vector unsigned short __ATTRS_o_ai
10931 vec_lvrx(int __a, const vector unsigned short *__b) {
10932   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10933                   vec_lvsl(__a, (unsigned char *)__b));
10934 }
10935
10936 static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
10937                                                const vector bool short *__b) {
10938   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
10939                   vec_lvsl(__a, (unsigned char *)__b));
10940 }
10941
10942 static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
10943   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
10944                   vec_lvsl(__a, (unsigned char *)__b));
10945 }
10946
10947 static vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
10948   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10949 }
10950
10951 static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
10952   return vec_perm((vector int)(0), vec_ld(__a, __b),
10953                   vec_lvsl(__a, (unsigned char *)__b));
10954 }
10955
10956 static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
10957                                                  const unsigned int *__b) {
10958   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10959                   vec_lvsl(__a, __b));
10960 }
10961
10962 static vector unsigned int __ATTRS_o_ai
10963 vec_lvrx(int __a, const vector unsigned int *__b) {
10964   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10965                   vec_lvsl(__a, (unsigned char *)__b));
10966 }
10967
10968 static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
10969                                              const vector bool int *__b) {
10970   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
10971                   vec_lvsl(__a, (unsigned char *)__b));
10972 }
10973
10974 static vector float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
10975   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10976 }
10977
10978 static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
10979   return vec_perm((vector float)(0), vec_ld(__a, __b),
10980                   vec_lvsl(__a, (unsigned char *)__b));
10981 }
10982
10983 /* vec_lvrxl */
10984
10985 static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
10986                                                  const signed char *__b) {
10987   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10988                   vec_lvsl(__a, __b));
10989 }
10990
10991 static vector signed char __ATTRS_o_ai
10992 vec_lvrxl(int __a, const vector signed char *__b) {
10993   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10994                   vec_lvsl(__a, (unsigned char *)__b));
10995 }
10996
10997 static vector unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
10998                                                    const unsigned char *__b) {
10999   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11000                   vec_lvsl(__a, __b));
11001 }
11002
11003 static vector unsigned char __ATTRS_o_ai
11004 vec_lvrxl(int __a, const vector unsigned char *__b) {
11005   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
11006                   vec_lvsl(__a, (unsigned char *)__b));
11007 }
11008
11009 static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
11010                                                const vector bool char *__b) {
11011   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
11012                   vec_lvsl(__a, (unsigned char *)__b));
11013 }
11014
11015 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
11016   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11017 }
11018
11019 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
11020   return vec_perm((vector short)(0), vec_ldl(__a, __b),
11021                   vec_lvsl(__a, (unsigned char *)__b));
11022 }
11023
11024 static vector unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
11025                                                     const unsigned short *__b) {
11026   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11027                   vec_lvsl(__a, __b));
11028 }
11029
11030 static vector unsigned short __ATTRS_o_ai
11031 vec_lvrxl(int __a, const vector unsigned short *__b) {
11032   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11033                   vec_lvsl(__a, (unsigned char *)__b));
11034 }
11035
11036 static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
11037                                                 const vector bool short *__b) {
11038   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
11039                   vec_lvsl(__a, (unsigned char *)__b));
11040 }
11041
11042 static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
11043   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
11044                   vec_lvsl(__a, (unsigned char *)__b));
11045 }
11046
11047 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
11048   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11049 }
11050
11051 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
11052   return vec_perm((vector int)(0), vec_ldl(__a, __b),
11053                   vec_lvsl(__a, (unsigned char *)__b));
11054 }
11055
11056 static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
11057                                                   const unsigned int *__b) {
11058   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11059                   vec_lvsl(__a, __b));
11060 }
11061
11062 static vector unsigned int __ATTRS_o_ai
11063 vec_lvrxl(int __a, const vector unsigned int *__b) {
11064   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11065                   vec_lvsl(__a, (unsigned char *)__b));
11066 }
11067
11068 static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
11069                                               const vector bool int *__b) {
11070   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
11071                   vec_lvsl(__a, (unsigned char *)__b));
11072 }
11073
11074 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
11075   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11076 }
11077
11078 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
11079   return vec_perm((vector float)(0), vec_ldl(__a, __b),
11080                   vec_lvsl(__a, (unsigned char *)__b));
11081 }
11082
11083 /* vec_stvlx */
11084
11085 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11086                                    signed char *__c) {
11087   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11088                 __c);
11089 }
11090
11091 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11092                                    vector signed char *__c) {
11093   return vec_st(
11094       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11095       __b, __c);
11096 }
11097
11098 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11099                                    unsigned char *__c) {
11100   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11101                 __c);
11102 }
11103
11104 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11105                                    vector unsigned char *__c) {
11106   return vec_st(
11107       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11108       __b, __c);
11109 }
11110
11111 static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
11112                                    vector bool char *__c) {
11113   return vec_st(
11114       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11115       __b, __c);
11116 }
11117
11118 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
11119   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11120                 __c);
11121 }
11122
11123 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11124                                    vector short *__c) {
11125   return vec_st(
11126       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11127       __b, __c);
11128 }
11129
11130 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
11131                                    unsigned short *__c) {
11132   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11133                 __c);
11134 }
11135
11136 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
11137                                    vector unsigned short *__c) {
11138   return vec_st(
11139       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11140       __b, __c);
11141 }
11142
11143 static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
11144                                    vector bool short *__c) {
11145   return vec_st(
11146       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11147       __b, __c);
11148 }
11149
11150 static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
11151                                    vector pixel *__c) {
11152   return vec_st(
11153       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11154       __b, __c);
11155 }
11156
11157 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
11158   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11159                 __c);
11160 }
11161
11162 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__c) {
11163   return vec_st(
11164       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11165       __b, __c);
11166 }
11167
11168 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11169                                    unsigned int *__c) {
11170   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11171                 __c);
11172 }
11173
11174 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11175                                    vector unsigned int *__c) {
11176   return vec_st(
11177       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11178       __b, __c);
11179 }
11180
11181 static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
11182                                    vector bool int *__c) {
11183   return vec_st(
11184       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11185       __b, __c);
11186 }
11187
11188 static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
11189                                    vector float *__c) {
11190   return vec_st(
11191       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11192       __b, __c);
11193 }
11194
11195 /* vec_stvlxl */
11196
11197 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11198                                     signed char *__c) {
11199   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11200                  __c);
11201 }
11202
11203 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11204                                     vector signed char *__c) {
11205   return vec_stl(
11206       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11207       __b, __c);
11208 }
11209
11210 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
11211                                     unsigned char *__c) {
11212   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11213                  __c);
11214 }
11215
11216 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
11217                                     vector unsigned char *__c) {
11218   return vec_stl(
11219       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11220       __b, __c);
11221 }
11222
11223 static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
11224                                     vector bool char *__c) {
11225   return vec_stl(
11226       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11227       __b, __c);
11228 }
11229
11230 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
11231   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11232                  __c);
11233 }
11234
11235 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11236                                     vector short *__c) {
11237   return vec_stl(
11238       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11239       __b, __c);
11240 }
11241
11242 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11243                                     unsigned short *__c) {
11244   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11245                  __c);
11246 }
11247
11248 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11249                                     vector unsigned short *__c) {
11250   return vec_stl(
11251       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11252       __b, __c);
11253 }
11254
11255 static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
11256                                     vector bool short *__c) {
11257   return vec_stl(
11258       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11259       __b, __c);
11260 }
11261
11262 static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
11263                                     vector pixel *__c) {
11264   return vec_stl(
11265       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11266       __b, __c);
11267 }
11268
11269 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
11270   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11271                  __c);
11272 }
11273
11274 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__c) {
11275   return vec_stl(
11276       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11277       __b, __c);
11278 }
11279
11280 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11281                                     unsigned int *__c) {
11282   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11283                  __c);
11284 }
11285
11286 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11287                                     vector unsigned int *__c) {
11288   return vec_stl(
11289       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11290       __b, __c);
11291 }
11292
11293 static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
11294                                     vector bool int *__c) {
11295   return vec_stl(
11296       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11297       __b, __c);
11298 }
11299
11300 static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
11301                                     vector float *__c) {
11302   return vec_stl(
11303       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11304       __b, __c);
11305 }
11306
11307 /* vec_stvrx */
11308
11309 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11310                                    signed char *__c) {
11311   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11312                 __c);
11313 }
11314
11315 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11316                                    vector signed char *__c) {
11317   return vec_st(
11318       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11319       __b, __c);
11320 }
11321
11322 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11323                                    unsigned char *__c) {
11324   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11325                 __c);
11326 }
11327
11328 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11329                                    vector unsigned char *__c) {
11330   return vec_st(
11331       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11332       __b, __c);
11333 }
11334
11335 static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
11336                                    vector bool char *__c) {
11337   return vec_st(
11338       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11339       __b, __c);
11340 }
11341
11342 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
11343   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11344                 __c);
11345 }
11346
11347 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11348                                    vector short *__c) {
11349   return vec_st(
11350       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11351       __b, __c);
11352 }
11353
11354 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11355                                    unsigned short *__c) {
11356   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11357                 __c);
11358 }
11359
11360 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11361                                    vector unsigned short *__c) {
11362   return vec_st(
11363       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11364       __b, __c);
11365 }
11366
11367 static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
11368                                    vector bool short *__c) {
11369   return vec_st(
11370       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11371       __b, __c);
11372 }
11373
11374 static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
11375                                    vector pixel *__c) {
11376   return vec_st(
11377       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11378       __b, __c);
11379 }
11380
11381 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
11382   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11383                 __c);
11384 }
11385
11386 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__c) {
11387   return vec_st(
11388       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11389       __b, __c);
11390 }
11391
11392 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11393                                    unsigned int *__c) {
11394   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11395                 __c);
11396 }
11397
11398 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11399                                    vector unsigned int *__c) {
11400   return vec_st(
11401       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11402       __b, __c);
11403 }
11404
11405 static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
11406                                    vector bool int *__c) {
11407   return vec_st(
11408       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11409       __b, __c);
11410 }
11411
11412 static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
11413                                    vector float *__c) {
11414   return vec_st(
11415       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11416       __b, __c);
11417 }
11418
11419 /* vec_stvrxl */
11420
11421 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11422                                     signed char *__c) {
11423   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11424                  __c);
11425 }
11426
11427 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11428                                     vector signed char *__c) {
11429   return vec_stl(
11430       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11431       __b, __c);
11432 }
11433
11434 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11435                                     unsigned char *__c) {
11436   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11437                  __c);
11438 }
11439
11440 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11441                                     vector unsigned char *__c) {
11442   return vec_stl(
11443       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11444       __b, __c);
11445 }
11446
11447 static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
11448                                     vector bool char *__c) {
11449   return vec_stl(
11450       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11451       __b, __c);
11452 }
11453
11454 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
11455   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11456                  __c);
11457 }
11458
11459 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11460                                     vector short *__c) {
11461   return vec_stl(
11462       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11463       __b, __c);
11464 }
11465
11466 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11467                                     unsigned short *__c) {
11468   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11469                  __c);
11470 }
11471
11472 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11473                                     vector unsigned short *__c) {
11474   return vec_stl(
11475       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11476       __b, __c);
11477 }
11478
11479 static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
11480                                     vector bool short *__c) {
11481   return vec_stl(
11482       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11483       __b, __c);
11484 }
11485
11486 static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
11487                                     vector pixel *__c) {
11488   return vec_stl(
11489       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11490       __b, __c);
11491 }
11492
11493 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
11494   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11495                  __c);
11496 }
11497
11498 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__c) {
11499   return vec_stl(
11500       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11501       __b, __c);
11502 }
11503
11504 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11505                                     unsigned int *__c) {
11506   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11507                  __c);
11508 }
11509
11510 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11511                                     vector unsigned int *__c) {
11512   return vec_stl(
11513       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11514       __b, __c);
11515 }
11516
11517 static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
11518                                     vector bool int *__c) {
11519   return vec_stl(
11520       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11521       __b, __c);
11522 }
11523
11524 static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
11525                                     vector float *__c) {
11526   return vec_stl(
11527       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11528       __b, __c);
11529 }
11530
11531 /* vec_promote */
11532
11533 static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
11534   vector signed char __res = (vector signed char)(0);
11535   __res[__b] = __a;
11536   return __res;
11537 }
11538
11539 static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
11540                                                      int __b) {
11541   vector unsigned char __res = (vector unsigned char)(0);
11542   __res[__b] = __a;
11543   return __res;
11544 }
11545
11546 static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
11547   vector short __res = (vector short)(0);
11548   __res[__b] = __a;
11549   return __res;
11550 }
11551
11552 static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
11553                                                       int __b) {
11554   vector unsigned short __res = (vector unsigned short)(0);
11555   __res[__b] = __a;
11556   return __res;
11557 }
11558
11559 static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
11560   vector int __res = (vector int)(0);
11561   __res[__b] = __a;
11562   return __res;
11563 }
11564
11565 static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
11566   vector unsigned int __res = (vector unsigned int)(0);
11567   __res[__b] = __a;
11568   return __res;
11569 }
11570
11571 static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
11572   vector float __res = (vector float)(0);
11573   __res[__b] = __a;
11574   return __res;
11575 }
11576
11577 /* vec_splats */
11578
11579 static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
11580   return (vector signed char)(__a);
11581 }
11582
11583 static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
11584   return (vector unsigned char)(__a);
11585 }
11586
11587 static vector short __ATTRS_o_ai vec_splats(short __a) {
11588   return (vector short)(__a);
11589 }
11590
11591 static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
11592   return (vector unsigned short)(__a);
11593 }
11594
11595 static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
11596
11597 static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
11598   return (vector unsigned int)(__a);
11599 }
11600
11601 #ifdef __VSX__
11602 static vector signed long long __ATTRS_o_ai vec_splats(signed long long __a) {
11603   return (vector signed long long)(__a);
11604 }
11605
11606 static vector unsigned long long __ATTRS_o_ai
11607 vec_splats(unsigned long long __a) {
11608   return (vector unsigned long long)(__a);
11609 }
11610
11611 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11612 static vector signed __int128 __ATTRS_o_ai vec_splats(signed __int128 __a) {
11613   return (vector signed __int128)(__a);
11614 }
11615
11616 static vector unsigned __int128 __ATTRS_o_ai
11617 vec_splats(unsigned __int128 __a) {
11618   return (vector unsigned __int128)(__a);
11619 }
11620
11621 #endif
11622
11623 static vector double __ATTRS_o_ai vec_splats(double __a) {
11624   return (vector double)(__a);
11625 }
11626 #endif
11627
11628 static vector float __ATTRS_o_ai vec_splats(float __a) {
11629   return (vector float)(__a);
11630 }
11631
11632 /* ----------------------------- predicates --------------------------------- */
11633
11634 /* vec_all_eq */
11635
11636 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11637                                    vector signed char __b) {
11638   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11639                                       (vector char)__b);
11640 }
11641
11642 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11643                                    vector bool char __b) {
11644   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11645                                       (vector char)__b);
11646 }
11647
11648 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11649                                    vector unsigned char __b) {
11650   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11651                                       (vector char)__b);
11652 }
11653
11654 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11655                                    vector bool char __b) {
11656   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11657                                       (vector char)__b);
11658 }
11659
11660 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11661                                    vector signed char __b) {
11662   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11663                                       (vector char)__b);
11664 }
11665
11666 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11667                                    vector unsigned char __b) {
11668   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11669                                       (vector char)__b);
11670 }
11671
11672 static int __ATTRS_o_ai vec_all_eq(vector bool char __a, vector bool char __b) {
11673   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11674                                       (vector char)__b);
11675 }
11676
11677 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
11678   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
11679 }
11680
11681 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
11682   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
11683 }
11684
11685 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11686                                    vector unsigned short __b) {
11687   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11688                                       (vector short)__b);
11689 }
11690
11691 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11692                                    vector bool short __b) {
11693   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11694                                       (vector short)__b);
11695 }
11696
11697 static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
11698   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11699                                       (vector short)__b);
11700 }
11701
11702 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11703                                    vector unsigned short __b) {
11704   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11705                                       (vector short)__b);
11706 }
11707
11708 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11709                                    vector bool short __b) {
11710   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11711                                       (vector short)__b);
11712 }
11713
11714 static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
11715   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11716                                       (vector short)__b);
11717 }
11718
11719 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
11720   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
11721 }
11722
11723 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
11724   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
11725 }
11726
11727 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11728                                    vector unsigned int __b) {
11729   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11730                                       (vector int)__b);
11731 }
11732
11733 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11734                                    vector bool int __b) {
11735   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11736                                       (vector int)__b);
11737 }
11738
11739 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
11740   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11741                                       (vector int)__b);
11742 }
11743
11744 static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
11745                                    vector unsigned int __b) {
11746   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11747                                       (vector int)__b);
11748 }
11749
11750 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
11751   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11752                                       (vector int)__b);
11753 }
11754
11755 #ifdef __POWER8_VECTOR__
11756 static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
11757                                    vector signed long long __b) {
11758   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11759 }
11760
11761 static int __ATTRS_o_ai vec_all_eq(vector long long __a,
11762                                    vector bool long long __b) {
11763   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11764 }
11765
11766 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11767                                    vector unsigned long long __b) {
11768   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11769                                       (vector long long)__b);
11770 }
11771
11772 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11773                                    vector bool long long __b) {
11774   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11775                                       (vector long long)__b);
11776 }
11777
11778 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11779                                    vector long long __b) {
11780   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11781                                       (vector long long)__b);
11782 }
11783
11784 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11785                                    vector unsigned long long __b) {
11786   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11787                                       (vector long long)__b);
11788 }
11789
11790 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11791                                    vector bool long long __b) {
11792   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11793                                       (vector long long)__b);
11794 }
11795 #endif
11796
11797 static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
11798 #ifdef __VSX__
11799   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
11800 #else
11801   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
11802 #endif
11803 }
11804
11805 #ifdef __VSX__
11806 static int __ATTRS_o_ai vec_all_eq(vector double __a, vector double __b) {
11807   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
11808 }
11809 #endif
11810
11811 /* vec_all_ge */
11812
11813 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11814                                    vector signed char __b) {
11815   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
11816 }
11817
11818 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11819                                    vector bool char __b) {
11820   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
11821 }
11822
11823 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11824                                    vector unsigned char __b) {
11825   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
11826 }
11827
11828 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11829                                    vector bool char __b) {
11830   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
11831 }
11832
11833 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11834                                    vector signed char __b) {
11835   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11836                                       (vector unsigned char)__a);
11837 }
11838
11839 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11840                                    vector unsigned char __b) {
11841   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
11842 }
11843
11844 static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
11845   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11846                                       (vector unsigned char)__a);
11847 }
11848
11849 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
11850   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
11851 }
11852
11853 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
11854   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
11855 }
11856
11857 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11858                                    vector unsigned short __b) {
11859   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
11860 }
11861
11862 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11863                                    vector bool short __b) {
11864   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11865                                       __a);
11866 }
11867
11868 static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
11869   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11870                                       (vector unsigned short)__a);
11871 }
11872
11873 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11874                                    vector unsigned short __b) {
11875   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
11876                                       (vector unsigned short)__a);
11877 }
11878
11879 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11880                                    vector bool short __b) {
11881   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11882                                       (vector unsigned short)__a);
11883 }
11884
11885 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
11886   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
11887 }
11888
11889 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
11890   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
11891 }
11892
11893 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11894                                    vector unsigned int __b) {
11895   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
11896 }
11897
11898 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11899                                    vector bool int __b) {
11900   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
11901 }
11902
11903 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
11904   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11905                                       (vector unsigned int)__a);
11906 }
11907
11908 static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
11909                                    vector unsigned int __b) {
11910   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
11911 }
11912
11913 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
11914   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11915                                       (vector unsigned int)__a);
11916 }
11917
11918 #ifdef __POWER8_VECTOR__
11919 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11920                                    vector signed long long __b) {
11921   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11922 }
11923 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11924                                    vector bool long long __b) {
11925   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11926                                       __a);
11927 }
11928
11929 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11930                                    vector unsigned long long __b) {
11931   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11932 }
11933
11934 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11935                                    vector bool long long __b) {
11936   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11937                                       __a);
11938 }
11939
11940 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11941                                    vector signed long long __b) {
11942   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11943                                       (vector unsigned long long)__a);
11944 }
11945
11946 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11947                                    vector unsigned long long __b) {
11948   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11949                                       (vector unsigned long long)__a);
11950 }
11951
11952 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11953                                    vector bool long long __b) {
11954   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11955                                       (vector unsigned long long)__a);
11956 }
11957 #endif
11958
11959 static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
11960 #ifdef __VSX__
11961   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
11962 #else
11963   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
11964 #endif
11965 }
11966
11967 #ifdef __VSX__
11968 static int __ATTRS_o_ai vec_all_ge(vector double __a, vector double __b) {
11969   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
11970 }
11971 #endif
11972
11973 /* vec_all_gt */
11974
11975 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11976                                    vector signed char __b) {
11977   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
11978 }
11979
11980 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11981                                    vector bool char __b) {
11982   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
11983 }
11984
11985 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11986                                    vector unsigned char __b) {
11987   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
11988 }
11989
11990 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11991                                    vector bool char __b) {
11992   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
11993 }
11994
11995 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
11996                                    vector signed char __b) {
11997   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
11998                                       (vector unsigned char)__b);
11999 }
12000
12001 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
12002                                    vector unsigned char __b) {
12003   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
12004 }
12005
12006 static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
12007   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
12008                                       (vector unsigned char)__b);
12009 }
12010
12011 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
12012   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
12013 }
12014
12015 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
12016   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
12017 }
12018
12019 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12020                                    vector unsigned short __b) {
12021   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
12022 }
12023
12024 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
12025                                    vector bool short __b) {
12026   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
12027                                       (vector unsigned short)__b);
12028 }
12029
12030 static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
12031   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12032                                       (vector unsigned short)__b);
12033 }
12034
12035 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12036                                    vector unsigned short __b) {
12037   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12038                                       __b);
12039 }
12040
12041 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12042                                    vector bool short __b) {
12043   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12044                                       (vector unsigned short)__b);
12045 }
12046
12047 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
12048   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
12049 }
12050
12051 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
12052   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
12053 }
12054
12055 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12056                                    vector unsigned int __b) {
12057   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
12058 }
12059
12060 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12061                                    vector bool int __b) {
12062   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
12063 }
12064
12065 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
12066   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12067                                       (vector unsigned int)__b);
12068 }
12069
12070 static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12071                                    vector unsigned int __b) {
12072   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
12073 }
12074
12075 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
12076   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12077                                       (vector unsigned int)__b);
12078 }
12079
12080 #ifdef __POWER8_VECTOR__
12081 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12082                                    vector signed long long __b) {
12083   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
12084 }
12085 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12086                                    vector bool long long __b) {
12087   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
12088                                       (vector signed long long)__b);
12089 }
12090
12091 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12092                                    vector unsigned long long __b) {
12093   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
12094 }
12095
12096 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12097                                    vector bool long long __b) {
12098   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
12099                                       (vector unsigned long long)__b);
12100 }
12101
12102 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12103                                    vector signed long long __b) {
12104   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12105                                       (vector unsigned long long)__b);
12106 }
12107
12108 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12109                                    vector unsigned long long __b) {
12110   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12111                                       __b);
12112 }
12113
12114 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12115                                    vector bool long long __b) {
12116   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12117                                       (vector unsigned long long)__b);
12118 }
12119 #endif
12120
12121 static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
12122 #ifdef __VSX__
12123   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
12124 #else
12125   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
12126 #endif
12127 }
12128
12129 #ifdef __VSX__
12130 static int __ATTRS_o_ai vec_all_gt(vector double __a, vector double __b) {
12131   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
12132 }
12133 #endif
12134
12135 /* vec_all_in */
12136
12137 static int __attribute__((__always_inline__))
12138 vec_all_in(vector float __a, vector float __b) {
12139   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
12140 }
12141
12142 /* vec_all_le */
12143
12144 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
12145                                    vector signed char __b) {
12146   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
12147 }
12148
12149 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
12150                                    vector bool char __b) {
12151   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
12152 }
12153
12154 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12155                                    vector unsigned char __b) {
12156   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
12157 }
12158
12159 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12160                                    vector bool char __b) {
12161   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
12162 }
12163
12164 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
12165                                    vector signed char __b) {
12166   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12167                                       (vector unsigned char)__b);
12168 }
12169
12170 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
12171                                    vector unsigned char __b) {
12172   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
12173 }
12174
12175 static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
12176   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12177                                       (vector unsigned char)__b);
12178 }
12179
12180 static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
12181   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
12182 }
12183
12184 static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
12185   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
12186 }
12187
12188 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12189                                    vector unsigned short __b) {
12190   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
12191 }
12192
12193 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12194                                    vector bool short __b) {
12195   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
12196                                       (vector unsigned short)__b);
12197 }
12198
12199 static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
12200   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12201                                       (vector unsigned short)__b);
12202 }
12203
12204 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
12205                                    vector unsigned short __b) {
12206   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12207                                       __b);
12208 }
12209
12210 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
12211                                    vector bool short __b) {
12212   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12213                                       (vector unsigned short)__b);
12214 }
12215
12216 static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
12217   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
12218 }
12219
12220 static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
12221   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
12222 }
12223
12224 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12225                                    vector unsigned int __b) {
12226   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
12227 }
12228
12229 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12230                                    vector bool int __b) {
12231   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
12232 }
12233
12234 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
12235   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12236                                       (vector unsigned int)__b);
12237 }
12238
12239 static int __ATTRS_o_ai vec_all_le(vector bool int __a,
12240                                    vector unsigned int __b) {
12241   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
12242 }
12243
12244 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
12245   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12246                                       (vector unsigned int)__b);
12247 }
12248
12249 #ifdef __POWER8_VECTOR__
12250 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12251                                    vector signed long long __b) {
12252   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
12253 }
12254
12255 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12256                                    vector unsigned long long __b) {
12257   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
12258 }
12259
12260 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12261                                    vector bool long long __b) {
12262   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
12263                                       (vector signed long long)__b);
12264 }
12265
12266 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12267                                    vector bool long long __b) {
12268   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
12269                                       (vector unsigned long long)__b);
12270 }
12271
12272 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12273                                    vector signed long long __b) {
12274   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12275                                       (vector unsigned long long)__b);
12276 }
12277
12278 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12279                                    vector unsigned long long __b) {
12280   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12281                                       __b);
12282 }
12283
12284 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12285                                    vector bool long long __b) {
12286   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12287                                       (vector unsigned long long)__b);
12288 }
12289 #endif
12290
12291 static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
12292 #ifdef __VSX__
12293   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
12294 #else
12295   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
12296 #endif
12297 }
12298
12299 #ifdef __VSX__
12300 static int __ATTRS_o_ai vec_all_le(vector double __a, vector double __b) {
12301   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
12302 }
12303 #endif
12304
12305 /* vec_all_lt */
12306
12307 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12308                                    vector signed char __b) {
12309   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
12310 }
12311
12312 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12313                                    vector bool char __b) {
12314   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
12315 }
12316
12317 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12318                                    vector unsigned char __b) {
12319   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
12320 }
12321
12322 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12323                                    vector bool char __b) {
12324   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
12325 }
12326
12327 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12328                                    vector signed char __b) {
12329   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12330                                       (vector unsigned char)__a);
12331 }
12332
12333 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12334                                    vector unsigned char __b) {
12335   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
12336 }
12337
12338 static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
12339   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12340                                       (vector unsigned char)__a);
12341 }
12342
12343 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
12344   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
12345 }
12346
12347 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
12348   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
12349 }
12350
12351 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12352                                    vector unsigned short __b) {
12353   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
12354 }
12355
12356 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12357                                    vector bool short __b) {
12358   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12359                                       __a);
12360 }
12361
12362 static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
12363   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12364                                       (vector unsigned short)__a);
12365 }
12366
12367 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12368                                    vector unsigned short __b) {
12369   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
12370                                       (vector unsigned short)__a);
12371 }
12372
12373 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12374                                    vector bool short __b) {
12375   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12376                                       (vector unsigned short)__a);
12377 }
12378
12379 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
12380   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
12381 }
12382
12383 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
12384   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
12385 }
12386
12387 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12388                                    vector unsigned int __b) {
12389   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
12390 }
12391
12392 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12393                                    vector bool int __b) {
12394   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
12395 }
12396
12397 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
12398   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12399                                       (vector unsigned int)__a);
12400 }
12401
12402 static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12403                                    vector unsigned int __b) {
12404   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
12405 }
12406
12407 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
12408   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12409                                       (vector unsigned int)__a);
12410 }
12411
12412 #ifdef __POWER8_VECTOR__
12413 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12414                                    vector signed long long __b) {
12415   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12416 }
12417
12418 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12419                                    vector unsigned long long __b) {
12420   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12421 }
12422
12423 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12424                                    vector bool long long __b) {
12425   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12426                                       __a);
12427 }
12428
12429 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12430                                    vector bool long long __b) {
12431   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12432                                       __a);
12433 }
12434
12435 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12436                                    vector signed long long __b) {
12437   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12438                                       (vector unsigned long long)__a);
12439 }
12440
12441 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12442                                    vector unsigned long long __b) {
12443   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12444                                       (vector unsigned long long)__a);
12445 }
12446
12447 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12448                                    vector bool long long __b) {
12449   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12450                                       (vector unsigned long long)__a);
12451 }
12452 #endif
12453
12454 static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
12455 #ifdef __VSX__
12456   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
12457 #else
12458   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
12459 #endif
12460 }
12461
12462 #ifdef __VSX__
12463 static int __ATTRS_o_ai vec_all_lt(vector double __a, vector double __b) {
12464   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
12465 }
12466 #endif
12467
12468 /* vec_all_nan */
12469
12470 static int __ATTRS_o_ai vec_all_nan(vector float __a) {
12471 #ifdef __VSX__
12472   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
12473 #else
12474   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
12475 #endif
12476 }
12477
12478 #ifdef __VSX__
12479 static int __ATTRS_o_ai vec_all_nan(vector double __a) {
12480   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
12481 }
12482 #endif
12483
12484 /* vec_all_ne */
12485
12486 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12487                                    vector signed char __b) {
12488   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12489                                       (vector char)__b);
12490 }
12491
12492 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12493                                    vector bool char __b) {
12494   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12495                                       (vector char)__b);
12496 }
12497
12498 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12499                                    vector unsigned char __b) {
12500   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12501                                       (vector char)__b);
12502 }
12503
12504 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12505                                    vector bool char __b) {
12506   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12507                                       (vector char)__b);
12508 }
12509
12510 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12511                                    vector signed char __b) {
12512   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12513                                       (vector char)__b);
12514 }
12515
12516 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12517                                    vector unsigned char __b) {
12518   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12519                                       (vector char)__b);
12520 }
12521
12522 static int __ATTRS_o_ai vec_all_ne(vector bool char __a, vector bool char __b) {
12523   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12524                                       (vector char)__b);
12525 }
12526
12527 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
12528   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
12529 }
12530
12531 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
12532   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
12533 }
12534
12535 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12536                                    vector unsigned short __b) {
12537   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12538                                       (vector short)__b);
12539 }
12540
12541 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12542                                    vector bool short __b) {
12543   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12544                                       (vector short)__b);
12545 }
12546
12547 static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
12548   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12549                                       (vector short)__b);
12550 }
12551
12552 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12553                                    vector unsigned short __b) {
12554   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12555                                       (vector short)__b);
12556 }
12557
12558 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12559                                    vector bool short __b) {
12560   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12561                                       (vector short)__b);
12562 }
12563
12564 static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
12565   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12566                                       (vector short)__b);
12567 }
12568
12569 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
12570   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
12571 }
12572
12573 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
12574   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
12575 }
12576
12577 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12578                                    vector unsigned int __b) {
12579   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12580                                       (vector int)__b);
12581 }
12582
12583 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12584                                    vector bool int __b) {
12585   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12586                                       (vector int)__b);
12587 }
12588
12589 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
12590   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12591                                       (vector int)__b);
12592 }
12593
12594 static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
12595                                    vector unsigned int __b) {
12596   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12597                                       (vector int)__b);
12598 }
12599
12600 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
12601   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12602                                       (vector int)__b);
12603 }
12604
12605 #ifdef __POWER8_VECTOR__
12606 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12607                                    vector signed long long __b) {
12608   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12609 }
12610
12611 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12612                                    vector unsigned long long __b) {
12613   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12614                                       (vector long long)__b);
12615 }
12616
12617 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12618                                    vector bool long long __b) {
12619   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12620                                       (vector signed long long)__b);
12621 }
12622
12623 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12624                                    vector bool long long __b) {
12625   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12626                                       (vector signed long long)__b);
12627 }
12628
12629 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12630                                    vector signed long long __b) {
12631   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12632                                       (vector signed long long)__b);
12633 }
12634
12635 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12636                                    vector unsigned long long __b) {
12637   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12638                                       (vector signed long long)__b);
12639 }
12640
12641 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12642                                    vector bool long long __b) {
12643   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12644                                       (vector signed long long)__b);
12645 }
12646 #endif
12647
12648 static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
12649 #ifdef __VSX__
12650   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
12651 #else
12652   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
12653 #endif
12654 }
12655
12656 #ifdef __VSX__
12657 static int __ATTRS_o_ai vec_all_ne(vector double __a, vector double __b) {
12658   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
12659 }
12660 #endif
12661
12662 /* vec_all_nge */
12663
12664 static int __ATTRS_o_ai
12665 vec_all_nge(vector float __a, vector float __b) {
12666 #ifdef __VSX__
12667   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
12668 #else
12669   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
12670 #endif
12671 }
12672
12673 #ifdef __VSX__
12674 static int __ATTRS_o_ai
12675 vec_all_nge(vector double __a, vector double __b) {
12676   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
12677 }
12678 #endif
12679
12680 /* vec_all_ngt */
12681
12682 static int __ATTRS_o_ai
12683 vec_all_ngt(vector float __a, vector float __b) {
12684 #ifdef __VSX__
12685   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
12686 #else
12687   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
12688 #endif
12689 }
12690
12691 #ifdef __VSX__
12692 static int __ATTRS_o_ai
12693 vec_all_ngt(vector double __a, vector double __b) {
12694   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
12695 }
12696 #endif
12697
12698 /* vec_all_nle */
12699
12700 static int __attribute__((__always_inline__))
12701 vec_all_nle(vector float __a, vector float __b) {
12702   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
12703 }
12704
12705 /* vec_all_nlt */
12706
12707 static int __attribute__((__always_inline__))
12708 vec_all_nlt(vector float __a, vector float __b) {
12709   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
12710 }
12711
12712 /* vec_all_numeric */
12713
12714 static int __attribute__((__always_inline__))
12715 vec_all_numeric(vector float __a) {
12716   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
12717 }
12718
12719 /* vec_any_eq */
12720
12721 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12722                                    vector signed char __b) {
12723   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12724                                       (vector char)__b);
12725 }
12726
12727 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12728                                    vector bool char __b) {
12729   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12730                                       (vector char)__b);
12731 }
12732
12733 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12734                                    vector unsigned char __b) {
12735   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12736                                       (vector char)__b);
12737 }
12738
12739 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12740                                    vector bool char __b) {
12741   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12742                                       (vector char)__b);
12743 }
12744
12745 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12746                                    vector signed char __b) {
12747   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12748                                       (vector char)__b);
12749 }
12750
12751 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12752                                    vector unsigned char __b) {
12753   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12754                                       (vector char)__b);
12755 }
12756
12757 static int __ATTRS_o_ai vec_any_eq(vector bool char __a, vector bool char __b) {
12758   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12759                                       (vector char)__b);
12760 }
12761
12762 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
12763   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
12764 }
12765
12766 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
12767   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
12768 }
12769
12770 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12771                                    vector unsigned short __b) {
12772   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12773                                       (vector short)__b);
12774 }
12775
12776 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12777                                    vector bool short __b) {
12778   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12779                                       (vector short)__b);
12780 }
12781
12782 static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
12783   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12784                                       (vector short)__b);
12785 }
12786
12787 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12788                                    vector unsigned short __b) {
12789   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12790                                       (vector short)__b);
12791 }
12792
12793 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12794                                    vector bool short __b) {
12795   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12796                                       (vector short)__b);
12797 }
12798
12799 static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
12800   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12801                                       (vector short)__b);
12802 }
12803
12804 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
12805   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
12806 }
12807
12808 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
12809   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
12810 }
12811
12812 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12813                                    vector unsigned int __b) {
12814   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12815                                       (vector int)__b);
12816 }
12817
12818 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12819                                    vector bool int __b) {
12820   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12821                                       (vector int)__b);
12822 }
12823
12824 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
12825   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12826                                       (vector int)__b);
12827 }
12828
12829 static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
12830                                    vector unsigned int __b) {
12831   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12832                                       (vector int)__b);
12833 }
12834
12835 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
12836   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12837                                       (vector int)__b);
12838 }
12839
12840 #ifdef __POWER8_VECTOR__
12841 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12842                                    vector signed long long __b) {
12843   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12844 }
12845
12846 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12847                                    vector unsigned long long __b) {
12848   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12849                                       (vector long long)__b);
12850 }
12851
12852 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12853                                    vector bool long long __b) {
12854   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12855                                       (vector signed long long)__b);
12856 }
12857
12858 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12859                                    vector bool long long __b) {
12860   return __builtin_altivec_vcmpequd_p(
12861       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12862 }
12863
12864 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12865                                    vector signed long long __b) {
12866   return __builtin_altivec_vcmpequd_p(
12867       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12868 }
12869
12870 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12871                                    vector unsigned long long __b) {
12872   return __builtin_altivec_vcmpequd_p(
12873       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12874 }
12875
12876 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12877                                    vector bool long long __b) {
12878   return __builtin_altivec_vcmpequd_p(
12879       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12880 }
12881 #endif
12882
12883 static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
12884 #ifdef __VSX__
12885   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
12886 #else
12887   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
12888 #endif
12889 }
12890
12891 #ifdef __VSX__
12892 static int __ATTRS_o_ai vec_any_eq(vector double __a, vector double __b) {
12893   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
12894 }
12895 #endif
12896
12897 /* vec_any_ge */
12898
12899 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12900                                    vector signed char __b) {
12901   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
12902 }
12903
12904 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12905                                    vector bool char __b) {
12906   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
12907                                       __a);
12908 }
12909
12910 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12911                                    vector unsigned char __b) {
12912   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
12913 }
12914
12915 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12916                                    vector bool char __b) {
12917   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12918                                       __a);
12919 }
12920
12921 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12922                                    vector signed char __b) {
12923   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12924                                       (vector unsigned char)__a);
12925 }
12926
12927 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12928                                    vector unsigned char __b) {
12929   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
12930                                       (vector unsigned char)__a);
12931 }
12932
12933 static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
12934   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12935                                       (vector unsigned char)__a);
12936 }
12937
12938 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
12939   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
12940 }
12941
12942 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
12943   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
12944 }
12945
12946 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12947                                    vector unsigned short __b) {
12948   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
12949 }
12950
12951 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12952                                    vector bool short __b) {
12953   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12954                                       __a);
12955 }
12956
12957 static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
12958   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12959                                       (vector unsigned short)__a);
12960 }
12961
12962 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12963                                    vector unsigned short __b) {
12964   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
12965                                       (vector unsigned short)__a);
12966 }
12967
12968 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12969                                    vector bool short __b) {
12970   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12971                                       (vector unsigned short)__a);
12972 }
12973
12974 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
12975   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
12976 }
12977
12978 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
12979   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
12980 }
12981
12982 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12983                                    vector unsigned int __b) {
12984   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
12985 }
12986
12987 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12988                                    vector bool int __b) {
12989   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12990                                       __a);
12991 }
12992
12993 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
12994   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12995                                       (vector unsigned int)__a);
12996 }
12997
12998 static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
12999                                    vector unsigned int __b) {
13000   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
13001                                       (vector unsigned int)__a);
13002 }
13003
13004 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
13005   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
13006                                       (vector unsigned int)__a);
13007 }
13008
13009 #ifdef __POWER8_VECTOR__
13010 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13011                                    vector signed long long __b) {
13012   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
13013 }
13014
13015 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13016                                    vector unsigned long long __b) {
13017   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
13018 }
13019
13020 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
13021                                    vector bool long long __b) {
13022   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
13023                                       (vector signed long long)__b, __a);
13024 }
13025
13026 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
13027                                    vector bool long long __b) {
13028   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13029                                       (vector unsigned long long)__b, __a);
13030 }
13031
13032 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13033                                    vector signed long long __b) {
13034   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13035                                       (vector unsigned long long)__b,
13036                                       (vector unsigned long long)__a);
13037 }
13038
13039 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13040                                    vector unsigned long long __b) {
13041   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
13042                                       (vector unsigned long long)__a);
13043 }
13044
13045 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13046                                    vector bool long long __b) {
13047   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13048                                       (vector unsigned long long)__b,
13049                                       (vector unsigned long long)__a);
13050 }
13051 #endif
13052
13053 static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
13054 #ifdef __VSX__
13055   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
13056 #else
13057   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
13058 #endif
13059 }
13060
13061 #ifdef __VSX__
13062 static int __ATTRS_o_ai vec_any_ge(vector double __a, vector double __b) {
13063   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
13064 }
13065 #endif
13066
13067 /* vec_any_gt */
13068
13069 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13070                                    vector signed char __b) {
13071   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
13072 }
13073
13074 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13075                                    vector bool char __b) {
13076   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
13077                                       (vector signed char)__b);
13078 }
13079
13080 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13081                                    vector unsigned char __b) {
13082   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
13083 }
13084
13085 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13086                                    vector bool char __b) {
13087   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
13088                                       (vector unsigned char)__b);
13089 }
13090
13091 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13092                                    vector signed char __b) {
13093   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13094                                       (vector unsigned char)__b);
13095 }
13096
13097 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13098                                    vector unsigned char __b) {
13099   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13100                                       __b);
13101 }
13102
13103 static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
13104   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13105                                       (vector unsigned char)__b);
13106 }
13107
13108 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
13109   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
13110 }
13111
13112 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
13113   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
13114 }
13115
13116 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13117                                    vector unsigned short __b) {
13118   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
13119 }
13120
13121 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13122                                    vector bool short __b) {
13123   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
13124                                       (vector unsigned short)__b);
13125 }
13126
13127 static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
13128   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13129                                       (vector unsigned short)__b);
13130 }
13131
13132 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13133                                    vector unsigned short __b) {
13134   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13135                                       __b);
13136 }
13137
13138 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13139                                    vector bool short __b) {
13140   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13141                                       (vector unsigned short)__b);
13142 }
13143
13144 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
13145   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
13146 }
13147
13148 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
13149   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
13150 }
13151
13152 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13153                                    vector unsigned int __b) {
13154   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
13155 }
13156
13157 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13158                                    vector bool int __b) {
13159   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
13160                                       (vector unsigned int)__b);
13161 }
13162
13163 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
13164   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13165                                       (vector unsigned int)__b);
13166 }
13167
13168 static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13169                                    vector unsigned int __b) {
13170   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13171                                       __b);
13172 }
13173
13174 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
13175   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13176                                       (vector unsigned int)__b);
13177 }
13178
13179 #ifdef __POWER8_VECTOR__
13180 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13181                                    vector signed long long __b) {
13182   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
13183 }
13184
13185 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13186                                    vector unsigned long long __b) {
13187   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
13188 }
13189
13190 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13191                                    vector bool long long __b) {
13192   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
13193                                       (vector signed long long)__b);
13194 }
13195
13196 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13197                                    vector bool long long __b) {
13198   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
13199                                       (vector unsigned long long)__b);
13200 }
13201
13202 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13203                                    vector signed long long __b) {
13204   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13205                                       (vector unsigned long long)__a,
13206                                       (vector unsigned long long)__b);
13207 }
13208
13209 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13210                                    vector unsigned long long __b) {
13211   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13212                                       (vector unsigned long long)__a, __b);
13213 }
13214
13215 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13216                                    vector bool long long __b) {
13217   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13218                                       (vector unsigned long long)__a,
13219                                       (vector unsigned long long)__b);
13220 }
13221 #endif
13222
13223 static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
13224 #ifdef __VSX__
13225   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
13226 #else
13227   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
13228 #endif
13229 }
13230
13231 #ifdef __VSX__
13232 static int __ATTRS_o_ai vec_any_gt(vector double __a, vector double __b) {
13233   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
13234 }
13235 #endif
13236
13237 /* vec_any_le */
13238
13239 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
13240                                    vector signed char __b) {
13241   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
13242 }
13243
13244 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
13245                                    vector bool char __b) {
13246   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
13247                                       (vector signed char)__b);
13248 }
13249
13250 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13251                                    vector unsigned char __b) {
13252   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
13253 }
13254
13255 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13256                                    vector bool char __b) {
13257   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
13258                                       (vector unsigned char)__b);
13259 }
13260
13261 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
13262                                    vector signed char __b) {
13263   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13264                                       (vector unsigned char)__b);
13265 }
13266
13267 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
13268                                    vector unsigned char __b) {
13269   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13270                                       __b);
13271 }
13272
13273 static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
13274   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13275                                       (vector unsigned char)__b);
13276 }
13277
13278 static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
13279   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
13280 }
13281
13282 static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
13283   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
13284 }
13285
13286 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13287                                    vector unsigned short __b) {
13288   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
13289 }
13290
13291 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13292                                    vector bool short __b) {
13293   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
13294                                       (vector unsigned short)__b);
13295 }
13296
13297 static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
13298   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13299                                       (vector unsigned short)__b);
13300 }
13301
13302 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
13303                                    vector unsigned short __b) {
13304   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13305                                       __b);
13306 }
13307
13308 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
13309                                    vector bool short __b) {
13310   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13311                                       (vector unsigned short)__b);
13312 }
13313
13314 static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
13315   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
13316 }
13317
13318 static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
13319   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
13320 }
13321
13322 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13323                                    vector unsigned int __b) {
13324   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
13325 }
13326
13327 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13328                                    vector bool int __b) {
13329   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
13330                                       (vector unsigned int)__b);
13331 }
13332
13333 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
13334   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13335                                       (vector unsigned int)__b);
13336 }
13337
13338 static int __ATTRS_o_ai vec_any_le(vector bool int __a,
13339                                    vector unsigned int __b) {
13340   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13341                                       __b);
13342 }
13343
13344 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
13345   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13346                                       (vector unsigned int)__b);
13347 }
13348
13349 #ifdef __POWER8_VECTOR__
13350 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13351                                    vector signed long long __b) {
13352   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13353 }
13354
13355 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13356                                    vector unsigned long long __b) {
13357   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13358 }
13359
13360 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13361                                    vector bool long long __b) {
13362   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13363                                       (vector signed long long)__b);
13364 }
13365
13366 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13367                                    vector bool long long __b) {
13368   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13369                                       (vector unsigned long long)__b);
13370 }
13371
13372 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13373                                    vector signed long long __b) {
13374   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13375                                       (vector unsigned long long)__a,
13376                                       (vector unsigned long long)__b);
13377 }
13378
13379 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13380                                    vector unsigned long long __b) {
13381   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13382                                       (vector unsigned long long)__a, __b);
13383 }
13384
13385 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13386                                    vector bool long long __b) {
13387   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13388                                       (vector unsigned long long)__a,
13389                                       (vector unsigned long long)__b);
13390 }
13391 #endif
13392
13393 static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
13394 #ifdef __VSX__
13395   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
13396 #else
13397   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
13398 #endif
13399 }
13400
13401 #ifdef __VSX__
13402 static int __ATTRS_o_ai vec_any_le(vector double __a, vector double __b) {
13403   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
13404 }
13405 #endif
13406
13407 /* vec_any_lt */
13408
13409 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13410                                    vector signed char __b) {
13411   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
13412 }
13413
13414 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13415                                    vector bool char __b) {
13416   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
13417                                       __a);
13418 }
13419
13420 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13421                                    vector unsigned char __b) {
13422   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
13423 }
13424
13425 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13426                                    vector bool char __b) {
13427   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13428                                       __a);
13429 }
13430
13431 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13432                                    vector signed char __b) {
13433   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13434                                       (vector unsigned char)__a);
13435 }
13436
13437 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13438                                    vector unsigned char __b) {
13439   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
13440                                       (vector unsigned char)__a);
13441 }
13442
13443 static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
13444   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13445                                       (vector unsigned char)__a);
13446 }
13447
13448 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
13449   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
13450 }
13451
13452 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
13453   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
13454 }
13455
13456 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13457                                    vector unsigned short __b) {
13458   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
13459 }
13460
13461 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13462                                    vector bool short __b) {
13463   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13464                                       __a);
13465 }
13466
13467 static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
13468   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13469                                       (vector unsigned short)__a);
13470 }
13471
13472 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13473                                    vector unsigned short __b) {
13474   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
13475                                       (vector unsigned short)__a);
13476 }
13477
13478 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13479                                    vector bool short __b) {
13480   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13481                                       (vector unsigned short)__a);
13482 }
13483
13484 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
13485   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
13486 }
13487
13488 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
13489   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
13490 }
13491
13492 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13493                                    vector unsigned int __b) {
13494   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
13495 }
13496
13497 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13498                                    vector bool int __b) {
13499   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13500                                       __a);
13501 }
13502
13503 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
13504   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13505                                       (vector unsigned int)__a);
13506 }
13507
13508 static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
13509                                    vector unsigned int __b) {
13510   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
13511                                       (vector unsigned int)__a);
13512 }
13513
13514 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
13515   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13516                                       (vector unsigned int)__a);
13517 }
13518
13519 #ifdef __POWER8_VECTOR__
13520 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13521                                    vector signed long long __b) {
13522   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13523 }
13524
13525 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13526                                    vector unsigned long long __b) {
13527   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13528 }
13529
13530 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13531                                    vector bool long long __b) {
13532   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13533                                       (vector signed long long)__b, __a);
13534 }
13535
13536 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13537                                    vector bool long long __b) {
13538   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13539                                       (vector unsigned long long)__b, __a);
13540 }
13541
13542 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13543                                    vector signed long long __b) {
13544   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13545                                       (vector unsigned long long)__b,
13546                                       (vector unsigned long long)__a);
13547 }
13548
13549 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13550                                    vector unsigned long long __b) {
13551   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13552                                       (vector unsigned long long)__a);
13553 }
13554
13555 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13556                                    vector bool long long __b) {
13557   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13558                                       (vector unsigned long long)__b,
13559                                       (vector unsigned long long)__a);
13560 }
13561 #endif
13562
13563 static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
13564 #ifdef __VSX__
13565   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
13566 #else
13567   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
13568 #endif
13569 }
13570
13571 #ifdef __VSX__
13572 static int __ATTRS_o_ai vec_any_lt(vector double __a, vector double __b) {
13573   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
13574 }
13575 #endif
13576
13577 /* vec_any_nan */
13578
13579 static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
13580   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
13581 }
13582
13583 /* vec_any_ne */
13584
13585 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13586                                    vector signed char __b) {
13587   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13588                                       (vector char)__b);
13589 }
13590
13591 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13592                                    vector bool char __b) {
13593   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13594                                       (vector char)__b);
13595 }
13596
13597 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13598                                    vector unsigned char __b) {
13599   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13600                                       (vector char)__b);
13601 }
13602
13603 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13604                                    vector bool char __b) {
13605   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13606                                       (vector char)__b);
13607 }
13608
13609 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13610                                    vector signed char __b) {
13611   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13612                                       (vector char)__b);
13613 }
13614
13615 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13616                                    vector unsigned char __b) {
13617   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13618                                       (vector char)__b);
13619 }
13620
13621 static int __ATTRS_o_ai vec_any_ne(vector bool char __a, vector bool char __b) {
13622   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13623                                       (vector char)__b);
13624 }
13625
13626 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
13627   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
13628 }
13629
13630 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
13631   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
13632 }
13633
13634 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13635                                    vector unsigned short __b) {
13636   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13637                                       (vector short)__b);
13638 }
13639
13640 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13641                                    vector bool short __b) {
13642   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13643                                       (vector short)__b);
13644 }
13645
13646 static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
13647   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13648                                       (vector short)__b);
13649 }
13650
13651 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13652                                    vector unsigned short __b) {
13653   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13654                                       (vector short)__b);
13655 }
13656
13657 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13658                                    vector bool short __b) {
13659   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13660                                       (vector short)__b);
13661 }
13662
13663 static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
13664   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13665                                       (vector short)__b);
13666 }
13667
13668 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
13669   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
13670 }
13671
13672 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
13673   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
13674 }
13675
13676 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13677                                    vector unsigned int __b) {
13678   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13679                                       (vector int)__b);
13680 }
13681
13682 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13683                                    vector bool int __b) {
13684   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13685                                       (vector int)__b);
13686 }
13687
13688 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
13689   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13690                                       (vector int)__b);
13691 }
13692
13693 static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
13694                                    vector unsigned int __b) {
13695   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13696                                       (vector int)__b);
13697 }
13698
13699 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
13700   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13701                                       (vector int)__b);
13702 }
13703
13704 #ifdef __POWER8_VECTOR__
13705 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13706                                    vector signed long long __b) {
13707   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13708 }
13709
13710 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13711                                    vector unsigned long long __b) {
13712   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13713                                       (vector long long)__b);
13714 }
13715
13716 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13717                                    vector bool long long __b) {
13718   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13719                                       (vector signed long long)__b);
13720 }
13721
13722 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13723                                    vector bool long long __b) {
13724   return __builtin_altivec_vcmpequd_p(
13725       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13726 }
13727
13728 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13729                                    vector signed long long __b) {
13730   return __builtin_altivec_vcmpequd_p(
13731       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13732 }
13733
13734 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13735                                    vector unsigned long long __b) {
13736   return __builtin_altivec_vcmpequd_p(
13737       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13738 }
13739
13740 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13741                                    vector bool long long __b) {
13742   return __builtin_altivec_vcmpequd_p(
13743       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13744 }
13745 #endif
13746
13747 static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
13748 #ifdef __VSX__
13749   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
13750 #else
13751   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
13752 #endif
13753 }
13754
13755 #ifdef __VSX__
13756 static int __ATTRS_o_ai vec_any_ne(vector double __a, vector double __b) {
13757   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
13758 }
13759 #endif
13760
13761 /* vec_any_nge */
13762
13763 static int __attribute__((__always_inline__))
13764 vec_any_nge(vector float __a, vector float __b) {
13765   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
13766 }
13767
13768 /* vec_any_ngt */
13769
13770 static int __attribute__((__always_inline__))
13771 vec_any_ngt(vector float __a, vector float __b) {
13772   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
13773 }
13774
13775 /* vec_any_nle */
13776
13777 static int __attribute__((__always_inline__))
13778 vec_any_nle(vector float __a, vector float __b) {
13779   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
13780 }
13781
13782 /* vec_any_nlt */
13783
13784 static int __attribute__((__always_inline__))
13785 vec_any_nlt(vector float __a, vector float __b) {
13786   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
13787 }
13788
13789 /* vec_any_numeric */
13790
13791 static int __attribute__((__always_inline__))
13792 vec_any_numeric(vector float __a) {
13793   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
13794 }
13795
13796 /* vec_any_out */
13797
13798 static int __attribute__((__always_inline__))
13799 vec_any_out(vector float __a, vector float __b) {
13800   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
13801 }
13802
13803 /* Power 8 Crypto functions
13804 Note: We diverge from the current GCC implementation with regard
13805 to cryptography and related functions as follows:
13806 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13807 - The remaining ones are only available on Power8 and up so
13808   require -mpower8-vector
13809 The justification for this is that export requirements require that
13810 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13811 support). As a result, we need to be able to turn off support for those.
13812 The remaining ones (currently controlled by -mcrypto for GCC) still
13813 need to be provided on compliant hardware even if Vector.Crypto is not
13814 provided.
13815 */
13816 #ifdef __CRYPTO__
13817 #define vec_sbox_be __builtin_altivec_crypto_vsbox
13818 #define vec_cipher_be __builtin_altivec_crypto_vcipher
13819 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
13820 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
13821 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
13822
13823 static vector unsigned long long __attribute__((__always_inline__))
13824 __builtin_crypto_vsbox(vector unsigned long long __a) {
13825   return __builtin_altivec_crypto_vsbox(__a);
13826 }
13827
13828 static vector unsigned long long __attribute__((__always_inline__))
13829 __builtin_crypto_vcipher(vector unsigned long long __a,
13830                          vector unsigned long long __b) {
13831   return __builtin_altivec_crypto_vcipher(__a, __b);
13832 }
13833
13834 static vector unsigned long long __attribute__((__always_inline__))
13835 __builtin_crypto_vcipherlast(vector unsigned long long __a,
13836                              vector unsigned long long __b) {
13837   return __builtin_altivec_crypto_vcipherlast(__a, __b);
13838 }
13839
13840 static vector unsigned long long __attribute__((__always_inline__))
13841 __builtin_crypto_vncipher(vector unsigned long long __a,
13842                           vector unsigned long long __b) {
13843   return __builtin_altivec_crypto_vncipher(__a, __b);
13844 }
13845
13846 static vector unsigned long long __attribute__((__always_inline__))
13847 __builtin_crypto_vncipherlast(vector unsigned long long __a,
13848                               vector unsigned long long __b) {
13849   return __builtin_altivec_crypto_vncipherlast(__a, __b);
13850 }
13851
13852 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13853 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13854
13855 #define vec_shasigma_be(X, Y, Z) \
13856   _Generic((X), vector unsigned int: __builtin_crypto_vshasigmaw, \
13857                 vector unsigned long long: __builtin_crypto_vshasigmad) \
13858 ((X), (Y), (Z))
13859 #endif
13860
13861 #ifdef __POWER8_VECTOR__
13862 static vector unsigned char __ATTRS_o_ai
13863 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
13864                           vector unsigned char __c) {
13865   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13866 }
13867
13868 static vector unsigned short __ATTRS_o_ai
13869 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
13870                           vector unsigned short __c) {
13871   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
13872       (vector unsigned char)__a, (vector unsigned char)__b,
13873       (vector unsigned char)__c);
13874 }
13875
13876 static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
13877     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
13878   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
13879       (vector unsigned char)__a, (vector unsigned char)__b,
13880       (vector unsigned char)__c);
13881 }
13882
13883 static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
13884     vector unsigned long long __a, vector unsigned long long __b,
13885     vector unsigned long long __c) {
13886   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
13887       (vector unsigned char)__a, (vector unsigned char)__b,
13888       (vector unsigned char)__c);
13889 }
13890
13891 static vector unsigned char __ATTRS_o_ai
13892 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
13893   return __builtin_altivec_crypto_vpmsumb(__a, __b);
13894 }
13895
13896 static vector unsigned short __ATTRS_o_ai
13897 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
13898   return __builtin_altivec_crypto_vpmsumh(__a, __b);
13899 }
13900
13901 static vector unsigned int __ATTRS_o_ai
13902 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
13903   return __builtin_altivec_crypto_vpmsumw(__a, __b);
13904 }
13905
13906 static vector unsigned long long __ATTRS_o_ai
13907 __builtin_crypto_vpmsumb(vector unsigned long long __a,
13908                          vector unsigned long long __b) {
13909   return __builtin_altivec_crypto_vpmsumd(__a, __b);
13910 }
13911
13912 static vector signed char __ATTRS_o_ai vec_vgbbd (vector signed char __a)
13913 {
13914   return __builtin_altivec_vgbbd((vector unsigned char) __a);
13915 }
13916
13917 #define vec_pmsum_be __builtin_crypto_vpmsumb
13918 #define vec_gb __builtin_altivec_vgbbd
13919
13920 static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a)
13921 {
13922   return __builtin_altivec_vgbbd(__a);
13923 }
13924
13925 static vector long long __ATTRS_o_ai
13926 vec_vbpermq (vector signed char __a, vector signed char __b)
13927 {
13928   return __builtin_altivec_vbpermq((vector unsigned char) __a,
13929                                    (vector unsigned char) __b);
13930 }
13931
13932 static vector long long __ATTRS_o_ai
13933 vec_vbpermq (vector unsigned char __a, vector unsigned char __b)
13934 {
13935   return __builtin_altivec_vbpermq(__a, __b);
13936 }
13937
13938 #ifdef __powerpc64__
13939 static vector unsigned long long __attribute__((__always_inline__))
13940 vec_bperm (vector unsigned __int128 __a, vector unsigned char __b) {
13941   return __builtin_altivec_vbpermq((vector unsigned char) __a,
13942                                    (vector unsigned char) __b);
13943 }
13944 #endif
13945 #endif
13946
13947 #undef __ATTRS_o_ai
13948
13949 #endif /* __ALTIVEC_H */