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