]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/altivec.h
Update clang to trunk r256633.
[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 /* vec_vcfsx */
1895
1896 static vector float __attribute__((__always_inline__))
1897 vec_vcfsx(vector int __a, int __b) {
1898   return __builtin_altivec_vcfsx(__a, __b);
1899 }
1900
1901 /* vec_vcfux */
1902
1903 static vector float __attribute__((__always_inline__))
1904 vec_vcfux(vector unsigned int __a, int __b) {
1905   return __builtin_altivec_vcfux((vector int)__a, __b);
1906 }
1907
1908 /* vec_cts */
1909
1910 static vector int __attribute__((__always_inline__))
1911 vec_cts(vector float __a, int __b) {
1912   return __builtin_altivec_vctsxs(__a, __b);
1913 }
1914
1915 /* vec_vctsxs */
1916
1917 static vector int __attribute__((__always_inline__))
1918 vec_vctsxs(vector float __a, int __b) {
1919   return __builtin_altivec_vctsxs(__a, __b);
1920 }
1921
1922 /* vec_ctu */
1923
1924 static vector unsigned int __attribute__((__always_inline__))
1925 vec_ctu(vector float __a, int __b) {
1926   return __builtin_altivec_vctuxs(__a, __b);
1927 }
1928
1929 /* vec_vctuxs */
1930
1931 static vector unsigned int __attribute__((__always_inline__))
1932 vec_vctuxs(vector float __a, int __b) {
1933   return __builtin_altivec_vctuxs(__a, __b);
1934 }
1935
1936 /* vec_double */
1937
1938 #ifdef __VSX__
1939 static vector double __ATTRS_o_ai vec_double (vector signed long long __a) {
1940   vector double __ret = { __a[0], __a[1] };
1941   return __ret;
1942 }
1943
1944 static vector double __ATTRS_o_ai vec_double (vector unsigned long long __a) {
1945   vector double __ret = { __a[0], __a[1] };
1946   return __ret;
1947 }
1948 #endif
1949
1950 /* vec_div */
1951
1952 /* Integer vector divides (vectors are scalarized, elements divided
1953    and the vectors reassembled).
1954 */
1955 static vector signed char __ATTRS_o_ai vec_div(vector signed char __a,
1956                                                vector signed char __b) {
1957   return __a / __b;
1958 }
1959
1960 static vector unsigned char __ATTRS_o_ai vec_div(vector unsigned char __a,
1961                                                  vector unsigned char __b) {
1962   return __a / __b;
1963 }
1964
1965 static vector signed short __ATTRS_o_ai vec_div(vector signed short __a,
1966                                                 vector signed short __b) {
1967   return __a / __b;
1968 }
1969
1970 static vector unsigned short __ATTRS_o_ai vec_div(vector unsigned short __a,
1971                                                   vector unsigned short __b) {
1972   return __a / __b;
1973 }
1974
1975 static vector signed int __ATTRS_o_ai vec_div(vector signed int __a,
1976                                               vector signed int __b) {
1977   return __a / __b;
1978 }
1979
1980 static vector unsigned int __ATTRS_o_ai vec_div(vector unsigned int __a,
1981                                                 vector unsigned int __b) {
1982   return __a / __b;
1983 }
1984
1985 #ifdef __VSX__
1986 static vector signed long long __ATTRS_o_ai
1987 vec_div(vector signed long long __a, vector signed long long __b) {
1988   return __a / __b;
1989 }
1990
1991 static vector unsigned long long __ATTRS_o_ai
1992 vec_div(vector unsigned long long __a, vector unsigned long long __b) {
1993   return __a / __b;
1994 }
1995
1996 static vector float __ATTRS_o_ai vec_div(vector float __a, vector float __b) {
1997   return __a / __b;
1998 }
1999
2000 static vector double __ATTRS_o_ai vec_div(vector double __a,
2001                                           vector double __b) {
2002   return __a / __b;
2003 }
2004 #endif
2005
2006 /* vec_dss */
2007
2008 static void __attribute__((__always_inline__)) vec_dss(int __a) {
2009   __builtin_altivec_dss(__a);
2010 }
2011
2012 /* vec_dssall */
2013
2014 static void __attribute__((__always_inline__)) vec_dssall(void) {
2015   __builtin_altivec_dssall();
2016 }
2017
2018 /* vec_dst */
2019
2020 static void __attribute__((__always_inline__))
2021 vec_dst(const void *__a, int __b, int __c) {
2022   __builtin_altivec_dst(__a, __b, __c);
2023 }
2024
2025 /* vec_dstst */
2026
2027 static void __attribute__((__always_inline__))
2028 vec_dstst(const void *__a, int __b, int __c) {
2029   __builtin_altivec_dstst(__a, __b, __c);
2030 }
2031
2032 /* vec_dststt */
2033
2034 static void __attribute__((__always_inline__))
2035 vec_dststt(const void *__a, int __b, int __c) {
2036   __builtin_altivec_dststt(__a, __b, __c);
2037 }
2038
2039 /* vec_dstt */
2040
2041 static void __attribute__((__always_inline__))
2042 vec_dstt(const void *__a, int __b, int __c) {
2043   __builtin_altivec_dstt(__a, __b, __c);
2044 }
2045
2046 /* vec_eqv */
2047
2048 #ifdef __POWER8_VECTOR__
2049 static vector signed char __ATTRS_o_ai vec_eqv(vector signed char __a,
2050                                                vector signed char __b) {
2051   return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2052                                                   (vector unsigned int)__b);
2053 }
2054
2055 static vector unsigned char __ATTRS_o_ai vec_eqv(vector unsigned char __a,
2056                                                  vector unsigned char __b) {
2057   return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2058                                                     (vector unsigned int)__b);
2059 }
2060
2061 static vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
2062                                              vector bool char __b) {
2063   return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
2064                                                 (vector unsigned int)__b);
2065 }
2066
2067 static vector signed short __ATTRS_o_ai vec_eqv(vector signed short __a,
2068                                                 vector signed short __b) {
2069   return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2070                                                    (vector unsigned int)__b);
2071 }
2072
2073 static vector unsigned short __ATTRS_o_ai vec_eqv(vector unsigned short __a,
2074                                                   vector unsigned short __b) {
2075   return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2076                                                      (vector unsigned int)__b);
2077 }
2078
2079 static vector bool short __ATTRS_o_ai vec_eqv(vector bool short __a,
2080                                               vector bool short __b) {
2081   return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
2082                                                  (vector unsigned int)__b);
2083 }
2084
2085 static vector signed int __ATTRS_o_ai vec_eqv(vector signed int __a,
2086                                               vector signed int __b) {
2087   return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2088                                                  (vector unsigned int)__b);
2089 }
2090
2091 static vector unsigned int __ATTRS_o_ai vec_eqv(vector unsigned int __a,
2092                                                 vector unsigned int __b) {
2093   return __builtin_vsx_xxleqv(__a, __b);
2094 }
2095
2096 static vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
2097                                             vector bool int __b) {
2098   return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
2099                                                  (vector unsigned int)__b);
2100 }
2101
2102 static vector signed long long __ATTRS_o_ai
2103 vec_eqv(vector signed long long __a, vector signed long long __b) {
2104   return (vector signed long long)
2105     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2106 }
2107
2108 static vector unsigned long long __ATTRS_o_ai
2109 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
2110   return (vector unsigned long long)
2111     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2112 }
2113
2114 static vector bool long long __ATTRS_o_ai
2115 vec_eqv(vector bool long long __a, vector bool long long __b) {
2116   return (vector bool long long)
2117     __builtin_vsx_xxleqv((vector unsigned int)__a, (vector unsigned int)__b);
2118 }
2119
2120 static vector float __ATTRS_o_ai vec_eqv(vector float __a, vector float __b) {
2121   return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
2122                                             (vector unsigned int)__b);
2123 }
2124
2125 static vector double __ATTRS_o_ai vec_eqv(vector double __a,
2126                                           vector double __b) {
2127   return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
2128                                              (vector unsigned int)__b);
2129 }
2130 #endif
2131
2132 /* vec_expte */
2133
2134 static vector float __attribute__((__always_inline__))
2135 vec_expte(vector float __a) {
2136   return __builtin_altivec_vexptefp(__a);
2137 }
2138
2139 /* vec_vexptefp */
2140
2141 static vector float __attribute__((__always_inline__))
2142 vec_vexptefp(vector float __a) {
2143   return __builtin_altivec_vexptefp(__a);
2144 }
2145
2146 /* vec_floor */
2147
2148 static vector float __ATTRS_o_ai vec_floor(vector float __a) {
2149 #ifdef __VSX__
2150   return __builtin_vsx_xvrspim(__a);
2151 #else
2152   return __builtin_altivec_vrfim(__a);
2153 #endif
2154 }
2155
2156 #ifdef __VSX__
2157 static vector double __ATTRS_o_ai vec_floor(vector double __a) {
2158   return __builtin_vsx_xvrdpim(__a);
2159 }
2160 #endif
2161
2162 /* vec_vrfim */
2163
2164 static vector float __attribute__((__always_inline__))
2165 vec_vrfim(vector float __a) {
2166   return __builtin_altivec_vrfim(__a);
2167 }
2168
2169 /* vec_ld */
2170
2171 static vector signed char __ATTRS_o_ai vec_ld(int __a,
2172                                               const vector signed char *__b) {
2173   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2174 }
2175
2176 static vector signed char __ATTRS_o_ai vec_ld(int __a, const signed char *__b) {
2177   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2178 }
2179
2180 static vector unsigned char __ATTRS_o_ai
2181 vec_ld(int __a, const vector unsigned char *__b) {
2182   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2183 }
2184
2185 static vector unsigned char __ATTRS_o_ai vec_ld(int __a,
2186                                                 const unsigned char *__b) {
2187   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2188 }
2189
2190 static vector bool char __ATTRS_o_ai vec_ld(int __a,
2191                                             const vector bool char *__b) {
2192   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2193 }
2194
2195 static vector short __ATTRS_o_ai vec_ld(int __a, const vector short *__b) {
2196   return (vector short)__builtin_altivec_lvx(__a, __b);
2197 }
2198
2199 static vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
2200   return (vector short)__builtin_altivec_lvx(__a, __b);
2201 }
2202
2203 static vector unsigned short __ATTRS_o_ai
2204 vec_ld(int __a, const vector unsigned short *__b) {
2205   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2206 }
2207
2208 static vector unsigned short __ATTRS_o_ai vec_ld(int __a,
2209                                                  const unsigned short *__b) {
2210   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2211 }
2212
2213 static vector bool short __ATTRS_o_ai vec_ld(int __a,
2214                                              const vector bool short *__b) {
2215   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2216 }
2217
2218 static vector pixel __ATTRS_o_ai vec_ld(int __a, const vector pixel *__b) {
2219   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2220 }
2221
2222 static vector int __ATTRS_o_ai vec_ld(int __a, const vector int *__b) {
2223   return (vector int)__builtin_altivec_lvx(__a, __b);
2224 }
2225
2226 static vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
2227   return (vector int)__builtin_altivec_lvx(__a, __b);
2228 }
2229
2230 static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
2231                                                const vector unsigned int *__b) {
2232   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2233 }
2234
2235 static vector unsigned int __ATTRS_o_ai vec_ld(int __a,
2236                                                const unsigned int *__b) {
2237   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2238 }
2239
2240 static vector bool int __ATTRS_o_ai vec_ld(int __a,
2241                                            const vector bool int *__b) {
2242   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2243 }
2244
2245 static vector float __ATTRS_o_ai vec_ld(int __a, const vector float *__b) {
2246   return (vector float)__builtin_altivec_lvx(__a, __b);
2247 }
2248
2249 static vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
2250   return (vector float)__builtin_altivec_lvx(__a, __b);
2251 }
2252
2253 /* vec_lvx */
2254
2255 static vector signed char __ATTRS_o_ai vec_lvx(int __a,
2256                                                const vector signed char *__b) {
2257   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2258 }
2259
2260 static vector signed char __ATTRS_o_ai vec_lvx(int __a,
2261                                                const signed char *__b) {
2262   return (vector signed char)__builtin_altivec_lvx(__a, __b);
2263 }
2264
2265 static vector unsigned char __ATTRS_o_ai
2266 vec_lvx(int __a, const vector unsigned char *__b) {
2267   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2268 }
2269
2270 static vector unsigned char __ATTRS_o_ai vec_lvx(int __a,
2271                                                  const unsigned char *__b) {
2272   return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
2273 }
2274
2275 static vector bool char __ATTRS_o_ai vec_lvx(int __a,
2276                                              const vector bool char *__b) {
2277   return (vector bool char)__builtin_altivec_lvx(__a, __b);
2278 }
2279
2280 static vector short __ATTRS_o_ai vec_lvx(int __a, const vector short *__b) {
2281   return (vector short)__builtin_altivec_lvx(__a, __b);
2282 }
2283
2284 static vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
2285   return (vector short)__builtin_altivec_lvx(__a, __b);
2286 }
2287
2288 static vector unsigned short __ATTRS_o_ai
2289 vec_lvx(int __a, const vector unsigned short *__b) {
2290   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2291 }
2292
2293 static vector unsigned short __ATTRS_o_ai vec_lvx(int __a,
2294                                                   const unsigned short *__b) {
2295   return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
2296 }
2297
2298 static vector bool short __ATTRS_o_ai vec_lvx(int __a,
2299                                               const vector bool short *__b) {
2300   return (vector bool short)__builtin_altivec_lvx(__a, __b);
2301 }
2302
2303 static vector pixel __ATTRS_o_ai vec_lvx(int __a, const vector pixel *__b) {
2304   return (vector pixel)__builtin_altivec_lvx(__a, __b);
2305 }
2306
2307 static vector int __ATTRS_o_ai vec_lvx(int __a, const vector int *__b) {
2308   return (vector int)__builtin_altivec_lvx(__a, __b);
2309 }
2310
2311 static vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
2312   return (vector int)__builtin_altivec_lvx(__a, __b);
2313 }
2314
2315 static vector unsigned int __ATTRS_o_ai
2316 vec_lvx(int __a, const vector unsigned int *__b) {
2317   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2318 }
2319
2320 static vector unsigned int __ATTRS_o_ai vec_lvx(int __a,
2321                                                 const unsigned int *__b) {
2322   return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
2323 }
2324
2325 static vector bool int __ATTRS_o_ai vec_lvx(int __a,
2326                                             const vector bool int *__b) {
2327   return (vector bool int)__builtin_altivec_lvx(__a, __b);
2328 }
2329
2330 static vector float __ATTRS_o_ai vec_lvx(int __a, const vector float *__b) {
2331   return (vector float)__builtin_altivec_lvx(__a, __b);
2332 }
2333
2334 static vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
2335   return (vector float)__builtin_altivec_lvx(__a, __b);
2336 }
2337
2338 /* vec_lde */
2339
2340 static vector signed char __ATTRS_o_ai vec_lde(int __a,
2341                                                const signed char *__b) {
2342   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2343 }
2344
2345 static vector unsigned char __ATTRS_o_ai vec_lde(int __a,
2346                                                  const unsigned char *__b) {
2347   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2348 }
2349
2350 static vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
2351   return (vector short)__builtin_altivec_lvehx(__a, __b);
2352 }
2353
2354 static vector unsigned short __ATTRS_o_ai vec_lde(int __a,
2355                                                   const unsigned short *__b) {
2356   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2357 }
2358
2359 static vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
2360   return (vector int)__builtin_altivec_lvewx(__a, __b);
2361 }
2362
2363 static vector unsigned int __ATTRS_o_ai vec_lde(int __a,
2364                                                 const unsigned int *__b) {
2365   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2366 }
2367
2368 static vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
2369   return (vector float)__builtin_altivec_lvewx(__a, __b);
2370 }
2371
2372 /* vec_lvebx */
2373
2374 static vector signed char __ATTRS_o_ai vec_lvebx(int __a,
2375                                                  const signed char *__b) {
2376   return (vector signed char)__builtin_altivec_lvebx(__a, __b);
2377 }
2378
2379 static vector unsigned char __ATTRS_o_ai vec_lvebx(int __a,
2380                                                    const unsigned char *__b) {
2381   return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
2382 }
2383
2384 /* vec_lvehx */
2385
2386 static vector short __ATTRS_o_ai vec_lvehx(int __a, const short *__b) {
2387   return (vector short)__builtin_altivec_lvehx(__a, __b);
2388 }
2389
2390 static vector unsigned short __ATTRS_o_ai vec_lvehx(int __a,
2391                                                     const unsigned short *__b) {
2392   return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
2393 }
2394
2395 /* vec_lvewx */
2396
2397 static vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
2398   return (vector int)__builtin_altivec_lvewx(__a, __b);
2399 }
2400
2401 static vector unsigned int __ATTRS_o_ai vec_lvewx(int __a,
2402                                                   const unsigned int *__b) {
2403   return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
2404 }
2405
2406 static vector float __ATTRS_o_ai vec_lvewx(int __a, const float *__b) {
2407   return (vector float)__builtin_altivec_lvewx(__a, __b);
2408 }
2409
2410 /* vec_ldl */
2411
2412 static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2413                                                const vector signed char *__b) {
2414   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2415 }
2416
2417 static vector signed char __ATTRS_o_ai vec_ldl(int __a,
2418                                                const signed char *__b) {
2419   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2420 }
2421
2422 static vector unsigned char __ATTRS_o_ai
2423 vec_ldl(int __a, const vector unsigned char *__b) {
2424   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2425 }
2426
2427 static vector unsigned char __ATTRS_o_ai vec_ldl(int __a,
2428                                                  const unsigned char *__b) {
2429   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2430 }
2431
2432 static vector bool char __ATTRS_o_ai vec_ldl(int __a,
2433                                              const vector bool char *__b) {
2434   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2435 }
2436
2437 static vector short __ATTRS_o_ai vec_ldl(int __a, const vector short *__b) {
2438   return (vector short)__builtin_altivec_lvxl(__a, __b);
2439 }
2440
2441 static vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
2442   return (vector short)__builtin_altivec_lvxl(__a, __b);
2443 }
2444
2445 static vector unsigned short __ATTRS_o_ai
2446 vec_ldl(int __a, const vector unsigned short *__b) {
2447   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2448 }
2449
2450 static vector unsigned short __ATTRS_o_ai vec_ldl(int __a,
2451                                                   const unsigned short *__b) {
2452   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2453 }
2454
2455 static vector bool short __ATTRS_o_ai vec_ldl(int __a,
2456                                               const vector bool short *__b) {
2457   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2458 }
2459
2460 static vector pixel __ATTRS_o_ai vec_ldl(int __a, const vector pixel *__b) {
2461   return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
2462 }
2463
2464 static vector int __ATTRS_o_ai vec_ldl(int __a, const vector int *__b) {
2465   return (vector int)__builtin_altivec_lvxl(__a, __b);
2466 }
2467
2468 static vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
2469   return (vector int)__builtin_altivec_lvxl(__a, __b);
2470 }
2471
2472 static vector unsigned int __ATTRS_o_ai
2473 vec_ldl(int __a, const vector unsigned int *__b) {
2474   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2475 }
2476
2477 static vector unsigned int __ATTRS_o_ai vec_ldl(int __a,
2478                                                 const unsigned int *__b) {
2479   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2480 }
2481
2482 static vector bool int __ATTRS_o_ai vec_ldl(int __a,
2483                                             const vector bool int *__b) {
2484   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2485 }
2486
2487 static vector float __ATTRS_o_ai vec_ldl(int __a, const vector float *__b) {
2488   return (vector float)__builtin_altivec_lvxl(__a, __b);
2489 }
2490
2491 static vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
2492   return (vector float)__builtin_altivec_lvxl(__a, __b);
2493 }
2494
2495 /* vec_lvxl */
2496
2497 static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2498                                                 const vector signed char *__b) {
2499   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2500 }
2501
2502 static vector signed char __ATTRS_o_ai vec_lvxl(int __a,
2503                                                 const signed char *__b) {
2504   return (vector signed char)__builtin_altivec_lvxl(__a, __b);
2505 }
2506
2507 static vector unsigned char __ATTRS_o_ai
2508 vec_lvxl(int __a, const vector unsigned char *__b) {
2509   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2510 }
2511
2512 static vector unsigned char __ATTRS_o_ai vec_lvxl(int __a,
2513                                                   const unsigned char *__b) {
2514   return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
2515 }
2516
2517 static vector bool char __ATTRS_o_ai vec_lvxl(int __a,
2518                                               const vector bool char *__b) {
2519   return (vector bool char)__builtin_altivec_lvxl(__a, __b);
2520 }
2521
2522 static vector short __ATTRS_o_ai vec_lvxl(int __a, const vector short *__b) {
2523   return (vector short)__builtin_altivec_lvxl(__a, __b);
2524 }
2525
2526 static vector short __ATTRS_o_ai vec_lvxl(int __a, const short *__b) {
2527   return (vector short)__builtin_altivec_lvxl(__a, __b);
2528 }
2529
2530 static vector unsigned short __ATTRS_o_ai
2531 vec_lvxl(int __a, const vector unsigned short *__b) {
2532   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2533 }
2534
2535 static vector unsigned short __ATTRS_o_ai vec_lvxl(int __a,
2536                                                    const unsigned short *__b) {
2537   return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
2538 }
2539
2540 static vector bool short __ATTRS_o_ai vec_lvxl(int __a,
2541                                                const vector bool short *__b) {
2542   return (vector bool short)__builtin_altivec_lvxl(__a, __b);
2543 }
2544
2545 static vector pixel __ATTRS_o_ai vec_lvxl(int __a, const vector pixel *__b) {
2546   return (vector pixel)__builtin_altivec_lvxl(__a, __b);
2547 }
2548
2549 static vector int __ATTRS_o_ai vec_lvxl(int __a, const vector int *__b) {
2550   return (vector int)__builtin_altivec_lvxl(__a, __b);
2551 }
2552
2553 static vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
2554   return (vector int)__builtin_altivec_lvxl(__a, __b);
2555 }
2556
2557 static vector unsigned int __ATTRS_o_ai
2558 vec_lvxl(int __a, const vector unsigned int *__b) {
2559   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2560 }
2561
2562 static vector unsigned int __ATTRS_o_ai vec_lvxl(int __a,
2563                                                  const unsigned int *__b) {
2564   return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
2565 }
2566
2567 static vector bool int __ATTRS_o_ai vec_lvxl(int __a,
2568                                              const vector bool int *__b) {
2569   return (vector bool int)__builtin_altivec_lvxl(__a, __b);
2570 }
2571
2572 static vector float __ATTRS_o_ai vec_lvxl(int __a, const vector float *__b) {
2573   return (vector float)__builtin_altivec_lvxl(__a, __b);
2574 }
2575
2576 static vector float __ATTRS_o_ai vec_lvxl(int __a, const float *__b) {
2577   return (vector float)__builtin_altivec_lvxl(__a, __b);
2578 }
2579
2580 /* vec_loge */
2581
2582 static vector float __attribute__((__always_inline__))
2583 vec_loge(vector float __a) {
2584   return __builtin_altivec_vlogefp(__a);
2585 }
2586
2587 /* vec_vlogefp */
2588
2589 static vector float __attribute__((__always_inline__))
2590 vec_vlogefp(vector float __a) {
2591   return __builtin_altivec_vlogefp(__a);
2592 }
2593
2594 /* vec_lvsl */
2595
2596 #ifdef __LITTLE_ENDIAN__
2597 static vector unsigned char __ATTRS_o_ai
2598     __attribute__((__deprecated__("use assignment for unaligned little endian \
2599 loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
2600   vector unsigned char mask =
2601       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2602   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2603                                   7,  6,  5,  4,  3,  2,  1, 0};
2604   return vec_perm(mask, mask, reverse);
2605 }
2606 #else
2607 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2608                                                   const signed char *__b) {
2609   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2610 }
2611 #endif
2612
2613 #ifdef __LITTLE_ENDIAN__
2614 static vector unsigned char __ATTRS_o_ai
2615     __attribute__((__deprecated__("use assignment for unaligned little endian \
2616 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
2617   vector unsigned char mask =
2618       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2619   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2620                                   7,  6,  5,  4,  3,  2,  1, 0};
2621   return vec_perm(mask, mask, reverse);
2622 }
2623 #else
2624 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2625                                                   const unsigned char *__b) {
2626   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2627 }
2628 #endif
2629
2630 #ifdef __LITTLE_ENDIAN__
2631 static vector unsigned char __ATTRS_o_ai
2632     __attribute__((__deprecated__("use assignment for unaligned little endian \
2633 loads/stores"))) vec_lvsl(int __a, const short *__b) {
2634   vector unsigned char mask =
2635       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2636   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2637                                   7,  6,  5,  4,  3,  2,  1, 0};
2638   return vec_perm(mask, mask, reverse);
2639 }
2640 #else
2641 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const short *__b) {
2642   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2643 }
2644 #endif
2645
2646 #ifdef __LITTLE_ENDIAN__
2647 static vector unsigned char __ATTRS_o_ai
2648     __attribute__((__deprecated__("use assignment for unaligned little endian \
2649 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
2650   vector unsigned char mask =
2651       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2652   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2653                                   7,  6,  5,  4,  3,  2,  1, 0};
2654   return vec_perm(mask, mask, reverse);
2655 }
2656 #else
2657 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2658                                                   const unsigned short *__b) {
2659   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2660 }
2661 #endif
2662
2663 #ifdef __LITTLE_ENDIAN__
2664 static vector unsigned char __ATTRS_o_ai
2665     __attribute__((__deprecated__("use assignment for unaligned little endian \
2666 loads/stores"))) vec_lvsl(int __a, const int *__b) {
2667   vector unsigned char mask =
2668       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2669   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2670                                   7,  6,  5,  4,  3,  2,  1, 0};
2671   return vec_perm(mask, mask, reverse);
2672 }
2673 #else
2674 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const int *__b) {
2675   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2676 }
2677 #endif
2678
2679 #ifdef __LITTLE_ENDIAN__
2680 static vector unsigned char __ATTRS_o_ai
2681     __attribute__((__deprecated__("use assignment for unaligned little endian \
2682 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
2683   vector unsigned char mask =
2684       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2685   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2686                                   7,  6,  5,  4,  3,  2,  1, 0};
2687   return vec_perm(mask, mask, reverse);
2688 }
2689 #else
2690 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
2691                                                   const unsigned int *__b) {
2692   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2693 }
2694 #endif
2695
2696 #ifdef __LITTLE_ENDIAN__
2697 static vector unsigned char __ATTRS_o_ai
2698     __attribute__((__deprecated__("use assignment for unaligned little endian \
2699 loads/stores"))) vec_lvsl(int __a, const float *__b) {
2700   vector unsigned char mask =
2701       (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2702   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2703                                   7,  6,  5,  4,  3,  2,  1, 0};
2704   return vec_perm(mask, mask, reverse);
2705 }
2706 #else
2707 static vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const float *__b) {
2708   return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2709 }
2710 #endif
2711
2712 /* vec_lvsr */
2713
2714 #ifdef __LITTLE_ENDIAN__
2715 static vector unsigned char __ATTRS_o_ai
2716     __attribute__((__deprecated__("use assignment for unaligned little endian \
2717 loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
2718   vector unsigned char mask =
2719       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2720   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2721                                   7,  6,  5,  4,  3,  2,  1, 0};
2722   return vec_perm(mask, mask, reverse);
2723 }
2724 #else
2725 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2726                                                   const signed char *__b) {
2727   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2728 }
2729 #endif
2730
2731 #ifdef __LITTLE_ENDIAN__
2732 static vector unsigned char __ATTRS_o_ai
2733     __attribute__((__deprecated__("use assignment for unaligned little endian \
2734 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
2735   vector unsigned char mask =
2736       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2737   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2738                                   7,  6,  5,  4,  3,  2,  1, 0};
2739   return vec_perm(mask, mask, reverse);
2740 }
2741 #else
2742 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2743                                                   const unsigned char *__b) {
2744   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2745 }
2746 #endif
2747
2748 #ifdef __LITTLE_ENDIAN__
2749 static vector unsigned char __ATTRS_o_ai
2750     __attribute__((__deprecated__("use assignment for unaligned little endian \
2751 loads/stores"))) vec_lvsr(int __a, const short *__b) {
2752   vector unsigned char mask =
2753       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2754   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2755                                   7,  6,  5,  4,  3,  2,  1, 0};
2756   return vec_perm(mask, mask, reverse);
2757 }
2758 #else
2759 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const short *__b) {
2760   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2761 }
2762 #endif
2763
2764 #ifdef __LITTLE_ENDIAN__
2765 static vector unsigned char __ATTRS_o_ai
2766     __attribute__((__deprecated__("use assignment for unaligned little endian \
2767 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
2768   vector unsigned char mask =
2769       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2770   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2771                                   7,  6,  5,  4,  3,  2,  1, 0};
2772   return vec_perm(mask, mask, reverse);
2773 }
2774 #else
2775 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2776                                                   const unsigned short *__b) {
2777   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2778 }
2779 #endif
2780
2781 #ifdef __LITTLE_ENDIAN__
2782 static vector unsigned char __ATTRS_o_ai
2783     __attribute__((__deprecated__("use assignment for unaligned little endian \
2784 loads/stores"))) vec_lvsr(int __a, const int *__b) {
2785   vector unsigned char mask =
2786       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2787   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2788                                   7,  6,  5,  4,  3,  2,  1, 0};
2789   return vec_perm(mask, mask, reverse);
2790 }
2791 #else
2792 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const int *__b) {
2793   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2794 }
2795 #endif
2796
2797 #ifdef __LITTLE_ENDIAN__
2798 static vector unsigned char __ATTRS_o_ai
2799     __attribute__((__deprecated__("use assignment for unaligned little endian \
2800 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
2801   vector unsigned char mask =
2802       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2803   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2804                                   7,  6,  5,  4,  3,  2,  1, 0};
2805   return vec_perm(mask, mask, reverse);
2806 }
2807 #else
2808 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
2809                                                   const unsigned int *__b) {
2810   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2811 }
2812 #endif
2813
2814 #ifdef __LITTLE_ENDIAN__
2815 static vector unsigned char __ATTRS_o_ai
2816     __attribute__((__deprecated__("use assignment for unaligned little endian \
2817 loads/stores"))) vec_lvsr(int __a, const float *__b) {
2818   vector unsigned char mask =
2819       (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2820   vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
2821                                   7,  6,  5,  4,  3,  2,  1, 0};
2822   return vec_perm(mask, mask, reverse);
2823 }
2824 #else
2825 static vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const float *__b) {
2826   return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2827 }
2828 #endif
2829
2830 /* vec_madd */
2831 static vector signed short __ATTRS_o_ai
2832 vec_mladd(vector signed short, vector signed short, vector signed short);
2833 static vector signed short __ATTRS_o_ai
2834 vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
2835 static vector signed short __ATTRS_o_ai
2836 vec_mladd(vector unsigned short, vector signed short, vector signed short);
2837 static vector unsigned short __ATTRS_o_ai
2838 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
2839
2840 static vector signed short __ATTRS_o_ai
2841 vec_madd(vector signed short __a, vector signed short __b,
2842          vector signed short __c) {
2843   return  vec_mladd(__a, __b, __c);
2844 }
2845
2846 static vector signed short __ATTRS_o_ai
2847 vec_madd(vector signed short __a, vector unsigned short __b,
2848          vector unsigned short __c) {
2849   return vec_mladd(__a, __b, __c);
2850 }
2851
2852 static vector signed short __ATTRS_o_ai
2853 vec_madd(vector unsigned short __a, vector signed short __b,
2854          vector signed short __c) {
2855   return vec_mladd(__a, __b, __c);
2856 }
2857
2858 static vector unsigned short __ATTRS_o_ai
2859 vec_madd(vector unsigned short __a, vector unsigned short __b,
2860          vector unsigned short __c) {
2861   return vec_mladd(__a, __b, __c);
2862 }
2863
2864 static vector float __ATTRS_o_ai
2865 vec_madd(vector float __a, vector float __b, vector float __c) {
2866 #ifdef __VSX__
2867   return __builtin_vsx_xvmaddasp(__a, __b, __c);
2868 #else
2869   return __builtin_altivec_vmaddfp(__a, __b, __c);
2870 #endif
2871 }
2872
2873 #ifdef __VSX__
2874 static vector double __ATTRS_o_ai
2875 vec_madd(vector double __a, vector double __b, vector double __c) {
2876   return __builtin_vsx_xvmaddadp(__a, __b, __c);
2877 }
2878 #endif
2879
2880 /* vec_vmaddfp */
2881
2882 static vector float __attribute__((__always_inline__))
2883 vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
2884   return __builtin_altivec_vmaddfp(__a, __b, __c);
2885 }
2886
2887 /* vec_madds */
2888
2889 static vector signed short __attribute__((__always_inline__))
2890 vec_madds(vector signed short __a, vector signed short __b,
2891           vector signed short __c) {
2892   return __builtin_altivec_vmhaddshs(__a, __b, __c);
2893 }
2894
2895 /* vec_vmhaddshs */
2896 static vector signed short __attribute__((__always_inline__))
2897 vec_vmhaddshs(vector signed short __a, vector signed short __b,
2898               vector signed short __c) {
2899   return __builtin_altivec_vmhaddshs(__a, __b, __c);
2900 }
2901
2902 /* vec_msub */
2903
2904 #ifdef __VSX__
2905 static vector float __ATTRS_o_ai
2906 vec_msub(vector float __a, vector float __b, vector float __c) {
2907   return __builtin_vsx_xvmsubasp(__a, __b, __c);
2908 }
2909
2910 static vector double __ATTRS_o_ai
2911 vec_msub(vector double __a, vector double __b, vector double __c) {
2912   return __builtin_vsx_xvmsubadp(__a, __b, __c);
2913 }
2914 #endif
2915
2916 /* vec_max */
2917
2918 static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2919                                                vector signed char __b) {
2920   return __builtin_altivec_vmaxsb(__a, __b);
2921 }
2922
2923 static vector signed char __ATTRS_o_ai vec_max(vector bool char __a,
2924                                                vector signed char __b) {
2925   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
2926 }
2927
2928 static vector signed char __ATTRS_o_ai vec_max(vector signed char __a,
2929                                                vector bool char __b) {
2930   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
2931 }
2932
2933 static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2934                                                  vector unsigned char __b) {
2935   return __builtin_altivec_vmaxub(__a, __b);
2936 }
2937
2938 static vector unsigned char __ATTRS_o_ai vec_max(vector bool char __a,
2939                                                  vector unsigned char __b) {
2940   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
2941 }
2942
2943 static vector unsigned char __ATTRS_o_ai vec_max(vector unsigned char __a,
2944                                                  vector bool char __b) {
2945   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
2946 }
2947
2948 static vector short __ATTRS_o_ai vec_max(vector short __a, vector short __b) {
2949   return __builtin_altivec_vmaxsh(__a, __b);
2950 }
2951
2952 static vector short __ATTRS_o_ai vec_max(vector bool short __a,
2953                                          vector short __b) {
2954   return __builtin_altivec_vmaxsh((vector short)__a, __b);
2955 }
2956
2957 static vector short __ATTRS_o_ai vec_max(vector short __a,
2958                                          vector bool short __b) {
2959   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
2960 }
2961
2962 static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2963                                                   vector unsigned short __b) {
2964   return __builtin_altivec_vmaxuh(__a, __b);
2965 }
2966
2967 static vector unsigned short __ATTRS_o_ai vec_max(vector bool short __a,
2968                                                   vector unsigned short __b) {
2969   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
2970 }
2971
2972 static vector unsigned short __ATTRS_o_ai vec_max(vector unsigned short __a,
2973                                                   vector bool short __b) {
2974   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
2975 }
2976
2977 static vector int __ATTRS_o_ai vec_max(vector int __a, vector int __b) {
2978   return __builtin_altivec_vmaxsw(__a, __b);
2979 }
2980
2981 static vector int __ATTRS_o_ai vec_max(vector bool int __a, vector int __b) {
2982   return __builtin_altivec_vmaxsw((vector int)__a, __b);
2983 }
2984
2985 static vector int __ATTRS_o_ai vec_max(vector int __a, vector bool int __b) {
2986   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
2987 }
2988
2989 static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
2990                                                 vector unsigned int __b) {
2991   return __builtin_altivec_vmaxuw(__a, __b);
2992 }
2993
2994 static vector unsigned int __ATTRS_o_ai vec_max(vector bool int __a,
2995                                                 vector unsigned int __b) {
2996   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
2997 }
2998
2999 static vector unsigned int __ATTRS_o_ai vec_max(vector unsigned int __a,
3000                                                 vector bool int __b) {
3001   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3002 }
3003
3004 #ifdef __POWER8_VECTOR__
3005 static vector signed long long __ATTRS_o_ai
3006 vec_max(vector signed long long __a, vector signed long long __b) {
3007   return __builtin_altivec_vmaxsd(__a, __b);
3008 }
3009
3010 static vector signed long long __ATTRS_o_ai
3011 vec_max(vector bool long long __a, vector signed long long __b) {
3012   return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
3013 }
3014
3015 static vector signed long long __ATTRS_o_ai vec_max(vector signed long long __a,
3016                                                     vector bool long long __b) {
3017   return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
3018 }
3019
3020 static vector unsigned long long __ATTRS_o_ai
3021 vec_max(vector unsigned long long __a, vector unsigned long long __b) {
3022   return __builtin_altivec_vmaxud(__a, __b);
3023 }
3024
3025 static vector unsigned long long __ATTRS_o_ai
3026 vec_max(vector bool long long __a, vector unsigned long long __b) {
3027   return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
3028 }
3029
3030 static vector unsigned long long __ATTRS_o_ai
3031 vec_max(vector unsigned long long __a, vector bool long long __b) {
3032   return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
3033 }
3034 #endif
3035
3036 static vector float __ATTRS_o_ai vec_max(vector float __a, vector float __b) {
3037 #ifdef __VSX__
3038   return __builtin_vsx_xvmaxsp(__a, __b);
3039 #else
3040   return __builtin_altivec_vmaxfp(__a, __b);
3041 #endif
3042 }
3043
3044 #ifdef __VSX__
3045 static vector double __ATTRS_o_ai vec_max(vector double __a,
3046                                           vector double __b) {
3047   return __builtin_vsx_xvmaxdp(__a, __b);
3048 }
3049 #endif
3050
3051 /* vec_vmaxsb */
3052
3053 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
3054                                                   vector signed char __b) {
3055   return __builtin_altivec_vmaxsb(__a, __b);
3056 }
3057
3058 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector bool char __a,
3059                                                   vector signed char __b) {
3060   return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
3061 }
3062
3063 static vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a,
3064                                                   vector bool char __b) {
3065   return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
3066 }
3067
3068 /* vec_vmaxub */
3069
3070 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
3071                                                     vector unsigned char __b) {
3072   return __builtin_altivec_vmaxub(__a, __b);
3073 }
3074
3075 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector bool char __a,
3076                                                     vector unsigned char __b) {
3077   return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
3078 }
3079
3080 static vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a,
3081                                                     vector bool char __b) {
3082   return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
3083 }
3084
3085 /* vec_vmaxsh */
3086
3087 static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3088                                             vector short __b) {
3089   return __builtin_altivec_vmaxsh(__a, __b);
3090 }
3091
3092 static vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
3093                                             vector short __b) {
3094   return __builtin_altivec_vmaxsh((vector short)__a, __b);
3095 }
3096
3097 static vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
3098                                             vector bool short __b) {
3099   return __builtin_altivec_vmaxsh(__a, (vector short)__b);
3100 }
3101
3102 /* vec_vmaxuh */
3103
3104 static vector unsigned short __ATTRS_o_ai
3105 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
3106   return __builtin_altivec_vmaxuh(__a, __b);
3107 }
3108
3109 static vector unsigned short __ATTRS_o_ai
3110 vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
3111   return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
3112 }
3113
3114 static vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a,
3115                                                      vector bool short __b) {
3116   return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
3117 }
3118
3119 /* vec_vmaxsw */
3120
3121 static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b) {
3122   return __builtin_altivec_vmaxsw(__a, __b);
3123 }
3124
3125 static vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, vector int __b) {
3126   return __builtin_altivec_vmaxsw((vector int)__a, __b);
3127 }
3128
3129 static vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector bool int __b) {
3130   return __builtin_altivec_vmaxsw(__a, (vector int)__b);
3131 }
3132
3133 /* vec_vmaxuw */
3134
3135 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
3136                                                    vector unsigned int __b) {
3137   return __builtin_altivec_vmaxuw(__a, __b);
3138 }
3139
3140 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector bool int __a,
3141                                                    vector unsigned int __b) {
3142   return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
3143 }
3144
3145 static vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a,
3146                                                    vector bool int __b) {
3147   return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
3148 }
3149
3150 /* vec_vmaxfp */
3151
3152 static vector float __attribute__((__always_inline__))
3153 vec_vmaxfp(vector float __a, vector float __b) {
3154 #ifdef __VSX__
3155   return __builtin_vsx_xvmaxsp(__a, __b);
3156 #else
3157   return __builtin_altivec_vmaxfp(__a, __b);
3158 #endif
3159 }
3160
3161 /* vec_mergeh */
3162
3163 static vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a,
3164                                                   vector signed char __b) {
3165   return vec_perm(__a, __b,
3166                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3167                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3168                                          0x06, 0x16, 0x07, 0x17));
3169 }
3170
3171 static vector unsigned char __ATTRS_o_ai vec_mergeh(vector unsigned char __a,
3172                                                     vector unsigned char __b) {
3173   return vec_perm(__a, __b,
3174                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3175                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3176                                          0x06, 0x16, 0x07, 0x17));
3177 }
3178
3179 static vector bool char __ATTRS_o_ai vec_mergeh(vector bool char __a,
3180                                                 vector bool char __b) {
3181   return vec_perm(__a, __b,
3182                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3183                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3184                                          0x06, 0x16, 0x07, 0x17));
3185 }
3186
3187 static vector short __ATTRS_o_ai vec_mergeh(vector short __a,
3188                                             vector short __b) {
3189   return vec_perm(__a, __b,
3190                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3191                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3192                                          0x06, 0x07, 0x16, 0x17));
3193 }
3194
3195 static vector unsigned short __ATTRS_o_ai
3196 vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
3197   return vec_perm(__a, __b,
3198                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3199                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3200                                          0x06, 0x07, 0x16, 0x17));
3201 }
3202
3203 static vector bool short __ATTRS_o_ai vec_mergeh(vector bool short __a,
3204                                                  vector bool short __b) {
3205   return vec_perm(__a, __b,
3206                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3207                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3208                                          0x06, 0x07, 0x16, 0x17));
3209 }
3210
3211 static vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
3212                                             vector pixel __b) {
3213   return vec_perm(__a, __b,
3214                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3215                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3216                                          0x06, 0x07, 0x16, 0x17));
3217 }
3218
3219 static vector int __ATTRS_o_ai vec_mergeh(vector int __a, vector int __b) {
3220   return vec_perm(__a, __b,
3221                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3222                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3223                                          0x14, 0x15, 0x16, 0x17));
3224 }
3225
3226 static vector unsigned int __ATTRS_o_ai vec_mergeh(vector unsigned int __a,
3227                                                    vector unsigned int __b) {
3228   return vec_perm(__a, __b,
3229                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3230                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3231                                          0x14, 0x15, 0x16, 0x17));
3232 }
3233
3234 static vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
3235                                                vector bool int __b) {
3236   return vec_perm(__a, __b,
3237                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3238                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3239                                          0x14, 0x15, 0x16, 0x17));
3240 }
3241
3242 static vector float __ATTRS_o_ai vec_mergeh(vector float __a,
3243                                             vector float __b) {
3244   return vec_perm(__a, __b,
3245                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3246                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3247                                          0x14, 0x15, 0x16, 0x17));
3248 }
3249
3250 #ifdef __VSX__
3251 static vector signed long long __ATTRS_o_ai
3252 vec_mergeh(vector signed long long __a, vector signed long long __b) {
3253   return vec_perm(__a, __b,
3254                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3255                                          0x04, 0x05, 0x06, 0x07,
3256                                          0x10, 0x11, 0x12, 0x13,
3257                                          0x14, 0x15, 0x16, 0x17));
3258 }
3259
3260 static vector signed long long __ATTRS_o_ai
3261 vec_mergeh(vector signed long long __a, vector bool long long __b) {
3262   return vec_perm(__a, (vector signed long long)__b,
3263                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3264                                          0x04, 0x05, 0x06, 0x07,
3265                                          0x10, 0x11, 0x12, 0x13,
3266                                          0x14, 0x15, 0x16, 0x17));
3267 }
3268
3269 static vector signed long long __ATTRS_o_ai
3270 vec_mergeh(vector bool long long __a, vector signed long long __b) {
3271   return vec_perm((vector signed long long)__a, __b,
3272                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3273                                          0x04, 0x05, 0x06, 0x07,
3274                                          0x10, 0x11, 0x12, 0x13,
3275                                          0x14, 0x15, 0x16, 0x17));
3276 }
3277
3278 static vector unsigned long long __ATTRS_o_ai
3279 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
3280   return vec_perm(__a, __b,
3281                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3282                                          0x04, 0x05, 0x06, 0x07,
3283                                          0x10, 0x11, 0x12, 0x13,
3284                                          0x14, 0x15, 0x16, 0x17));
3285 }
3286
3287 static vector unsigned long long __ATTRS_o_ai
3288 vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
3289   return vec_perm(__a, (vector unsigned long long)__b,
3290                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3291                                          0x04, 0x05, 0x06, 0x07,
3292                                          0x10, 0x11, 0x12, 0x13,
3293                                          0x14, 0x15, 0x16, 0x17));
3294 }
3295
3296 static vector unsigned long long __ATTRS_o_ai
3297 vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
3298   return vec_perm((vector unsigned long long)__a, __b,
3299                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3300                                          0x04, 0x05, 0x06, 0x07,
3301                                          0x10, 0x11, 0x12, 0x13,
3302                                          0x14, 0x15, 0x16, 0x17));
3303 }
3304
3305 static vector bool long long __ATTRS_o_ai
3306 vec_mergeh(vector bool long long __a, vector bool long long __b) {
3307   return vec_perm(__a, __b,
3308                  (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3309                                         0x04, 0x05, 0x06, 0x07,
3310                                         0x10, 0x11, 0x12, 0x13,
3311                                         0x14, 0x15, 0x16, 0x17));
3312 }
3313
3314 static vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3315                                              vector double __b) {
3316   return vec_perm(__a, __b,
3317                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3318                                          0x04, 0x05, 0x06, 0x07,
3319                                          0x10, 0x11, 0x12, 0x13,
3320                                          0x14, 0x15, 0x16, 0x17));
3321 }
3322 static vector double __ATTRS_o_ai vec_mergeh(vector double __a,
3323                                              vector bool long long __b) {
3324   return vec_perm(__a, (vector double)__b,
3325                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3326                                          0x04, 0x05, 0x06, 0x07,
3327                                          0x10, 0x11, 0x12, 0x13,
3328                                          0x14, 0x15, 0x16, 0x17));
3329 }
3330 static vector double __ATTRS_o_ai vec_mergeh(vector bool long long __a,
3331                                              vector double __b) {
3332   return vec_perm((vector double)__a, __b,
3333                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03,
3334                                          0x04, 0x05, 0x06, 0x07,
3335                                          0x10, 0x11, 0x12, 0x13,
3336                                          0x14, 0x15, 0x16, 0x17));
3337 }
3338 #endif
3339
3340 /* vec_vmrghb */
3341
3342 #define __builtin_altivec_vmrghb vec_vmrghb
3343
3344 static vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a,
3345                                                   vector signed char __b) {
3346   return vec_perm(__a, __b,
3347                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3348                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3349                                          0x06, 0x16, 0x07, 0x17));
3350 }
3351
3352 static vector unsigned char __ATTRS_o_ai vec_vmrghb(vector unsigned char __a,
3353                                                     vector unsigned char __b) {
3354   return vec_perm(__a, __b,
3355                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3356                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3357                                          0x06, 0x16, 0x07, 0x17));
3358 }
3359
3360 static vector bool char __ATTRS_o_ai vec_vmrghb(vector bool char __a,
3361                                                 vector bool char __b) {
3362   return vec_perm(__a, __b,
3363                   (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
3364                                          0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
3365                                          0x06, 0x16, 0x07, 0x17));
3366 }
3367
3368 /* vec_vmrghh */
3369
3370 #define __builtin_altivec_vmrghh vec_vmrghh
3371
3372 static vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
3373                                             vector short __b) {
3374   return vec_perm(__a, __b,
3375                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3376                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3377                                          0x06, 0x07, 0x16, 0x17));
3378 }
3379
3380 static vector unsigned short __ATTRS_o_ai
3381 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
3382   return vec_perm(__a, __b,
3383                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3384                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3385                                          0x06, 0x07, 0x16, 0x17));
3386 }
3387
3388 static vector bool short __ATTRS_o_ai vec_vmrghh(vector bool short __a,
3389                                                  vector bool short __b) {
3390   return vec_perm(__a, __b,
3391                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3392                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3393                                          0x06, 0x07, 0x16, 0x17));
3394 }
3395
3396 static vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
3397                                             vector pixel __b) {
3398   return vec_perm(__a, __b,
3399                   (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
3400                                          0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
3401                                          0x06, 0x07, 0x16, 0x17));
3402 }
3403
3404 /* vec_vmrghw */
3405
3406 #define __builtin_altivec_vmrghw vec_vmrghw
3407
3408 static vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b) {
3409   return vec_perm(__a, __b,
3410                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3411                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3412                                          0x14, 0x15, 0x16, 0x17));
3413 }
3414
3415 static vector unsigned int __ATTRS_o_ai vec_vmrghw(vector unsigned int __a,
3416                                                    vector unsigned int __b) {
3417   return vec_perm(__a, __b,
3418                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3419                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3420                                          0x14, 0x15, 0x16, 0x17));
3421 }
3422
3423 static vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
3424                                                vector bool int __b) {
3425   return vec_perm(__a, __b,
3426                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3427                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3428                                          0x14, 0x15, 0x16, 0x17));
3429 }
3430
3431 static vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
3432                                             vector float __b) {
3433   return vec_perm(__a, __b,
3434                   (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
3435                                          0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
3436                                          0x14, 0x15, 0x16, 0x17));
3437 }
3438
3439 /* vec_mergel */
3440
3441 static vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a,
3442                                                   vector signed char __b) {
3443   return vec_perm(__a, __b,
3444                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3445                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3446                                          0x0E, 0x1E, 0x0F, 0x1F));
3447 }
3448
3449 static vector unsigned char __ATTRS_o_ai vec_mergel(vector unsigned char __a,
3450                                                     vector unsigned char __b) {
3451   return vec_perm(__a, __b,
3452                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3453                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3454                                          0x0E, 0x1E, 0x0F, 0x1F));
3455 }
3456
3457 static vector bool char __ATTRS_o_ai vec_mergel(vector bool char __a,
3458                                                 vector bool char __b) {
3459   return vec_perm(__a, __b,
3460                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3461                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3462                                          0x0E, 0x1E, 0x0F, 0x1F));
3463 }
3464
3465 static vector short __ATTRS_o_ai vec_mergel(vector short __a,
3466                                             vector short __b) {
3467   return vec_perm(__a, __b,
3468                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3469                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3470                                          0x0E, 0x0F, 0x1E, 0x1F));
3471 }
3472
3473 static vector unsigned short __ATTRS_o_ai
3474 vec_mergel(vector unsigned short __a, vector unsigned short __b) {
3475   return vec_perm(__a, __b,
3476                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3477                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3478                                          0x0E, 0x0F, 0x1E, 0x1F));
3479 }
3480
3481 static vector bool short __ATTRS_o_ai vec_mergel(vector bool short __a,
3482                                                  vector bool short __b) {
3483   return vec_perm(__a, __b,
3484                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3485                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3486                                          0x0E, 0x0F, 0x1E, 0x1F));
3487 }
3488
3489 static vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
3490                                             vector pixel __b) {
3491   return vec_perm(__a, __b,
3492                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3493                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3494                                          0x0E, 0x0F, 0x1E, 0x1F));
3495 }
3496
3497 static vector int __ATTRS_o_ai vec_mergel(vector int __a, vector int __b) {
3498   return vec_perm(__a, __b,
3499                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3500                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3501                                          0x1C, 0x1D, 0x1E, 0x1F));
3502 }
3503
3504 static vector unsigned int __ATTRS_o_ai vec_mergel(vector unsigned int __a,
3505                                                    vector unsigned int __b) {
3506   return vec_perm(__a, __b,
3507                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3508                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3509                                          0x1C, 0x1D, 0x1E, 0x1F));
3510 }
3511
3512 static vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
3513                                                vector bool int __b) {
3514   return vec_perm(__a, __b,
3515                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3516                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3517                                          0x1C, 0x1D, 0x1E, 0x1F));
3518 }
3519
3520 static vector float __ATTRS_o_ai vec_mergel(vector float __a,
3521                                             vector float __b) {
3522   return vec_perm(__a, __b,
3523                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3524                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3525                                          0x1C, 0x1D, 0x1E, 0x1F));
3526 }
3527
3528 #ifdef __VSX__
3529 static vector signed long long __ATTRS_o_ai
3530 vec_mergel(vector signed long long __a, vector signed long long __b) {
3531   return vec_perm(__a, __b,
3532                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3533                                          0x0C, 0x0D, 0x0E, 0x0F,
3534                                          0x18, 0X19, 0x1A, 0x1B,
3535                                          0x1C, 0x1D, 0x1E, 0x1F));
3536 }
3537 static vector signed long long __ATTRS_o_ai
3538 vec_mergel(vector signed long long __a, vector bool long long __b) {
3539   return vec_perm(__a, (vector signed long long)__b,
3540                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3541                                          0x0C, 0x0D, 0x0E, 0x0F,
3542                                          0x18, 0X19, 0x1A, 0x1B,
3543                                          0x1C, 0x1D, 0x1E, 0x1F));
3544 }
3545 static vector signed long long __ATTRS_o_ai
3546 vec_mergel(vector bool long long __a, vector signed long long __b) {
3547   return vec_perm((vector signed long long)__a, __b,
3548                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3549                                          0x0C, 0x0D, 0x0E, 0x0F,
3550                                          0x18, 0X19, 0x1A, 0x1B,
3551                                          0x1C, 0x1D, 0x1E, 0x1F));
3552 }
3553 static vector unsigned long long __ATTRS_o_ai
3554 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
3555   return vec_perm(__a, __b,
3556                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3557                                          0x0C, 0x0D, 0x0E, 0x0F,
3558                                          0x18, 0X19, 0x1A, 0x1B,
3559                                          0x1C, 0x1D, 0x1E, 0x1F));
3560 }
3561 static vector unsigned long long __ATTRS_o_ai
3562 vec_mergel(vector unsigned long long __a, vector bool long long __b) {
3563   return vec_perm(__a, (vector unsigned long long)__b,
3564                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3565                                          0x0C, 0x0D, 0x0E, 0x0F,
3566                                          0x18, 0X19, 0x1A, 0x1B,
3567                                          0x1C, 0x1D, 0x1E, 0x1F));
3568 }
3569 static vector unsigned long long __ATTRS_o_ai
3570 vec_mergel(vector bool long long __a, vector unsigned long long __b) {
3571   return vec_perm((vector unsigned long long)__a, __b,
3572                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3573                                          0x0C, 0x0D, 0x0E, 0x0F,
3574                                          0x18, 0X19, 0x1A, 0x1B,
3575                                          0x1C, 0x1D, 0x1E, 0x1F));
3576 }
3577 static vector bool long long __ATTRS_o_ai
3578 vec_mergel(vector bool long long __a, vector bool long long __b) {
3579   return vec_perm(__a, __b,
3580                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3581                                          0x0C, 0x0D, 0x0E, 0x0F,
3582                                          0x18, 0X19, 0x1A, 0x1B,
3583                                          0x1C, 0x1D, 0x1E, 0x1F));
3584 }
3585 static vector double __ATTRS_o_ai
3586 vec_mergel(vector double __a, vector double __b) {
3587   return vec_perm(__a, __b,
3588                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3589                                          0x0C, 0x0D, 0x0E, 0x0F,
3590                                          0x18, 0X19, 0x1A, 0x1B,
3591                                          0x1C, 0x1D, 0x1E, 0x1F));
3592 }
3593 static vector double __ATTRS_o_ai
3594 vec_mergel(vector double __a, vector bool long long __b) {
3595   return vec_perm(__a, (vector double)__b,
3596                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3597                                          0x0C, 0x0D, 0x0E, 0x0F,
3598                                          0x18, 0X19, 0x1A, 0x1B,
3599                                          0x1C, 0x1D, 0x1E, 0x1F));
3600 }
3601 static vector double __ATTRS_o_ai
3602 vec_mergel(vector bool long long __a, vector double __b) {
3603   return vec_perm((vector double)__a, __b,
3604                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B,
3605                                          0x0C, 0x0D, 0x0E, 0x0F,
3606                                          0x18, 0X19, 0x1A, 0x1B,
3607                                          0x1C, 0x1D, 0x1E, 0x1F));
3608 }
3609 #endif
3610
3611 /* vec_vmrglb */
3612
3613 #define __builtin_altivec_vmrglb vec_vmrglb
3614
3615 static vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a,
3616                                                   vector signed char __b) {
3617   return vec_perm(__a, __b,
3618                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3619                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3620                                          0x0E, 0x1E, 0x0F, 0x1F));
3621 }
3622
3623 static vector unsigned char __ATTRS_o_ai vec_vmrglb(vector unsigned char __a,
3624                                                     vector unsigned char __b) {
3625   return vec_perm(__a, __b,
3626                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3627                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3628                                          0x0E, 0x1E, 0x0F, 0x1F));
3629 }
3630
3631 static vector bool char __ATTRS_o_ai vec_vmrglb(vector bool char __a,
3632                                                 vector bool char __b) {
3633   return vec_perm(__a, __b,
3634                   (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
3635                                          0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
3636                                          0x0E, 0x1E, 0x0F, 0x1F));
3637 }
3638
3639 /* vec_vmrglh */
3640
3641 #define __builtin_altivec_vmrglh vec_vmrglh
3642
3643 static vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
3644                                             vector short __b) {
3645   return vec_perm(__a, __b,
3646                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3647                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3648                                          0x0E, 0x0F, 0x1E, 0x1F));
3649 }
3650
3651 static vector unsigned short __ATTRS_o_ai
3652 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
3653   return vec_perm(__a, __b,
3654                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3655                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3656                                          0x0E, 0x0F, 0x1E, 0x1F));
3657 }
3658
3659 static vector bool short __ATTRS_o_ai vec_vmrglh(vector bool short __a,
3660                                                  vector bool short __b) {
3661   return vec_perm(__a, __b,
3662                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3663                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3664                                          0x0E, 0x0F, 0x1E, 0x1F));
3665 }
3666
3667 static vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
3668                                             vector pixel __b) {
3669   return vec_perm(__a, __b,
3670                   (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
3671                                          0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
3672                                          0x0E, 0x0F, 0x1E, 0x1F));
3673 }
3674
3675 /* vec_vmrglw */
3676
3677 #define __builtin_altivec_vmrglw vec_vmrglw
3678
3679 static vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b) {
3680   return vec_perm(__a, __b,
3681                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3682                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3683                                          0x1C, 0x1D, 0x1E, 0x1F));
3684 }
3685
3686 static vector unsigned int __ATTRS_o_ai vec_vmrglw(vector unsigned int __a,
3687                                                    vector unsigned int __b) {
3688   return vec_perm(__a, __b,
3689                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3690                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3691                                          0x1C, 0x1D, 0x1E, 0x1F));
3692 }
3693
3694 static vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
3695                                                vector bool int __b) {
3696   return vec_perm(__a, __b,
3697                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3698                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3699                                          0x1C, 0x1D, 0x1E, 0x1F));
3700 }
3701
3702 static vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
3703                                             vector float __b) {
3704   return vec_perm(__a, __b,
3705                   (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
3706                                          0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
3707                                          0x1C, 0x1D, 0x1E, 0x1F));
3708 }
3709
3710
3711 #ifdef __POWER8_VECTOR__
3712 /* vec_mergee */
3713
3714 static vector bool int __ATTRS_o_ai
3715 vec_mergee(vector bool int __a, vector bool int __b) {
3716   return vec_perm(__a, __b, (vector unsigned char)
3717                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3718                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3719 }
3720
3721 static vector signed int __ATTRS_o_ai
3722 vec_mergee(vector signed int __a, vector signed int __b) {
3723   return vec_perm(__a, __b, (vector unsigned char)
3724                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3725                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3726 }
3727
3728 static vector unsigned int __ATTRS_o_ai
3729 vec_mergee(vector unsigned int __a, vector unsigned int __b) {
3730   return vec_perm(__a, __b, (vector unsigned char)
3731                   (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3732                    0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B));
3733 }
3734
3735 /* vec_mergeo */
3736
3737 static vector bool int  __ATTRS_o_ai
3738 vec_mergeo(vector bool int __a, vector bool int __b) {
3739   return vec_perm(__a, __b, (vector unsigned char)
3740                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3741                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3742 }
3743
3744 static vector signed int  __ATTRS_o_ai
3745 vec_mergeo(vector signed int __a, vector signed int __b) {
3746   return vec_perm(__a, __b, (vector unsigned char)
3747                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3748                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3749 }
3750
3751 static vector unsigned int  __ATTRS_o_ai
3752 vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
3753   return vec_perm(__a, __b, (vector unsigned char)
3754                   (0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17,
3755                    0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3756 }
3757
3758 #endif
3759
3760 /* vec_mfvscr */
3761
3762 static vector unsigned short __attribute__((__always_inline__))
3763 vec_mfvscr(void) {
3764   return __builtin_altivec_mfvscr();
3765 }
3766
3767 /* vec_min */
3768
3769 static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3770                                                vector signed char __b) {
3771   return __builtin_altivec_vminsb(__a, __b);
3772 }
3773
3774 static vector signed char __ATTRS_o_ai vec_min(vector bool char __a,
3775                                                vector signed char __b) {
3776   return __builtin_altivec_vminsb((vector signed char)__a, __b);
3777 }
3778
3779 static vector signed char __ATTRS_o_ai vec_min(vector signed char __a,
3780                                                vector bool char __b) {
3781   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3782 }
3783
3784 static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3785                                                  vector unsigned char __b) {
3786   return __builtin_altivec_vminub(__a, __b);
3787 }
3788
3789 static vector unsigned char __ATTRS_o_ai vec_min(vector bool char __a,
3790                                                  vector unsigned char __b) {
3791   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3792 }
3793
3794 static vector unsigned char __ATTRS_o_ai vec_min(vector unsigned char __a,
3795                                                  vector bool char __b) {
3796   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3797 }
3798
3799 static vector short __ATTRS_o_ai vec_min(vector short __a, vector short __b) {
3800   return __builtin_altivec_vminsh(__a, __b);
3801 }
3802
3803 static vector short __ATTRS_o_ai vec_min(vector bool short __a,
3804                                          vector short __b) {
3805   return __builtin_altivec_vminsh((vector short)__a, __b);
3806 }
3807
3808 static vector short __ATTRS_o_ai vec_min(vector short __a,
3809                                          vector bool short __b) {
3810   return __builtin_altivec_vminsh(__a, (vector short)__b);
3811 }
3812
3813 static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3814                                                   vector unsigned short __b) {
3815   return __builtin_altivec_vminuh(__a, __b);
3816 }
3817
3818 static vector unsigned short __ATTRS_o_ai vec_min(vector bool short __a,
3819                                                   vector unsigned short __b) {
3820   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3821 }
3822
3823 static vector unsigned short __ATTRS_o_ai vec_min(vector unsigned short __a,
3824                                                   vector bool short __b) {
3825   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3826 }
3827
3828 static vector int __ATTRS_o_ai vec_min(vector int __a, vector int __b) {
3829   return __builtin_altivec_vminsw(__a, __b);
3830 }
3831
3832 static vector int __ATTRS_o_ai vec_min(vector bool int __a, vector int __b) {
3833   return __builtin_altivec_vminsw((vector int)__a, __b);
3834 }
3835
3836 static vector int __ATTRS_o_ai vec_min(vector int __a, vector bool int __b) {
3837   return __builtin_altivec_vminsw(__a, (vector int)__b);
3838 }
3839
3840 static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3841                                                 vector unsigned int __b) {
3842   return __builtin_altivec_vminuw(__a, __b);
3843 }
3844
3845 static vector unsigned int __ATTRS_o_ai vec_min(vector bool int __a,
3846                                                 vector unsigned int __b) {
3847   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
3848 }
3849
3850 static vector unsigned int __ATTRS_o_ai vec_min(vector unsigned int __a,
3851                                                 vector bool int __b) {
3852   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
3853 }
3854
3855 #ifdef __POWER8_VECTOR__
3856 static vector signed long long __ATTRS_o_ai
3857 vec_min(vector signed long long __a, vector signed long long __b) {
3858   return __builtin_altivec_vminsd(__a, __b);
3859 }
3860
3861 static vector signed long long __ATTRS_o_ai
3862 vec_min(vector bool long long __a, vector signed long long __b) {
3863   return __builtin_altivec_vminsd((vector signed long long)__a, __b);
3864 }
3865
3866 static vector signed long long __ATTRS_o_ai vec_min(vector signed long long __a,
3867                                                     vector bool long long __b) {
3868   return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
3869 }
3870
3871 static vector unsigned long long __ATTRS_o_ai
3872 vec_min(vector unsigned long long __a, vector unsigned long long __b) {
3873   return __builtin_altivec_vminud(__a, __b);
3874 }
3875
3876 static vector unsigned long long __ATTRS_o_ai
3877 vec_min(vector bool long long __a, vector unsigned long long __b) {
3878   return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
3879 }
3880
3881 static vector unsigned long long __ATTRS_o_ai
3882 vec_min(vector unsigned long long __a, vector bool long long __b) {
3883   return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
3884 }
3885 #endif
3886
3887 static vector float __ATTRS_o_ai vec_min(vector float __a, vector float __b) {
3888 #ifdef __VSX__
3889   return __builtin_vsx_xvminsp(__a, __b);
3890 #else
3891   return __builtin_altivec_vminfp(__a, __b);
3892 #endif
3893 }
3894
3895 #ifdef __VSX__
3896 static vector double __ATTRS_o_ai vec_min(vector double __a,
3897                                           vector double __b) {
3898   return __builtin_vsx_xvmindp(__a, __b);
3899 }
3900 #endif
3901
3902 /* vec_vminsb */
3903
3904 static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3905                                                   vector signed char __b) {
3906   return __builtin_altivec_vminsb(__a, __b);
3907 }
3908
3909 static vector signed char __ATTRS_o_ai vec_vminsb(vector bool char __a,
3910                                                   vector signed char __b) {
3911   return __builtin_altivec_vminsb((vector signed char)__a, __b);
3912 }
3913
3914 static vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a,
3915                                                   vector bool char __b) {
3916   return __builtin_altivec_vminsb(__a, (vector signed char)__b);
3917 }
3918
3919 /* vec_vminub */
3920
3921 static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3922                                                     vector unsigned char __b) {
3923   return __builtin_altivec_vminub(__a, __b);
3924 }
3925
3926 static vector unsigned char __ATTRS_o_ai vec_vminub(vector bool char __a,
3927                                                     vector unsigned char __b) {
3928   return __builtin_altivec_vminub((vector unsigned char)__a, __b);
3929 }
3930
3931 static vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a,
3932                                                     vector bool char __b) {
3933   return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
3934 }
3935
3936 /* vec_vminsh */
3937
3938 static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3939                                             vector short __b) {
3940   return __builtin_altivec_vminsh(__a, __b);
3941 }
3942
3943 static vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
3944                                             vector short __b) {
3945   return __builtin_altivec_vminsh((vector short)__a, __b);
3946 }
3947
3948 static vector short __ATTRS_o_ai vec_vminsh(vector short __a,
3949                                             vector bool short __b) {
3950   return __builtin_altivec_vminsh(__a, (vector short)__b);
3951 }
3952
3953 /* vec_vminuh */
3954
3955 static vector unsigned short __ATTRS_o_ai
3956 vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
3957   return __builtin_altivec_vminuh(__a, __b);
3958 }
3959
3960 static vector unsigned short __ATTRS_o_ai
3961 vec_vminuh(vector bool short __a, vector unsigned short __b) {
3962   return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
3963 }
3964
3965 static vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a,
3966                                                      vector bool short __b) {
3967   return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
3968 }
3969
3970 /* vec_vminsw */
3971
3972 static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b) {
3973   return __builtin_altivec_vminsw(__a, __b);
3974 }
3975
3976 static vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, vector int __b) {
3977   return __builtin_altivec_vminsw((vector int)__a, __b);
3978 }
3979
3980 static vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector bool int __b) {
3981   return __builtin_altivec_vminsw(__a, (vector int)__b);
3982 }
3983
3984 /* vec_vminuw */
3985
3986 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3987                                                    vector unsigned int __b) {
3988   return __builtin_altivec_vminuw(__a, __b);
3989 }
3990
3991 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector bool int __a,
3992                                                    vector unsigned int __b) {
3993   return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
3994 }
3995
3996 static vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a,
3997                                                    vector bool int __b) {
3998   return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
3999 }
4000
4001 /* vec_vminfp */
4002
4003 static vector float __attribute__((__always_inline__))
4004 vec_vminfp(vector float __a, vector float __b) {
4005 #ifdef __VSX__
4006   return __builtin_vsx_xvminsp(__a, __b);
4007 #else
4008   return __builtin_altivec_vminfp(__a, __b);
4009 #endif
4010 }
4011
4012 /* vec_mladd */
4013
4014 #define __builtin_altivec_vmladduhm vec_mladd
4015
4016 static vector short __ATTRS_o_ai vec_mladd(vector short __a, vector short __b,
4017                                            vector short __c) {
4018   return __a * __b + __c;
4019 }
4020
4021 static vector short __ATTRS_o_ai vec_mladd(vector short __a,
4022                                            vector unsigned short __b,
4023                                            vector unsigned short __c) {
4024   return __a * (vector short)__b + (vector short)__c;
4025 }
4026
4027 static vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4028                                            vector short __b, vector short __c) {
4029   return (vector short)__a * __b + __c;
4030 }
4031
4032 static vector unsigned short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
4033                                                     vector unsigned short __b,
4034                                                     vector unsigned short __c) {
4035   return __a * __b + __c;
4036 }
4037
4038 /* vec_vmladduhm */
4039
4040 static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4041                                                vector short __b,
4042                                                vector short __c) {
4043   return __a * __b + __c;
4044 }
4045
4046 static vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
4047                                                vector unsigned short __b,
4048                                                vector unsigned short __c) {
4049   return __a * (vector short)__b + (vector short)__c;
4050 }
4051
4052 static vector short __ATTRS_o_ai vec_vmladduhm(vector unsigned short __a,
4053                                                vector short __b,
4054                                                vector short __c) {
4055   return (vector short)__a * __b + __c;
4056 }
4057
4058 static vector unsigned short __ATTRS_o_ai
4059 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
4060               vector unsigned short __c) {
4061   return __a * __b + __c;
4062 }
4063
4064 /* vec_mradds */
4065
4066 static vector short __attribute__((__always_inline__))
4067 vec_mradds(vector short __a, vector short __b, vector short __c) {
4068   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4069 }
4070
4071 /* vec_vmhraddshs */
4072
4073 static vector short __attribute__((__always_inline__))
4074 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
4075   return __builtin_altivec_vmhraddshs(__a, __b, __c);
4076 }
4077
4078 /* vec_msum */
4079
4080 static vector int __ATTRS_o_ai vec_msum(vector signed char __a,
4081                                         vector unsigned char __b,
4082                                         vector int __c) {
4083   return __builtin_altivec_vmsummbm(__a, __b, __c);
4084 }
4085
4086 static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned char __a,
4087                                                  vector unsigned char __b,
4088                                                  vector unsigned int __c) {
4089   return __builtin_altivec_vmsumubm(__a, __b, __c);
4090 }
4091
4092 static vector int __ATTRS_o_ai vec_msum(vector short __a, vector short __b,
4093                                         vector int __c) {
4094   return __builtin_altivec_vmsumshm(__a, __b, __c);
4095 }
4096
4097 static vector unsigned int __ATTRS_o_ai vec_msum(vector unsigned short __a,
4098                                                  vector unsigned short __b,
4099                                                  vector unsigned int __c) {
4100   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4101 }
4102
4103 /* vec_vmsummbm */
4104
4105 static vector int __attribute__((__always_inline__))
4106 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
4107   return __builtin_altivec_vmsummbm(__a, __b, __c);
4108 }
4109
4110 /* vec_vmsumubm */
4111
4112 static vector unsigned int __attribute__((__always_inline__))
4113 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
4114              vector unsigned int __c) {
4115   return __builtin_altivec_vmsumubm(__a, __b, __c);
4116 }
4117
4118 /* vec_vmsumshm */
4119
4120 static vector int __attribute__((__always_inline__))
4121 vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
4122   return __builtin_altivec_vmsumshm(__a, __b, __c);
4123 }
4124
4125 /* vec_vmsumuhm */
4126
4127 static vector unsigned int __attribute__((__always_inline__))
4128 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
4129              vector unsigned int __c) {
4130   return __builtin_altivec_vmsumuhm(__a, __b, __c);
4131 }
4132
4133 /* vec_msums */
4134
4135 static vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b,
4136                                          vector int __c) {
4137   return __builtin_altivec_vmsumshs(__a, __b, __c);
4138 }
4139
4140 static vector unsigned int __ATTRS_o_ai vec_msums(vector unsigned short __a,
4141                                                   vector unsigned short __b,
4142                                                   vector unsigned int __c) {
4143   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4144 }
4145
4146 /* vec_vmsumshs */
4147
4148 static vector int __attribute__((__always_inline__))
4149 vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
4150   return __builtin_altivec_vmsumshs(__a, __b, __c);
4151 }
4152
4153 /* vec_vmsumuhs */
4154
4155 static vector unsigned int __attribute__((__always_inline__))
4156 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
4157              vector unsigned int __c) {
4158   return __builtin_altivec_vmsumuhs(__a, __b, __c);
4159 }
4160
4161 /* vec_mtvscr */
4162
4163 static void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
4164   __builtin_altivec_mtvscr((vector int)__a);
4165 }
4166
4167 static void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
4168   __builtin_altivec_mtvscr((vector int)__a);
4169 }
4170
4171 static void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
4172   __builtin_altivec_mtvscr((vector int)__a);
4173 }
4174
4175 static void __ATTRS_o_ai vec_mtvscr(vector short __a) {
4176   __builtin_altivec_mtvscr((vector int)__a);
4177 }
4178
4179 static void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
4180   __builtin_altivec_mtvscr((vector int)__a);
4181 }
4182
4183 static void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
4184   __builtin_altivec_mtvscr((vector int)__a);
4185 }
4186
4187 static void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
4188   __builtin_altivec_mtvscr((vector int)__a);
4189 }
4190
4191 static void __ATTRS_o_ai vec_mtvscr(vector int __a) {
4192   __builtin_altivec_mtvscr((vector int)__a);
4193 }
4194
4195 static void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
4196   __builtin_altivec_mtvscr((vector int)__a);
4197 }
4198
4199 static void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
4200   __builtin_altivec_mtvscr((vector int)__a);
4201 }
4202
4203 static void __ATTRS_o_ai vec_mtvscr(vector float __a) {
4204   __builtin_altivec_mtvscr((vector int)__a);
4205 }
4206
4207 /* vec_mul */
4208
4209 /* Integer vector multiplication will involve multiplication of the odd/even
4210    elements separately, then truncating the results and moving to the
4211    result vector.
4212 */
4213 static vector signed char __ATTRS_o_ai vec_mul(vector signed char __a,
4214                                                vector signed char __b) {
4215   return __a * __b;
4216 }
4217
4218 static vector unsigned char __ATTRS_o_ai vec_mul(vector unsigned char __a,
4219                                                  vector unsigned char __b) {
4220   return __a * __b;
4221 }
4222
4223 static vector signed short __ATTRS_o_ai vec_mul(vector signed short __a,
4224                                                 vector signed short __b) {
4225   return __a * __b;
4226 }
4227
4228 static vector unsigned short __ATTRS_o_ai vec_mul(vector unsigned short __a,
4229                                                   vector unsigned short __b) {
4230   return __a * __b;
4231 }
4232
4233 static vector signed int __ATTRS_o_ai vec_mul(vector signed int __a,
4234                                               vector signed int __b) {
4235   return __a * __b;
4236 }
4237
4238 static vector unsigned int __ATTRS_o_ai vec_mul(vector unsigned int __a,
4239                                                 vector unsigned int __b) {
4240   return __a * __b;
4241 }
4242
4243 #ifdef __VSX__
4244 static vector signed long long __ATTRS_o_ai
4245 vec_mul(vector signed long long __a, vector signed long long __b) {
4246   return __a * __b;
4247 }
4248
4249 static vector unsigned long long __ATTRS_o_ai
4250 vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
4251   return __a * __b;
4252 }
4253 #endif
4254
4255 static vector float __ATTRS_o_ai vec_mul(vector float __a, vector float __b) {
4256   return __a * __b;
4257 }
4258
4259 #ifdef __VSX__
4260 static vector double __ATTRS_o_ai
4261 vec_mul(vector double __a, vector double __b) {
4262   return __a * __b;
4263 }
4264 #endif
4265
4266 /* The vmulos* and vmules* instructions have a big endian bias, so
4267    we must reverse the meaning of "even" and "odd" for little endian.  */
4268
4269 /* vec_mule */
4270
4271 static vector short __ATTRS_o_ai vec_mule(vector signed char __a,
4272                                           vector signed char __b) {
4273 #ifdef __LITTLE_ENDIAN__
4274   return __builtin_altivec_vmulosb(__a, __b);
4275 #else
4276   return __builtin_altivec_vmulesb(__a, __b);
4277 #endif
4278 }
4279
4280 static vector unsigned short __ATTRS_o_ai vec_mule(vector unsigned char __a,
4281                                                    vector unsigned char __b) {
4282 #ifdef __LITTLE_ENDIAN__
4283   return __builtin_altivec_vmuloub(__a, __b);
4284 #else
4285   return __builtin_altivec_vmuleub(__a, __b);
4286 #endif
4287 }
4288
4289 static vector int __ATTRS_o_ai vec_mule(vector short __a, vector short __b) {
4290 #ifdef __LITTLE_ENDIAN__
4291   return __builtin_altivec_vmulosh(__a, __b);
4292 #else
4293   return __builtin_altivec_vmulesh(__a, __b);
4294 #endif
4295 }
4296
4297 static vector unsigned int __ATTRS_o_ai vec_mule(vector unsigned short __a,
4298                                                  vector unsigned short __b) {
4299 #ifdef __LITTLE_ENDIAN__
4300   return __builtin_altivec_vmulouh(__a, __b);
4301 #else
4302   return __builtin_altivec_vmuleuh(__a, __b);
4303 #endif
4304 }
4305
4306 #ifdef __POWER8_VECTOR__
4307 static vector signed long long __ATTRS_o_ai vec_mule(vector signed int __a,
4308                                                      vector signed int __b) {
4309 #ifdef __LITTLE_ENDIAN__
4310   return __builtin_altivec_vmulosw(__a, __b);
4311 #else
4312   return __builtin_altivec_vmulesw(__a, __b);
4313 #endif
4314 }
4315
4316 static vector unsigned long long __ATTRS_o_ai
4317 vec_mule(vector unsigned int __a, vector unsigned int __b) {
4318 #ifdef __LITTLE_ENDIAN__
4319   return __builtin_altivec_vmulouw(__a, __b);
4320 #else
4321   return __builtin_altivec_vmuleuw(__a, __b);
4322 #endif
4323 }
4324 #endif
4325
4326 /* vec_vmulesb */
4327
4328 static vector short __attribute__((__always_inline__))
4329 vec_vmulesb(vector signed char __a, vector signed char __b) {
4330 #ifdef __LITTLE_ENDIAN__
4331   return __builtin_altivec_vmulosb(__a, __b);
4332 #else
4333   return __builtin_altivec_vmulesb(__a, __b);
4334 #endif
4335 }
4336
4337 /* vec_vmuleub */
4338
4339 static vector unsigned short __attribute__((__always_inline__))
4340 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
4341 #ifdef __LITTLE_ENDIAN__
4342   return __builtin_altivec_vmuloub(__a, __b);
4343 #else
4344   return __builtin_altivec_vmuleub(__a, __b);
4345 #endif
4346 }
4347
4348 /* vec_vmulesh */
4349
4350 static vector int __attribute__((__always_inline__))
4351 vec_vmulesh(vector short __a, vector short __b) {
4352 #ifdef __LITTLE_ENDIAN__
4353   return __builtin_altivec_vmulosh(__a, __b);
4354 #else
4355   return __builtin_altivec_vmulesh(__a, __b);
4356 #endif
4357 }
4358
4359 /* vec_vmuleuh */
4360
4361 static vector unsigned int __attribute__((__always_inline__))
4362 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
4363 #ifdef __LITTLE_ENDIAN__
4364   return __builtin_altivec_vmulouh(__a, __b);
4365 #else
4366   return __builtin_altivec_vmuleuh(__a, __b);
4367 #endif
4368 }
4369
4370 /* vec_mulo */
4371
4372 static vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
4373                                           vector signed char __b) {
4374 #ifdef __LITTLE_ENDIAN__
4375   return __builtin_altivec_vmulesb(__a, __b);
4376 #else
4377   return __builtin_altivec_vmulosb(__a, __b);
4378 #endif
4379 }
4380
4381 static vector unsigned short __ATTRS_o_ai vec_mulo(vector unsigned char __a,
4382                                                    vector unsigned char __b) {
4383 #ifdef __LITTLE_ENDIAN__
4384   return __builtin_altivec_vmuleub(__a, __b);
4385 #else
4386   return __builtin_altivec_vmuloub(__a, __b);
4387 #endif
4388 }
4389
4390 static vector int __ATTRS_o_ai vec_mulo(vector short __a, vector short __b) {
4391 #ifdef __LITTLE_ENDIAN__
4392   return __builtin_altivec_vmulesh(__a, __b);
4393 #else
4394   return __builtin_altivec_vmulosh(__a, __b);
4395 #endif
4396 }
4397
4398 static vector unsigned int __ATTRS_o_ai vec_mulo(vector unsigned short __a,
4399                                                  vector unsigned short __b) {
4400 #ifdef __LITTLE_ENDIAN__
4401   return __builtin_altivec_vmuleuh(__a, __b);
4402 #else
4403   return __builtin_altivec_vmulouh(__a, __b);
4404 #endif
4405 }
4406
4407 #ifdef __POWER8_VECTOR__
4408 static vector signed long long __ATTRS_o_ai vec_mulo(vector signed int __a,
4409                                                      vector signed int __b) {
4410 #ifdef __LITTLE_ENDIAN__
4411   return __builtin_altivec_vmulesw(__a, __b);
4412 #else
4413   return __builtin_altivec_vmulosw(__a, __b);
4414 #endif
4415 }
4416
4417 static vector unsigned long long __ATTRS_o_ai
4418 vec_mulo(vector unsigned int __a, vector unsigned int __b) {
4419 #ifdef __LITTLE_ENDIAN__
4420   return __builtin_altivec_vmuleuw(__a, __b);
4421 #else
4422   return __builtin_altivec_vmulouw(__a, __b);
4423 #endif
4424 }
4425 #endif
4426
4427 /* vec_vmulosb */
4428
4429 static vector short __attribute__((__always_inline__))
4430 vec_vmulosb(vector signed char __a, vector signed char __b) {
4431 #ifdef __LITTLE_ENDIAN__
4432   return __builtin_altivec_vmulesb(__a, __b);
4433 #else
4434   return __builtin_altivec_vmulosb(__a, __b);
4435 #endif
4436 }
4437
4438 /* vec_vmuloub */
4439
4440 static vector unsigned short __attribute__((__always_inline__))
4441 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
4442 #ifdef __LITTLE_ENDIAN__
4443   return __builtin_altivec_vmuleub(__a, __b);
4444 #else
4445   return __builtin_altivec_vmuloub(__a, __b);
4446 #endif
4447 }
4448
4449 /* vec_vmulosh */
4450
4451 static vector int __attribute__((__always_inline__))
4452 vec_vmulosh(vector short __a, vector short __b) {
4453 #ifdef __LITTLE_ENDIAN__
4454   return __builtin_altivec_vmulesh(__a, __b);
4455 #else
4456   return __builtin_altivec_vmulosh(__a, __b);
4457 #endif
4458 }
4459
4460 /* vec_vmulouh */
4461
4462 static vector unsigned int __attribute__((__always_inline__))
4463 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
4464 #ifdef __LITTLE_ENDIAN__
4465   return __builtin_altivec_vmuleuh(__a, __b);
4466 #else
4467   return __builtin_altivec_vmulouh(__a, __b);
4468 #endif
4469 }
4470
4471 /*  vec_nand */
4472
4473 #ifdef __POWER8_VECTOR__
4474 static vector signed char __ATTRS_o_ai vec_nand(vector signed char __a,
4475                                                 vector signed char __b) {
4476   return ~(__a & __b);
4477 }
4478
4479 static vector signed char __ATTRS_o_ai vec_nand(vector signed char __a,
4480                                                 vector bool char __b) {
4481   return ~(__a & __b);
4482 }
4483
4484 static vector signed char __ATTRS_o_ai vec_nand(vector bool char __a,
4485                                                 vector signed char __b) {
4486   return ~(__a & __b);
4487 }
4488
4489 static vector unsigned char __ATTRS_o_ai vec_nand(vector unsigned char __a,
4490                                                   vector unsigned char __b) {
4491   return ~(__a & __b);
4492 }
4493
4494 static vector unsigned char __ATTRS_o_ai vec_nand(vector unsigned char __a,
4495                                                   vector bool char __b) {
4496   return ~(__a & __b);
4497
4498 }
4499
4500 static vector unsigned char __ATTRS_o_ai vec_nand(vector bool char __a,
4501                                                   vector unsigned char __b) {
4502   return ~(__a & __b);
4503 }
4504
4505 static vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
4506                                               vector bool char __b) {
4507   return ~(__a & __b);
4508 }
4509
4510 static vector signed short __ATTRS_o_ai vec_nand(vector signed short __a,
4511                                                  vector signed short __b) {
4512   return ~(__a & __b);
4513 }
4514
4515 static vector signed short __ATTRS_o_ai vec_nand(vector signed short __a,
4516                                                  vector bool short __b) {
4517   return ~(__a & __b);
4518 }
4519
4520 static vector signed short __ATTRS_o_ai vec_nand(vector bool short __a,
4521                                                  vector signed short __b) {
4522   return ~(__a & __b);
4523 }
4524
4525 static vector unsigned short __ATTRS_o_ai vec_nand(vector unsigned short __a,
4526                                                    vector unsigned short __b) {
4527   return ~(__a & __b);
4528 }
4529
4530 static vector unsigned short __ATTRS_o_ai vec_nand(vector unsigned short __a,
4531                                                    vector bool short __b) {
4532   return ~(__a & __b);
4533
4534 }
4535
4536 static vector bool short __ATTRS_o_ai vec_nand(vector bool short __a,
4537                                                vector bool short __b) {
4538   return ~(__a & __b);
4539
4540 }
4541
4542 static vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4543                                                vector signed int __b) {
4544   return ~(__a & __b);
4545 }
4546
4547 static vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
4548                                                vector bool int __b) {
4549   return ~(__a & __b);
4550 }
4551
4552 static vector signed int __ATTRS_o_ai vec_nand(vector bool int __a,
4553                                                vector signed int __b) {
4554   return ~(__a & __b);
4555 }
4556
4557 static vector unsigned int __ATTRS_o_ai vec_nand(vector unsigned int __a,
4558                                                  vector unsigned int __b) {
4559   return ~(__a & __b);
4560 }
4561
4562 static vector unsigned int __ATTRS_o_ai vec_nand(vector unsigned int __a,
4563                                                  vector bool int __b) {
4564   return ~(__a & __b);
4565 }
4566
4567 static vector unsigned int __ATTRS_o_ai vec_nand(vector bool int __a,
4568                                                  vector unsigned int __b) {
4569   return ~(__a & __b);
4570 }
4571
4572 static vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
4573                                              vector bool int __b) {
4574   return ~(__a & __b);
4575 }
4576
4577 static vector signed long long __ATTRS_o_ai
4578 vec_nand(vector signed long long __a, vector signed long long __b) {
4579   return ~(__a & __b);
4580 }
4581
4582 static vector signed long long __ATTRS_o_ai
4583 vec_nand(vector signed long long __a, vector bool long long __b) {
4584   return ~(__a & __b);
4585 }
4586
4587 static vector signed long long __ATTRS_o_ai
4588 vec_nand(vector bool long long __a, vector signed long long __b) {
4589   return ~(__a & __b);
4590 }
4591
4592 static vector unsigned long long __ATTRS_o_ai
4593 vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
4594   return ~(__a & __b);
4595 }
4596
4597 static vector unsigned long long __ATTRS_o_ai
4598 vec_nand(vector unsigned long long __a, vector bool long long __b) {
4599   return ~(__a & __b);
4600 }
4601
4602 static vector unsigned long long __ATTRS_o_ai
4603 vec_nand(vector bool long long __a, vector unsigned long long __b) {
4604   return ~(__a & __b);
4605 }
4606
4607 static vector bool long long __ATTRS_o_ai
4608 vec_nand(vector bool long long __a, vector bool long long __b) {
4609   return ~(__a & __b);
4610 }
4611
4612 #endif
4613
4614 /* vec_nmadd */
4615
4616 #ifdef __VSX__
4617 static vector float __ATTRS_o_ai
4618 vec_nmadd(vector float __a, vector float __b, vector float __c) {
4619   return __builtin_vsx_xvnmaddasp(__a, __b, __c);
4620 }
4621
4622 static vector double __ATTRS_o_ai
4623 vec_nmadd(vector double __a, vector double __b, vector double __c) {
4624   return __builtin_vsx_xvnmaddadp(__a, __b, __c);
4625 }
4626 #endif
4627
4628 /* vec_nmsub */
4629
4630 static vector float __ATTRS_o_ai
4631 vec_nmsub(vector float __a, vector float __b, vector float __c) {
4632 #ifdef __VSX__
4633   return __builtin_vsx_xvnmsubasp(__a, __b, __c);
4634 #else
4635   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4636 #endif
4637 }
4638
4639 #ifdef __VSX__
4640 static vector double __ATTRS_o_ai
4641 vec_nmsub(vector double __a, vector double __b, vector double __c) {
4642   return __builtin_vsx_xvnmsubadp(__a, __b, __c);
4643 }
4644 #endif
4645
4646 /* vec_vnmsubfp */
4647
4648 static vector float __attribute__((__always_inline__))
4649 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
4650   return __builtin_altivec_vnmsubfp(__a, __b, __c);
4651 }
4652
4653 /* vec_nor */
4654
4655 #define __builtin_altivec_vnor vec_nor
4656
4657 static vector signed char __ATTRS_o_ai vec_nor(vector signed char __a,
4658                                                vector signed char __b) {
4659   return ~(__a | __b);
4660 }
4661
4662 static vector unsigned char __ATTRS_o_ai vec_nor(vector unsigned char __a,
4663                                                  vector unsigned char __b) {
4664   return ~(__a | __b);
4665 }
4666
4667 static vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
4668                                              vector bool char __b) {
4669   return ~(__a | __b);
4670 }
4671
4672 static vector short __ATTRS_o_ai vec_nor(vector short __a, vector short __b) {
4673   return ~(__a | __b);
4674 }
4675
4676 static vector unsigned short __ATTRS_o_ai vec_nor(vector unsigned short __a,
4677                                                   vector unsigned short __b) {
4678   return ~(__a | __b);
4679 }
4680
4681 static vector bool short __ATTRS_o_ai vec_nor(vector bool short __a,
4682                                               vector bool short __b) {
4683   return ~(__a | __b);
4684 }
4685
4686 static vector int __ATTRS_o_ai vec_nor(vector int __a, vector int __b) {
4687   return ~(__a | __b);
4688 }
4689
4690 static vector unsigned int __ATTRS_o_ai vec_nor(vector unsigned int __a,
4691                                                 vector unsigned int __b) {
4692   return ~(__a | __b);
4693 }
4694
4695 static vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
4696                                             vector bool int __b) {
4697   return ~(__a | __b);
4698 }
4699
4700 static vector float __ATTRS_o_ai vec_nor(vector float __a, vector float __b) {
4701   vector unsigned int __res =
4702       ~((vector unsigned int)__a | (vector unsigned int)__b);
4703   return (vector float)__res;
4704 }
4705
4706 #ifdef __VSX__
4707 static vector double __ATTRS_o_ai
4708 vec_nor(vector double __a, vector double __b) {
4709   vector unsigned long long __res =
4710       ~((vector unsigned long long)__a | (vector unsigned long long)__b);
4711   return (vector double)__res;
4712 }
4713 #endif
4714
4715 /* vec_vnor */
4716
4717 static vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a,
4718                                                 vector signed char __b) {
4719   return ~(__a | __b);
4720 }
4721
4722 static vector unsigned char __ATTRS_o_ai vec_vnor(vector unsigned char __a,
4723                                                   vector unsigned char __b) {
4724   return ~(__a | __b);
4725 }
4726
4727 static vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
4728                                               vector bool char __b) {
4729   return ~(__a | __b);
4730 }
4731
4732 static vector short __ATTRS_o_ai vec_vnor(vector short __a, vector short __b) {
4733   return ~(__a | __b);
4734 }
4735
4736 static vector unsigned short __ATTRS_o_ai vec_vnor(vector unsigned short __a,
4737                                                    vector unsigned short __b) {
4738   return ~(__a | __b);
4739 }
4740
4741 static vector bool short __ATTRS_o_ai vec_vnor(vector bool short __a,
4742                                                vector bool short __b) {
4743   return ~(__a | __b);
4744 }
4745
4746 static vector int __ATTRS_o_ai vec_vnor(vector int __a, vector int __b) {
4747   return ~(__a | __b);
4748 }
4749
4750 static vector unsigned int __ATTRS_o_ai vec_vnor(vector unsigned int __a,
4751                                                  vector unsigned int __b) {
4752   return ~(__a | __b);
4753 }
4754
4755 static vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
4756                                              vector bool int __b) {
4757   return ~(__a | __b);
4758 }
4759
4760 static vector float __ATTRS_o_ai vec_vnor(vector float __a, vector float __b) {
4761   vector unsigned int __res =
4762       ~((vector unsigned int)__a | (vector unsigned int)__b);
4763   return (vector float)__res;
4764 }
4765
4766 #ifdef __VSX__
4767 static vector signed long long __ATTRS_o_ai
4768 vec_nor(vector signed long long __a, vector signed long long __b) {
4769   return ~(__a | __b);
4770 }
4771
4772 static vector unsigned long long __ATTRS_o_ai
4773 vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
4774   return ~(__a | __b);
4775 }
4776
4777 static vector bool long long __ATTRS_o_ai vec_nor(vector bool long long __a,
4778                                                   vector bool long long __b) {
4779   return ~(__a | __b);
4780 }
4781 #endif
4782
4783 /* vec_or */
4784
4785 #define __builtin_altivec_vor vec_or
4786
4787 static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4788                                               vector signed char __b) {
4789   return __a | __b;
4790 }
4791
4792 static vector signed char __ATTRS_o_ai vec_or(vector bool char __a,
4793                                               vector signed char __b) {
4794   return (vector signed char)__a | __b;
4795 }
4796
4797 static vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
4798                                               vector bool char __b) {
4799   return __a | (vector signed char)__b;
4800 }
4801
4802 static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4803                                                 vector unsigned char __b) {
4804   return __a | __b;
4805 }
4806
4807 static vector unsigned char __ATTRS_o_ai vec_or(vector bool char __a,
4808                                                 vector unsigned char __b) {
4809   return (vector unsigned char)__a | __b;
4810 }
4811
4812 static vector unsigned char __ATTRS_o_ai vec_or(vector unsigned char __a,
4813                                                 vector bool char __b) {
4814   return __a | (vector unsigned char)__b;
4815 }
4816
4817 static vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
4818                                             vector bool char __b) {
4819   return __a | __b;
4820 }
4821
4822 static vector short __ATTRS_o_ai vec_or(vector short __a, vector short __b) {
4823   return __a | __b;
4824 }
4825
4826 static vector short __ATTRS_o_ai vec_or(vector bool short __a,
4827                                         vector short __b) {
4828   return (vector short)__a | __b;
4829 }
4830
4831 static vector short __ATTRS_o_ai vec_or(vector short __a,
4832                                         vector bool short __b) {
4833   return __a | (vector short)__b;
4834 }
4835
4836 static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4837                                                  vector unsigned short __b) {
4838   return __a | __b;
4839 }
4840
4841 static vector unsigned short __ATTRS_o_ai vec_or(vector bool short __a,
4842                                                  vector unsigned short __b) {
4843   return (vector unsigned short)__a | __b;
4844 }
4845
4846 static vector unsigned short __ATTRS_o_ai vec_or(vector unsigned short __a,
4847                                                  vector bool short __b) {
4848   return __a | (vector unsigned short)__b;
4849 }
4850
4851 static vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
4852                                              vector bool short __b) {
4853   return __a | __b;
4854 }
4855
4856 static vector int __ATTRS_o_ai vec_or(vector int __a, vector int __b) {
4857   return __a | __b;
4858 }
4859
4860 static vector int __ATTRS_o_ai vec_or(vector bool int __a, vector int __b) {
4861   return (vector int)__a | __b;
4862 }
4863
4864 static vector int __ATTRS_o_ai vec_or(vector int __a, vector bool int __b) {
4865   return __a | (vector int)__b;
4866 }
4867
4868 static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4869                                                vector unsigned int __b) {
4870   return __a | __b;
4871 }
4872
4873 static vector unsigned int __ATTRS_o_ai vec_or(vector bool int __a,
4874                                                vector unsigned int __b) {
4875   return (vector unsigned int)__a | __b;
4876 }
4877
4878 static vector unsigned int __ATTRS_o_ai vec_or(vector unsigned int __a,
4879                                                vector bool int __b) {
4880   return __a | (vector unsigned int)__b;
4881 }
4882
4883 static vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
4884                                            vector bool int __b) {
4885   return __a | __b;
4886 }
4887
4888 static vector float __ATTRS_o_ai vec_or(vector float __a, vector float __b) {
4889   vector unsigned int __res =
4890       (vector unsigned int)__a | (vector unsigned int)__b;
4891   return (vector float)__res;
4892 }
4893
4894 static vector float __ATTRS_o_ai vec_or(vector bool int __a, vector float __b) {
4895   vector unsigned int __res =
4896       (vector unsigned int)__a | (vector unsigned int)__b;
4897   return (vector float)__res;
4898 }
4899
4900 static vector float __ATTRS_o_ai vec_or(vector float __a, vector bool int __b) {
4901   vector unsigned int __res =
4902       (vector unsigned int)__a | (vector unsigned int)__b;
4903   return (vector float)__res;
4904 }
4905
4906 #ifdef __VSX__
4907 static vector double __ATTRS_o_ai vec_or(vector bool long long __a,
4908                                          vector double __b) {
4909   return (vector unsigned long long)__a | (vector unsigned long long)__b;
4910 }
4911
4912 static vector double __ATTRS_o_ai vec_or(vector double __a,
4913                                          vector bool long long __b) {
4914   return (vector unsigned long long)__a | (vector unsigned long long)__b;
4915 }
4916
4917 static vector double __ATTRS_o_ai vec_or(vector double __a, vector double __b) {
4918   vector unsigned long long __res =
4919       (vector unsigned long long)__a | (vector unsigned long long)__b;
4920   return (vector double)__res;
4921 }
4922
4923 static vector signed long long __ATTRS_o_ai
4924 vec_or(vector signed long long __a, vector signed long long __b) {
4925   return __a | __b;
4926 }
4927
4928 static vector signed long long __ATTRS_o_ai
4929 vec_or(vector bool long long __a, vector signed long long __b) {
4930   return (vector signed long long)__a | __b;
4931 }
4932
4933 static vector signed long long __ATTRS_o_ai vec_or(vector signed long long __a,
4934                                                    vector bool long long __b) {
4935   return __a | (vector signed long long)__b;
4936 }
4937
4938 static vector unsigned long long __ATTRS_o_ai
4939 vec_or(vector unsigned long long __a, vector unsigned long long __b) {
4940   return __a | __b;
4941 }
4942
4943 static vector unsigned long long __ATTRS_o_ai
4944 vec_or(vector bool long long __a, vector unsigned long long __b) {
4945   return (vector unsigned long long)__a | __b;
4946 }
4947
4948 static vector unsigned long long __ATTRS_o_ai
4949 vec_or(vector unsigned long long __a, vector bool long long __b) {
4950   return __a | (vector unsigned long long)__b;
4951 }
4952
4953 static vector bool long long __ATTRS_o_ai vec_or(vector bool long long __a,
4954                                                  vector bool long long __b) {
4955   return __a | __b;
4956 }
4957 #endif
4958
4959 #ifdef __POWER8_VECTOR__
4960 static vector signed char __ATTRS_o_ai vec_orc(vector signed char __a,
4961                                                vector signed char __b) {
4962   return __a | ~__b;
4963 }
4964
4965 static vector signed char __ATTRS_o_ai vec_orc(vector signed char __a,
4966                                                vector bool char __b) {
4967   return __a | ~__b;
4968 }
4969
4970 static vector signed char __ATTRS_o_ai vec_orc(vector bool char __a,
4971                                                vector signed char __b) {
4972   return __a | ~__b;
4973 }
4974
4975 static vector unsigned char __ATTRS_o_ai vec_orc(vector unsigned char __a,
4976                                                  vector unsigned char __b) {
4977   return __a | ~__b;
4978 }
4979
4980 static vector unsigned char __ATTRS_o_ai vec_orc(vector unsigned char __a,
4981                                                  vector bool char __b) {
4982   return __a | ~__b;
4983 }
4984
4985 static vector unsigned char __ATTRS_o_ai vec_orc(vector bool char __a,
4986                                                  vector unsigned char __b) {
4987   return __a | ~__b;
4988 }
4989
4990 static vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
4991                                              vector bool char __b) {
4992   return __a | ~__b;
4993 }
4994
4995 static vector signed short __ATTRS_o_ai vec_orc(vector signed short __a,
4996                                                 vector signed short __b) {
4997   return __a | ~__b;
4998 }
4999
5000 static vector signed short __ATTRS_o_ai vec_orc(vector signed short __a,
5001                                                 vector bool short __b) {
5002   return __a | ~__b;
5003 }
5004
5005 static vector signed short __ATTRS_o_ai vec_orc(vector bool short __a,
5006                                                 vector signed short __b) {
5007   return __a | ~__b;
5008 }
5009
5010 static vector unsigned short __ATTRS_o_ai vec_orc(vector unsigned short __a,
5011                                                   vector unsigned short __b) {
5012   return __a | ~__b;
5013 }
5014
5015 static vector unsigned short __ATTRS_o_ai vec_orc(vector unsigned short __a,
5016                                                   vector bool short __b) {
5017   return __a | ~__b;
5018 }
5019
5020 static vector unsigned short __ATTRS_o_ai
5021 vec_orc(vector bool short __a, vector unsigned short __b) {
5022   return __a | ~__b;
5023 }
5024
5025 static vector bool short __ATTRS_o_ai vec_orc(vector bool short __a,
5026                                               vector bool short __b) {
5027   return __a | ~__b;
5028 }
5029
5030 static vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5031                                               vector signed int __b) {
5032   return __a | ~__b;
5033 }
5034
5035 static vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
5036                                               vector bool int __b) {
5037   return __a | ~__b;
5038 }
5039
5040 static vector signed int __ATTRS_o_ai vec_orc(vector bool int __a,
5041                                               vector signed int __b) {
5042   return __a | ~__b;
5043 }
5044
5045 static vector unsigned int __ATTRS_o_ai vec_orc(vector unsigned int __a,
5046                                                 vector unsigned int __b) {
5047   return __a | ~__b;
5048 }
5049
5050 static vector unsigned int __ATTRS_o_ai vec_orc(vector unsigned int __a,
5051                                                 vector bool int __b) {
5052   return __a | ~__b;
5053 }
5054
5055 static vector unsigned int __ATTRS_o_ai vec_orc(vector bool int __a,
5056                                                 vector unsigned int __b) {
5057   return __a | ~__b;
5058 }
5059
5060 static vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
5061                                             vector bool int __b) {
5062   return __a | ~__b;
5063 }
5064
5065 static vector signed long long __ATTRS_o_ai
5066 vec_orc(vector signed long long __a, vector signed long long __b) {
5067   return __a | ~__b;
5068 }
5069
5070 static vector signed long long __ATTRS_o_ai vec_orc(vector signed long long __a,
5071                                                     vector bool long long __b) {
5072   return __a | ~__b;
5073 }
5074
5075 static vector signed long long __ATTRS_o_ai
5076 vec_orc(vector bool long long __a, vector signed long long __b) {
5077   return __a | ~__b;
5078 }
5079
5080 static vector unsigned long long __ATTRS_o_ai
5081 vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
5082   return __a | ~__b;
5083 }
5084
5085 static vector unsigned long long __ATTRS_o_ai
5086 vec_orc(vector unsigned long long __a, vector bool long long __b) {
5087   return __a | ~__b;
5088 }
5089
5090 static vector unsigned long long __ATTRS_o_ai
5091 vec_orc(vector bool long long __a, vector unsigned long long __b) {
5092   return __a | ~__b;
5093 }
5094
5095 static vector bool long long __ATTRS_o_ai
5096 vec_orc(vector bool long long __a, vector bool long long __b) {
5097   return __a | ~__b;
5098 }
5099 #endif
5100
5101 /* vec_vor */
5102
5103 static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
5104                                                vector signed char __b) {
5105   return __a | __b;
5106 }
5107
5108 static vector signed char __ATTRS_o_ai vec_vor(vector bool char __a,
5109                                                vector signed char __b) {
5110   return (vector signed char)__a | __b;
5111 }
5112
5113 static vector signed char __ATTRS_o_ai vec_vor(vector signed char __a,
5114                                                vector bool char __b) {
5115   return __a | (vector signed char)__b;
5116 }
5117
5118 static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
5119                                                  vector unsigned char __b) {
5120   return __a | __b;
5121 }
5122
5123 static vector unsigned char __ATTRS_o_ai vec_vor(vector bool char __a,
5124                                                  vector unsigned char __b) {
5125   return (vector unsigned char)__a | __b;
5126 }
5127
5128 static vector unsigned char __ATTRS_o_ai vec_vor(vector unsigned char __a,
5129                                                  vector bool char __b) {
5130   return __a | (vector unsigned char)__b;
5131 }
5132
5133 static vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
5134                                              vector bool char __b) {
5135   return __a | __b;
5136 }
5137
5138 static vector short __ATTRS_o_ai vec_vor(vector short __a, vector short __b) {
5139   return __a | __b;
5140 }
5141
5142 static vector short __ATTRS_o_ai vec_vor(vector bool short __a,
5143                                          vector short __b) {
5144   return (vector short)__a | __b;
5145 }
5146
5147 static vector short __ATTRS_o_ai vec_vor(vector short __a,
5148                                          vector bool short __b) {
5149   return __a | (vector short)__b;
5150 }
5151
5152 static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
5153                                                   vector unsigned short __b) {
5154   return __a | __b;
5155 }
5156
5157 static vector unsigned short __ATTRS_o_ai vec_vor(vector bool short __a,
5158                                                   vector unsigned short __b) {
5159   return (vector unsigned short)__a | __b;
5160 }
5161
5162 static vector unsigned short __ATTRS_o_ai vec_vor(vector unsigned short __a,
5163                                                   vector bool short __b) {
5164   return __a | (vector unsigned short)__b;
5165 }
5166
5167 static vector bool short __ATTRS_o_ai vec_vor(vector bool short __a,
5168                                               vector bool short __b) {
5169   return __a | __b;
5170 }
5171
5172 static vector int __ATTRS_o_ai vec_vor(vector int __a, vector int __b) {
5173   return __a | __b;
5174 }
5175
5176 static vector int __ATTRS_o_ai vec_vor(vector bool int __a, vector int __b) {
5177   return (vector int)__a | __b;
5178 }
5179
5180 static vector int __ATTRS_o_ai vec_vor(vector int __a, vector bool int __b) {
5181   return __a | (vector int)__b;
5182 }
5183
5184 static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
5185                                                 vector unsigned int __b) {
5186   return __a | __b;
5187 }
5188
5189 static vector unsigned int __ATTRS_o_ai vec_vor(vector bool int __a,
5190                                                 vector unsigned int __b) {
5191   return (vector unsigned int)__a | __b;
5192 }
5193
5194 static vector unsigned int __ATTRS_o_ai vec_vor(vector unsigned int __a,
5195                                                 vector bool int __b) {
5196   return __a | (vector unsigned int)__b;
5197 }
5198
5199 static vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
5200                                             vector bool int __b) {
5201   return __a | __b;
5202 }
5203
5204 static vector float __ATTRS_o_ai vec_vor(vector float __a, vector float __b) {
5205   vector unsigned int __res =
5206       (vector unsigned int)__a | (vector unsigned int)__b;
5207   return (vector float)__res;
5208 }
5209
5210 static vector float __ATTRS_o_ai vec_vor(vector bool int __a,
5211                                          vector float __b) {
5212   vector unsigned int __res =
5213       (vector unsigned int)__a | (vector unsigned int)__b;
5214   return (vector float)__res;
5215 }
5216
5217 static vector float __ATTRS_o_ai vec_vor(vector float __a,
5218                                          vector bool int __b) {
5219   vector unsigned int __res =
5220       (vector unsigned int)__a | (vector unsigned int)__b;
5221   return (vector float)__res;
5222 }
5223
5224 #ifdef __VSX__
5225 static vector signed long long __ATTRS_o_ai
5226 vec_vor(vector signed long long __a, vector signed long long __b) {
5227   return __a | __b;
5228 }
5229
5230 static vector signed long long __ATTRS_o_ai
5231 vec_vor(vector bool long long __a, vector signed long long __b) {
5232   return (vector signed long long)__a | __b;
5233 }
5234
5235 static vector signed long long __ATTRS_o_ai vec_vor(vector signed long long __a,
5236                                                     vector bool long long __b) {
5237   return __a | (vector signed long long)__b;
5238 }
5239
5240 static vector unsigned long long __ATTRS_o_ai
5241 vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
5242   return __a | __b;
5243 }
5244
5245 static vector unsigned long long __ATTRS_o_ai
5246 vec_vor(vector bool long long __a, vector unsigned long long __b) {
5247   return (vector unsigned long long)__a | __b;
5248 }
5249
5250 static vector unsigned long long __ATTRS_o_ai
5251 vec_vor(vector unsigned long long __a, vector bool long long __b) {
5252   return __a | (vector unsigned long long)__b;
5253 }
5254
5255 static vector bool long long __ATTRS_o_ai vec_vor(vector bool long long __a,
5256                                                   vector bool long long __b) {
5257   return __a | __b;
5258 }
5259 #endif
5260
5261 /* vec_pack */
5262
5263 /* The various vector pack instructions have a big-endian bias, so for
5264    little endian we must handle reversed element numbering.  */
5265
5266 static vector signed char __ATTRS_o_ai vec_pack(vector signed short __a,
5267                                                 vector signed short __b) {
5268 #ifdef __LITTLE_ENDIAN__
5269   return (vector signed char)vec_perm(
5270       __a, __b,
5271       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5272                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5273 #else
5274   return (vector signed char)vec_perm(
5275       __a, __b,
5276       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5277                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5278 #endif
5279 }
5280
5281 static vector unsigned char __ATTRS_o_ai vec_pack(vector unsigned short __a,
5282                                                   vector unsigned short __b) {
5283 #ifdef __LITTLE_ENDIAN__
5284   return (vector unsigned char)vec_perm(
5285       __a, __b,
5286       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5287                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5288 #else
5289   return (vector unsigned char)vec_perm(
5290       __a, __b,
5291       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5292                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5293 #endif
5294 }
5295
5296 static vector bool char __ATTRS_o_ai vec_pack(vector bool short __a,
5297                                               vector bool short __b) {
5298 #ifdef __LITTLE_ENDIAN__
5299   return (vector bool 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 bool 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 short __ATTRS_o_ai vec_pack(vector int __a, vector int __b) {
5312 #ifdef __LITTLE_ENDIAN__
5313   return (vector short)vec_perm(
5314       __a, __b,
5315       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5316                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5317 #else
5318   return (vector short)vec_perm(
5319       __a, __b,
5320       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5321                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5322 #endif
5323 }
5324
5325 static vector unsigned short __ATTRS_o_ai vec_pack(vector unsigned int __a,
5326                                                    vector unsigned int __b) {
5327 #ifdef __LITTLE_ENDIAN__
5328   return (vector unsigned short)vec_perm(
5329       __a, __b,
5330       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5331                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5332 #else
5333   return (vector unsigned short)vec_perm(
5334       __a, __b,
5335       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5336                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5337 #endif
5338 }
5339
5340 static vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
5341                                                vector bool int __b) {
5342 #ifdef __LITTLE_ENDIAN__
5343   return (vector bool 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 bool 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 #ifdef __VSX__
5356 static vector signed int __ATTRS_o_ai vec_pack(vector signed long long __a,
5357                                                vector signed long long __b) {
5358 #ifdef __LITTLE_ENDIAN__
5359   return (vector signed int)vec_perm(
5360       __a, __b,
5361       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5362                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5363 #else
5364   return (vector signed int)vec_perm(
5365       __a, __b,
5366       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5367                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5368 #endif
5369 }
5370 static vector unsigned int __ATTRS_o_ai
5371 vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
5372 #ifdef __LITTLE_ENDIAN__
5373   return (vector unsigned int)vec_perm(
5374       __a, __b,
5375       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5376                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5377 #else
5378   return (vector unsigned int)vec_perm(
5379       __a, __b,
5380       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5381                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5382 #endif
5383 }
5384
5385 static vector bool int __ATTRS_o_ai vec_pack(vector bool long long __a,
5386                                              vector bool long long __b) {
5387 #ifdef __LITTLE_ENDIAN__
5388   return (vector bool int)vec_perm(
5389       __a, __b,
5390       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5391                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5392 #else
5393   return (vector bool int)vec_perm(
5394       __a, __b,
5395       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5396                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5397 #endif
5398 }
5399
5400 #endif
5401
5402 /* vec_vpkuhum */
5403
5404 #define __builtin_altivec_vpkuhum vec_vpkuhum
5405
5406 static vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a,
5407                                                    vector signed short __b) {
5408 #ifdef __LITTLE_ENDIAN__
5409   return (vector signed char)vec_perm(
5410       __a, __b,
5411       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5412                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5413 #else
5414   return (vector signed char)vec_perm(
5415       __a, __b,
5416       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5417                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5418 #endif
5419 }
5420
5421 static vector unsigned char __ATTRS_o_ai
5422 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
5423 #ifdef __LITTLE_ENDIAN__
5424   return (vector unsigned char)vec_perm(
5425       __a, __b,
5426       (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
5427                              0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
5428 #else
5429   return (vector unsigned char)vec_perm(
5430       __a, __b,
5431       (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
5432                              0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
5433 #endif
5434 }
5435
5436 static vector bool char __ATTRS_o_ai vec_vpkuhum(vector bool short __a,
5437                                                  vector bool short __b) {
5438 #ifdef __LITTLE_ENDIAN__
5439   return (vector bool 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 bool 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 /* vec_vpkuwum */
5452
5453 #define __builtin_altivec_vpkuwum vec_vpkuwum
5454
5455 static vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b) {
5456 #ifdef __LITTLE_ENDIAN__
5457   return (vector short)vec_perm(
5458       __a, __b,
5459       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5460                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5461 #else
5462   return (vector short)vec_perm(
5463       __a, __b,
5464       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5465                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5466 #endif
5467 }
5468
5469 static vector unsigned short __ATTRS_o_ai vec_vpkuwum(vector unsigned int __a,
5470                                                       vector unsigned int __b) {
5471 #ifdef __LITTLE_ENDIAN__
5472   return (vector unsigned short)vec_perm(
5473       __a, __b,
5474       (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
5475                              0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
5476 #else
5477   return (vector unsigned short)vec_perm(
5478       __a, __b,
5479       (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
5480                              0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
5481 #endif
5482 }
5483
5484 static vector bool short __ATTRS_o_ai vec_vpkuwum(vector bool int __a,
5485                                                   vector bool int __b) {
5486 #ifdef __LITTLE_ENDIAN__
5487   return (vector bool 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 bool 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 /* vec_vpkudum */
5500
5501 #ifdef __POWER8_VECTOR__
5502 #define __builtin_altivec_vpkudum vec_vpkudum
5503
5504 static vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
5505                                            vector long long __b) {
5506 #ifdef __LITTLE_ENDIAN__
5507   return (vector int)vec_perm(
5508       __a, __b,
5509       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5510                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5511 #else
5512   return (vector int)vec_perm(
5513       __a, __b,
5514       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5515                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5516 #endif
5517 }
5518
5519 static vector unsigned int __ATTRS_o_ai
5520 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
5521 #ifdef __LITTLE_ENDIAN__
5522   return (vector unsigned int)vec_perm(
5523       __a, __b,
5524       (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
5525                              0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
5526 #else
5527   return (vector unsigned int)vec_perm(
5528       __a, __b,
5529       (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
5530                              0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
5531 #endif
5532 }
5533
5534 static vector bool int __ATTRS_o_ai vec_vpkudum(vector bool long long __a,
5535                                                 vector bool long long __b) {
5536 #ifdef __LITTLE_ENDIAN__
5537   return (vector bool int)vec_perm(
5538       (vector long long)__a, (vector long long)__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 bool int)vec_perm(
5543       (vector long long)__a, (vector long long)__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 #endif
5549
5550 /* vec_packpx */
5551
5552 static vector pixel __attribute__((__always_inline__))
5553 vec_packpx(vector unsigned int __a, vector unsigned int __b) {
5554 #ifdef __LITTLE_ENDIAN__
5555   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5556 #else
5557   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5558 #endif
5559 }
5560
5561 /* vec_vpkpx */
5562
5563 static vector pixel __attribute__((__always_inline__))
5564 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
5565 #ifdef __LITTLE_ENDIAN__
5566   return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
5567 #else
5568   return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
5569 #endif
5570 }
5571
5572 /* vec_packs */
5573
5574 static vector signed char __ATTRS_o_ai vec_packs(vector short __a,
5575                                                  vector short __b) {
5576 #ifdef __LITTLE_ENDIAN__
5577   return __builtin_altivec_vpkshss(__b, __a);
5578 #else
5579   return __builtin_altivec_vpkshss(__a, __b);
5580 #endif
5581 }
5582
5583 static vector unsigned char __ATTRS_o_ai vec_packs(vector unsigned short __a,
5584                                                    vector unsigned short __b) {
5585 #ifdef __LITTLE_ENDIAN__
5586   return __builtin_altivec_vpkuhus(__b, __a);
5587 #else
5588   return __builtin_altivec_vpkuhus(__a, __b);
5589 #endif
5590 }
5591
5592 static vector signed short __ATTRS_o_ai vec_packs(vector int __a,
5593                                                   vector int __b) {
5594 #ifdef __LITTLE_ENDIAN__
5595   return __builtin_altivec_vpkswss(__b, __a);
5596 #else
5597   return __builtin_altivec_vpkswss(__a, __b);
5598 #endif
5599 }
5600
5601 static vector unsigned short __ATTRS_o_ai vec_packs(vector unsigned int __a,
5602                                                     vector unsigned int __b) {
5603 #ifdef __LITTLE_ENDIAN__
5604   return __builtin_altivec_vpkuwus(__b, __a);
5605 #else
5606   return __builtin_altivec_vpkuwus(__a, __b);
5607 #endif
5608 }
5609
5610 #ifdef __POWER8_VECTOR__
5611 static vector int __ATTRS_o_ai vec_packs(vector long long __a,
5612                                          vector long long __b) {
5613 #ifdef __LITTLE_ENDIAN__
5614   return __builtin_altivec_vpksdss(__b, __a);
5615 #else
5616   return __builtin_altivec_vpksdss(__a, __b);
5617 #endif
5618 }
5619
5620 static vector unsigned int __ATTRS_o_ai
5621 vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
5622 #ifdef __LITTLE_ENDIAN__
5623   return __builtin_altivec_vpkudus(__b, __a);
5624 #else
5625   return __builtin_altivec_vpkudus(__a, __b);
5626 #endif
5627 }
5628 #endif
5629
5630 /* vec_vpkshss */
5631
5632 static vector signed char __attribute__((__always_inline__))
5633 vec_vpkshss(vector short __a, vector short __b) {
5634 #ifdef __LITTLE_ENDIAN__
5635   return __builtin_altivec_vpkshss(__b, __a);
5636 #else
5637   return __builtin_altivec_vpkshss(__a, __b);
5638 #endif
5639 }
5640
5641 /* vec_vpksdss */
5642
5643 #ifdef __POWER8_VECTOR__
5644 static vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
5645                                            vector long long __b) {
5646 #ifdef __LITTLE_ENDIAN__
5647   return __builtin_altivec_vpksdss(__b, __a);
5648 #else
5649   return __builtin_altivec_vpksdss(__a, __b);
5650 #endif
5651 }
5652 #endif
5653
5654 /* vec_vpkuhus */
5655
5656 static vector unsigned char __attribute__((__always_inline__))
5657 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
5658 #ifdef __LITTLE_ENDIAN__
5659   return __builtin_altivec_vpkuhus(__b, __a);
5660 #else
5661   return __builtin_altivec_vpkuhus(__a, __b);
5662 #endif
5663 }
5664
5665 /* vec_vpkudus */
5666
5667 #ifdef __POWER8_VECTOR__
5668 static vector unsigned int __attribute__((__always_inline__))
5669 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
5670 #ifdef __LITTLE_ENDIAN__
5671   return __builtin_altivec_vpkudus(__b, __a);
5672 #else
5673   return __builtin_altivec_vpkudus(__a, __b);
5674 #endif
5675 }
5676 #endif
5677
5678 /* vec_vpkswss */
5679
5680 static vector signed short __attribute__((__always_inline__))
5681 vec_vpkswss(vector int __a, vector int __b) {
5682 #ifdef __LITTLE_ENDIAN__
5683   return __builtin_altivec_vpkswss(__b, __a);
5684 #else
5685   return __builtin_altivec_vpkswss(__a, __b);
5686 #endif
5687 }
5688
5689 /* vec_vpkuwus */
5690
5691 static vector unsigned short __attribute__((__always_inline__))
5692 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
5693 #ifdef __LITTLE_ENDIAN__
5694   return __builtin_altivec_vpkuwus(__b, __a);
5695 #else
5696   return __builtin_altivec_vpkuwus(__a, __b);
5697 #endif
5698 }
5699
5700 /* vec_packsu */
5701
5702 static vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a,
5703                                                     vector short __b) {
5704 #ifdef __LITTLE_ENDIAN__
5705   return __builtin_altivec_vpkshus(__b, __a);
5706 #else
5707   return __builtin_altivec_vpkshus(__a, __b);
5708 #endif
5709 }
5710
5711 static vector unsigned char __ATTRS_o_ai vec_packsu(vector unsigned short __a,
5712                                                     vector unsigned short __b) {
5713 #ifdef __LITTLE_ENDIAN__
5714   return __builtin_altivec_vpkuhus(__b, __a);
5715 #else
5716   return __builtin_altivec_vpkuhus(__a, __b);
5717 #endif
5718 }
5719
5720 static vector unsigned short __ATTRS_o_ai vec_packsu(vector int __a,
5721                                                      vector int __b) {
5722 #ifdef __LITTLE_ENDIAN__
5723   return __builtin_altivec_vpkswus(__b, __a);
5724 #else
5725   return __builtin_altivec_vpkswus(__a, __b);
5726 #endif
5727 }
5728
5729 static vector unsigned short __ATTRS_o_ai vec_packsu(vector unsigned int __a,
5730                                                      vector unsigned int __b) {
5731 #ifdef __LITTLE_ENDIAN__
5732   return __builtin_altivec_vpkuwus(__b, __a);
5733 #else
5734   return __builtin_altivec_vpkuwus(__a, __b);
5735 #endif
5736 }
5737
5738 #ifdef __POWER8_VECTOR__
5739 static vector unsigned int __ATTRS_o_ai vec_packsu(vector long long __a,
5740                                                    vector long long __b) {
5741 #ifdef __LITTLE_ENDIAN__
5742   return __builtin_altivec_vpksdus(__b, __a);
5743 #else
5744   return __builtin_altivec_vpksdus(__a, __b);
5745 #endif
5746 }
5747
5748 static vector unsigned int __ATTRS_o_ai
5749 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
5750 #ifdef __LITTLE_ENDIAN__
5751   return __builtin_altivec_vpkudus(__b, __a);
5752 #else
5753   return __builtin_altivec_vpkudus(__a, __b);
5754 #endif
5755 }
5756 #endif
5757
5758 /* vec_vpkshus */
5759
5760 static vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a,
5761                                                      vector short __b) {
5762 #ifdef __LITTLE_ENDIAN__
5763   return __builtin_altivec_vpkshus(__b, __a);
5764 #else
5765   return __builtin_altivec_vpkshus(__a, __b);
5766 #endif
5767 }
5768
5769 static vector unsigned char __ATTRS_o_ai
5770 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
5771 #ifdef __LITTLE_ENDIAN__
5772   return __builtin_altivec_vpkuhus(__b, __a);
5773 #else
5774   return __builtin_altivec_vpkuhus(__a, __b);
5775 #endif
5776 }
5777
5778 /* vec_vpkswus */
5779
5780 static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a,
5781                                                       vector int __b) {
5782 #ifdef __LITTLE_ENDIAN__
5783   return __builtin_altivec_vpkswus(__b, __a);
5784 #else
5785   return __builtin_altivec_vpkswus(__a, __b);
5786 #endif
5787 }
5788
5789 static vector unsigned short __ATTRS_o_ai vec_vpkswus(vector unsigned int __a,
5790                                                       vector unsigned int __b) {
5791 #ifdef __LITTLE_ENDIAN__
5792   return __builtin_altivec_vpkuwus(__b, __a);
5793 #else
5794   return __builtin_altivec_vpkuwus(__a, __b);
5795 #endif
5796 }
5797
5798 /* vec_vpksdus */
5799
5800 #ifdef __POWER8_VECTOR__
5801 static vector unsigned int __ATTRS_o_ai vec_vpksdus(vector long long __a,
5802                                                     vector long long __b) {
5803 #ifdef __LITTLE_ENDIAN__
5804   return __builtin_altivec_vpksdus(__b, __a);
5805 #else
5806   return __builtin_altivec_vpksdus(__a, __b);
5807 #endif
5808 }
5809 #endif
5810
5811 /* vec_perm */
5812
5813 // The vperm instruction is defined architecturally with a big-endian bias.
5814 // For little endian, we swap the input operands and invert the permute
5815 // control vector.  Only the rightmost 5 bits matter, so we could use
5816 // a vector of all 31s instead of all 255s to perform the inversion.
5817 // However, when the PCV is not a constant, using 255 has an advantage
5818 // in that the vec_xor can be recognized as a vec_nor (and for P8 and
5819 // later, possibly a vec_nand).
5820
5821 static vector signed char __ATTRS_o_ai vec_perm(vector signed char __a,
5822                                                 vector signed char __b,
5823                                                 vector unsigned char __c) {
5824 #ifdef __LITTLE_ENDIAN__
5825   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5826                               255, 255, 255, 255, 255, 255, 255, 255};
5827   __d = vec_xor(__c, __d);
5828   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
5829                                                          (vector int)__a, __d);
5830 #else
5831   return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
5832                                                          (vector int)__b, __c);
5833 #endif
5834 }
5835
5836 static vector unsigned char __ATTRS_o_ai vec_perm(vector unsigned char __a,
5837                                                   vector unsigned char __b,
5838                                                   vector unsigned char __c) {
5839 #ifdef __LITTLE_ENDIAN__
5840   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5841                               255, 255, 255, 255, 255, 255, 255, 255};
5842   __d = vec_xor(__c, __d);
5843   return (vector unsigned char)__builtin_altivec_vperm_4si(
5844       (vector int)__b, (vector int)__a, __d);
5845 #else
5846   return (vector unsigned char)__builtin_altivec_vperm_4si(
5847       (vector int)__a, (vector int)__b, __c);
5848 #endif
5849 }
5850
5851 static vector bool char __ATTRS_o_ai vec_perm(vector bool char __a,
5852                                               vector bool 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 bool char)__builtin_altivec_vperm_4si((vector int)__b,
5859                                                        (vector int)__a, __d);
5860 #else
5861   return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
5862                                                        (vector int)__b, __c);
5863 #endif
5864 }
5865
5866 static vector short __ATTRS_o_ai vec_perm(vector signed short __a,
5867                                           vector signed short __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 signed short)__builtin_altivec_vperm_4si((vector int)__b,
5874                                                           (vector int)__a, __d);
5875 #else
5876   return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
5877                                                           (vector int)__b, __c);
5878 #endif
5879 }
5880
5881 static vector unsigned short __ATTRS_o_ai vec_perm(vector unsigned short __a,
5882                                                    vector unsigned short __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 unsigned short)__builtin_altivec_vperm_4si(
5889       (vector int)__b, (vector int)__a, __d);
5890 #else
5891   return (vector unsigned short)__builtin_altivec_vperm_4si(
5892       (vector int)__a, (vector int)__b, __c);
5893 #endif
5894 }
5895
5896 static vector bool short __ATTRS_o_ai vec_perm(vector bool short __a,
5897                                                vector bool 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 bool short)__builtin_altivec_vperm_4si((vector int)__b,
5904                                                         (vector int)__a, __d);
5905 #else
5906   return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
5907                                                         (vector int)__b, __c);
5908 #endif
5909 }
5910
5911 static vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, vector pixel __b,
5912                                           vector unsigned char __c) {
5913 #ifdef __LITTLE_ENDIAN__
5914   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5915                               255, 255, 255, 255, 255, 255, 255, 255};
5916   __d = vec_xor(__c, __d);
5917   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
5918                                                    (vector int)__a, __d);
5919 #else
5920   return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
5921                                                    (vector int)__b, __c);
5922 #endif
5923 }
5924
5925 static vector int __ATTRS_o_ai vec_perm(vector signed int __a,
5926                                         vector signed int __b,
5927                                         vector unsigned char __c) {
5928 #ifdef __LITTLE_ENDIAN__
5929   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5930                               255, 255, 255, 255, 255, 255, 255, 255};
5931   __d = vec_xor(__c, __d);
5932   return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
5933 #else
5934   return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
5935 #endif
5936 }
5937
5938 static vector unsigned int __ATTRS_o_ai vec_perm(vector unsigned int __a,
5939                                                  vector unsigned int __b,
5940                                                  vector unsigned char __c) {
5941 #ifdef __LITTLE_ENDIAN__
5942   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5943                               255, 255, 255, 255, 255, 255, 255, 255};
5944   __d = vec_xor(__c, __d);
5945   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
5946                                                           (vector int)__a, __d);
5947 #else
5948   return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
5949                                                           (vector int)__b, __c);
5950 #endif
5951 }
5952
5953 static vector bool int __ATTRS_o_ai vec_perm(vector bool int __a,
5954                                              vector bool int __b,
5955                                              vector unsigned char __c) {
5956 #ifdef __LITTLE_ENDIAN__
5957   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5958                               255, 255, 255, 255, 255, 255, 255, 255};
5959   __d = vec_xor(__c, __d);
5960   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
5961                                                       (vector int)__a, __d);
5962 #else
5963   return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
5964                                                       (vector int)__b, __c);
5965 #endif
5966 }
5967
5968 static vector float __ATTRS_o_ai vec_perm(vector float __a, vector float __b,
5969                                           vector unsigned char __c) {
5970 #ifdef __LITTLE_ENDIAN__
5971   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
5972                               255, 255, 255, 255, 255, 255, 255, 255};
5973   __d = vec_xor(__c, __d);
5974   return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
5975                                                    (vector int)__a, __d);
5976 #else
5977   return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
5978                                                    (vector int)__b, __c);
5979 #endif
5980 }
5981
5982 #ifdef __VSX__
5983 static vector long long __ATTRS_o_ai vec_perm(vector signed long long __a,
5984                                               vector signed long long __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 signed long long)__builtin_altivec_vperm_4si(
5991       (vector int)__b, (vector int)__a, __d);
5992 #else
5993   return (vector signed long long)__builtin_altivec_vperm_4si(
5994       (vector int)__a, (vector int)__b, __c);
5995 #endif
5996 }
5997
5998 static vector unsigned long long __ATTRS_o_ai
5999 vec_perm(vector unsigned long long __a, vector unsigned long long __b,
6000          vector unsigned char __c) {
6001 #ifdef __LITTLE_ENDIAN__
6002   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6003                               255, 255, 255, 255, 255, 255, 255, 255};
6004   __d = vec_xor(__c, __d);
6005   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6006       (vector int)__b, (vector int)__a, __d);
6007 #else
6008   return (vector unsigned long long)__builtin_altivec_vperm_4si(
6009       (vector int)__a, (vector int)__b, __c);
6010 #endif
6011 }
6012
6013 static vector bool long long __ATTRS_o_ai
6014 vec_perm(vector bool long long __a, vector bool 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 bool long long)__builtin_altivec_vperm_4si(
6021       (vector int)__b, (vector int)__a, __d);
6022 #else
6023   return (vector bool long long)__builtin_altivec_vperm_4si(
6024       (vector int)__a, (vector int)__b, __c);
6025 #endif
6026 }
6027
6028 static vector double __ATTRS_o_ai vec_perm(vector double __a, vector double __b,
6029                                            vector unsigned char __c) {
6030 #ifdef __LITTLE_ENDIAN__
6031   vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
6032                               255, 255, 255, 255, 255, 255, 255, 255};
6033   __d = vec_xor(__c, __d);
6034   return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
6035                                                     (vector int)__a, __d);
6036 #else
6037   return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
6038                                                     (vector int)__b, __c);
6039 #endif
6040 }
6041 #endif
6042
6043 /* vec_vperm */
6044
6045 static vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a,
6046                                                  vector signed char __b,
6047                                                  vector unsigned char __c) {
6048   return vec_perm(__a, __b, __c);
6049 }
6050
6051 static vector unsigned char __ATTRS_o_ai vec_vperm(vector unsigned char __a,
6052                                                    vector unsigned char __b,
6053                                                    vector unsigned char __c) {
6054   return vec_perm(__a, __b, __c);
6055 }
6056
6057 static vector bool char __ATTRS_o_ai vec_vperm(vector bool char __a,
6058                                                vector bool char __b,
6059                                                vector unsigned char __c) {
6060   return vec_perm(__a, __b, __c);
6061 }
6062
6063 static vector short __ATTRS_o_ai vec_vperm(vector short __a, vector short __b,
6064                                            vector unsigned char __c) {
6065   return vec_perm(__a, __b, __c);
6066 }
6067
6068 static vector unsigned short __ATTRS_o_ai vec_vperm(vector unsigned short __a,
6069                                                     vector unsigned short __b,
6070                                                     vector unsigned char __c) {
6071   return vec_perm(__a, __b, __c);
6072 }
6073
6074 static vector bool short __ATTRS_o_ai vec_vperm(vector bool short __a,
6075                                                 vector bool short __b,
6076                                                 vector unsigned char __c) {
6077   return vec_perm(__a, __b, __c);
6078 }
6079
6080 static vector pixel __ATTRS_o_ai vec_vperm(vector pixel __a, vector pixel __b,
6081                                            vector unsigned char __c) {
6082   return vec_perm(__a, __b, __c);
6083 }
6084
6085 static vector int __ATTRS_o_ai vec_vperm(vector int __a, vector int __b,
6086                                          vector unsigned char __c) {
6087   return vec_perm(__a, __b, __c);
6088 }
6089
6090 static vector unsigned int __ATTRS_o_ai vec_vperm(vector unsigned int __a,
6091                                                   vector unsigned int __b,
6092                                                   vector unsigned char __c) {
6093   return vec_perm(__a, __b, __c);
6094 }
6095
6096 static vector bool int __ATTRS_o_ai vec_vperm(vector bool int __a,
6097                                               vector bool int __b,
6098                                               vector unsigned char __c) {
6099   return vec_perm(__a, __b, __c);
6100 }
6101
6102 static vector float __ATTRS_o_ai vec_vperm(vector float __a, vector float __b,
6103                                            vector unsigned char __c) {
6104   return vec_perm(__a, __b, __c);
6105 }
6106
6107 #ifdef __VSX__
6108 static vector long long __ATTRS_o_ai vec_vperm(vector long long __a,
6109                                                vector long long __b,
6110                                                vector unsigned char __c) {
6111   return vec_perm(__a, __b, __c);
6112 }
6113
6114 static vector unsigned long long __ATTRS_o_ai
6115 vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
6116           vector unsigned char __c) {
6117   return vec_perm(__a, __b, __c);
6118 }
6119
6120 static vector double __ATTRS_o_ai vec_vperm(vector double __a,
6121                                             vector double __b,
6122                                             vector unsigned char __c) {
6123   return vec_perm(__a, __b, __c);
6124 }
6125 #endif
6126
6127 /* vec_re */
6128
6129 static vector float __ATTRS_o_ai
6130 vec_re(vector float __a) {
6131 #ifdef __VSX__
6132   return __builtin_vsx_xvresp(__a);
6133 #else
6134   return __builtin_altivec_vrefp(__a);
6135 #endif
6136 }
6137
6138 #ifdef __VSX__
6139 static vector double __ATTRS_o_ai vec_re(vector double __a) {
6140   return __builtin_vsx_xvredp(__a);
6141 }
6142 #endif
6143
6144 /* vec_vrefp */
6145
6146 static vector float __attribute__((__always_inline__))
6147 vec_vrefp(vector float __a) {
6148   return __builtin_altivec_vrefp(__a);
6149 }
6150
6151 /* vec_rl */
6152
6153 static vector signed char __ATTRS_o_ai vec_rl(vector signed char __a,
6154                                               vector unsigned char __b) {
6155   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6156 }
6157
6158 static vector unsigned char __ATTRS_o_ai vec_rl(vector unsigned char __a,
6159                                                 vector unsigned char __b) {
6160   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6161 }
6162
6163 static vector short __ATTRS_o_ai vec_rl(vector short __a,
6164                                         vector unsigned short __b) {
6165   return __builtin_altivec_vrlh(__a, __b);
6166 }
6167
6168 static vector unsigned short __ATTRS_o_ai vec_rl(vector unsigned short __a,
6169                                                  vector unsigned short __b) {
6170   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6171 }
6172
6173 static vector int __ATTRS_o_ai vec_rl(vector int __a, vector unsigned int __b) {
6174   return __builtin_altivec_vrlw(__a, __b);
6175 }
6176
6177 static vector unsigned int __ATTRS_o_ai vec_rl(vector unsigned int __a,
6178                                                vector unsigned int __b) {
6179   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6180 }
6181
6182 #ifdef __POWER8_VECTOR__
6183 static vector signed long long __ATTRS_o_ai
6184 vec_rl(vector signed long long __a, vector unsigned long long __b) {
6185   return __builtin_altivec_vrld(__a, __b);
6186 }
6187
6188 static vector unsigned long long __ATTRS_o_ai
6189 vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
6190   return __builtin_altivec_vrld(__a, __b);
6191 }
6192 #endif
6193
6194 /* vec_vrlb */
6195
6196 static vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a,
6197                                                 vector unsigned char __b) {
6198   return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
6199 }
6200
6201 static vector unsigned char __ATTRS_o_ai vec_vrlb(vector unsigned char __a,
6202                                                   vector unsigned char __b) {
6203   return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
6204 }
6205
6206 /* vec_vrlh */
6207
6208 static vector short __ATTRS_o_ai vec_vrlh(vector short __a,
6209                                           vector unsigned short __b) {
6210   return __builtin_altivec_vrlh(__a, __b);
6211 }
6212
6213 static vector unsigned short __ATTRS_o_ai vec_vrlh(vector unsigned short __a,
6214                                                    vector unsigned short __b) {
6215   return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
6216 }
6217
6218 /* vec_vrlw */
6219
6220 static vector int __ATTRS_o_ai vec_vrlw(vector int __a,
6221                                         vector unsigned int __b) {
6222   return __builtin_altivec_vrlw(__a, __b);
6223 }
6224
6225 static vector unsigned int __ATTRS_o_ai vec_vrlw(vector unsigned int __a,
6226                                                  vector unsigned int __b) {
6227   return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
6228 }
6229
6230 /* vec_round */
6231
6232 static vector float __ATTRS_o_ai vec_round(vector float __a) {
6233 #ifdef __VSX__
6234   return __builtin_vsx_xvrspi(__a);
6235 #else
6236   return __builtin_altivec_vrfin(__a);
6237 #endif
6238 }
6239
6240 #ifdef __VSX__
6241 static vector double __ATTRS_o_ai vec_round(vector double __a) {
6242   return __builtin_vsx_xvrdpi(__a);
6243 }
6244
6245 /* vec_rint */
6246
6247 static vector float __ATTRS_o_ai
6248 vec_rint(vector float __a) {
6249   return __builtin_vsx_xvrspic(__a);
6250 }
6251
6252 static vector double __ATTRS_o_ai
6253 vec_rint(vector double __a) {
6254   return __builtin_vsx_xvrdpic(__a);
6255 }
6256
6257 /* vec_nearbyint */
6258
6259 static vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
6260   return __builtin_vsx_xvrspi(__a);
6261 }
6262
6263 static vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
6264   return __builtin_vsx_xvrdpi(__a);
6265 }
6266 #endif
6267
6268 /* vec_vrfin */
6269
6270 static vector float __attribute__((__always_inline__))
6271 vec_vrfin(vector float __a) {
6272   return __builtin_altivec_vrfin(__a);
6273 }
6274
6275 /* vec_sqrt */
6276
6277 #ifdef __VSX__
6278 static vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
6279   return __builtin_vsx_xvsqrtsp(__a);
6280 }
6281
6282 static vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
6283   return __builtin_vsx_xvsqrtdp(__a);
6284 }
6285 #endif
6286
6287 /* vec_rsqrte */
6288
6289 static vector float __ATTRS_o_ai
6290 vec_rsqrte(vector float __a) {
6291 #ifdef __VSX__
6292   return __builtin_vsx_xvrsqrtesp(__a);
6293 #else
6294   return __builtin_altivec_vrsqrtefp(__a);
6295 #endif
6296 }
6297
6298 #ifdef __VSX__
6299 static vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
6300   return __builtin_vsx_xvrsqrtedp(__a);
6301 }
6302 #endif
6303
6304 /* vec_vrsqrtefp */
6305
6306 static __vector float __attribute__((__always_inline__))
6307 vec_vrsqrtefp(vector float __a) {
6308   return __builtin_altivec_vrsqrtefp(__a);
6309 }
6310
6311 /* vec_sel */
6312
6313 #define __builtin_altivec_vsel_4si vec_sel
6314
6315 static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
6316                                                vector signed char __b,
6317                                                vector unsigned char __c) {
6318   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6319 }
6320
6321 static vector signed char __ATTRS_o_ai vec_sel(vector signed char __a,
6322                                                vector signed char __b,
6323                                                vector bool char __c) {
6324   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6325 }
6326
6327 static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
6328                                                  vector unsigned char __b,
6329                                                  vector unsigned char __c) {
6330   return (__a & ~__c) | (__b & __c);
6331 }
6332
6333 static vector unsigned char __ATTRS_o_ai vec_sel(vector unsigned char __a,
6334                                                  vector unsigned char __b,
6335                                                  vector bool char __c) {
6336   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6337 }
6338
6339 static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6340                                              vector bool char __b,
6341                                              vector unsigned char __c) {
6342   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6343 }
6344
6345 static vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
6346                                              vector bool char __b,
6347                                              vector bool char __c) {
6348   return (__a & ~__c) | (__b & __c);
6349 }
6350
6351 static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
6352                                          vector unsigned short __c) {
6353   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6354 }
6355
6356 static vector short __ATTRS_o_ai vec_sel(vector short __a, vector short __b,
6357                                          vector bool short __c) {
6358   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6359 }
6360
6361 static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
6362                                                   vector unsigned short __b,
6363                                                   vector unsigned short __c) {
6364   return (__a & ~__c) | (__b & __c);
6365 }
6366
6367 static vector unsigned short __ATTRS_o_ai vec_sel(vector unsigned short __a,
6368                                                   vector unsigned short __b,
6369                                                   vector bool short __c) {
6370   return (__a & ~(vector unsigned short)__c) |
6371          (__b & (vector unsigned short)__c);
6372 }
6373
6374 static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
6375                                               vector bool short __b,
6376                                               vector unsigned short __c) {
6377   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6378 }
6379
6380 static vector bool short __ATTRS_o_ai vec_sel(vector bool short __a,
6381                                               vector bool short __b,
6382                                               vector bool short __c) {
6383   return (__a & ~__c) | (__b & __c);
6384 }
6385
6386 static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
6387                                        vector unsigned int __c) {
6388   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6389 }
6390
6391 static vector int __ATTRS_o_ai vec_sel(vector int __a, vector int __b,
6392                                        vector bool int __c) {
6393   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6394 }
6395
6396 static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
6397                                                 vector unsigned int __b,
6398                                                 vector unsigned int __c) {
6399   return (__a & ~__c) | (__b & __c);
6400 }
6401
6402 static vector unsigned int __ATTRS_o_ai vec_sel(vector unsigned int __a,
6403                                                 vector unsigned int __b,
6404                                                 vector bool int __c) {
6405   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6406 }
6407
6408 static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6409                                             vector bool int __b,
6410                                             vector unsigned int __c) {
6411   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6412 }
6413
6414 static vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
6415                                             vector bool int __b,
6416                                             vector bool int __c) {
6417   return (__a & ~__c) | (__b & __c);
6418 }
6419
6420 static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
6421                                          vector unsigned int __c) {
6422   vector int __res = ((vector int)__a & ~(vector int)__c) |
6423                      ((vector int)__b & (vector int)__c);
6424   return (vector float)__res;
6425 }
6426
6427 static vector float __ATTRS_o_ai vec_sel(vector float __a, vector float __b,
6428                                          vector bool int __c) {
6429   vector int __res = ((vector int)__a & ~(vector int)__c) |
6430                      ((vector int)__b & (vector int)__c);
6431   return (vector float)__res;
6432 }
6433
6434 #ifdef __VSX__
6435 static vector double __ATTRS_o_ai vec_sel(vector double __a, vector double __b,
6436                                           vector bool long long __c) {
6437   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6438                      ((vector long long)__b & (vector long long)__c);
6439   return (vector double)__res;
6440 }
6441
6442 static vector double __ATTRS_o_ai vec_sel(vector double __a, vector double __b,
6443                                           vector unsigned long long __c) {
6444   vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
6445                      ((vector long long)__b & (vector long long)__c);
6446   return (vector double)__res;
6447 }
6448 #endif
6449
6450 /* vec_vsel */
6451
6452 static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
6453                                                 vector signed char __b,
6454                                                 vector unsigned char __c) {
6455   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6456 }
6457
6458 static vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a,
6459                                                 vector signed char __b,
6460                                                 vector bool char __c) {
6461   return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
6462 }
6463
6464 static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
6465                                                   vector unsigned char __b,
6466                                                   vector unsigned char __c) {
6467   return (__a & ~__c) | (__b & __c);
6468 }
6469
6470 static vector unsigned char __ATTRS_o_ai vec_vsel(vector unsigned char __a,
6471                                                   vector unsigned char __b,
6472                                                   vector bool char __c) {
6473   return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
6474 }
6475
6476 static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6477                                               vector bool char __b,
6478                                               vector unsigned char __c) {
6479   return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
6480 }
6481
6482 static vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
6483                                               vector bool char __b,
6484                                               vector bool char __c) {
6485   return (__a & ~__c) | (__b & __c);
6486 }
6487
6488 static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
6489                                           vector unsigned short __c) {
6490   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6491 }
6492
6493 static vector short __ATTRS_o_ai vec_vsel(vector short __a, vector short __b,
6494                                           vector bool short __c) {
6495   return (__a & ~(vector short)__c) | (__b & (vector short)__c);
6496 }
6497
6498 static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
6499                                                    vector unsigned short __b,
6500                                                    vector unsigned short __c) {
6501   return (__a & ~__c) | (__b & __c);
6502 }
6503
6504 static vector unsigned short __ATTRS_o_ai vec_vsel(vector unsigned short __a,
6505                                                    vector unsigned short __b,
6506                                                    vector bool short __c) {
6507   return (__a & ~(vector unsigned short)__c) |
6508          (__b & (vector unsigned short)__c);
6509 }
6510
6511 static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
6512                                                vector bool short __b,
6513                                                vector unsigned short __c) {
6514   return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
6515 }
6516
6517 static vector bool short __ATTRS_o_ai vec_vsel(vector bool short __a,
6518                                                vector bool short __b,
6519                                                vector bool short __c) {
6520   return (__a & ~__c) | (__b & __c);
6521 }
6522
6523 static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
6524                                         vector unsigned int __c) {
6525   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6526 }
6527
6528 static vector int __ATTRS_o_ai vec_vsel(vector int __a, vector int __b,
6529                                         vector bool int __c) {
6530   return (__a & ~(vector int)__c) | (__b & (vector int)__c);
6531 }
6532
6533 static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
6534                                                  vector unsigned int __b,
6535                                                  vector unsigned int __c) {
6536   return (__a & ~__c) | (__b & __c);
6537 }
6538
6539 static vector unsigned int __ATTRS_o_ai vec_vsel(vector unsigned int __a,
6540                                                  vector unsigned int __b,
6541                                                  vector bool int __c) {
6542   return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
6543 }
6544
6545 static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6546                                              vector bool int __b,
6547                                              vector unsigned int __c) {
6548   return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
6549 }
6550
6551 static vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
6552                                              vector bool int __b,
6553                                              vector bool int __c) {
6554   return (__a & ~__c) | (__b & __c);
6555 }
6556
6557 static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
6558                                           vector unsigned int __c) {
6559   vector int __res = ((vector int)__a & ~(vector int)__c) |
6560                      ((vector int)__b & (vector int)__c);
6561   return (vector float)__res;
6562 }
6563
6564 static vector float __ATTRS_o_ai vec_vsel(vector float __a, vector float __b,
6565                                           vector bool int __c) {
6566   vector int __res = ((vector int)__a & ~(vector int)__c) |
6567                      ((vector int)__b & (vector int)__c);
6568   return (vector float)__res;
6569 }
6570
6571 /* vec_sl */
6572
6573 static vector signed char __ATTRS_o_ai vec_sl(vector signed char __a,
6574                                               vector unsigned char __b) {
6575   return __a << (vector signed char)__b;
6576 }
6577
6578 static vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a,
6579                                                 vector unsigned char __b) {
6580   return __a << __b;
6581 }
6582
6583 static vector short __ATTRS_o_ai vec_sl(vector short __a,
6584                                         vector unsigned short __b) {
6585   return __a << (vector short)__b;
6586 }
6587
6588 static vector unsigned short __ATTRS_o_ai vec_sl(vector unsigned short __a,
6589                                                  vector unsigned short __b) {
6590   return __a << __b;
6591 }
6592
6593 static vector int __ATTRS_o_ai vec_sl(vector int __a, vector unsigned int __b) {
6594   return __a << (vector int)__b;
6595 }
6596
6597 static vector unsigned int __ATTRS_o_ai vec_sl(vector unsigned int __a,
6598                                                vector unsigned int __b) {
6599   return __a << __b;
6600 }
6601
6602 #ifdef __POWER8_VECTOR__
6603 static vector signed long long __ATTRS_o_ai
6604 vec_sl(vector signed long long __a, vector unsigned long long __b) {
6605   return __a << (vector long long)__b;
6606 }
6607
6608 static vector unsigned long long __ATTRS_o_ai
6609 vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
6610   return __a << __b;
6611 }
6612 #endif
6613
6614 /* vec_vslb */
6615
6616 #define __builtin_altivec_vslb vec_vslb
6617
6618 static vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a,
6619                                                 vector unsigned char __b) {
6620   return vec_sl(__a, __b);
6621 }
6622
6623 static vector unsigned char __ATTRS_o_ai vec_vslb(vector unsigned char __a,
6624                                                   vector unsigned char __b) {
6625   return vec_sl(__a, __b);
6626 }
6627
6628 /* vec_vslh */
6629
6630 #define __builtin_altivec_vslh vec_vslh
6631
6632 static vector short __ATTRS_o_ai vec_vslh(vector short __a,
6633                                           vector unsigned short __b) {
6634   return vec_sl(__a, __b);
6635 }
6636
6637 static vector unsigned short __ATTRS_o_ai vec_vslh(vector unsigned short __a,
6638                                                    vector unsigned short __b) {
6639   return vec_sl(__a, __b);
6640 }
6641
6642 /* vec_vslw */
6643
6644 #define __builtin_altivec_vslw vec_vslw
6645
6646 static vector int __ATTRS_o_ai vec_vslw(vector int __a,
6647                                         vector unsigned int __b) {
6648   return vec_sl(__a, __b);
6649 }
6650
6651 static vector unsigned int __ATTRS_o_ai vec_vslw(vector unsigned int __a,
6652                                                  vector unsigned int __b) {
6653   return vec_sl(__a, __b);
6654 }
6655
6656 /* vec_sld */
6657
6658 #define __builtin_altivec_vsldoi_4si vec_sld
6659
6660 static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
6661                                                vector signed char __b,
6662                                                unsigned const int __c) {
6663   unsigned char __d = __c & 0x0F;
6664 #ifdef __LITTLE_ENDIAN__
6665   return vec_perm(
6666       __b, __a,
6667       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6668                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6669                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6670                              31 - __d));
6671 #else
6672   return vec_perm(
6673       __a, __b,
6674       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6675                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6676                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6677 #endif
6678 }
6679
6680 static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
6681                                                  vector unsigned char __b,
6682                                                  unsigned const int __c) {
6683   unsigned char __d = __c & 0x0F;
6684 #ifdef __LITTLE_ENDIAN__
6685   return vec_perm(
6686       __b, __a,
6687       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6688                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6689                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6690                              31 - __d));
6691 #else
6692   return vec_perm(
6693       __a, __b,
6694       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6695                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6696                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6697 #endif
6698 }
6699
6700 static vector bool char __ATTRS_o_ai vec_sld(vector bool char __a,
6701                                              vector bool char __b,
6702                                              unsigned const int __c) {
6703   unsigned char __d = __c & 0x0F;
6704 #ifdef __LITTLE_ENDIAN__
6705   return vec_perm(
6706       __b, __a,
6707       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6708                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6709                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6710                              31 - __d));
6711 #else
6712   return vec_perm(
6713       __a, __b,
6714       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6715                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6716                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6717 #endif
6718 }
6719
6720 static vector signed short __ATTRS_o_ai vec_sld(vector signed short __a,
6721                                                 vector signed short __b,
6722                                                 unsigned const int __c) {
6723   unsigned char __d = __c & 0x0F;
6724 #ifdef __LITTLE_ENDIAN__
6725   return vec_perm(
6726       __b, __a,
6727       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6728                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6729                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6730                              31 - __d));
6731 #else
6732   return vec_perm(
6733       __a, __b,
6734       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6735                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6736                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6737 #endif
6738 }
6739
6740 static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
6741                                                   vector unsigned short __b,
6742                                                   unsigned const int __c) {
6743   unsigned char __d = __c & 0x0F;
6744 #ifdef __LITTLE_ENDIAN__
6745   return vec_perm(
6746       __b, __a,
6747       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6748                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6749                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6750                              31 - __d));
6751 #else
6752   return vec_perm(
6753       __a, __b,
6754       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6755                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6756                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6757 #endif
6758 }
6759
6760 static vector bool short __ATTRS_o_ai vec_sld(vector bool short __a,
6761                                               vector bool short __b,
6762                                               unsigned const int __c) {
6763   unsigned char __d = __c & 0x0F;
6764 #ifdef __LITTLE_ENDIAN__
6765   return vec_perm(
6766       __b, __a,
6767       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6768                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6769                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6770                              31 - __d));
6771 #else
6772   return vec_perm(
6773       __a, __b,
6774       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6775                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6776                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6777 #endif
6778 }
6779
6780 static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
6781                                          unsigned const int __c) {
6782   unsigned char __d = __c & 0x0F;
6783 #ifdef __LITTLE_ENDIAN__
6784   return vec_perm(
6785       __b, __a,
6786       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6787                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6788                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6789                              31 - __d));
6790 #else
6791   return vec_perm(
6792       __a, __b,
6793       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6794                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6795                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6796 #endif
6797 }
6798
6799 static vector signed int __ATTRS_o_ai vec_sld(vector signed int __a,
6800                                               vector signed int __b,
6801                                               unsigned const int __c) {
6802   unsigned char __d = __c & 0x0F;
6803 #ifdef __LITTLE_ENDIAN__
6804   return vec_perm(
6805       __b, __a,
6806       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6807                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6808                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6809                              31 - __d));
6810 #else
6811   return vec_perm(
6812       __a, __b,
6813       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6814                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6815                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6816 #endif
6817 }
6818
6819 static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
6820                                                 vector unsigned int __b,
6821                                                 unsigned const int __c) {
6822   unsigned char __d = __c & 0x0F;
6823 #ifdef __LITTLE_ENDIAN__
6824   return vec_perm(
6825       __b, __a,
6826       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6827                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6828                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6829                              31 - __d));
6830 #else
6831   return vec_perm(
6832       __a, __b,
6833       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6834                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6835                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6836 #endif
6837 }
6838
6839 static vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
6840                                             vector bool int __b,
6841                                             unsigned const int __c) {
6842   unsigned char __d = __c & 0x0F;
6843 #ifdef __LITTLE_ENDIAN__
6844   return vec_perm(
6845       __b, __a,
6846       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6847                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6848                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6849                              31 - __d));
6850 #else
6851   return vec_perm(
6852       __a, __b,
6853       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6854                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6855                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6856 #endif
6857 }
6858
6859 static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
6860                                          unsigned const int __c) {
6861   unsigned char __d = __c & 0x0F;
6862 #ifdef __LITTLE_ENDIAN__
6863   return vec_perm(
6864       __b, __a,
6865       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6866                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6867                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6868                              31 - __d));
6869 #else
6870   return vec_perm(
6871       __a, __b,
6872       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6873                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6874                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6875 #endif
6876 }
6877
6878 /* vec_vsldoi */
6879
6880 static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
6881                                                   vector signed char __b,
6882                                                   unsigned char __c) {
6883   unsigned char __d = __c & 0x0F;
6884 #ifdef __LITTLE_ENDIAN__
6885   return vec_perm(
6886       __b, __a,
6887       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6888                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6889                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6890                              31 - __d));
6891 #else
6892   return vec_perm(
6893       __a, __b,
6894       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6895                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6896                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6897 #endif
6898 }
6899
6900 static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
6901                                                     vector unsigned char __b,
6902                                                     unsigned char __c) {
6903   unsigned char __d = __c & 0x0F;
6904 #ifdef __LITTLE_ENDIAN__
6905   return vec_perm(
6906       __b, __a,
6907       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6908                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6909                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6910                              31 - __d));
6911 #else
6912   return vec_perm(
6913       __a, __b,
6914       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6915                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6916                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6917 #endif
6918 }
6919
6920 static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
6921                                             unsigned char __c) {
6922   unsigned char __d = __c & 0x0F;
6923 #ifdef __LITTLE_ENDIAN__
6924   return vec_perm(
6925       __b, __a,
6926       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6927                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6928                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6929                              31 - __d));
6930 #else
6931   return vec_perm(
6932       __a, __b,
6933       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6934                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6935                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6936 #endif
6937 }
6938
6939 static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
6940                                                      vector unsigned short __b,
6941                                                      unsigned char __c) {
6942   unsigned char __d = __c & 0x0F;
6943 #ifdef __LITTLE_ENDIAN__
6944   return vec_perm(
6945       __b, __a,
6946       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6947                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6948                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6949                              31 - __d));
6950 #else
6951   return vec_perm(
6952       __a, __b,
6953       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6954                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6955                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6956 #endif
6957 }
6958
6959 static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
6960                                             unsigned char __c) {
6961   unsigned char __d = __c & 0x0F;
6962 #ifdef __LITTLE_ENDIAN__
6963   return vec_perm(
6964       __b, __a,
6965       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6966                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6967                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6968                              31 - __d));
6969 #else
6970   return vec_perm(
6971       __a, __b,
6972       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6973                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6974                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6975 #endif
6976 }
6977
6978 static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
6979                                           unsigned char __c) {
6980   unsigned char __d = __c & 0x0F;
6981 #ifdef __LITTLE_ENDIAN__
6982   return vec_perm(
6983       __b, __a,
6984       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
6985                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
6986                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
6987                              31 - __d));
6988 #else
6989   return vec_perm(
6990       __a, __b,
6991       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
6992                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
6993                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
6994 #endif
6995 }
6996
6997 static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
6998                                                    vector unsigned int __b,
6999                                                    unsigned char __c) {
7000   unsigned char __d = __c & 0x0F;
7001 #ifdef __LITTLE_ENDIAN__
7002   return vec_perm(
7003       __b, __a,
7004       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
7005                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
7006                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
7007                              31 - __d));
7008 #else
7009   return vec_perm(
7010       __a, __b,
7011       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7012                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7013                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7014 #endif
7015 }
7016
7017 static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
7018                                             unsigned char __c) {
7019   unsigned char __d = __c & 0x0F;
7020 #ifdef __LITTLE_ENDIAN__
7021   return vec_perm(
7022       __b, __a,
7023       (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
7024                              21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
7025                              26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
7026                              31 - __d));
7027 #else
7028   return vec_perm(
7029       __a, __b,
7030       (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
7031                              __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
7032                              __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
7033 #endif
7034 }
7035
7036 /* vec_sll */
7037
7038 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7039                                                vector unsigned char __b) {
7040   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7041                                                    (vector int)__b);
7042 }
7043
7044 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7045                                                vector unsigned short __b) {
7046   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7047                                                    (vector int)__b);
7048 }
7049
7050 static vector signed char __ATTRS_o_ai vec_sll(vector signed char __a,
7051                                                vector unsigned int __b) {
7052   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7053                                                    (vector int)__b);
7054 }
7055
7056 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7057                                                  vector unsigned char __b) {
7058   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7059                                                      (vector int)__b);
7060 }
7061
7062 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7063                                                  vector unsigned short __b) {
7064   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7065                                                      (vector int)__b);
7066 }
7067
7068 static vector unsigned char __ATTRS_o_ai vec_sll(vector unsigned char __a,
7069                                                  vector unsigned int __b) {
7070   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7071                                                      (vector int)__b);
7072 }
7073
7074 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7075                                              vector unsigned char __b) {
7076   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7077                                                  (vector int)__b);
7078 }
7079
7080 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7081                                              vector unsigned short __b) {
7082   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7083                                                  (vector int)__b);
7084 }
7085
7086 static vector bool char __ATTRS_o_ai vec_sll(vector bool char __a,
7087                                              vector unsigned int __b) {
7088   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7089                                                  (vector int)__b);
7090 }
7091
7092 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7093                                          vector unsigned char __b) {
7094   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7095 }
7096
7097 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7098                                          vector unsigned short __b) {
7099   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7100 }
7101
7102 static vector short __ATTRS_o_ai vec_sll(vector short __a,
7103                                          vector unsigned int __b) {
7104   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7105 }
7106
7107 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7108                                                   vector unsigned char __b) {
7109   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7110                                                       (vector int)__b);
7111 }
7112
7113 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7114                                                   vector unsigned short __b) {
7115   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7116                                                       (vector int)__b);
7117 }
7118
7119 static vector unsigned short __ATTRS_o_ai vec_sll(vector unsigned short __a,
7120                                                   vector unsigned int __b) {
7121   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7122                                                       (vector int)__b);
7123 }
7124
7125 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7126                                               vector unsigned char __b) {
7127   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7128                                                   (vector int)__b);
7129 }
7130
7131 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7132                                               vector unsigned short __b) {
7133   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7134                                                   (vector int)__b);
7135 }
7136
7137 static vector bool short __ATTRS_o_ai vec_sll(vector bool short __a,
7138                                               vector unsigned int __b) {
7139   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7140                                                   (vector int)__b);
7141 }
7142
7143 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7144                                          vector unsigned char __b) {
7145   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7146 }
7147
7148 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7149                                          vector unsigned short __b) {
7150   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7151 }
7152
7153 static vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
7154                                          vector unsigned int __b) {
7155   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7156 }
7157
7158 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7159                                        vector unsigned char __b) {
7160   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7161 }
7162
7163 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7164                                        vector unsigned short __b) {
7165   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7166 }
7167
7168 static vector int __ATTRS_o_ai vec_sll(vector int __a,
7169                                        vector unsigned int __b) {
7170   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7171 }
7172
7173 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7174                                                 vector unsigned char __b) {
7175   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7176                                                     (vector int)__b);
7177 }
7178
7179 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7180                                                 vector unsigned short __b) {
7181   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7182                                                     (vector int)__b);
7183 }
7184
7185 static vector unsigned int __ATTRS_o_ai vec_sll(vector unsigned int __a,
7186                                                 vector unsigned int __b) {
7187   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7188                                                     (vector int)__b);
7189 }
7190
7191 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7192                                             vector unsigned char __b) {
7193   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7194                                                 (vector int)__b);
7195 }
7196
7197 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7198                                             vector unsigned short __b) {
7199   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7200                                                 (vector int)__b);
7201 }
7202
7203 static vector bool int __ATTRS_o_ai vec_sll(vector bool int __a,
7204                                             vector unsigned int __b) {
7205   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7206                                                 (vector int)__b);
7207 }
7208
7209 /* vec_vsl */
7210
7211 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7212                                                vector unsigned char __b) {
7213   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7214                                                    (vector int)__b);
7215 }
7216
7217 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7218                                                vector unsigned short __b) {
7219   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7220                                                    (vector int)__b);
7221 }
7222
7223 static vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a,
7224                                                vector unsigned int __b) {
7225   return (vector signed char)__builtin_altivec_vsl((vector int)__a,
7226                                                    (vector int)__b);
7227 }
7228
7229 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7230                                                  vector unsigned char __b) {
7231   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7232                                                      (vector int)__b);
7233 }
7234
7235 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7236                                                  vector unsigned short __b) {
7237   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7238                                                      (vector int)__b);
7239 }
7240
7241 static vector unsigned char __ATTRS_o_ai vec_vsl(vector unsigned char __a,
7242                                                  vector unsigned int __b) {
7243   return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
7244                                                      (vector int)__b);
7245 }
7246
7247 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7248                                              vector unsigned char __b) {
7249   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7250                                                  (vector int)__b);
7251 }
7252
7253 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7254                                              vector unsigned short __b) {
7255   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7256                                                  (vector int)__b);
7257 }
7258
7259 static vector bool char __ATTRS_o_ai vec_vsl(vector bool char __a,
7260                                              vector unsigned int __b) {
7261   return (vector bool char)__builtin_altivec_vsl((vector int)__a,
7262                                                  (vector int)__b);
7263 }
7264
7265 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7266                                          vector unsigned char __b) {
7267   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7268 }
7269
7270 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7271                                          vector unsigned short __b) {
7272   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7273 }
7274
7275 static vector short __ATTRS_o_ai vec_vsl(vector short __a,
7276                                          vector unsigned int __b) {
7277   return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7278 }
7279
7280 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7281                                                   vector unsigned char __b) {
7282   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7283                                                       (vector int)__b);
7284 }
7285
7286 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7287                                                   vector unsigned short __b) {
7288   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7289                                                       (vector int)__b);
7290 }
7291
7292 static vector unsigned short __ATTRS_o_ai vec_vsl(vector unsigned short __a,
7293                                                   vector unsigned int __b) {
7294   return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
7295                                                       (vector int)__b);
7296 }
7297
7298 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7299                                               vector unsigned char __b) {
7300   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7301                                                   (vector int)__b);
7302 }
7303
7304 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7305                                               vector unsigned short __b) {
7306   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7307                                                   (vector int)__b);
7308 }
7309
7310 static vector bool short __ATTRS_o_ai vec_vsl(vector bool short __a,
7311                                               vector unsigned int __b) {
7312   return (vector bool short)__builtin_altivec_vsl((vector int)__a,
7313                                                   (vector int)__b);
7314 }
7315
7316 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7317                                          vector unsigned char __b) {
7318   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7319 }
7320
7321 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7322                                          vector unsigned short __b) {
7323   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7324 }
7325
7326 static vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
7327                                          vector unsigned int __b) {
7328   return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
7329 }
7330
7331 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7332                                        vector unsigned char __b) {
7333   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7334 }
7335
7336 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7337                                        vector unsigned short __b) {
7338   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7339 }
7340
7341 static vector int __ATTRS_o_ai vec_vsl(vector int __a,
7342                                        vector unsigned int __b) {
7343   return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
7344 }
7345
7346 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7347                                                 vector unsigned char __b) {
7348   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7349                                                     (vector int)__b);
7350 }
7351
7352 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7353                                                 vector unsigned short __b) {
7354   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7355                                                     (vector int)__b);
7356 }
7357
7358 static vector unsigned int __ATTRS_o_ai vec_vsl(vector unsigned int __a,
7359                                                 vector unsigned int __b) {
7360   return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
7361                                                     (vector int)__b);
7362 }
7363
7364 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7365                                             vector unsigned char __b) {
7366   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7367                                                 (vector int)__b);
7368 }
7369
7370 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7371                                             vector unsigned short __b) {
7372   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7373                                                 (vector int)__b);
7374 }
7375
7376 static vector bool int __ATTRS_o_ai vec_vsl(vector bool int __a,
7377                                             vector unsigned int __b) {
7378   return (vector bool int)__builtin_altivec_vsl((vector int)__a,
7379                                                 (vector int)__b);
7380 }
7381
7382 /* vec_slo */
7383
7384 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7385                                                vector signed char __b) {
7386   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7387                                                     (vector int)__b);
7388 }
7389
7390 static vector signed char __ATTRS_o_ai vec_slo(vector signed char __a,
7391                                                vector unsigned char __b) {
7392   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7393                                                     (vector int)__b);
7394 }
7395
7396 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7397                                                  vector signed char __b) {
7398   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7399                                                       (vector int)__b);
7400 }
7401
7402 static vector unsigned char __ATTRS_o_ai vec_slo(vector unsigned char __a,
7403                                                  vector unsigned char __b) {
7404   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7405                                                       (vector int)__b);
7406 }
7407
7408 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7409                                          vector signed char __b) {
7410   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7411 }
7412
7413 static vector short __ATTRS_o_ai vec_slo(vector short __a,
7414                                          vector unsigned char __b) {
7415   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7416 }
7417
7418 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7419                                                   vector signed char __b) {
7420   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7421                                                        (vector int)__b);
7422 }
7423
7424 static vector unsigned short __ATTRS_o_ai vec_slo(vector unsigned short __a,
7425                                                   vector unsigned char __b) {
7426   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7427                                                        (vector int)__b);
7428 }
7429
7430 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7431                                          vector signed char __b) {
7432   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7433 }
7434
7435 static vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
7436                                          vector unsigned char __b) {
7437   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7438 }
7439
7440 static vector int __ATTRS_o_ai vec_slo(vector int __a, vector signed char __b) {
7441   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7442 }
7443
7444 static vector int __ATTRS_o_ai vec_slo(vector int __a,
7445                                        vector unsigned char __b) {
7446   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7447 }
7448
7449 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7450                                                 vector signed char __b) {
7451   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7452                                                      (vector int)__b);
7453 }
7454
7455 static vector unsigned int __ATTRS_o_ai vec_slo(vector unsigned int __a,
7456                                                 vector unsigned char __b) {
7457   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7458                                                      (vector int)__b);
7459 }
7460
7461 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7462                                          vector signed char __b) {
7463   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7464 }
7465
7466 static vector float __ATTRS_o_ai vec_slo(vector float __a,
7467                                          vector unsigned char __b) {
7468   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7469 }
7470
7471 /* vec_vslo */
7472
7473 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7474                                                 vector signed char __b) {
7475   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7476                                                     (vector int)__b);
7477 }
7478
7479 static vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a,
7480                                                 vector unsigned char __b) {
7481   return (vector signed char)__builtin_altivec_vslo((vector int)__a,
7482                                                     (vector int)__b);
7483 }
7484
7485 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7486                                                   vector signed char __b) {
7487   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7488                                                       (vector int)__b);
7489 }
7490
7491 static vector unsigned char __ATTRS_o_ai vec_vslo(vector unsigned char __a,
7492                                                   vector unsigned char __b) {
7493   return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
7494                                                       (vector int)__b);
7495 }
7496
7497 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7498                                           vector signed char __b) {
7499   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7500 }
7501
7502 static vector short __ATTRS_o_ai vec_vslo(vector short __a,
7503                                           vector unsigned char __b) {
7504   return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7505 }
7506
7507 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7508                                                    vector signed char __b) {
7509   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7510                                                        (vector int)__b);
7511 }
7512
7513 static vector unsigned short __ATTRS_o_ai vec_vslo(vector unsigned short __a,
7514                                                    vector unsigned char __b) {
7515   return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
7516                                                        (vector int)__b);
7517 }
7518
7519 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7520                                           vector signed char __b) {
7521   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7522 }
7523
7524 static vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
7525                                           vector unsigned char __b) {
7526   return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7527 }
7528
7529 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7530                                         vector signed char __b) {
7531   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7532 }
7533
7534 static vector int __ATTRS_o_ai vec_vslo(vector int __a,
7535                                         vector unsigned char __b) {
7536   return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
7537 }
7538
7539 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7540                                                  vector signed char __b) {
7541   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7542                                                      (vector int)__b);
7543 }
7544
7545 static vector unsigned int __ATTRS_o_ai vec_vslo(vector unsigned int __a,
7546                                                  vector unsigned char __b) {
7547   return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
7548                                                      (vector int)__b);
7549 }
7550
7551 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7552                                           vector signed char __b) {
7553   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7554 }
7555
7556 static vector float __ATTRS_o_ai vec_vslo(vector float __a,
7557                                           vector unsigned char __b) {
7558   return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
7559 }
7560
7561 /* vec_splat */
7562
7563 static vector signed char __ATTRS_o_ai vec_splat(vector signed char __a,
7564                                                  unsigned const int __b) {
7565   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7566 }
7567
7568 static vector unsigned char __ATTRS_o_ai vec_splat(vector unsigned char __a,
7569                                                    unsigned const int __b) {
7570   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7571 }
7572
7573 static vector bool char __ATTRS_o_ai vec_splat(vector bool char __a,
7574                                                unsigned const int __b) {
7575   return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
7576 }
7577
7578 static vector signed short __ATTRS_o_ai vec_splat(vector signed short __a,
7579                                                   unsigned const int __b) {
7580   unsigned char b0 = (__b & 0x07) * 2;
7581   unsigned char b1 = b0 + 1;
7582   return vec_perm(__a, __a,
7583                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7584                                          b0, b1, b0, b1, b0, b1, b0, b1));
7585 }
7586
7587 static vector unsigned short __ATTRS_o_ai vec_splat(vector unsigned short __a,
7588                                                     unsigned const int __b) {
7589   unsigned char b0 = (__b & 0x07) * 2;
7590   unsigned char b1 = b0 + 1;
7591   return vec_perm(__a, __a,
7592                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7593                                          b0, b1, b0, b1, b0, b1, b0, b1));
7594 }
7595
7596 static vector bool short __ATTRS_o_ai vec_splat(vector bool short __a,
7597                                                 unsigned const int __b) {
7598   unsigned char b0 = (__b & 0x07) * 2;
7599   unsigned char b1 = b0 + 1;
7600   return vec_perm(__a, __a,
7601                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7602                                          b0, b1, b0, b1, b0, b1, b0, b1));
7603 }
7604
7605 static vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
7606                                            unsigned const int __b) {
7607   unsigned char b0 = (__b & 0x07) * 2;
7608   unsigned char b1 = b0 + 1;
7609   return vec_perm(__a, __a,
7610                   (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1,
7611                                          b0, b1, b0, b1, b0, b1, b0, b1));
7612 }
7613
7614 static vector signed int __ATTRS_o_ai vec_splat(vector signed int __a,
7615                                                 unsigned const int __b) {
7616   unsigned char b0 = (__b & 0x03) * 4;
7617   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7618   return vec_perm(__a, __a,
7619                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7620                                          b1, b2, b3, b0, b1, b2, b3));
7621 }
7622
7623 static vector unsigned int __ATTRS_o_ai vec_splat(vector unsigned int __a,
7624                                                   unsigned const int __b) {
7625   unsigned char b0 = (__b & 0x03) * 4;
7626   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7627   return vec_perm(__a, __a,
7628                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7629                                          b1, b2, b3, b0, b1, b2, b3));
7630 }
7631
7632 static vector bool int __ATTRS_o_ai vec_splat(vector bool int __a,
7633                                               unsigned const int __b) {
7634   unsigned char b0 = (__b & 0x03) * 4;
7635   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7636   return vec_perm(__a, __a,
7637                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7638                                          b1, b2, b3, b0, b1, b2, b3));
7639 }
7640
7641 static vector float __ATTRS_o_ai vec_splat(vector float __a,
7642                                            unsigned const int __b) {
7643   unsigned char b0 = (__b & 0x03) * 4;
7644   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
7645   return vec_perm(__a, __a,
7646                   (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0,
7647                                          b1, b2, b3, b0, b1, b2, b3));
7648 }
7649
7650 #ifdef __VSX__
7651 static vector double __ATTRS_o_ai vec_splat(vector double __a,
7652                                             unsigned const int __b) {
7653   unsigned char b0 = (__b & 0x01) * 8;
7654   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7655                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7656   return vec_perm(__a, __a,
7657                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7658                                          b0, b1, b2, b3, b4, b5, b6, b7));
7659 }
7660 static vector bool long long __ATTRS_o_ai vec_splat(vector bool long long __a,
7661                                                     unsigned const int __b) {
7662   unsigned char b0 = (__b & 0x01) * 8;
7663   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7664                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7665   return vec_perm(__a, __a,
7666                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7667                                          b0, b1, b2, b3, b4, b5, b6, b7));
7668 }
7669 static vector signed long long __ATTRS_o_ai
7670 vec_splat(vector signed long long __a, unsigned const int __b) {
7671   unsigned char b0 = (__b & 0x01) * 8;
7672   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7673                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7674   return vec_perm(__a, __a,
7675                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7676                                          b0, b1, b2, b3, b4, b5, b6, b7));
7677 }
7678 static vector unsigned long long __ATTRS_o_ai
7679 vec_splat(vector unsigned long long __a, unsigned const int __b) {
7680   unsigned char b0 = (__b & 0x01) * 8;
7681   unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4,
7682                 b5 = b0 + 5, b6 = b0 + 6, b7 = b0 + 7;
7683   return vec_perm(__a, __a,
7684                   (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7,
7685                                          b0, b1, b2, b3, b4, b5, b6, b7));
7686 }
7687 #endif
7688
7689 /* vec_vspltb */
7690
7691 #define __builtin_altivec_vspltb vec_vspltb
7692
7693 static vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a,
7694                                                   unsigned char __b) {
7695   return vec_perm(__a, __a, (vector unsigned char)(__b));
7696 }
7697
7698 static vector unsigned char __ATTRS_o_ai vec_vspltb(vector unsigned char __a,
7699                                                     unsigned char __b) {
7700   return vec_perm(__a, __a, (vector unsigned char)(__b));
7701 }
7702
7703 static vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
7704                                                 unsigned char __b) {
7705   return vec_perm(__a, __a, (vector unsigned char)(__b));
7706 }
7707
7708 /* vec_vsplth */
7709
7710 #define __builtin_altivec_vsplth vec_vsplth
7711
7712 static vector short __ATTRS_o_ai vec_vsplth(vector short __a,
7713                                             unsigned char __b) {
7714   __b *= 2;
7715   unsigned char b1 = __b + 1;
7716   return vec_perm(__a, __a,
7717                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7718                                          __b, b1, __b, b1, __b, b1, __b, b1));
7719 }
7720
7721 static vector unsigned short __ATTRS_o_ai vec_vsplth(vector unsigned short __a,
7722                                                      unsigned char __b) {
7723   __b *= 2;
7724   unsigned char b1 = __b + 1;
7725   return vec_perm(__a, __a,
7726                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7727                                          __b, b1, __b, b1, __b, b1, __b, b1));
7728 }
7729
7730 static vector bool short __ATTRS_o_ai vec_vsplth(vector bool short __a,
7731                                                  unsigned char __b) {
7732   __b *= 2;
7733   unsigned char b1 = __b + 1;
7734   return vec_perm(__a, __a,
7735                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7736                                          __b, b1, __b, b1, __b, b1, __b, b1));
7737 }
7738
7739 static vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
7740                                             unsigned char __b) {
7741   __b *= 2;
7742   unsigned char b1 = __b + 1;
7743   return vec_perm(__a, __a,
7744                   (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
7745                                          __b, b1, __b, b1, __b, b1, __b, b1));
7746 }
7747
7748 /* vec_vspltw */
7749
7750 #define __builtin_altivec_vspltw vec_vspltw
7751
7752 static vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b) {
7753   __b *= 4;
7754   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7755   return vec_perm(__a, __a,
7756                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7757                                          b1, b2, b3, __b, b1, b2, b3));
7758 }
7759
7760 static vector unsigned int __ATTRS_o_ai vec_vspltw(vector unsigned int __a,
7761                                                    unsigned char __b) {
7762   __b *= 4;
7763   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7764   return vec_perm(__a, __a,
7765                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7766                                          b1, b2, b3, __b, b1, b2, b3));
7767 }
7768
7769 static vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
7770                                                unsigned char __b) {
7771   __b *= 4;
7772   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7773   return vec_perm(__a, __a,
7774                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7775                                          b1, b2, b3, __b, b1, b2, b3));
7776 }
7777
7778 static vector float __ATTRS_o_ai vec_vspltw(vector float __a,
7779                                             unsigned char __b) {
7780   __b *= 4;
7781   unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
7782   return vec_perm(__a, __a,
7783                   (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
7784                                          b1, b2, b3, __b, b1, b2, b3));
7785 }
7786
7787 /* vec_splat_s8 */
7788
7789 #define __builtin_altivec_vspltisb vec_splat_s8
7790
7791 // FIXME: parameter should be treated as 5-bit signed literal
7792 static vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a) {
7793   return (vector signed char)(__a);
7794 }
7795
7796 /* vec_vspltisb */
7797
7798 // FIXME: parameter should be treated as 5-bit signed literal
7799 static vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a) {
7800   return (vector signed char)(__a);
7801 }
7802
7803 /* vec_splat_s16 */
7804
7805 #define __builtin_altivec_vspltish vec_splat_s16
7806
7807 // FIXME: parameter should be treated as 5-bit signed literal
7808 static vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
7809   return (vector short)(__a);
7810 }
7811
7812 /* vec_vspltish */
7813
7814 // FIXME: parameter should be treated as 5-bit signed literal
7815 static vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
7816   return (vector short)(__a);
7817 }
7818
7819 /* vec_splat_s32 */
7820
7821 #define __builtin_altivec_vspltisw vec_splat_s32
7822
7823 // FIXME: parameter should be treated as 5-bit signed literal
7824 static vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
7825   return (vector int)(__a);
7826 }
7827
7828 /* vec_vspltisw */
7829
7830 // FIXME: parameter should be treated as 5-bit signed literal
7831 static vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
7832   return (vector int)(__a);
7833 }
7834
7835 /* vec_splat_u8 */
7836
7837 // FIXME: parameter should be treated as 5-bit signed literal
7838 static vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a) {
7839   return (vector unsigned char)(__a);
7840 }
7841
7842 /* vec_splat_u16 */
7843
7844 // FIXME: parameter should be treated as 5-bit signed literal
7845 static vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a) {
7846   return (vector unsigned short)(__a);
7847 }
7848
7849 /* vec_splat_u32 */
7850
7851 // FIXME: parameter should be treated as 5-bit signed literal
7852 static vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a) {
7853   return (vector unsigned int)(__a);
7854 }
7855
7856 /* vec_sr */
7857
7858 static vector signed char __ATTRS_o_ai vec_sr(vector signed char __a,
7859                                               vector unsigned char __b) {
7860   vector unsigned char __res = (vector unsigned char)__a >> __b;
7861   return (vector signed char)__res;
7862 }
7863
7864 static vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a,
7865                                                 vector unsigned char __b) {
7866   return __a >> __b;
7867 }
7868
7869 static vector signed short __ATTRS_o_ai vec_sr(vector signed short __a,
7870                                         vector unsigned short __b) {
7871   vector unsigned short __res = (vector unsigned short)__a >> __b;
7872   return (vector signed short)__res;
7873 }
7874
7875 static vector unsigned short __ATTRS_o_ai vec_sr(vector unsigned short __a,
7876                                                  vector unsigned short __b) {
7877   return __a >> __b;
7878 }
7879
7880 static vector signed int __ATTRS_o_ai vec_sr(vector signed int __a,
7881                                              vector unsigned int __b) {
7882   vector unsigned int __res = (vector unsigned int)__a >> __b;
7883   return (vector signed int)__res;
7884 }
7885
7886 static vector unsigned int __ATTRS_o_ai vec_sr(vector unsigned int __a,
7887                                                vector unsigned int __b) {
7888   return __a >> __b;
7889 }
7890
7891 #ifdef __POWER8_VECTOR__
7892 static vector signed long long __ATTRS_o_ai
7893 vec_sr(vector signed long long __a, vector unsigned long long __b) {
7894   vector unsigned long long __res = (vector unsigned long long)__a >> __b;
7895   return (vector signed long long)__res;
7896 }
7897
7898 static vector unsigned long long __ATTRS_o_ai
7899 vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
7900   return __a >> __b;
7901 }
7902 #endif
7903
7904 /* vec_vsrb */
7905
7906 #define __builtin_altivec_vsrb vec_vsrb
7907
7908 static vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a,
7909                                                 vector unsigned char __b) {
7910   return __a >> (vector signed char)__b;
7911 }
7912
7913 static vector unsigned char __ATTRS_o_ai vec_vsrb(vector unsigned char __a,
7914                                                   vector unsigned char __b) {
7915   return __a >> __b;
7916 }
7917
7918 /* vec_vsrh */
7919
7920 #define __builtin_altivec_vsrh vec_vsrh
7921
7922 static vector short __ATTRS_o_ai vec_vsrh(vector short __a,
7923                                           vector unsigned short __b) {
7924   return __a >> (vector short)__b;
7925 }
7926
7927 static vector unsigned short __ATTRS_o_ai vec_vsrh(vector unsigned short __a,
7928                                                    vector unsigned short __b) {
7929   return __a >> __b;
7930 }
7931
7932 /* vec_vsrw */
7933
7934 #define __builtin_altivec_vsrw vec_vsrw
7935
7936 static vector int __ATTRS_o_ai vec_vsrw(vector int __a,
7937                                         vector unsigned int __b) {
7938   return __a >> (vector int)__b;
7939 }
7940
7941 static vector unsigned int __ATTRS_o_ai vec_vsrw(vector unsigned int __a,
7942                                                  vector unsigned int __b) {
7943   return __a >> __b;
7944 }
7945
7946 /* vec_sra */
7947
7948 static vector signed char __ATTRS_o_ai vec_sra(vector signed char __a,
7949                                                vector unsigned char __b) {
7950   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
7951 }
7952
7953 static vector unsigned char __ATTRS_o_ai vec_sra(vector unsigned char __a,
7954                                                  vector unsigned char __b) {
7955   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
7956 }
7957
7958 static vector short __ATTRS_o_ai vec_sra(vector short __a,
7959                                          vector unsigned short __b) {
7960   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
7961 }
7962
7963 static vector unsigned short __ATTRS_o_ai vec_sra(vector unsigned short __a,
7964                                                   vector unsigned short __b) {
7965   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
7966 }
7967
7968 static vector int __ATTRS_o_ai vec_sra(vector int __a,
7969                                        vector unsigned int __b) {
7970   return __builtin_altivec_vsraw(__a, __b);
7971 }
7972
7973 static vector unsigned int __ATTRS_o_ai vec_sra(vector unsigned int __a,
7974                                                 vector unsigned int __b) {
7975   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
7976 }
7977
7978 #ifdef __POWER8_VECTOR__
7979 static vector signed long long __ATTRS_o_ai
7980 vec_sra(vector signed long long __a, vector unsigned long long __b) {
7981   return __a >> __b;
7982 }
7983
7984 static vector unsigned long long __ATTRS_o_ai
7985 vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
7986   return (vector unsigned long long)((vector signed long long)__a >> __b);
7987 }
7988 #endif
7989
7990 /* vec_vsrab */
7991
7992 static vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a,
7993                                                  vector unsigned char __b) {
7994   return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
7995 }
7996
7997 static vector unsigned char __ATTRS_o_ai vec_vsrab(vector unsigned char __a,
7998                                                    vector unsigned char __b) {
7999   return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
8000 }
8001
8002 /* vec_vsrah */
8003
8004 static vector short __ATTRS_o_ai vec_vsrah(vector short __a,
8005                                            vector unsigned short __b) {
8006   return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
8007 }
8008
8009 static vector unsigned short __ATTRS_o_ai vec_vsrah(vector unsigned short __a,
8010                                                     vector unsigned short __b) {
8011   return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
8012 }
8013
8014 /* vec_vsraw */
8015
8016 static vector int __ATTRS_o_ai vec_vsraw(vector int __a,
8017                                          vector unsigned int __b) {
8018   return __builtin_altivec_vsraw(__a, __b);
8019 }
8020
8021 static vector unsigned int __ATTRS_o_ai vec_vsraw(vector unsigned int __a,
8022                                                   vector unsigned int __b) {
8023   return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
8024 }
8025
8026 /* vec_srl */
8027
8028 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8029                                                vector unsigned char __b) {
8030   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8031                                                    (vector int)__b);
8032 }
8033
8034 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8035                                                vector unsigned short __b) {
8036   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8037                                                    (vector int)__b);
8038 }
8039
8040 static vector signed char __ATTRS_o_ai vec_srl(vector signed char __a,
8041                                                vector unsigned int __b) {
8042   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8043                                                    (vector int)__b);
8044 }
8045
8046 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8047                                                  vector unsigned char __b) {
8048   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8049                                                      (vector int)__b);
8050 }
8051
8052 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8053                                                  vector unsigned short __b) {
8054   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8055                                                      (vector int)__b);
8056 }
8057
8058 static vector unsigned char __ATTRS_o_ai vec_srl(vector unsigned char __a,
8059                                                  vector unsigned int __b) {
8060   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8061                                                      (vector int)__b);
8062 }
8063
8064 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8065                                              vector unsigned char __b) {
8066   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8067                                                  (vector int)__b);
8068 }
8069
8070 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8071                                              vector unsigned short __b) {
8072   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8073                                                  (vector int)__b);
8074 }
8075
8076 static vector bool char __ATTRS_o_ai vec_srl(vector bool char __a,
8077                                              vector unsigned int __b) {
8078   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8079                                                  (vector int)__b);
8080 }
8081
8082 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8083                                          vector unsigned char __b) {
8084   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8085 }
8086
8087 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8088                                          vector unsigned short __b) {
8089   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8090 }
8091
8092 static vector short __ATTRS_o_ai vec_srl(vector short __a,
8093                                          vector unsigned int __b) {
8094   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8095 }
8096
8097 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8098                                                   vector unsigned char __b) {
8099   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8100                                                       (vector int)__b);
8101 }
8102
8103 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8104                                                   vector unsigned short __b) {
8105   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8106                                                       (vector int)__b);
8107 }
8108
8109 static vector unsigned short __ATTRS_o_ai vec_srl(vector unsigned short __a,
8110                                                   vector unsigned int __b) {
8111   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8112                                                       (vector int)__b);
8113 }
8114
8115 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8116                                               vector unsigned char __b) {
8117   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8118                                                   (vector int)__b);
8119 }
8120
8121 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8122                                               vector unsigned short __b) {
8123   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8124                                                   (vector int)__b);
8125 }
8126
8127 static vector bool short __ATTRS_o_ai vec_srl(vector bool short __a,
8128                                               vector unsigned int __b) {
8129   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8130                                                   (vector int)__b);
8131 }
8132
8133 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8134                                          vector unsigned char __b) {
8135   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8136 }
8137
8138 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8139                                          vector unsigned short __b) {
8140   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8141 }
8142
8143 static vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
8144                                          vector unsigned int __b) {
8145   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8146 }
8147
8148 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8149                                        vector unsigned char __b) {
8150   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8151 }
8152
8153 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8154                                        vector unsigned short __b) {
8155   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8156 }
8157
8158 static vector int __ATTRS_o_ai vec_srl(vector int __a,
8159                                        vector unsigned int __b) {
8160   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8161 }
8162
8163 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8164                                                 vector unsigned char __b) {
8165   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8166                                                     (vector int)__b);
8167 }
8168
8169 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8170                                                 vector unsigned short __b) {
8171   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8172                                                     (vector int)__b);
8173 }
8174
8175 static vector unsigned int __ATTRS_o_ai vec_srl(vector unsigned int __a,
8176                                                 vector unsigned int __b) {
8177   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8178                                                     (vector int)__b);
8179 }
8180
8181 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8182                                             vector unsigned char __b) {
8183   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8184                                                 (vector int)__b);
8185 }
8186
8187 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8188                                             vector unsigned short __b) {
8189   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8190                                                 (vector int)__b);
8191 }
8192
8193 static vector bool int __ATTRS_o_ai vec_srl(vector bool int __a,
8194                                             vector unsigned int __b) {
8195   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8196                                                 (vector int)__b);
8197 }
8198
8199 /* vec_vsr */
8200
8201 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8202                                                vector unsigned char __b) {
8203   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8204                                                    (vector int)__b);
8205 }
8206
8207 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8208                                                vector unsigned short __b) {
8209   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8210                                                    (vector int)__b);
8211 }
8212
8213 static vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a,
8214                                                vector unsigned int __b) {
8215   return (vector signed char)__builtin_altivec_vsr((vector int)__a,
8216                                                    (vector int)__b);
8217 }
8218
8219 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8220                                                  vector unsigned char __b) {
8221   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8222                                                      (vector int)__b);
8223 }
8224
8225 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8226                                                  vector unsigned short __b) {
8227   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8228                                                      (vector int)__b);
8229 }
8230
8231 static vector unsigned char __ATTRS_o_ai vec_vsr(vector unsigned char __a,
8232                                                  vector unsigned int __b) {
8233   return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
8234                                                      (vector int)__b);
8235 }
8236
8237 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8238                                              vector unsigned char __b) {
8239   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8240                                                  (vector int)__b);
8241 }
8242
8243 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8244                                              vector unsigned short __b) {
8245   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8246                                                  (vector int)__b);
8247 }
8248
8249 static vector bool char __ATTRS_o_ai vec_vsr(vector bool char __a,
8250                                              vector unsigned int __b) {
8251   return (vector bool char)__builtin_altivec_vsr((vector int)__a,
8252                                                  (vector int)__b);
8253 }
8254
8255 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8256                                          vector unsigned char __b) {
8257   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8258 }
8259
8260 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8261                                          vector unsigned short __b) {
8262   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8263 }
8264
8265 static vector short __ATTRS_o_ai vec_vsr(vector short __a,
8266                                          vector unsigned int __b) {
8267   return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8268 }
8269
8270 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8271                                                   vector unsigned char __b) {
8272   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8273                                                       (vector int)__b);
8274 }
8275
8276 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8277                                                   vector unsigned short __b) {
8278   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8279                                                       (vector int)__b);
8280 }
8281
8282 static vector unsigned short __ATTRS_o_ai vec_vsr(vector unsigned short __a,
8283                                                   vector unsigned int __b) {
8284   return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
8285                                                       (vector int)__b);
8286 }
8287
8288 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8289                                               vector unsigned char __b) {
8290   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8291                                                   (vector int)__b);
8292 }
8293
8294 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8295                                               vector unsigned short __b) {
8296   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8297                                                   (vector int)__b);
8298 }
8299
8300 static vector bool short __ATTRS_o_ai vec_vsr(vector bool short __a,
8301                                               vector unsigned int __b) {
8302   return (vector bool short)__builtin_altivec_vsr((vector int)__a,
8303                                                   (vector int)__b);
8304 }
8305
8306 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8307                                          vector unsigned char __b) {
8308   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8309 }
8310
8311 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8312                                          vector unsigned short __b) {
8313   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8314 }
8315
8316 static vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
8317                                          vector unsigned int __b) {
8318   return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
8319 }
8320
8321 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8322                                        vector unsigned char __b) {
8323   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8324 }
8325
8326 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8327                                        vector unsigned short __b) {
8328   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8329 }
8330
8331 static vector int __ATTRS_o_ai vec_vsr(vector int __a,
8332                                        vector unsigned int __b) {
8333   return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
8334 }
8335
8336 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8337                                                 vector unsigned char __b) {
8338   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8339                                                     (vector int)__b);
8340 }
8341
8342 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8343                                                 vector unsigned short __b) {
8344   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8345                                                     (vector int)__b);
8346 }
8347
8348 static vector unsigned int __ATTRS_o_ai vec_vsr(vector unsigned int __a,
8349                                                 vector unsigned int __b) {
8350   return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
8351                                                     (vector int)__b);
8352 }
8353
8354 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8355                                             vector unsigned char __b) {
8356   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8357                                                 (vector int)__b);
8358 }
8359
8360 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8361                                             vector unsigned short __b) {
8362   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8363                                                 (vector int)__b);
8364 }
8365
8366 static vector bool int __ATTRS_o_ai vec_vsr(vector bool int __a,
8367                                             vector unsigned int __b) {
8368   return (vector bool int)__builtin_altivec_vsr((vector int)__a,
8369                                                 (vector int)__b);
8370 }
8371
8372 /* vec_sro */
8373
8374 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8375                                                vector signed char __b) {
8376   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8377                                                     (vector int)__b);
8378 }
8379
8380 static vector signed char __ATTRS_o_ai vec_sro(vector signed char __a,
8381                                                vector unsigned char __b) {
8382   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8383                                                     (vector int)__b);
8384 }
8385
8386 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8387                                                  vector signed char __b) {
8388   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8389                                                       (vector int)__b);
8390 }
8391
8392 static vector unsigned char __ATTRS_o_ai vec_sro(vector unsigned char __a,
8393                                                  vector unsigned char __b) {
8394   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8395                                                       (vector int)__b);
8396 }
8397
8398 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8399                                          vector signed char __b) {
8400   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8401 }
8402
8403 static vector short __ATTRS_o_ai vec_sro(vector short __a,
8404                                          vector unsigned char __b) {
8405   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8406 }
8407
8408 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8409                                                   vector signed char __b) {
8410   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8411                                                        (vector int)__b);
8412 }
8413
8414 static vector unsigned short __ATTRS_o_ai vec_sro(vector unsigned short __a,
8415                                                   vector unsigned char __b) {
8416   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8417                                                        (vector int)__b);
8418 }
8419
8420 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8421                                          vector signed char __b) {
8422   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8423 }
8424
8425 static vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
8426                                          vector unsigned char __b) {
8427   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8428 }
8429
8430 static vector int __ATTRS_o_ai vec_sro(vector int __a, vector signed char __b) {
8431   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8432 }
8433
8434 static vector int __ATTRS_o_ai vec_sro(vector int __a,
8435                                        vector unsigned char __b) {
8436   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8437 }
8438
8439 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8440                                                 vector signed char __b) {
8441   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8442                                                      (vector int)__b);
8443 }
8444
8445 static vector unsigned int __ATTRS_o_ai vec_sro(vector unsigned int __a,
8446                                                 vector unsigned char __b) {
8447   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8448                                                      (vector int)__b);
8449 }
8450
8451 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8452                                          vector signed char __b) {
8453   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8454 }
8455
8456 static vector float __ATTRS_o_ai vec_sro(vector float __a,
8457                                          vector unsigned char __b) {
8458   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8459 }
8460
8461 /* vec_vsro */
8462
8463 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8464                                                 vector signed char __b) {
8465   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8466                                                     (vector int)__b);
8467 }
8468
8469 static vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a,
8470                                                 vector unsigned char __b) {
8471   return (vector signed char)__builtin_altivec_vsro((vector int)__a,
8472                                                     (vector int)__b);
8473 }
8474
8475 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8476                                                   vector signed char __b) {
8477   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8478                                                       (vector int)__b);
8479 }
8480
8481 static vector unsigned char __ATTRS_o_ai vec_vsro(vector unsigned char __a,
8482                                                   vector unsigned char __b) {
8483   return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
8484                                                       (vector int)__b);
8485 }
8486
8487 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8488                                           vector signed char __b) {
8489   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8490 }
8491
8492 static vector short __ATTRS_o_ai vec_vsro(vector short __a,
8493                                           vector unsigned char __b) {
8494   return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8495 }
8496
8497 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8498                                                    vector signed char __b) {
8499   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8500                                                        (vector int)__b);
8501 }
8502
8503 static vector unsigned short __ATTRS_o_ai vec_vsro(vector unsigned short __a,
8504                                                    vector unsigned char __b) {
8505   return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
8506                                                        (vector int)__b);
8507 }
8508
8509 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8510                                           vector signed char __b) {
8511   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8512 }
8513
8514 static vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
8515                                           vector unsigned char __b) {
8516   return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8517 }
8518
8519 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8520                                         vector signed char __b) {
8521   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8522 }
8523
8524 static vector int __ATTRS_o_ai vec_vsro(vector int __a,
8525                                         vector unsigned char __b) {
8526   return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
8527 }
8528
8529 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8530                                                  vector signed char __b) {
8531   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8532                                                      (vector int)__b);
8533 }
8534
8535 static vector unsigned int __ATTRS_o_ai vec_vsro(vector unsigned int __a,
8536                                                  vector unsigned char __b) {
8537   return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
8538                                                      (vector int)__b);
8539 }
8540
8541 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8542                                           vector signed char __b) {
8543   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8544 }
8545
8546 static vector float __ATTRS_o_ai vec_vsro(vector float __a,
8547                                           vector unsigned char __b) {
8548   return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
8549 }
8550
8551 /* vec_st */
8552
8553 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8554                                 vector signed char *__c) {
8555   __builtin_altivec_stvx((vector int)__a, __b, __c);
8556 }
8557
8558 static void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
8559                                 signed char *__c) {
8560   __builtin_altivec_stvx((vector int)__a, __b, __c);
8561 }
8562
8563 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8564                                 vector unsigned char *__c) {
8565   __builtin_altivec_stvx((vector int)__a, __b, __c);
8566 }
8567
8568 static void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
8569                                 unsigned char *__c) {
8570   __builtin_altivec_stvx((vector int)__a, __b, __c);
8571 }
8572
8573 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8574                                 signed char *__c) {
8575   __builtin_altivec_stvx((vector int)__a, __b, __c);
8576 }
8577
8578 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8579                                 unsigned char *__c) {
8580   __builtin_altivec_stvx((vector int)__a, __b, __c);
8581 }
8582
8583 static void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
8584                                 vector bool char *__c) {
8585   __builtin_altivec_stvx((vector int)__a, __b, __c);
8586 }
8587
8588 static void __ATTRS_o_ai vec_st(vector short __a, int __b, vector short *__c) {
8589   __builtin_altivec_stvx((vector int)__a, __b, __c);
8590 }
8591
8592 static void __ATTRS_o_ai vec_st(vector short __a, int __b, short *__c) {
8593   __builtin_altivec_stvx((vector int)__a, __b, __c);
8594 }
8595
8596 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8597                                 vector unsigned short *__c) {
8598   __builtin_altivec_stvx((vector int)__a, __b, __c);
8599 }
8600
8601 static void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
8602                                 unsigned short *__c) {
8603   __builtin_altivec_stvx((vector int)__a, __b, __c);
8604 }
8605
8606 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b, short *__c) {
8607   __builtin_altivec_stvx((vector int)__a, __b, __c);
8608 }
8609
8610 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8611                                 unsigned short *__c) {
8612   __builtin_altivec_stvx((vector int)__a, __b, __c);
8613 }
8614
8615 static void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
8616                                 vector bool short *__c) {
8617   __builtin_altivec_stvx((vector int)__a, __b, __c);
8618 }
8619
8620 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, short *__c) {
8621   __builtin_altivec_stvx((vector int)__a, __b, __c);
8622 }
8623
8624 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
8625                                 unsigned short *__c) {
8626   __builtin_altivec_stvx((vector int)__a, __b, __c);
8627 }
8628
8629 static void __ATTRS_o_ai vec_st(vector pixel __a, int __b, vector pixel *__c) {
8630   __builtin_altivec_stvx((vector int)__a, __b, __c);
8631 }
8632
8633 static void __ATTRS_o_ai vec_st(vector int __a, int __b, vector int *__c) {
8634   __builtin_altivec_stvx(__a, __b, __c);
8635 }
8636
8637 static void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
8638   __builtin_altivec_stvx(__a, __b, __c);
8639 }
8640
8641 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8642                                 vector unsigned int *__c) {
8643   __builtin_altivec_stvx((vector int)__a, __b, __c);
8644 }
8645
8646 static void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
8647                                 unsigned int *__c) {
8648   __builtin_altivec_stvx((vector int)__a, __b, __c);
8649 }
8650
8651 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b, int *__c) {
8652   __builtin_altivec_stvx((vector int)__a, __b, __c);
8653 }
8654
8655 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8656                                 unsigned int *__c) {
8657   __builtin_altivec_stvx((vector int)__a, __b, __c);
8658 }
8659
8660 static void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
8661                                 vector bool int *__c) {
8662   __builtin_altivec_stvx((vector int)__a, __b, __c);
8663 }
8664
8665 static void __ATTRS_o_ai vec_st(vector float __a, int __b, vector float *__c) {
8666   __builtin_altivec_stvx((vector int)__a, __b, __c);
8667 }
8668
8669 static void __ATTRS_o_ai vec_st(vector float __a, int __b, float *__c) {
8670   __builtin_altivec_stvx((vector int)__a, __b, __c);
8671 }
8672
8673 /* vec_stvx */
8674
8675 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8676                                   vector signed char *__c) {
8677   __builtin_altivec_stvx((vector int)__a, __b, __c);
8678 }
8679
8680 static void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
8681                                   signed char *__c) {
8682   __builtin_altivec_stvx((vector int)__a, __b, __c);
8683 }
8684
8685 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8686                                   vector unsigned char *__c) {
8687   __builtin_altivec_stvx((vector int)__a, __b, __c);
8688 }
8689
8690 static void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
8691                                   unsigned char *__c) {
8692   __builtin_altivec_stvx((vector int)__a, __b, __c);
8693 }
8694
8695 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8696                                   signed char *__c) {
8697   __builtin_altivec_stvx((vector int)__a, __b, __c);
8698 }
8699
8700 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8701                                   unsigned char *__c) {
8702   __builtin_altivec_stvx((vector int)__a, __b, __c);
8703 }
8704
8705 static void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
8706                                   vector bool char *__c) {
8707   __builtin_altivec_stvx((vector int)__a, __b, __c);
8708 }
8709
8710 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
8711                                   vector short *__c) {
8712   __builtin_altivec_stvx((vector int)__a, __b, __c);
8713 }
8714
8715 static void __ATTRS_o_ai vec_stvx(vector short __a, int __b, short *__c) {
8716   __builtin_altivec_stvx((vector int)__a, __b, __c);
8717 }
8718
8719 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8720                                   vector unsigned short *__c) {
8721   __builtin_altivec_stvx((vector int)__a, __b, __c);
8722 }
8723
8724 static void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
8725                                   unsigned short *__c) {
8726   __builtin_altivec_stvx((vector int)__a, __b, __c);
8727 }
8728
8729 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, short *__c) {
8730   __builtin_altivec_stvx((vector int)__a, __b, __c);
8731 }
8732
8733 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8734                                   unsigned short *__c) {
8735   __builtin_altivec_stvx((vector int)__a, __b, __c);
8736 }
8737
8738 static void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
8739                                   vector bool short *__c) {
8740   __builtin_altivec_stvx((vector int)__a, __b, __c);
8741 }
8742
8743 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, short *__c) {
8744   __builtin_altivec_stvx((vector int)__a, __b, __c);
8745 }
8746
8747 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8748                                   unsigned short *__c) {
8749   __builtin_altivec_stvx((vector int)__a, __b, __c);
8750 }
8751
8752 static void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
8753                                   vector pixel *__c) {
8754   __builtin_altivec_stvx((vector int)__a, __b, __c);
8755 }
8756
8757 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, vector int *__c) {
8758   __builtin_altivec_stvx(__a, __b, __c);
8759 }
8760
8761 static void __ATTRS_o_ai vec_stvx(vector int __a, int __b, int *__c) {
8762   __builtin_altivec_stvx(__a, __b, __c);
8763 }
8764
8765 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8766                                   vector unsigned int *__c) {
8767   __builtin_altivec_stvx((vector int)__a, __b, __c);
8768 }
8769
8770 static void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
8771                                   unsigned int *__c) {
8772   __builtin_altivec_stvx((vector int)__a, __b, __c);
8773 }
8774
8775 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, int *__c) {
8776   __builtin_altivec_stvx((vector int)__a, __b, __c);
8777 }
8778
8779 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8780                                   unsigned int *__c) {
8781   __builtin_altivec_stvx((vector int)__a, __b, __c);
8782 }
8783
8784 static void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
8785                                   vector bool int *__c) {
8786   __builtin_altivec_stvx((vector int)__a, __b, __c);
8787 }
8788
8789 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
8790                                   vector float *__c) {
8791   __builtin_altivec_stvx((vector int)__a, __b, __c);
8792 }
8793
8794 static void __ATTRS_o_ai vec_stvx(vector float __a, int __b, float *__c) {
8795   __builtin_altivec_stvx((vector int)__a, __b, __c);
8796 }
8797
8798 /* vec_ste */
8799
8800 static void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
8801                                  signed char *__c) {
8802   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8803 }
8804
8805 static void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
8806                                  unsigned char *__c) {
8807   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8808 }
8809
8810 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8811                                  signed char *__c) {
8812   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8813 }
8814
8815 static void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
8816                                  unsigned char *__c) {
8817   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8818 }
8819
8820 static void __ATTRS_o_ai vec_ste(vector short __a, int __b, short *__c) {
8821   __builtin_altivec_stvehx(__a, __b, __c);
8822 }
8823
8824 static void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
8825                                  unsigned short *__c) {
8826   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8827 }
8828
8829 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, short *__c) {
8830   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8831 }
8832
8833 static void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
8834                                  unsigned short *__c) {
8835   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8836 }
8837
8838 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, short *__c) {
8839   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8840 }
8841
8842 static void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
8843                                  unsigned short *__c) {
8844   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8845 }
8846
8847 static void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
8848   __builtin_altivec_stvewx(__a, __b, __c);
8849 }
8850
8851 static void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
8852                                  unsigned int *__c) {
8853   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8854 }
8855
8856 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, int *__c) {
8857   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8858 }
8859
8860 static void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
8861                                  unsigned int *__c) {
8862   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8863 }
8864
8865 static void __ATTRS_o_ai vec_ste(vector float __a, int __b, float *__c) {
8866   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8867 }
8868
8869 /* vec_stvebx */
8870
8871 static void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
8872                                     signed char *__c) {
8873   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8874 }
8875
8876 static void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, int __b,
8877                                     unsigned char *__c) {
8878   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8879 }
8880
8881 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8882                                     signed char *__c) {
8883   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8884 }
8885
8886 static void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
8887                                     unsigned char *__c) {
8888   __builtin_altivec_stvebx((vector char)__a, __b, __c);
8889 }
8890
8891 /* vec_stvehx */
8892
8893 static void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, short *__c) {
8894   __builtin_altivec_stvehx(__a, __b, __c);
8895 }
8896
8897 static void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, int __b,
8898                                     unsigned short *__c) {
8899   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8900 }
8901
8902 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8903                                     short *__c) {
8904   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8905 }
8906
8907 static void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
8908                                     unsigned short *__c) {
8909   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8910 }
8911
8912 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, short *__c) {
8913   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8914 }
8915
8916 static void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
8917                                     unsigned short *__c) {
8918   __builtin_altivec_stvehx((vector short)__a, __b, __c);
8919 }
8920
8921 /* vec_stvewx */
8922
8923 static void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, int *__c) {
8924   __builtin_altivec_stvewx(__a, __b, __c);
8925 }
8926
8927 static void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
8928                                     unsigned int *__c) {
8929   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8930 }
8931
8932 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, int *__c) {
8933   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8934 }
8935
8936 static void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
8937                                     unsigned int *__c) {
8938   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8939 }
8940
8941 static void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, float *__c) {
8942   __builtin_altivec_stvewx((vector int)__a, __b, __c);
8943 }
8944
8945 /* vec_stl */
8946
8947 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8948                                  vector signed char *__c) {
8949   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8950 }
8951
8952 static void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
8953                                  signed char *__c) {
8954   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8955 }
8956
8957 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8958                                  vector unsigned char *__c) {
8959   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8960 }
8961
8962 static void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
8963                                  unsigned char *__c) {
8964   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8965 }
8966
8967 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8968                                  signed char *__c) {
8969   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8970 }
8971
8972 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8973                                  unsigned char *__c) {
8974   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8975 }
8976
8977 static void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
8978                                  vector bool char *__c) {
8979   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8980 }
8981
8982 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, vector short *__c) {
8983   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8984 }
8985
8986 static void __ATTRS_o_ai vec_stl(vector short __a, int __b, short *__c) {
8987   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8988 }
8989
8990 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
8991                                  vector unsigned short *__c) {
8992   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8993 }
8994
8995 static void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
8996                                  unsigned short *__c) {
8997   __builtin_altivec_stvxl((vector int)__a, __b, __c);
8998 }
8999
9000 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, short *__c) {
9001   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9002 }
9003
9004 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9005                                  unsigned short *__c) {
9006   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9007 }
9008
9009 static void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
9010                                  vector bool short *__c) {
9011   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9012 }
9013
9014 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, short *__c) {
9015   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9016 }
9017
9018 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
9019                                  unsigned short *__c) {
9020   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9021 }
9022
9023 static void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, vector pixel *__c) {
9024   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9025 }
9026
9027 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, vector int *__c) {
9028   __builtin_altivec_stvxl(__a, __b, __c);
9029 }
9030
9031 static void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
9032   __builtin_altivec_stvxl(__a, __b, __c);
9033 }
9034
9035 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9036                                  vector unsigned int *__c) {
9037   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9038 }
9039
9040 static void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
9041                                  unsigned int *__c) {
9042   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9043 }
9044
9045 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, int *__c) {
9046   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9047 }
9048
9049 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9050                                  unsigned int *__c) {
9051   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9052 }
9053
9054 static void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
9055                                  vector bool int *__c) {
9056   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9057 }
9058
9059 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, vector float *__c) {
9060   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9061 }
9062
9063 static void __ATTRS_o_ai vec_stl(vector float __a, int __b, float *__c) {
9064   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9065 }
9066
9067 /* vec_stvxl */
9068
9069 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9070                                    vector signed char *__c) {
9071   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9072 }
9073
9074 static void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
9075                                    signed char *__c) {
9076   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9077 }
9078
9079 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9080                                    vector unsigned char *__c) {
9081   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9082 }
9083
9084 static void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
9085                                    unsigned char *__c) {
9086   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9087 }
9088
9089 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9090                                    signed char *__c) {
9091   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9092 }
9093
9094 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9095                                    unsigned char *__c) {
9096   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9097 }
9098
9099 static void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
9100                                    vector bool char *__c) {
9101   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9102 }
9103
9104 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
9105                                    vector short *__c) {
9106   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9107 }
9108
9109 static void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, short *__c) {
9110   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9111 }
9112
9113 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9114                                    vector unsigned short *__c) {
9115   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9116 }
9117
9118 static void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, int __b,
9119                                    unsigned short *__c) {
9120   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9121 }
9122
9123 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, short *__c) {
9124   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9125 }
9126
9127 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9128                                    unsigned short *__c) {
9129   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9130 }
9131
9132 static void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
9133                                    vector bool short *__c) {
9134   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9135 }
9136
9137 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, short *__c) {
9138   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9139 }
9140
9141 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9142                                    unsigned short *__c) {
9143   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9144 }
9145
9146 static void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
9147                                    vector pixel *__c) {
9148   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9149 }
9150
9151 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, vector int *__c) {
9152   __builtin_altivec_stvxl(__a, __b, __c);
9153 }
9154
9155 static void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, int *__c) {
9156   __builtin_altivec_stvxl(__a, __b, __c);
9157 }
9158
9159 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9160                                    vector unsigned int *__c) {
9161   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9162 }
9163
9164 static void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
9165                                    unsigned int *__c) {
9166   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9167 }
9168
9169 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, int *__c) {
9170   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9171 }
9172
9173 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9174                                    unsigned int *__c) {
9175   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9176 }
9177
9178 static void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
9179                                    vector bool int *__c) {
9180   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9181 }
9182
9183 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
9184                                    vector float *__c) {
9185   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9186 }
9187
9188 static void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, float *__c) {
9189   __builtin_altivec_stvxl((vector int)__a, __b, __c);
9190 }
9191
9192 /* vec_sub */
9193
9194 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9195                                                vector signed char __b) {
9196   return __a - __b;
9197 }
9198
9199 static vector signed char __ATTRS_o_ai vec_sub(vector bool char __a,
9200                                                vector signed char __b) {
9201   return (vector signed char)__a - __b;
9202 }
9203
9204 static vector signed char __ATTRS_o_ai vec_sub(vector signed char __a,
9205                                                vector bool char __b) {
9206   return __a - (vector signed char)__b;
9207 }
9208
9209 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9210                                                  vector unsigned char __b) {
9211   return __a - __b;
9212 }
9213
9214 static vector unsigned char __ATTRS_o_ai vec_sub(vector bool char __a,
9215                                                  vector unsigned char __b) {
9216   return (vector unsigned char)__a - __b;
9217 }
9218
9219 static vector unsigned char __ATTRS_o_ai vec_sub(vector unsigned char __a,
9220                                                  vector bool char __b) {
9221   return __a - (vector unsigned char)__b;
9222 }
9223
9224 static vector short __ATTRS_o_ai vec_sub(vector short __a, vector short __b) {
9225   return __a - __b;
9226 }
9227
9228 static vector short __ATTRS_o_ai vec_sub(vector bool short __a,
9229                                          vector short __b) {
9230   return (vector short)__a - __b;
9231 }
9232
9233 static vector short __ATTRS_o_ai vec_sub(vector short __a,
9234                                          vector bool short __b) {
9235   return __a - (vector short)__b;
9236 }
9237
9238 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9239                                                   vector unsigned short __b) {
9240   return __a - __b;
9241 }
9242
9243 static vector unsigned short __ATTRS_o_ai vec_sub(vector bool short __a,
9244                                                   vector unsigned short __b) {
9245   return (vector unsigned short)__a - __b;
9246 }
9247
9248 static vector unsigned short __ATTRS_o_ai vec_sub(vector unsigned short __a,
9249                                                   vector bool short __b) {
9250   return __a - (vector unsigned short)__b;
9251 }
9252
9253 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector int __b) {
9254   return __a - __b;
9255 }
9256
9257 static vector int __ATTRS_o_ai vec_sub(vector bool int __a, vector int __b) {
9258   return (vector int)__a - __b;
9259 }
9260
9261 static vector int __ATTRS_o_ai vec_sub(vector int __a, vector bool int __b) {
9262   return __a - (vector int)__b;
9263 }
9264
9265 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9266                                                 vector unsigned int __b) {
9267   return __a - __b;
9268 }
9269
9270 static vector unsigned int __ATTRS_o_ai vec_sub(vector bool int __a,
9271                                                 vector unsigned int __b) {
9272   return (vector unsigned int)__a - __b;
9273 }
9274
9275 static vector unsigned int __ATTRS_o_ai vec_sub(vector unsigned int __a,
9276                                                 vector bool int __b) {
9277   return __a - (vector unsigned int)__b;
9278 }
9279
9280 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9281 static vector signed __int128 __ATTRS_o_ai vec_sub(vector signed __int128 __a,
9282                                                    vector signed __int128 __b) {
9283   return __a - __b;
9284 }
9285
9286 static vector unsigned __int128 __ATTRS_o_ai
9287 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9288   return __a - __b;
9289 }
9290 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9291
9292 #ifdef __VSX__
9293 static vector signed long long __ATTRS_o_ai
9294 vec_sub(vector signed long long __a, vector signed long long __b) {
9295   return __a - __b;
9296 }
9297
9298 static vector unsigned long long __ATTRS_o_ai
9299 vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
9300   return __a - __b;
9301 }
9302
9303 static vector double __ATTRS_o_ai
9304 vec_sub(vector double __a, vector double __b) {
9305   return __a - __b;
9306 }
9307 #endif
9308
9309 static vector float __ATTRS_o_ai vec_sub(vector float __a, vector float __b) {
9310   return __a - __b;
9311 }
9312
9313 /* vec_vsububm */
9314
9315 #define __builtin_altivec_vsububm vec_vsububm
9316
9317 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9318                                                    vector signed char __b) {
9319   return __a - __b;
9320 }
9321
9322 static vector signed char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9323                                                    vector signed char __b) {
9324   return (vector signed char)__a - __b;
9325 }
9326
9327 static vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a,
9328                                                    vector bool char __b) {
9329   return __a - (vector signed char)__b;
9330 }
9331
9332 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9333                                                      vector unsigned char __b) {
9334   return __a - __b;
9335 }
9336
9337 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector bool char __a,
9338                                                      vector unsigned char __b) {
9339   return (vector unsigned char)__a - __b;
9340 }
9341
9342 static vector unsigned char __ATTRS_o_ai vec_vsububm(vector unsigned char __a,
9343                                                      vector bool char __b) {
9344   return __a - (vector unsigned char)__b;
9345 }
9346
9347 /* vec_vsubuhm */
9348
9349 #define __builtin_altivec_vsubuhm vec_vsubuhm
9350
9351 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9352                                              vector short __b) {
9353   return __a - __b;
9354 }
9355
9356 static vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
9357                                              vector short __b) {
9358   return (vector short)__a - __b;
9359 }
9360
9361 static vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
9362                                              vector bool short __b) {
9363   return __a - (vector short)__b;
9364 }
9365
9366 static vector unsigned short __ATTRS_o_ai
9367 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
9368   return __a - __b;
9369 }
9370
9371 static vector unsigned short __ATTRS_o_ai
9372 vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
9373   return (vector unsigned short)__a - __b;
9374 }
9375
9376 static vector unsigned short __ATTRS_o_ai vec_vsubuhm(vector unsigned short __a,
9377                                                       vector bool short __b) {
9378   return __a - (vector unsigned short)__b;
9379 }
9380
9381 /* vec_vsubuwm */
9382
9383 #define __builtin_altivec_vsubuwm vec_vsubuwm
9384
9385 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b) {
9386   return __a - __b;
9387 }
9388
9389 static vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9390                                            vector int __b) {
9391   return (vector int)__a - __b;
9392 }
9393
9394 static vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
9395                                            vector bool int __b) {
9396   return __a - (vector int)__b;
9397 }
9398
9399 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9400                                                     vector unsigned int __b) {
9401   return __a - __b;
9402 }
9403
9404 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
9405                                                     vector unsigned int __b) {
9406   return (vector unsigned int)__a - __b;
9407 }
9408
9409 static vector unsigned int __ATTRS_o_ai vec_vsubuwm(vector unsigned int __a,
9410                                                     vector bool int __b) {
9411   return __a - (vector unsigned int)__b;
9412 }
9413
9414 /* vec_vsubfp */
9415
9416 #define __builtin_altivec_vsubfp vec_vsubfp
9417
9418 static vector float __attribute__((__always_inline__))
9419 vec_vsubfp(vector float __a, vector float __b) {
9420   return __a - __b;
9421 }
9422
9423 /* vec_subc */
9424
9425 static vector unsigned int __ATTRS_o_ai vec_subc(vector unsigned int __a,
9426                                                  vector unsigned int __b) {
9427   return __builtin_altivec_vsubcuw(__a, __b);
9428 }
9429
9430 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9431 static vector unsigned __int128 __ATTRS_o_ai
9432 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9433   return __builtin_altivec_vsubcuq(__a, __b);
9434 }
9435
9436 static vector signed __int128 __ATTRS_o_ai
9437 vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
9438   return __builtin_altivec_vsubcuq(__a, __b);
9439 }
9440 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9441
9442 /* vec_vsubcuw */
9443
9444 static vector unsigned int __attribute__((__always_inline__))
9445 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
9446   return __builtin_altivec_vsubcuw(__a, __b);
9447 }
9448
9449 /* vec_subs */
9450
9451 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9452                                                 vector signed char __b) {
9453   return __builtin_altivec_vsubsbs(__a, __b);
9454 }
9455
9456 static vector signed char __ATTRS_o_ai vec_subs(vector bool char __a,
9457                                                 vector signed char __b) {
9458   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9459 }
9460
9461 static vector signed char __ATTRS_o_ai vec_subs(vector signed char __a,
9462                                                 vector bool char __b) {
9463   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9464 }
9465
9466 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9467                                                   vector unsigned char __b) {
9468   return __builtin_altivec_vsububs(__a, __b);
9469 }
9470
9471 static vector unsigned char __ATTRS_o_ai vec_subs(vector bool char __a,
9472                                                   vector unsigned char __b) {
9473   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9474 }
9475
9476 static vector unsigned char __ATTRS_o_ai vec_subs(vector unsigned char __a,
9477                                                   vector bool char __b) {
9478   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9479 }
9480
9481 static vector short __ATTRS_o_ai vec_subs(vector short __a, vector short __b) {
9482   return __builtin_altivec_vsubshs(__a, __b);
9483 }
9484
9485 static vector short __ATTRS_o_ai vec_subs(vector bool short __a,
9486                                           vector short __b) {
9487   return __builtin_altivec_vsubshs((vector short)__a, __b);
9488 }
9489
9490 static vector short __ATTRS_o_ai vec_subs(vector short __a,
9491                                           vector bool short __b) {
9492   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9493 }
9494
9495 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9496                                                    vector unsigned short __b) {
9497   return __builtin_altivec_vsubuhs(__a, __b);
9498 }
9499
9500 static vector unsigned short __ATTRS_o_ai vec_subs(vector bool short __a,
9501                                                    vector unsigned short __b) {
9502   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9503 }
9504
9505 static vector unsigned short __ATTRS_o_ai vec_subs(vector unsigned short __a,
9506                                                    vector bool short __b) {
9507   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9508 }
9509
9510 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector int __b) {
9511   return __builtin_altivec_vsubsws(__a, __b);
9512 }
9513
9514 static vector int __ATTRS_o_ai vec_subs(vector bool int __a, vector int __b) {
9515   return __builtin_altivec_vsubsws((vector int)__a, __b);
9516 }
9517
9518 static vector int __ATTRS_o_ai vec_subs(vector int __a, vector bool int __b) {
9519   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9520 }
9521
9522 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9523                                                  vector unsigned int __b) {
9524   return __builtin_altivec_vsubuws(__a, __b);
9525 }
9526
9527 static vector unsigned int __ATTRS_o_ai vec_subs(vector bool int __a,
9528                                                  vector unsigned int __b) {
9529   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9530 }
9531
9532 static vector unsigned int __ATTRS_o_ai vec_subs(vector unsigned int __a,
9533                                                  vector bool int __b) {
9534   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9535 }
9536
9537 /* vec_vsubsbs */
9538
9539 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9540                                                    vector signed char __b) {
9541   return __builtin_altivec_vsubsbs(__a, __b);
9542 }
9543
9544 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector bool char __a,
9545                                                    vector signed char __b) {
9546   return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
9547 }
9548
9549 static vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a,
9550                                                    vector bool char __b) {
9551   return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
9552 }
9553
9554 /* vec_vsububs */
9555
9556 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9557                                                      vector unsigned char __b) {
9558   return __builtin_altivec_vsububs(__a, __b);
9559 }
9560
9561 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector bool char __a,
9562                                                      vector unsigned char __b) {
9563   return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
9564 }
9565
9566 static vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a,
9567                                                      vector bool char __b) {
9568   return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
9569 }
9570
9571 /* vec_vsubshs */
9572
9573 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9574                                              vector short __b) {
9575   return __builtin_altivec_vsubshs(__a, __b);
9576 }
9577
9578 static vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
9579                                              vector short __b) {
9580   return __builtin_altivec_vsubshs((vector short)__a, __b);
9581 }
9582
9583 static vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
9584                                              vector bool short __b) {
9585   return __builtin_altivec_vsubshs(__a, (vector short)__b);
9586 }
9587
9588 /* vec_vsubuhs */
9589
9590 static vector unsigned short __ATTRS_o_ai
9591 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
9592   return __builtin_altivec_vsubuhs(__a, __b);
9593 }
9594
9595 static vector unsigned short __ATTRS_o_ai
9596 vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
9597   return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
9598 }
9599
9600 static vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a,
9601                                                       vector bool short __b) {
9602   return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
9603 }
9604
9605 /* vec_vsubsws */
9606
9607 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b) {
9608   return __builtin_altivec_vsubsws(__a, __b);
9609 }
9610
9611 static vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
9612                                            vector int __b) {
9613   return __builtin_altivec_vsubsws((vector int)__a, __b);
9614 }
9615
9616 static vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
9617                                            vector bool int __b) {
9618   return __builtin_altivec_vsubsws(__a, (vector int)__b);
9619 }
9620
9621 /* vec_vsubuws */
9622
9623 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9624                                                     vector unsigned int __b) {
9625   return __builtin_altivec_vsubuws(__a, __b);
9626 }
9627
9628 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector bool int __a,
9629                                                     vector unsigned int __b) {
9630   return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
9631 }
9632
9633 static vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a,
9634                                                     vector bool int __b) {
9635   return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
9636 }
9637
9638 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9639 /* vec_vsubuqm */
9640
9641 static vector signed __int128 __ATTRS_o_ai
9642 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
9643   return __a - __b;
9644 }
9645
9646 static vector unsigned __int128 __ATTRS_o_ai
9647 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9648   return __a - __b;
9649 }
9650
9651 /* vec_vsubeuqm */
9652
9653 static vector signed __int128 __ATTRS_o_ai
9654 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
9655              vector signed __int128 __c) {
9656   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9657 }
9658
9659 static vector unsigned __int128 __ATTRS_o_ai
9660 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
9661              vector unsigned __int128 __c) {
9662   return __builtin_altivec_vsubeuqm(__a, __b, __c);
9663 }
9664
9665 /* vec_vsubcuq */
9666
9667 static vector signed __int128 __ATTRS_o_ai
9668 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
9669   return __builtin_altivec_vsubcuq(__a, __b);
9670 }
9671
9672 static vector unsigned __int128 __ATTRS_o_ai
9673 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
9674   return __builtin_altivec_vsubcuq(__a, __b);
9675 }
9676
9677 /* vec_vsubecuq */
9678
9679 static vector signed __int128 __ATTRS_o_ai
9680 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
9681              vector signed __int128 __c) {
9682   return __builtin_altivec_vsubecuq(__a, __b, __c);
9683 }
9684
9685 static vector unsigned __int128 __ATTRS_o_ai
9686 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
9687              vector unsigned __int128 __c) {
9688   return __builtin_altivec_vsubecuq(__a, __b, __c);
9689 }
9690 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
9691
9692 /* vec_sum4s */
9693
9694 static vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
9695                                          vector int __b) {
9696   return __builtin_altivec_vsum4sbs(__a, __b);
9697 }
9698
9699 static vector unsigned int __ATTRS_o_ai vec_sum4s(vector unsigned char __a,
9700                                                   vector unsigned int __b) {
9701   return __builtin_altivec_vsum4ubs(__a, __b);
9702 }
9703
9704 static vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
9705                                          vector int __b) {
9706   return __builtin_altivec_vsum4shs(__a, __b);
9707 }
9708
9709 /* vec_vsum4sbs */
9710
9711 static vector int __attribute__((__always_inline__))
9712 vec_vsum4sbs(vector signed char __a, vector int __b) {
9713   return __builtin_altivec_vsum4sbs(__a, __b);
9714 }
9715
9716 /* vec_vsum4ubs */
9717
9718 static vector unsigned int __attribute__((__always_inline__))
9719 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
9720   return __builtin_altivec_vsum4ubs(__a, __b);
9721 }
9722
9723 /* vec_vsum4shs */
9724
9725 static vector int __attribute__((__always_inline__))
9726 vec_vsum4shs(vector signed short __a, vector int __b) {
9727   return __builtin_altivec_vsum4shs(__a, __b);
9728 }
9729
9730 /* vec_sum2s */
9731
9732 /* The vsum2sws instruction has a big-endian bias, so that the second
9733    input vector and the result always reference big-endian elements
9734    1 and 3 (little-endian element 0 and 2).  For ease of porting the
9735    programmer wants elements 1 and 3 in both cases, so for little
9736    endian we must perform some permutes.  */
9737
9738 static vector signed int __attribute__((__always_inline__))
9739 vec_sum2s(vector int __a, vector int __b) {
9740 #ifdef __LITTLE_ENDIAN__
9741   vector int __c = (vector signed int)vec_perm(
9742       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9743                                        8, 9, 10, 11));
9744   __c = __builtin_altivec_vsum2sws(__a, __c);
9745   return (vector signed int)vec_perm(
9746       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9747                                        8, 9, 10, 11));
9748 #else
9749   return __builtin_altivec_vsum2sws(__a, __b);
9750 #endif
9751 }
9752
9753 /* vec_vsum2sws */
9754
9755 static vector signed int __attribute__((__always_inline__))
9756 vec_vsum2sws(vector int __a, vector int __b) {
9757 #ifdef __LITTLE_ENDIAN__
9758   vector int __c = (vector signed int)vec_perm(
9759       __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9760                                        8, 9, 10, 11));
9761   __c = __builtin_altivec_vsum2sws(__a, __c);
9762   return (vector signed int)vec_perm(
9763       __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
9764                                        8, 9, 10, 11));
9765 #else
9766   return __builtin_altivec_vsum2sws(__a, __b);
9767 #endif
9768 }
9769
9770 /* vec_sums */
9771
9772 /* The vsumsws instruction has a big-endian bias, so that the second
9773    input vector and the result always reference big-endian element 3
9774    (little-endian element 0).  For ease of porting the programmer
9775    wants element 3 in both cases, so for little endian we must perform
9776    some permutes.  */
9777
9778 static vector signed int __attribute__((__always_inline__))
9779 vec_sums(vector signed int __a, vector signed int __b) {
9780 #ifdef __LITTLE_ENDIAN__
9781   __b = (vector signed int)vec_splat(__b, 3);
9782   __b = __builtin_altivec_vsumsws(__a, __b);
9783   return (vector signed int)(0, 0, 0, __b[0]);
9784 #else
9785   return __builtin_altivec_vsumsws(__a, __b);
9786 #endif
9787 }
9788
9789 /* vec_vsumsws */
9790
9791 static vector signed int __attribute__((__always_inline__))
9792 vec_vsumsws(vector signed int __a, vector signed int __b) {
9793 #ifdef __LITTLE_ENDIAN__
9794   __b = (vector signed int)vec_splat(__b, 3);
9795   __b = __builtin_altivec_vsumsws(__a, __b);
9796   return (vector signed int)(0, 0, 0, __b[0]);
9797 #else
9798   return __builtin_altivec_vsumsws(__a, __b);
9799 #endif
9800 }
9801
9802 /* vec_trunc */
9803
9804 static vector float __ATTRS_o_ai
9805 vec_trunc(vector float __a) {
9806 #ifdef __VSX__
9807   return __builtin_vsx_xvrspiz(__a);
9808 #else
9809   return __builtin_altivec_vrfiz(__a);
9810 #endif
9811 }
9812
9813 #ifdef __VSX__
9814 static vector double __ATTRS_o_ai vec_trunc(vector double __a) {
9815   return __builtin_vsx_xvrdpiz(__a);
9816 }
9817 #endif
9818
9819 /* vec_vrfiz */
9820
9821 static vector float __attribute__((__always_inline__))
9822 vec_vrfiz(vector float __a) {
9823   return __builtin_altivec_vrfiz(__a);
9824 }
9825
9826 /* vec_unpackh */
9827
9828 /* The vector unpack instructions all have a big-endian bias, so for
9829    little endian we must reverse the meanings of "high" and "low."  */
9830
9831 static vector short __ATTRS_o_ai vec_unpackh(vector signed char __a) {
9832 #ifdef __LITTLE_ENDIAN__
9833   return __builtin_altivec_vupklsb((vector char)__a);
9834 #else
9835   return __builtin_altivec_vupkhsb((vector char)__a);
9836 #endif
9837 }
9838
9839 static vector bool short __ATTRS_o_ai vec_unpackh(vector bool char __a) {
9840 #ifdef __LITTLE_ENDIAN__
9841   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9842 #else
9843   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9844 #endif
9845 }
9846
9847 static vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
9848 #ifdef __LITTLE_ENDIAN__
9849   return __builtin_altivec_vupklsh(__a);
9850 #else
9851   return __builtin_altivec_vupkhsh(__a);
9852 #endif
9853 }
9854
9855 static vector bool int __ATTRS_o_ai vec_unpackh(vector bool short __a) {
9856 #ifdef __LITTLE_ENDIAN__
9857   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9858 #else
9859   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9860 #endif
9861 }
9862
9863 static vector unsigned int __ATTRS_o_ai vec_unpackh(vector pixel __a) {
9864 #ifdef __LITTLE_ENDIAN__
9865   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9866 #else
9867   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9868 #endif
9869 }
9870
9871 #ifdef __POWER8_VECTOR__
9872 static vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
9873 #ifdef __LITTLE_ENDIAN__
9874   return __builtin_altivec_vupklsw(__a);
9875 #else
9876   return __builtin_altivec_vupkhsw(__a);
9877 #endif
9878 }
9879
9880 static vector bool long long __ATTRS_o_ai vec_unpackh(vector bool int __a) {
9881 #ifdef __LITTLE_ENDIAN__
9882   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9883 #else
9884   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9885 #endif
9886 }
9887 #endif
9888
9889 /* vec_vupkhsb */
9890
9891 static vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a) {
9892 #ifdef __LITTLE_ENDIAN__
9893   return __builtin_altivec_vupklsb((vector char)__a);
9894 #else
9895   return __builtin_altivec_vupkhsb((vector char)__a);
9896 #endif
9897 }
9898
9899 static vector bool short __ATTRS_o_ai vec_vupkhsb(vector bool char __a) {
9900 #ifdef __LITTLE_ENDIAN__
9901   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9902 #else
9903   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9904 #endif
9905 }
9906
9907 /* vec_vupkhsh */
9908
9909 static vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
9910 #ifdef __LITTLE_ENDIAN__
9911   return __builtin_altivec_vupklsh(__a);
9912 #else
9913   return __builtin_altivec_vupkhsh(__a);
9914 #endif
9915 }
9916
9917 static vector bool int __ATTRS_o_ai vec_vupkhsh(vector bool short __a) {
9918 #ifdef __LITTLE_ENDIAN__
9919   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9920 #else
9921   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9922 #endif
9923 }
9924
9925 static vector unsigned int __ATTRS_o_ai vec_vupkhsh(vector pixel __a) {
9926 #ifdef __LITTLE_ENDIAN__
9927   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9928 #else
9929   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9930 #endif
9931 }
9932
9933 /* vec_vupkhsw */
9934
9935 #ifdef __POWER8_VECTOR__
9936 static vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
9937 #ifdef __LITTLE_ENDIAN__
9938   return __builtin_altivec_vupklsw(__a);
9939 #else
9940   return __builtin_altivec_vupkhsw(__a);
9941 #endif
9942 }
9943
9944 static vector bool long long __ATTRS_o_ai vec_vupkhsw(vector bool int __a) {
9945 #ifdef __LITTLE_ENDIAN__
9946   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
9947 #else
9948   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
9949 #endif
9950 }
9951 #endif
9952
9953 /* vec_unpackl */
9954
9955 static vector short __ATTRS_o_ai vec_unpackl(vector signed char __a) {
9956 #ifdef __LITTLE_ENDIAN__
9957   return __builtin_altivec_vupkhsb((vector char)__a);
9958 #else
9959   return __builtin_altivec_vupklsb((vector char)__a);
9960 #endif
9961 }
9962
9963 static vector bool short __ATTRS_o_ai vec_unpackl(vector bool char __a) {
9964 #ifdef __LITTLE_ENDIAN__
9965   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9966 #else
9967   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
9968 #endif
9969 }
9970
9971 static vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
9972 #ifdef __LITTLE_ENDIAN__
9973   return __builtin_altivec_vupkhsh(__a);
9974 #else
9975   return __builtin_altivec_vupklsh(__a);
9976 #endif
9977 }
9978
9979 static vector bool int __ATTRS_o_ai vec_unpackl(vector bool short __a) {
9980 #ifdef __LITTLE_ENDIAN__
9981   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9982 #else
9983   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
9984 #endif
9985 }
9986
9987 static vector unsigned int __ATTRS_o_ai vec_unpackl(vector pixel __a) {
9988 #ifdef __LITTLE_ENDIAN__
9989   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9990 #else
9991   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9992 #endif
9993 }
9994
9995 #ifdef __POWER8_VECTOR__
9996 static vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
9997 #ifdef __LITTLE_ENDIAN__
9998   return __builtin_altivec_vupkhsw(__a);
9999 #else
10000   return __builtin_altivec_vupklsw(__a);
10001 #endif
10002 }
10003
10004 static vector bool long long __ATTRS_o_ai vec_unpackl(vector bool int __a) {
10005 #ifdef __LITTLE_ENDIAN__
10006   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10007 #else
10008   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10009 #endif
10010 }
10011 #endif
10012
10013 /* vec_vupklsb */
10014
10015 static vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a) {
10016 #ifdef __LITTLE_ENDIAN__
10017   return __builtin_altivec_vupkhsb((vector char)__a);
10018 #else
10019   return __builtin_altivec_vupklsb((vector char)__a);
10020 #endif
10021 }
10022
10023 static vector bool short __ATTRS_o_ai vec_vupklsb(vector bool char __a) {
10024 #ifdef __LITTLE_ENDIAN__
10025   return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
10026 #else
10027   return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
10028 #endif
10029 }
10030
10031 /* vec_vupklsh */
10032
10033 static vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
10034 #ifdef __LITTLE_ENDIAN__
10035   return __builtin_altivec_vupkhsh(__a);
10036 #else
10037   return __builtin_altivec_vupklsh(__a);
10038 #endif
10039 }
10040
10041 static vector bool int __ATTRS_o_ai vec_vupklsh(vector bool short __a) {
10042 #ifdef __LITTLE_ENDIAN__
10043   return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
10044 #else
10045   return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
10046 #endif
10047 }
10048
10049 static vector unsigned int __ATTRS_o_ai vec_vupklsh(vector pixel __a) {
10050 #ifdef __LITTLE_ENDIAN__
10051   return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
10052 #else
10053   return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
10054 #endif
10055 }
10056
10057 /* vec_vupklsw */
10058
10059 #ifdef __POWER8_VECTOR__
10060 static vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
10061 #ifdef __LITTLE_ENDIAN__
10062   return __builtin_altivec_vupkhsw(__a);
10063 #else
10064   return __builtin_altivec_vupklsw(__a);
10065 #endif
10066 }
10067
10068 static vector bool long long __ATTRS_o_ai vec_vupklsw(vector bool int __a) {
10069 #ifdef __LITTLE_ENDIAN__
10070   return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
10071 #else
10072   return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
10073 #endif
10074 }
10075 #endif
10076
10077 /* vec_vsx_ld */
10078
10079 #ifdef __VSX__
10080
10081 static vector signed int __ATTRS_o_ai vec_vsx_ld(int __a,
10082                                                  const vector signed int *__b) {
10083   return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
10084 }
10085
10086 static vector unsigned int __ATTRS_o_ai
10087 vec_vsx_ld(int __a, const vector unsigned int *__b) {
10088   return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
10089 }
10090
10091 static vector float __ATTRS_o_ai vec_vsx_ld(int __a, const vector float *__b) {
10092   return (vector float)__builtin_vsx_lxvw4x(__a, __b);
10093 }
10094
10095 static vector signed long long __ATTRS_o_ai
10096 vec_vsx_ld(int __a, const vector signed long long *__b) {
10097   return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
10098 }
10099
10100 static vector unsigned long long __ATTRS_o_ai
10101 vec_vsx_ld(int __a, const vector unsigned long long *__b) {
10102   return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
10103 }
10104
10105 static vector double __ATTRS_o_ai vec_vsx_ld(int __a,
10106                                              const vector double *__b) {
10107   return (vector double)__builtin_vsx_lxvd2x(__a, __b);
10108 }
10109
10110 #endif
10111
10112 /* vec_vsx_st */
10113
10114 #ifdef __VSX__
10115
10116 static void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
10117                                     vector signed int *__c) {
10118   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10119 }
10120
10121 static void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
10122                                     vector unsigned int *__c) {
10123   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10124 }
10125
10126 static void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
10127                                     vector float *__c) {
10128   __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
10129 }
10130
10131 static void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, int __b,
10132                                     vector signed long long *__c) {
10133   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10134 }
10135
10136 static void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, int __b,
10137                                     vector unsigned long long *__c) {
10138   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10139 }
10140
10141 static void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
10142                                     vector double *__c) {
10143   __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
10144 }
10145
10146 #endif
10147
10148 /* vec_xor */
10149
10150 #define __builtin_altivec_vxor vec_xor
10151
10152 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10153                                                vector signed char __b) {
10154   return __a ^ __b;
10155 }
10156
10157 static vector signed char __ATTRS_o_ai vec_xor(vector bool char __a,
10158                                                vector signed char __b) {
10159   return (vector signed char)__a ^ __b;
10160 }
10161
10162 static vector signed char __ATTRS_o_ai vec_xor(vector signed char __a,
10163                                                vector bool char __b) {
10164   return __a ^ (vector signed char)__b;
10165 }
10166
10167 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10168                                                  vector unsigned char __b) {
10169   return __a ^ __b;
10170 }
10171
10172 static vector unsigned char __ATTRS_o_ai vec_xor(vector bool char __a,
10173                                                  vector unsigned char __b) {
10174   return (vector unsigned char)__a ^ __b;
10175 }
10176
10177 static vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a,
10178                                                  vector bool char __b) {
10179   return __a ^ (vector unsigned char)__b;
10180 }
10181
10182 static vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
10183                                              vector bool char __b) {
10184   return __a ^ __b;
10185 }
10186
10187 static vector short __ATTRS_o_ai vec_xor(vector short __a, vector short __b) {
10188   return __a ^ __b;
10189 }
10190
10191 static vector short __ATTRS_o_ai vec_xor(vector bool short __a,
10192                                          vector short __b) {
10193   return (vector short)__a ^ __b;
10194 }
10195
10196 static vector short __ATTRS_o_ai vec_xor(vector short __a,
10197                                          vector bool short __b) {
10198   return __a ^ (vector short)__b;
10199 }
10200
10201 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10202                                                   vector unsigned short __b) {
10203   return __a ^ __b;
10204 }
10205
10206 static vector unsigned short __ATTRS_o_ai vec_xor(vector bool short __a,
10207                                                   vector unsigned short __b) {
10208   return (vector unsigned short)__a ^ __b;
10209 }
10210
10211 static vector unsigned short __ATTRS_o_ai vec_xor(vector unsigned short __a,
10212                                                   vector bool short __b) {
10213   return __a ^ (vector unsigned short)__b;
10214 }
10215
10216 static vector bool short __ATTRS_o_ai vec_xor(vector bool short __a,
10217                                               vector bool short __b) {
10218   return __a ^ __b;
10219 }
10220
10221 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector int __b) {
10222   return __a ^ __b;
10223 }
10224
10225 static vector int __ATTRS_o_ai vec_xor(vector bool int __a, vector int __b) {
10226   return (vector int)__a ^ __b;
10227 }
10228
10229 static vector int __ATTRS_o_ai vec_xor(vector int __a, vector bool int __b) {
10230   return __a ^ (vector int)__b;
10231 }
10232
10233 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10234                                                 vector unsigned int __b) {
10235   return __a ^ __b;
10236 }
10237
10238 static vector unsigned int __ATTRS_o_ai vec_xor(vector bool int __a,
10239                                                 vector unsigned int __b) {
10240   return (vector unsigned int)__a ^ __b;
10241 }
10242
10243 static vector unsigned int __ATTRS_o_ai vec_xor(vector unsigned int __a,
10244                                                 vector bool int __b) {
10245   return __a ^ (vector unsigned int)__b;
10246 }
10247
10248 static vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
10249                                             vector bool int __b) {
10250   return __a ^ __b;
10251 }
10252
10253 static vector float __ATTRS_o_ai vec_xor(vector float __a, vector float __b) {
10254   vector unsigned int __res =
10255       (vector unsigned int)__a ^ (vector unsigned int)__b;
10256   return (vector float)__res;
10257 }
10258
10259 static vector float __ATTRS_o_ai vec_xor(vector bool int __a,
10260                                          vector float __b) {
10261   vector unsigned int __res =
10262       (vector unsigned int)__a ^ (vector unsigned int)__b;
10263   return (vector float)__res;
10264 }
10265
10266 static vector float __ATTRS_o_ai vec_xor(vector float __a,
10267                                          vector bool int __b) {
10268   vector unsigned int __res =
10269       (vector unsigned int)__a ^ (vector unsigned int)__b;
10270   return (vector float)__res;
10271 }
10272
10273 #ifdef __VSX__
10274 static vector signed long long __ATTRS_o_ai
10275 vec_xor(vector signed long long __a, vector signed long long __b) {
10276   return __a ^ __b;
10277 }
10278
10279 static vector signed long long __ATTRS_o_ai
10280 vec_xor(vector bool long long __a, vector signed long long __b) {
10281   return (vector signed long long)__a ^ __b;
10282 }
10283
10284 static vector signed long long __ATTRS_o_ai vec_xor(vector signed long long __a,
10285                                                     vector bool long long __b) {
10286   return __a ^ (vector signed long long)__b;
10287 }
10288
10289 static vector unsigned long long __ATTRS_o_ai
10290 vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
10291   return __a ^ __b;
10292 }
10293
10294 static vector unsigned long long __ATTRS_o_ai
10295 vec_xor(vector bool long long __a, vector unsigned long long __b) {
10296   return (vector unsigned long long)__a ^ __b;
10297 }
10298
10299 static vector unsigned long long __ATTRS_o_ai
10300 vec_xor(vector unsigned long long __a, vector bool long long __b) {
10301   return __a ^ (vector unsigned long long)__b;
10302 }
10303
10304 static vector bool long long __ATTRS_o_ai vec_xor(vector bool long long __a,
10305                                                   vector bool long long __b) {
10306   return __a ^ __b;
10307 }
10308
10309 static vector double __ATTRS_o_ai
10310 vec_xor(vector double __a, vector double __b) {
10311   return (vector double)((vector unsigned long long)__a ^
10312                           (vector unsigned long long)__b);
10313 }
10314
10315 static vector double __ATTRS_o_ai
10316 vec_xor(vector double __a, vector bool long long __b) {
10317   return (vector double)((vector unsigned long long)__a ^
10318                          (vector unsigned long long) __b);
10319 }
10320
10321 static vector double __ATTRS_o_ai
10322 vec_xor(vector bool long long __a, vector double __b) {
10323   return (vector double)((vector unsigned long long)__a ^
10324                          (vector unsigned long long)__b);
10325 }
10326 #endif
10327
10328 /* vec_vxor */
10329
10330 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10331                                                 vector signed char __b) {
10332   return __a ^ __b;
10333 }
10334
10335 static vector signed char __ATTRS_o_ai vec_vxor(vector bool char __a,
10336                                                 vector signed char __b) {
10337   return (vector signed char)__a ^ __b;
10338 }
10339
10340 static vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a,
10341                                                 vector bool char __b) {
10342   return __a ^ (vector signed char)__b;
10343 }
10344
10345 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10346                                                   vector unsigned char __b) {
10347   return __a ^ __b;
10348 }
10349
10350 static vector unsigned char __ATTRS_o_ai vec_vxor(vector bool char __a,
10351                                                   vector unsigned char __b) {
10352   return (vector unsigned char)__a ^ __b;
10353 }
10354
10355 static vector unsigned char __ATTRS_o_ai vec_vxor(vector unsigned char __a,
10356                                                   vector bool char __b) {
10357   return __a ^ (vector unsigned char)__b;
10358 }
10359
10360 static vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
10361                                               vector bool char __b) {
10362   return __a ^ __b;
10363 }
10364
10365 static vector short __ATTRS_o_ai vec_vxor(vector short __a, vector short __b) {
10366   return __a ^ __b;
10367 }
10368
10369 static vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
10370                                           vector short __b) {
10371   return (vector short)__a ^ __b;
10372 }
10373
10374 static vector short __ATTRS_o_ai vec_vxor(vector short __a,
10375                                           vector bool short __b) {
10376   return __a ^ (vector short)__b;
10377 }
10378
10379 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10380                                                    vector unsigned short __b) {
10381   return __a ^ __b;
10382 }
10383
10384 static vector unsigned short __ATTRS_o_ai vec_vxor(vector bool short __a,
10385                                                    vector unsigned short __b) {
10386   return (vector unsigned short)__a ^ __b;
10387 }
10388
10389 static vector unsigned short __ATTRS_o_ai vec_vxor(vector unsigned short __a,
10390                                                    vector bool short __b) {
10391   return __a ^ (vector unsigned short)__b;
10392 }
10393
10394 static vector bool short __ATTRS_o_ai vec_vxor(vector bool short __a,
10395                                                vector bool short __b) {
10396   return __a ^ __b;
10397 }
10398
10399 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector int __b) {
10400   return __a ^ __b;
10401 }
10402
10403 static vector int __ATTRS_o_ai vec_vxor(vector bool int __a, vector int __b) {
10404   return (vector int)__a ^ __b;
10405 }
10406
10407 static vector int __ATTRS_o_ai vec_vxor(vector int __a, vector bool int __b) {
10408   return __a ^ (vector int)__b;
10409 }
10410
10411 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10412                                                  vector unsigned int __b) {
10413   return __a ^ __b;
10414 }
10415
10416 static vector unsigned int __ATTRS_o_ai vec_vxor(vector bool int __a,
10417                                                  vector unsigned int __b) {
10418   return (vector unsigned int)__a ^ __b;
10419 }
10420
10421 static vector unsigned int __ATTRS_o_ai vec_vxor(vector unsigned int __a,
10422                                                  vector bool int __b) {
10423   return __a ^ (vector unsigned int)__b;
10424 }
10425
10426 static vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
10427                                              vector bool int __b) {
10428   return __a ^ __b;
10429 }
10430
10431 static vector float __ATTRS_o_ai vec_vxor(vector float __a, vector float __b) {
10432   vector unsigned int __res =
10433       (vector unsigned int)__a ^ (vector unsigned int)__b;
10434   return (vector float)__res;
10435 }
10436
10437 static vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
10438                                           vector float __b) {
10439   vector unsigned int __res =
10440       (vector unsigned int)__a ^ (vector unsigned int)__b;
10441   return (vector float)__res;
10442 }
10443
10444 static vector float __ATTRS_o_ai vec_vxor(vector float __a,
10445                                           vector bool int __b) {
10446   vector unsigned int __res =
10447       (vector unsigned int)__a ^ (vector unsigned int)__b;
10448   return (vector float)__res;
10449 }
10450
10451 #ifdef __VSX__
10452 static vector signed long long __ATTRS_o_ai
10453 vec_vxor(vector signed long long __a, vector signed long long __b) {
10454   return __a ^ __b;
10455 }
10456
10457 static vector signed long long __ATTRS_o_ai
10458 vec_vxor(vector bool long long __a, vector signed long long __b) {
10459   return (vector signed long long)__a ^ __b;
10460 }
10461
10462 static vector signed long long __ATTRS_o_ai
10463 vec_vxor(vector signed long long __a, vector bool long long __b) {
10464   return __a ^ (vector signed long long)__b;
10465 }
10466
10467 static vector unsigned long long __ATTRS_o_ai
10468 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
10469   return __a ^ __b;
10470 }
10471
10472 static vector unsigned long long __ATTRS_o_ai
10473 vec_vxor(vector bool long long __a, vector unsigned long long __b) {
10474   return (vector unsigned long long)__a ^ __b;
10475 }
10476
10477 static vector unsigned long long __ATTRS_o_ai
10478 vec_vxor(vector unsigned long long __a, vector bool long long __b) {
10479   return __a ^ (vector unsigned long long)__b;
10480 }
10481
10482 static vector bool long long __ATTRS_o_ai vec_vxor(vector bool long long __a,
10483                                                    vector bool long long __b) {
10484   return __a ^ __b;
10485 }
10486 #endif
10487
10488 /* ------------------------ extensions for CBEA ----------------------------- */
10489
10490 /* vec_extract */
10491
10492 static signed char __ATTRS_o_ai vec_extract(vector signed char __a, int __b) {
10493   return __a[__b];
10494 }
10495
10496 static unsigned char __ATTRS_o_ai vec_extract(vector unsigned char __a,
10497                                               int __b) {
10498   return __a[__b];
10499 }
10500
10501 static unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
10502                                               int __b) {
10503   return __a[__b];
10504 }
10505
10506 static signed short __ATTRS_o_ai vec_extract(vector signed short __a, int __b) {
10507   return __a[__b];
10508 }
10509
10510 static unsigned short __ATTRS_o_ai vec_extract(vector unsigned short __a,
10511                                                int __b) {
10512   return __a[__b];
10513 }
10514
10515 static unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
10516                                                int __b) {
10517   return __a[__b];
10518 }
10519
10520 static signed int __ATTRS_o_ai vec_extract(vector signed int __a, int __b) {
10521   return __a[__b];
10522 }
10523
10524 static unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, int __b) {
10525   return __a[__b];
10526 }
10527
10528 static unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, int __b) {
10529   return __a[__b];
10530 }
10531
10532 #ifdef __VSX__
10533 static signed long long __ATTRS_o_ai vec_extract(vector signed long long __a,
10534                                                  int __b) {
10535   return __a[__b];
10536 }
10537
10538 static unsigned long long __ATTRS_o_ai
10539 vec_extract(vector unsigned long long __a, int __b) {
10540   return __a[__b];
10541 }
10542
10543 static unsigned long long __ATTRS_o_ai vec_extract(vector bool long long __a,
10544                                                    int __b) {
10545   return __a[__b];
10546 }
10547
10548 static double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
10549   return __a[__b];
10550 }
10551 #endif
10552
10553 static float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
10554   return __a[__b];
10555 }
10556
10557 /* vec_insert */
10558
10559 static vector signed char __ATTRS_o_ai vec_insert(signed char __a,
10560                                                   vector signed char __b,
10561                                                   int __c) {
10562   __b[__c] = __a;
10563   return __b;
10564 }
10565
10566 static vector unsigned char __ATTRS_o_ai vec_insert(unsigned char __a,
10567                                                     vector unsigned char __b,
10568                                                     int __c) {
10569   __b[__c] = __a;
10570   return __b;
10571 }
10572
10573 static vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
10574                                                 vector bool char __b,
10575                                                 int __c) {
10576   __b[__c] = __a;
10577   return __b;
10578 }
10579
10580 static vector signed short __ATTRS_o_ai vec_insert(signed short __a,
10581                                                    vector signed short __b,
10582                                                    int __c) {
10583   __b[__c] = __a;
10584   return __b;
10585 }
10586
10587 static vector unsigned short __ATTRS_o_ai vec_insert(unsigned short __a,
10588                                                      vector unsigned short __b,
10589                                                      int __c) {
10590   __b[__c] = __a;
10591   return __b;
10592 }
10593
10594 static vector bool short __ATTRS_o_ai vec_insert(unsigned short __a,
10595                                                  vector bool short __b,
10596                                                  int __c) {
10597   __b[__c] = __a;
10598   return __b;
10599 }
10600
10601 static vector signed int __ATTRS_o_ai vec_insert(signed int __a,
10602                                                  vector signed int __b,
10603                                                  int __c) {
10604   __b[__c] = __a;
10605   return __b;
10606 }
10607
10608 static vector unsigned int __ATTRS_o_ai vec_insert(unsigned int __a,
10609                                                    vector unsigned int __b,
10610                                                    int __c) {
10611   __b[__c] = __a;
10612   return __b;
10613 }
10614
10615 static vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
10616                                                vector bool int __b,
10617                                                int __c) {
10618   __b[__c] = __a;
10619   return __b;
10620 }
10621
10622 #ifdef __VSX__
10623 static vector signed long long __ATTRS_o_ai
10624 vec_insert(signed long long __a, vector signed long long __b, int __c) {
10625   __b[__c] = __a;
10626   return __b;
10627 }
10628
10629 static vector unsigned long long __ATTRS_o_ai
10630 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
10631   __b[__c] = __a;
10632   return __b;
10633 }
10634
10635 static vector bool long long __ATTRS_o_ai
10636 vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
10637   __b[__c] = __a;
10638   return __b;
10639 }
10640 static vector double __ATTRS_o_ai vec_insert(double __a, vector double __b,
10641                                              int __c) {
10642   __b[__c] = __a;
10643   return __b;
10644 }
10645 #endif
10646
10647 static vector float __ATTRS_o_ai vec_insert(float __a, vector float __b,
10648                                             int __c) {
10649   __b[__c] = __a;
10650   return __b;
10651 }
10652
10653 /* vec_lvlx */
10654
10655 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10656                                                 const signed char *__b) {
10657   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10658                   vec_lvsl(__a, __b));
10659 }
10660
10661 static vector signed char __ATTRS_o_ai vec_lvlx(int __a,
10662                                                 const vector signed char *__b) {
10663   return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
10664                   vec_lvsl(__a, (unsigned char *)__b));
10665 }
10666
10667 static vector unsigned char __ATTRS_o_ai vec_lvlx(int __a,
10668                                                   const unsigned char *__b) {
10669   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10670                   vec_lvsl(__a, __b));
10671 }
10672
10673 static vector unsigned char __ATTRS_o_ai
10674 vec_lvlx(int __a, const vector unsigned char *__b) {
10675   return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
10676                   vec_lvsl(__a, (unsigned char *)__b));
10677 }
10678
10679 static vector bool char __ATTRS_o_ai vec_lvlx(int __a,
10680                                               const vector bool char *__b) {
10681   return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
10682                   vec_lvsl(__a, (unsigned char *)__b));
10683 }
10684
10685 static vector short __ATTRS_o_ai vec_lvlx(int __a, const short *__b) {
10686   return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10687 }
10688
10689 static vector short __ATTRS_o_ai vec_lvlx(int __a, const vector short *__b) {
10690   return vec_perm(vec_ld(__a, __b), (vector short)(0),
10691                   vec_lvsl(__a, (unsigned char *)__b));
10692 }
10693
10694 static vector unsigned short __ATTRS_o_ai vec_lvlx(int __a,
10695                                                    const unsigned short *__b) {
10696   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10697                   vec_lvsl(__a, __b));
10698 }
10699
10700 static vector unsigned short __ATTRS_o_ai
10701 vec_lvlx(int __a, const vector unsigned short *__b) {
10702   return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
10703                   vec_lvsl(__a, (unsigned char *)__b));
10704 }
10705
10706 static vector bool short __ATTRS_o_ai vec_lvlx(int __a,
10707                                                const vector bool short *__b) {
10708   return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
10709                   vec_lvsl(__a, (unsigned char *)__b));
10710 }
10711
10712 static vector pixel __ATTRS_o_ai vec_lvlx(int __a, const vector pixel *__b) {
10713   return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
10714                   vec_lvsl(__a, (unsigned char *)__b));
10715 }
10716
10717 static vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
10718   return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10719 }
10720
10721 static vector int __ATTRS_o_ai vec_lvlx(int __a, const vector int *__b) {
10722   return vec_perm(vec_ld(__a, __b), (vector int)(0),
10723                   vec_lvsl(__a, (unsigned char *)__b));
10724 }
10725
10726 static vector unsigned int __ATTRS_o_ai vec_lvlx(int __a,
10727                                                  const unsigned int *__b) {
10728   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10729                   vec_lvsl(__a, __b));
10730 }
10731
10732 static vector unsigned int __ATTRS_o_ai
10733 vec_lvlx(int __a, const vector unsigned int *__b) {
10734   return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
10735                   vec_lvsl(__a, (unsigned char *)__b));
10736 }
10737
10738 static vector bool int __ATTRS_o_ai vec_lvlx(int __a,
10739                                              const vector bool int *__b) {
10740   return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
10741                   vec_lvsl(__a, (unsigned char *)__b));
10742 }
10743
10744 static vector float __ATTRS_o_ai vec_lvlx(int __a, const float *__b) {
10745   return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10746 }
10747
10748 static vector float __ATTRS_o_ai vec_lvlx(int __a, const vector float *__b) {
10749   return vec_perm(vec_ld(__a, __b), (vector float)(0),
10750                   vec_lvsl(__a, (unsigned char *)__b));
10751 }
10752
10753 /* vec_lvlxl */
10754
10755 static vector signed char __ATTRS_o_ai vec_lvlxl(int __a,
10756                                                  const signed char *__b) {
10757   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10758                   vec_lvsl(__a, __b));
10759 }
10760
10761 static vector signed char __ATTRS_o_ai
10762 vec_lvlxl(int __a, const vector signed char *__b) {
10763   return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
10764                   vec_lvsl(__a, (unsigned char *)__b));
10765 }
10766
10767 static vector unsigned char __ATTRS_o_ai vec_lvlxl(int __a,
10768                                                    const unsigned char *__b) {
10769   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10770                   vec_lvsl(__a, __b));
10771 }
10772
10773 static vector unsigned char __ATTRS_o_ai
10774 vec_lvlxl(int __a, const vector unsigned char *__b) {
10775   return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
10776                   vec_lvsl(__a, (unsigned char *)__b));
10777 }
10778
10779 static vector bool char __ATTRS_o_ai vec_lvlxl(int __a,
10780                                                const vector bool char *__b) {
10781   return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
10782                   vec_lvsl(__a, (unsigned char *)__b));
10783 }
10784
10785 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const short *__b) {
10786   return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
10787 }
10788
10789 static vector short __ATTRS_o_ai vec_lvlxl(int __a, const vector short *__b) {
10790   return vec_perm(vec_ldl(__a, __b), (vector short)(0),
10791                   vec_lvsl(__a, (unsigned char *)__b));
10792 }
10793
10794 static vector unsigned short __ATTRS_o_ai vec_lvlxl(int __a,
10795                                                     const unsigned short *__b) {
10796   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10797                   vec_lvsl(__a, __b));
10798 }
10799
10800 static vector unsigned short __ATTRS_o_ai
10801 vec_lvlxl(int __a, const vector unsigned short *__b) {
10802   return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
10803                   vec_lvsl(__a, (unsigned char *)__b));
10804 }
10805
10806 static vector bool short __ATTRS_o_ai vec_lvlxl(int __a,
10807                                                 const vector bool short *__b) {
10808   return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
10809                   vec_lvsl(__a, (unsigned char *)__b));
10810 }
10811
10812 static vector pixel __ATTRS_o_ai vec_lvlxl(int __a, const vector pixel *__b) {
10813   return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
10814                   vec_lvsl(__a, (unsigned char *)__b));
10815 }
10816
10817 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
10818   return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
10819 }
10820
10821 static vector int __ATTRS_o_ai vec_lvlxl(int __a, const vector int *__b) {
10822   return vec_perm(vec_ldl(__a, __b), (vector int)(0),
10823                   vec_lvsl(__a, (unsigned char *)__b));
10824 }
10825
10826 static vector unsigned int __ATTRS_o_ai vec_lvlxl(int __a,
10827                                                   const unsigned int *__b) {
10828   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10829                   vec_lvsl(__a, __b));
10830 }
10831
10832 static vector unsigned int __ATTRS_o_ai
10833 vec_lvlxl(int __a, const vector unsigned int *__b) {
10834   return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
10835                   vec_lvsl(__a, (unsigned char *)__b));
10836 }
10837
10838 static vector bool int __ATTRS_o_ai vec_lvlxl(int __a,
10839                                               const vector bool int *__b) {
10840   return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
10841                   vec_lvsl(__a, (unsigned char *)__b));
10842 }
10843
10844 static vector float __ATTRS_o_ai vec_lvlxl(int __a, const float *__b) {
10845   return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
10846 }
10847
10848 static vector float __ATTRS_o_ai vec_lvlxl(int __a, vector float *__b) {
10849   return vec_perm(vec_ldl(__a, __b), (vector float)(0),
10850                   vec_lvsl(__a, (unsigned char *)__b));
10851 }
10852
10853 /* vec_lvrx */
10854
10855 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10856                                                 const signed char *__b) {
10857   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10858                   vec_lvsl(__a, __b));
10859 }
10860
10861 static vector signed char __ATTRS_o_ai vec_lvrx(int __a,
10862                                                 const vector signed char *__b) {
10863   return vec_perm((vector signed char)(0), vec_ld(__a, __b),
10864                   vec_lvsl(__a, (unsigned char *)__b));
10865 }
10866
10867 static vector unsigned char __ATTRS_o_ai vec_lvrx(int __a,
10868                                                   const unsigned char *__b) {
10869   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10870                   vec_lvsl(__a, __b));
10871 }
10872
10873 static vector unsigned char __ATTRS_o_ai
10874 vec_lvrx(int __a, const vector unsigned char *__b) {
10875   return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
10876                   vec_lvsl(__a, (unsigned char *)__b));
10877 }
10878
10879 static vector bool char __ATTRS_o_ai vec_lvrx(int __a,
10880                                               const vector bool char *__b) {
10881   return vec_perm((vector bool char)(0), vec_ld(__a, __b),
10882                   vec_lvsl(__a, (unsigned char *)__b));
10883 }
10884
10885 static vector short __ATTRS_o_ai vec_lvrx(int __a, const short *__b) {
10886   return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10887 }
10888
10889 static vector short __ATTRS_o_ai vec_lvrx(int __a, const vector short *__b) {
10890   return vec_perm((vector short)(0), vec_ld(__a, __b),
10891                   vec_lvsl(__a, (unsigned char *)__b));
10892 }
10893
10894 static vector unsigned short __ATTRS_o_ai vec_lvrx(int __a,
10895                                                    const unsigned short *__b) {
10896   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10897                   vec_lvsl(__a, __b));
10898 }
10899
10900 static vector unsigned short __ATTRS_o_ai
10901 vec_lvrx(int __a, const vector unsigned short *__b) {
10902   return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
10903                   vec_lvsl(__a, (unsigned char *)__b));
10904 }
10905
10906 static vector bool short __ATTRS_o_ai vec_lvrx(int __a,
10907                                                const vector bool short *__b) {
10908   return vec_perm((vector bool short)(0), vec_ld(__a, __b),
10909                   vec_lvsl(__a, (unsigned char *)__b));
10910 }
10911
10912 static vector pixel __ATTRS_o_ai vec_lvrx(int __a, const vector pixel *__b) {
10913   return vec_perm((vector pixel)(0), vec_ld(__a, __b),
10914                   vec_lvsl(__a, (unsigned char *)__b));
10915 }
10916
10917 static vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
10918   return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10919 }
10920
10921 static vector int __ATTRS_o_ai vec_lvrx(int __a, const vector int *__b) {
10922   return vec_perm((vector int)(0), vec_ld(__a, __b),
10923                   vec_lvsl(__a, (unsigned char *)__b));
10924 }
10925
10926 static vector unsigned int __ATTRS_o_ai vec_lvrx(int __a,
10927                                                  const unsigned int *__b) {
10928   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10929                   vec_lvsl(__a, __b));
10930 }
10931
10932 static vector unsigned int __ATTRS_o_ai
10933 vec_lvrx(int __a, const vector unsigned int *__b) {
10934   return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
10935                   vec_lvsl(__a, (unsigned char *)__b));
10936 }
10937
10938 static vector bool int __ATTRS_o_ai vec_lvrx(int __a,
10939                                              const vector bool int *__b) {
10940   return vec_perm((vector bool int)(0), vec_ld(__a, __b),
10941                   vec_lvsl(__a, (unsigned char *)__b));
10942 }
10943
10944 static vector float __ATTRS_o_ai vec_lvrx(int __a, const float *__b) {
10945   return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
10946 }
10947
10948 static vector float __ATTRS_o_ai vec_lvrx(int __a, const vector float *__b) {
10949   return vec_perm((vector float)(0), vec_ld(__a, __b),
10950                   vec_lvsl(__a, (unsigned char *)__b));
10951 }
10952
10953 /* vec_lvrxl */
10954
10955 static vector signed char __ATTRS_o_ai vec_lvrxl(int __a,
10956                                                  const signed char *__b) {
10957   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10958                   vec_lvsl(__a, __b));
10959 }
10960
10961 static vector signed char __ATTRS_o_ai
10962 vec_lvrxl(int __a, const vector signed char *__b) {
10963   return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
10964                   vec_lvsl(__a, (unsigned char *)__b));
10965 }
10966
10967 static vector unsigned char __ATTRS_o_ai vec_lvrxl(int __a,
10968                                                    const unsigned char *__b) {
10969   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
10970                   vec_lvsl(__a, __b));
10971 }
10972
10973 static vector unsigned char __ATTRS_o_ai
10974 vec_lvrxl(int __a, const vector unsigned char *__b) {
10975   return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
10976                   vec_lvsl(__a, (unsigned char *)__b));
10977 }
10978
10979 static vector bool char __ATTRS_o_ai vec_lvrxl(int __a,
10980                                                const vector bool char *__b) {
10981   return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
10982                   vec_lvsl(__a, (unsigned char *)__b));
10983 }
10984
10985 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const short *__b) {
10986   return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
10987 }
10988
10989 static vector short __ATTRS_o_ai vec_lvrxl(int __a, const vector short *__b) {
10990   return vec_perm((vector short)(0), vec_ldl(__a, __b),
10991                   vec_lvsl(__a, (unsigned char *)__b));
10992 }
10993
10994 static vector unsigned short __ATTRS_o_ai vec_lvrxl(int __a,
10995                                                     const unsigned short *__b) {
10996   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
10997                   vec_lvsl(__a, __b));
10998 }
10999
11000 static vector unsigned short __ATTRS_o_ai
11001 vec_lvrxl(int __a, const vector unsigned short *__b) {
11002   return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
11003                   vec_lvsl(__a, (unsigned char *)__b));
11004 }
11005
11006 static vector bool short __ATTRS_o_ai vec_lvrxl(int __a,
11007                                                 const vector bool short *__b) {
11008   return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
11009                   vec_lvsl(__a, (unsigned char *)__b));
11010 }
11011
11012 static vector pixel __ATTRS_o_ai vec_lvrxl(int __a, const vector pixel *__b) {
11013   return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
11014                   vec_lvsl(__a, (unsigned char *)__b));
11015 }
11016
11017 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
11018   return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11019 }
11020
11021 static vector int __ATTRS_o_ai vec_lvrxl(int __a, const vector int *__b) {
11022   return vec_perm((vector int)(0), vec_ldl(__a, __b),
11023                   vec_lvsl(__a, (unsigned char *)__b));
11024 }
11025
11026 static vector unsigned int __ATTRS_o_ai vec_lvrxl(int __a,
11027                                                   const unsigned int *__b) {
11028   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11029                   vec_lvsl(__a, __b));
11030 }
11031
11032 static vector unsigned int __ATTRS_o_ai
11033 vec_lvrxl(int __a, const vector unsigned int *__b) {
11034   return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
11035                   vec_lvsl(__a, (unsigned char *)__b));
11036 }
11037
11038 static vector bool int __ATTRS_o_ai vec_lvrxl(int __a,
11039                                               const vector bool int *__b) {
11040   return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
11041                   vec_lvsl(__a, (unsigned char *)__b));
11042 }
11043
11044 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const float *__b) {
11045   return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
11046 }
11047
11048 static vector float __ATTRS_o_ai vec_lvrxl(int __a, const vector float *__b) {
11049   return vec_perm((vector float)(0), vec_ldl(__a, __b),
11050                   vec_lvsl(__a, (unsigned char *)__b));
11051 }
11052
11053 /* vec_stvlx */
11054
11055 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11056                                    signed char *__c) {
11057   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11058                 __c);
11059 }
11060
11061 static void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
11062                                    vector signed char *__c) {
11063   return vec_st(
11064       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11065       __b, __c);
11066 }
11067
11068 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11069                                    unsigned char *__c) {
11070   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11071                 __c);
11072 }
11073
11074 static void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
11075                                    vector unsigned char *__c) {
11076   return vec_st(
11077       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11078       __b, __c);
11079 }
11080
11081 static void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
11082                                    vector bool char *__c) {
11083   return vec_st(
11084       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11085       __b, __c);
11086 }
11087
11088 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, short *__c) {
11089   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11090                 __c);
11091 }
11092
11093 static void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
11094                                    vector short *__c) {
11095   return vec_st(
11096       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11097       __b, __c);
11098 }
11099
11100 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
11101                                    unsigned short *__c) {
11102   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11103                 __c);
11104 }
11105
11106 static void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, int __b,
11107                                    vector unsigned short *__c) {
11108   return vec_st(
11109       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11110       __b, __c);
11111 }
11112
11113 static void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
11114                                    vector bool short *__c) {
11115   return vec_st(
11116       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11117       __b, __c);
11118 }
11119
11120 static void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
11121                                    vector pixel *__c) {
11122   return vec_st(
11123       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11124       __b, __c);
11125 }
11126
11127 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, int *__c) {
11128   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11129                 __c);
11130 }
11131
11132 static void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, vector int *__c) {
11133   return vec_st(
11134       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11135       __b, __c);
11136 }
11137
11138 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11139                                    unsigned int *__c) {
11140   return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11141                 __c);
11142 }
11143
11144 static void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
11145                                    vector unsigned int *__c) {
11146   return vec_st(
11147       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11148       __b, __c);
11149 }
11150
11151 static void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
11152                                    vector bool int *__c) {
11153   return vec_st(
11154       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11155       __b, __c);
11156 }
11157
11158 static void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
11159                                    vector float *__c) {
11160   return vec_st(
11161       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11162       __b, __c);
11163 }
11164
11165 /* vec_stvlxl */
11166
11167 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11168                                     signed char *__c) {
11169   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11170                  __c);
11171 }
11172
11173 static void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
11174                                     vector signed char *__c) {
11175   return vec_stl(
11176       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11177       __b, __c);
11178 }
11179
11180 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
11181                                     unsigned char *__c) {
11182   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11183                  __c);
11184 }
11185
11186 static void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, int __b,
11187                                     vector unsigned char *__c) {
11188   return vec_stl(
11189       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11190       __b, __c);
11191 }
11192
11193 static void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
11194                                     vector bool char *__c) {
11195   return vec_stl(
11196       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11197       __b, __c);
11198 }
11199
11200 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, short *__c) {
11201   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11202                  __c);
11203 }
11204
11205 static void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
11206                                     vector short *__c) {
11207   return vec_stl(
11208       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11209       __b, __c);
11210 }
11211
11212 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11213                                     unsigned short *__c) {
11214   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11215                  __c);
11216 }
11217
11218 static void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, int __b,
11219                                     vector unsigned short *__c) {
11220   return vec_stl(
11221       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11222       __b, __c);
11223 }
11224
11225 static void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
11226                                     vector bool short *__c) {
11227   return vec_stl(
11228       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11229       __b, __c);
11230 }
11231
11232 static void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
11233                                     vector pixel *__c) {
11234   return vec_stl(
11235       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11236       __b, __c);
11237 }
11238
11239 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, int *__c) {
11240   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11241                  __c);
11242 }
11243
11244 static void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, vector int *__c) {
11245   return vec_stl(
11246       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11247       __b, __c);
11248 }
11249
11250 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11251                                     unsigned int *__c) {
11252   return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
11253                  __c);
11254 }
11255
11256 static void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
11257                                     vector unsigned int *__c) {
11258   return vec_stl(
11259       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11260       __b, __c);
11261 }
11262
11263 static void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
11264                                     vector bool int *__c) {
11265   return vec_stl(
11266       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11267       __b, __c);
11268 }
11269
11270 static void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
11271                                     vector float *__c) {
11272   return vec_stl(
11273       vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
11274       __b, __c);
11275 }
11276
11277 /* vec_stvrx */
11278
11279 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11280                                    signed char *__c) {
11281   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11282                 __c);
11283 }
11284
11285 static void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
11286                                    vector signed char *__c) {
11287   return vec_st(
11288       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11289       __b, __c);
11290 }
11291
11292 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11293                                    unsigned char *__c) {
11294   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11295                 __c);
11296 }
11297
11298 static void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
11299                                    vector unsigned char *__c) {
11300   return vec_st(
11301       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11302       __b, __c);
11303 }
11304
11305 static void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
11306                                    vector bool char *__c) {
11307   return vec_st(
11308       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11309       __b, __c);
11310 }
11311
11312 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, short *__c) {
11313   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11314                 __c);
11315 }
11316
11317 static void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
11318                                    vector short *__c) {
11319   return vec_st(
11320       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11321       __b, __c);
11322 }
11323
11324 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11325                                    unsigned short *__c) {
11326   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11327                 __c);
11328 }
11329
11330 static void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, int __b,
11331                                    vector unsigned short *__c) {
11332   return vec_st(
11333       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11334       __b, __c);
11335 }
11336
11337 static void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
11338                                    vector bool short *__c) {
11339   return vec_st(
11340       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11341       __b, __c);
11342 }
11343
11344 static void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
11345                                    vector pixel *__c) {
11346   return vec_st(
11347       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11348       __b, __c);
11349 }
11350
11351 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, int *__c) {
11352   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11353                 __c);
11354 }
11355
11356 static void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, vector int *__c) {
11357   return vec_st(
11358       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11359       __b, __c);
11360 }
11361
11362 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11363                                    unsigned int *__c) {
11364   return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11365                 __c);
11366 }
11367
11368 static void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
11369                                    vector unsigned int *__c) {
11370   return vec_st(
11371       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11372       __b, __c);
11373 }
11374
11375 static void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
11376                                    vector bool int *__c) {
11377   return vec_st(
11378       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11379       __b, __c);
11380 }
11381
11382 static void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
11383                                    vector float *__c) {
11384   return vec_st(
11385       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11386       __b, __c);
11387 }
11388
11389 /* vec_stvrxl */
11390
11391 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11392                                     signed char *__c) {
11393   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11394                  __c);
11395 }
11396
11397 static void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
11398                                     vector signed char *__c) {
11399   return vec_stl(
11400       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11401       __b, __c);
11402 }
11403
11404 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11405                                     unsigned char *__c) {
11406   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11407                  __c);
11408 }
11409
11410 static void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, int __b,
11411                                     vector unsigned char *__c) {
11412   return vec_stl(
11413       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11414       __b, __c);
11415 }
11416
11417 static void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
11418                                     vector bool char *__c) {
11419   return vec_stl(
11420       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11421       __b, __c);
11422 }
11423
11424 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, short *__c) {
11425   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11426                  __c);
11427 }
11428
11429 static void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
11430                                     vector short *__c) {
11431   return vec_stl(
11432       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11433       __b, __c);
11434 }
11435
11436 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11437                                     unsigned short *__c) {
11438   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11439                  __c);
11440 }
11441
11442 static void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, int __b,
11443                                     vector unsigned short *__c) {
11444   return vec_stl(
11445       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11446       __b, __c);
11447 }
11448
11449 static void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
11450                                     vector bool short *__c) {
11451   return vec_stl(
11452       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11453       __b, __c);
11454 }
11455
11456 static void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
11457                                     vector pixel *__c) {
11458   return vec_stl(
11459       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11460       __b, __c);
11461 }
11462
11463 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, int *__c) {
11464   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11465                  __c);
11466 }
11467
11468 static void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, vector int *__c) {
11469   return vec_stl(
11470       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11471       __b, __c);
11472 }
11473
11474 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11475                                     unsigned int *__c) {
11476   return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
11477                  __c);
11478 }
11479
11480 static void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
11481                                     vector unsigned int *__c) {
11482   return vec_stl(
11483       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11484       __b, __c);
11485 }
11486
11487 static void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
11488                                     vector bool int *__c) {
11489   return vec_stl(
11490       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11491       __b, __c);
11492 }
11493
11494 static void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
11495                                     vector float *__c) {
11496   return vec_stl(
11497       vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
11498       __b, __c);
11499 }
11500
11501 /* vec_promote */
11502
11503 static vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b) {
11504   vector signed char __res = (vector signed char)(0);
11505   __res[__b] = __a;
11506   return __res;
11507 }
11508
11509 static vector unsigned char __ATTRS_o_ai vec_promote(unsigned char __a,
11510                                                      int __b) {
11511   vector unsigned char __res = (vector unsigned char)(0);
11512   __res[__b] = __a;
11513   return __res;
11514 }
11515
11516 static vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
11517   vector short __res = (vector short)(0);
11518   __res[__b] = __a;
11519   return __res;
11520 }
11521
11522 static vector unsigned short __ATTRS_o_ai vec_promote(unsigned short __a,
11523                                                       int __b) {
11524   vector unsigned short __res = (vector unsigned short)(0);
11525   __res[__b] = __a;
11526   return __res;
11527 }
11528
11529 static vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
11530   vector int __res = (vector int)(0);
11531   __res[__b] = __a;
11532   return __res;
11533 }
11534
11535 static vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, int __b) {
11536   vector unsigned int __res = (vector unsigned int)(0);
11537   __res[__b] = __a;
11538   return __res;
11539 }
11540
11541 static vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
11542   vector float __res = (vector float)(0);
11543   __res[__b] = __a;
11544   return __res;
11545 }
11546
11547 /* vec_splats */
11548
11549 static vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
11550   return (vector signed char)(__a);
11551 }
11552
11553 static vector unsigned char __ATTRS_o_ai vec_splats(unsigned char __a) {
11554   return (vector unsigned char)(__a);
11555 }
11556
11557 static vector short __ATTRS_o_ai vec_splats(short __a) {
11558   return (vector short)(__a);
11559 }
11560
11561 static vector unsigned short __ATTRS_o_ai vec_splats(unsigned short __a) {
11562   return (vector unsigned short)(__a);
11563 }
11564
11565 static vector int __ATTRS_o_ai vec_splats(int __a) { return (vector int)(__a); }
11566
11567 static vector unsigned int __ATTRS_o_ai vec_splats(unsigned int __a) {
11568   return (vector unsigned int)(__a);
11569 }
11570
11571 #ifdef __VSX__
11572 static vector signed long long __ATTRS_o_ai vec_splats(signed long long __a) {
11573   return (vector signed long long)(__a);
11574 }
11575
11576 static vector unsigned long long __ATTRS_o_ai
11577 vec_splats(unsigned long long __a) {
11578   return (vector unsigned long long)(__a);
11579 }
11580
11581 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
11582 static vector signed __int128 __ATTRS_o_ai vec_splats(signed __int128 __a) {
11583   return (vector signed __int128)(__a);
11584 }
11585
11586 static vector unsigned __int128 __ATTRS_o_ai
11587 vec_splats(unsigned __int128 __a) {
11588   return (vector unsigned __int128)(__a);
11589 }
11590
11591 #endif
11592
11593 static vector double __ATTRS_o_ai vec_splats(double __a) {
11594   return (vector double)(__a);
11595 }
11596 #endif
11597
11598 static vector float __ATTRS_o_ai vec_splats(float __a) {
11599   return (vector float)(__a);
11600 }
11601
11602 /* ----------------------------- predicates --------------------------------- */
11603
11604 /* vec_all_eq */
11605
11606 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11607                                    vector signed char __b) {
11608   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11609                                       (vector char)__b);
11610 }
11611
11612 static int __ATTRS_o_ai vec_all_eq(vector signed char __a,
11613                                    vector bool char __b) {
11614   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11615                                       (vector char)__b);
11616 }
11617
11618 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11619                                    vector unsigned char __b) {
11620   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11621                                       (vector char)__b);
11622 }
11623
11624 static int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
11625                                    vector bool char __b) {
11626   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11627                                       (vector char)__b);
11628 }
11629
11630 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11631                                    vector signed char __b) {
11632   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11633                                       (vector char)__b);
11634 }
11635
11636 static int __ATTRS_o_ai vec_all_eq(vector bool char __a,
11637                                    vector unsigned 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 bool char __a, vector bool char __b) {
11643   return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
11644                                       (vector char)__b);
11645 }
11646
11647 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector short __b) {
11648   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
11649 }
11650
11651 static int __ATTRS_o_ai vec_all_eq(vector short __a, vector bool short __b) {
11652   return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
11653 }
11654
11655 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11656                                    vector unsigned short __b) {
11657   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11658                                       (vector short)__b);
11659 }
11660
11661 static int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
11662                                    vector bool short __b) {
11663   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11664                                       (vector short)__b);
11665 }
11666
11667 static int __ATTRS_o_ai vec_all_eq(vector bool short __a, vector short __b) {
11668   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11669                                       (vector short)__b);
11670 }
11671
11672 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11673                                    vector unsigned short __b) {
11674   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11675                                       (vector short)__b);
11676 }
11677
11678 static int __ATTRS_o_ai vec_all_eq(vector bool short __a,
11679                                    vector bool short __b) {
11680   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11681                                       (vector short)__b);
11682 }
11683
11684 static int __ATTRS_o_ai vec_all_eq(vector pixel __a, vector pixel __b) {
11685   return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
11686                                       (vector short)__b);
11687 }
11688
11689 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
11690   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
11691 }
11692
11693 static int __ATTRS_o_ai vec_all_eq(vector int __a, vector bool int __b) {
11694   return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
11695 }
11696
11697 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11698                                    vector unsigned int __b) {
11699   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11700                                       (vector int)__b);
11701 }
11702
11703 static int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
11704                                    vector bool int __b) {
11705   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11706                                       (vector int)__b);
11707 }
11708
11709 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector int __b) {
11710   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11711                                       (vector int)__b);
11712 }
11713
11714 static int __ATTRS_o_ai vec_all_eq(vector bool int __a,
11715                                    vector unsigned int __b) {
11716   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11717                                       (vector int)__b);
11718 }
11719
11720 static int __ATTRS_o_ai vec_all_eq(vector bool int __a, vector bool int __b) {
11721   return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
11722                                       (vector int)__b);
11723 }
11724
11725 #ifdef __POWER8_VECTOR__
11726 static int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
11727                                    vector signed long long __b) {
11728   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11729 }
11730
11731 static int __ATTRS_o_ai vec_all_eq(vector long long __a,
11732                                    vector bool long long __b) {
11733   return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11734 }
11735
11736 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11737                                    vector unsigned long long __b) {
11738   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11739                                       (vector long long)__b);
11740 }
11741
11742 static int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
11743                                    vector bool long long __b) {
11744   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11745                                       (vector long long)__b);
11746 }
11747
11748 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11749                                    vector long long __b) {
11750   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11751                                       (vector long long)__b);
11752 }
11753
11754 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11755                                    vector unsigned long long __b) {
11756   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11757                                       (vector long long)__b);
11758 }
11759
11760 static int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
11761                                    vector bool long long __b) {
11762   return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11763                                       (vector long long)__b);
11764 }
11765 #endif
11766
11767 static int __ATTRS_o_ai vec_all_eq(vector float __a, vector float __b) {
11768 #ifdef __VSX__
11769   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
11770 #else
11771   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
11772 #endif
11773 }
11774
11775 #ifdef __VSX__
11776 static int __ATTRS_o_ai vec_all_eq(vector double __a, vector double __b) {
11777   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
11778 }
11779 #endif
11780
11781 /* vec_all_ge */
11782
11783 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11784                                    vector signed char __b) {
11785   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
11786 }
11787
11788 static int __ATTRS_o_ai vec_all_ge(vector signed char __a,
11789                                    vector bool char __b) {
11790   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
11791 }
11792
11793 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11794                                    vector unsigned char __b) {
11795   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
11796 }
11797
11798 static int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
11799                                    vector bool char __b) {
11800   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
11801 }
11802
11803 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11804                                    vector signed char __b) {
11805   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11806                                       (vector unsigned char)__a);
11807 }
11808
11809 static int __ATTRS_o_ai vec_all_ge(vector bool char __a,
11810                                    vector unsigned char __b) {
11811   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
11812 }
11813
11814 static int __ATTRS_o_ai vec_all_ge(vector bool char __a, vector bool char __b) {
11815   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
11816                                       (vector unsigned char)__a);
11817 }
11818
11819 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector short __b) {
11820   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
11821 }
11822
11823 static int __ATTRS_o_ai vec_all_ge(vector short __a, vector bool short __b) {
11824   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
11825 }
11826
11827 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11828                                    vector unsigned short __b) {
11829   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
11830 }
11831
11832 static int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
11833                                    vector bool short __b) {
11834   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11835                                       __a);
11836 }
11837
11838 static int __ATTRS_o_ai vec_all_ge(vector bool short __a, vector short __b) {
11839   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11840                                       (vector unsigned short)__a);
11841 }
11842
11843 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11844                                    vector unsigned short __b) {
11845   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
11846                                       (vector unsigned short)__a);
11847 }
11848
11849 static int __ATTRS_o_ai vec_all_ge(vector bool short __a,
11850                                    vector bool short __b) {
11851   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
11852                                       (vector unsigned short)__a);
11853 }
11854
11855 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
11856   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
11857 }
11858
11859 static int __ATTRS_o_ai vec_all_ge(vector int __a, vector bool int __b) {
11860   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
11861 }
11862
11863 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11864                                    vector unsigned int __b) {
11865   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
11866 }
11867
11868 static int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
11869                                    vector bool int __b) {
11870   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
11871 }
11872
11873 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector int __b) {
11874   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11875                                       (vector unsigned int)__a);
11876 }
11877
11878 static int __ATTRS_o_ai vec_all_ge(vector bool int __a,
11879                                    vector unsigned int __b) {
11880   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
11881 }
11882
11883 static int __ATTRS_o_ai vec_all_ge(vector bool int __a, vector bool int __b) {
11884   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
11885                                       (vector unsigned int)__a);
11886 }
11887
11888 #ifdef __POWER8_VECTOR__
11889 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11890                                    vector signed long long __b) {
11891   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11892 }
11893 static int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
11894                                    vector bool long long __b) {
11895   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11896                                       __a);
11897 }
11898
11899 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11900                                    vector unsigned long long __b) {
11901   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11902 }
11903
11904 static int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
11905                                    vector bool long long __b) {
11906   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11907                                       __a);
11908 }
11909
11910 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11911                                    vector signed long long __b) {
11912   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11913                                       (vector unsigned long long)__a);
11914 }
11915
11916 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11917                                    vector unsigned long long __b) {
11918   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11919                                       (vector unsigned long long)__a);
11920 }
11921
11922 static int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
11923                                    vector bool long long __b) {
11924   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11925                                       (vector unsigned long long)__a);
11926 }
11927 #endif
11928
11929 static int __ATTRS_o_ai vec_all_ge(vector float __a, vector float __b) {
11930 #ifdef __VSX__
11931   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
11932 #else
11933   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
11934 #endif
11935 }
11936
11937 #ifdef __VSX__
11938 static int __ATTRS_o_ai vec_all_ge(vector double __a, vector double __b) {
11939   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
11940 }
11941 #endif
11942
11943 /* vec_all_gt */
11944
11945 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11946                                    vector signed char __b) {
11947   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
11948 }
11949
11950 static int __ATTRS_o_ai vec_all_gt(vector signed char __a,
11951                                    vector bool char __b) {
11952   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
11953 }
11954
11955 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11956                                    vector unsigned char __b) {
11957   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
11958 }
11959
11960 static int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
11961                                    vector bool char __b) {
11962   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
11963 }
11964
11965 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
11966                                    vector signed char __b) {
11967   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
11968                                       (vector unsigned char)__b);
11969 }
11970
11971 static int __ATTRS_o_ai vec_all_gt(vector bool char __a,
11972                                    vector unsigned char __b) {
11973   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
11974 }
11975
11976 static int __ATTRS_o_ai vec_all_gt(vector bool char __a, vector bool char __b) {
11977   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
11978                                       (vector unsigned char)__b);
11979 }
11980
11981 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector short __b) {
11982   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
11983 }
11984
11985 static int __ATTRS_o_ai vec_all_gt(vector short __a, vector bool short __b) {
11986   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
11987 }
11988
11989 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
11990                                    vector unsigned short __b) {
11991   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
11992 }
11993
11994 static int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
11995                                    vector bool short __b) {
11996   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
11997                                       (vector unsigned short)__b);
11998 }
11999
12000 static int __ATTRS_o_ai vec_all_gt(vector bool short __a, vector short __b) {
12001   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12002                                       (vector unsigned short)__b);
12003 }
12004
12005 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12006                                    vector unsigned short __b) {
12007   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12008                                       __b);
12009 }
12010
12011 static int __ATTRS_o_ai vec_all_gt(vector bool short __a,
12012                                    vector bool short __b) {
12013   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
12014                                       (vector unsigned short)__b);
12015 }
12016
12017 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
12018   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
12019 }
12020
12021 static int __ATTRS_o_ai vec_all_gt(vector int __a, vector bool int __b) {
12022   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
12023 }
12024
12025 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12026                                    vector unsigned int __b) {
12027   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
12028 }
12029
12030 static int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
12031                                    vector bool int __b) {
12032   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
12033 }
12034
12035 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector int __b) {
12036   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12037                                       (vector unsigned int)__b);
12038 }
12039
12040 static int __ATTRS_o_ai vec_all_gt(vector bool int __a,
12041                                    vector unsigned int __b) {
12042   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
12043 }
12044
12045 static int __ATTRS_o_ai vec_all_gt(vector bool int __a, vector bool int __b) {
12046   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
12047                                       (vector unsigned int)__b);
12048 }
12049
12050 #ifdef __POWER8_VECTOR__
12051 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12052                                    vector signed long long __b) {
12053   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
12054 }
12055 static int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
12056                                    vector bool long long __b) {
12057   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
12058                                       (vector signed long long)__b);
12059 }
12060
12061 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12062                                    vector unsigned long long __b) {
12063   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
12064 }
12065
12066 static int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
12067                                    vector bool long long __b) {
12068   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
12069                                       (vector unsigned long long)__b);
12070 }
12071
12072 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12073                                    vector signed long long __b) {
12074   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12075                                       (vector unsigned long long)__b);
12076 }
12077
12078 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12079                                    vector unsigned long long __b) {
12080   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12081                                       __b);
12082 }
12083
12084 static int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
12085                                    vector bool long long __b) {
12086   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
12087                                       (vector unsigned long long)__b);
12088 }
12089 #endif
12090
12091 static int __ATTRS_o_ai vec_all_gt(vector float __a, vector float __b) {
12092 #ifdef __VSX__
12093   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
12094 #else
12095   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
12096 #endif
12097 }
12098
12099 #ifdef __VSX__
12100 static int __ATTRS_o_ai vec_all_gt(vector double __a, vector double __b) {
12101   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
12102 }
12103 #endif
12104
12105 /* vec_all_in */
12106
12107 static int __attribute__((__always_inline__))
12108 vec_all_in(vector float __a, vector float __b) {
12109   return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
12110 }
12111
12112 /* vec_all_le */
12113
12114 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
12115                                    vector signed char __b) {
12116   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
12117 }
12118
12119 static int __ATTRS_o_ai vec_all_le(vector signed char __a,
12120                                    vector bool char __b) {
12121   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
12122 }
12123
12124 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12125                                    vector unsigned char __b) {
12126   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
12127 }
12128
12129 static int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
12130                                    vector bool char __b) {
12131   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
12132 }
12133
12134 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
12135                                    vector signed char __b) {
12136   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12137                                       (vector unsigned char)__b);
12138 }
12139
12140 static int __ATTRS_o_ai vec_all_le(vector bool char __a,
12141                                    vector unsigned char __b) {
12142   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
12143 }
12144
12145 static int __ATTRS_o_ai vec_all_le(vector bool char __a, vector bool char __b) {
12146   return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
12147                                       (vector unsigned char)__b);
12148 }
12149
12150 static int __ATTRS_o_ai vec_all_le(vector short __a, vector short __b) {
12151   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
12152 }
12153
12154 static int __ATTRS_o_ai vec_all_le(vector short __a, vector bool short __b) {
12155   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
12156 }
12157
12158 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12159                                    vector unsigned short __b) {
12160   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
12161 }
12162
12163 static int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
12164                                    vector bool short __b) {
12165   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
12166                                       (vector unsigned short)__b);
12167 }
12168
12169 static int __ATTRS_o_ai vec_all_le(vector bool short __a, vector short __b) {
12170   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12171                                       (vector unsigned short)__b);
12172 }
12173
12174 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
12175                                    vector unsigned short __b) {
12176   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12177                                       __b);
12178 }
12179
12180 static int __ATTRS_o_ai vec_all_le(vector bool short __a,
12181                                    vector bool short __b) {
12182   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
12183                                       (vector unsigned short)__b);
12184 }
12185
12186 static int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
12187   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
12188 }
12189
12190 static int __ATTRS_o_ai vec_all_le(vector int __a, vector bool int __b) {
12191   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
12192 }
12193
12194 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12195                                    vector unsigned int __b) {
12196   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
12197 }
12198
12199 static int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
12200                                    vector bool int __b) {
12201   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
12202 }
12203
12204 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector int __b) {
12205   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12206                                       (vector unsigned int)__b);
12207 }
12208
12209 static int __ATTRS_o_ai vec_all_le(vector bool int __a,
12210                                    vector unsigned int __b) {
12211   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
12212 }
12213
12214 static int __ATTRS_o_ai vec_all_le(vector bool int __a, vector bool int __b) {
12215   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
12216                                       (vector unsigned int)__b);
12217 }
12218
12219 #ifdef __POWER8_VECTOR__
12220 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12221                                    vector signed long long __b) {
12222   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
12223 }
12224
12225 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12226                                    vector unsigned long long __b) {
12227   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
12228 }
12229
12230 static int __ATTRS_o_ai vec_all_le(vector signed long long __a,
12231                                    vector bool long long __b) {
12232   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
12233                                       (vector signed long long)__b);
12234 }
12235
12236 static int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
12237                                    vector bool long long __b) {
12238   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
12239                                       (vector unsigned long long)__b);
12240 }
12241
12242 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12243                                    vector signed long long __b) {
12244   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12245                                       (vector unsigned long long)__b);
12246 }
12247
12248 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12249                                    vector unsigned long long __b) {
12250   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12251                                       __b);
12252 }
12253
12254 static int __ATTRS_o_ai vec_all_le(vector bool long long __a,
12255                                    vector bool long long __b) {
12256   return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
12257                                       (vector unsigned long long)__b);
12258 }
12259 #endif
12260
12261 static int __ATTRS_o_ai vec_all_le(vector float __a, vector float __b) {
12262 #ifdef __VSX__
12263   return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
12264 #else
12265   return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
12266 #endif
12267 }
12268
12269 #ifdef __VSX__
12270 static int __ATTRS_o_ai vec_all_le(vector double __a, vector double __b) {
12271   return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
12272 }
12273 #endif
12274
12275 /* vec_all_lt */
12276
12277 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12278                                    vector signed char __b) {
12279   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
12280 }
12281
12282 static int __ATTRS_o_ai vec_all_lt(vector signed char __a,
12283                                    vector bool char __b) {
12284   return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
12285 }
12286
12287 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12288                                    vector unsigned char __b) {
12289   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
12290 }
12291
12292 static int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
12293                                    vector bool char __b) {
12294   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
12295 }
12296
12297 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12298                                    vector signed char __b) {
12299   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12300                                       (vector unsigned char)__a);
12301 }
12302
12303 static int __ATTRS_o_ai vec_all_lt(vector bool char __a,
12304                                    vector unsigned char __b) {
12305   return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
12306 }
12307
12308 static int __ATTRS_o_ai vec_all_lt(vector bool char __a, vector bool char __b) {
12309   return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
12310                                       (vector unsigned char)__a);
12311 }
12312
12313 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector short __b) {
12314   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
12315 }
12316
12317 static int __ATTRS_o_ai vec_all_lt(vector short __a, vector bool short __b) {
12318   return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
12319 }
12320
12321 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12322                                    vector unsigned short __b) {
12323   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
12324 }
12325
12326 static int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
12327                                    vector bool short __b) {
12328   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12329                                       __a);
12330 }
12331
12332 static int __ATTRS_o_ai vec_all_lt(vector bool short __a, vector short __b) {
12333   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12334                                       (vector unsigned short)__a);
12335 }
12336
12337 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12338                                    vector unsigned short __b) {
12339   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
12340                                       (vector unsigned short)__a);
12341 }
12342
12343 static int __ATTRS_o_ai vec_all_lt(vector bool short __a,
12344                                    vector bool short __b) {
12345   return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
12346                                       (vector unsigned short)__a);
12347 }
12348
12349 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
12350   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
12351 }
12352
12353 static int __ATTRS_o_ai vec_all_lt(vector int __a, vector bool int __b) {
12354   return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
12355 }
12356
12357 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12358                                    vector unsigned int __b) {
12359   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
12360 }
12361
12362 static int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
12363                                    vector bool int __b) {
12364   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
12365 }
12366
12367 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector int __b) {
12368   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12369                                       (vector unsigned int)__a);
12370 }
12371
12372 static int __ATTRS_o_ai vec_all_lt(vector bool int __a,
12373                                    vector unsigned int __b) {
12374   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
12375 }
12376
12377 static int __ATTRS_o_ai vec_all_lt(vector bool int __a, vector bool int __b) {
12378   return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
12379                                       (vector unsigned int)__a);
12380 }
12381
12382 #ifdef __POWER8_VECTOR__
12383 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12384                                    vector signed long long __b) {
12385   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
12386 }
12387
12388 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12389                                    vector unsigned long long __b) {
12390   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
12391 }
12392
12393 static int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
12394                                    vector bool long long __b) {
12395   return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
12396                                       __a);
12397 }
12398
12399 static int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
12400                                    vector bool long long __b) {
12401   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12402                                       __a);
12403 }
12404
12405 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12406                                    vector signed long long __b) {
12407   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12408                                       (vector unsigned long long)__a);
12409 }
12410
12411 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12412                                    vector unsigned long long __b) {
12413   return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
12414                                       (vector unsigned long long)__a);
12415 }
12416
12417 static int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
12418                                    vector bool long long __b) {
12419   return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
12420                                       (vector unsigned long long)__a);
12421 }
12422 #endif
12423
12424 static int __ATTRS_o_ai vec_all_lt(vector float __a, vector float __b) {
12425 #ifdef __VSX__
12426   return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
12427 #else
12428   return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
12429 #endif
12430 }
12431
12432 #ifdef __VSX__
12433 static int __ATTRS_o_ai vec_all_lt(vector double __a, vector double __b) {
12434   return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
12435 }
12436 #endif
12437
12438 /* vec_all_nan */
12439
12440 static int __ATTRS_o_ai vec_all_nan(vector float __a) {
12441 #ifdef __VSX__
12442   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
12443 #else
12444   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
12445 #endif
12446 }
12447
12448 #ifdef __VSX__
12449 static int __ATTRS_o_ai vec_all_nan(vector double __a) {
12450   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
12451 }
12452 #endif
12453
12454 /* vec_all_ne */
12455
12456 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12457                                    vector signed char __b) {
12458   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12459                                       (vector char)__b);
12460 }
12461
12462 static int __ATTRS_o_ai vec_all_ne(vector signed char __a,
12463                                    vector bool char __b) {
12464   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12465                                       (vector char)__b);
12466 }
12467
12468 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12469                                    vector unsigned char __b) {
12470   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12471                                       (vector char)__b);
12472 }
12473
12474 static int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
12475                                    vector bool char __b) {
12476   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12477                                       (vector char)__b);
12478 }
12479
12480 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12481                                    vector signed char __b) {
12482   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12483                                       (vector char)__b);
12484 }
12485
12486 static int __ATTRS_o_ai vec_all_ne(vector bool char __a,
12487                                    vector unsigned 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 bool char __a, vector bool char __b) {
12493   return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
12494                                       (vector char)__b);
12495 }
12496
12497 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector short __b) {
12498   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
12499 }
12500
12501 static int __ATTRS_o_ai vec_all_ne(vector short __a, vector bool short __b) {
12502   return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
12503 }
12504
12505 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12506                                    vector unsigned short __b) {
12507   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12508                                       (vector short)__b);
12509 }
12510
12511 static int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
12512                                    vector bool short __b) {
12513   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12514                                       (vector short)__b);
12515 }
12516
12517 static int __ATTRS_o_ai vec_all_ne(vector bool short __a, vector short __b) {
12518   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12519                                       (vector short)__b);
12520 }
12521
12522 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12523                                    vector unsigned short __b) {
12524   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12525                                       (vector short)__b);
12526 }
12527
12528 static int __ATTRS_o_ai vec_all_ne(vector bool short __a,
12529                                    vector bool short __b) {
12530   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12531                                       (vector short)__b);
12532 }
12533
12534 static int __ATTRS_o_ai vec_all_ne(vector pixel __a, vector pixel __b) {
12535   return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
12536                                       (vector short)__b);
12537 }
12538
12539 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
12540   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
12541 }
12542
12543 static int __ATTRS_o_ai vec_all_ne(vector int __a, vector bool int __b) {
12544   return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
12545 }
12546
12547 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12548                                    vector unsigned int __b) {
12549   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12550                                       (vector int)__b);
12551 }
12552
12553 static int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
12554                                    vector bool int __b) {
12555   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12556                                       (vector int)__b);
12557 }
12558
12559 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector int __b) {
12560   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12561                                       (vector int)__b);
12562 }
12563
12564 static int __ATTRS_o_ai vec_all_ne(vector bool int __a,
12565                                    vector unsigned int __b) {
12566   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12567                                       (vector int)__b);
12568 }
12569
12570 static int __ATTRS_o_ai vec_all_ne(vector bool int __a, vector bool int __b) {
12571   return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
12572                                       (vector int)__b);
12573 }
12574
12575 #ifdef __POWER8_VECTOR__
12576 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12577                                    vector signed long long __b) {
12578   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12579 }
12580
12581 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12582                                    vector unsigned long long __b) {
12583   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12584                                       (vector long long)__b);
12585 }
12586
12587 static int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
12588                                    vector bool long long __b) {
12589   return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12590                                       (vector signed long long)__b);
12591 }
12592
12593 static int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
12594                                    vector bool long long __b) {
12595   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12596                                       (vector signed long long)__b);
12597 }
12598
12599 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12600                                    vector signed long long __b) {
12601   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12602                                       (vector signed long long)__b);
12603 }
12604
12605 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12606                                    vector unsigned long long __b) {
12607   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12608                                       (vector signed long long)__b);
12609 }
12610
12611 static int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
12612                                    vector bool long long __b) {
12613   return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12614                                       (vector signed long long)__b);
12615 }
12616 #endif
12617
12618 static int __ATTRS_o_ai vec_all_ne(vector float __a, vector float __b) {
12619 #ifdef __VSX__
12620   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
12621 #else
12622   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
12623 #endif
12624 }
12625
12626 #ifdef __VSX__
12627 static int __ATTRS_o_ai vec_all_ne(vector double __a, vector double __b) {
12628   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
12629 }
12630 #endif
12631
12632 /* vec_all_nge */
12633
12634 static int __ATTRS_o_ai
12635 vec_all_nge(vector float __a, vector float __b) {
12636 #ifdef __VSX__
12637   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
12638 #else
12639   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
12640 #endif
12641 }
12642
12643 #ifdef __VSX__
12644 static int __ATTRS_o_ai
12645 vec_all_nge(vector double __a, vector double __b) {
12646   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
12647 }
12648 #endif
12649
12650 /* vec_all_ngt */
12651
12652 static int __ATTRS_o_ai
12653 vec_all_ngt(vector float __a, vector float __b) {
12654 #ifdef __VSX__
12655   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
12656 #else
12657   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
12658 #endif
12659 }
12660
12661 #ifdef __VSX__
12662 static int __ATTRS_o_ai
12663 vec_all_ngt(vector double __a, vector double __b) {
12664   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
12665 }
12666 #endif
12667
12668 /* vec_all_nle */
12669
12670 static int __attribute__((__always_inline__))
12671 vec_all_nle(vector float __a, vector float __b) {
12672   return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
12673 }
12674
12675 /* vec_all_nlt */
12676
12677 static int __attribute__((__always_inline__))
12678 vec_all_nlt(vector float __a, vector float __b) {
12679   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
12680 }
12681
12682 /* vec_all_numeric */
12683
12684 static int __attribute__((__always_inline__))
12685 vec_all_numeric(vector float __a) {
12686   return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
12687 }
12688
12689 /* vec_any_eq */
12690
12691 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12692                                    vector signed char __b) {
12693   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12694                                       (vector char)__b);
12695 }
12696
12697 static int __ATTRS_o_ai vec_any_eq(vector signed char __a,
12698                                    vector bool char __b) {
12699   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12700                                       (vector char)__b);
12701 }
12702
12703 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12704                                    vector unsigned char __b) {
12705   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12706                                       (vector char)__b);
12707 }
12708
12709 static int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
12710                                    vector bool char __b) {
12711   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12712                                       (vector char)__b);
12713 }
12714
12715 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12716                                    vector signed char __b) {
12717   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12718                                       (vector char)__b);
12719 }
12720
12721 static int __ATTRS_o_ai vec_any_eq(vector bool char __a,
12722                                    vector unsigned 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 bool char __a, vector bool char __b) {
12728   return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
12729                                       (vector char)__b);
12730 }
12731
12732 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector short __b) {
12733   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
12734 }
12735
12736 static int __ATTRS_o_ai vec_any_eq(vector short __a, vector bool short __b) {
12737   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
12738 }
12739
12740 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12741                                    vector unsigned short __b) {
12742   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12743                                       (vector short)__b);
12744 }
12745
12746 static int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
12747                                    vector bool short __b) {
12748   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12749                                       (vector short)__b);
12750 }
12751
12752 static int __ATTRS_o_ai vec_any_eq(vector bool short __a, vector short __b) {
12753   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12754                                       (vector short)__b);
12755 }
12756
12757 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12758                                    vector unsigned short __b) {
12759   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12760                                       (vector short)__b);
12761 }
12762
12763 static int __ATTRS_o_ai vec_any_eq(vector bool short __a,
12764                                    vector bool short __b) {
12765   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12766                                       (vector short)__b);
12767 }
12768
12769 static int __ATTRS_o_ai vec_any_eq(vector pixel __a, vector pixel __b) {
12770   return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
12771                                       (vector short)__b);
12772 }
12773
12774 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
12775   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
12776 }
12777
12778 static int __ATTRS_o_ai vec_any_eq(vector int __a, vector bool int __b) {
12779   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
12780 }
12781
12782 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12783                                    vector unsigned int __b) {
12784   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12785                                       (vector int)__b);
12786 }
12787
12788 static int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
12789                                    vector bool int __b) {
12790   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12791                                       (vector int)__b);
12792 }
12793
12794 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector int __b) {
12795   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12796                                       (vector int)__b);
12797 }
12798
12799 static int __ATTRS_o_ai vec_any_eq(vector bool int __a,
12800                                    vector unsigned int __b) {
12801   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12802                                       (vector int)__b);
12803 }
12804
12805 static int __ATTRS_o_ai vec_any_eq(vector bool int __a, vector bool int __b) {
12806   return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
12807                                       (vector int)__b);
12808 }
12809
12810 #ifdef __POWER8_VECTOR__
12811 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12812                                    vector signed long long __b) {
12813   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12814 }
12815
12816 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12817                                    vector unsigned long long __b) {
12818   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12819                                       (vector long long)__b);
12820 }
12821
12822 static int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
12823                                    vector bool long long __b) {
12824   return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12825                                       (vector signed long long)__b);
12826 }
12827
12828 static int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
12829                                    vector bool long long __b) {
12830   return __builtin_altivec_vcmpequd_p(
12831       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12832 }
12833
12834 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12835                                    vector signed long long __b) {
12836   return __builtin_altivec_vcmpequd_p(
12837       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12838 }
12839
12840 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12841                                    vector unsigned long long __b) {
12842   return __builtin_altivec_vcmpequd_p(
12843       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12844 }
12845
12846 static int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
12847                                    vector bool long long __b) {
12848   return __builtin_altivec_vcmpequd_p(
12849       __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
12850 }
12851 #endif
12852
12853 static int __ATTRS_o_ai vec_any_eq(vector float __a, vector float __b) {
12854 #ifdef __VSX__
12855   return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
12856 #else
12857   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
12858 #endif
12859 }
12860
12861 #ifdef __VSX__
12862 static int __ATTRS_o_ai vec_any_eq(vector double __a, vector double __b) {
12863   return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
12864 }
12865 #endif
12866
12867 /* vec_any_ge */
12868
12869 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12870                                    vector signed char __b) {
12871   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
12872 }
12873
12874 static int __ATTRS_o_ai vec_any_ge(vector signed char __a,
12875                                    vector bool char __b) {
12876   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
12877                                       __a);
12878 }
12879
12880 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12881                                    vector unsigned char __b) {
12882   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
12883 }
12884
12885 static int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
12886                                    vector bool char __b) {
12887   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12888                                       __a);
12889 }
12890
12891 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12892                                    vector signed char __b) {
12893   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12894                                       (vector unsigned char)__a);
12895 }
12896
12897 static int __ATTRS_o_ai vec_any_ge(vector bool char __a,
12898                                    vector unsigned char __b) {
12899   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
12900                                       (vector unsigned char)__a);
12901 }
12902
12903 static int __ATTRS_o_ai vec_any_ge(vector bool char __a, vector bool char __b) {
12904   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
12905                                       (vector unsigned char)__a);
12906 }
12907
12908 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector short __b) {
12909   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
12910 }
12911
12912 static int __ATTRS_o_ai vec_any_ge(vector short __a, vector bool short __b) {
12913   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
12914 }
12915
12916 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12917                                    vector unsigned short __b) {
12918   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
12919 }
12920
12921 static int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
12922                                    vector bool short __b) {
12923   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12924                                       __a);
12925 }
12926
12927 static int __ATTRS_o_ai vec_any_ge(vector bool short __a, vector short __b) {
12928   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12929                                       (vector unsigned short)__a);
12930 }
12931
12932 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12933                                    vector unsigned short __b) {
12934   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
12935                                       (vector unsigned short)__a);
12936 }
12937
12938 static int __ATTRS_o_ai vec_any_ge(vector bool short __a,
12939                                    vector bool short __b) {
12940   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
12941                                       (vector unsigned short)__a);
12942 }
12943
12944 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
12945   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
12946 }
12947
12948 static int __ATTRS_o_ai vec_any_ge(vector int __a, vector bool int __b) {
12949   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
12950 }
12951
12952 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12953                                    vector unsigned int __b) {
12954   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
12955 }
12956
12957 static int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
12958                                    vector bool int __b) {
12959   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12960                                       __a);
12961 }
12962
12963 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector int __b) {
12964   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12965                                       (vector unsigned int)__a);
12966 }
12967
12968 static int __ATTRS_o_ai vec_any_ge(vector bool int __a,
12969                                    vector unsigned int __b) {
12970   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
12971                                       (vector unsigned int)__a);
12972 }
12973
12974 static int __ATTRS_o_ai vec_any_ge(vector bool int __a, vector bool int __b) {
12975   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
12976                                       (vector unsigned int)__a);
12977 }
12978
12979 #ifdef __POWER8_VECTOR__
12980 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
12981                                    vector signed long long __b) {
12982   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
12983 }
12984
12985 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
12986                                    vector unsigned long long __b) {
12987   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
12988 }
12989
12990 static int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
12991                                    vector bool long long __b) {
12992   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
12993                                       (vector signed long long)__b, __a);
12994 }
12995
12996 static int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
12997                                    vector bool long long __b) {
12998   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12999                                       (vector unsigned long long)__b, __a);
13000 }
13001
13002 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13003                                    vector signed long long __b) {
13004   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13005                                       (vector unsigned long long)__b,
13006                                       (vector unsigned long long)__a);
13007 }
13008
13009 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13010                                    vector unsigned long long __b) {
13011   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
13012                                       (vector unsigned long long)__a);
13013 }
13014
13015 static int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
13016                                    vector bool long long __b) {
13017   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13018                                       (vector unsigned long long)__b,
13019                                       (vector unsigned long long)__a);
13020 }
13021 #endif
13022
13023 static int __ATTRS_o_ai vec_any_ge(vector float __a, vector float __b) {
13024 #ifdef __VSX__
13025   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
13026 #else
13027   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
13028 #endif
13029 }
13030
13031 #ifdef __VSX__
13032 static int __ATTRS_o_ai vec_any_ge(vector double __a, vector double __b) {
13033   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
13034 }
13035 #endif
13036
13037 /* vec_any_gt */
13038
13039 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13040                                    vector signed char __b) {
13041   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
13042 }
13043
13044 static int __ATTRS_o_ai vec_any_gt(vector signed char __a,
13045                                    vector bool char __b) {
13046   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
13047                                       (vector signed char)__b);
13048 }
13049
13050 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13051                                    vector unsigned char __b) {
13052   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
13053 }
13054
13055 static int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
13056                                    vector bool char __b) {
13057   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
13058                                       (vector unsigned char)__b);
13059 }
13060
13061 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13062                                    vector signed char __b) {
13063   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13064                                       (vector unsigned char)__b);
13065 }
13066
13067 static int __ATTRS_o_ai vec_any_gt(vector bool char __a,
13068                                    vector unsigned char __b) {
13069   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13070                                       __b);
13071 }
13072
13073 static int __ATTRS_o_ai vec_any_gt(vector bool char __a, vector bool char __b) {
13074   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
13075                                       (vector unsigned char)__b);
13076 }
13077
13078 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector short __b) {
13079   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
13080 }
13081
13082 static int __ATTRS_o_ai vec_any_gt(vector short __a, vector bool short __b) {
13083   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
13084 }
13085
13086 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13087                                    vector unsigned short __b) {
13088   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
13089 }
13090
13091 static int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
13092                                    vector bool short __b) {
13093   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
13094                                       (vector unsigned short)__b);
13095 }
13096
13097 static int __ATTRS_o_ai vec_any_gt(vector bool short __a, vector short __b) {
13098   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13099                                       (vector unsigned short)__b);
13100 }
13101
13102 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13103                                    vector unsigned short __b) {
13104   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13105                                       __b);
13106 }
13107
13108 static int __ATTRS_o_ai vec_any_gt(vector bool short __a,
13109                                    vector bool short __b) {
13110   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
13111                                       (vector unsigned short)__b);
13112 }
13113
13114 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
13115   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
13116 }
13117
13118 static int __ATTRS_o_ai vec_any_gt(vector int __a, vector bool int __b) {
13119   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
13120 }
13121
13122 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13123                                    vector unsigned int __b) {
13124   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
13125 }
13126
13127 static int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
13128                                    vector bool int __b) {
13129   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
13130                                       (vector unsigned int)__b);
13131 }
13132
13133 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector int __b) {
13134   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13135                                       (vector unsigned int)__b);
13136 }
13137
13138 static int __ATTRS_o_ai vec_any_gt(vector bool int __a,
13139                                    vector unsigned int __b) {
13140   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13141                                       __b);
13142 }
13143
13144 static int __ATTRS_o_ai vec_any_gt(vector bool int __a, vector bool int __b) {
13145   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
13146                                       (vector unsigned int)__b);
13147 }
13148
13149 #ifdef __POWER8_VECTOR__
13150 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13151                                    vector signed long long __b) {
13152   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
13153 }
13154
13155 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13156                                    vector unsigned long long __b) {
13157   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
13158 }
13159
13160 static int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
13161                                    vector bool long long __b) {
13162   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
13163                                       (vector signed long long)__b);
13164 }
13165
13166 static int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
13167                                    vector bool long long __b) {
13168   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
13169                                       (vector unsigned long long)__b);
13170 }
13171
13172 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13173                                    vector signed long long __b) {
13174   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13175                                       (vector unsigned long long)__a,
13176                                       (vector unsigned long long)__b);
13177 }
13178
13179 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13180                                    vector unsigned long long __b) {
13181   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13182                                       (vector unsigned long long)__a, __b);
13183 }
13184
13185 static int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
13186                                    vector bool long long __b) {
13187   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13188                                       (vector unsigned long long)__a,
13189                                       (vector unsigned long long)__b);
13190 }
13191 #endif
13192
13193 static int __ATTRS_o_ai vec_any_gt(vector float __a, vector float __b) {
13194 #ifdef __VSX__
13195   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
13196 #else
13197   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
13198 #endif
13199 }
13200
13201 #ifdef __VSX__
13202 static int __ATTRS_o_ai vec_any_gt(vector double __a, vector double __b) {
13203   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
13204 }
13205 #endif
13206
13207 /* vec_any_le */
13208
13209 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
13210                                    vector signed char __b) {
13211   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
13212 }
13213
13214 static int __ATTRS_o_ai vec_any_le(vector signed char __a,
13215                                    vector bool char __b) {
13216   return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
13217                                       (vector signed char)__b);
13218 }
13219
13220 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13221                                    vector unsigned char __b) {
13222   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
13223 }
13224
13225 static int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
13226                                    vector bool char __b) {
13227   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
13228                                       (vector unsigned char)__b);
13229 }
13230
13231 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
13232                                    vector signed char __b) {
13233   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13234                                       (vector unsigned char)__b);
13235 }
13236
13237 static int __ATTRS_o_ai vec_any_le(vector bool char __a,
13238                                    vector unsigned char __b) {
13239   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13240                                       __b);
13241 }
13242
13243 static int __ATTRS_o_ai vec_any_le(vector bool char __a, vector bool char __b) {
13244   return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
13245                                       (vector unsigned char)__b);
13246 }
13247
13248 static int __ATTRS_o_ai vec_any_le(vector short __a, vector short __b) {
13249   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
13250 }
13251
13252 static int __ATTRS_o_ai vec_any_le(vector short __a, vector bool short __b) {
13253   return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
13254 }
13255
13256 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13257                                    vector unsigned short __b) {
13258   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
13259 }
13260
13261 static int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
13262                                    vector bool short __b) {
13263   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
13264                                       (vector unsigned short)__b);
13265 }
13266
13267 static int __ATTRS_o_ai vec_any_le(vector bool short __a, vector short __b) {
13268   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13269                                       (vector unsigned short)__b);
13270 }
13271
13272 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
13273                                    vector unsigned short __b) {
13274   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13275                                       __b);
13276 }
13277
13278 static int __ATTRS_o_ai vec_any_le(vector bool short __a,
13279                                    vector bool short __b) {
13280   return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
13281                                       (vector unsigned short)__b);
13282 }
13283
13284 static int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
13285   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
13286 }
13287
13288 static int __ATTRS_o_ai vec_any_le(vector int __a, vector bool int __b) {
13289   return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
13290 }
13291
13292 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13293                                    vector unsigned int __b) {
13294   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
13295 }
13296
13297 static int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
13298                                    vector bool int __b) {
13299   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
13300                                       (vector unsigned int)__b);
13301 }
13302
13303 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector int __b) {
13304   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13305                                       (vector unsigned int)__b);
13306 }
13307
13308 static int __ATTRS_o_ai vec_any_le(vector bool int __a,
13309                                    vector unsigned int __b) {
13310   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13311                                       __b);
13312 }
13313
13314 static int __ATTRS_o_ai vec_any_le(vector bool int __a, vector bool int __b) {
13315   return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
13316                                       (vector unsigned int)__b);
13317 }
13318
13319 #ifdef __POWER8_VECTOR__
13320 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13321                                    vector signed long long __b) {
13322   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
13323 }
13324
13325 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13326                                    vector unsigned long long __b) {
13327   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
13328 }
13329
13330 static int __ATTRS_o_ai vec_any_le(vector signed long long __a,
13331                                    vector bool long long __b) {
13332   return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
13333                                       (vector signed long long)__b);
13334 }
13335
13336 static int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
13337                                    vector bool long long __b) {
13338   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
13339                                       (vector unsigned long long)__b);
13340 }
13341
13342 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13343                                    vector signed long long __b) {
13344   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13345                                       (vector unsigned long long)__a,
13346                                       (vector unsigned long long)__b);
13347 }
13348
13349 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13350                                    vector unsigned long long __b) {
13351   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13352                                       (vector unsigned long long)__a, __b);
13353 }
13354
13355 static int __ATTRS_o_ai vec_any_le(vector bool long long __a,
13356                                    vector bool long long __b) {
13357   return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
13358                                       (vector unsigned long long)__a,
13359                                       (vector unsigned long long)__b);
13360 }
13361 #endif
13362
13363 static int __ATTRS_o_ai vec_any_le(vector float __a, vector float __b) {
13364 #ifdef __VSX__
13365   return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
13366 #else
13367   return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
13368 #endif
13369 }
13370
13371 #ifdef __VSX__
13372 static int __ATTRS_o_ai vec_any_le(vector double __a, vector double __b) {
13373   return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
13374 }
13375 #endif
13376
13377 /* vec_any_lt */
13378
13379 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13380                                    vector signed char __b) {
13381   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
13382 }
13383
13384 static int __ATTRS_o_ai vec_any_lt(vector signed char __a,
13385                                    vector bool char __b) {
13386   return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
13387                                       __a);
13388 }
13389
13390 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13391                                    vector unsigned char __b) {
13392   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
13393 }
13394
13395 static int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
13396                                    vector bool char __b) {
13397   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13398                                       __a);
13399 }
13400
13401 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13402                                    vector signed char __b) {
13403   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13404                                       (vector unsigned char)__a);
13405 }
13406
13407 static int __ATTRS_o_ai vec_any_lt(vector bool char __a,
13408                                    vector unsigned char __b) {
13409   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
13410                                       (vector unsigned char)__a);
13411 }
13412
13413 static int __ATTRS_o_ai vec_any_lt(vector bool char __a, vector bool char __b) {
13414   return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
13415                                       (vector unsigned char)__a);
13416 }
13417
13418 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector short __b) {
13419   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
13420 }
13421
13422 static int __ATTRS_o_ai vec_any_lt(vector short __a, vector bool short __b) {
13423   return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
13424 }
13425
13426 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13427                                    vector unsigned short __b) {
13428   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
13429 }
13430
13431 static int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
13432                                    vector bool short __b) {
13433   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13434                                       __a);
13435 }
13436
13437 static int __ATTRS_o_ai vec_any_lt(vector bool short __a, vector short __b) {
13438   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13439                                       (vector unsigned short)__a);
13440 }
13441
13442 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13443                                    vector unsigned short __b) {
13444   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
13445                                       (vector unsigned short)__a);
13446 }
13447
13448 static int __ATTRS_o_ai vec_any_lt(vector bool short __a,
13449                                    vector bool short __b) {
13450   return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
13451                                       (vector unsigned short)__a);
13452 }
13453
13454 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
13455   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
13456 }
13457
13458 static int __ATTRS_o_ai vec_any_lt(vector int __a, vector bool int __b) {
13459   return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
13460 }
13461
13462 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13463                                    vector unsigned int __b) {
13464   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
13465 }
13466
13467 static int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
13468                                    vector bool int __b) {
13469   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13470                                       __a);
13471 }
13472
13473 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector int __b) {
13474   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13475                                       (vector unsigned int)__a);
13476 }
13477
13478 static int __ATTRS_o_ai vec_any_lt(vector bool int __a,
13479                                    vector unsigned int __b) {
13480   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
13481                                       (vector unsigned int)__a);
13482 }
13483
13484 static int __ATTRS_o_ai vec_any_lt(vector bool int __a, vector bool int __b) {
13485   return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
13486                                       (vector unsigned int)__a);
13487 }
13488
13489 #ifdef __POWER8_VECTOR__
13490 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13491                                    vector signed long long __b) {
13492   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13493 }
13494
13495 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13496                                    vector unsigned long long __b) {
13497   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13498 }
13499
13500 static int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
13501                                    vector bool long long __b) {
13502   return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13503                                       (vector signed long long)__b, __a);
13504 }
13505
13506 static int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
13507                                    vector bool long long __b) {
13508   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13509                                       (vector unsigned long long)__b, __a);
13510 }
13511
13512 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13513                                    vector signed long long __b) {
13514   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13515                                       (vector unsigned long long)__b,
13516                                       (vector unsigned long long)__a);
13517 }
13518
13519 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13520                                    vector unsigned long long __b) {
13521   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13522                                       (vector unsigned long long)__a);
13523 }
13524
13525 static int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
13526                                    vector bool long long __b) {
13527   return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13528                                       (vector unsigned long long)__b,
13529                                       (vector unsigned long long)__a);
13530 }
13531 #endif
13532
13533 static int __ATTRS_o_ai vec_any_lt(vector float __a, vector float __b) {
13534 #ifdef __VSX__
13535   return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
13536 #else
13537   return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
13538 #endif
13539 }
13540
13541 #ifdef __VSX__
13542 static int __ATTRS_o_ai vec_any_lt(vector double __a, vector double __b) {
13543   return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
13544 }
13545 #endif
13546
13547 /* vec_any_nan */
13548
13549 static int __attribute__((__always_inline__)) vec_any_nan(vector float __a) {
13550   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
13551 }
13552
13553 /* vec_any_ne */
13554
13555 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13556                                    vector signed char __b) {
13557   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13558                                       (vector char)__b);
13559 }
13560
13561 static int __ATTRS_o_ai vec_any_ne(vector signed char __a,
13562                                    vector bool char __b) {
13563   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13564                                       (vector char)__b);
13565 }
13566
13567 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13568                                    vector unsigned char __b) {
13569   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13570                                       (vector char)__b);
13571 }
13572
13573 static int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
13574                                    vector bool char __b) {
13575   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13576                                       (vector char)__b);
13577 }
13578
13579 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13580                                    vector signed char __b) {
13581   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13582                                       (vector char)__b);
13583 }
13584
13585 static int __ATTRS_o_ai vec_any_ne(vector bool char __a,
13586                                    vector unsigned 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 bool char __a, vector bool char __b) {
13592   return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
13593                                       (vector char)__b);
13594 }
13595
13596 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector short __b) {
13597   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
13598 }
13599
13600 static int __ATTRS_o_ai vec_any_ne(vector short __a, vector bool short __b) {
13601   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
13602 }
13603
13604 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13605                                    vector unsigned short __b) {
13606   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13607                                       (vector short)__b);
13608 }
13609
13610 static int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
13611                                    vector bool short __b) {
13612   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13613                                       (vector short)__b);
13614 }
13615
13616 static int __ATTRS_o_ai vec_any_ne(vector bool short __a, vector short __b) {
13617   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13618                                       (vector short)__b);
13619 }
13620
13621 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13622                                    vector unsigned short __b) {
13623   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13624                                       (vector short)__b);
13625 }
13626
13627 static int __ATTRS_o_ai vec_any_ne(vector bool short __a,
13628                                    vector bool short __b) {
13629   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13630                                       (vector short)__b);
13631 }
13632
13633 static int __ATTRS_o_ai vec_any_ne(vector pixel __a, vector pixel __b) {
13634   return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
13635                                       (vector short)__b);
13636 }
13637
13638 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
13639   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
13640 }
13641
13642 static int __ATTRS_o_ai vec_any_ne(vector int __a, vector bool int __b) {
13643   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
13644 }
13645
13646 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13647                                    vector unsigned int __b) {
13648   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13649                                       (vector int)__b);
13650 }
13651
13652 static int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
13653                                    vector bool int __b) {
13654   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13655                                       (vector int)__b);
13656 }
13657
13658 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector int __b) {
13659   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13660                                       (vector int)__b);
13661 }
13662
13663 static int __ATTRS_o_ai vec_any_ne(vector bool int __a,
13664                                    vector unsigned int __b) {
13665   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13666                                       (vector int)__b);
13667 }
13668
13669 static int __ATTRS_o_ai vec_any_ne(vector bool int __a, vector bool int __b) {
13670   return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
13671                                       (vector int)__b);
13672 }
13673
13674 #ifdef __POWER8_VECTOR__
13675 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13676                                    vector signed long long __b) {
13677   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13678 }
13679
13680 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13681                                    vector unsigned long long __b) {
13682   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13683                                       (vector long long)__b);
13684 }
13685
13686 static int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
13687                                    vector bool long long __b) {
13688   return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13689                                       (vector signed long long)__b);
13690 }
13691
13692 static int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
13693                                    vector bool long long __b) {
13694   return __builtin_altivec_vcmpequd_p(
13695       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13696 }
13697
13698 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13699                                    vector signed long long __b) {
13700   return __builtin_altivec_vcmpequd_p(
13701       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13702 }
13703
13704 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13705                                    vector unsigned long long __b) {
13706   return __builtin_altivec_vcmpequd_p(
13707       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13708 }
13709
13710 static int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
13711                                    vector bool long long __b) {
13712   return __builtin_altivec_vcmpequd_p(
13713       __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
13714 }
13715 #endif
13716
13717 static int __ATTRS_o_ai vec_any_ne(vector float __a, vector float __b) {
13718 #ifdef __VSX__
13719   return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
13720 #else
13721   return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
13722 #endif
13723 }
13724
13725 #ifdef __VSX__
13726 static int __ATTRS_o_ai vec_any_ne(vector double __a, vector double __b) {
13727   return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
13728 }
13729 #endif
13730
13731 /* vec_any_nge */
13732
13733 static int __attribute__((__always_inline__))
13734 vec_any_nge(vector float __a, vector float __b) {
13735   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
13736 }
13737
13738 /* vec_any_ngt */
13739
13740 static int __attribute__((__always_inline__))
13741 vec_any_ngt(vector float __a, vector float __b) {
13742   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
13743 }
13744
13745 /* vec_any_nle */
13746
13747 static int __attribute__((__always_inline__))
13748 vec_any_nle(vector float __a, vector float __b) {
13749   return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
13750 }
13751
13752 /* vec_any_nlt */
13753
13754 static int __attribute__((__always_inline__))
13755 vec_any_nlt(vector float __a, vector float __b) {
13756   return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
13757 }
13758
13759 /* vec_any_numeric */
13760
13761 static int __attribute__((__always_inline__))
13762 vec_any_numeric(vector float __a) {
13763   return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
13764 }
13765
13766 /* vec_any_out */
13767
13768 static int __attribute__((__always_inline__))
13769 vec_any_out(vector float __a, vector float __b) {
13770   return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
13771 }
13772
13773 /* Power 8 Crypto functions
13774 Note: We diverge from the current GCC implementation with regard
13775 to cryptography and related functions as follows:
13776 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13777 - The remaining ones are only available on Power8 and up so
13778   require -mpower8-vector
13779 The justification for this is that export requirements require that
13780 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13781 support). As a result, we need to be able to turn off support for those.
13782 The remaining ones (currently controlled by -mcrypto for GCC) still
13783 need to be provided on compliant hardware even if Vector.Crypto is not
13784 provided.
13785 */
13786 #ifdef __CRYPTO__
13787 #define vec_sbox_be __builtin_altivec_crypto_vsbox
13788 #define vec_cipher_be __builtin_altivec_crypto_vcipher
13789 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
13790 #define vec_ncipher_be __builtin_altivec_crypto_vncipher
13791 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
13792
13793 static vector unsigned long long __attribute__((__always_inline__))
13794 __builtin_crypto_vsbox(vector unsigned long long __a) {
13795   return __builtin_altivec_crypto_vsbox(__a);
13796 }
13797
13798 static vector unsigned long long __attribute__((__always_inline__))
13799 __builtin_crypto_vcipher(vector unsigned long long __a,
13800                          vector unsigned long long __b) {
13801   return __builtin_altivec_crypto_vcipher(__a, __b);
13802 }
13803
13804 static vector unsigned long long __attribute__((__always_inline__))
13805 __builtin_crypto_vcipherlast(vector unsigned long long __a,
13806                              vector unsigned long long __b) {
13807   return __builtin_altivec_crypto_vcipherlast(__a, __b);
13808 }
13809
13810 static vector unsigned long long __attribute__((__always_inline__))
13811 __builtin_crypto_vncipher(vector unsigned long long __a,
13812                           vector unsigned long long __b) {
13813   return __builtin_altivec_crypto_vncipher(__a, __b);
13814 }
13815
13816 static vector unsigned long long __attribute__((__always_inline__))
13817 __builtin_crypto_vncipherlast(vector unsigned long long __a,
13818                               vector unsigned long long __b) {
13819   return __builtin_altivec_crypto_vncipherlast(__a, __b);
13820 }
13821
13822 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13823 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13824
13825 #define vec_shasigma_be(X, Y, Z) \
13826   _Generic((X), vector unsigned int: __builtin_crypto_vshasigmaw, \
13827                 vector unsigned long long: __builtin_crypto_vshasigmad) \
13828 ((X), (Y), (Z))
13829 #endif
13830
13831 #ifdef __POWER8_VECTOR__
13832 static vector unsigned char __ATTRS_o_ai
13833 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
13834                           vector unsigned char __c) {
13835   return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13836 }
13837
13838 static vector unsigned short __ATTRS_o_ai
13839 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
13840                           vector unsigned short __c) {
13841   return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
13842       (vector unsigned char)__a, (vector unsigned char)__b,
13843       (vector unsigned char)__c);
13844 }
13845
13846 static vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
13847     vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
13848   return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
13849       (vector unsigned char)__a, (vector unsigned char)__b,
13850       (vector unsigned char)__c);
13851 }
13852
13853 static vector unsigned long long __ATTRS_o_ai __builtin_crypto_vpermxor(
13854     vector unsigned long long __a, vector unsigned long long __b,
13855     vector unsigned long long __c) {
13856   return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
13857       (vector unsigned char)__a, (vector unsigned char)__b,
13858       (vector unsigned char)__c);
13859 }
13860
13861 static vector unsigned char __ATTRS_o_ai
13862 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
13863   return __builtin_altivec_crypto_vpmsumb(__a, __b);
13864 }
13865
13866 static vector unsigned short __ATTRS_o_ai
13867 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
13868   return __builtin_altivec_crypto_vpmsumh(__a, __b);
13869 }
13870
13871 static vector unsigned int __ATTRS_o_ai
13872 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
13873   return __builtin_altivec_crypto_vpmsumw(__a, __b);
13874 }
13875
13876 static vector unsigned long long __ATTRS_o_ai
13877 __builtin_crypto_vpmsumb(vector unsigned long long __a,
13878                          vector unsigned long long __b) {
13879   return __builtin_altivec_crypto_vpmsumd(__a, __b);
13880 }
13881
13882 static vector signed char __ATTRS_o_ai vec_vgbbd (vector signed char __a)
13883 {
13884   return __builtin_altivec_vgbbd((vector unsigned char) __a);
13885 }
13886
13887 #define vec_pmsum_be __builtin_crypto_vpmsumb
13888 #define vec_gb __builtin_altivec_vgbbd
13889
13890 static vector unsigned char __ATTRS_o_ai vec_vgbbd (vector unsigned char __a)
13891 {
13892   return __builtin_altivec_vgbbd(__a);
13893 }
13894
13895 static vector long long __ATTRS_o_ai
13896 vec_vbpermq (vector signed char __a, vector signed char __b)
13897 {
13898   return __builtin_altivec_vbpermq((vector unsigned char) __a,
13899                                    (vector unsigned char) __b);
13900 }
13901
13902 static vector long long __ATTRS_o_ai
13903 vec_vbpermq (vector unsigned char __a, vector unsigned char __b)
13904 {
13905   return __builtin_altivec_vbpermq(__a, __b);
13906 }
13907
13908 #ifdef __powerpc64__
13909 static vector unsigned long long __attribute__((__always_inline__))
13910 vec_bperm (vector unsigned __int128 __a, vector unsigned char __b) {
13911   return __builtin_altivec_vbpermq((vector unsigned char) __a,
13912                                    (vector unsigned char) __b);
13913 }
13914 #endif
13915 #endif
13916
13917 #undef __ATTRS_o_ai
13918
13919 #endif /* __ALTIVEC_H */